feat: Allow trace-level logging for non-published release builds (#49564)

### What?

Disable `tracing/release_max_level_info` for non-published release
builds. I modified CI script to strip out logging for published
binaries.

### Why?

x-ref: https://vercel.slack.com/archives/C03EWR7LGEN/p1683621374204959

It's required to print logging for turbopack.

### How?

Closes WEB-1032

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
This commit is contained in:
Donny/강동윤 2023-05-10 21:50:36 +09:00 committed by GitHub
parent f55359ffb6
commit 54ea0d95a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 11 deletions

View file

@ -1338,12 +1338,12 @@ jobs:
target: 'x86_64-apple-darwin'
build: |
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" && if [ ! -f $(dirname $(which yarn))/pnpm ]; then ln -s $(which yarn) $(dirname $(which yarn))/pnpm;fi
turbo run build-native -- --release --target x86_64-apple-darwin
turbo run build-native-release -- --target x86_64-apple-darwin --release
strip -x packages/next-swc/native/next-swc.*.node
- host: windows-latest
build: |
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" "pnpm@${PNPM_VERSION}"
turbo run build-native -- --release --target x86_64-pc-windows-msvc
turbo run build-native-release -- --target x86_64-pc-windows-msvc
target: 'x86_64-pc-windows-msvc'
- host: windows-latest
build: |
@ -1360,7 +1360,7 @@ jobs:
rustup target add x86_64-unknown-linux-gnu &&
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" && if [ ! -f $(dirname $(which yarn))/pnpm ]; then ln -s $(which yarn) $(dirname $(which yarn))/pnpm;fi &&
unset CC_x86_64_unknown_linux_gnu && unset CC &&
turbo run build-native -- --release --target x86_64-unknown-linux-gnu &&
turbo run build-native-release -- --target x86_64-unknown-linux-gnu &&
strip packages/next-swc/native/next-swc.*.node
- host: ubuntu-latest
target: 'x86_64-unknown-linux-musl'
@ -1372,7 +1372,7 @@ jobs:
rustup default "${RUST_TOOLCHAIN}" &&
rustup target add x86_64-unknown-linux-musl &&
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" && if [ ! -f $(dirname $(which yarn))/pnpm ]; then ln -s $(which yarn) $(dirname $(which yarn))/pnpm;fi &&
turbo run build-native -- --release --target x86_64-unknown-linux-musl &&
turbo run build-native-release -- --target x86_64-unknown-linux-musl &&
strip packages/next-swc/native/next-swc.*.node
- host: macos-latest
target: 'aarch64-apple-darwin'
@ -1383,7 +1383,7 @@ jobs:
SYSROOT=$(xcrun --sdk macosx --show-sdk-path);
export CFLAGS="-isysroot $SYSROOT -isystem $SYSROOT";
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" && if [ ! -f $(dirname $(which yarn))/pnpm ]; then ln -s $(which yarn) $(dirname $(which yarn))/pnpm;fi
turbo run build-native -- --release --target aarch64-apple-darwin
turbo run build-native-release -- --target aarch64-apple-darwin
strip -x packages/next-swc/native/next-swc.*.node
- host: ubuntu-latest
target: 'aarch64-unknown-linux-gnu'
@ -1396,7 +1396,7 @@ jobs:
rustup target add aarch64-unknown-linux-gnu &&
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" && if [ ! -f $(dirname $(which yarn))/pnpm ]; then ln -s $(which yarn) $(dirname $(which yarn))/pnpm;fi &&
export CC_aarch64_unknown_linux_gnu=/usr/aarch64-unknown-linux-gnu/bin/aarch64-unknown-linux-gnu-gcc &&
turbo run build-native -- --release --target aarch64-unknown-linux-gnu &&
turbo run build-native-release -- --target aarch64-unknown-linux-gnu &&
llvm-strip -x packages/next-swc/native/next-swc.*.node
- host: ubuntu-latest
target: 'aarch64-unknown-linux-musl'
@ -1409,13 +1409,13 @@ jobs:
rustup toolchain install "${RUST_TOOLCHAIN}" &&
rustup default "${RUST_TOOLCHAIN}" &&
rustup target add aarch64-unknown-linux-musl &&
turbo run build-native -- --release --target aarch64-unknown-linux-musl &&
turbo run build-native-release -- --target aarch64-unknown-linux-musl &&
llvm-strip -x packages/next-swc/native/next-swc.*.node
- host: windows-latest
target: 'aarch64-pc-windows-msvc'
build: |
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" "pnpm@${PNPM_VERSION}"
turbo run build-native-no-plugin-woa -- --release --target aarch64-pc-windows-msvc --cargo-flags=--no-default-features
turbo run build-native-no-plugin-woa-release -- --target aarch64-pc-windows-msvc
if: ${{ needs.build.outputs.isRelease == 'true' || (needs.build.outputs.turboToken != 'empty') }}
needs: build
name: stable - ${{ matrix.settings.target }} - node@16

View file

@ -20,7 +20,7 @@ regex = "1.5"
serde = "1"
serde_json = "1"
sha1 = "0.10.1"
tracing = { version = "0.1.37", features = ["release_max_level_info"] }
tracing = { version = "0.1.37" }
turbo-binding = { workspace = true, features = [
"__swc_core",

View file

@ -54,7 +54,7 @@ turbo-tasks = { workspace = true }
once_cell = { workspace = true }
serde = "1"
serde_json = "1"
tracing = { version = "0.1.37", features = ["release_max_level_info"] }
tracing = { version = "0.1.37" }
tracing-futures = "0.2.5"
tracing-subscriber = "0.3.9"
tracing-chrome = "0.5.0"

View file

@ -5,9 +5,10 @@
"scripts": {
"clean": "node ../../scripts/rm.mjs native",
"build-native": "napi build --platform -p next-swc-napi --cargo-cwd ../../ --cargo-name next_swc_napi --features plugin,rustls-tls --js false native",
"build-native-woa": "napi build --platform -p next-swc-napi --cargo-cwd ../../ --cargo-name next_swc_napi --cargo-flags=--no-default-features --features plugin,native-tls --js false native",
"build-native-release": "napi build --platform -p next-swc-napi --cargo-cwd ../../ --cargo-name next_swc_napi --release --features plugin,rustls-tls,tracing/release_max_level_info --js false native",
"build-native-no-plugin": "napi build --platform -p next-swc-napi --cargo-cwd ../../ --cargo-name next_swc_napi --js false native",
"build-native-no-plugin-woa": "napi build --platform -p next-swc-napi --cargo-cwd ../../ --cargo-name next_swc_napi --cargo-flags=--no-default-features --features native-tls --js false native",
"build-native-no-plugin-woa-release": "napi build --platform -p next-swc-napi --cargo-cwd ../../ --cargo-name next_swc_napi --release --cargo-flags=--no-default-features --features native-tls,tracing/release_max_level_info --js false native",
"build-wasm": "wasm-pack build crates/wasm --scope=next",
"cache-build-native": "echo $(ls native)"
},

View file

@ -5,6 +5,10 @@
"dependsOn": ["^build-native"],
"outputs": ["native/*.node"]
},
"build-native-release": {
"dependsOn": ["^build-native-release"],
"outputs": ["native/*.node"]
},
"build-native-no-plugin": {
"dependsOn": ["^build-native-no-plugin"],
"outputs": ["native/*.node"]
@ -13,6 +17,10 @@
"dependsOn": ["^build-native-no-plugin-woa"],
"outputs": ["native/*.node"]
},
"build-native-no-plugin-woa-release": {
"dependsOn": ["^build-native-no-plugin-woa-release"],
"outputs": ["native/*.node"]
},
"build-wasm": {
"dependsOn": ["^build-wasm"],
"outputs": ["crates/wasm/pkg/*"]