зеркало из https://github.com/microsoft/rnx-kit.git
fix(cli): always write output when on CI (#3349)
This commit is contained in:
Родитель
846177876a
Коммит
b6a18d9fea
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"@rnx-kit/cli": patch
|
||||
---
|
||||
|
||||
Always write output when on CI
|
|
@ -148,7 +148,7 @@ jobs:
|
|||
- name: Build iOS app
|
||||
if: ${{ steps.affected-projects.outputs.ios != '' }}
|
||||
run: |
|
||||
yarn build:ios
|
||||
yarn build:ios | xcbeautify
|
||||
working-directory: packages/test-app
|
||||
build-website:
|
||||
name: "Build the website"
|
||||
|
|
|
@ -20,9 +20,7 @@ export function buildAndroid(
|
|||
}
|
||||
|
||||
return import("@rnx-kit/tools-android").then(({ assemble }) => {
|
||||
return new Promise<BuildResult>((resolve) => {
|
||||
const gradle = assemble(sourceDir, buildParams);
|
||||
watch(gradle, logger, () => resolve(sourceDir), resolve);
|
||||
});
|
||||
const gradle = assemble(sourceDir, buildParams);
|
||||
return watch(gradle, logger, () => sourceDir);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -15,12 +15,8 @@ export function runBuild(
|
|||
logger: Ora
|
||||
): Promise<BuildResult> {
|
||||
return import("@rnx-kit/tools-apple").then(({ xcodebuild }) => {
|
||||
return new Promise<BuildResult>((resolve) => {
|
||||
const onSuccess = () => resolve({ xcworkspace, args: build.spawnargs });
|
||||
const build = xcodebuild(xcworkspace, buildParams, (text) => {
|
||||
logger.info(text);
|
||||
});
|
||||
watch(build, logger, onSuccess, resolve);
|
||||
});
|
||||
const log = (message: string) => logger.info(message);
|
||||
const build = xcodebuild(xcworkspace, buildParams, log);
|
||||
return watch(build, logger, () => ({ xcworkspace, args: build.spawnargs }));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,28 +1,37 @@
|
|||
import type { ChildProcessWithoutNullStreams } from "node:child_process";
|
||||
import type { Ora } from "ora";
|
||||
|
||||
export function watch(
|
||||
export type ExitCode = number | null;
|
||||
|
||||
export function watch<T>(
|
||||
subproc: ChildProcessWithoutNullStreams,
|
||||
logger: Ora,
|
||||
onSuccess: () => void,
|
||||
onFail: (exitCode: number | null) => void
|
||||
onSuccess: () => T
|
||||
) {
|
||||
subproc.stdout.on("data", () => (logger.text += "."));
|
||||
return new Promise<T | ExitCode>((resolve) => {
|
||||
const errors: Buffer[] = [];
|
||||
|
||||
const errors: Buffer[] = [];
|
||||
subproc.stderr.on("data", (data) => errors.push(data));
|
||||
|
||||
subproc.on("close", (code) => {
|
||||
if (code === 0) {
|
||||
logger.succeed("Build succeeded");
|
||||
onSuccess();
|
||||
const isCI = Boolean(process.env.CI);
|
||||
if (isCI) {
|
||||
subproc.stdout.on("data", (chunk) => process.stdout.write(chunk));
|
||||
subproc.stderr.on("data", (chunk) => process.stderr.write(chunk));
|
||||
} else {
|
||||
logger.fail(Buffer.concat(errors).toString());
|
||||
process.exitCode = code ?? 1;
|
||||
onFail(code);
|
||||
subproc.stdout.on("data", () => (logger.text += "."));
|
||||
subproc.stderr.on("data", (data) => errors.push(data));
|
||||
}
|
||||
});
|
||||
|
||||
logger.info(`Command: ${subproc.spawnargs.join(" ")}`);
|
||||
logger.start("Building");
|
||||
subproc.on("close", (code) => {
|
||||
if (code === 0) {
|
||||
logger.succeed("Build succeeded");
|
||||
resolve(onSuccess());
|
||||
} else {
|
||||
logger.fail(Buffer.concat(errors).toString());
|
||||
process.exitCode = code ?? 1;
|
||||
resolve(code);
|
||||
}
|
||||
});
|
||||
|
||||
logger.info(`Command: ${subproc.spawnargs.join(" ")}`);
|
||||
logger.start("Building");
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,14 +1,33 @@
|
|||
import type { Command } from "@react-native-community/cli-types";
|
||||
import { alignDepsCommand } from "@rnx-kit/align-deps";
|
||||
import { writeThirdPartyNoticesCommand } from "@rnx-kit/third-party-notices";
|
||||
import { rnxBuildCommand } from "./build";
|
||||
import { rnxBundleCommand } from "./bundle";
|
||||
import { rnxCleanCommand } from "./clean";
|
||||
import { rnxCopyAssetsCommand } from "./copy-assets";
|
||||
import { rnxRamBundleCommand } from "./ram-bundle";
|
||||
import { rnxRunCommand } from "./run";
|
||||
import { rnxStartCommand } from "./start";
|
||||
import { rnxTestCommand } from "./test";
|
||||
import { rnxBuild, rnxBuildCommand } from "./build";
|
||||
import { rnxBundle, rnxBundleCommand } from "./bundle";
|
||||
import { rnxClean, rnxCleanCommand } from "./clean";
|
||||
import { copyProjectAssets, rnxCopyAssetsCommand } from "./copy-assets";
|
||||
import { rnxRamBundle, rnxRamBundleCommand } from "./ram-bundle";
|
||||
import { rnxRun, rnxRunCommand } from "./run";
|
||||
import { rnxStart, rnxStartCommand } from "./start";
|
||||
import { rnxTest, rnxTestCommand } from "./test";
|
||||
|
||||
export {
|
||||
copyProjectAssets,
|
||||
rnxBuild,
|
||||
rnxBuildCommand,
|
||||
rnxBundle,
|
||||
rnxBundleCommand,
|
||||
rnxClean,
|
||||
rnxCleanCommand,
|
||||
rnxCopyAssetsCommand,
|
||||
rnxRamBundle,
|
||||
rnxRamBundleCommand,
|
||||
rnxRun,
|
||||
rnxRunCommand,
|
||||
rnxStart,
|
||||
rnxStartCommand,
|
||||
rnxTest,
|
||||
rnxTestCommand,
|
||||
};
|
||||
|
||||
export const reactNativeConfig = {
|
||||
commands: [
|
||||
|
@ -32,12 +51,3 @@ export const rnxAlignDepsCommand = alignDepsCommand;
|
|||
// @rnx-kit/third-party-notices
|
||||
export const rnxWriteThirdPartyNotices = writeThirdPartyNoticesCommand.func;
|
||||
export const rnxWriteThirdPartyNoticesCommand = writeThirdPartyNoticesCommand;
|
||||
|
||||
export { rnxBuild, rnxBuildCommand } from "./build";
|
||||
export { rnxBundle, rnxBundleCommand } from "./bundle";
|
||||
export { rnxClean, rnxCleanCommand } from "./clean";
|
||||
export { copyProjectAssets, rnxCopyAssetsCommand } from "./copy-assets";
|
||||
export { rnxRamBundle, rnxRamBundleCommand } from "./ram-bundle";
|
||||
export { rnxRun, rnxRunCommand } from "./run";
|
||||
export { rnxStart, rnxStartCommand } from "./start";
|
||||
export { rnxTest, rnxTestCommand } from "./test";
|
||||
|
|
|
@ -1455,7 +1455,7 @@ PODS:
|
|||
- React-logger (= 0.75.2)
|
||||
- React-perflogger (= 0.75.2)
|
||||
- React-utils (= 0.75.2)
|
||||
- ReactNativeHost (0.4.12):
|
||||
- ReactNativeHost (0.5.0):
|
||||
- DoubleConversion
|
||||
- glog
|
||||
- RCT-Folly (= 2024.01.01.00)
|
||||
|
@ -1481,10 +1481,10 @@ PODS:
|
|||
- ReactTestApp-DevSupport (3.9.7):
|
||||
- React-Core
|
||||
- React-jsi
|
||||
- ReactTestApp-MSAL (3.0.3):
|
||||
- ReactTestApp-MSAL (4.0.0):
|
||||
- MSAL
|
||||
- ReactTestApp-Resources (1.0.0-dev)
|
||||
- RNWWebStorage (0.2.8):
|
||||
- RNWWebStorage (0.3.0):
|
||||
- DoubleConversion
|
||||
- glog
|
||||
- RCT-Folly (= 2024.01.01.00)
|
||||
|
@ -1505,7 +1505,7 @@ PODS:
|
|||
- ReactCommon/turbomodule/bridging
|
||||
- ReactCommon/turbomodule/core
|
||||
- Yoga
|
||||
- RNXAuth (0.2.6):
|
||||
- RNXAuth (0.3.0):
|
||||
- React-Core
|
||||
- SocketRocket (0.7.0)
|
||||
- Yoga (0.0.0)
|
||||
|
@ -1782,12 +1782,12 @@ SPEC CHECKSUMS:
|
|||
React-utils: 87f64cff8c1fe244bf688a7a48395a70eb61a509
|
||||
ReactCodegen: f8ed6f835a2fffe2a3666dfbce5ff1b120f24982
|
||||
ReactCommon: a33f215e2ca23410f8f44b0a94ab93120882e5e5
|
||||
ReactNativeHost: 1648deef337f0967092821c3c4b860eacc55f473
|
||||
ReactNativeHost: a3cd2bc15b6deac7439318607ce5637d8a93a117
|
||||
ReactTestApp-DevSupport: 74676edd899013becce4eaecc5eabba1fc51e26e
|
||||
ReactTestApp-MSAL: 9d7c1ba83a38c0c314546f3396c22f9ae7550312
|
||||
ReactTestApp-MSAL: a7ac8e821fce95fc4e27cd91cf2a931b277ffef3
|
||||
ReactTestApp-Resources: a4cc1f968cd26bdbd18ee0bfbd0ab8dd0ea90101
|
||||
RNWWebStorage: 7fa0c2bd3aba2d3e17cb92983bda1cad8ba4fe4c
|
||||
RNXAuth: da888a17b9a0f54908f6daa8b2e020d3585f91cc
|
||||
RNWWebStorage: 39af6c7aa24a9360372280338e0f5900630779a2
|
||||
RNXAuth: 7716515bc74149d226d798138f2d76af9f34427f
|
||||
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
|
||||
Yoga: a1d7895431387402a674fd0d1c04ec85e87909b8
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ export async function parsePlist(app: string): Promise<Error | JSObject> {
|
|||
export function xcodebuild(
|
||||
xcworkspace: string,
|
||||
params: BuildParams,
|
||||
log = console.log
|
||||
log: (message: string) => void = console.log
|
||||
) {
|
||||
const args = ["-workspace", xcworkspace];
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче