diff --git a/.bazelci/postsubmit.yml b/.bazelci/postsubmit.yml index 0ff4c51bcb282a..144c46cea6b97f 100644 --- a/.bazelci/postsubmit.yml +++ b/.bazelci/postsubmit.yml @@ -44,13 +44,27 @@ tasks: - "-//src/test/shell/bazel:bazel_coverage_cc_released_test_gcc" - "-//src/test/shell/bazel:bazel_coverage_cc_head_test_gcc" - "-//src/test/shell/bazel:bazel_coverage_sh_test" - # https://github.com/bazelbuild/bazel/issues/18776 + # Centos7 uses python 2 by default, so these fail: https://github.com/bazelbuild/bazel/issues/18776 - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test" - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test_with_head_android_tools" - - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test_with_platforms" - "-//src/test/shell/bazel/android:aapt_integration_test" - "-//src/test/shell/bazel/android:aapt_integration_test_with_head_android_tools" - - "-//src/test/shell/bazel/android:aapt_integration_test_with_platforms" + include_json_profile: + - build + - test + fedora39: + shell_commands: + - sed -i.bak -e 's/^# android_sdk_repository/android_sdk_repository/' -e 's/^# + android_ndk_repository/android_ndk_repository/' WORKSPACE.bzlmod + - rm -f WORKSPACE.bzlmod.bak + - rm -rf $HOME/bazeltest + - mkdir $HOME/bazeltest + build_flags: + - "--config=ci-linux" + build_targets: + - "//src:bazel" + - "//src:bazel_jdk_minimal" + - "//src/main/java/..." include_json_profile: - build - test @@ -85,13 +99,6 @@ tasks: - "//tools/bash/..." # Re-enable once fixed: https://github.com/bazelbuild/bazel/issues/8162 - "-//src/java_tools/import_deps_checker/..." - # https://github.com/bazelbuild/bazel/issues/18776 - - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test" - - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test_with_head_android_tools" - - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test_with_platforms" - - "-//src/test/shell/bazel/android:aapt_integration_test" - - "-//src/test/shell/bazel/android:aapt_integration_test_with_head_android_tools" - - "-//src/test/shell/bazel/android:aapt_integration_test_with_platforms" include_json_profile: - build - test @@ -152,13 +159,6 @@ tasks: - "//tools/bash/..." # Re-enable once fixed: https://github.com/bazelbuild/bazel/issues/8162 - "-//src/java_tools/import_deps_checker/..." - # https://github.com/bazelbuild/bazel/issues/18776 - - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test" - - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test_with_head_android_tools" - - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test_with_platforms" - - "-//src/test/shell/bazel/android:aapt_integration_test" - - "-//src/test/shell/bazel/android:aapt_integration_test_with_head_android_tools" - - "-//src/test/shell/bazel/android:aapt_integration_test_with_platforms" include_json_profile: - build - test @@ -206,13 +206,6 @@ tasks: - "-//src/test/shell/bazel/apple:bazel_apple_test" # https://github.com/bazelbuild/bazel/issues/17408 - "-//src/test/shell/bazel/apple:bazel_objc_test" - # https://github.com/bazelbuild/bazel/issues/18776 - - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test" - - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test_with_head_android_tools" - - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test_with_platforms" - - "-//src/test/shell/bazel/android:aapt_integration_test" - - "-//src/test/shell/bazel/android:aapt_integration_test_with_head_android_tools" - - "-//src/test/shell/bazel/android:aapt_integration_test_with_platforms" # https://github.com/bazelbuild/bazel/issues/17410 - "-//src/test/java/com/google/devtools/build/lib/platform:SystemMemoryPressureEventTest" # https://github.com/bazelbuild/bazel/issues/17411 @@ -223,10 +216,22 @@ tasks: - "-//src/test/shell/bazel:bazel_determinism_test" # https://github.com/bazelbuild/bazel/issues/17457 - "-//src/test/shell/bazel:jdeps_test" + # Macs can't find python, so these fail: https://github.com/bazelbuild/bazel/issues/18776 + - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test" + - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test_with_head_android_tools" + - "-//src/test/shell/bazel/android:aapt_integration_test" + - "-//src/test/shell/bazel/android:aapt_integration_test_with_head_android_tools" + # Disable recently regressed tests: https://github.com/bazelbuild/bazel/issues/20437 + - "-//src/test/java/com/google/devtools/build/lib/rules/cpp:CppSysrootTest" + - "-//src/test/java/com/google/devtools/build/lib/rules/cpp:CcImportConfiguredTargetTest" + - "-//src/test/java/com/google/devtools/build/lib/rules/objc:ObjcRulesTests" + - "-//src/test/java/com/google/devtools/build/lib/rules/objc:BazelJ2ObjcLibraryTest" + - "-//src/test/java/com/google/devtools/build/lib/rules/cpp:CcToolchainTest" include_json_profile: - build - test macos_arm64: + xcode_version: "15.1" shell_commands: - sed -i.bak -e 's/^# android_sdk_repository/android_sdk_repository/' -e 's/^# android_ndk_repository/android_ndk_repository/' WORKSPACE.bzlmod @@ -262,10 +267,6 @@ tasks: - "-//src/test/shell/bazel:bazel_cc_code_coverage_test" # MacOS does not have cgroups so it can't support hardened sandbox - "-//src/test/shell/integration:bazel_hardened_sandboxed_worker_test" - # https://github.com/bazelbuild/bazel/issues/16521 & https://github.com/bazelbuild/bazel/issues/18776 - - "-//src/test/shell/bazel/android/..." - - "-//src/tools/android/java/com/google/devtools/build/android/..." - - "-//src/test/java/com/google/devtools/build/android/dexer:AllTests" # https://github.com/bazelbuild/bazel/issues/16525 - "-//src/test/java/com/google/devtools/build/lib/buildtool:KeepGoingTest" - "-//src/test/java/com/google/devtools/build/lib/buildtool:DanglingSymlinkTest" @@ -277,6 +278,25 @@ tasks: - "-//src/test/java/com/google/devtools/build/lib/rules/objc:ObjcRulesTests" # https://github.com/bazelbuild/bazel/issues/17007 - "-//src/test/java/com/google/devtools/build/lib/platform:SystemMemoryPressureEventTest" + # https://github.com/bazelbuild/bazel/issues/16521 & https://github.com/bazelbuild/bazel/issues/18776 + - "-//src/test/shell/bazel/android/..." + - "-//src/tools/android/java/com/google/devtools/build/android/..." + - "-//src/test/java/com/google/devtools/build/android/dexer:AllTests" + # Macs can't find python, so these fail: https://github.com/bazelbuild/bazel/issues/18776 + - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test" + - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test_with_head_android_tools" + - "-//src/test/shell/bazel/android:aapt_integration_test" + - "-//src/test/shell/bazel/android:aapt_integration_test_with_head_android_tools" + # Disable recently regressed tests: https://github.com/bazelbuild/bazel/issues/20437 + - "-//src/test/java/com/google/devtools/build/lib/rules/cpp:CppSysrootTest" + - "-//src/test/java/com/google/devtools/build/lib/rules/cpp:CcImportConfiguredTargetTest" + - "-//src/test/java/com/google/devtools/build/lib/rules/objc:ObjcRulesTests" + - "-//src/test/java/com/google/devtools/build/lib/rules/objc:BazelJ2ObjcLibraryTest" + - "-//src/test/java/com/google/devtools/build/lib/rules/cpp:CcToolchainTest" + # https://github.com/bazelbuild/bazel/issues/17411 + - "-//src/test/java/com/google/devtools/build/lib/blackbox/tests/workspace:PatchApiBlackBoxTest" + # https://github.com/bazelbuild/bazel/issues/17447 + - "-//src/test/java/com/google/devtools/build/lib/blackbox/tests/workspace:GitRepositoryBlackBoxTest" include_json_profile: - build - test @@ -404,13 +424,6 @@ tasks: - "-//src/test/py/bazel:bazel_yanked_versions_test" - "-//src/test/py/bazel:bzlmod_query_test" - "-//src/test/shell/bazel:verify_workspace" - # https://github.com/bazelbuild/bazel/issues/18776 - - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test" - - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test_with_head_android_tools" - - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test_with_platforms" - - "-//src/test/shell/bazel/android:aapt_integration_test" - - "-//src/test/shell/bazel/android:aapt_integration_test_with_head_android_tools" - - "-//src/test/shell/bazel/android:aapt_integration_test_with_platforms" include_json_profile: - build - test diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 7d24c739659aca..29b9f793089cb7 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -45,13 +45,27 @@ tasks: - "-//src/test/shell/bazel:bazel_coverage_cc_released_test_gcc" - "-//src/test/shell/bazel:bazel_coverage_cc_head_test_gcc" - "-//src/test/shell/bazel:bazel_coverage_sh_test" - # https://github.com/bazelbuild/bazel/issues/18776 + # Centos7 uses python 2 by default, so these fail: https://github.com/bazelbuild/bazel/issues/18776 - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test" - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test_with_head_android_tools" - - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test_with_platforms" - "-//src/test/shell/bazel/android:aapt_integration_test" - "-//src/test/shell/bazel/android:aapt_integration_test_with_head_android_tools" - - "-//src/test/shell/bazel/android:aapt_integration_test_with_platforms" + include_json_profile: + - build + - test + fedora39: + shell_commands: + - sed -i.bak -e 's/^# android_sdk_repository/android_sdk_repository/' -e 's/^# + android_ndk_repository/android_ndk_repository/' WORKSPACE.bzlmod + - rm -f WORKSPACE.bzlmod.bak + - rm -rf $HOME/bazeltest + - mkdir $HOME/bazeltest + build_flags: + - "--config=ci-linux" + build_targets: + - "//src:bazel" + - "//src:bazel_jdk_minimal" + - "//src/main/java/..." include_json_profile: - build - test @@ -87,13 +101,6 @@ tasks: - "//tools/bash/..." # Re-enable once fixed: https://github.com/bazelbuild/bazel/issues/8162 - "-//src/java_tools/import_deps_checker/..." - # https://github.com/bazelbuild/bazel/issues/18776 - - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test" - - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test_with_head_android_tools" - - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test_with_platforms" - - "-//src/test/shell/bazel/android:aapt_integration_test" - - "-//src/test/shell/bazel/android:aapt_integration_test_with_head_android_tools" - - "-//src/test/shell/bazel/android:aapt_integration_test_with_platforms" include_json_profile: - build - test @@ -155,13 +162,6 @@ tasks: - "//tools/bash/..." # Re-enable once fixed: https://github.com/bazelbuild/bazel/issues/8162 - "-//src/java_tools/import_deps_checker/..." - # https://github.com/bazelbuild/bazel/issues/18776 - - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test" - - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test_with_head_android_tools" - - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test_with_platforms" - - "-//src/test/shell/bazel/android:aapt_integration_test" - - "-//src/test/shell/bazel/android:aapt_integration_test_with_head_android_tools" - - "-//src/test/shell/bazel/android:aapt_integration_test_with_platforms" include_json_profile: - build - test @@ -210,13 +210,6 @@ tasks: - "-//src/test/shell/bazel/apple:bazel_apple_test" # https://github.com/bazelbuild/bazel/issues/17408 - "-//src/test/shell/bazel/apple:bazel_objc_test" - # https://github.com/bazelbuild/bazel/issues/18776 - - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test" - - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test_with_head_android_tools" - - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test_with_platforms" - - "-//src/test/shell/bazel/android:aapt_integration_test" - - "-//src/test/shell/bazel/android:aapt_integration_test_with_head_android_tools" - - "-//src/test/shell/bazel/android:aapt_integration_test_with_platforms" # https://github.com/bazelbuild/bazel/issues/17410 - "-//src/test/java/com/google/devtools/build/lib/platform:SystemMemoryPressureEventTest" # https://github.com/bazelbuild/bazel/issues/17411 @@ -227,11 +220,23 @@ tasks: - "-//src/test/shell/bazel:bazel_determinism_test" # https://github.com/bazelbuild/bazel/issues/17457 - "-//src/test/shell/bazel:jdeps_test" + # Macs can't find python, so these fail: https://github.com/bazelbuild/bazel/issues/18776 + - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test" + - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test_with_head_android_tools" + - "-//src/test/shell/bazel/android:aapt_integration_test" + - "-//src/test/shell/bazel/android:aapt_integration_test_with_head_android_tools" + # Disable recently regressed tests: https://github.com/bazelbuild/bazel/issues/20437 + - "-//src/test/java/com/google/devtools/build/lib/rules/cpp:CppSysrootTest" + - "-//src/test/java/com/google/devtools/build/lib/rules/cpp:CcImportConfiguredTargetTest" + - "-//src/test/java/com/google/devtools/build/lib/rules/objc:ObjcRulesTests" + - "-//src/test/java/com/google/devtools/build/lib/rules/objc:BazelJ2ObjcLibraryTest" + - "-//src/test/java/com/google/devtools/build/lib/rules/cpp:CcToolchainTest" include_json_profile: - build - test macos_arm64: shards: 2 + xcode_version: "15.1" shell_commands: - sed -i.bak -e 's/^# android_sdk_repository/android_sdk_repository/' -e 's/^# android_ndk_repository/android_ndk_repository/' WORKSPACE.bzlmod @@ -267,10 +272,6 @@ tasks: - "-//src/test/shell/bazel:bazel_cc_code_coverage_test" # MacOS does not have cgroups so it can't support hardened sandbox - "-//src/test/shell/integration:bazel_hardened_sandboxed_worker_test" - # https://github.com/bazelbuild/bazel/issues/16521 & https://github.com/bazelbuild/bazel/issues/18776 - - "-//src/test/shell/bazel/android/..." - - "-//src/tools/android/java/com/google/devtools/build/android/..." - - "-//src/test/java/com/google/devtools/build/android/dexer:AllTests" # https://github.com/bazelbuild/bazel/issues/16525 - "-//src/test/java/com/google/devtools/build/lib/buildtool:KeepGoingTest" - "-//src/test/java/com/google/devtools/build/lib/buildtool:DanglingSymlinkTest" @@ -335,6 +336,26 @@ tasks: - "-//src/test/shell/bazel:bazel_repository_cache_test" - "-//src/test/shell/integration:aquery_test" - "-//src/test/shell/integration:py_args_escaping_test" + # https://github.com/bazelbuild/bazel/issues/16521 & https://github.com/bazelbuild/bazel/issues/18776 + - "-//src/test/shell/bazel/android/..." + - "-//src/tools/android/java/com/google/devtools/build/android/..." + - "-//src/test/java/com/google/devtools/build/android/dexer:AllTests" + # Macs can't find python, so these fail: https://github.com/bazelbuild/bazel/issues/18776 + - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test" + - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test_with_head_android_tools" + - "-//src/test/shell/bazel/android:aapt_integration_test" + - "-//src/test/shell/bazel/android:aapt_integration_test_with_head_android_tools" + # Disable recently regressed tests: https://github.com/bazelbuild/bazel/issues/20437 + - "-//src/test/java/com/google/devtools/build/lib/rules/cpp:CppSysrootTest" + - "-//src/test/java/com/google/devtools/build/lib/rules/cpp:CcImportConfiguredTargetTest" + - "-//src/test/java/com/google/devtools/build/lib/rules/objc:ObjcRulesTests" + - "-//src/test/java/com/google/devtools/build/lib/rules/objc:BazelJ2ObjcLibraryTest" + - "-//src/test/java/com/google/devtools/build/lib/rules/cpp:CcToolchainTest" + - "-//src/test/shell/integration:minimal_jdk_test" + # https://github.com/bazelbuild/bazel/issues/17411 + - "-//src/test/java/com/google/devtools/build/lib/blackbox/tests/workspace:PatchApiBlackBoxTest" + # https://github.com/bazelbuild/bazel/issues/17447 + - "-//src/test/java/com/google/devtools/build/lib/blackbox/tests/workspace:GitRepositoryBlackBoxTest" include_json_profile: - build - test @@ -468,13 +489,6 @@ tasks: # Flaky on rbe_ubuntu2004 # https://github.com/bazelbuild/continuous-integration/issues/1631 - "-//src/test/shell/bazel:bazel_sandboxing_networking_test" - # https://github.com/bazelbuild/bazel/issues/18776 - - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test" - - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test_with_head_android_tools" - - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test_with_platforms" - - "-//src/test/shell/bazel/android:aapt_integration_test" - - "-//src/test/shell/bazel/android:aapt_integration_test_with_head_android_tools" - - "-//src/test/shell/bazel/android:aapt_integration_test_with_platforms" include_json_profile: - build - test diff --git a/.bazelversion b/.bazelversion index 19b860c1872d57..a8907c025d5fa5 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -6.4.0 +7.0.2 diff --git a/MODULE.bazel b/MODULE.bazel index 03f1dce5d811cf..7c958cfcd323d5 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -138,6 +138,7 @@ maven.install( "io.netty:netty-transport-native-unix-common:jar:osx-x86_64:4.1.93.Final", "io.netty:netty-transport:4.1.93.Final", "io.reactivex.rxjava3:rxjava:3.1.2", + "it.unimi.dsi:fastutil:7.2.1", "javax.activation:javax.activation-api:1.2.0", "javax.annotation:javax.annotation-api:1.3.2", "javax.inject:javax.inject:1", diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 3646c7e15bfa9c..3bb0614a6bd480 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -1,6 +1,6 @@ { "lockFileVersion": 3, - "moduleFileHash": "63625ac7809ba5bc83e0814e16f223ac28a98df884897ddd5bfbd69fd4e3ddbf", + "moduleFileHash": "1ce286c2e04a814940dcb741cddee8772a3d8b97d22e12ee12e116dac57f1cd3", "flags": { "cmdRegistries": [ "https://bcr.bazel.build/" @@ -13,7 +13,7 @@ "compatibilityMode": "ERROR" }, "localOverrideHashes": { - "bazel_tools": "0cc38516259ab87144b82461dd874e139f093d8e356667c3a3c5a52441ac448f", + "bazel_tools": "922ea6752dc9105de5af957f7a99a6933c0a6a712d23df6aad16a9c399f7e787", "googleapis": "89bad67656f73e953cbf62f12165f56e97cf2cc17d56974c593de76200fa3471", "remoteapis": "3862bfbe3d308e71852b8f025f4b33ea9c0dc8790829eda4a71425c5a2ca814e" }, @@ -127,6 +127,7 @@ "io.netty:netty-transport-native-unix-common:jar:osx-x86_64:4.1.93.Final", "io.netty:netty-transport:4.1.93.Final", "io.reactivex.rxjava3:rxjava:3.1.2", + "it.unimi.dsi:fastutil:7.2.1", "javax.activation:javax.activation-api:1.2.0", "javax.annotation:javax.annotation-api:1.3.2", "javax.inject:javax.inject:1", @@ -182,7 +183,7 @@ "devDependency": false, "location": { "file": "@@//:MODULE.bazel", - "line": 188, + "line": 189, "column": 19 } }, @@ -197,7 +198,7 @@ "devDependency": false, "location": { "file": "@@//:MODULE.bazel", - "line": 188, + "line": 189, "column": 19 } }, @@ -212,7 +213,7 @@ "devDependency": false, "location": { "file": "@@//:MODULE.bazel", - "line": 188, + "line": 189, "column": 19 } }, @@ -227,7 +228,7 @@ "devDependency": false, "location": { "file": "@@//:MODULE.bazel", - "line": 188, + "line": 189, "column": 19 } }, @@ -242,7 +243,7 @@ "devDependency": false, "location": { "file": "@@//:MODULE.bazel", - "line": 188, + "line": 189, "column": 19 } }, @@ -257,7 +258,7 @@ "devDependency": false, "location": { "file": "@@//:MODULE.bazel", - "line": 188, + "line": 189, "column": 19 } }, @@ -272,7 +273,7 @@ "devDependency": false, "location": { "file": "@@//:MODULE.bazel", - "line": 188, + "line": 189, "column": 19 } }, @@ -287,7 +288,7 @@ "devDependency": false, "location": { "file": "@@//:MODULE.bazel", - "line": 188, + "line": 189, "column": 19 } }, @@ -302,7 +303,7 @@ "devDependency": false, "location": { "file": "@@//:MODULE.bazel", - "line": 188, + "line": 189, "column": 19 } }, @@ -330,7 +331,7 @@ "devDependency": false, "location": { "file": "@@//:MODULE.bazel", - "line": 321, + "line": 322, "column": 22 } } @@ -344,7 +345,7 @@ "usingModule": "", "location": { "file": "@@//:MODULE.bazel", - "line": 209, + "line": 210, "column": 32 }, "imports": { @@ -384,7 +385,7 @@ "usingModule": "", "location": { "file": "@@//:MODULE.bazel", - "line": 243, + "line": 244, "column": 23 }, "imports": {}, @@ -398,7 +399,7 @@ "devDependency": false, "location": { "file": "@@//:MODULE.bazel", - "line": 244, + "line": 245, "column": 17 } } @@ -412,7 +413,7 @@ "usingModule": "", "location": { "file": "@@//:MODULE.bazel", - "line": 246, + "line": 247, "column": 20 }, "imports": { @@ -430,7 +431,7 @@ "devDependency": false, "location": { "file": "@@//:MODULE.bazel", - "line": 247, + "line": 248, "column": 10 } } @@ -444,7 +445,7 @@ "usingModule": "", "location": { "file": "@@//:MODULE.bazel", - "line": 258, + "line": 259, "column": 33 }, "imports": { @@ -475,7 +476,7 @@ "usingModule": "", "location": { "file": "@@//:MODULE.bazel", - "line": 279, + "line": 280, "column": 29 }, "imports": { @@ -492,7 +493,7 @@ "usingModule": "", "location": { "file": "@@//:MODULE.bazel", - "line": 286, + "line": 287, "column": 32 }, "imports": { @@ -511,7 +512,7 @@ "usingModule": "", "location": { "file": "@@//:MODULE.bazel", - "line": 294, + "line": 295, "column": 31 }, "imports": { @@ -528,7 +529,7 @@ "usingModule": "", "location": { "file": "@@//:MODULE.bazel", - "line": 297, + "line": 298, "column": 48 }, "imports": { @@ -545,7 +546,7 @@ "usingModule": "", "location": { "file": "@@//:MODULE.bazel", - "line": 343, + "line": 344, "column": 35 }, "imports": { @@ -562,7 +563,7 @@ "usingModule": "", "location": { "file": "@@//:MODULE.bazel", - "line": 346, + "line": 347, "column": 42 }, "imports": { @@ -1794,7 +1795,7 @@ "usingModule": "bazel_tools@_", "location": { "file": "@@bazel_tools//:MODULE.bazel", - "line": 13, + "line": 17, "column": 29 }, "imports": { @@ -1812,7 +1813,7 @@ "usingModule": "bazel_tools@_", "location": { "file": "@@bazel_tools//:MODULE.bazel", - "line": 17, + "line": 21, "column": 32 }, "imports": { @@ -1829,7 +1830,7 @@ "usingModule": "bazel_tools@_", "location": { "file": "@@bazel_tools//:MODULE.bazel", - "line": 20, + "line": 24, "column": 32 }, "imports": { @@ -1851,7 +1852,7 @@ "usingModule": "bazel_tools@_", "location": { "file": "@@bazel_tools//:MODULE.bazel", - "line": 31, + "line": 35, "column": 39 }, "imports": { @@ -1868,7 +1869,7 @@ "usingModule": "bazel_tools@_", "location": { "file": "@@bazel_tools//:MODULE.bazel", - "line": 35, + "line": 39, "column": 48 }, "imports": { @@ -1885,7 +1886,7 @@ "usingModule": "bazel_tools@_", "location": { "file": "@@bazel_tools//:MODULE.bazel", - "line": 38, + "line": 42, "column": 42 }, "imports": { @@ -1907,6 +1908,7 @@ "platforms": "platforms@0.0.8", "com_google_protobuf": "protobuf@21.7", "zlib": "zlib@1.3", + "build_bazel_apple_support": "apple_support@1.5.0", "local_config_platform": "local_config_platform@_" } }, @@ -2158,7 +2160,7 @@ "moduleExtensions": { "//:extensions.bzl%bazel_android_deps": { "general": { - "bzlTransitiveDigest": "PjK+f/kxkhda9tRFlKVdGfNszPoXs7CDXZUi+ZGWGYU=", + "bzlTransitiveDigest": "Kib+Lx/bmCiuTsKHb+nnvwZZeTkKvKY/zLO6DCser8M=", "accumulatedFileDigests": {}, "envVariables": {}, "generatedRepoSpecs": { @@ -2172,15 +2174,127 @@ "url": "https://github.com/google/desugar_jdk_libs/archive/24dcd1dead0b64aae3d7c89ca9646b5dc4068009.zip" } } - } + }, + "recordedRepoMappingEntries": [ + [ + "", + "abseil-cpp", + "abseil-cpp~20230125.1" + ], + [ + "", + "apple_support", + "apple_support~1.5.0" + ], + [ + "", + "bazel_skylib", + "bazel_skylib~1.4.1" + ], + [ + "", + "bazel_tools", + "bazel_tools" + ], + [ + "", + "blake3", + "blake3~1.3.3.bcr.1" + ], + [ + "", + "c-ares", + "c-ares~1.15.0" + ], + [ + "", + "com_github_grpc_grpc", + "grpc~1.48.1.bcr.1" + ], + [ + "", + "com_google_protobuf", + "protobuf~21.7" + ], + [ + "", + "io_bazel_skydoc", + "stardoc~0.5.3" + ], + [ + "", + "platforms", + "platforms" + ], + [ + "", + "rules_cc", + "rules_cc~0.0.9" + ], + [ + "", + "rules_go", + "rules_go~0.39.1" + ], + [ + "", + "rules_java", + "rules_java~7.1.0" + ], + [ + "", + "rules_jvm_external", + "rules_jvm_external~5.2" + ], + [ + "", + "rules_license", + "rules_license~0.0.7" + ], + [ + "", + "rules_pkg", + "rules_pkg~0.9.1" + ], + [ + "", + "rules_proto", + "rules_proto~5.3.0-21.7" + ], + [ + "", + "rules_python", + "rules_python~0.26.0" + ], + [ + "", + "upb", + "upb~0.0.0-20220923-a547704" + ], + [ + "", + "zlib", + "zlib~1.3" + ], + [ + "", + "zstd-jni", + "zstd-jni~1.5.2-3.bcr.1" + ], + [ + "bazel_tools", + "bazel_tools", + "bazel_tools" + ] + ] } }, "//:extensions.bzl%bazel_build_deps": { "general": { - "bzlTransitiveDigest": "PjK+f/kxkhda9tRFlKVdGfNszPoXs7CDXZUi+ZGWGYU=", + "bzlTransitiveDigest": "Kib+Lx/bmCiuTsKHb+nnvwZZeTkKvKY/zLO6DCser8M=", "accumulatedFileDigests": { - "@@//src/test/tools/bzlmod:MODULE.bazel.lock": "10b96bd3c1eb194b0efe3a13fd06f2051abf36efb33414ad92048883ba471c7f", - "@@//:MODULE.bazel": "63625ac7809ba5bc83e0814e16f223ac28a98df884897ddd5bfbd69fd4e3ddbf" + "@@//src/test/tools/bzlmod:MODULE.bazel.lock": "fa5834588c505d6667ae43e3d31af7d2dfcbc70e5098d49a814472d0b9b75a71", + "@@//:MODULE.bazel": "1ce286c2e04a814940dcb741cddee8772a3d8b97d22e12ee12e116dac57f1cd3" }, "envVariables": {}, "generatedRepoSpecs": { @@ -2203,13 +2317,19 @@ "rules_cc~0.0.9", "rules_java~7.1.0", "rules_license~0.0.7", - "rules_proto~4.0.0", - "rules_python~0.4.0", + "rules_proto~5.3.0-21.7", + "rules_python~0.22.0", "platforms", - "protobuf~3.19.6", + "protobuf~21.7", "zlib~1.3", "apple_support~1.5.0", - "bazel_skylib~1.3.0" + "bazel_skylib~1.3.0", + "rules_pkg~0.7.0", + "abseil-cpp~20211102.0", + "upb~0.0.0-20220923-a547704", + "rules_jvm_external~4.4.2", + "googletest~1.11.0", + "stardoc~0.5.1" ], "lockfile": "@@//src/test/tools/bzlmod:MODULE.bazel.lock" } @@ -2423,12 +2543,124 @@ "build_file": "@@//tools/distributions/debian:debian_proto.BUILD" } } - } + }, + "recordedRepoMappingEntries": [ + [ + "", + "abseil-cpp", + "abseil-cpp~20230125.1" + ], + [ + "", + "apple_support", + "apple_support~1.5.0" + ], + [ + "", + "bazel_skylib", + "bazel_skylib~1.4.1" + ], + [ + "", + "bazel_tools", + "bazel_tools" + ], + [ + "", + "blake3", + "blake3~1.3.3.bcr.1" + ], + [ + "", + "c-ares", + "c-ares~1.15.0" + ], + [ + "", + "com_github_grpc_grpc", + "grpc~1.48.1.bcr.1" + ], + [ + "", + "com_google_protobuf", + "protobuf~21.7" + ], + [ + "", + "io_bazel_skydoc", + "stardoc~0.5.3" + ], + [ + "", + "platforms", + "platforms" + ], + [ + "", + "rules_cc", + "rules_cc~0.0.9" + ], + [ + "", + "rules_go", + "rules_go~0.39.1" + ], + [ + "", + "rules_java", + "rules_java~7.1.0" + ], + [ + "", + "rules_jvm_external", + "rules_jvm_external~5.2" + ], + [ + "", + "rules_license", + "rules_license~0.0.7" + ], + [ + "", + "rules_pkg", + "rules_pkg~0.9.1" + ], + [ + "", + "rules_proto", + "rules_proto~5.3.0-21.7" + ], + [ + "", + "rules_python", + "rules_python~0.26.0" + ], + [ + "", + "upb", + "upb~0.0.0-20220923-a547704" + ], + [ + "", + "zlib", + "zlib~1.3" + ], + [ + "", + "zstd-jni", + "zstd-jni~1.5.2-3.bcr.1" + ], + [ + "bazel_tools", + "bazel_tools", + "bazel_tools" + ] + ] } }, "//:extensions.bzl%bazel_test_deps": { "general": { - "bzlTransitiveDigest": "PjK+f/kxkhda9tRFlKVdGfNszPoXs7CDXZUi+ZGWGYU=", + "bzlTransitiveDigest": "Kib+Lx/bmCiuTsKHb+nnvwZZeTkKvKY/zLO6DCser8M=", "accumulatedFileDigests": {}, "envVariables": {}, "generatedRepoSpecs": { @@ -2456,7 +2688,119 @@ "url": "https://github.com/bazelbuild/continuous-integration/releases/download/rules-1.0.0/bazelci_rules-1.0.0.tar.gz" } } - } + }, + "recordedRepoMappingEntries": [ + [ + "", + "abseil-cpp", + "abseil-cpp~20230125.1" + ], + [ + "", + "apple_support", + "apple_support~1.5.0" + ], + [ + "", + "bazel_skylib", + "bazel_skylib~1.4.1" + ], + [ + "", + "bazel_tools", + "bazel_tools" + ], + [ + "", + "blake3", + "blake3~1.3.3.bcr.1" + ], + [ + "", + "c-ares", + "c-ares~1.15.0" + ], + [ + "", + "com_github_grpc_grpc", + "grpc~1.48.1.bcr.1" + ], + [ + "", + "com_google_protobuf", + "protobuf~21.7" + ], + [ + "", + "io_bazel_skydoc", + "stardoc~0.5.3" + ], + [ + "", + "platforms", + "platforms" + ], + [ + "", + "rules_cc", + "rules_cc~0.0.9" + ], + [ + "", + "rules_go", + "rules_go~0.39.1" + ], + [ + "", + "rules_java", + "rules_java~7.1.0" + ], + [ + "", + "rules_jvm_external", + "rules_jvm_external~5.2" + ], + [ + "", + "rules_license", + "rules_license~0.0.7" + ], + [ + "", + "rules_pkg", + "rules_pkg~0.9.1" + ], + [ + "", + "rules_proto", + "rules_proto~5.3.0-21.7" + ], + [ + "", + "rules_python", + "rules_python~0.26.0" + ], + [ + "", + "upb", + "upb~0.0.0-20220923-a547704" + ], + [ + "", + "zlib", + "zlib~1.3" + ], + [ + "", + "zstd-jni", + "zstd-jni~1.5.2-3.bcr.1" + ], + [ + "bazel_tools", + "bazel_tools", + "bazel_tools" + ] + ] } }, "//:rbe_extension.bzl%bazel_rbe_deps": { @@ -2473,12 +2817,13 @@ "toolchain": "ubuntu2004-bazel-java11" } } - } + }, + "recordedRepoMappingEntries": [] } }, "//tools/android:android_extensions.bzl%remote_android_tools_extensions": { "general": { - "bzlTransitiveDigest": "iz3RFYDcsjupaT10sdSPAhA44WL3eDYkTEnYThllj1w=", + "bzlTransitiveDigest": "S0n86BFe4SJ3lRaZiRA5D46oH52UO2hP1T50t/zldOw=", "accumulatedFileDigests": {}, "envVariables": {}, "generatedRepoSpecs": { @@ -2500,12 +2845,13 @@ "url": "https://maven.google.com/com/android/tools/r8/8.1.56/r8-8.1.56.jar" } } - } + }, + "recordedRepoMappingEntries": [] } }, "//tools/test:extensions.bzl%remote_coverage_tools_extension": { "general": { - "bzlTransitiveDigest": "cizrA62cv8WUgb0cCmx5B6PRijtr/I4TAWxg/4caNGU=", + "bzlTransitiveDigest": "l5mcjH2gWmbmIycx97bzI2stD0Q0M5gpDc0aLOHKIm8=", "accumulatedFileDigests": {}, "envVariables": {}, "generatedRepoSpecs": { @@ -2520,12 +2866,13 @@ ] } } - } + }, + "recordedRepoMappingEntries": [] } }, - "@apple_support~1.5.0//crosstool:setup.bzl%apple_cc_configure_extension": { + "@@apple_support~1.5.0//crosstool:setup.bzl%apple_cc_configure_extension": { "general": { - "bzlTransitiveDigest": "jHojdO5WHRVU9tk3Qspqa1HdHApA7p3vMRe5vEKWQkg=", + "bzlTransitiveDigest": "pMLFCYaRPkgXPQ8vtuNkMfiHfPmRBy6QJfnid4sWfv0=", "accumulatedFileDigests": {}, "envVariables": {}, "generatedRepoSpecs": { @@ -2543,10 +2890,17 @@ "name": "apple_support~1.5.0~apple_cc_configure_extension~local_config_apple_cc_toolchains" } } - } + }, + "recordedRepoMappingEntries": [ + [ + "apple_support~1.5.0", + "bazel_tools", + "bazel_tools" + ] + ] } }, - "@bazel_features~1.1.0//private:extensions.bzl%version_extension": { + "@@bazel_features~1.1.0//private:extensions.bzl%version_extension": { "general": { "bzlTransitiveDigest": "LKmXjK1avT44pRhO3x6Hplu1mU9qrNOaHP+/tJ0VFfE=", "accumulatedFileDigests": {}, @@ -2571,12 +2925,13 @@ } } } - } + }, + "recordedRepoMappingEntries": [] } }, - "@bazel_tools//tools/android:android_extensions.bzl%remote_android_tools_extensions": { + "@@bazel_tools//tools/android:android_extensions.bzl%remote_android_tools_extensions": { "general": { - "bzlTransitiveDigest": "4+Dj2H7maLh8JtpJKiuaI7PSXiIZw6oWX9xsVhnJ5DU=", + "bzlTransitiveDigest": "4x/FXzwoadac6uV9ItZ4eGOyCculGHHrKUhLFNWo3lA=", "accumulatedFileDigests": {}, "envVariables": {}, "generatedRepoSpecs": { @@ -2585,8 +2940,8 @@ "ruleClassName": "http_archive", "attributes": { "name": "bazel_tools~remote_android_tools_extensions~android_tools", - "sha256": "1afa4b7e13c82523c8b69e87f8d598c891ec7e2baa41d9e24e08becd723edb4d", - "url": "https://mirror.bazel.build/bazel_android_tools/android_tools_pkg-0.27.0.tar.gz" + "sha256": "2b661a761a735b41c41b3a78089f4fc1982626c76ddb944604ae3ff8c545d3c2", + "url": "https://mirror.bazel.build/bazel_android_tools/android_tools_pkg-0.30.0.tar" } }, "android_gmaven_r8": { @@ -2594,16 +2949,17 @@ "ruleClassName": "http_jar", "attributes": { "name": "bazel_tools~remote_android_tools_extensions~android_gmaven_r8", - "sha256": "ab1379835c7d3e5f21f80347c3c81e2f762e0b9b02748ae5232c3afa14adf702", - "url": "https://maven.google.com/com/android/tools/r8/8.0.40/r8-8.0.40.jar" + "sha256": "57a696749695a09381a87bc2f08c3a8ed06a717a5caa3ef878a3077e0d3af19d", + "url": "https://maven.google.com/com/android/tools/r8/8.1.56/r8-8.1.56.jar" } } - } + }, + "recordedRepoMappingEntries": [] } }, - "@bazel_tools//tools/cpp:cc_configure.bzl%cc_configure_extension": { + "@@bazel_tools//tools/cpp:cc_configure.bzl%cc_configure_extension": { "general": { - "bzlTransitiveDigest": "sftnIlf92nP/IUiWiMkgL9Sh8Drk9kKhTXHvoavVJZg=", + "bzlTransitiveDigest": "mcsWHq3xORJexV5/4eCvNOLxFOQKV6eli3fkr+tEaqE=", "accumulatedFileDigests": {}, "envVariables": {}, "generatedRepoSpecs": { @@ -2621,12 +2977,19 @@ "name": "bazel_tools~cc_configure_extension~local_config_cc_toolchains" } } - } + }, + "recordedRepoMappingEntries": [ + [ + "bazel_tools", + "bazel_tools", + "bazel_tools" + ] + ] } }, - "@bazel_tools//tools/osx:xcode_configure.bzl%xcode_configure_extension": { + "@@bazel_tools//tools/osx:xcode_configure.bzl%xcode_configure_extension": { "general": { - "bzlTransitiveDigest": "CtmyZVPtInM72JKIFfarSKOF0R/GbDRl8HBuOsRWhRs=", + "bzlTransitiveDigest": "Qh2bWTU6QW6wkrd87qrU4YeY+SG37Nvw3A0PR4Y0L2Y=", "accumulatedFileDigests": {}, "envVariables": {}, "generatedRepoSpecs": { @@ -2639,10 +3002,11 @@ "remote_xcode": "" } } - } + }, + "recordedRepoMappingEntries": [] } }, - "@bazel_tools//tools/sh:sh_configure.bzl%sh_configure_extension": { + "@@bazel_tools//tools/sh:sh_configure.bzl%sh_configure_extension": { "general": { "bzlTransitiveDigest": "hp4NgmNjEg5+xgvzfh6L83bt9/aiiWETuNpwNuF1MSU=", "accumulatedFileDigests": {}, @@ -2655,12 +3019,13 @@ "name": "bazel_tools~sh_configure_extension~local_config_sh" } } - } + }, + "recordedRepoMappingEntries": [] } }, - "@bazel_tools//tools/test:extensions.bzl%remote_coverage_tools_extension": { + "@@bazel_tools//tools/test:extensions.bzl%remote_coverage_tools_extension": { "general": { - "bzlTransitiveDigest": "IWFtZ+6M0WGmNpfnHZMxnVFSDZ6pRTEWt7jixp7XffQ=", + "bzlTransitiveDigest": "y48q5zUu2oMiYv7yUyi7rFB0wt14eqiF/RQcWT6vP7I=", "accumulatedFileDigests": {}, "envVariables": {}, "generatedRepoSpecs": { @@ -2675,12 +3040,13 @@ ] } } - } + }, + "recordedRepoMappingEntries": [] } }, - "@gazelle~0.30.0//:extensions.bzl%go_deps": { + "@@gazelle~0.30.0//:extensions.bzl%go_deps": { "general": { - "bzlTransitiveDigest": "BoYvkoiu4JJx2ptGuMiFUuXn9wupdeJIWbn2MXOkBb8=", + "bzlTransitiveDigest": "qA0ex33bTMERZ7C8nXKz92cjvx42TwSWN1J1CSDT0K8=", "accumulatedFileDigests": { "@@rules_go~0.39.1//:go.sum": "022d36c9ebcc7b5dee1e9b85b3da9c9f3a529ee6f979946d66e4955b8d54614a", "@@rules_go~0.39.1//:go.mod": "a7143f329c2a3e0b983ce74a96c0c25b0d0c59d236d75f7e1b069aadd988d55e", @@ -2937,10 +3303,17 @@ "build_directives": [] } } - } + }, + "recordedRepoMappingEntries": [ + [ + "gazelle~0.30.0", + "bazel_tools", + "bazel_tools" + ] + ] } }, - "@gazelle~0.30.0//internal/bzlmod:non_module_deps.bzl%non_module_deps": { + "@@gazelle~0.30.0//internal/bzlmod:non_module_deps.bzl%non_module_deps": { "general": { "bzlTransitiveDigest": "30wev+wJfzc4s72MCfbP9U8W+3Js2b+Xbo5ofgZbHw8=", "accumulatedFileDigests": {}, @@ -2963,12 +3336,13 @@ "go_env": {} } } - } + }, + "recordedRepoMappingEntries": [] } }, - "@grpc~1.48.1.bcr.1//bazel:grpc_deps.bzl%grpc_repo_deps_ext": { + "@@grpc~1.48.1.bcr.1//bazel:grpc_deps.bzl%grpc_repo_deps_ext": { "general": { - "bzlTransitiveDigest": "S5rdtWt3QVZgX2cP/Ot1NLUmlqgtcoz1cPNksEQYtFQ=", + "bzlTransitiveDigest": "Vi/A+pHz0UslIVgXw0k4nRhXybndFcXR259m5TlMQXA=", "accumulatedFileDigests": {}, "envVariables": {}, "generatedRepoSpecs": { @@ -3267,12 +3641,24 @@ ] } } - } + }, + "recordedRepoMappingEntries": [ + [ + "grpc~1.48.1.bcr.1", + "bazel_tools", + "bazel_tools" + ], + [ + "grpc~1.48.1.bcr.1", + "com_github_grpc_grpc", + "grpc~1.48.1.bcr.1" + ] + ] } }, - "@grpc~1.48.1.bcr.1//bazel:grpc_extra_deps.bzl%grpc_extra_deps_ext": { + "@@grpc~1.48.1.bcr.1//bazel:grpc_extra_deps.bzl%grpc_extra_deps_ext": { "general": { - "bzlTransitiveDigest": "ALqwntEqKRNf03LlwK9t4Oh/flVzCF6ZWFL9xTX69uI=", + "bzlTransitiveDigest": "a/Diq7iDATaU2rBTMgcQ5R3n2KlPdis6c56UUe28yBU=", "accumulatedFileDigests": {}, "envVariables": {}, "generatedRepoSpecs": { @@ -3421,12 +3807,84 @@ } } } - } + }, + "recordedRepoMappingEntries": [ + [ + "grpc~1.48.1.bcr.1", + "com_envoyproxy_protoc_gen_validate", + "grpc~1.48.1.bcr.1~grpc_repo_deps_ext~com_envoyproxy_protoc_gen_validate" + ], + [ + "grpc~1.48.1.bcr.1", + "com_google_googleapis", + "grpc~1.48.1.bcr.1~grpc_repo_deps_ext~com_google_googleapis" + ], + [ + "grpc~1.48.1.bcr.1", + "com_google_protobuf", + "protobuf~21.7" + ], + [ + "grpc~1.48.1.bcr.1", + "envoy_api", + "grpc~1.48.1.bcr.1~grpc_repo_deps_ext~envoy_api" + ], + [ + "grpc~1.48.1.bcr.1", + "io_bazel_rules_go", + "rules_go~0.39.1" + ], + [ + "grpc~1.48.1.bcr.1", + "upb", + "upb~0.0.0-20220923-a547704" + ], + [ + "grpc~1.48.1.bcr.1~grpc_repo_deps_ext~bazel_gazelle", + "bazel_gazelle", + "grpc~1.48.1.bcr.1~grpc_repo_deps_ext~bazel_gazelle" + ], + [ + "grpc~1.48.1.bcr.1~grpc_repo_deps_ext~bazel_gazelle", + "bazel_tools", + "bazel_tools" + ], + [ + "grpc~1.48.1.bcr.1~grpc_repo_deps_ext~com_envoyproxy_protoc_gen_validate", + "bazel_gazelle", + "grpc~1.48.1.bcr.1~grpc_repo_deps_ext~bazel_gazelle" + ], + [ + "grpc~1.48.1.bcr.1~grpc_repo_deps_ext~envoy_api", + "bazel_tools", + "bazel_tools" + ], + [ + "grpc~1.48.1.bcr.1~grpc_repo_deps_ext~envoy_api", + "envoy_api", + "grpc~1.48.1.bcr.1~grpc_repo_deps_ext~envoy_api" + ], + [ + "protobuf~21.7", + "bazel_tools", + "bazel_tools" + ], + [ + "rules_go~0.39.1", + "bazel_tools", + "bazel_tools" + ], + [ + "upb~0.0.0-20220923-a547704", + "bazel_tools", + "bazel_tools" + ] + ] } }, - "@rules_go~0.39.1//go:extensions.bzl%go_sdk": { + "@@rules_go~0.39.1//go:extensions.bzl%go_sdk": { "general": { - "bzlTransitiveDigest": "baCc5Mc6nJAIoj3TovuW1bOINXCqP/9lOv0UCbAkhsk=", + "bzlTransitiveDigest": "cvuDQzKTBy1BBsQPA+7jKTCEaEg3uqu2SQX9x2Z1vz4=", "accumulatedFileDigests": {}, "envVariables": {}, "generatedRepoSpecs": { @@ -3469,12 +3927,19 @@ ] } } - } + }, + "recordedRepoMappingEntries": [ + [ + "rules_go~0.39.1", + "bazel_tools", + "bazel_tools" + ] + ] } }, - "@rules_go~0.39.1//go/private:extensions.bzl%non_module_dependencies": { + "@@rules_go~0.39.1//go/private:extensions.bzl%non_module_dependencies": { "general": { - "bzlTransitiveDigest": "lISD5Aqr6V4eTUAf5oZ4MilfT1BSlMybWvnRzRfSmM4=", + "bzlTransitiveDigest": "CamLV5C1Q66aY4Gu2ce5shMFpOJV/A+fmw4qzuGHmJk=", "accumulatedFileDigests": {}, "envVariables": {}, "generatedRepoSpecs": { @@ -3694,12 +4159,19 @@ ] } } - } + }, + "recordedRepoMappingEntries": [ + [ + "rules_go~0.39.1", + "bazel_tools", + "bazel_tools" + ] + ] } }, - "@rules_java~7.1.0//java:extensions.bzl%toolchains": { + "@@rules_java~7.1.0//java:extensions.bzl%toolchains": { "general": { - "bzlTransitiveDigest": "p7Arq0FCdeuM/UFxax3JGDCetBx8pIqr2m77/MWrf8w=", + "bzlTransitiveDigest": "D02GmifxnV/IhYgspsJMDZ/aE8HxAjXgek5gi6FSto4=", "accumulatedFileDigests": {}, "envVariables": {}, "generatedRepoSpecs": { @@ -4234,14 +4706,26 @@ "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_21\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"21\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:windows\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk21_win//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:windows\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk21_win//:jdk\",\n)\n" } } - } + }, + "recordedRepoMappingEntries": [ + [ + "rules_java~7.1.0", + "bazel_tools", + "bazel_tools" + ], + [ + "rules_java~7.1.0", + "remote_java_tools", + "rules_java~7.1.0~toolchains~remote_java_tools" + ] + ] } }, - "@rules_jvm_external~5.2//:extensions.bzl%maven": { + "@@rules_jvm_external~5.2//:extensions.bzl%maven": { "general": { - "bzlTransitiveDigest": "WAWsskOl4eHIskcL0TuHZGIMjV8sMJaAbAo2luMqofo=", + "bzlTransitiveDigest": "TILQV9AUWIcMmCzpK8EI/A8Y1Nz/OC6X3NPuJDA23kg=", "accumulatedFileDigests": { - "@@//:maven_install.json": "cc2396f3421ceaeca5bf2852dc5aa14b83e5a918f4c3dee5a1214b127214584c", + "@@//:maven_install.json": "cd50b13026ebe6ade5f55d893de893f4568b475291cf9295412b380810a6ac6f", "@@rules_jvm_external~5.2//:rules_jvm_external_deps_install.json": "3ab1f67b0de4815df110bc72ccd6c77882b3b21d3d1e0a84445847b6ce3235a3", "@@//src/tools/android:maven_android_install.json": "09bff3e33d291336046f7c9201630fb5e014f0e60b78b6f09b84e4f5f73ed04f" }, @@ -4831,6 +5315,7 @@ "{ \"group\": \"io.netty\", \"artifact\": \"netty-transport-native-unix-common\", \"version\": \"4.1.93.Final\", \"packaging\": \"jar\", \"classifier\": \"osx-x86_64\" }", "{ \"group\": \"io.netty\", \"artifact\": \"netty-transport\", \"version\": \"4.1.93.Final\" }", "{ \"group\": \"io.reactivex.rxjava3\", \"artifact\": \"rxjava\", \"version\": \"3.1.2\" }", + "{ \"group\": \"it.unimi.dsi\", \"artifact\": \"fastutil\", \"version\": \"7.2.1\" }", "{ \"group\": \"javax.activation\", \"artifact\": \"javax.activation-api\", \"version\": \"1.2.0\" }", "{ \"group\": \"javax.annotation\", \"artifact\": \"javax.annotation-api\", \"version\": \"1.3.2\" }", "{ \"group\": \"javax.inject\", \"artifact\": \"javax.inject\", \"version\": \"1\" }", @@ -6368,6 +6853,18 @@ "downloaded_file_path": "com/beust/jcommander/1.82/jcommander-1.82.jar" } }, + "it_unimi_dsi_fastutil_7_2_1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "name": "rules_jvm_external~5.2~maven~it_unimi_dsi_fastutil_7_2_1", + "sha256": "d73dec5ec18f973f380869b6125d60f5cda77cf6e40e321bd06e0308ed0a40b7", + "urls": [ + "https://repo1.maven.org/maven2/it/unimi/dsi/fastutil/7.2.1/fastutil-7.2.1.jar" + ], + "downloaded_file_path": "it/unimi/dsi/fastutil/7.2.1/fastutil-7.2.1.jar" + } + }, "androidx_databinding_databinding_common_3_4_0_alpha10": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_file", @@ -7342,6 +7839,7 @@ "{ \"group\": \"io.netty\", \"artifact\": \"netty-transport-native-unix-common\", \"version\": \"4.1.93.Final\", \"packaging\": \"jar\", \"classifier\": \"osx-x86_64\" }", "{ \"group\": \"io.netty\", \"artifact\": \"netty-transport\", \"version\": \"4.1.93.Final\" }", "{ \"group\": \"io.reactivex.rxjava3\", \"artifact\": \"rxjava\", \"version\": \"3.1.2\" }", + "{ \"group\": \"it.unimi.dsi\", \"artifact\": \"fastutil\", \"version\": \"7.2.1\" }", "{ \"group\": \"javax.activation\", \"artifact\": \"javax.activation-api\", \"version\": \"1.2.0\" }", "{ \"group\": \"javax.annotation\", \"artifact\": \"javax.annotation-api\", \"version\": \"1.3.2\" }", "{ \"group\": \"javax.inject\", \"artifact\": \"javax.inject\", \"version\": \"1\" }", @@ -7985,12 +8483,24 @@ "downloaded_file_path": "software/amazon/awssdk/sdk-core/2.17.183/sdk-core-2.17.183.jar" } } - } + }, + "recordedRepoMappingEntries": [ + [ + "rules_jvm_external~5.2", + "bazel_tools", + "bazel_tools" + ], + [ + "rules_jvm_external~5.2", + "rules_jvm_external", + "rules_jvm_external~5.2" + ] + ] } }, - "@rules_jvm_external~5.2//:non-module-deps.bzl%non_module_deps": { + "@@rules_jvm_external~5.2//:non-module-deps.bzl%non_module_deps": { "general": { - "bzlTransitiveDigest": "QlnkwH7xmrau2+KLjoV5wWr0r3Ne+JfXhrHUVpwVloQ=", + "bzlTransitiveDigest": "zXwz7xFBNBig3QRyd5WAZU3y/6fZvd6jnP6EkJIutS0=", "accumulatedFileDigests": {}, "envVariables": {}, "generatedRepoSpecs": { @@ -8005,12 +8515,19 @@ ] } } - } + }, + "recordedRepoMappingEntries": [ + [ + "rules_jvm_external~5.2", + "bazel_tools", + "bazel_tools" + ] + ] } }, - "@rules_python~0.26.0//python/extensions:pip.bzl%pip": { + "@@rules_python~0.26.0//python/extensions:pip.bzl%pip": { "os:osx,arch:aarch64": { - "bzlTransitiveDigest": "E4QgOqZbBS/oj8Ee3OTJc/aHg+JLL1isQX37e9bF+jc=", + "bzlTransitiveDigest": "udSms4Q/6hNLCjKfjNOdbSYN66ZRD2hHVyobSu652iM=", "accumulatedFileDigests": { "@@//:requirements.txt": "ff12967a755bb8e9b4c92524f6471a99e14c30474a3d428547c55745ec8f23a0" }, @@ -8050,7 +8567,124 @@ "environment": {} } } - } + }, + "recordedRepoMappingEntries": [ + [ + "bazel_features~1.1.0", + "bazel_features_globals", + "bazel_features~1.1.0~version_extension~bazel_features_globals" + ], + [ + "bazel_features~1.1.0", + "bazel_features_version", + "bazel_features~1.1.0~version_extension~bazel_features_version" + ], + [ + "rules_python~0.26.0", + "bazel_features", + "bazel_features~1.1.0" + ], + [ + "rules_python~0.26.0", + "bazel_skylib", + "bazel_skylib~1.4.1" + ], + [ + "rules_python~0.26.0", + "bazel_tools", + "bazel_tools" + ], + [ + "rules_python~0.26.0", + "pypi__build", + "rules_python~0.26.0~internal_deps~pypi__build" + ], + [ + "rules_python~0.26.0", + "pypi__click", + "rules_python~0.26.0~internal_deps~pypi__click" + ], + [ + "rules_python~0.26.0", + "pypi__colorama", + "rules_python~0.26.0~internal_deps~pypi__colorama" + ], + [ + "rules_python~0.26.0", + "pypi__importlib_metadata", + "rules_python~0.26.0~internal_deps~pypi__importlib_metadata" + ], + [ + "rules_python~0.26.0", + "pypi__installer", + "rules_python~0.26.0~internal_deps~pypi__installer" + ], + [ + "rules_python~0.26.0", + "pypi__more_itertools", + "rules_python~0.26.0~internal_deps~pypi__more_itertools" + ], + [ + "rules_python~0.26.0", + "pypi__packaging", + "rules_python~0.26.0~internal_deps~pypi__packaging" + ], + [ + "rules_python~0.26.0", + "pypi__pep517", + "rules_python~0.26.0~internal_deps~pypi__pep517" + ], + [ + "rules_python~0.26.0", + "pypi__pip", + "rules_python~0.26.0~internal_deps~pypi__pip" + ], + [ + "rules_python~0.26.0", + "pypi__pip_tools", + "rules_python~0.26.0~internal_deps~pypi__pip_tools" + ], + [ + "rules_python~0.26.0", + "pypi__pyproject_hooks", + "rules_python~0.26.0~internal_deps~pypi__pyproject_hooks" + ], + [ + "rules_python~0.26.0", + "pypi__setuptools", + "rules_python~0.26.0~internal_deps~pypi__setuptools" + ], + [ + "rules_python~0.26.0", + "pypi__tomli", + "rules_python~0.26.0~internal_deps~pypi__tomli" + ], + [ + "rules_python~0.26.0", + "pypi__wheel", + "rules_python~0.26.0~internal_deps~pypi__wheel" + ], + [ + "rules_python~0.26.0", + "pypi__zipp", + "rules_python~0.26.0~internal_deps~pypi__zipp" + ], + [ + "rules_python~0.26.0", + "pythons_hub", + "rules_python~0.26.0~python~pythons_hub" + ], + [ + "rules_python~0.26.0~python~pythons_hub", + "python_3_11_aarch64-apple-darwin", + "rules_python~0.26.0~python~python_3_11_aarch64-apple-darwin" + ], + [ + "rules_python~0.26.0~python~pythons_hub", + "python_3_8_aarch64-apple-darwin", + "rules_python~0.26.0~python~python_3_8_aarch64-apple-darwin" + ] + ] }, "os:osx,arch:x86_64": { "bzlTransitiveDigest": "5EamR6lYbDoZchZjoF0opxKmFTBnPc4IRBqvtfKzQBg=", @@ -8093,7 +8727,8 @@ "environment": {} } } - } + }, + "recordedRepoMappingEntries": [] }, "os:windows,arch:amd64": { "bzlTransitiveDigest": "TXSsRggvq8p1Am/XZURcY+/3pp6aMvMI4CIzUjNNoVc=", @@ -8136,10 +8771,11 @@ "environment": {} } } - } + }, + "recordedRepoMappingEntries": [] }, "os:linux,arch:amd64": { - "bzlTransitiveDigest": "8ozZeXZLMP2XAUvOsoOqqAh+f3capth/BEC9p7XrFHQ=", + "bzlTransitiveDigest": "G6KYy2g2q2nZLeFH0iTUPavkolvqd/yzny2kKKJvA/c=", "accumulatedFileDigests": { "@@//:requirements.txt": "ff12967a755bb8e9b4c92524f6471a99e14c30474a3d428547c55745ec8f23a0" }, @@ -8179,12 +8815,129 @@ "environment": {} } } - } + }, + "recordedRepoMappingEntries": [ + [ + "bazel_features~1.1.0", + "bazel_features_globals", + "bazel_features~1.1.0~version_extension~bazel_features_globals" + ], + [ + "bazel_features~1.1.0", + "bazel_features_version", + "bazel_features~1.1.0~version_extension~bazel_features_version" + ], + [ + "rules_python~0.26.0", + "bazel_features", + "bazel_features~1.1.0" + ], + [ + "rules_python~0.26.0", + "bazel_skylib", + "bazel_skylib~1.4.1" + ], + [ + "rules_python~0.26.0", + "bazel_tools", + "bazel_tools" + ], + [ + "rules_python~0.26.0", + "pypi__build", + "rules_python~0.26.0~internal_deps~pypi__build" + ], + [ + "rules_python~0.26.0", + "pypi__click", + "rules_python~0.26.0~internal_deps~pypi__click" + ], + [ + "rules_python~0.26.0", + "pypi__colorama", + "rules_python~0.26.0~internal_deps~pypi__colorama" + ], + [ + "rules_python~0.26.0", + "pypi__importlib_metadata", + "rules_python~0.26.0~internal_deps~pypi__importlib_metadata" + ], + [ + "rules_python~0.26.0", + "pypi__installer", + "rules_python~0.26.0~internal_deps~pypi__installer" + ], + [ + "rules_python~0.26.0", + "pypi__more_itertools", + "rules_python~0.26.0~internal_deps~pypi__more_itertools" + ], + [ + "rules_python~0.26.0", + "pypi__packaging", + "rules_python~0.26.0~internal_deps~pypi__packaging" + ], + [ + "rules_python~0.26.0", + "pypi__pep517", + "rules_python~0.26.0~internal_deps~pypi__pep517" + ], + [ + "rules_python~0.26.0", + "pypi__pip", + "rules_python~0.26.0~internal_deps~pypi__pip" + ], + [ + "rules_python~0.26.0", + "pypi__pip_tools", + "rules_python~0.26.0~internal_deps~pypi__pip_tools" + ], + [ + "rules_python~0.26.0", + "pypi__pyproject_hooks", + "rules_python~0.26.0~internal_deps~pypi__pyproject_hooks" + ], + [ + "rules_python~0.26.0", + "pypi__setuptools", + "rules_python~0.26.0~internal_deps~pypi__setuptools" + ], + [ + "rules_python~0.26.0", + "pypi__tomli", + "rules_python~0.26.0~internal_deps~pypi__tomli" + ], + [ + "rules_python~0.26.0", + "pypi__wheel", + "rules_python~0.26.0~internal_deps~pypi__wheel" + ], + [ + "rules_python~0.26.0", + "pypi__zipp", + "rules_python~0.26.0~internal_deps~pypi__zipp" + ], + [ + "rules_python~0.26.0", + "pythons_hub", + "rules_python~0.26.0~python~pythons_hub" + ], + [ + "rules_python~0.26.0~python~pythons_hub", + "python_3_11_x86_64-unknown-linux-gnu", + "rules_python~0.26.0~python~python_3_11_x86_64-unknown-linux-gnu" + ], + [ + "rules_python~0.26.0~python~pythons_hub", + "python_3_8_x86_64-unknown-linux-gnu", + "rules_python~0.26.0~python~python_3_8_x86_64-unknown-linux-gnu" + ] + ] } }, - "@rules_python~0.26.0//python/extensions:python.bzl%python": { + "@@rules_python~0.26.0//python/extensions:python.bzl%python": { "general": { - "bzlTransitiveDigest": "xlkyXQiU87j2f+jKiO4buHXyNexVt0a6ildROtqkRMA=", + "bzlTransitiveDigest": "8WVQIVnIXBFr70L5lVEwzdfZo6ozRWUK790TujH0YSE=", "accumulatedFileDigests": {}, "envVariables": {}, "generatedRepoSpecs": { @@ -8469,12 +9222,19 @@ "ignore_root_user_error": false } } - } + }, + "recordedRepoMappingEntries": [ + [ + "rules_python~0.26.0", + "bazel_tools", + "bazel_tools" + ] + ] } }, - "@rules_python~0.26.0//python/extensions/private:internal_deps.bzl%internal_deps": { + "@@rules_python~0.26.0//python/extensions/private:internal_deps.bzl%internal_deps": { "general": { - "bzlTransitiveDigest": "+RIu4LoHAUtbbEXVX84ChFRN1Rqdyonp+wk0SJE5eHA=", + "bzlTransitiveDigest": "dKlgHcytYIuArRvGrVsU3/vM58ltOlejmfkkAPUCPnY=", "accumulatedFileDigests": {}, "envVariables": {}, "generatedRepoSpecs": { @@ -8650,7 +9410,19 @@ "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:defs.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude in /python/pip_install/tools/bazel.py\n # to avoid non-determinism following pip install's behavior.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/* *\",\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" } } - } + }, + "recordedRepoMappingEntries": [ + [ + "rules_python~0.26.0", + "bazel_skylib", + "bazel_skylib~1.4.1" + ], + [ + "rules_python~0.26.0", + "bazel_tools", + "bazel_tools" + ] + ] } } } diff --git a/bazel_downloader.cfg b/bazel_downloader.cfg index efa65d2e9c3c32..99a15d355ebec0 100644 --- a/bazel_downloader.cfg +++ b/bazel_downloader.cfg @@ -1,2 +1,6 @@ rewrite (github.com)/(.*) https://mirror.bazel.build/$1/$2 rewrite (github.com)/(.*) https://$1/$2 +rewrite (maven.google.com)/(.*) https://mirror.bazel.build/$1/$2 +rewrite (maven.google.com)/(.*) https://$1/$2 +rewrite (cdn.azul.com)/(.*) https://mirror.bazel.build/$1/$2 +rewrite (cdn.azul.com)/(.*) https://$1/$2 diff --git a/maven_install.json b/maven_install.json index 46f3bf2d0ae1fc..f0f138f92fb87f 100644 --- a/maven_install.json +++ b/maven_install.json @@ -1,7 +1,7 @@ { "__AUTOGENERATED_FILE_DO_NOT_MODIFY_THIS_FILE_MANUALLY": "THERE_IS_NO_DATA_ONLY_ZUUL", - "__INPUT_ARTIFACTS_HASH": 1631956901, - "__RESOLVED_ARTIFACTS_HASH": -1555815775, + "__INPUT_ARTIFACTS_HASH": -2080944044, + "__RESOLVED_ARTIFACTS_HASH": -166480638, "conflict_resolution": { "com.google.code.gson:gson:2.8.9": "com.google.code.gson:gson:2.9.0", "com.google.errorprone:error_prone_annotations:2.3.2": "com.google.errorprone:error_prone_annotations:2.22.0", @@ -532,6 +532,12 @@ }, "version": "1.0.0" }, + "it.unimi.dsi:fastutil": { + "shasums": { + "jar": "d73dec5ec18f973f380869b6125d60f5cda77cf6e40e321bd06e0308ed0a40b7" + }, + "version": "7.2.1" + }, "javax.activation:javax.activation-api": { "shasums": { "jar": "43fdef0b5b6ceb31b0424b208b930c74ab58fac2ceeb7b3f6fd3aeb8b5ca4393" @@ -1817,6 +1823,19 @@ "io.sweers.autotransient:autotransient": [ "io.sweers.autotransient" ], + "it.unimi.dsi:fastutil": [ + "it.unimi.dsi.fastutil", + "it.unimi.dsi.fastutil.booleans", + "it.unimi.dsi.fastutil.bytes", + "it.unimi.dsi.fastutil.chars", + "it.unimi.dsi.fastutil.doubles", + "it.unimi.dsi.fastutil.floats", + "it.unimi.dsi.fastutil.ints", + "it.unimi.dsi.fastutil.io", + "it.unimi.dsi.fastutil.longs", + "it.unimi.dsi.fastutil.objects", + "it.unimi.dsi.fastutil.shorts" + ], "javax.activation:javax.activation-api": [ "javax.activation" ], @@ -2260,6 +2279,7 @@ "io.perfmark:perfmark-api", "io.reactivex.rxjava3:rxjava", "io.sweers.autotransient:autotransient", + "it.unimi.dsi:fastutil", "javax.activation:javax.activation-api", "javax.annotation:javax.annotation-api", "javax.inject:javax.inject", diff --git a/scripts/bash_completion_test.sh b/scripts/bash_completion_test.sh index 6a2f39622795fd..bc243da2aac954 100755 --- a/scripts/bash_completion_test.sh +++ b/scripts/bash_completion_test.sh @@ -794,4 +794,19 @@ test_workspace_boundary() { 'build //sub_repo/' } +test_complete_root_package() { + # This test only works for Bazel + if [[ ! " ${COMMAND_ALIASES[*]} " =~ " bazel " ]]; then return; fi + + mkdir pkgs_repo + touch pkgs_repo/WORKSPACE + cat > pkgs_repo/BUILD <<'EOF' +cc_binary(name = "main") +EOF + cd pkgs_repo 2>/dev/null + + assert_expansion 'build //' \ + 'build //:' +} + run_suite "Tests of bash completion of 'blaze' command." diff --git a/scripts/bazel-complete-template.bash b/scripts/bazel-complete-template.bash index 320d77670c7820..2b3402c2fd9bb0 100644 --- a/scripts/bazel-complete-template.bash +++ b/scripts/bazel-complete-template.bash @@ -269,6 +269,14 @@ _bazel__expand_package_name() { fi fi done + # The loop over the compgen -d output above does not include the top-level + # package. + if [ -f $root$current/BUILD.bazel -o -f $root$current/BUILD ]; then + found=1 + if [ "${type}" != "label-package" ]; then + echo "${current}:" + fi + fi [ $found -gt 0 ] && break # Stop searching package path upon first match. done } diff --git a/scripts/ci/build.sh b/scripts/ci/build.sh index 8f7280b68cbae1..826c55f0813c86 100755 --- a/scripts/ci/build.sh +++ b/scripts/ci/build.sh @@ -146,15 +146,15 @@ function release_to_github() { local release_name=$(get_release_name) local rc=$(get_release_candidate) + local full_release_name=$(get_full_release_name) - if [ -n "${release_name}" ] && [ -z "${rc}" ]; then + if [ -n "${release_name}" ]; then local github_token="$(gsutil cat gs://bazel-trusted-encrypted-secrets/github-trusted-token.enc | \ gcloud kms decrypt --project bazel-public --location global --keyring buildkite --key github-trusted-token --ciphertext-file - --plaintext-file -)" - - if [ "$(is_rolling_release)" -eq 1 ]; then - GITHUB_TOKEN="${github_token}" github-release -prerelease "bazelbuild/bazel" "${release_name}" "" "$(get_release_page)" "${artifact_dir}/*" - else + if [ -z "${rc}" ]; then GITHUB_TOKEN="${github_token}" github-release "bazelbuild/bazel" "${release_name}" "" "$(get_release_page)" "${artifact_dir}/*" + else + GITHUB_TOKEN="${github_token}" github-release -prerelease "bazelbuild/bazel" "${full_release_name}" "" "$(get_release_page)" "${artifact_dir}/*" fi fi } diff --git a/site/en/concepts/labels.md b/site/en/concepts/labels.md index a7a28b9b0af96b..adaf07f96b2e4e 100644 --- a/site/en/concepts/labels.md +++ b/site/en/concepts/labels.md @@ -5,18 +5,35 @@ Book: /_book.yaml {% include "_buttons.html" %} -All targets belong to exactly one package. The name of a target is -called its _label_. Every label uniquely identifies a target. A -typical label in canonical form looks like: +A **label** is an identifier for a target. A typical label in its full canonical +form looks like: + +```none +@@myrepo//my/app/main:app_binary +``` + +The first part of the label is the repository name, `@@myrepo`. The double-`@` +syntax signifies that this is a [*canonical* repo +name](/external/overview#canonical-repo-name), which is unique within +the workspace. Labels with canonical repo names unambiguously identify a target +no matter which context they appear in. + +Often the canonical repo name is an arcane string that looks like +`@@rules_java~7.1.0~toolchains~local_jdk`. What is much more commonly seen is +labels with an [*apparent* repo name](/external/overview#apparent-repo-name), +which looks like: ``` @myrepo//my/app/main:app_binary ``` -The first part of the label is the repository name, `@myrepo//`. +The only difference is the repo name being prefixed with one `@` instead of two. +This refers to a repo with the apparent name `myrepo`, which could be different +based on the context this label appears in. + In the typical case that a label refers to the same repository from which -it is used, the repository identifier may be abbreviated as `//`. -So, inside `@myrepo` this label is usually written as +it is used, the repo name part may be omitted. So, inside `@@myrepo` the first +label is usually written as ``` //my/app/main:app_binary @@ -26,9 +43,9 @@ The second part of the label is the un-qualified package name `my/app/main`, the path to the package relative to the repository root. Together, the repository name and the un-qualified package name form the fully-qualified package name -`@myrepo//my/app/main`. When the label refers to the same +`@@myrepo//my/app/main`. When the label refers to the same package it is used in, the package name (and optionally, the colon) -may be omitted. So, inside `@myrepo//my/app/main`, +may be omitted. So, inside `@@myrepo//my/app/main`, this label may be written either of the following ways: ``` @@ -56,14 +73,14 @@ this file is in the `my/app/main/testdata` subdirectory of the repository: //my/app/main:testdata/input.txt ``` -Strings like `//my/app` and `@some_repo//my/app` have two meanings depending on +Strings like `//my/app` and `@@some_repo//my/app` have two meanings depending on the context in which they are used: when Bazel expects a label, they mean -`//my/app:app` and `@some_repo//my/app:app`, respectively. But, when Bazel +`//my/app:app` and `@@some_repo//my/app:app`, respectively. But, when Bazel expects a package (e.g. in `package_group` specifications), they reference the package that contains that label. A common mistake in `BUILD` files is using `//my/app` to refer to a package, or -to *all* the targets in a package--it does not. Remember, it is +to *all* targets in a package--it does not. Remember, it is equivalent to `//my/app:app`, so it names the `app` target in the `my/app` package of the current repository. @@ -89,9 +106,9 @@ are two ways (one wrong, one correct) to refer to this file within -Labels starting with `@//` are references to the main +Labels starting with `@@//` are references to the main repository, which will still work even from external repositories. -Therefore `@//a/b/c` is different from +Therefore `@@//a/b/c` is different from `//a/b/c` when referenced from an external repository. The former refers back to the main repository, while the latter looks for `//a/b/c` in the external repository itself. diff --git a/site/en/extending/repo.md b/site/en/extending/repo.md index cf6bc1d38a976a..e617d625bde305 100644 --- a/site/en/extending/repo.md +++ b/site/en/extending/repo.md @@ -114,12 +114,11 @@ following things changes: * The parameters passed to the declaration of the repository in the `WORKSPACE` file. * The Starlark code comprising the implementation of the repository. -* The value of any environment variable declared with the `environ` - attribute of the [`repository_rule`](/rules/lib/globals/bzl#repository_rule). - The values of these environment variables can be hard-wired on the command - line with the - [`--action_env`](/reference/command-line-reference#flag--action_env) - flag (but this flag will invalidate every action of the build). +* The value of any environment variable passed to `repository_ctx`'s + `getenv()` method or declared with the `environ` attribute of the + [`repository_rule`](/rules/lib/globals/bzl#repository_rule). The values + of these environment variables can be hard-wired on the command line with the + [`--repo_env`](/reference/command-line-reference#flag--repo_env) flag. * The content of any file passed to the `read()`, `execute()` and similar methods of `repository_ctx` which is referred to by a label (for example, `//mypkg:label.txt` but not `mypkg/label.txt`) diff --git a/site/en/external/extension.md b/site/en/external/extension.md index 5ba7c74bda4885..6c6aec83ebca98 100644 --- a/site/en/external/extension.md +++ b/site/en/external/extension.md @@ -174,4 +174,12 @@ repositories generated by another extension. Even if you don't use this functionality, it's best to put them in separate files in case you need it later. This is because the extension's identify is based on its file, so moving the extension into another file later changes your public API and is a backwards -incompatible change for your users. \ No newline at end of file +incompatible change for your users. + +### Specify the operating system and architecture + +If your extension relies on the operating system or its architecture type, +ensure to indicate this in the extension definition using the `os_dependent` +and `arch_dependent` boolean attributes. This ensures that Bazel recognizes the +need for re-evaluation if there are changes to either of them. + diff --git a/site/en/external/migration.md b/site/en/external/migration.md index c4eb0c4050dbab..d860e1f894cd97 100644 --- a/site/en/external/migration.md +++ b/site/en/external/migration.md @@ -152,7 +152,9 @@ repository. ### Fetch external dependencies with module extensions{:#fetch-deps-module-extensions} If your dependency is not a Bazel project or not yet available in any Bazel -registry, you can introduce it using [module extensions](/external/extension). +registry, you can introduce it using +[`use_repo_rule`](/external/module#use_repo_rule) or [module +extensions](/external/extension). * **WORKSPACE** @@ -172,9 +174,24 @@ registry, you can introduce it using [module extensions](/external/extension). * **Bzlmod** - With Bzlmod, you have to move the definition into a `.bzl` file, which also - lets you share the definition between WORKSPACE and Bzlmod during the - migration period. + With Bzlmod, you can use the `use_repo_rule` directive in your MODULE.bazel + file to directly instantiate repos: + + ```python + ## MODULE.bazel + http_file = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file") + http_file( + name = "data_file", + url = "http://example.com/file", + sha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + ) + ``` + + Under the hood, this is implemented using a module extension. If you need to + perform more complex logic than simply invoking a repo rule, you could also + implement a module extension yourself. You'll need to move the definition + into a `.bzl` file, which also lets you share the definition between + WORKSPACE and Bzlmod during the migration period. ```python ## repositories.bzl diff --git a/site/en/external/module.md b/site/en/external/module.md index b4210e1e007942..5baeecc0843e74 100644 --- a/site/en/external/module.md +++ b/site/en/external/module.md @@ -173,6 +173,21 @@ Bazel supports the following non-registry overrides: * [`git_override`](/rules/lib/globals/module#git_override) * [`local_path_override`](/rules/lib/globals/module#local_path_override) +## Define repos that don't represent Bazel modules {:#use_repo_rule} + +With `bazel_dep`, you can define repos that represent other Bazel modules. +Sometimes there is a need to define a repo that does _not_ represent a Bazel +module; for example, one that contains a plain JSON file to be read as data. + +In this case, you could use the [`use_repo_rule` +directive](/rules/lib/globals/module#use_repo_rule) to directly define a repo +by invoking a repo rule. This repo will only be visible to the module it's +defined in. + +Under the hood, this is implemented using the same mechanism as [module +extensions](/external/extension), which lets you define repos with more +flexibility. + ## Repository names and strict deps The [canonical name](/external/overview#canonical-repo-name) of a repo backing a diff --git a/site/en/external/overview.md b/site/en/external/overview.md index 97714878a0f46e..bdda1cf5f9bddc 100644 --- a/site/en/external/overview.md +++ b/site/en/external/overview.md @@ -25,8 +25,14 @@ in Bazel, before going into a bit more detail about the two systems in order. ### Repository {:#repository} -A directory with a `WORKSPACE` or `WORKSPACE.bazel` file, containing source -files to be used in a Bazel build. Often shortened to just **repo**. +A directory tree with a boundary marker file at its root, containing source +files that can be used in a Bazel build. Often shortened to just **repo**. + +A repo boundary marker file can be `MODULE.bazel` (signaling that this repo +represents a Bazel module), `REPO.bazel` (see [below](#repo.bazel)), or in +legacy contexts, `WORKSPACE` or `WORKSPACE.bazel`. Any repo boundary marker file +will signify the boundary of a repo; multiple such files can coexist in a +directory. ### Main repository {:#main-repository} @@ -100,6 +106,29 @@ canonical name `canonical_name`: ls $(bazel info output_base)/external/{{ '' }} canonical_name {{ '' }} ``` +### REPO.bazel file {:#repo.bazel} + +The `REPO.bazel` file is used to mark the topmost boundary of the directory tree +that constitutes a repo. It doesn't need to contain anything to serve as a repo +boundary file; however, it can also be used to specify some common attributes +for all build targets inside the repo. + +The syntax of a `REPO.bazel` file is similar to `BUILD` files, except that no +`load` statements are supported, and only a single function, `repo()`, is +available. `repo()` takes the same arguments as the [`package()` +function](/reference/be/functions#package) in `BUILD` files; whereas `package()` +specifies common attributes for all build targets inside the package, `repo()` +analogously does so for all build targets inside the repo. + +For example, you can specify a common license for all targets in your repo by +having the following `REPO.bazel` file: + +```python +repo( + default_package_metadata = ["//:my_license"], +) +``` + ## Manage external dependencies with Bzlmod {:#bzlmod} Bzlmod, the new external dependency subsystem, does not directly work with repo diff --git a/site/en/external/registry.md b/site/en/external/registry.md index 0cdf9d64b8b13d..2a064df2740ba2 100644 --- a/site/en/external/registry.md +++ b/site/en/external/registry.md @@ -64,6 +64,16 @@ An index registry must follow the format below: By default, the archive type is determined from the file extension of the URL. If the file has no extension, you can explicitly specify one of the following: `"zip"`, `"jar"`, `"war"`, `"aar"`, `"tar"`, `"tar.gz"`, `"tgz"`, `"tar.xz"`, `"txz"`, `"tar.zst"`, `"tzst"`, `tar.bz2`, `"ar"`, or `"deb"`. + * The type can be changed to use a git repository, with these fields: + * `type`: `git_repository` + * The following fields as described at https://bazel.build/rules/lib/repo/git: + * `remote` + * `commit` + * `shallow_since` + * `tag` + * `init_submodules` + * `verbose` + * `strip_prefix` * The type can be changed to use a local path, representing a `local_repository` repo, with these fields: * `type`: `local_path` diff --git a/site/en/reference/glossary.md b/site/en/reference/glossary.md index a63bd5176d3ca1..09d31265506406 100644 --- a/site/en/reference/glossary.md +++ b/site/en/reference/glossary.md @@ -232,6 +232,9 @@ reference to `//:bar`. `//:foo` has an *action dependency* on `//:bar` if an action in `//:foo` depends on an input [artifact](#artifact) created by an action in `//:bar`. +In certain contexts, it could also refer to an _external dependency_; see +[modules](#module). + ### Depset {:#depset} A data structure for collecting data on transitive dependencies. Optimized so @@ -308,28 +311,30 @@ build. ### Label {:#label} -An identifier for a [target](#target). A fully-qualified label such as -`//path/to/package:target` consists of `//` to mark the workspace root -directory, `path/to/package` as the directory that contains the [`BUILD` -file](#build-file) declaring the target, and `:target` as the name of the target -declared in the aforementioned `BUILD` file. May also be prefixed with -`@my_repository//<..>` to indicate that the target is declared in an [external -repository](/docs/external) named `my_repository`. +An identifier for a [target](#target). Generally has the form +`@repo//path/to/package:target`, where `repo` is the (apparent) name of the +[repository](#repository) containing the target, `path/to/package` is the path +to the directory that contains the [`BUILD` file](#build-file) declaring the +target (this directory is also known as the [package](#package)), and `target` +is the name of the target itself. Depending on the situation, parts of this +syntax may be omitted. + +**See also**: [Labels](/concepts/labels) ### Loading phase {:#loading-phase} -The first phase of a build where Bazel parses `WORKSPACE`, `BUILD`, and [`.bzl` -files](#bzl-file) to create [packages](#package). [Macros](#macro) and certain -functions like `glob()` are evaluated in this phase. Interleaved with the second -phase of the build, the [analysis phase](#analysis-phase), to build up a [target +The first phase of a build where Bazel executes [`BUILD` files](#build-file) to +create [packages](#package). [Macros](#macro) and certain functions like +`glob()` are evaluated in this phase. Interleaved with the second phase of the +build, the [analysis phase](#analysis-phase), to build up a [target graph](#target-graph). ### Macro {:#macro} A mechanism to compose multiple [rule](#rule) target declarations together under a single [Starlark](#starlark) function. Enables reusing common rule declaration -patterns across `BUILD` files. Expanded to the underlying rule target declarations -during the [loading phase](#loading-phase). +patterns across `BUILD` files. Expanded to the underlying rule target +declarations during the [loading phase](#loading-phase). **See also:** [Macro documentation](/extending/macros) @@ -341,6 +346,32 @@ identifiers for *spawn strategy* selections. Some examples of action mnemonics are `Javac` from Java rules, `CppCompile` from C++ rules, and `AndroidManifestMerger` from Android rules. +### Module {:#module} + +A Bazel project that can have multiple versions, each of which can have +dependencies on other modules. This is analogous to familiar concepts in other +dependency management systems, such as a Maven _artifact_, an npm _package_, a +Go _module_, or a Cargo _crate_. Modules form the backbone of Bazel's external +dependency management system. + +Each module is backed by a [repo](#repository) with a `MODULE.bazel` file at its +root. This file contains metadata about the module itself (such as its name and +version), its direct dependencies, and various other data including toolchain +registrations and [module extension](#module-extension) input. + +Module metadata is hosted in Bazel registries. + +**See also:** [Bazel modules](/external/module) + +### Module Extension {:#module-extension} + +A piece of logic that can be run to generate [repos](#repository) by reading +inputs from across the [module](#module) dependency graph and invoking [repo +rules](#repository-rule). Module extensions have capabilities similar to repo +rules, allowing them to access the internet, perform file I/O, and so on. + +**See also:** [Module extensions](/external/extension) + ### Native rules {:#native-rules} [Rules](#rule) that are built into Bazel and implemented in Java. Such rules @@ -351,8 +382,8 @@ example, `native.cc_library` or `native.java_library`). User-defined rules ### Output base {:#output-base} A [workspace](#workspace)-specific directory to store Bazel output files. Used -to separate outputs from the *workspace*'s source tree. Located in the [output -user root](#output-user-root). +to separate outputs from the *workspace*'s source tree (the [main +repo](#repository)). Located in the [output user root](#output-user-root). ### Output groups {:#output-groups} @@ -376,9 +407,9 @@ also known as [output bases](#output-base). ### Package {:#package} The set of [targets](#target) defined by a [`BUILD` file](#build-file). A -package's name is the `BUILD` file's path relative to the workspace root. A -package can contain subpackages, or subdirectories containing `BUILD` files, -thus forming a package hierarchy. +package's name is the `BUILD` file's path relative to the [repo](#repository) +root. A package can contain subpackages, or subdirectories containing `BUILD` +files, thus forming a package hierarchy. ### Package group {:#package-group} @@ -422,16 +453,48 @@ but can't analyze the effects of `select()`, [build flags](#command-flags), **See also:** [Query how-to](/query/guide), [Query reference](/query/language) +### Repository {:#repository} + +A directory tree with a boundary marker file at its root, containing source +files that can be used in a Bazel build. Often shortened to just **repo**. + +A repo boundary marker file can be `MODULE.bazel` (signaling that this repo +represents a Bazel module), `REPO.bazel`, or in legacy contexts, `WORKSPACE` or +`WORKSPACE.bazel`. Any repo boundary marker file will signify the boundary of a +repo; multiple such files can coexist in a directory. + +The *main repo* is the repo in which the current Bazel command is being run. + +*External repos* are defined by specifying [modules](#module) in `MODULE.bazel` +files, or invoking [repo rules](#repository-rule) in [module +extensions](#module-extension). They can be fetched on demand to a predetermined +"magical" location on disk. + +Each repo has a unique, constant *canonical* name, and potentially different +*apparent* names when viewed from other repos. + +**See also**: [External dependencies overview](/external/overview) + ### Repository cache {:#repo-cache} A shared content-addressable cache of files downloaded by Bazel for builds, shareable across [workspaces](#workspace). Enables offline builds after the -initial download. Commonly used to cache files downloaded through repository -rules like `http_archive` and repository rule APIs like +initial download. Commonly used to cache files downloaded through [repository +rules](#repository-rule) like `http_archive` and repository rule APIs like `repository_ctx.download`. Files are cached only if their SHA-256 checksums are specified for the download. - +### Repository rule {:#repository-rule} + +A schema for repository definitions that tells Bazel how to materialize (or +"fetch") a [repository](#repository). Often shortened to just **repo rule**. +Repo rules are invoked by Bazel internally to define repos backed by +[modules](#module), or can be invoked by [module extensions](#module-extension). +Repo rules can access the internet or perform file I/O; the most common repo +rule is `http_archive` to download an archive containing source files from the +internet. + +**See also:** [Repo rule documentation](/extending/repo) ### Reproducibility {:#reproducibility} @@ -618,12 +681,10 @@ or `.bzl` file may load a given `.bzl` file. Without context, usually ### Workspace {:#workspace} -A directory containing a `WORKSPACE` file and source code for the software you -want to build. Labels that start with `//` are relative to the workspace -directory. - -### WORKSPACE file {:#workspace-file} +The environment shared by all Bazel commands run from the same [main +repository](#repository). -Defines a directory to be a [workspace](#workspace). The file can be empty, -although it usually contains external repository declarations to fetch -additional dependencies from the network or local filesystem. +Note that historically the concepts of "repository" and "workspace" have been +conflated; the term "workspace" has often been used to refer to the main +repository, and sometimes even used as a synonym of "repository". Such usage +should be avoided for clarity. diff --git a/src/MODULE.tools b/src/MODULE.tools index 40e6d70e79b826..2bcc239489ddbb 100644 --- a/src/MODULE.tools +++ b/src/MODULE.tools @@ -8,7 +8,7 @@ bazel_dep(name = "rules_cc", version = "0.0.9") bazel_dep(name = "rules_java", version = "7.1.0") bazel_dep(name = "rules_license", version = "0.0.3") bazel_dep(name = "rules_proto", version = "4.0.0") -bazel_dep(name = "rules_python", version = "0.4.0") +bazel_dep(name = "rules_python", version = "0.22.0") bazel_dep(name = "platforms", version = "0.0.7") bazel_dep(name = "protobuf", version = "3.19.6", repo_name = "com_google_protobuf") diff --git a/src/java_tools/singlejar/java/com/google/devtools/build/singlejar/ZipCombiner.java b/src/java_tools/singlejar/java/com/google/devtools/build/singlejar/ZipCombiner.java index 44d4f0262b69e5..33cf205c7e4000 100644 --- a/src/java_tools/singlejar/java/com/google/devtools/build/singlejar/ZipCombiner.java +++ b/src/java_tools/singlejar/java/com/google/devtools/build/singlejar/ZipCombiner.java @@ -66,6 +66,7 @@ * ZIP format */ public class ZipCombiner implements AutoCloseable { + private static final int INFLATER_BUFFER_BYTES = 8192; public static final Date DOS_EPOCH = new Date(ZipUtil.DOS_EPOCH); /** * Whether to compress or decompress entries. @@ -440,7 +441,7 @@ public void addZip(File zipFile) throws IOException { entries.put(filename, null); InputStream in = zip.getRawInputStream(entry); if (entry.getMethod() == Compression.DEFLATED) { - in = new InflaterInputStream(in, getInflater()); + in = new InflaterInputStream(in, getInflater(), INFLATER_BUFFER_BYTES); } action.getStrategy().merge(in, action.getMergeBuffer()); break; @@ -492,7 +493,9 @@ private void writeEntryFromBuffer(ZipFileEntry entry, byte[] uncompressed) throw writeEntry(entry, new ByteArrayInputStream(uncompressed)); } else { ByteArrayOutputStream compressed = new ByteArrayOutputStream(); - copyStream(new DeflaterInputStream(new ByteArrayInputStream(uncompressed), getDeflater()), + copyStream( + new DeflaterInputStream( + new ByteArrayInputStream(uncompressed), getDeflater(), INFLATER_BUFFER_BYTES), compressed); entry.setMethod(Compression.DEFLATED); entry.setCompressedSize(compressed.size()); @@ -529,14 +532,19 @@ private void writeEntry(ZipReader zip, ZipFileEntry entry, EntryAction action) // from the raw file data and deflate to a temporary byte array to determine the deflated // size. Then use this byte array as the input stream for writing the entry. ByteArrayOutputStream tmp = new ByteArrayOutputStream(); - copyStream(new DeflaterInputStream(zip.getRawInputStream(entry), getDeflater()), tmp); + copyStream( + new DeflaterInputStream( + zip.getRawInputStream(entry), getDeflater(), INFLATER_BUFFER_BYTES), + tmp); data = new ByteArrayInputStream(tmp.toByteArray()); outEntry.setMethod(Compression.DEFLATED); outEntry.setCompressedSize(tmp.size()); } else if (mode == OutputMode.FORCE_STORED && entry.getMethod() != Compression.STORED) { // The output mode is stored, but the entry compression is not; create an inflater stream - // from the raw file data. - data = new InflaterInputStream(zip.getRawInputStream(entry), getInflater()); + // from the raw file data. + data = + new InflaterInputStream( + zip.getRawInputStream(entry), getInflater(), INFLATER_BUFFER_BYTES); outEntry.setMethod(Compression.STORED); outEntry.setCompressedSize(entry.getSize()); } else { diff --git a/src/java_tools/singlejar/java/com/google/devtools/build/zip/ZipEntryInputStream.java b/src/java_tools/singlejar/java/com/google/devtools/build/zip/ZipEntryInputStream.java index f162997a37c186..e40b049fabe928 100644 --- a/src/java_tools/singlejar/java/com/google/devtools/build/zip/ZipEntryInputStream.java +++ b/src/java_tools/singlejar/java/com/google/devtools/build/zip/ZipEntryInputStream.java @@ -15,7 +15,6 @@ package com.google.devtools.build.zip; import com.google.devtools.build.zip.ZipFileEntry.Compression; - import java.io.IOException; import java.io.InputStream; import java.util.zip.Inflater; @@ -24,6 +23,7 @@ /** An input stream for reading the file data of a ZIP file entry. */ class ZipEntryInputStream extends InputStream { + private static final int INFLATER_BUFFER_BYTES = 8192; private InputStream stream; private long rem; @@ -61,7 +61,7 @@ class ZipEntryInputStream extends InputStream { rem = zipEntry.getSize(); } if (!raw && zipEntry.getMethod() == Compression.DEFLATED) { - stream = new InflaterInputStream(stream, new Inflater(true)); + stream = new InflaterInputStream(stream, new Inflater(true), INFLATER_BUFFER_BYTES); } } diff --git a/src/main/cpp/blaze.cc b/src/main/cpp/blaze.cc index 6a764b15a52082..128104d4ecfec7 100644 --- a/src/main/cpp/blaze.cc +++ b/src/main/cpp/blaze.cc @@ -1011,7 +1011,9 @@ static void EnsureCorrectRunningVersion(const StartupOptions &startup_options, // find install bases that haven't been used for a long time std::unique_ptr mtime( blaze_util::CreateFileMtime()); - if (!mtime->SetToNow(blaze_util::Path(startup_options.install_base))) { + // Ignore permissions errors (i.e. if the install base is not writable): + if (!mtime->SetToNowIfPossible( + blaze_util::Path(startup_options.install_base))) { string err = GetLastErrorString(); BAZEL_DIE(blaze_exit_code::LOCAL_ENVIRONMENTAL_ERROR) << "failed to set timestamp on '" << startup_options.install_base diff --git a/src/main/cpp/util/file_platform.h b/src/main/cpp/util/file_platform.h index a0860dea7d0c5b..4157f01f8fd058 100644 --- a/src/main/cpp/util/file_platform.h +++ b/src/main/cpp/util/file_platform.h @@ -48,6 +48,12 @@ class IFileMtime { // Returns true if the mtime was changed successfully. virtual bool SetToNow(const Path &path) = 0; + // Attempt to set the mtime of file under `path` to the current time. + // + // Returns true if the mtime was changed successfully OR if setting the mtime + // failed due to permissions errors. + virtual bool SetToNowIfPossible(const Path &path) = 0; + // Sets the mtime of file under `path` to the distant future. // "Distant future" should be on the order of some years into the future, like // a decade. diff --git a/src/main/cpp/util/file_posix.cc b/src/main/cpp/util/file_posix.cc index 8b1d541660c6ea..ffe97880471475 100644 --- a/src/main/cpp/util/file_posix.cc +++ b/src/main/cpp/util/file_posix.cc @@ -453,6 +453,7 @@ class PosixFileMtime : public IFileMtime { bool IsUntampered(const Path &path) override; bool SetToNow(const Path &path) override; + bool SetToNowIfPossible(const Path &path) override; bool SetToDistantFuture(const Path &path) override; private: @@ -486,6 +487,19 @@ bool PosixFileMtime::SetToNow(const Path &path) { return Set(path, times); } +bool PosixFileMtime::SetToNowIfPossible(const Path &path) { + bool okay = this->SetToNow(path); + if (!okay) { + // `SetToNow`/`Set` are backed by `utime(2)` which can return `EROFS` and + // `EPERM` when there's a permissions issue: + if (errno == EROFS || errno == EPERM) { + okay = true; + } + } + + return okay; +} + bool PosixFileMtime::SetToDistantFuture(const Path &path) { return Set(path, distant_future_); } diff --git a/src/main/cpp/util/file_windows.cc b/src/main/cpp/util/file_windows.cc index 33eba1f40122c4..2cb41a4617a105 100644 --- a/src/main/cpp/util/file_windows.cc +++ b/src/main/cpp/util/file_windows.cc @@ -115,6 +115,7 @@ class WindowsFileMtime : public IFileMtime { bool IsUntampered(const Path& path) override; bool SetToNow(const Path& path) override; + bool SetToNowIfPossible(const Path& path) override; bool SetToDistantFuture(const Path& path) override; private: @@ -179,6 +180,19 @@ bool WindowsFileMtime::SetToNow(const Path& path) { return Set(path, GetNow()); } +bool WindowsFileMtime::SetToNowIfPossible(const Path& path) { + bool okay = this->SetToNow(path); + if (!okay) { + // `SetToNow` is backed by `CreateFileW` + `SetFileTime`; the former can + // return `ERROR_ACCESS_DENIED` if there's a permissions issue: + if (GetLastError() == ERROR_ACCESS_DENIED) { + okay = true; + } + } + + return okay; +} + bool WindowsFileMtime::SetToDistantFuture(const Path& path) { return Set(path, distant_future_); } diff --git a/src/main/java/com/google/devtools/build/docgen/templates/be/functions.vm b/src/main/java/com/google/devtools/build/docgen/templates/be/functions.vm index 5e92910e5f6fd5..80c354a9fc9381 100644 --- a/src/main/java/com/google/devtools/build/docgen/templates/be/functions.vm +++ b/src/main/java/com/google/devtools/build/docgen/templates/be/functions.vm @@ -39,6 +39,10 @@ package(default_deprecation, default_package_metadata, default_testonly, default

