From 2f527938b27074116a89b9248e218a2ed073be34 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Fri, 20 Jan 2023 21:31:16 +0800 Subject: [PATCH] fix(napi): build error with zig@0.10.1 --- .github/workflows/zig.yaml | 2 +- cli/src/build.ts | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/zig.yaml b/.github/workflows/zig.yaml index d322306460..635bb2ef6a 100644 --- a/.github/workflows/zig.yaml +++ b/.github/workflows/zig.yaml @@ -52,7 +52,7 @@ jobs: - name: Install ziglang uses: goto-bus-stop/setup-zig@v2 with: - version: 0.10.0 + version: 0.10.1 - name: Install dependencies run: yarn install --immutable --mode=skip-build - name: 'Build TypeScript' diff --git a/cli/src/build.ts b/cli/src/build.ts index 7e0444eb4d..1f3429b225 100644 --- a/cli/src/build.ts +++ b/cli/src/build.ts @@ -844,14 +844,18 @@ async function patchArmFeaturesHForArmTargets() { const p = zigLibDir ? join(zigLibDir, 'libc/glibc/sysdeps/arm/arm-features.h') : join(zigExePath, '../lib/libc/glibc/sysdeps/arm/arm-features.h') - await writeFileAsync(p, ARM_FEATURES_H, { - mode: 0o644, - }) + if (!existsSync(p)) { + await writeFileAsync(p, ARM_FEATURES_H, { + mode: 0o644, + }) + } } catch (e) { - throw new Error( - `Cannot patch arm-features.h, error: ${ - (e as Error).message || e - }. See: https://github.com/ziglang/zig/issues/3287`, + console.error( + Error( + `Cannot patch arm-features.h, error: ${ + (e as Error).message || e + }. See: https://github.com/ziglang/zig/issues/3287`, + ), ) } }