Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,8 @@ jobs:
export TURBOPACK_BUILD=1
export NEXT_TEST_MODE=start
export NEXT_TEST_REACT_VERSION="${{ matrix.react }}"
# TODO(PACK-4578): Remove
export TURBOPACK_TEMP_DISABLE_DUPLICATE_MODULES_CHECK=1

node run-tests.js --timings -g ${{ matrix.group }} --type production
stepName: 'test-turbopack-production-react-${{ matrix.react }}-${{ matrix.group }}'
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/build_reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ on:
required: false
description: 'if nextest rust dep is needed'
type: string
rustBuildProfile:
required: false
description: 'The profile to use for the build, default is `release-with-assertions`, also supports `` for debug and `release` for normal release'
Comment thread
lukesandberg marked this conversation as resolved.
type: string
default: 'release-with-assertions'
uploadSwcArtifact:
required: false
description: 'if swc artifact needs uploading'
Expand Down Expand Up @@ -179,7 +184,7 @@ jobs:
with:
cache-provider: 'turbo'
save-if: ${{ github.ref_name == 'canary' }}
shared-key: ${{ inputs.rustCacheKey }}-${{ inputs.buildNativeTarget }}-build-${{ hashFiles('.cargo/config.toml') }}
shared-key: ${{ inputs.rustCacheKey }}-${{ inputs.buildNativeTarget }}-build-${{ inputs.rustBuildProfile }}-${{ hashFiles('.cargo/config.toml') }}

# clean up any previous artifacts to avoid hitting disk space limits
- run: git clean -xdf && rm -rf /tmp/next-repo-*; rm -rf /tmp/next-install-* /tmp/yarn-* /tmp/ncc-cache target
Expand All @@ -197,7 +202,7 @@ jobs:
- run: node scripts/normalize-version-bump.js
name: normalize versions

- run: pnpm dlx turbo@${TURBO_VERSION} run build-native-release -v --env-mode loose --remote-cache-timeout 90 --summarize -- --target ${{ inputs.buildNativeTarget }}
- run: pnpm dlx turbo@${TURBO_VERSION} run build-native-${{ inputs.rustBuildProfile }} -v --env-mode loose --remote-cache-timeout 90 --summarize -- --target ${{ inputs.buildNativeTarget }}
if: ${{ inputs.skipNativeBuild != 'yes' }}

- name: Upload next-swc artifact
Expand Down
1 change: 1 addition & 0 deletions packages/next-swc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"clean": "node ../../scripts/rm.mjs native",
"build-native": "napi build --platform -p next-swc-napi --cargo-cwd ../../ --cargo-name next_swc_napi --features plugin,image-extended --js false native",
"build-native-release": "napi build --platform -p next-swc-napi --cargo-cwd ../../ --cargo-name next_swc_napi --release --features plugin,image-extended,tracing/release_max_level_info --js false native",
"build-native-release-with-assertions": "napi build --platform -p next-swc-napi --cargo-cwd ../../ --cargo-name next_swc_napi --profile release-with-assertions --features plugin,image-extended,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 --features image-webp --js false native",
"build-native-no-plugin-release": "napi build --platform -p next-swc-napi --cargo-cwd ../../ --cargo-name next_swc_napi --release --features image-webp,tracing/release_max_level_info --js false native",
"build-native-wasi": "npx --package=@napi-rs/cli@3.0.0-alpha.45 napi build --platform --target wasm32-wasip1-threads -p next-swc-napi --cwd ../../ --output-dir packages/next-swc/native --no-default-features",
Expand Down
13 changes: 13 additions & 0 deletions packages/next-swc/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@
"env": ["CI"],
"outputs": ["native/*.node"]
},
"build-native-release-with-assertions": {
"inputs": [
"../../.cargo/**",
"../../crates/**",
"../../turbopack/crates/**",
"../../**/Cargo.toml",
"../../**/Cargo.lock",
"../../.github/workflows/build_and_deploy.yml",
"../../rust-toolchain"
],
"env": ["CI"],
"outputs": ["native/*.node"]
},
"build-native-no-plugin": {
"inputs": [
"../../.cargo/**",
Expand Down
29 changes: 20 additions & 9 deletions turbopack/crates/turbopack-core/src/module_graph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,16 +344,27 @@ impl SingleModuleGraph {

#[cfg(debug_assertions)]
{
let mut duplicates = Vec::new();
let mut set = FxHashSet::default();
for &module in modules.keys() {
let ident = module.ident().to_string().await?;
if !set.insert(ident.clone()) {
duplicates.push(ident)
use once_cell::sync::Lazy;

// TODO(PACK-4578): This is temporary while the last issues are being addressed.
static CHECK_FOR_DUPLICATE_MODULES: Lazy<bool> = Lazy::new(|| {
match std::env::var_os("TURBOPACK_TEMP_DISABLE_DUPLICATE_MODULES_CHECK") {
Some(v) => v != "1" && v != "true",
None => true,
}
});
if *CHECK_FOR_DUPLICATE_MODULES {
let mut duplicates = Vec::new();
let mut set = FxHashSet::default();
for &module in modules.keys() {
let ident = module.ident().to_string().await?;
if !set.insert(ident.clone()) {
duplicates.push(ident)
}
}
if !duplicates.is_empty() {
panic!("Duplicate module idents in graph: {duplicates:#?}");
}
}
if !duplicates.is_empty() {
panic!("Duplicate module idents in graph: {duplicates:#?}");
}
}

Expand Down