This function declares metadata that applies to every rule in the package. It is used at most once within a package (BUILD file).

+

For the counterpart that declares metadata applying to every rule in the whole +repository, use the repo() function in the +REPO.bazel file at the root of your repo. +The repo() function takes exactly the same arguments as package().

The package() function should be called right after all the load() statements at the top of the file, before any rule.

diff --git a/src/main/java/com/google/devtools/build/lib/actions/ActionExecutionContext.java b/src/main/java/com/google/devtools/build/lib/actions/ActionExecutionContext.java index b14cd4361fe8ba..78585cf4902373 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/ActionExecutionContext.java +++ b/src/main/java/com/google/devtools/build/lib/actions/ActionExecutionContext.java @@ -345,7 +345,7 @@ public void maybeReportSubcommand(Spawn spawn) { /* environmentVariablesToClear= */ null, getExecRoot().getPathString(), spawn.getConfigurationChecksum(), - spawn.getExecutionPlatformLabelString()); + spawn.getExecutionPlatformLabel()); getEventHandler().handle(Event.of(EventKind.SUBCOMMAND, null, "# " + reason + "\n" + message)); } diff --git a/src/main/java/com/google/devtools/build/lib/actions/ActionInputHelper.java b/src/main/java/com/google/devtools/build/lib/actions/ActionInputHelper.java index 9c57f73edf3ade..5bcb26aad5d2f3 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/ActionInputHelper.java +++ b/src/main/java/com/google/devtools/build/lib/actions/ActionInputHelper.java @@ -21,7 +21,10 @@ import com.google.devtools.build.lib.vfs.Path; import com.google.devtools.build.lib.vfs.PathFragment; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; +import java.util.Set; +import java.util.TreeSet; /** Helper utility to create ActionInput instances. */ public final class ActionInputHelper { @@ -122,14 +125,24 @@ public static List expandArtifacts( ArtifactExpander artifactExpander, boolean keepEmptyTreeArtifacts) { List result = new ArrayList<>(); + Set emptyTreeArtifacts = new TreeSet<>(); + Set treeFileArtifactParents = new HashSet<>(); for (ActionInput input : inputs.toList()) { if (input instanceof Artifact) { - Artifact.addExpandedArtifact( - (Artifact) input, result, artifactExpander, keepEmptyTreeArtifacts); + Artifact inputArtifact = (Artifact) input; + Artifact.addExpandedArtifact(inputArtifact, result, artifactExpander, emptyTreeArtifacts); + if (inputArtifact.isChildOfDeclaredDirectory()) { + treeFileArtifactParents.add(inputArtifact.getParent()); + } } else { result.add(input); } } + + if (keepEmptyTreeArtifacts) { + emptyTreeArtifacts.removeAll(treeFileArtifactParents); + result.addAll(emptyTreeArtifacts); + } return result; } diff --git a/src/main/java/com/google/devtools/build/lib/actions/Artifact.java b/src/main/java/com/google/devtools/build/lib/actions/Artifact.java index 1775144cfd400a..1a0b1ba55483cb 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/Artifact.java +++ b/src/main/java/com/google/devtools/build/lib/actions/Artifact.java @@ -59,6 +59,7 @@ import java.util.Comparator; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.function.UnaryOperator; import javax.annotation.Nullable; import net.starlark.java.eval.EvalException; @@ -1544,21 +1545,20 @@ public static String joinRootRelativePaths(String delimiter, Iterable /** * Adds an artifact to a collection, expanding it once if it's a middleman or tree artifact. * - *

A middleman artifact is never added to the collection. If {@code keepEmptyTreeArtifacts} is - * true, a tree artifact will be added to the collection when it expands into zero file artifacts. - * Otherwise, only the file artifacts the tree artifact expands into will be added. + *

The middleman or tree artifact is never added to the output collection. If a tree artifact + * expands into zero file artifacts, it is added to emptyTreeArtifacts. */ static void addExpandedArtifact( Artifact artifact, Collection output, ArtifactExpander artifactExpander, - boolean keepEmptyTreeArtifacts) { + Set emptyTreeArtifacts) { if (artifact.isMiddlemanArtifact() || artifact.isTreeArtifact()) { List expandedArtifacts = new ArrayList<>(); artifactExpander.expand(artifact, expandedArtifacts); output.addAll(expandedArtifacts); - if (keepEmptyTreeArtifacts && artifact.isTreeArtifact() && expandedArtifacts.isEmpty()) { - output.add(artifact); + if (artifact.isTreeArtifact() && expandedArtifacts.isEmpty()) { + emptyTreeArtifacts.add(artifact); } } else { output.add(artifact); diff --git a/src/main/java/com/google/devtools/build/lib/actions/BUILD b/src/main/java/com/google/devtools/build/lib/actions/BUILD index ecfe45aefff70c..c8c6e19ef72c22 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/BUILD +++ b/src/main/java/com/google/devtools/build/lib/actions/BUILD @@ -422,18 +422,13 @@ java_library( name = "localhost_capacity", srcs = [ "LocalHostCapacity.java", - "LocalHostResourceFallback.java", - "LocalHostResourceManagerDarwin.java", - "LocalHostResourceManagerLinux.java", + "LocalHostResource.java", "ResourceSet.java", "ResourceSetOrBuilder.java", ], deps = [ ":exec_exception", "//src/main/java/com/google/devtools/build/lib/concurrent", - "//src/main/java/com/google/devtools/build/lib/jni", - "//src/main/java/com/google/devtools/build/lib/unix", - "//src/main/java/com/google/devtools/build/lib/unix:procmeminfo_parser", "//src/main/java/com/google/devtools/build/lib/util:os", "//src/main/java/com/google/devtools/build/lib/worker:worker_key", "//src/main/java/com/google/devtools/common/options", diff --git a/src/main/java/com/google/devtools/build/lib/actions/FileArtifactValue.java b/src/main/java/com/google/devtools/build/lib/actions/FileArtifactValue.java index 1afcd70e2b533b..be99bbd147220b 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/FileArtifactValue.java +++ b/src/main/java/com/google/devtools/build/lib/actions/FileArtifactValue.java @@ -169,11 +169,19 @@ protected boolean couldBeModifiedByMetadata(FileArtifactValue lastKnown) { /** * Optional materialization path. * - *

If present, this artifact is a copy of another artifact. It is still tracked as a - * non-symlink by Bazel, but materialized in the local filesystem as a symlink to the original - * artifact, whose contents live at this location. This is used by {@link - * com.google.devtools.build.lib.remote.AbstractActionInputPrefetcher} to implement zero-cost - * copies of remotely stored artifacts. + *

If present, this artifact is a copy of another artifact whose contents live at this path. + * This can happen when it is declared as a file and not as an unresolved symlink but the action + * that creates it materializes it in the filesystem as a symlink to another output artifact. This + * information is useful in two situations: + * + *

    + *
  1. When the symlink target is a remotely stored artifact, we can avoid downloading it + * multiple times when building without the bytes (see AbstractActionInputPrefetcher). + *
  2. When the symlink target is inaccessible from the sandboxed environment an action runs + * under, we can rewrite it accordingly (see SandboxHelpers). + *
+ * + * @see com.google.devtools.build.lib.skyframe.TreeArtifactValue#getMaterializationExecPath(). */ public Optional getMaterializationExecPath() { return Optional.empty(); @@ -214,6 +222,12 @@ public static FileArtifactValue createForSourceArtifact( xattrProvider); } + public static FileArtifactValue createForResolvedSymlink( + PathFragment realPath, FileArtifactValue metadata, @Nullable byte[] digest) { + return new ResolvedSymlinkFileArtifactValue( + realPath, digest, metadata.getContentsProxy(), metadata.getSize()); + } + public static FileArtifactValue createFromInjectedDigest( FileArtifactValue metadata, @Nullable byte[] digest) { return createForNormalFile(digest, metadata.getContentsProxy(), metadata.getSize()); @@ -439,7 +453,25 @@ public String toString() { } } - private static final class RegularFileArtifactValue extends FileArtifactValue { + private static final class ResolvedSymlinkFileArtifactValue extends RegularFileArtifactValue { + private final PathFragment realPath; + + private ResolvedSymlinkFileArtifactValue( + PathFragment realPath, + @Nullable byte[] digest, + @Nullable FileContentsProxy proxy, + long size) { + super(digest, proxy, size); + this.realPath = realPath; + } + + @Override + public Optional getMaterializationExecPath() { + return Optional.of(realPath); + } + } + + private static class RegularFileArtifactValue extends FileArtifactValue { private final byte[] digest; @Nullable private final FileContentsProxy proxy; private final long size; @@ -462,7 +494,8 @@ public boolean equals(Object o) { RegularFileArtifactValue that = (RegularFileArtifactValue) o; return Arrays.equals(digest, that.digest) && Objects.equals(proxy, that.proxy) - && size == that.size; + && size == that.size + && Objects.equals(getMaterializationExecPath(), that.getMaterializationExecPath()); } @Override diff --git a/src/main/java/com/google/devtools/build/lib/actions/LocalHostCapacity.java b/src/main/java/com/google/devtools/build/lib/actions/LocalHostCapacity.java index 026199db7b3b1d..a0946ec35cc4fe 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/LocalHostCapacity.java +++ b/src/main/java/com/google/devtools/build/lib/actions/LocalHostCapacity.java @@ -17,7 +17,6 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.flogger.GoogleLogger; import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadCompatible; -import com.google.devtools.build.lib.util.OS; /** * This class estimates the local host's resource capacity. @@ -26,7 +25,6 @@ public final class LocalHostCapacity { private static final GoogleLogger logger = GoogleLogger.forEnclosingClass(); - private static final OS currentOS = OS.getCurrent(); private static ResourceSet localHostCapacity; private LocalHostCapacity() {} @@ -39,21 +37,7 @@ public static ResourceSet getLocalHostCapacity() { } private static ResourceSet getNewLocalHostCapacity() { - ResourceSet localResources = null; - switch (currentOS) { - case DARWIN: - localResources = LocalHostResourceManagerDarwin.getLocalHostResources(); - break; - case LINUX: - localResources = LocalHostResourceManagerLinux.getLocalHostResources(); - break; - default: - break; - } - if (localResources == null) { - localResources = LocalHostResourceFallback.getLocalHostResources(); - } - + ResourceSet localResources = LocalHostResource.get(); logger.atInfo().log( "Determined local resources: RAM=%dMB, CPU=%.1f", (int) localResources.getMemoryMb(), localResources.getCpuUsage()); diff --git a/src/main/java/com/google/devtools/build/lib/actions/LocalHostResourceFallback.java b/src/main/java/com/google/devtools/build/lib/actions/LocalHostResource.java similarity index 50% rename from src/main/java/com/google/devtools/build/lib/actions/LocalHostResourceFallback.java rename to src/main/java/com/google/devtools/build/lib/actions/LocalHostResource.java index 77cd5a83f7f444..07edb8fcc365a5 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/LocalHostResourceFallback.java +++ b/src/main/java/com/google/devtools/build/lib/actions/LocalHostResource.java @@ -14,22 +14,28 @@ package com.google.devtools.build.lib.actions; -/** - * This class provide a fallback of the local host's resource capacity. - */ -public class LocalHostResourceFallback { +import com.sun.management.OperatingSystemMXBean; +import java.lang.management.ManagementFactory; + +/** This class computes the local host's resource capacity. */ +final class LocalHostResource { - /* If /proc/* information is not available, guess based on what the JVM thinks. Anecdotally, - * the JVM picks 0.22 the total available memory as maxMemory (tested on a standard Mac), so - * multiply by 3, and divide by 2^20 because we want megabytes. - */ private static final ResourceSet DEFAULT_RESOURCES = ResourceSet.create( - 3.0 * (Runtime.getRuntime().maxMemory() >> 20), + // Only com.sun.management.OperatingSystemMXBean provides the total physical memory size. + // This bean is container-aware as of JDK 14. + // https://github.com/openjdk/jdk/commit/7b82266a159ce363708e347aba7e1b0d38206b48 + ((OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()) + .getTotalPhysicalMemorySize() + / (1024.0 * 1024.0), + // As of JDK 11, availableProcessors is aware of cgroups as commonly used by containers. + // https://hg.openjdk.java.net/jdk/hs/rev/7f22774a5f42#l6.178 Runtime.getRuntime().availableProcessors(), Integer.MAX_VALUE); - public static ResourceSet getLocalHostResources() { + public static ResourceSet get() { return DEFAULT_RESOURCES; } + + private LocalHostResource() {} } diff --git a/src/main/java/com/google/devtools/build/lib/actions/LocalHostResourceManagerDarwin.java b/src/main/java/com/google/devtools/build/lib/actions/LocalHostResourceManagerDarwin.java deleted file mode 100644 index 95116cd88c7f12..00000000000000 --- a/src/main/java/com/google/devtools/build/lib/actions/LocalHostResourceManagerDarwin.java +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2016 The Bazel Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.google.devtools.build.lib.actions; - -import com.google.devtools.build.lib.jni.JniLoader; -import com.google.devtools.build.lib.unix.NativePosixSystem; -import java.io.IOException; -import javax.annotation.Nullable; - -/** - * This class estimates the local host's resource capacity for Darwin. - */ -public class LocalHostResourceManagerDarwin { - - private static int getLogicalCpuCount() throws IOException { - return (int) NativePosixSystem.sysctlbynameGetLong("hw.logicalcpu"); - } - - private static double getMemoryInMb() throws IOException { - return NativePosixSystem.sysctlbynameGetLong("hw.memsize") / 1E6; - } - - @Nullable - public static ResourceSet getLocalHostResources() { - if (!JniLoader.isJniAvailable()) { - return null; - } - - try { - int logicalCpuCount = getLogicalCpuCount(); - double ramMb = getMemoryInMb(); - - return ResourceSet.create( - ramMb, - logicalCpuCount, - Integer.MAX_VALUE); - } catch (IOException e) { - return null; - } - } -} diff --git a/src/main/java/com/google/devtools/build/lib/actions/LocalHostResourceManagerLinux.java b/src/main/java/com/google/devtools/build/lib/actions/LocalHostResourceManagerLinux.java deleted file mode 100644 index fd3c7dfafd203c..00000000000000 --- a/src/main/java/com/google/devtools/build/lib/actions/LocalHostResourceManagerLinux.java +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2016 The Bazel Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.google.devtools.build.lib.actions; - -import com.google.devtools.build.lib.unix.ProcMeminfoParser; -import java.io.IOException; -import javax.annotation.Nullable; - -/** - * This class estimates the local host's resource capacity for Linux. - */ -public class LocalHostResourceManagerLinux { - - private static final String MEM_INFO_FILE = "/proc/meminfo"; - - private static int getLogicalCpuCount() throws IOException { - // As of JDK 11, availableProcessors is aware of cgroups as commonly used by containers. - // https://hg.openjdk.java.net/jdk/hs/rev/7f22774a5f42#l6.178 - return Runtime.getRuntime().availableProcessors(); - } - - private static double getMemoryInMb() throws IOException { - return getMemoryInMbHelper(MEM_INFO_FILE); - } - - @Nullable - public static ResourceSet getLocalHostResources() { - try { - int logicalCpuCount = getLogicalCpuCount(); - double ramMb = getMemoryInMb(); - - return ResourceSet.create( - ramMb, - logicalCpuCount, - Integer.MAX_VALUE); - } catch (IOException e) { - return null; - } - } - - public static double getMemoryInMbHelper(String memInfoFileName) throws IOException { - ProcMeminfoParser memInfo = new ProcMeminfoParser(memInfoFileName); - double ramMb = ProcMeminfoParser.kbToMb(memInfo.getTotalKb()); - return ramMb; - } -} diff --git a/src/main/java/com/google/devtools/build/lib/actions/Spawn.java b/src/main/java/com/google/devtools/build/lib/actions/Spawn.java index 8fa244bf94ee96..282b7888ef8cae 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/Spawn.java +++ b/src/main/java/com/google/devtools/build/lib/actions/Spawn.java @@ -21,7 +21,6 @@ import com.google.devtools.build.lib.collect.nestedset.NestedSet; import com.google.devtools.build.lib.util.DescribableExecutionUnit; import java.util.Collection; -import java.util.Objects; import javax.annotation.Nullable; /** @@ -171,9 +170,9 @@ default boolean isMandatoryOutput(ActionInput output) { @Override @Nullable - default String getExecutionPlatformLabelString() { + default Label getExecutionPlatformLabel() { PlatformInfo executionPlatform = getExecutionPlatform(); - return executionPlatform == null ? null : Objects.toString(executionPlatform.label()); + return executionPlatform != null ? executionPlatform.label() : null; } @Override @@ -184,9 +183,8 @@ default String getConfigurationChecksum() { @Override @Nullable - default String getTargetLabel() { - Label label = getResourceOwner().getOwner().getLabel(); - return label == null ? null : label.toString(); + default Label getTargetLabel() { + return getResourceOwner().getOwner().getLabel(); } /** diff --git a/src/main/java/com/google/devtools/build/lib/analysis/actions/FileWriteAction.java b/src/main/java/com/google/devtools/build/lib/analysis/actions/FileWriteAction.java index 83d4e026fbc1f2..08c6f51380765f 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/actions/FileWriteAction.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/actions/FileWriteAction.java @@ -231,6 +231,7 @@ protected void computeKey( private static final class CompressedFileWriteAction extends FileWriteAction { private static final String GUID = "5bfba914-2251-11ee-be56-0242ac120002"; + private static final int GZIP_BYTES_BUFFER = 8192; private final byte[] compressedBytes; private final int uncompressedSize; @@ -252,7 +253,7 @@ private static final class CompressedFileWriteAction extends FileWriteAction { // Presize on the small end to avoid over-allocating memory. ByteArrayOutputStream byteStream = new ByteArrayOutputStream(dataToCompress.length / 100); - try (GZIPOutputStream zipStream = new GZIPOutputStream(byteStream)) { + try (GZIPOutputStream zipStream = new GZIPOutputStream(byteStream, GZIP_BYTES_BUFFER)) { zipStream.write(dataToCompress); } catch (IOException e) { // This should be impossible since we're writing to a byte array. @@ -268,7 +269,7 @@ private static final class CompressedFileWriteAction extends FileWriteAction { public String getFileContents() { byte[] uncompressedBytes = new byte[uncompressedSize]; try (GZIPInputStream zipStream = - new GZIPInputStream(new ByteArrayInputStream(compressedBytes))) { + new GZIPInputStream(new ByteArrayInputStream(compressedBytes), GZIP_BYTES_BUFFER)) { int read; int totalRead = 0; while (totalRead < uncompressedSize @@ -293,7 +294,7 @@ public String getFileContents() { public DeterministicWriter newDeterministicWriter(ActionExecutionContext ctx) { return out -> { try (GZIPInputStream gzipIn = - new GZIPInputStream(new ByteArrayInputStream(compressedBytes))) { + new GZIPInputStream(new ByteArrayInputStream(compressedBytes), GZIP_BYTES_BUFFER)) { ByteStreams.copy(gzipIn, out); } }; diff --git a/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkRuleClassFunctions.java b/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkRuleClassFunctions.java index 4d5d2ebfa57c8d..31488ce1f47a1c 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkRuleClassFunctions.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkRuleClassFunctions.java @@ -1277,7 +1277,10 @@ public Label label(Object input, StarlarkThread thread) throws EvalException { // environment across .bzl files. Hence, we opt for stack inspection. BazelModuleContext moduleContext = BazelModuleContext.ofInnermostBzlOrFail(thread, "Label()"); try { - return Label.parseWithPackageContext((String) input, moduleContext.packageContext()); + return Label.parseWithPackageContext( + (String) input, + moduleContext.packageContext(), + thread.getThreadLocal(Label.RepoMappingRecorder.class)); } catch (LabelSyntaxException e) { throw Starlark.errorf("invalid label in Label(): %s", e.getMessage()); } diff --git a/src/main/java/com/google/devtools/build/lib/bazel/BUILD b/src/main/java/com/google/devtools/build/lib/bazel/BUILD index 7de94c3cf50b2e..709c010c9ab11c 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/BUILD +++ b/src/main/java/com/google/devtools/build/lib/bazel/BUILD @@ -12,7 +12,6 @@ filegroup( "//src/main/java/com/google/devtools/build/lib/bazel/commands:srcs", "//src/main/java/com/google/devtools/build/lib/bazel/coverage:srcs", "//src/main/java/com/google/devtools/build/lib/bazel/debug:srcs", - "//src/main/java/com/google/devtools/build/lib/bazel/execlog:srcs", "//src/main/java/com/google/devtools/build/lib/bazel/repository:srcs", "//src/main/java/com/google/devtools/build/lib/bazel/rules:srcs", ], @@ -129,7 +128,6 @@ java_library( ], deps = [ "//src/main/java/com/google/devtools/build/lib:runtime", - "//src/main/java/com/google/devtools/build/lib/bazel/execlog:stable_sort", "//src/main/java/com/google/devtools/build/lib/events", "//src/main/java/com/google/devtools/build/lib/exec:execution_options", "//src/main/java/com/google/devtools/build/lib/exec:executor_builder", @@ -138,10 +136,8 @@ java_library( "//src/main/java/com/google/devtools/build/lib/remote/options", "//src/main/java/com/google/devtools/build/lib/util:abrupt_exit_exception", "//src/main/java/com/google/devtools/build/lib/util:detailed_exit_code", - "//src/main/java/com/google/devtools/build/lib/util/io", "//src/main/java/com/google/devtools/build/lib/vfs", "//src/main/protobuf:failure_details_java_proto", - "//src/main/protobuf:spawn_java_proto", "//third_party:guava", "//third_party:jsr305", ], diff --git a/src/main/java/com/google/devtools/build/lib/bazel/BazelFileSystemModule.java b/src/main/java/com/google/devtools/build/lib/bazel/BazelFileSystemModule.java index f5af64e7ab9f66..1afaaa6bcce8df 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/BazelFileSystemModule.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/BazelFileSystemModule.java @@ -75,6 +75,17 @@ public ModuleFileSystem getFileSystem( FileSystem fs; if (OS.getCurrent() == OS.WINDOWS) { + if (!JniLoader.isJniAvailable()) { + Throwable e = checkNotNull(JniLoader.getJniLoadError()); + throw new AbruptExitException( + DetailedExitCode.of( + FailureDetail.newBuilder() + .setMessage(Strings.nullToEmpty(e.getMessage())) + .setFilesystem( + Filesystem.newBuilder().setCode(Code.FILESYSTEM_JNI_NOT_AVAILABLE)) + .build()), + e); + } fs = new WindowsFileSystem(digestHashFunction, options.enableWindowsSymlinks); } else { if (JniLoader.isJniAvailable()) { diff --git a/src/main/java/com/google/devtools/build/lib/bazel/BazelRepositoryModule.java b/src/main/java/com/google/devtools/build/lib/bazel/BazelRepositoryModule.java index 0a2661fde95dc7..56de39965b24f1 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/BazelRepositoryModule.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/BazelRepositoryModule.java @@ -340,10 +340,27 @@ public void beforeCommand(CommandEnvironment env) throws AbruptExitException { starlarkRepositoryFunction.setWorkerExecutorService(repoFetchingWorkerThreadPool); break; case VIRTUAL: - throw new AbruptExitException( - detailedExitCode( - "using a virtual worker thread for repo fetching is not yet supported", - Code.BAD_DOWNLOADER_CONFIG)); + case AUTO: + try { + // Since Google hasn't migrated to JDK 21 yet, we can't directly call + // Executors.newVirtualThreadPerTaskExecutor here. But a bit of reflection never hurt + // anyone... right? (OSS Bazel already ships with a bundled JDK 21) + starlarkRepositoryFunction.setWorkerExecutorService( + (ExecutorService) + Executors.class + .getDeclaredMethod("newVirtualThreadPerTaskExecutor") + .invoke(null)); + } catch (ReflectiveOperationException e) { + if (repoOptions.workerForRepoFetching == RepositoryOptions.WorkerForRepoFetching.AUTO) { + starlarkRepositoryFunction.setWorkerExecutorService(null); + } else { + throw new AbruptExitException( + detailedExitCode( + "couldn't create virtual worker thread executor for repo fetching", + Code.BAD_DOWNLOADER_CONFIG), + e); + } + } } downloadManager.setDisableDownload(repoOptions.disableDownload); if (repoOptions.repositoryDownloaderRetries >= 0) { diff --git a/src/main/java/com/google/devtools/build/lib/bazel/SpawnLogModule.java b/src/main/java/com/google/devtools/build/lib/bazel/SpawnLogModule.java index 99d457a5ad28da..1fcce471cf4133 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/SpawnLogModule.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/SpawnLogModule.java @@ -15,13 +15,15 @@ import static com.google.common.base.Preconditions.checkNotNull; -import com.google.devtools.build.lib.bazel.execlog.StableSort; +import com.google.common.primitives.Booleans; import com.google.devtools.build.lib.buildtool.BuildRequest; import com.google.devtools.build.lib.events.Event; +import com.google.devtools.build.lib.exec.CompactSpawnLogContext; import com.google.devtools.build.lib.exec.ExecutionOptions; import com.google.devtools.build.lib.exec.ExecutorBuilder; +import com.google.devtools.build.lib.exec.ExpandedSpawnLogContext; +import com.google.devtools.build.lib.exec.ExpandedSpawnLogContext.Encoding; import com.google.devtools.build.lib.exec.ModuleActionContextRegistry; -import com.google.devtools.build.lib.exec.Protos.SpawnExec; import com.google.devtools.build.lib.exec.SpawnLogContext; import com.google.devtools.build.lib.remote.options.RemoteOptions; import com.google.devtools.build.lib.runtime.BlazeModule; @@ -32,58 +34,41 @@ import com.google.devtools.build.lib.server.FailureDetails.FailureDetail; import com.google.devtools.build.lib.util.AbruptExitException; import com.google.devtools.build.lib.util.DetailedExitCode; -import com.google.devtools.build.lib.util.io.AsynchronousMessageOutputStream; -import com.google.devtools.build.lib.util.io.MessageOutputStream; -import com.google.devtools.build.lib.util.io.MessageOutputStreamWrapper.BinaryOutputStreamWrapper; -import com.google.devtools.build.lib.util.io.MessageOutputStreamWrapper.JsonOutputStreamWrapper; import com.google.devtools.build.lib.vfs.Path; import java.io.IOException; -import java.io.InputStream; import javax.annotation.Nullable; /** Module providing on-demand spawn logging. */ public final class SpawnLogModule extends BlazeModule { @Nullable private SpawnLogContext spawnLogContext; - /** Output path for the raw output stream. */ - @Nullable private Path rawOutputPath; - - /** Output stream to write directly into during execution. */ - @Nullable private MessageOutputStream rawOutputStream; - - /** - * Output stream to convert the raw output into after the execution is done. - * - *

We open the stream at the beginning of the command so that any errors (e.g., unwritable - * location) are surfaced before execution begins. - */ - @Nullable private MessageOutputStream convertedOutputStream; - - private CommandEnvironment env; - private void clear() { spawnLogContext = null; - rawOutputPath = null; - rawOutputStream = null; - convertedOutputStream = null; - env = null; } private void initOutputs(CommandEnvironment env) throws IOException { clear(); ExecutionOptions executionOptions = env.getOptions().getOptions(ExecutionOptions.class); - if (executionOptions == null - || (executionOptions.executionLogBinaryFile == null - && executionOptions.executionLogJsonFile == null)) { + if (executionOptions == null) { + return; + } + + int numFormats = + Booleans.countTrue( + executionOptions.executionLogCompactFile != null, + executionOptions.executionLogBinaryFile != null, + executionOptions.executionLogJsonFile != null); + + if (numFormats == 0) { // No logging requested. return; } - if (executionOptions.executionLogBinaryFile != null - && executionOptions.executionLogJsonFile != null) { + if (numFormats > 1) { String message = - "Must specify at most one of --execution_log_json_file and --execution_log_binary_file"; + "Must specify at most one of --execution_log_binary_file, --execution_log_json_file and" + + " --experimental_execution_log_compact_file"; env.getBlazeModuleEnvironment() .exit( new AbruptExitException( @@ -99,48 +84,44 @@ private void initOutputs(CommandEnvironment env) throws IOException { return; } - this.env = env; - Path workingDirectory = env.getWorkingDirectory(); Path outputBase = env.getOutputBase(); - // Set up the raw output stream. - // This stream performs the writes in a separate thread to avoid blocking execution. - // If the unsorted binary format was requested, use the respective output path to avoid a - // pointless conversion at the end. Otherwise, use a temporary path. - if (executionOptions.executionLogBinaryFile != null && !executionOptions.executionLogSort) { - rawOutputPath = workingDirectory.getRelative(executionOptions.executionLogBinaryFile); + if (executionOptions.executionLogCompactFile != null) { + spawnLogContext = + new CompactSpawnLogContext( + workingDirectory.getRelative(executionOptions.executionLogCompactFile), + env.getExecRoot().asFragment(), + env.getOptions().getOptions(RemoteOptions.class), + env.getRuntime().getFileSystem().getDigestFunction(), + env.getXattrProvider()); } else { - rawOutputPath = outputBase.getRelative("execution.log"); - } - rawOutputStream = new AsynchronousMessageOutputStream<>(rawOutputPath); - - // Set up the binary output stream, if distinct from the raw output stream. - if (executionOptions.executionLogBinaryFile != null && executionOptions.executionLogSort) { - convertedOutputStream = - new BinaryOutputStreamWrapper<>( - workingDirectory - .getRelative(executionOptions.executionLogBinaryFile) - .getOutputStream()); - } + Path outputPath = null; + Encoding encoding = null; + + if (executionOptions.executionLogBinaryFile != null) { + encoding = Encoding.BINARY; + outputPath = workingDirectory.getRelative(executionOptions.executionLogBinaryFile); + } else if (executionOptions.executionLogJsonFile != null) { + encoding = Encoding.JSON; + outputPath = workingDirectory.getRelative(executionOptions.executionLogJsonFile); + } - // Set up the text output stream. - if (executionOptions.executionLogJsonFile != null) { - convertedOutputStream = - new JsonOutputStreamWrapper<>( - workingDirectory - .getRelative(executionOptions.executionLogJsonFile) - .getOutputStream()); + // Use a well-known temporary path to avoid accumulation of potentially large files in /tmp + // due to abnormally terminated invocations (e.g., when running out of memory). + Path tempPath = outputBase.getRelative("execution.log"); + + spawnLogContext = + new ExpandedSpawnLogContext( + checkNotNull(outputPath), + tempPath, + checkNotNull(encoding), + /* sorted= */ executionOptions.executionLogSort, + env.getExecRoot().asFragment(), + env.getOptions().getOptions(RemoteOptions.class), + env.getRuntime().getFileSystem().getDigestFunction(), + env.getXattrProvider()); } - - spawnLogContext = - new SpawnLogContext( - env.getExecRoot().asFragment(), - rawOutputStream, - env.getOptions().getOptions(ExecutionOptions.class), - env.getOptions().getOptions(RemoteOptions.class), - env.getRuntime().getFileSystem().getDigestFunction(), - env.getXattrProvider()); } @Override @@ -180,44 +161,13 @@ public void afterCommand() throws AbruptExitException { return; } - checkNotNull(rawOutputPath); - - boolean done = false; try { spawnLogContext.close(); - if (convertedOutputStream != null) { - InputStream in = rawOutputPath.getInputStream(); - if (spawnLogContext.shouldSort()) { - StableSort.stableSort(in, convertedOutputStream); - } else { - while (in.available() > 0) { - SpawnExec ex = SpawnExec.parseDelimitedFrom(in); - convertedOutputStream.write(ex); - } - } - convertedOutputStream.close(); - } - done = true; } catch (IOException e) { String message = e.getMessage() == null ? "Error writing execution log" : e.getMessage(); throw new AbruptExitException( createDetailedExitCode(message, Code.EXECUTION_LOG_WRITE_FAILURE), e); } finally { - if (convertedOutputStream != null) { - if (!done) { - env.getReporter() - .handle( - Event.warn( - "Execution log might not have been populated. Raw execution log is at " - + rawOutputPath)); - } else { - try { - rawOutputPath.delete(); - } catch (IOException e) { - // Intentionally ignored. - } - } - } clear(); } } diff --git a/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/BUILD b/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/BUILD index d97a0305b5ce2c..18ce05e87cf197 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/BUILD +++ b/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/BUILD @@ -18,6 +18,7 @@ java_library( srcs = [ "ArchiveRepoSpecBuilder.java", "AttributeValues.java", + "GitRepoSpecBuilder.java", "ModuleFile.java", "ModuleKey.java", "RepoSpec.java", @@ -220,6 +221,7 @@ java_library( "//src/main/java/com/google/devtools/build/lib/skyframe:client_environment_function", "//src/main/java/com/google/devtools/build/lib/skyframe:client_environment_value", "//src/main/java/com/google/devtools/build/lib/skyframe:precomputed_value", + "//src/main/java/com/google/devtools/build/lib/skyframe:repository_mapping_value", "//src/main/java/com/google/devtools/build/lib/skyframe:skyframe_cluster", "//src/main/java/com/google/devtools/build/lib/util", "//src/main/java/com/google/devtools/build/lib/util:os", diff --git a/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/BazelLockFileFunction.java b/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/BazelLockFileFunction.java index 763b3828492301..500a5775bd8051 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/BazelLockFileFunction.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/BazelLockFileFunction.java @@ -84,7 +84,7 @@ public SkyValue compute(SkyKey skyKey, Environment env) } try (SilentCloseable c = Profiler.instance().profile(ProfilerTask.BZLMOD, "parse lockfile")) { - return getLockfileValue(lockfilePath); + return getLockfileValue(lockfilePath, rootDirectory); } catch (IOException | JsonSyntaxException | NullPointerException e) { throw new BazelLockfileFunctionException( ExternalDepsException.withMessage( @@ -96,7 +96,8 @@ public SkyValue compute(SkyKey skyKey, Environment env) } } - public static BazelLockFileValue getLockfileValue(RootedPath lockfilePath) throws IOException { + public static BazelLockFileValue getLockfileValue(RootedPath lockfilePath, Path rootDirectory) + throws IOException { BazelLockFileValue bazelLockFileValue; try { String json = FileSystemUtils.readContent(lockfilePath.asPath(), UTF_8); @@ -108,7 +109,8 @@ public static BazelLockFileValue getLockfileValue(RootedPath lockfilePath) throw lockfilePath .asPath() .getParentDirectory() - .getRelative(LabelConstants.MODULE_DOT_BAZEL_FILE_NAME)) + .getRelative(LabelConstants.MODULE_DOT_BAZEL_FILE_NAME), + rootDirectory) .fromJson(json, BazelLockFileValue.class); } else { // This is an old version, needs to be updated diff --git a/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/BazelLockFileModule.java b/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/BazelLockFileModule.java index 96fe6ac21d5f2f..6c3a69e5e92b6b 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/BazelLockFileModule.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/BazelLockFileModule.java @@ -201,7 +201,8 @@ public static void updateLockfile(Path workspaceRoot, BazelLockFileValue updated lockfilePath .asPath() .getParentDirectory() - .getRelative(LabelConstants.MODULE_DOT_BAZEL_FILE_NAME)) + .getRelative(LabelConstants.MODULE_DOT_BAZEL_FILE_NAME), + workspaceRoot) .toJson(updatedLockfile) + "\n"); } catch (IOException e) { diff --git a/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/BazelLockFileValue.java b/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/BazelLockFileValue.java index 21b02c479b76e7..8ac7fb38e77d64 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/BazelLockFileValue.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/BazelLockFileValue.java @@ -25,7 +25,6 @@ import com.google.devtools.build.skyframe.SkyKey; import com.google.devtools.build.skyframe.SkyValue; import com.ryanharter.auto.value.gson.GenerateTypeAdapter; -import java.util.Arrays; import java.util.Map; /** @@ -118,36 +117,4 @@ public ImmutableList getModuleAndFlagsDiff( } return moduleDiff.build(); } - - /** Returns the differences between an extension and its locked data */ - public ImmutableList getModuleExtensionDiff( - ModuleExtensionId extensionId, - LockFileModuleExtension lockedExtension, - byte[] transitiveDigest, - boolean filesChanged, - ImmutableMap envVariables, - ImmutableList> extensionUsages, - ImmutableList> lockedExtensionUsages) { - - ImmutableList.Builder extDiff = new ImmutableList.Builder<>(); - if (!Arrays.equals(transitiveDigest, lockedExtension.getBzlTransitiveDigest())) { - extDiff.add( - "The implementation of the extension '" - + extensionId - + "' or one of its transitive .bzl files has changed"); - } - if (filesChanged) { - extDiff.add("One or more files the extension '" + extensionId + "' is using have changed"); - } - if (!extensionUsages.equals(lockedExtensionUsages)) { - extDiff.add("The usages of the extension '" + extensionId + "' have changed"); - } - if (!envVariables.equals(lockedExtension.getEnvVariables())) { - extDiff.add( - "The environment variables the extension '" - + extensionId - + "' depends on (or their values) have changed"); - } - return extDiff.build(); - } } diff --git a/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/GitOverride.java b/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/GitOverride.java index 260f805f2d7f1b..586fafa97b5a6b 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/GitOverride.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/GitOverride.java @@ -17,22 +17,21 @@ import com.google.auto.value.AutoValue; import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; import com.google.devtools.build.lib.bazel.bzlmod.BazelModuleInspectorValue.AugmentedModule.ResolutionReason; import com.google.devtools.build.lib.cmdline.RepositoryName; /** Specifies that a module should be retrieved from a Git repository. */ @AutoValue public abstract class GitOverride implements NonRegistryOverride { - public static final String GIT_REPOSITORY_PATH = "@bazel_tools//tools/build_defs/repo:git.bzl"; - public static GitOverride create( String remote, String commit, ImmutableList patches, ImmutableList patchCmds, - int patchStrip) { - return new AutoValue_GitOverride(remote, commit, patches, patchCmds, patchStrip); + int patchStrip, + boolean initSubmodules) { + return new AutoValue_GitOverride( + remote, commit, patches, patchCmds, patchStrip, initSubmodules); } /** The URL pointing to the git repository. */ @@ -50,22 +49,22 @@ public static GitOverride create( /** The number of path segments to strip from the paths in the supplied patches. */ public abstract int getPatchStrip(); + /** Whether submodules in the fetched repo should be recursively initialized. */ + public abstract boolean getInitSubmodules(); + /** Returns the {@link RepoSpec} that defines this repository. */ @Override public RepoSpec getRepoSpec(RepositoryName repoName) { - ImmutableMap.Builder attrBuilder = ImmutableMap.builder(); - attrBuilder - .put("name", repoName.getName()) - .put("remote", getRemote()) - .put("commit", getCommit()) - .put("patches", getPatches()) - .put("patch_cmds", getPatchCmds()) - .put("patch_args", ImmutableList.of("-p" + getPatchStrip())); - return RepoSpec.builder() - .setBzlFile(GIT_REPOSITORY_PATH) - .setRuleClassName("git_repository") - .setAttributes(AttributeValues.create(attrBuilder.buildOrThrow())) - .build(); + GitRepoSpecBuilder builder = new GitRepoSpecBuilder(); + builder + .setRepoName(repoName.getName()) + .setRemote(getRemote()) + .setCommit(getCommit()) + .setPatches(getPatches()) + .setPatchCmds(getPatchCmds()) + .setPatchArgs(ImmutableList.of("-p" + getPatchStrip())) + .setInitSubmodules(getInitSubmodules()); + return builder.build(); } @Override diff --git a/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/GitRepoSpecBuilder.java b/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/GitRepoSpecBuilder.java new file mode 100644 index 00000000000000..838ea37629b960 --- /dev/null +++ b/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/GitRepoSpecBuilder.java @@ -0,0 +1,132 @@ +// Copyright 2021 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +package com.google.devtools.build.lib.bazel.bzlmod; + +import com.google.common.collect.ImmutableMap; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import java.util.List; + +/** + * Builder for a {@link RepoSpec} object that indicates how to materialize a repo corresponding to a + * {@code git_repository} repo rule call. + */ +public class GitRepoSpecBuilder { + + public static final String GIT_REPO_PATH = "@bazel_tools//tools/build_defs/repo:git.bzl"; + + private final ImmutableMap.Builder attrBuilder; + + public GitRepoSpecBuilder() { + attrBuilder = new ImmutableMap.Builder<>(); + } + + @CanIgnoreReturnValue + public GitRepoSpecBuilder setRepoName(String repoName) { + return setAttr("name", repoName); + } + + @CanIgnoreReturnValue + public GitRepoSpecBuilder setRemote(String remoteRepoUrl) { + return setAttr("remote", remoteRepoUrl); + } + + @CanIgnoreReturnValue + public GitRepoSpecBuilder setCommit(String gitCommitHash) { + return setAttr("commit", gitCommitHash); + } + + @CanIgnoreReturnValue + public GitRepoSpecBuilder setShallowSince(String shallowSince) { + return setAttr("shallow_since", shallowSince); + } + + @CanIgnoreReturnValue + public GitRepoSpecBuilder setTag(String tag) { + return setAttr("tag", tag); + } + + @CanIgnoreReturnValue + public GitRepoSpecBuilder setInitSubmodules(boolean initSubmodules) { + setAttr("init_submodules", initSubmodules); + setAttr("recursive_init_submodules", initSubmodules); + return this; + } + + @CanIgnoreReturnValue + public GitRepoSpecBuilder setVerbose(boolean verbose) { + return setAttr("verbose", verbose); + } + + @CanIgnoreReturnValue + public GitRepoSpecBuilder setStripPrefix(String stripPrefix) { + return setAttr("strip_prefix", stripPrefix); + } + + @CanIgnoreReturnValue + public GitRepoSpecBuilder setPatches(List patches) { + return setAttr("patches", patches); + } + + @CanIgnoreReturnValue + public GitRepoSpecBuilder setPatchTool(String patchTool) { + return setAttr("patch_tool", patchTool); + } + + @CanIgnoreReturnValue + public GitRepoSpecBuilder setPatchArgs(List patchArgs) { + return setAttr("patch_args", patchArgs); + } + + @CanIgnoreReturnValue + public GitRepoSpecBuilder setPatchCmds(List patchCmds) { + return setAttr("patch_cmds", patchCmds); + } + + @CanIgnoreReturnValue + public GitRepoSpecBuilder setPatchCmdsWin(List patchCmdsWin) { + return setAttr("patch_cmds_win", patchCmdsWin); + } + + public RepoSpec build() { + return RepoSpec.builder() + .setBzlFile(GIT_REPO_PATH) + .setRuleClassName("git_repository") + .setAttributes(AttributeValues.create(attrBuilder.buildOrThrow())) + .build(); + } + + @CanIgnoreReturnValue + private GitRepoSpecBuilder setAttr(String name, String value) { + if (value != null && !value.isEmpty()) { + attrBuilder.put(name, value); + } + return this; + } + + @CanIgnoreReturnValue + private GitRepoSpecBuilder setAttr(String name, boolean value) { + attrBuilder.put(name, value); + return this; + } + + @CanIgnoreReturnValue + private GitRepoSpecBuilder setAttr(String name, List value) { + if (value != null && !value.isEmpty()) { + attrBuilder.put(name, value); + } + return this; + } +} diff --git a/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/GsonTypeAdapterUtil.java b/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/GsonTypeAdapterUtil.java index 05a54e2e053cc7..808d83821d6291 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/GsonTypeAdapterUtil.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/GsonTypeAdapterUtil.java @@ -23,9 +23,12 @@ import com.google.auto.value.AutoValue; import com.google.common.base.Preconditions; import com.google.common.base.Splitter; +import com.google.common.collect.ImmutableTable; +import com.google.common.collect.Table; import com.google.devtools.build.lib.bazel.bzlmod.Version.ParseException; import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.cmdline.LabelSyntaxException; +import com.google.devtools.build.lib.cmdline.RepositoryName; import com.google.devtools.build.lib.vfs.Path; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -92,7 +95,7 @@ public ModuleKey read(JsonReader jsonReader) throws IOException { }; public static final TypeAdapter