From 0b767ed2d7bd24f7d219c3bb2f9ac4830b59eecc Mon Sep 17 00:00:00 2001 From: Sam Gammon Date: Sat, 19 Aug 2023 04:31:51 -0700 Subject: [PATCH] fix: integration tests, toolchain cleanup --- .bazelrc | 1 - example/integration_tests/bzlmod/MODULE.bazel.lock | 4 ++-- example/integration_tests/bzlmod/sample/BUILD.bazel | 1 + example/integration_tests/workspace/sample/BUILD.bazel | 1 + graalvm/nativeimage/rules.bzl | 2 +- graalvm/toolchain/BUILD.bazel | 2 +- tools/bazel/labs.bazelrc | 1 + 7 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.bazelrc b/.bazelrc index 82112b6e..58fd7e32 100644 --- a/.bazelrc +++ b/.bazelrc @@ -22,7 +22,6 @@ import %workspace%/tools/bazel/java.bazelrc common --color=auto build --worker_sandboxing -build --spawn_strategy=worker,sandboxed,local build --verbose_failures # pick something trivial as a "noop" diff --git a/example/integration_tests/bzlmod/MODULE.bazel.lock b/example/integration_tests/bzlmod/MODULE.bazel.lock index ecbe65cc..a49fbac7 100644 --- a/example/integration_tests/bzlmod/MODULE.bazel.lock +++ b/example/integration_tests/bzlmod/MODULE.bazel.lock @@ -909,7 +909,7 @@ } }, "@rules_graalvm~override//:extensions.bzl%graalvm": { - "bzlTransitiveDigest": "9cLi3x5Vw8HacsqCGHL2kNGcDEu/m3du8hKAu5u77Wk=", + "bzlTransitiveDigest": "OgpQl/eL5Fgy9kDK3u5MWIAAl7osvXy+/vQ4FoQtxqQ=", "envVariables": {}, "generatedRepoSpecs": { "graalvm": { @@ -920,7 +920,7 @@ "graalvm_toolchain_config_repo": { "bzlFile": "@@rules_graalvm~override//internal:graalvm_bindist.bzl", "ruleClassName": "_toolchain_config", - "attributes": {"name":"--rules_graalvm~override~graalvm~graalvm_toolchain_config_repo","build_file":"--\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"graalvm_20\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"20\"},\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 = \"gvm\",\n target_compatible_with = [],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@rules_graalvm//graalvm/toolchain:graalvm\",\n toolchain = \"@graalvm//:jdk\",\n visibility = [\"//visibility:public\"],\n)\ntoolchain(\n name = \"native_image\",\n target_compatible_with = [],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@rules_graalvm//graalvm/toolchain:graalvm_native_image\",\n toolchain = \"@graalvm//:jdk\",\n visibility = [\"//visibility:public\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@graalvm//:jdk\",\n visibility = [\"//visibility:public\"],\n)\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 = [],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@graalvm//:jdk\",\n visibility = [\"//visibility:public\"],\n)\n\n"} + "attributes": {"name":"--rules_graalvm~override~graalvm~graalvm_toolchain_config_repo","build_file":"--\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"graalvm_20\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"20\"},\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 = \"gvm\",\n target_compatible_with = [],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@rules_graalvm//graalvm/toolchain:graalvm\",\n toolchain = \"@graalvm//:jdk\",\n visibility = [\"//visibility:public\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@graalvm//:jdk\",\n visibility = [\"//visibility:public\"],\n)\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 = [],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@graalvm//:jdk\",\n visibility = [\"//visibility:public\"],\n)\n\n"} } } }, diff --git a/example/integration_tests/bzlmod/sample/BUILD.bazel b/example/integration_tests/bzlmod/sample/BUILD.bazel index fde1e0bd..c944b9a1 100644 --- a/example/integration_tests/bzlmod/sample/BUILD.bazel +++ b/example/integration_tests/bzlmod/sample/BUILD.bazel @@ -20,6 +20,7 @@ native_image( name = "main-native", main_class = "Main", deps = [":java"], + native_image_tool = "@graalvm//:native-image", ) alias( diff --git a/example/integration_tests/workspace/sample/BUILD.bazel b/example/integration_tests/workspace/sample/BUILD.bazel index fde1e0bd..c944b9a1 100644 --- a/example/integration_tests/workspace/sample/BUILD.bazel +++ b/example/integration_tests/workspace/sample/BUILD.bazel @@ -20,6 +20,7 @@ native_image( name = "main-native", main_class = "Main", deps = [":java"], + native_image_tool = "@graalvm//:native-image", ) alias( diff --git a/graalvm/nativeimage/rules.bzl b/graalvm/nativeimage/rules.bzl index a8c1b62e..19bde575 100644 --- a/graalvm/nativeimage/rules.bzl +++ b/graalvm/nativeimage/rules.bzl @@ -14,7 +14,7 @@ load( _RULES_REPO = "@rules_graalvm" -_NATIVE_IMAGE_TOOLCHAIN_TYPE = "%s//graalvm/toolchain/native_image:toolchain_type" % _RULES_REPO +_NATIVE_IMAGE_TOOLCHAIN_TYPE = "%s//graalvm/toolchain" % _RULES_REPO _BAZEL_CPP_TOOLCHAIN_TYPE = "@bazel_tools//tools/cpp:toolchain_type" _BAZEL_CURRENT_CPP_TOOLCHAIN = "@bazel_tools//tools/cpp:current_cc_toolchain" diff --git a/graalvm/toolchain/BUILD.bazel b/graalvm/toolchain/BUILD.bazel index 767b6889..210f08d3 100644 --- a/graalvm/toolchain/BUILD.bazel +++ b/graalvm/toolchain/BUILD.bazel @@ -7,6 +7,6 @@ package(default_visibility = ["//visibility:public"]) # Describes a regular GraalVM toolchain; this type is satisfied by either GraalVM Community Edition # or a distribution of Oracle GraalVM. alias( - name = "graalvm", + name = "toolchain", actual = "//graalvm/toolchain/gvm:toolchain_type", ) diff --git a/tools/bazel/labs.bazelrc b/tools/bazel/labs.bazelrc index ba05b1da..35486839 100644 --- a/tools/bazel/labs.bazelrc +++ b/tools/bazel/labs.bazelrc @@ -8,6 +8,7 @@ build:labs --experimental_use_windows_sandbox=auto build:labs --incompatible_strict_action_env +build:labs --spawn_strategy=worker,sandboxed,local build:labs --dynamic_local_strategy=worker,sandboxed,standalone build:labs-broken --experimental_worker_strict_flagfiles