fix: Correctly find artifact when crate has multiple types
fix: Correctly find artifact when crate has multiple types
Resolves:
@@ -62,28 +62,25 @@ You can find instructions for installing Rust and Cargo at:
function processCargoBuildLine(options, copied, line) {
const data = JSON.parse(line);
+ const { filenames, reason, target } = data;
- if (!data || data.reason !== "compiler-artifact" || !data.target) {
+ if (!data || reason !== "compiler-artifact" || !target) {
return;
}
const { kind: kinds, name } = data.target;
- if (!Array.isArray(kinds) || !kinds.length) {
+ if (!Array.isArray(kinds) || !Array.isArray(filenames)) {
return;
}
- const [kind] = kinds;
+ // `kind` and `filenames` zip up as key/value pairs
+ kinds.forEach((kind, i) => {
+ const filename = filenames[i];
const key = getArtifactName({ artifactType: kind, crateName: name });
const outputFiles = options.artifacts[key];
- if (!outputFiles || !Array.isArray(data.filenames)) {
- return;
- }
-
- const [filename] = data.filenames;
-
- if (!filename) {
+ if (!outputFiles || !filename) {
return;
}
@@ -96,6 +93,7 @@ function processCargoBuildLine(options, copied, line) {
process.exitCode = 1;
console.error(err);
});
+ });
}
async function isNewer(filename, outputFile) {
