diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 85bb7955810aae..92acd73acef165 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -205,14 +205,14 @@ jobs: esac rm -rf ./out/sanitizers - BUILD_TYPE=sanitizers scripts/build/gn_gen.sh --args="$GN_ARGS" --export-compile-commands + BUILD_TYPE=sanitizers scripts/build/gn_gen.sh --args="$GN_ARGS" --add-export-compile-commands=* BUILD_TYPE=sanitizers scripts/tests/gn_tests.sh done - name: Generate tests with sanitizers (for tidy) if: github.event.pull_request.number != null run: | rm -rf ./out/sanitizers - BUILD_TYPE=sanitizers scripts/build/gn_gen.sh --args="is_clang=true is_asan=true" --export-compile-commands + BUILD_TYPE=sanitizers scripts/build/gn_gen.sh --args="is_clang=true is_asan=true" --add-export-compile-commands=* - name: Ensure codegen is done for sanitize run: | ./scripts/run_in_build_env.sh "./scripts/run_codegen_targets.sh out/sanitizers" @@ -439,7 +439,7 @@ jobs: # We want to build various standalone example apps (similar to what examples-linux-standalone.yaml # does), so use target_os="all" to get those picked up as part of the "unified" build. But then # to save CI resources we want to exclude the "host clang" build, which uses the pigweed clang. - scripts/build/gn_gen.sh --args='target_os="all" is_asan=true enable_host_clang_build=false' --export-compile-commands + scripts/build/gn_gen.sh --args='target_os="all" is_asan=true enable_host_clang_build=false' --add-export-compile-commands=* scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE" scripts/tests/gn_tests.sh - name: Ensure codegen is done for default diff --git a/config/qpg/chip-gn/build.sh b/config/qpg/chip-gn/build.sh index 541da2625253eb..974caaaf0ac2f9 100755 --- a/config/qpg/chip-gn/build.sh +++ b/config/qpg/chip-gn/build.sh @@ -31,7 +31,7 @@ gn \ --root-target=//config/qpg/chip-gn \ --dotfile="$GN_ROOT_TARGET/.gn" \ --script-executable=python3 \ - --export-compile-commands \ + --add-export-compile-commands="*" \ gen \ --check \ --args="$GN_ARGS" \ diff --git a/examples/chef/chef.py b/examples/chef/chef.py index cecbf646ffeedf..8c54ee8dbbc6fb 100755 --- a/examples/chef/chef.py +++ b/examples/chef/chef.py @@ -884,7 +884,7 @@ def main() -> int: """)) if options.do_clean: shell.run_cmd("rm -rf out") - shell.run_cmd("gn gen --export-compile-commands out") + shell.run_cmd("gn gen --add-export-compile-commands=* out") shell.run_cmd("ninja -C out") # diff --git a/examples/lighting-app/tizen/README.md b/examples/lighting-app/tizen/README.md index 28e0d9b2c0b22b..d1b2fe474e9220 100644 --- a/examples/lighting-app/tizen/README.md +++ b/examples/lighting-app/tizen/README.md @@ -13,7 +13,7 @@ Generating tizen-arm-light ```sh gn gen --check \ --fail-on-unused-args \ - --export-compile-commands \ + --add-export-compile-commands=* \ --root=$PW_PROJECT_ROOT/examples/lighting-app/tizen \ "--args=target_os=\"tizen\" target_cpu=\"arm\" tizen_sdk_root=\"$TIZEN_SDK_ROOT\" tizen_sdk_sysroot=\"$TIZEN_SDK_SYSROOT\"" \ $PW_PROJECT_ROOT/out/tizen-arm-light diff --git a/scripts/build/builders/efr32.py b/scripts/build/builders/efr32.py index cb80eab890495d..871785fd2c9db8 100644 --- a/scripts/build/builders/efr32.py +++ b/scripts/build/builders/efr32.py @@ -337,7 +337,7 @@ def bundle_outputs(self): def generate(self): cmd = [ 'gn', 'gen', '--check', '--fail-on-unused-args', - '--export-compile-commands', + '--add-export-compile-commands=*', '--root=%s' % self.root ] if self.dotfile: diff --git a/scripts/build/builders/gn.py b/scripts/build/builders/gn.py index 6d9385bd4fc2aa..f65d8878c2ba60 100644 --- a/scripts/build/builders/gn.py +++ b/scripts/build/builders/gn.py @@ -55,7 +55,7 @@ def PostBuildCommand(self): def generate(self): cmd = [ 'gn', 'gen', '--check', '--fail-on-unused-args', - '--export-compile-commands', + '--add-export-compile-commands=*', '--root=%s' % self.root ] diff --git a/scripts/build/builders/nxp.py b/scripts/build/builders/nxp.py index fa24ef2d2d13ce..202c4e87ff4c98 100644 --- a/scripts/build/builders/nxp.py +++ b/scripts/build/builders/nxp.py @@ -421,7 +421,7 @@ def generate(self): elif self.build_system == NxpBuildSystem.GN: # add empty space at the end to avoid concatenation issue when there is no --args - cmd += 'gn gen --check --fail-on-unused-args --export-compile-commands --root=%s ' % self.root + cmd += 'gn gen --check --fail-on-unused-args --add-export-compile-commands=* --root=%s ' % self.root extra_args = [] diff --git a/scripts/build/testdata/dry_run_efr32-brd4187c-light-rpc-no-version.txt b/scripts/build/testdata/dry_run_efr32-brd4187c-light-rpc-no-version.txt index d75eeabc3b6996..8d367e045510fb 100644 --- a/scripts/build/testdata/dry_run_efr32-brd4187c-light-rpc-no-version.txt +++ b/scripts/build/testdata/dry_run_efr32-brd4187c-light-rpc-no-version.txt @@ -2,7 +2,7 @@ cd "{root}" # Generating efr32-brd4187c-light-rpc-no-version -gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/silabs '--args=silabs_board="BRD4187C" is_debug=false import("//with_pw_rpc.gni") efr32_sdk_root="TEST_GSDK_ROOT" openthread_root="TEST_GSDK_ROOT/util/third_party/openthread" wiseconnect_sdk_root="TEST_WISECONNECT_SDK_ROOT" wifi_sdk_root="TEST_WIFI_SDK_ROOT"' {out}/efr32-brd4187c-light-rpc-no-version +gn gen --check --fail-on-unused-args '--add-export-compile-commands=*' --root={root}/examples/lighting-app/silabs '--args=silabs_board="BRD4187C" is_debug=false import("//with_pw_rpc.gni") efr32_sdk_root="TEST_GSDK_ROOT" openthread_root="TEST_GSDK_ROOT/util/third_party/openthread" wiseconnect_sdk_root="TEST_WISECONNECT_SDK_ROOT" wifi_sdk_root="TEST_WIFI_SDK_ROOT"' {out}/efr32-brd4187c-light-rpc-no-version # Building efr32-brd4187c-light-rpc-no-version ninja -C {out}/efr32-brd4187c-light-rpc-no-version diff --git a/scripts/build/testdata/dry_run_linux-arm64-chip-tool-ipv6only-clang.txt b/scripts/build/testdata/dry_run_linux-arm64-chip-tool-ipv6only-clang.txt index 58e095837e9a97..bcfce65eec65d8 100644 --- a/scripts/build/testdata/dry_run_linux-arm64-chip-tool-ipv6only-clang.txt +++ b/scripts/build/testdata/dry_run_linux-arm64-chip-tool-ipv6only-clang.txt @@ -4,7 +4,7 @@ cd "{root}" # Generating linux-arm64-chip-tool-ipv6only-clang bash -c ' PKG_CONFIG_PATH="SYSROOT_AARCH64/lib/aarch64-linux-gnu/pkgconfig" \ - gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/chip-tool '"'"'--args=chip_inet_config_enable_ipv4=false is_clang=true target_cpu="arm64" sysroot="SYSROOT_AARCH64"'"'"' {out}/linux-arm64-chip-tool-ipv6only-clang' + gn gen --check --fail-on-unused-args '"'"'--add-export-compile-commands=*'"'"' --root={root}/examples/chip-tool '"'"'--args=chip_inet_config_enable_ipv4=false is_clang=true target_cpu="arm64" sysroot="SYSROOT_AARCH64"'"'"' {out}/linux-arm64-chip-tool-ipv6only-clang' # Setting up Java deps third_party/java_deps/set_up_java_deps.sh diff --git a/scripts/build/testdata/dry_run_linux-arm64-ota-requestor-nodeps-ipv6only.txt b/scripts/build/testdata/dry_run_linux-arm64-ota-requestor-nodeps-ipv6only.txt index a1f9beb5eb6f60..dd9fd5f8e9622c 100644 --- a/scripts/build/testdata/dry_run_linux-arm64-ota-requestor-nodeps-ipv6only.txt +++ b/scripts/build/testdata/dry_run_linux-arm64-ota-requestor-nodeps-ipv6only.txt @@ -4,7 +4,7 @@ cd "{root}" # Generating linux-arm64-ota-requestor-nodeps-ipv6only bash -c ' PKG_CONFIG_PATH="SYSROOT_AARCH64/lib/aarch64-linux-gnu/pkgconfig" \ - gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/ota-requestor-app/linux '"'"'--args=chip_inet_config_enable_ipv4=false chip_config_network_layer_ble=false chip_enable_ble=false chip_enable_wifi=false chip_enable_openthread=false is_clang=true chip_crypto="mbedtls" target_cpu="arm64" sysroot="SYSROOT_AARCH64"'"'"' {out}/linux-arm64-ota-requestor-nodeps-ipv6only' + gn gen --check --fail-on-unused-args '"'"'--add-export-compile-commands=*'"'"' --root={root}/examples/ota-requestor-app/linux '"'"'--args=chip_inet_config_enable_ipv4=false chip_config_network_layer_ble=false chip_enable_ble=false chip_enable_wifi=false chip_enable_openthread=false is_clang=true chip_crypto="mbedtls" target_cpu="arm64" sysroot="SYSROOT_AARCH64"'"'"' {out}/linux-arm64-ota-requestor-nodeps-ipv6only' # Setting up Java deps third_party/java_deps/set_up_java_deps.sh diff --git a/scripts/build/testdata/dry_run_linux-x64-all-clusters-coverage.txt b/scripts/build/testdata/dry_run_linux-x64-all-clusters-coverage.txt index d2960f35542eba..00c4027603d13e 100644 --- a/scripts/build/testdata/dry_run_linux-x64-all-clusters-coverage.txt +++ b/scripts/build/testdata/dry_run_linux-x64-all-clusters-coverage.txt @@ -2,7 +2,7 @@ cd "{root}" # Generating linux-x64-all-clusters-coverage -gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/all-clusters-app/linux --args=use_coverage=true {out}/linux-x64-all-clusters-coverage +gn gen --check --fail-on-unused-args '--add-export-compile-commands=*' --root={root}/examples/all-clusters-app/linux --args=use_coverage=true {out}/linux-x64-all-clusters-coverage # Setting up Java deps third_party/java_deps/set_up_java_deps.sh diff --git a/scripts/examples/gn_bouffalolab_example.sh b/scripts/examples/gn_bouffalolab_example.sh index 3942d796896027..79ccda9ae1f755 100755 --- a/scripts/examples/gn_bouffalolab_example.sh +++ b/scripts/examples/gn_bouffalolab_example.sh @@ -200,7 +200,7 @@ else example_dir=$MATTER_ROOT/examples/$example_name/bouffalolab/$bouffalo_chip output_dir=$MATTER_ROOT/$output_folder - gn gen --check --fail-on-unused-args --export-compile-commands --root="$example_dir" "$output_dir" --args="${optArgs[*]}" + gn gen --check --fail-on-unused-args --add-export-compile-commands=* --root="$example_dir" "$output_dir" --args="${optArgs[*]}" ninja -C "$output_dir" fi diff --git a/scripts/examples/gn_silabs_example.sh b/scripts/examples/gn_silabs_example.sh index bc06f8b2d28b0c..f68c938e579c45 100755 --- a/scripts/examples/gn_silabs_example.sh +++ b/scripts/examples/gn_silabs_example.sh @@ -340,7 +340,7 @@ else optArgs+="openthread_root=\"$GSDK_ROOT/util/third_party/openthread\" " fi - "$GN_PATH" gen --check --script-executable="$PYTHON_PATH" --fail-on-unused-args --export-compile-commands --root="$ROOT" --dotfile="$DOTFILE" --args="silabs_board=\"$SILABS_BOARD\" $optArgs" "$BUILD_DIR" + "$GN_PATH" gen --check --script-executable="$PYTHON_PATH" --fail-on-unused-args --add-export-compile-commands=* --root="$ROOT" --dotfile="$DOTFILE" --args="silabs_board=\"$SILABS_BOARD\" $optArgs" "$BUILD_DIR" if [ "$USE_SLC" == true ]; then # Activation needs to be after SLC generation which is done in gn gen. diff --git a/scripts/examples/gn_stm32_example.sh b/scripts/examples/gn_stm32_example.sh index 62c19cc3470de6..1167bd721dd54a 100755 --- a/scripts/examples/gn_stm32_example.sh +++ b/scripts/examples/gn_stm32_example.sh @@ -176,14 +176,14 @@ else BUILD_DIR=$OUTDIR/$STM32_BOARD echo BUILD_DIR="$BUILD_DIR" if [ "$USE_WIFI" == true ]; then - gn gen --check --fail-on-unused-args --export-compile-commands --root="$ROOT" --dotfile="$ROOT"/build_for_wifi_gnfile.gn --args="stm32_board=\"$STM32_BOARD\" $optArgs" "$BUILD_DIR" + gn gen --check --fail-on-unused-args --add-export-compile-commands=* --root="$ROOT" --dotfile="$ROOT"/build_for_wifi_gnfile.gn --args="stm32_board=\"$STM32_BOARD\" $optArgs" "$BUILD_DIR" else # thread build # if [ -z "$optArgs" ]; then - gn gen --check --fail-on-unused-args --export-compile-commands --root="$ROOT" --args="stm32_board=\"$STM32_BOARD\" treat_warnings_as_errors=false" --ide=json "$BUILD_DIR" + gn gen --check --fail-on-unused-args --add-export-compile-commands=* --root="$ROOT" --args="stm32_board=\"$STM32_BOARD\" treat_warnings_as_errors=false" --ide=json "$BUILD_DIR" else - gn gen --check --fail-on-unused-args --export-compile-commands --root="$ROOT" --args="stm32_board=\"$STM32_BOARD\" $optArgs treat_warnings_as_errors=false" --ide=json "$BUILD_DIR" + gn gen --check --fail-on-unused-args --add-export-compile-commands=* --root="$ROOT" --args="stm32_board=\"$STM32_BOARD\" $optArgs treat_warnings_as_errors=false" --ide=json "$BUILD_DIR" fi fi ninja -v -C "$BUILD_DIR"/ diff --git a/scripts/helpers/update_compile_commands.sh b/scripts/helpers/update_compile_commands.sh index 15b03c1799a0d7..d103a2a4183789 100755 --- a/scripts/helpers/update_compile_commands.sh +++ b/scripts/helpers/update_compile_commands.sh @@ -23,23 +23,23 @@ CHIP_ROOT="$(dirname "$0")/../.." source "$CHIP_ROOT/scripts/activate.sh" -gn --root="$CHIP_ROOT" gen "$CHIP_ROOT/out/debug" --export-compile-commands=host_gcc +gn --root="$CHIP_ROOT" gen "$CHIP_ROOT/out/debug" --add-export-compile-commands="//:host_gcc" mv "$CHIP_ROOT/out/debug/compile_commands.json" "$CHIP_ROOT/out/debug/compile_commands.gcc.json" -gn --root="$CHIP_ROOT" gen "$CHIP_ROOT/out/debug" --export-compile-commands=host_clang +gn --root="$CHIP_ROOT" gen "$CHIP_ROOT/out/debug" --add-export-compile-commands="//:host_clang" mv "$CHIP_ROOT/out/debug/compile_commands.json" "$CHIP_ROOT/out/debug/compile_commands.clang.json" -gn --root="$CHIP_ROOT" gen "$CHIP_ROOT/out/debug" --export-compile-commands=host_gcc_mbedtls +gn --root="$CHIP_ROOT" gen "$CHIP_ROOT/out/debug" --add-export-compile-commands="//:host_gcc_mbedtls" mv "$CHIP_ROOT/out/debug/compile_commands.json" "$CHIP_ROOT/out/debug/compile_commands.mbedtls.json" -gn --root="$CHIP_ROOT" gen "$CHIP_ROOT/out/debug" --export-compile-commands=android_x64 +gn --root="$CHIP_ROOT" gen "$CHIP_ROOT/out/debug" --add-export-compile-commands="//:android_x64" mv "$CHIP_ROOT/out/debug/compile_commands.json" "$CHIP_ROOT/out/debug/compile_commands.android_x64.json" -gn --root="$CHIP_ROOT" gen "$CHIP_ROOT/out/debug" --export-compile-commands=android_arm64 +gn --root="$CHIP_ROOT" gen "$CHIP_ROOT/out/debug" --add-export-compile-commands="//:android_arm64" mv "$CHIP_ROOT/out/debug/compile_commands.json" "$CHIP_ROOT/out/debug/compile_commands.android_arm64.json" -gn --root="$CHIP_ROOT" gen "$CHIP_ROOT/out/debug" --export-compile-commands=efr32_lock_app +gn --root="$CHIP_ROOT" gen "$CHIP_ROOT/out/debug" --add-export-compile-commands="//:efr32_lock_app" mv "$CHIP_ROOT/out/debug/compile_commands.json" "$CHIP_ROOT/out/debug/compile_commands.efr32.json" -gn --root="$CHIP_ROOT" gen "$CHIP_ROOT/out/debug" --export-compile-commands=tizen_lighting_app +gn --root="$CHIP_ROOT" gen "$CHIP_ROOT/out/debug" --add-export-compile-commands="//:tizen_lighting_app" mv "$CHIP_ROOT/out/debug/compile_commands.json" "$CHIP_ROOT/out/debug/compile_commands.tizen_arm.json"