mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
Fix updating dependency not cloning and re-building (#18708)
This commit is contained in:
@@ -2,8 +2,15 @@
|
||||
|
||||
import { spawn as nodeSpawn } from "node:child_process";
|
||||
import { existsSync, readFileSync, mkdirSync, cpSync, chmodSync } from "node:fs";
|
||||
import { basename, join, resolve } from "node:path";
|
||||
import { isCI, printEnvironment, startGroup } from "./utils.mjs";
|
||||
import { basename, join, relative, resolve } from "node:path";
|
||||
import {
|
||||
formatAnnotationToHtml,
|
||||
isCI,
|
||||
parseAnnotations,
|
||||
printEnvironment,
|
||||
reportAnnotationToBuildKite,
|
||||
startGroup,
|
||||
} from "./utils.mjs";
|
||||
|
||||
// https://cmake.org/cmake/help/latest/manual/cmake.1.html#generate-a-project-buildsystem
|
||||
const generateFlags = [
|
||||
@@ -222,16 +229,24 @@ async function spawn(command, args, options, label) {
|
||||
timestamp = Date.now();
|
||||
});
|
||||
|
||||
let stdoutBuffer = "";
|
||||
|
||||
let done;
|
||||
if (pipe) {
|
||||
const stdout = new Promise(resolve => {
|
||||
subprocess.stdout.on("end", resolve);
|
||||
subprocess.stdout.on("data", data => process.stdout.write(data));
|
||||
subprocess.stdout.on("data", data => {
|
||||
stdoutBuffer += data.toString();
|
||||
process.stdout.write(data);
|
||||
});
|
||||
});
|
||||
|
||||
const stderr = new Promise(resolve => {
|
||||
subprocess.stderr.on("end", resolve);
|
||||
subprocess.stderr.on("data", data => process.stderr.write(data));
|
||||
subprocess.stderr.on("data", data => {
|
||||
stdoutBuffer += data.toString();
|
||||
process.stderr.write(data);
|
||||
});
|
||||
});
|
||||
|
||||
done = Promise.all([stdout, stderr]);
|
||||
@@ -252,9 +267,38 @@ async function spawn(command, args, options, label) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else if (signalCode) {
|
||||
let annotated;
|
||||
try {
|
||||
const { annotations } = parseAnnotations(stdoutBuffer);
|
||||
for (const annotation of annotations) {
|
||||
const content = formatAnnotationToHtml(annotation);
|
||||
reportAnnotationToBuildKite({
|
||||
priority: 10,
|
||||
label: annotation.title || annotation.filename,
|
||||
content,
|
||||
});
|
||||
annotated = true;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`Failed to parse annotations:`, error);
|
||||
}
|
||||
|
||||
if (!annotated) {
|
||||
const content = formatAnnotationToHtml({
|
||||
filename: relative(process.cwd(), import.meta.filename),
|
||||
title: "build failed",
|
||||
content: stdoutBuffer,
|
||||
source: "build",
|
||||
level: "error",
|
||||
});
|
||||
reportAnnotationToBuildKite({
|
||||
priority: 10,
|
||||
label: "build failed",
|
||||
content,
|
||||
});
|
||||
}
|
||||
|
||||
if (signalCode) {
|
||||
console.error(`Command killed: ${signalCode}`);
|
||||
} else {
|
||||
console.error(`Command exited: code ${exitCode}`);
|
||||
|
||||
Reference in New Issue
Block a user