diff --git a/MODULE.bazel b/MODULE.bazel index fe9ffd18..e941c2f4 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -17,6 +17,14 @@ GRAALVM_DIST = "ce" GRAALVM_SDK_VERSION = "23.1.1" +GRAALVM_JUNIT_VERSION = "0.9.28" + +JUNIT4_VERSION = "4.12" + +JUNIT5_VERSION = "5.10.0" + +JUNIT5_PLATFORM_VERSION = "1.10.0" + ## ## Dependencies: API @@ -137,10 +145,101 @@ bazel_dep( # rules_jvm_external ################################################################################ -MAVEN_ARTIFACTS = [ - "org.graalvm.nativeimage:svm:%s" % GRAALVM_SDK_VERSION, - "org.graalvm.sdk:graal-sdk:%s" % GRAALVM_SDK_VERSION, - "org.graalvm.polyglot:polyglot:%s" % GRAALVM_SDK_VERSION, +maven = use_extension( + "@rules_jvm_external//:extensions.bzl", + "maven", + dev_dependency = True, +) + +# GraalVM. +maven.artifact( + name = "maven_gvm", + group = "org.graalvm.nativeimage", + artifact= "svm", + version = GRAALVM_SDK_VERSION, + neverlink = True, +) +maven.artifact( + name = "maven_gvm", + group = "org.graalvm.sdk", + artifact= "graal-sdk", + version = GRAALVM_SDK_VERSION, + neverlink = True, +) +maven.artifact( + name = "maven_gvm", + group = "org.graalvm.sdk", + artifact= "nativeimage", + version = GRAALVM_SDK_VERSION, + neverlink = True, +) +maven.artifact( + name = "maven_gvm", + group = "org.graalvm.polyglot", + artifact = "polyglot", + version = GRAALVM_SDK_VERSION, +) +maven.artifact( + name = "maven_gvm", + group = "org.graalvm.polyglot", + artifact = "polyglot", + version = GRAALVM_SDK_VERSION, +) +maven.artifact( + name = "maven_gvm", + group = "org.graalvm.buildtools", + artifact = "junit-platform-native", + version = GRAALVM_JUNIT_VERSION, +) + +# JUnit 4. +maven.artifact( + name = "maven_gvm", + group = "junit", + artifact = "junit", + version = JUNIT4_VERSION, +) + +# JUnit 5. +maven.artifact( + name = "maven_gvm", + group = "org.junit.jupiter", + artifact = "junit-jupiter-api", + version = JUNIT5_VERSION, +) +maven.artifact( + name = "maven_gvm", + group = "org.junit.jupiter", + artifact = "junit-jupiter-engine", + version = JUNIT5_VERSION, +) +maven.artifact( + name = "maven_gvm", + group = "org.junit.jupiter", + artifact = "junit-jupiter-params", + version = JUNIT5_VERSION, +) +maven.artifact( + name = "maven_gvm", + group = "org.junit.platform", + artifact = "junit-platform-console", + version = JUNIT5_PLATFORM_VERSION, +) +maven.artifact( + name = "maven_gvm", + group = "org.junit.platform", + artifact = "junit-platform-commons", + version = JUNIT5_PLATFORM_VERSION, +) +maven.artifact( + name = "maven_gvm", + group = "org.junit.platform", + artifact = "junit-platform-launcher", + version = JUNIT5_PLATFORM_VERSION, +) + +STD_ARTIFACTS = [ + # Nothing at this time. ] MAVEN_REPOSITORIES = [ @@ -149,16 +248,11 @@ MAVEN_REPOSITORIES = [ "https://repo1.maven.org/maven2", ] -maven = use_extension( - "@rules_jvm_external//:extensions.bzl", - "maven", - dev_dependency = True, -) maven.install( name = "maven_gvm", - artifacts = MAVEN_ARTIFACTS, - lock_file = "//:maven_install.json", repositories = MAVEN_REPOSITORIES, + lock_file = "//:maven_install.json", + artifacts = STD_ARTIFACTS, ) use_repo( maven, diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 90653967..f28f272f 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -1,6 +1,6 @@ { "lockFileVersion": 3, - "moduleFileHash": "fa50be8381e0ebb2e2dd9fbb5eeff1495406335c7141ccc5d5d24800f8374789", + "moduleFileHash": "661de9433891f4824dce2a9447e4532dd15f886e3bab30ad91a3a6ed8998bbcf", "flags": { "cmdRegistries": [ "https://bcr.bazel.build/" @@ -34,7 +34,7 @@ "usingModule": "", "location": { "file": "@@//:MODULE.bazel", - "line": 152, + "line": 148, "column": 22 }, "imports": { @@ -46,26 +46,220 @@ "unpinned_maven_gvm" ], "tags": [ + { + "tagName": "artifact", + "attributeValues": { + "name": "maven_gvm", + "group": "org.graalvm.nativeimage", + "artifact": "svm", + "version": "23.1.1", + "neverlink": true + }, + "devDependency": true, + "location": { + "file": "@@//:MODULE.bazel", + "line": 155, + "column": 15 + } + }, + { + "tagName": "artifact", + "attributeValues": { + "name": "maven_gvm", + "group": "org.graalvm.sdk", + "artifact": "graal-sdk", + "version": "23.1.1", + "neverlink": true + }, + "devDependency": true, + "location": { + "file": "@@//:MODULE.bazel", + "line": 162, + "column": 15 + } + }, + { + "tagName": "artifact", + "attributeValues": { + "name": "maven_gvm", + "group": "org.graalvm.sdk", + "artifact": "nativeimage", + "version": "23.1.1", + "neverlink": true + }, + "devDependency": true, + "location": { + "file": "@@//:MODULE.bazel", + "line": 169, + "column": 15 + } + }, + { + "tagName": "artifact", + "attributeValues": { + "name": "maven_gvm", + "group": "org.graalvm.polyglot", + "artifact": "polyglot", + "version": "23.1.1" + }, + "devDependency": true, + "location": { + "file": "@@//:MODULE.bazel", + "line": 176, + "column": 15 + } + }, + { + "tagName": "artifact", + "attributeValues": { + "name": "maven_gvm", + "group": "org.graalvm.polyglot", + "artifact": "polyglot", + "version": "23.1.1" + }, + "devDependency": true, + "location": { + "file": "@@//:MODULE.bazel", + "line": 182, + "column": 15 + } + }, + { + "tagName": "artifact", + "attributeValues": { + "name": "maven_gvm", + "group": "org.graalvm.buildtools", + "artifact": "junit-platform-native", + "version": "0.9.28" + }, + "devDependency": true, + "location": { + "file": "@@//:MODULE.bazel", + "line": 188, + "column": 15 + } + }, + { + "tagName": "artifact", + "attributeValues": { + "name": "maven_gvm", + "group": "junit", + "artifact": "junit", + "version": "4.12" + }, + "devDependency": true, + "location": { + "file": "@@//:MODULE.bazel", + "line": 196, + "column": 15 + } + }, + { + "tagName": "artifact", + "attributeValues": { + "name": "maven_gvm", + "group": "org.junit.jupiter", + "artifact": "junit-jupiter-api", + "version": "5.10.0" + }, + "devDependency": true, + "location": { + "file": "@@//:MODULE.bazel", + "line": 204, + "column": 15 + } + }, + { + "tagName": "artifact", + "attributeValues": { + "name": "maven_gvm", + "group": "org.junit.jupiter", + "artifact": "junit-jupiter-engine", + "version": "5.10.0" + }, + "devDependency": true, + "location": { + "file": "@@//:MODULE.bazel", + "line": 210, + "column": 15 + } + }, + { + "tagName": "artifact", + "attributeValues": { + "name": "maven_gvm", + "group": "org.junit.jupiter", + "artifact": "junit-jupiter-params", + "version": "5.10.0" + }, + "devDependency": true, + "location": { + "file": "@@//:MODULE.bazel", + "line": 216, + "column": 15 + } + }, + { + "tagName": "artifact", + "attributeValues": { + "name": "maven_gvm", + "group": "org.junit.platform", + "artifact": "junit-platform-console", + "version": "1.10.0" + }, + "devDependency": true, + "location": { + "file": "@@//:MODULE.bazel", + "line": 222, + "column": 15 + } + }, + { + "tagName": "artifact", + "attributeValues": { + "name": "maven_gvm", + "group": "org.junit.platform", + "artifact": "junit-platform-commons", + "version": "1.10.0" + }, + "devDependency": true, + "location": { + "file": "@@//:MODULE.bazel", + "line": 228, + "column": 15 + } + }, + { + "tagName": "artifact", + "attributeValues": { + "name": "maven_gvm", + "group": "org.junit.platform", + "artifact": "junit-platform-launcher", + "version": "1.10.0" + }, + "devDependency": true, + "location": { + "file": "@@//:MODULE.bazel", + "line": 234, + "column": 15 + } + }, { "tagName": "install", "attributeValues": { "name": "maven_gvm", - "artifacts": [ - "org.graalvm.nativeimage:svm:23.1.1", - "org.graalvm.sdk:graal-sdk:23.1.1", - "org.graalvm.polyglot:polyglot:23.1.1" - ], - "lock_file": "//:maven_install.json", "repositories": [ "https://maven.pkg.st", "https://maven.google.com", "https://repo1.maven.org/maven2" - ] + ], + "lock_file": "//:maven_install.json", + "artifacts": [] }, "devDependency": true, "location": { "file": "@@//:MODULE.bazel", - "line": 157, + "line": 251, "column": 14 } } @@ -79,7 +273,7 @@ "usingModule": "", "location": { "file": "@@//:MODULE.bazel", - "line": 173, + "line": 267, "column": 20 }, "imports": { @@ -102,7 +296,7 @@ "devDependency": true, "location": { "file": "@@//:MODULE.bazel", - "line": 178, + "line": 272, "column": 12 } } @@ -116,7 +310,7 @@ "usingModule": "", "location": { "file": "@@//:MODULE.bazel", - "line": 212, + "line": 306, "column": 21 }, "imports": {}, @@ -130,7 +324,7 @@ "devDependency": true, "location": { "file": "@@//:MODULE.bazel", - "line": 217, + "line": 311, "column": 15 } } @@ -144,7 +338,7 @@ "usingModule": "", "location": { "file": "@@//:MODULE.bazel", - "line": 219, + "line": 313, "column": 20 }, "imports": { @@ -164,7 +358,7 @@ "devDependency": true, "location": { "file": "@@//:MODULE.bazel", - "line": 224, + "line": 318, "column": 23 } } @@ -2212,7 +2406,7 @@ "moduleExtensions": { "//:extensions.bzl%graalvm": { "general": { - "bzlTransitiveDigest": "PkyvavvK5e4FjXXNmFAYYcGB6FofYxEbQwP3Uuc8TR4=", + "bzlTransitiveDigest": "mRzSuTlbQlQ0snbnMM3X7itZ8Eh1p7TKee6l6JsBWUc=", "accumulatedFileDigests": {}, "envVariables": {}, "generatedRepoSpecs": { @@ -4178,7 +4372,7 @@ "general": { "bzlTransitiveDigest": "9VQBVBpk1BYX8MlZX/v6yoWpeoWbbeIDc8bZ2kiueLI=", "accumulatedFileDigests": { - "@@//:maven_install.json": "2c7a0a5389ba129060f790938b9522f9621b0b47efc5e6ef3c5b8ffaf12597a9", + "@@//:maven_install.json": "dd42cccacae1851b362f59dddedc2cf01f2ccff73e87b708346b1a484905e5f6", "@@stardoc~0.6.2//:maven_install.json": "de0bfa778b4ed6aebb77509362dd87ab8d20fc7c7c18d2a7429cdfee03949a21", "@@rules_jvm_external~5.3//:rules_jvm_external_deps_install.json": "741ab2ef3843a43eaacb45d1448835c9deb99c95162279f513096eface8acd44" }, @@ -4220,6 +4414,20 @@ "downloaded_file_path": "org/graalvm/sdk/graal-sdk/23.1.1/graal-sdk-23.1.1.jar" } }, + "org_junit_platform_junit_platform_engine_jar_sources_1_10_0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "name": "rules_jvm_external~5.3~maven~org_junit_platform_junit_platform_engine_jar_sources_1_10_0", + "sha256": "17ac74964fcd82c57130623afe72a99105ca107fc96cb53f169b3a8c9c444c83", + "urls": [ + "https://maven.pkg.st/org/junit/platform/junit-platform-engine/1.10.0/junit-platform-engine-1.10.0-sources.jar", + "https://maven.google.com/org/junit/platform/junit-platform-engine/1.10.0/junit-platform-engine-1.10.0-sources.jar", + "https://repo1.maven.org/maven2/org/junit/platform/junit-platform-engine/1.10.0/junit-platform-engine-1.10.0-sources.jar" + ], + "downloaded_file_path": "org/junit/platform/junit-platform-engine/1.10.0/junit-platform-engine-1.10.0-sources.jar" + } + }, "org_junit_jupiter_junit_jupiter_engine": { "bzlFile": "@@rules_jvm_external~5.3//private:compat_repository.bzl", "ruleClassName": "compat_repository", @@ -4466,6 +4674,20 @@ "target_name": "com_google_protobuf_protobuf_java" } }, + "org_junit_jupiter_junit_jupiter_api_5_10_0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "name": "rules_jvm_external~5.3~maven~org_junit_jupiter_junit_jupiter_api_5_10_0", + "sha256": "108088fd7ea46a8e65a0ce7f5d75ae3ff7865606770a078715f5a6e5709e17d8", + "urls": [ + "https://maven.pkg.st/org/junit/jupiter/junit-jupiter-api/5.10.0/junit-jupiter-api-5.10.0.jar", + "https://maven.google.com/org/junit/jupiter/junit-jupiter-api/5.10.0/junit-jupiter-api-5.10.0.jar", + "https://repo1.maven.org/maven2/org/junit/jupiter/junit-jupiter-api/5.10.0/junit-jupiter-api-5.10.0.jar" + ], + "downloaded_file_path": "org/junit/jupiter/junit-jupiter-api/5.10.0/junit-jupiter-api-5.10.0.jar" + } + }, "io_netty_netty_transport_native_unix_common_4_1_86_Final": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_file", @@ -4479,6 +4701,20 @@ "downloaded_file_path": "io/netty/netty-transport-native-unix-common/4.1.86.Final/netty-transport-native-unix-common-4.1.86.Final.jar" } }, + "org_opentest4j_opentest4j_jar_sources_1_3_0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "name": "rules_jvm_external~5.3~maven~org_opentest4j_opentest4j_jar_sources_1_3_0", + "sha256": "724a24e3a68267d5ebac9411389a15638a71e50c62448ffa58f59c34d5c1ebb2", + "urls": [ + "https://maven.pkg.st/org/opentest4j/opentest4j/1.3.0/opentest4j-1.3.0-sources.jar", + "https://maven.google.com/org/opentest4j/opentest4j/1.3.0/opentest4j-1.3.0-sources.jar", + "https://repo1.maven.org/maven2/org/opentest4j/opentest4j/1.3.0/opentest4j-1.3.0-sources.jar" + ], + "downloaded_file_path": "org/opentest4j/opentest4j/1.3.0/opentest4j-1.3.0-sources.jar" + } + }, "io_netty_netty_codec": { "bzlFile": "@@rules_jvm_external~5.3//private:compat_repository.bzl", "ruleClassName": "compat_repository", @@ -4488,6 +4724,34 @@ "target_name": "io_netty_netty_codec" } }, + "org_junit_platform_junit_platform_commons_jar_sources_1_10_0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "name": "rules_jvm_external~5.3~maven~org_junit_platform_junit_platform_commons_jar_sources_1_10_0", + "sha256": "ebeb653947017ad2eadc5e9f38eab56400003886d9edf6f336890906e8c905b3", + "urls": [ + "https://maven.pkg.st/org/junit/platform/junit-platform-commons/1.10.0/junit-platform-commons-1.10.0-sources.jar", + "https://maven.google.com/org/junit/platform/junit-platform-commons/1.10.0/junit-platform-commons-1.10.0-sources.jar", + "https://repo1.maven.org/maven2/org/junit/platform/junit-platform-commons/1.10.0/junit-platform-commons-1.10.0-sources.jar" + ], + "downloaded_file_path": "org/junit/platform/junit-platform-commons/1.10.0/junit-platform-commons-1.10.0-sources.jar" + } + }, + "org_apiguardian_apiguardian_api_jar_sources_1_1_2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "name": "rules_jvm_external~5.3~maven~org_apiguardian_apiguardian_api_jar_sources_1_1_2", + "sha256": "277a7a4315412817beb6655b324dc7276621e95ebff00b8bf65e17a27b685e2d", + "urls": [ + "https://maven.pkg.st/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2-sources.jar", + "https://maven.google.com/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2-sources.jar", + "https://repo1.maven.org/maven2/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2-sources.jar" + ], + "downloaded_file_path": "org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2-sources.jar" + } + }, "io_grpc_grpc_api_1_55_1": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_file", @@ -4539,6 +4803,20 @@ "downloaded_file_path": "org/ow2/asm/asm/9.1/asm-9.1.jar" } }, + "org_junit_platform_junit_platform_console_1_10_0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "name": "rules_jvm_external~5.3~maven~org_junit_platform_junit_platform_console_1_10_0", + "sha256": "5c43a8dccbb24781a1880ce0287e81290eb8fd23fa6800a346cec219a46b21a8", + "urls": [ + "https://maven.pkg.st/org/junit/platform/junit-platform-console/1.10.0/junit-platform-console-1.10.0.jar", + "https://maven.google.com/org/junit/platform/junit-platform-console/1.10.0/junit-platform-console-1.10.0.jar", + "https://repo1.maven.org/maven2/org/junit/platform/junit-platform-console/1.10.0/junit-platform-console-1.10.0.jar" + ], + "downloaded_file_path": "org/junit/platform/junit-platform-console/1.10.0/junit-platform-console-1.10.0.jar" + } + }, "org_codehaus_mojo_animal_sniffer_annotations": { "bzlFile": "@@rules_jvm_external~5.3//private:compat_repository.bzl", "ruleClassName": "compat_repository", @@ -4557,6 +4835,20 @@ "target_name": "org_slf4j_slf4j_api" } }, + "org_junit_jupiter_junit_jupiter_5_10_0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "name": "rules_jvm_external~5.3~maven~org_junit_jupiter_junit_jupiter_5_10_0", + "sha256": "8e4bde23ee28fc443975654a7b28c410a3b78d6be96b78c99ab73695ec344f7c", + "urls": [ + "https://maven.pkg.st/org/junit/jupiter/junit-jupiter/5.10.0/junit-jupiter-5.10.0.jar", + "https://maven.google.com/org/junit/jupiter/junit-jupiter/5.10.0/junit-jupiter-5.10.0.jar", + "https://repo1.maven.org/maven2/org/junit/jupiter/junit-jupiter/5.10.0/junit-jupiter-5.10.0.jar" + ], + "downloaded_file_path": "org/junit/jupiter/junit-jupiter/5.10.0/junit-jupiter-5.10.0.jar" + } + }, "com_google_api_api_common_2_11_1": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_file", @@ -4644,9 +4936,19 @@ "{ \"repo_url\": \"https://repo1.maven.org/maven2\" }" ], "artifacts": [ - "{ \"group\": \"org.graalvm.nativeimage\", \"artifact\": \"svm\", \"version\": \"23.1.1\" }", - "{ \"group\": \"org.graalvm.sdk\", \"artifact\": \"graal-sdk\", \"version\": \"23.1.1\" }", - "{ \"group\": \"org.graalvm.polyglot\", \"artifact\": \"polyglot\", \"version\": \"23.1.1\" }" + "{ \"group\": \"org.graalvm.nativeimage\", \"artifact\": \"svm\", \"version\": \"23.1.1\", \"neverlink\": true }", + "{ \"group\": \"org.graalvm.sdk\", \"artifact\": \"graal-sdk\", \"version\": \"23.1.1\", \"neverlink\": true }", + "{ \"group\": \"org.graalvm.sdk\", \"artifact\": \"nativeimage\", \"version\": \"23.1.1\", \"neverlink\": true }", + "{ \"group\": \"org.graalvm.polyglot\", \"artifact\": \"polyglot\", \"version\": \"23.1.1\" }", + "{ \"group\": \"org.graalvm.polyglot\", \"artifact\": \"polyglot\", \"version\": \"23.1.1\" }", + "{ \"group\": \"org.graalvm.buildtools\", \"artifact\": \"junit-platform-native\", \"version\": \"0.9.28\" }", + "{ \"group\": \"junit\", \"artifact\": \"junit\", \"version\": \"4.12\" }", + "{ \"group\": \"org.junit.jupiter\", \"artifact\": \"junit-jupiter-api\", \"version\": \"5.10.0\" }", + "{ \"group\": \"org.junit.jupiter\", \"artifact\": \"junit-jupiter-engine\", \"version\": \"5.10.0\" }", + "{ \"group\": \"org.junit.jupiter\", \"artifact\": \"junit-jupiter-params\", \"version\": \"5.10.0\" }", + "{ \"group\": \"org.junit.platform\", \"artifact\": \"junit-platform-console\", \"version\": \"1.10.0\" }", + "{ \"group\": \"org.junit.platform\", \"artifact\": \"junit-platform-commons\", \"version\": \"1.10.0\" }", + "{ \"group\": \"org.junit.platform\", \"artifact\": \"junit-platform-launcher\", \"version\": \"1.10.0\" }" ], "fail_on_missing_checksum": true, "fetch_sources": true, @@ -4747,9 +5049,19 @@ "{ \"repo_url\": \"https://repo1.maven.org/maven2\" }" ], "artifacts": [ - "{ \"group\": \"org.graalvm.nativeimage\", \"artifact\": \"svm\", \"version\": \"23.1.1\" }", - "{ \"group\": \"org.graalvm.sdk\", \"artifact\": \"graal-sdk\", \"version\": \"23.1.1\" }", - "{ \"group\": \"org.graalvm.polyglot\", \"artifact\": \"polyglot\", \"version\": \"23.1.1\" }" + "{ \"group\": \"org.graalvm.nativeimage\", \"artifact\": \"svm\", \"version\": \"23.1.1\", \"neverlink\": true }", + "{ \"group\": \"org.graalvm.sdk\", \"artifact\": \"graal-sdk\", \"version\": \"23.1.1\", \"neverlink\": true }", + "{ \"group\": \"org.graalvm.sdk\", \"artifact\": \"nativeimage\", \"version\": \"23.1.1\", \"neverlink\": true }", + "{ \"group\": \"org.graalvm.polyglot\", \"artifact\": \"polyglot\", \"version\": \"23.1.1\" }", + "{ \"group\": \"org.graalvm.polyglot\", \"artifact\": \"polyglot\", \"version\": \"23.1.1\" }", + "{ \"group\": \"org.graalvm.buildtools\", \"artifact\": \"junit-platform-native\", \"version\": \"0.9.28\" }", + "{ \"group\": \"junit\", \"artifact\": \"junit\", \"version\": \"4.12\" }", + "{ \"group\": \"org.junit.jupiter\", \"artifact\": \"junit-jupiter-api\", \"version\": \"5.10.0\" }", + "{ \"group\": \"org.junit.jupiter\", \"artifact\": \"junit-jupiter-engine\", \"version\": \"5.10.0\" }", + "{ \"group\": \"org.junit.jupiter\", \"artifact\": \"junit-jupiter-params\", \"version\": \"5.10.0\" }", + "{ \"group\": \"org.junit.platform\", \"artifact\": \"junit-platform-console\", \"version\": \"1.10.0\" }", + "{ \"group\": \"org.junit.platform\", \"artifact\": \"junit-platform-commons\", \"version\": \"1.10.0\" }", + "{ \"group\": \"org.junit.platform\", \"artifact\": \"junit-platform-launcher\", \"version\": \"1.10.0\" }" ], "fetch_sources": true, "fetch_javadoc": false, @@ -4883,6 +5195,20 @@ "duplicate_version_warning": "warn" } }, + "org_junit_jupiter_junit_jupiter_api_jar_sources_5_10_0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "name": "rules_jvm_external~5.3~maven~org_junit_jupiter_junit_jupiter_api_jar_sources_5_10_0", + "sha256": "34fbf1f58dac2db51ab44f22f547fcee185b342d046c3ac119ec00dd2ba98e75", + "urls": [ + "https://maven.pkg.st/org/junit/jupiter/junit-jupiter-api/5.10.0/junit-jupiter-api-5.10.0-sources.jar", + "https://maven.google.com/org/junit/jupiter/junit-jupiter-api/5.10.0/junit-jupiter-api-5.10.0-sources.jar", + "https://repo1.maven.org/maven2/org/junit/jupiter/junit-jupiter-api/5.10.0/junit-jupiter-api-5.10.0-sources.jar" + ], + "downloaded_file_path": "org/junit/jupiter/junit-jupiter-api/5.10.0/junit-jupiter-api-5.10.0-sources.jar" + } + }, "org_graalvm_sdk_collections_23_1_1": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_file", @@ -4923,6 +5249,20 @@ "downloaded_file_path": "com/google/auto/value/auto-value-annotations/1.10.1/auto-value-annotations-1.10.1.jar" } }, + "junit_junit_4_12": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "name": "rules_jvm_external~5.3~maven~junit_junit_4_12", + "sha256": "59721f0805e223d84b90677887d9ff567dc534d7c502ca903c0c2b17f05c116a", + "urls": [ + "https://maven.pkg.st/junit/junit/4.12/junit-4.12.jar", + "https://maven.google.com/junit/junit/4.12/junit-4.12.jar", + "https://repo1.maven.org/maven2/junit/junit/4.12/junit-4.12.jar" + ], + "downloaded_file_path": "junit/junit/4.12/junit-4.12.jar" + } + }, "com_google_j2objc_j2objc_annotations_1_3": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_file", @@ -5098,6 +5438,20 @@ "downloaded_file_path": "org/graalvm/truffle/truffle-compiler/23.1.1/truffle-compiler-23.1.1.jar" } }, + "org_hamcrest_hamcrest_core_jar_sources_1_3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "name": "rules_jvm_external~5.3~maven~org_hamcrest_hamcrest_core_jar_sources_1_3", + "sha256": "e223d2d8fbafd66057a8848cc94222d63c3cedd652cc48eddc0ab5c39c0f84df", + "urls": [ + "https://maven.pkg.st/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar", + "https://maven.google.com/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar", + "https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar" + ], + "downloaded_file_path": "org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar" + } + }, "junit_junit_4_13_2": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_file", @@ -5123,6 +5477,20 @@ "downloaded_file_path": "software/amazon/awssdk/aws-core/2.20.78/aws-core-2.20.78.jar" } }, + "org_junit_platform_junit_platform_commons_1_10_0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "name": "rules_jvm_external~5.3~maven~org_junit_platform_junit_platform_commons_1_10_0", + "sha256": "6083db08ca11fca1e16099d0dcfede0193d80b3762b276349d80d3da536791b2", + "urls": [ + "https://maven.pkg.st/org/junit/platform/junit-platform-commons/1.10.0/junit-platform-commons-1.10.0.jar", + "https://maven.google.com/org/junit/platform/junit-platform-commons/1.10.0/junit-platform-commons-1.10.0.jar", + "https://repo1.maven.org/maven2/org/junit/platform/junit-platform-commons/1.10.0/junit-platform-commons-1.10.0.jar" + ], + "downloaded_file_path": "org/junit/platform/junit-platform-commons/1.10.0/junit-platform-commons-1.10.0.jar" + } + }, "org_checkerframework_checker_qual_3_33_0": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_file", @@ -5143,6 +5511,8 @@ "name": "rules_jvm_external~5.3~maven~org_hamcrest_hamcrest_core_1_3", "sha256": "66fdef91e9739348df7a096aa384a5685f4e875584cce89386a7a47251c4d8e9", "urls": [ + "https://maven.pkg.st/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar", + "https://maven.google.com/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar", "https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar" ], "downloaded_file_path": "org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar" @@ -5259,6 +5629,20 @@ "downloaded_file_path": "software/amazon/awssdk/json-utils/2.20.78/json-utils-2.20.78.jar" } }, + "org_junit_jupiter_junit_jupiter_params_5_10_0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "name": "rules_jvm_external~5.3~maven~org_junit_jupiter_junit_jupiter_params_5_10_0", + "sha256": "f259a7322cce375430c2236a2dcb24d4a49d22045b723ad85af88e11704391c2", + "urls": [ + "https://maven.pkg.st/org/junit/jupiter/junit-jupiter-params/5.10.0/junit-jupiter-params-5.10.0.jar", + "https://maven.google.com/org/junit/jupiter/junit-jupiter-params/5.10.0/junit-jupiter-params-5.10.0.jar", + "https://repo1.maven.org/maven2/org/junit/jupiter/junit-jupiter-params/5.10.0/junit-jupiter-params-5.10.0.jar" + ], + "downloaded_file_path": "org/junit/jupiter/junit-jupiter-params/5.10.0/junit-jupiter-params-5.10.0.jar" + } + }, "commons_cli_commons_cli": { "bzlFile": "@@rules_jvm_external~5.3//private:compat_repository.bzl", "ruleClassName": "compat_repository", @@ -5268,6 +5652,20 @@ "target_name": "commons_cli_commons_cli" } }, + "org_junit_platform_junit_platform_reporting_jar_sources_1_10_0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "name": "rules_jvm_external~5.3~maven~org_junit_platform_junit_platform_reporting_jar_sources_1_10_0", + "sha256": "3da58799df48f4a280f4e4ea7a92d5e97d2e357ac1b98885afc04a4445457713", + "urls": [ + "https://maven.pkg.st/org/junit/platform/junit-platform-reporting/1.10.0/junit-platform-reporting-1.10.0-sources.jar", + "https://maven.google.com/org/junit/platform/junit-platform-reporting/1.10.0/junit-platform-reporting-1.10.0-sources.jar", + "https://repo1.maven.org/maven2/org/junit/platform/junit-platform-reporting/1.10.0/junit-platform-reporting-1.10.0-sources.jar" + ], + "downloaded_file_path": "org/junit/platform/junit-platform-reporting/1.10.0/junit-platform-reporting-1.10.0-sources.jar" + } + }, "io_opencensus_opencensus_contrib_http_util_0_31_1": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_file", @@ -5367,6 +5765,20 @@ "downloaded_file_path": "io/netty/netty-resolver/4.1.86.Final/netty-resolver-4.1.86.Final.jar" } }, + "org_junit_platform_junit_platform_console_jar_sources_1_10_0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "name": "rules_jvm_external~5.3~maven~org_junit_platform_junit_platform_console_jar_sources_1_10_0", + "sha256": "31abe626be8e567e99366667a1242e2d469e3e828d40efca65017662df4f61c6", + "urls": [ + "https://maven.pkg.st/org/junit/platform/junit-platform-console/1.10.0/junit-platform-console-1.10.0-sources.jar", + "https://maven.google.com/org/junit/platform/junit-platform-console/1.10.0/junit-platform-console-1.10.0-sources.jar", + "https://repo1.maven.org/maven2/org/junit/platform/junit-platform-console/1.10.0/junit-platform-console-1.10.0-sources.jar" + ], + "downloaded_file_path": "org/junit/platform/junit-platform-console/1.10.0/junit-platform-console-1.10.0-sources.jar" + } + }, "software_amazon_awssdk_utils_2_20_78": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_file", @@ -5603,6 +6015,20 @@ "target_name": "io_netty_netty_transport_native_unix_common" } }, + "org_junit_platform_junit_platform_reporting_1_10_0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "name": "rules_jvm_external~5.3~maven~org_junit_platform_junit_platform_reporting_1_10_0", + "sha256": "a0cdce1cc588fb902bdd08c7f24624ef72b131873eea09f063e6ee6ff453f654", + "urls": [ + "https://maven.pkg.st/org/junit/platform/junit-platform-reporting/1.10.0/junit-platform-reporting-1.10.0.jar", + "https://maven.google.com/org/junit/platform/junit-platform-reporting/1.10.0/junit-platform-reporting-1.10.0.jar", + "https://repo1.maven.org/maven2/org/junit/platform/junit-platform-reporting/1.10.0/junit-platform-reporting-1.10.0.jar" + ], + "downloaded_file_path": "org/junit/platform/junit-platform-reporting/1.10.0/junit-platform-reporting-1.10.0.jar" + } + }, "com_google_api_gax_httpjson_0_113_1": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_file", @@ -5758,6 +6184,20 @@ "target_name": "com_google_auto_value_auto_value_annotations" } }, + "org_junit_jupiter_junit_jupiter_params_jar_sources_5_10_0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "name": "rules_jvm_external~5.3~maven~org_junit_jupiter_junit_jupiter_params_jar_sources_5_10_0", + "sha256": "7d20740d1dded4cb1de5805c3da3293b6a5e2991ad3b64539aa575c9638719dc", + "urls": [ + "https://maven.pkg.st/org/junit/jupiter/junit-jupiter-params/5.10.0/junit-jupiter-params-5.10.0-sources.jar", + "https://maven.google.com/org/junit/jupiter/junit-jupiter-params/5.10.0/junit-jupiter-params-5.10.0-sources.jar", + "https://repo1.maven.org/maven2/org/junit/jupiter/junit-jupiter-params/5.10.0/junit-jupiter-params-5.10.0-sources.jar" + ], + "downloaded_file_path": "org/junit/jupiter/junit-jupiter-params/5.10.0/junit-jupiter-params-5.10.0-sources.jar" + } + }, "com_google_api_grpc_grpc_google_cloud_storage_v2_2_22_3_alpha": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_file", @@ -5917,6 +6357,20 @@ "target_name": "io_grpc_grpc_netty" } }, + "org_junit_platform_junit_platform_launcher_jar_sources_1_10_0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "name": "rules_jvm_external~5.3~maven~org_junit_platform_junit_platform_launcher_jar_sources_1_10_0", + "sha256": "f98514c156fe6a257659e2c4e964193ffc1d68df1e003d0d0470b24b9055787e", + "urls": [ + "https://maven.pkg.st/org/junit/platform/junit-platform-launcher/1.10.0/junit-platform-launcher-1.10.0-sources.jar", + "https://maven.google.com/org/junit/platform/junit-platform-launcher/1.10.0/junit-platform-launcher-1.10.0-sources.jar", + "https://repo1.maven.org/maven2/org/junit/platform/junit-platform-launcher/1.10.0/junit-platform-launcher-1.10.0-sources.jar" + ], + "downloaded_file_path": "org/junit/platform/junit-platform-launcher/1.10.0/junit-platform-launcher-1.10.0-sources.jar" + } + }, "io_opencensus_opencensus_api": { "bzlFile": "@@rules_jvm_external~5.3//private:compat_repository.bzl", "ruleClassName": "compat_repository", @@ -5926,6 +6380,34 @@ "target_name": "io_opencensus_opencensus_api" } }, + "org_junit_jupiter_junit_jupiter_engine_jar_sources_5_10_0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "name": "rules_jvm_external~5.3~maven~org_junit_jupiter_junit_jupiter_engine_jar_sources_5_10_0", + "sha256": "050476b6fa4a57db3152f52403860019a5588d480d653bc7a1df5bcc84376211", + "urls": [ + "https://maven.pkg.st/org/junit/jupiter/junit-jupiter-engine/5.10.0/junit-jupiter-engine-5.10.0-sources.jar", + "https://maven.google.com/org/junit/jupiter/junit-jupiter-engine/5.10.0/junit-jupiter-engine-5.10.0-sources.jar", + "https://repo1.maven.org/maven2/org/junit/jupiter/junit-jupiter-engine/5.10.0/junit-jupiter-engine-5.10.0-sources.jar" + ], + "downloaded_file_path": "org/junit/jupiter/junit-jupiter-engine/5.10.0/junit-jupiter-engine-5.10.0-sources.jar" + } + }, + "junit_junit_jar_sources_4_12": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "name": "rules_jvm_external~5.3~maven~junit_junit_jar_sources_4_12", + "sha256": "9f43fea92033ad82bcad2ae44cec5c82abc9d6ee4b095cab921d11ead98bf2ff", + "urls": [ + "https://maven.pkg.st/junit/junit/4.12/junit-4.12-sources.jar", + "https://maven.google.com/junit/junit/4.12/junit-4.12-sources.jar", + "https://repo1.maven.org/maven2/junit/junit/4.12/junit-4.12-sources.jar" + ], + "downloaded_file_path": "junit/junit/4.12/junit-4.12-sources.jar" + } + }, "com_google_apis_google_api_services_storage_v1_rev20230301_2_0_0": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_file", @@ -5939,6 +6421,20 @@ "downloaded_file_path": "com/google/apis/google-api-services-storage/v1-rev20230301-2.0.0/google-api-services-storage-v1-rev20230301-2.0.0.jar" } }, + "org_junit_jupiter_junit_jupiter_jar_sources_5_10_0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "name": "rules_jvm_external~5.3~maven~org_junit_jupiter_junit_jupiter_jar_sources_5_10_0", + "sha256": "bd628b06b83b0d8830b53747b7f466beebca12d4808f117660ac06e47af99d1c", + "urls": [ + "https://maven.pkg.st/org/junit/jupiter/junit-jupiter/5.10.0/junit-jupiter-5.10.0-sources.jar", + "https://maven.google.com/org/junit/jupiter/junit-jupiter/5.10.0/junit-jupiter-5.10.0-sources.jar", + "https://repo1.maven.org/maven2/org/junit/jupiter/junit-jupiter/5.10.0/junit-jupiter-5.10.0-sources.jar" + ], + "downloaded_file_path": "org/junit/jupiter/junit-jupiter/5.10.0/junit-jupiter-5.10.0-sources.jar" + } + }, "org_apache_httpcomponents_httpclient_4_5_14": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_file", @@ -6036,6 +6532,20 @@ "target_name": "org_junit_vintage_junit_vintage_engine" } }, + "org_graalvm_buildtools_junit_platform_native_0_9_28": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "name": "rules_jvm_external~5.3~maven~org_graalvm_buildtools_junit_platform_native_0_9_28", + "sha256": "b3f1f35878fdf3d2040e75f0fd5a787f03bf33c567419f81f4ce935726ea38fe", + "urls": [ + "https://maven.pkg.st/org/graalvm/buildtools/junit-platform-native/0.9.28/junit-platform-native-0.9.28.jar", + "https://maven.google.com/org/graalvm/buildtools/junit-platform-native/0.9.28/junit-platform-native-0.9.28.jar", + "https://repo1.maven.org/maven2/org/graalvm/buildtools/junit-platform-native/0.9.28/junit-platform-native-0.9.28.jar" + ], + "downloaded_file_path": "org/graalvm/buildtools/junit-platform-native/0.9.28/junit-platform-native-0.9.28.jar" + } + }, "org_codehaus_plexus_plexus_utils_3_5_1": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_file", @@ -6323,6 +6833,20 @@ "downloaded_file_path": "com/google/cloud/google-cloud-core/2.18.1/google-cloud-core-2.18.1.jar" } }, + "org_graalvm_buildtools_junit_platform_native_jar_sources_0_9_28": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "name": "rules_jvm_external~5.3~maven~org_graalvm_buildtools_junit_platform_native_jar_sources_0_9_28", + "sha256": "117c6752e28c6335c506c2d5fd945d9b4f6d0aeb9a6a4c960f19e1cc61e8efad", + "urls": [ + "https://maven.pkg.st/org/graalvm/buildtools/junit-platform-native/0.9.28/junit-platform-native-0.9.28-sources.jar", + "https://maven.google.com/org/graalvm/buildtools/junit-platform-native/0.9.28/junit-platform-native-0.9.28-sources.jar", + "https://repo1.maven.org/maven2/org/graalvm/buildtools/junit-platform-native/0.9.28/junit-platform-native-0.9.28-sources.jar" + ], + "downloaded_file_path": "org/graalvm/buildtools/junit-platform-native/0.9.28/junit-platform-native-0.9.28-sources.jar" + } + }, "com_google_errorprone_error_prone_annotations": { "bzlFile": "@@rules_jvm_external~5.3//private:compat_repository.bzl", "ruleClassName": "compat_repository", @@ -6367,6 +6891,20 @@ "downloaded_file_path": "software/amazon/awssdk/aws-xml-protocol/2.20.78/aws-xml-protocol-2.20.78.jar" } }, + "org_apiguardian_apiguardian_api_1_1_2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "name": "rules_jvm_external~5.3~maven~org_apiguardian_apiguardian_api_1_1_2", + "sha256": "b509448ac506d607319f182537f0b35d71007582ec741832a1f111e5b5b70b38", + "urls": [ + "https://maven.pkg.st/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar", + "https://maven.google.com/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar", + "https://repo1.maven.org/maven2/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar" + ], + "downloaded_file_path": "org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar" + } + }, "maven": { "bzlFile": "@@rules_jvm_external~5.3//:coursier.bzl", "ruleClassName": "coursier_fetch", @@ -6407,6 +6945,20 @@ "duplicate_version_warning": "warn" } }, + "org_junit_platform_junit_platform_launcher_1_10_0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "name": "rules_jvm_external~5.3~maven~org_junit_platform_junit_platform_launcher_1_10_0", + "sha256": "8c60b661ac170701a635dfc67565efbb8c85b5c5cdd5a4a9576e3a015c7111a4", + "urls": [ + "https://maven.pkg.st/org/junit/platform/junit-platform-launcher/1.10.0/junit-platform-launcher-1.10.0.jar", + "https://maven.google.com/org/junit/platform/junit-platform-launcher/1.10.0/junit-platform-launcher-1.10.0.jar", + "https://repo1.maven.org/maven2/org/junit/platform/junit-platform-launcher/1.10.0/junit-platform-launcher-1.10.0.jar" + ], + "downloaded_file_path": "org/junit/platform/junit-platform-launcher/1.10.0/junit-platform-launcher-1.10.0.jar" + } + }, "io_netty_netty_codec_http_4_1_86_Final": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_file", @@ -6420,6 +6972,20 @@ "downloaded_file_path": "io/netty/netty-codec-http/4.1.86.Final/netty-codec-http-4.1.86.Final.jar" } }, + "org_junit_platform_junit_platform_engine_1_10_0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "name": "rules_jvm_external~5.3~maven~org_junit_platform_junit_platform_engine_1_10_0", + "sha256": "cd338efd02ee73966ea754e0c0c71e1a11f4af5db9c2003e4b6137e119155abe", + "urls": [ + "https://maven.pkg.st/org/junit/platform/junit-platform-engine/1.10.0/junit-platform-engine-1.10.0.jar", + "https://maven.google.com/org/junit/platform/junit-platform-engine/1.10.0/junit-platform-engine-1.10.0.jar", + "https://repo1.maven.org/maven2/org/junit/platform/junit-platform-engine/1.10.0/junit-platform-engine-1.10.0.jar" + ], + "downloaded_file_path": "org/junit/platform/junit-platform-engine/1.10.0/junit-platform-engine-1.10.0.jar" + } + }, "com_google_cloud_google_cloud_core_grpc_2_18_1": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_file", @@ -6468,6 +7034,20 @@ "target_name": "org_junit_platform_junit_platform_reporting" } }, + "org_junit_jupiter_junit_jupiter_engine_5_10_0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "name": "rules_jvm_external~5.3~maven~org_junit_jupiter_junit_jupiter_engine_5_10_0", + "sha256": "57ea48e6f795200791065bbc86b70b84cd05367c5c9f2ac8f9268e27154c88a8", + "urls": [ + "https://maven.pkg.st/org/junit/jupiter/junit-jupiter-engine/5.10.0/junit-jupiter-engine-5.10.0.jar", + "https://maven.google.com/org/junit/jupiter/junit-jupiter-engine/5.10.0/junit-jupiter-engine-5.10.0.jar", + "https://repo1.maven.org/maven2/org/junit/jupiter/junit-jupiter-engine/5.10.0/junit-jupiter-engine-5.10.0.jar" + ], + "downloaded_file_path": "org/junit/jupiter/junit-jupiter-engine/5.10.0/junit-jupiter-engine-5.10.0.jar" + } + }, "com_google_errorprone_error_prone_annotations_2_11_0": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_file", @@ -6744,6 +7324,20 @@ "target_name": "com_google_guava_guava" } }, + "org_opentest4j_opentest4j_1_3_0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "name": "rules_jvm_external~5.3~maven~org_opentest4j_opentest4j_1_3_0", + "sha256": "48e2df636cab6563ced64dcdff8abb2355627cb236ef0bf37598682ddf742f1b", + "urls": [ + "https://maven.pkg.st/org/opentest4j/opentest4j/1.3.0/opentest4j-1.3.0.jar", + "https://maven.google.com/org/opentest4j/opentest4j/1.3.0/opentest4j-1.3.0.jar", + "https://repo1.maven.org/maven2/org/opentest4j/opentest4j/1.3.0/opentest4j-1.3.0.jar" + ], + "downloaded_file_path": "org/opentest4j/opentest4j/1.3.0/opentest4j-1.3.0.jar" + } + }, "org_checkerframework_checker_qual_3_13_0": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_file", diff --git a/docs/api/defs.md b/docs/api/defs.md index 01490fec..19176249 100755 --- a/docs/api/defs.md +++ b/docs/api/defs.md @@ -11,7 +11,7 @@ native_image(name, jni_configuration, initialize_at_build_time, initialize_at_run_time, native_features, debug, optimization_mode, shared_library, static_zlib, c_compiler_option, data, extra_args, allow_fallback, check_toolchains, native_image_tool, native_image_settings, - profiles, kwargs) + profiles, out_headers, additional_outputs, default_outputs, kwargs) Generates and compiles a GraalVM native image from a Java library target. @@ -43,6 +43,9 @@ Generates and compiles a GraalVM native image from a Java library target. | native_image_tool | Specific `native-image` executable target to use. | `None` | | native_image_settings | Suite(s) of Native Image build settings to use. | `[Label("@rules_graalvm//internal/native_image:defaults")]` | | profiles | Profiles to use for profile-guided optimization (PGO) and obtained from a native image compiled with `--pgo-instrument`. | `[]` | +| out_headers | Shared library headers expected to be emitted by the rule (in addition to defaults). | `[]` | +| additional_outputs | Additional outputs to expect from the rule (for example, polyglot language resources). | `[]` | +| default_outputs | Whether to consider default output files; when `False`, the developer specifies all outputs on top of the binary itself. | `True` | | kwargs | Extra keyword arguments are passed to the underlying `native_image` rule. | none | diff --git a/example/disabled_tests/bazel1/.bazelrc b/example/disabled_tests/bazel1/.bazelrc deleted file mode 100644 index 9e69f75e..00000000 --- a/example/disabled_tests/bazel1/.bazelrc +++ /dev/null @@ -1 +0,0 @@ -# Nothing at this time. \ No newline at end of file diff --git a/example/disabled_tests/bazel1/.bazelversion b/example/disabled_tests/bazel1/.bazelversion deleted file mode 100644 index 6085e946..00000000 --- a/example/disabled_tests/bazel1/.bazelversion +++ /dev/null @@ -1 +0,0 @@ -1.2.1 diff --git a/example/disabled_tests/bazel1/.gitignore b/example/disabled_tests/bazel1/.gitignore deleted file mode 100644 index ac51a054..00000000 --- a/example/disabled_tests/bazel1/.gitignore +++ /dev/null @@ -1 +0,0 @@ -bazel-* diff --git a/example/disabled_tests/bazel1/WORKSPACE.bazel b/example/disabled_tests/bazel1/WORKSPACE.bazel deleted file mode 100644 index 48695d76..00000000 --- a/example/disabled_tests/bazel1/WORKSPACE.bazel +++ /dev/null @@ -1,29 +0,0 @@ -workspace(name = "rules_graalvm_sample") - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -local_repository( - name = "rules_graalvm", - path = "../../..", -) - -http_archive( - name = "rules_java", - sha256 = "34b41ec683e67253043ab1a3d1e8b7c61e4e8edefbcad485381328c934d072fe", - url = "https://github.com/bazelbuild/rules_java/releases/download/4.0.0/rules_java-4.0.0.tar.gz", -) - -load("@rules_graalvm//graalvm:workspace.bzl", "register_graalvm_toolchains", "rules_graalvm_repositories") - -rules_graalvm_repositories(omit_rules_java = True) - -register_graalvm_toolchains() - -load("@rules_graalvm//graalvm:repositories.bzl", "graalvm_repository") - -graalvm_repository( - name = "graalvm", - distribution = "ce", - java_version = "20", - version = "20.0.2", -) diff --git a/example/disabled_tests/bazel1/sample/BUILD.bazel b/example/disabled_tests/bazel1/sample/BUILD.bazel deleted file mode 100644 index fbb24b47..00000000 --- a/example/disabled_tests/bazel1/sample/BUILD.bazel +++ /dev/null @@ -1,28 +0,0 @@ -load( - "@rules_graalvm//graal:graal.bzl", - "native_image", -) - -java_library( - name = "java", - srcs = ["Main.java"], -) - -java_binary( - name = "main", - main_class = "Main", - runtime_deps = [ - ":java", - ], -) - -native_image( - name = "main-native", - main_class = "Main", - deps = [":java"], -) - -alias( - name = "sample", - actual = "main-native", -) diff --git a/example/disabled_tests/bazel2/.bazelrc b/example/disabled_tests/bazel2/.bazelrc deleted file mode 100644 index 9e69f75e..00000000 --- a/example/disabled_tests/bazel2/.bazelrc +++ /dev/null @@ -1 +0,0 @@ -# Nothing at this time. \ No newline at end of file diff --git a/example/disabled_tests/bazel2/.bazelversion b/example/disabled_tests/bazel2/.bazelversion deleted file mode 100644 index ccbccc3d..00000000 --- a/example/disabled_tests/bazel2/.bazelversion +++ /dev/null @@ -1 +0,0 @@ -2.2.0 diff --git a/example/disabled_tests/bazel2/.gitignore b/example/disabled_tests/bazel2/.gitignore deleted file mode 100644 index ac51a054..00000000 --- a/example/disabled_tests/bazel2/.gitignore +++ /dev/null @@ -1 +0,0 @@ -bazel-* diff --git a/example/disabled_tests/bazel2/WORKSPACE.bazel b/example/disabled_tests/bazel2/WORKSPACE.bazel deleted file mode 100644 index 48695d76..00000000 --- a/example/disabled_tests/bazel2/WORKSPACE.bazel +++ /dev/null @@ -1,29 +0,0 @@ -workspace(name = "rules_graalvm_sample") - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -local_repository( - name = "rules_graalvm", - path = "../../..", -) - -http_archive( - name = "rules_java", - sha256 = "34b41ec683e67253043ab1a3d1e8b7c61e4e8edefbcad485381328c934d072fe", - url = "https://github.com/bazelbuild/rules_java/releases/download/4.0.0/rules_java-4.0.0.tar.gz", -) - -load("@rules_graalvm//graalvm:workspace.bzl", "register_graalvm_toolchains", "rules_graalvm_repositories") - -rules_graalvm_repositories(omit_rules_java = True) - -register_graalvm_toolchains() - -load("@rules_graalvm//graalvm:repositories.bzl", "graalvm_repository") - -graalvm_repository( - name = "graalvm", - distribution = "ce", - java_version = "20", - version = "20.0.2", -) diff --git a/example/disabled_tests/bazel2/sample/BUILD.bazel b/example/disabled_tests/bazel2/sample/BUILD.bazel deleted file mode 100644 index fbb24b47..00000000 --- a/example/disabled_tests/bazel2/sample/BUILD.bazel +++ /dev/null @@ -1,28 +0,0 @@ -load( - "@rules_graalvm//graal:graal.bzl", - "native_image", -) - -java_library( - name = "java", - srcs = ["Main.java"], -) - -java_binary( - name = "main", - main_class = "Main", - runtime_deps = [ - ":java", - ], -) - -native_image( - name = "main-native", - main_class = "Main", - deps = [":java"], -) - -alias( - name = "sample", - actual = "main-native", -) diff --git a/example/disabled_tests/bazel3/.bazelrc b/example/disabled_tests/bazel3/.bazelrc deleted file mode 100644 index 9e69f75e..00000000 --- a/example/disabled_tests/bazel3/.bazelrc +++ /dev/null @@ -1 +0,0 @@ -# Nothing at this time. \ No newline at end of file diff --git a/example/disabled_tests/bazel3/.bazelversion b/example/disabled_tests/bazel3/.bazelversion deleted file mode 100644 index 47b6be3f..00000000 --- a/example/disabled_tests/bazel3/.bazelversion +++ /dev/null @@ -1 +0,0 @@ -3.7.2 \ No newline at end of file diff --git a/example/disabled_tests/bazel3/.gitignore b/example/disabled_tests/bazel3/.gitignore deleted file mode 100644 index ac51a054..00000000 --- a/example/disabled_tests/bazel3/.gitignore +++ /dev/null @@ -1 +0,0 @@ -bazel-* diff --git a/example/disabled_tests/bazel3/WORKSPACE.bazel b/example/disabled_tests/bazel3/WORKSPACE.bazel deleted file mode 100644 index 48695d76..00000000 --- a/example/disabled_tests/bazel3/WORKSPACE.bazel +++ /dev/null @@ -1,29 +0,0 @@ -workspace(name = "rules_graalvm_sample") - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -local_repository( - name = "rules_graalvm", - path = "../../..", -) - -http_archive( - name = "rules_java", - sha256 = "34b41ec683e67253043ab1a3d1e8b7c61e4e8edefbcad485381328c934d072fe", - url = "https://github.com/bazelbuild/rules_java/releases/download/4.0.0/rules_java-4.0.0.tar.gz", -) - -load("@rules_graalvm//graalvm:workspace.bzl", "register_graalvm_toolchains", "rules_graalvm_repositories") - -rules_graalvm_repositories(omit_rules_java = True) - -register_graalvm_toolchains() - -load("@rules_graalvm//graalvm:repositories.bzl", "graalvm_repository") - -graalvm_repository( - name = "graalvm", - distribution = "ce", - java_version = "20", - version = "20.0.2", -) diff --git a/example/disabled_tests/bazel3/sample/BUILD.bazel b/example/disabled_tests/bazel3/sample/BUILD.bazel deleted file mode 100644 index fbb24b47..00000000 --- a/example/disabled_tests/bazel3/sample/BUILD.bazel +++ /dev/null @@ -1,28 +0,0 @@ -load( - "@rules_graalvm//graal:graal.bzl", - "native_image", -) - -java_library( - name = "java", - srcs = ["Main.java"], -) - -java_binary( - name = "main", - main_class = "Main", - runtime_deps = [ - ":java", - ], -) - -native_image( - name = "main-native", - main_class = "Main", - deps = [":java"], -) - -alias( - name = "sample", - actual = "main-native", -) diff --git a/example/disabled_tests/bazel3/sample/Main.java b/example/disabled_tests/bazel3/sample/Main.java deleted file mode 100644 index c9824efb..00000000 --- a/example/disabled_tests/bazel3/sample/Main.java +++ /dev/null @@ -1,5 +0,0 @@ -public class Main { - public static void main(String args[]) { - System.out.println("Hello, GraalVM!"); - } -} \ No newline at end of file diff --git a/example/integration_tests/bzlmod/MODULE.bazel.lock b/example/integration_tests/bzlmod/MODULE.bazel.lock index f8c1a7cd..fcac14b4 100644 --- a/example/integration_tests/bzlmod/MODULE.bazel.lock +++ b/example/integration_tests/bzlmod/MODULE.bazel.lock @@ -14,7 +14,7 @@ }, "localOverrideHashes": { "bazel_tools": "922ea6752dc9105de5af957f7a99a6933c0a6a712d23df6aad16a9c399f7e787", - "rules_graalvm": "fa50be8381e0ebb2e2dd9fbb5eeff1495406335c7141ccc5d5d24800f8374789" + "rules_graalvm": "661de9433891f4824dce2a9447e4532dd15f886e3bab30ad91a3a6ed8998bbcf" }, "moduleDepGraph": { "": { @@ -811,7 +811,7 @@ }, "@@rules_graalvm~override//:extensions.bzl%graalvm": { "general": { - "bzlTransitiveDigest": "PkyvavvK5e4FjXXNmFAYYcGB6FofYxEbQwP3Uuc8TR4=", + "bzlTransitiveDigest": "mRzSuTlbQlQ0snbnMM3X7itZ8Eh1p7TKee6l6JsBWUc=", "accumulatedFileDigests": {}, "envVariables": {}, "generatedRepoSpecs": { diff --git a/example/integration_tests/components-ce/MODULE.bazel.lock b/example/integration_tests/components-ce/MODULE.bazel.lock index bff4727d..ea2bb7a7 100644 --- a/example/integration_tests/components-ce/MODULE.bazel.lock +++ b/example/integration_tests/components-ce/MODULE.bazel.lock @@ -14,7 +14,7 @@ }, "localOverrideHashes": { "bazel_tools": "922ea6752dc9105de5af957f7a99a6933c0a6a712d23df6aad16a9c399f7e787", - "rules_graalvm": "fa50be8381e0ebb2e2dd9fbb5eeff1495406335c7141ccc5d5d24800f8374789" + "rules_graalvm": "661de9433891f4824dce2a9447e4532dd15f886e3bab30ad91a3a6ed8998bbcf" }, "moduleDepGraph": { "": { @@ -814,7 +814,7 @@ }, "@@rules_graalvm~override//:extensions.bzl%graalvm": { "general": { - "bzlTransitiveDigest": "PkyvavvK5e4FjXXNmFAYYcGB6FofYxEbQwP3Uuc8TR4=", + "bzlTransitiveDigest": "mRzSuTlbQlQ0snbnMM3X7itZ8Eh1p7TKee6l6JsBWUc=", "accumulatedFileDigests": {}, "envVariables": {}, "generatedRepoSpecs": { diff --git a/example/integration_tests/components-oracle/MODULE.bazel.lock b/example/integration_tests/components-oracle/MODULE.bazel.lock index afbfee18..d3cdc10c 100644 --- a/example/integration_tests/components-oracle/MODULE.bazel.lock +++ b/example/integration_tests/components-oracle/MODULE.bazel.lock @@ -14,7 +14,7 @@ }, "localOverrideHashes": { "bazel_tools": "922ea6752dc9105de5af957f7a99a6933c0a6a712d23df6aad16a9c399f7e787", - "rules_graalvm": "fa50be8381e0ebb2e2dd9fbb5eeff1495406335c7141ccc5d5d24800f8374789" + "rules_graalvm": "661de9433891f4824dce2a9447e4532dd15f886e3bab30ad91a3a6ed8998bbcf" }, "moduleDepGraph": { "": { @@ -815,7 +815,7 @@ }, "@@rules_graalvm~override//:extensions.bzl%graalvm": { "general": { - "bzlTransitiveDigest": "PkyvavvK5e4FjXXNmFAYYcGB6FofYxEbQwP3Uuc8TR4=", + "bzlTransitiveDigest": "mRzSuTlbQlQ0snbnMM3X7itZ8Eh1p7TKee6l6JsBWUc=", "accumulatedFileDigests": {}, "envVariables": {}, "generatedRepoSpecs": { diff --git a/example/integration_tests/inert/MODULE.bazel.lock b/example/integration_tests/inert/MODULE.bazel.lock index a1910c83..747e78a8 100644 --- a/example/integration_tests/inert/MODULE.bazel.lock +++ b/example/integration_tests/inert/MODULE.bazel.lock @@ -14,7 +14,7 @@ }, "localOverrideHashes": { "bazel_tools": "922ea6752dc9105de5af957f7a99a6933c0a6a712d23df6aad16a9c399f7e787", - "rules_graalvm": "fa50be8381e0ebb2e2dd9fbb5eeff1495406335c7141ccc5d5d24800f8374789" + "rules_graalvm": "661de9433891f4824dce2a9447e4532dd15f886e3bab30ad91a3a6ed8998bbcf" }, "moduleDepGraph": { "": { diff --git a/example/integration_tests/shared-lib/MODULE.bazel.lock b/example/integration_tests/shared-lib/MODULE.bazel.lock index f8c1a7cd..fcac14b4 100644 --- a/example/integration_tests/shared-lib/MODULE.bazel.lock +++ b/example/integration_tests/shared-lib/MODULE.bazel.lock @@ -14,7 +14,7 @@ }, "localOverrideHashes": { "bazel_tools": "922ea6752dc9105de5af957f7a99a6933c0a6a712d23df6aad16a9c399f7e787", - "rules_graalvm": "fa50be8381e0ebb2e2dd9fbb5eeff1495406335c7141ccc5d5d24800f8374789" + "rules_graalvm": "661de9433891f4824dce2a9447e4532dd15f886e3bab30ad91a3a6ed8998bbcf" }, "moduleDepGraph": { "": { @@ -811,7 +811,7 @@ }, "@@rules_graalvm~override//:extensions.bzl%graalvm": { "general": { - "bzlTransitiveDigest": "PkyvavvK5e4FjXXNmFAYYcGB6FofYxEbQwP3Uuc8TR4=", + "bzlTransitiveDigest": "mRzSuTlbQlQ0snbnMM3X7itZ8Eh1p7TKee6l6JsBWUc=", "accumulatedFileDigests": {}, "envVariables": {}, "generatedRepoSpecs": { diff --git a/example/integration_tests/shared-lib/sample/BUILD.bazel b/example/integration_tests/shared-lib/sample/BUILD.bazel index 38a62864..4acc1785 100644 --- a/example/integration_tests/shared-lib/sample/BUILD.bazel +++ b/example/integration_tests/shared-lib/sample/BUILD.bazel @@ -1,6 +1,6 @@ load( "@rules_graalvm//graalvm:defs.bzl", - "native_image", + "native_image_shared_library", ) java_library( @@ -8,10 +8,9 @@ java_library( srcs = ["Main.java"], ) -native_image( +native_image_shared_library( name = "lib-native", deps = [":java"], - shared_library = True, ) alias( diff --git a/example/modular/BUILD.bazel b/example/modular/BUILD.bazel new file mode 100644 index 00000000..2a674da8 --- /dev/null +++ b/example/modular/BUILD.bazel @@ -0,0 +1,58 @@ +load( + "@rules_graalvm//graalvm:defs.bzl", + "native_image", +) +load( + "@rules_graalvm//graalvm/artifacts:maven.bzl", + graalvm = "alias", +) +load( + "@rules_java//java:defs.bzl", + "java_binary", + "java_library", +) + +package(default_visibility = [ + "//tests:__subpackages__", +]) + + +filegroup( + name = "reflection-config", + srcs = ["reflection.json"], +) + +java_library( + name = "java", + srcs = [ + "Main.java", + "module-info.java", + ], + deps = [ + graalvm.artifact(graalvm.catalog.SDK, repo = "@maven_gvm"), + ], +) + +java_binary( + name = "main", + main_class = "app/Main", + runtime_deps = [ + ":java", + ], +) + +native_image( + name = "main-modular", + main_class = "Main", + deps = [":java"], + strict = True, + reflection_configuration = ":reflection-config", + module_deps = [ + graalvm.artifact(graalvm.catalog.SDK, repo = "@maven_gvm"), + ], +) + +alias( + name = "modular", + actual = "main-modular", +) diff --git a/example/disabled_tests/bazel1/sample/Main.java b/example/modular/Main.java similarity index 100% rename from example/disabled_tests/bazel1/sample/Main.java rename to example/modular/Main.java diff --git a/example/modular/module-info.java b/example/modular/module-info.java new file mode 100644 index 00000000..0c8674cd --- /dev/null +++ b/example/modular/module-info.java @@ -0,0 +1,4 @@ +module app { + requires java.base; + requires org.graalvm.sdk; +} diff --git a/example/native/reflection.cfg b/example/modular/reflection.json similarity index 100% rename from example/native/reflection.cfg rename to example/modular/reflection.json diff --git a/example/native/BUILD.bazel b/example/native/BUILD.bazel index ba44f5ec..966c46d9 100644 --- a/example/native/BUILD.bazel +++ b/example/native/BUILD.bazel @@ -12,6 +12,12 @@ package(default_visibility = [ "//tests:__subpackages__", ]) + +filegroup( + name = "reflection-config", + srcs = ["reflection.json"], +) + java_library( name = "java", srcs = ["Main.java"], @@ -29,6 +35,8 @@ native_image( name = "main-native", main_class = "Main", deps = [":java"], + strict = True, + reflection_configuration = ":reflection-config", ) alias( diff --git a/example/native/reflection.json b/example/native/reflection.json new file mode 100644 index 00000000..2ef1801f --- /dev/null +++ b/example/native/reflection.json @@ -0,0 +1,30 @@ +[ + { + "name" : "java.lang.Class", + "allDeclaredConstructors" : true, + "allPublicConstructors" : true, + "allDeclaredMethods" : true, + "allPublicMethods" : true, + "allDeclaredClasses" : true, + "allPublicClasses" : true + }, + { + "name" : "java.lang.String", + "fields" : [ + { "name" : "value", "allowWrite" : true }, + { "name" : "hash" } + ], + "methods" : [ + { "name" : "", "parameterTypes" : [] }, + { "name" : "", "parameterTypes" : ["char[]"] }, + { "name" : "charAt" }, + { "name" : "format", "parameterTypes" : ["java.lang.String", "java.lang.Object[]"] } + ] + }, + { + "name" : "java.lang.String$CaseInsensitiveComparator", + "methods" : [ + { "name" : "compare" } + ] + } +] diff --git a/example/shared/BUILD.bazel b/example/shared/BUILD.bazel new file mode 100644 index 00000000..0c2f4a82 --- /dev/null +++ b/example/shared/BUILD.bazel @@ -0,0 +1,45 @@ +load( + "@rules_graalvm//graalvm:defs.bzl", + "native_image_shared_library", +) +load( + "@rules_java//java:defs.bzl", + "java_binary", + "java_library", +) + +package(default_visibility = [ + "//tests:__subpackages__", +]) + + +filegroup( + name = "reflection-config", + srcs = ["reflection.json"], +) + +java_library( + name = "java", + srcs = ["Main.java"], +) + +java_binary( + name = "main", + main_class = "Main", + runtime_deps = [ + ":java", + ], +) + +native_image_shared_library( + name = "mylib", + deps = [":java"], + strict = True, + lib_name = "libmylib", # becomes `libmylib.so`, `libmylib.dylib`, etc. + reflection_configuration = ":reflection-config", +) + +alias( + name = "shared", + actual = "mylib", +) diff --git a/example/disabled_tests/bazel2/sample/Main.java b/example/shared/Main.java similarity index 100% rename from example/disabled_tests/bazel2/sample/Main.java rename to example/shared/Main.java diff --git a/example/shared/reflection.json b/example/shared/reflection.json new file mode 100644 index 00000000..2ef1801f --- /dev/null +++ b/example/shared/reflection.json @@ -0,0 +1,30 @@ +[ + { + "name" : "java.lang.Class", + "allDeclaredConstructors" : true, + "allPublicConstructors" : true, + "allDeclaredMethods" : true, + "allPublicMethods" : true, + "allDeclaredClasses" : true, + "allPublicClasses" : true + }, + { + "name" : "java.lang.String", + "fields" : [ + { "name" : "value", "allowWrite" : true }, + { "name" : "hash" } + ], + "methods" : [ + { "name" : "", "parameterTypes" : [] }, + { "name" : "", "parameterTypes" : ["char[]"] }, + { "name" : "charAt" }, + { "name" : "format", "parameterTypes" : ["java.lang.String", "java.lang.Object[]"] } + ] + }, + { + "name" : "java.lang.String$CaseInsensitiveComparator", + "methods" : [ + { "name" : "compare" } + ] + } +] diff --git a/example/testing/BUILD.bazel b/example/testing/BUILD.bazel new file mode 100644 index 00000000..4fbcea5e --- /dev/null +++ b/example/testing/BUILD.bazel @@ -0,0 +1,50 @@ +load( + "@rules_graalvm//graalvm:defs.bzl", + "native_image_test", +) +load( + "@rules_java//java:defs.bzl", + "java_library", +) +load( + "//tools/defs:junit5.bzl", + java_test = "java_junit5_test", +) + +package(default_visibility = [ + "//tests:__subpackages__", +]) + + +java_library( + name = "java", + srcs = ["Something.java"], +) + +java_test( + name = "java-test", + test_package = "example.testing", + srcs = ["SomethingTest.java"], + size = "small", + deps = [ + ":java", + ], +) + +native_image_test( + name = "native-test", + tests = [":java-test"], + size = "small", +) + +test_suite( + name = "tests", + tests = [ + ":native-test", + ], +) + +alias( + name = "testing", + actual = "tests", +) diff --git a/example/testing/Something.java b/example/testing/Something.java new file mode 100644 index 00000000..2e37cb9a --- /dev/null +++ b/example/testing/Something.java @@ -0,0 +1,11 @@ +package example.testing; + +public class Something { + public static void main(String args[]) { + System.out.println("Hello, GraalVM!"); + } + + public static int add(int a, int b) { + return a + b; + } +} diff --git a/example/testing/SomethingTest.java b/example/testing/SomethingTest.java new file mode 100644 index 00000000..1ab4c80c --- /dev/null +++ b/example/testing/SomethingTest.java @@ -0,0 +1,29 @@ +package example.testing; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import example.testing.Something; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Disabled; + +public class SomethingTest { + @Test + public void testMath() { + assertEquals(3, 1 + 2); + } + + @Test + @Disabled + public void testFails() { + assertEquals(4, 1 + 2); + } + + // @Test + // public void testSomething() { + // assertEquals(3, Something.add(1, 2)); + // } + + // @Test + // public void testSomethingThatFails() { + // assertEquals(9, Something.add(1, 2)); + // } +} diff --git a/graalvm/artifacts/maven.bzl b/graalvm/artifacts/maven.bzl index d66c987e..def1ae67 100644 --- a/graalvm/artifacts/maven.bzl +++ b/graalvm/artifacts/maven.bzl @@ -1,21 +1,37 @@ "Defines Maven helpers and coordinates for GraalVM artifacts." +load("@rules_jvm_external//:specs.bzl", "maven") + # buildifier: disable=name-conventions _MavenArtifacts = struct( + SVM = struct( + artifact = "svm", + group = "org.graalvm.nativeimage", + options = {"neverlink": True}, + ), SDK = struct( artifact = "graal-sdk", group = "org.graalvm.sdk", + options = {"neverlink": True}, + NATIVEIMAGE = struct( + artifact = "nativeimage", + group = "org.graalvm.sdk", + options = {"neverlink": True}, + ) ), POLYGLOT = struct( artifact = "polyglot", group = "org.graalvm.polyglot", + options = {}, ), TRUFFLE = struct( artifact = "truffle-api", group = "org.graalvm.truffle", + options = {}, NFI = struct( artifact = "truffle-nfi", group = "org.graalvm.truffle", + options = {}, ), ), ) @@ -111,6 +127,7 @@ def _graalvm_maven_artifact(maven, artifact, version): artifact = artifact.artifact, group = artifact.group, version = version, + **artifact.options, ) # buildifier: disable=name-conventions @@ -119,6 +136,9 @@ _MavenTools = struct( artifact = _graalvm_maven_artifact, ) +# buildifier: disable=name-conventions +MavenTools = _MavenTools + # Exports. # buildifier: disable=name-conventions diff --git a/graalvm/defs.bzl b/graalvm/defs.bzl index 0cb4121a..f672d855 100644 --- a/graalvm/defs.bzl +++ b/graalvm/defs.bzl @@ -3,7 +3,11 @@ load( "//graalvm/nativeimage:rules.bzl", _native_image = "native_image", + _native_image_shared_library = "native_image_shared_library", + _native_image_test = "native_image_test", ) ## Exports native_image = _native_image +native_image_shared_library = _native_image_shared_library +native_image_test = _native_image_test diff --git a/graalvm/nativeimage/rules.bzl b/graalvm/nativeimage/rules.bzl index 45ba9a7a..e4c3b05a 100644 --- a/graalvm/nativeimage/rules.bzl +++ b/graalvm/nativeimage/rules.bzl @@ -4,20 +4,30 @@ load( "@bazel_skylib//lib:dicts.bzl", "dicts", ) +load( + "@bazel_tools//tools/cpp:toolchain_utils.bzl", + "use_cpp_toolchain", +) load( "//internal/native_image:rules.bzl", - _BAZEL_CPP_TOOLCHAIN_TYPE = "BAZEL_CPP_TOOLCHAIN_TYPE", _DEBUG = "DEBUG_CONDITION", _GVM_TOOLCHAIN_TYPE = "GVM_TOOLCHAIN_TYPE", _NATIVE_IMAGE_ATTRS = "NATIVE_IMAGE_ATTRS", + _NATIVE_IMAGE_TEST_ATTRS = "NATIVE_IMAGE_TEST_ATTRS", + _NATIVE_IMAGE_SHARED_LIB_ATTRS = "NATIVE_IMAGE_SHARED_LIB_ATTRS", + _OUTPUT_GROUPS = "OUTPUT_GROUPS", _OPTIMIZATION_MODE = "OPTIMIZATION_MODE_CONDITION", _graal_binary_implementation = "graal_binary_implementation", + _graal_shared_binary_implementation = "graal_shared_binary_implementation", + _graal_test_binary_implementation = "graal_test_binary_implementation", ) load( "//internal/native_image:settings.bzl", "NativeImageInfo", ) +_DEFAULT_NATIVE_IMAGE_TESTUTILS = Label("@rules_graalvm//graalvm/testing") + _DEFAULT_NATIVE_IMAGE_SETTINGS = Label("@rules_graalvm//internal/native_image:defaults") _DEFAULT_CHECK_TOOLCHAINS_CONDITION = select({ @@ -30,33 +40,86 @@ _EXEUCTABLE_NAME_CONDITION = select({ "//conditions:default": "%target%-bin", }) -_native_image = rule( - implementation = _graal_binary_implementation, - attrs = dicts.add(_NATIVE_IMAGE_ATTRS, **{ - "native_image_tool": attr.label( - cfg = "exec", - allow_files = True, - executable = True, - mandatory = False, - ), - "native_image_settings": attr.label_list( - providers = [[NativeImageInfo]], - mandatory = False, - default = [_DEFAULT_NATIVE_IMAGE_SETTINGS], - ), - }), - executable = True, - fragments = [ +_TEST_NAME_CONDITION = select({ + "@bazel_tools//src/conditions:windows": "%target%-test.exe", + "//conditions:default": "%target%-test", +}) + +_DEFAULT_NATIVE_IMAGE_TESTDEPS = [ + Label("@maven_gvm//:org_graalvm_sdk_nativeimage"), + Label("@maven_gvm//:org_graalvm_buildtools_junit_platform_native"), + Label("@maven_gvm//:org_junit_jupiter_junit_jupiter_api"), + Label("@maven_gvm//:org_junit_jupiter_junit_jupiter_engine"), + Label("@maven_gvm//:org_junit_jupiter_junit_jupiter_params"), + Label("@maven_gvm//:org_junit_platform_junit_platform_console"), + Label("@maven_gvm//:org_junit_platform_junit_platform_commons"), + Label("@maven_gvm//:org_junit_platform_junit_platform_launcher"), +] + +_SHARED_LIB_NAME_CONDITION = select({ + "//conditions:default": "%target%", +}) + +_modern_rule_attrs = { + "native_image_tool": attr.label( + cfg = "exec", + allow_files = True, + executable = True, + mandatory = False, + ), + "native_image_settings": attr.label_list( + providers = [[NativeImageInfo]], + mandatory = False, + default = [_DEFAULT_NATIVE_IMAGE_SETTINGS], + ), +} + +_modern_rule_options = { + "fragments": [ "apple", + "coverage", "cpp", "java", "platform", "xcode", ], - toolchains = [ - _BAZEL_CPP_TOOLCHAIN_TYPE, + "toolchains": use_cpp_toolchain() + [ _GVM_TOOLCHAIN_TYPE, ], +} + +_native_image = rule( + implementation = _graal_binary_implementation, + attrs = dicts.add(_NATIVE_IMAGE_ATTRS, **_modern_rule_attrs), + executable = True, + **_modern_rule_options, +) + +_native_image_test = rule( + implementation = _graal_test_binary_implementation, + executable = True, + test = True, + attrs = dicts.add(_NATIVE_IMAGE_TEST_ATTRS, dicts.add(_modern_rule_attrs, **{ + "_native_image_test_utils": attr.label( + mandatory = False, + default = _DEFAULT_NATIVE_IMAGE_TESTUTILS, + ), + "_native_test_deps": attr.label_list( + mandatory = False, + default = _DEFAULT_NATIVE_IMAGE_TESTDEPS, + ) + })), + **_modern_rule_options, +) + +_native_image_shared_library = rule( + implementation = _graal_shared_binary_implementation, + attrs = dicts.add(_NATIVE_IMAGE_SHARED_LIB_ATTRS, **_modern_rule_attrs), + **_modern_rule_options, +) + +_NATIVE_IMAGE_UTILS = struct( + output_groups = _OUTPUT_GROUPS, ) # Exports. @@ -67,7 +130,15 @@ def native_image( executable_name = _EXEUCTABLE_NAME_CONDITION, include_resources = None, reflection_configuration = None, + reflection_configurations = [], jni_configuration = None, + jni_configurations = [], + resource_configuration = None, + resource_configurations = [], + proxy_configuration = None, + proxy_configurations = [], + serialization_configuration = None, + serialization_configurations = [], initialize_at_build_time = [], initialize_at_run_time = [], native_features = [], @@ -83,6 +154,8 @@ def native_image( native_image_tool = None, # uses toolchains by default native_image_settings = [_DEFAULT_NATIVE_IMAGE_SETTINGS], profiles = [], + additional_outputs = [], + default_outputs = True, **kwargs): """Generates and compiles a GraalVM native image from a Java library target. @@ -94,7 +167,15 @@ def native_image( The special string `%target%`, if present, is replaced with `name`. include_resources: Glob to pass to `IncludeResources`. No default; optional. reflection_configuration: Reflection configuration file. No default; optional. + reflection_configurations: Reflection configuration file. No default; optional. jni_configuration: JNI configuration file. No default; optional. + jni_configurations: Multiple JNI configuration files. No default; optional. + resource_configuration: Configuration file for embedded resources. No default; optional. + resource_configurations: Configuration files for embedded resources. No default; optional. + proxy_configuration: Configuration file for Java class proxies. No default; optional. + proxy_configurations: Configuration files for Java class proxies. No default; optional. + serialization_configuration: Configuration file for Java class proxies. No default; optional. + serialization_configurations: Configuration files for Java class proxies. No default; optional. initialize_at_build_time: Classes or patterns to pass to `--initialize-at-build-time`. No default; optional. initialize_at_run_time: Classes or patterns to pass to `--initialize-at-run-time`. No default; optional. native_features: GraalVM `Feature` classes to include and apply. No default; optional. @@ -111,20 +192,35 @@ def native_image( data: Data files to make available during the compilation. No default; optional. extra_args: Extra `native-image` args to pass. Last wins. No default; optional. allow_fallback: Whether to allow fall-back to a partial native image; defaults to `False`. + additional_outputs: Additional outputs to expect from the rule (for example, polyglot language resources). check_toolchains: Whether to perform toolchain checks in `native-image`; defaults to `True` on Windows, `False` otherwise. native_image_tool: Specific `native-image` executable target to use. native_image_settings: Suite(s) of Native Image build settings to use. profiles: Profiles to use for profile-guided optimization (PGO) and obtained from a native image compiled with `--pgo-instrument`. + default_outputs: Whether to consider default output files; when `False`, the developer specifies all outputs on top of the + binary itself. **kwargs: Extra keyword arguments are passed to the underlying `native_image` rule. """ + if shared_library: + # buildifier: disable=print + print("GraalVM rules for Bazel at >0.11.x uses `native_image_shared_library`. Please migrate at your convenience.") + _native_image( name = name, deps = deps, main_class = main_class, include_resources = include_resources, reflection_configuration = reflection_configuration, + reflection_configurations = reflection_configurations, jni_configuration = jni_configuration, + jni_configurations = jni_configurations, + resource_configuration = resource_configuration, + resource_configurations = resource_configurations, + proxy_configuration = proxy_configuration, + proxy_configurations = proxy_configurations, + serialization_configuration = serialization_configuration, + serialization_configurations = serialization_configurations, initialize_at_build_time = initialize_at_build_time, initialize_at_run_time = initialize_at_run_time, native_features = native_features, @@ -141,5 +237,244 @@ def native_image( native_image_tool = native_image_tool, native_image_settings = native_image_settings, profiles = profiles, + additional_outputs = additional_outputs, + default_outputs = default_outputs, **kwargs ) + +def native_image_test( + name, + tests, + deps = [], + main_class = None, + discovery = True, + executable_name = _TEST_NAME_CONDITION, + include_resources = None, + reflection_configuration = None, + reflection_configurations = [], + jni_configuration = None, + jni_configurations = [], + resource_configuration = None, + resource_configurations = [], + proxy_configuration = None, + proxy_configurations = [], + serialization_configuration = None, + serialization_configurations = [], + initialize_at_build_time = [], + initialize_at_run_time = [], + native_features = [], + debug = _DEBUG, + optimization_mode = _OPTIMIZATION_MODE, + shared_library = None, + static_zlib = None, + c_compiler_option = [], + data = [], + extra_args = [], + allow_fallback = False, + check_toolchains = _DEFAULT_CHECK_TOOLCHAINS_CONDITION, + native_image_tool = None, # uses toolchains by default + native_image_settings = [_DEFAULT_NATIVE_IMAGE_SETTINGS], + profiles = [], + additional_outputs = [], + default_outputs = True, + **kwargs): + """Generates and compiles a GraalVM native image from a Java library target. + + Args: + name: Name of the target; required. + tests: Java test targets to build and run natively. + deps: Dependency `java_library` targets to assemble the classpath from. Mandatory. + main_class: Testrunner to use; defaults to Bazel's test runner. + discovery: Enable test discovery support; injects classes to discover tests. Defaults to `True`. + executable_name: Set the name of the output binary; defaults to `%target%-test`, or `%target%-test.exe` on Windows. + The special string `%target%`, if present, is replaced with `name`. + include_resources: Glob to pass to `IncludeResources`. No default; optional. + reflection_configuration: Reflection configuration file. No default; optional. + reflection_configurations: Reflection configuration file. No default; optional. + jni_configuration: JNI configuration file. No default; optional. + jni_configurations: Multiple JNI configuration files. No default; optional. + resource_configuration: Configuration file for embedded resources. No default; optional. + resource_configurations: Configuration files for embedded resources. No default; optional. + proxy_configuration: Configuration file for Java class proxies. No default; optional. + proxy_configurations: Configuration files for Java class proxies. No default; optional. + serialization_configuration: Configuration file for Java class proxies. No default; optional. + serialization_configurations: Configuration files for Java class proxies. No default; optional. + initialize_at_build_time: Classes or patterns to pass to `--initialize-at-build-time`. No default; optional. + initialize_at_run_time: Classes or patterns to pass to `--initialize-at-run-time`. No default; optional. + native_features: GraalVM `Feature` classes to include and apply. No default; optional. + debug: Whether to include debug symbols; by default, this flag's state is managed by Bazel. Passing + `--compilation_mode=dbg` is sufficient to flip this to `True`, or it can be overridden via this parameter. + optimization_mode: Behaves the same as `debug`; normally, this flag's state is managed by Bazel. Passing + `--compilation_mode=fastbuild|opt|dbg` is sufficient to set this flag, or it can be overridden via this + parameter. + shared_library: Build a shared library binary instead of an executable. + static_zlib: A cc_library or cc_import target that provides zlib as a static library. + On Linux, this is used when Graal statically links zlib into the binary, e.g. with + `-H:+StaticExecutableWithDynamicLibC`. + c_compiler_option: Extra C compiler options to pass through `native-image`. No default; optional. + data: Data files to make available during the compilation. No default; optional. + extra_args: Extra `native-image` args to pass. Last wins. No default; optional. + allow_fallback: Whether to allow fall-back to a partial native image; defaults to `False`. + additional_outputs: Additional outputs to expect from the rule (for example, polyglot language resources). + check_toolchains: Whether to perform toolchain checks in `native-image`; defaults to `True` on Windows, `False` otherwise. + native_image_tool: Specific `native-image` executable target to use. + native_image_settings: Suite(s) of Native Image build settings to use. + profiles: Profiles to use for profile-guided optimization (PGO) and obtained from a native image compiled with `--pgo-instrument`. + default_outputs: Whether to consider default output files; when `False`, the developer specifies all outputs on top of the + binary itself. + **kwargs: Extra keyword arguments are passed to the underlying `native_image` rule. + """ + + _native_image_test( + name = name, + tests = tests, + deps = deps, + main_class = main_class, + discovery = discovery, + include_resources = include_resources, + reflection_configuration = reflection_configuration, + reflection_configurations = reflection_configurations, + jni_configuration = jni_configuration, + jni_configurations = jni_configurations, + resource_configuration = resource_configuration, + resource_configurations = resource_configurations, + proxy_configuration = proxy_configuration, + proxy_configurations = proxy_configurations, + serialization_configuration = serialization_configuration, + serialization_configurations = serialization_configurations, + initialize_at_build_time = initialize_at_build_time, + initialize_at_run_time = initialize_at_run_time, + native_features = native_features, + debug = debug, + optimization_mode = optimization_mode, + shared_library = shared_library, + data = data, + extra_args = extra_args, + check_toolchains = check_toolchains, + static_zlib = static_zlib, + c_compiler_option = c_compiler_option, + allow_fallback = allow_fallback, + executable_name = executable_name, + native_image_tool = native_image_tool, + native_image_settings = native_image_settings, + profiles = profiles, + additional_outputs = additional_outputs, + default_outputs = default_outputs, + **kwargs + ) + +def native_image_shared_library( + name, + deps, + lib_name = _SHARED_LIB_NAME_CONDITION, + include_resources = None, + reflection_configuration = None, + reflection_configurations = [], + jni_configuration = None, + jni_configurations = [], + resource_configuration = None, + resource_configurations = [], + proxy_configuration = None, + proxy_configurations = [], + serialization_configuration = None, + serialization_configurations = [], + initialize_at_build_time = [], + initialize_at_run_time = [], + native_features = [], + debug = _DEBUG, + optimization_mode = _OPTIMIZATION_MODE, + static_zlib = None, + c_compiler_option = [], + data = [], + extra_args = [], + allow_fallback = False, + check_toolchains = _DEFAULT_CHECK_TOOLCHAINS_CONDITION, + native_image_tool = None, # uses toolchains by default + native_image_settings = [_DEFAULT_NATIVE_IMAGE_SETTINGS], + profiles = [], + out_headers = [], + additional_outputs = [], + default_outputs = True, + **kwargs): + """Generates and compiles a GraalVM native image from a Java library target. + + Args: + name: Name of the target; required. + deps: Dependency `java_library` targets to assemble the classpath from. Mandatory. + lib_name: Set the name of the output library binary; defaults to `%target%`. + The special string `%target%`, if present, is replaced with `name`. + include_resources: Glob to pass to `IncludeResources`. No default; optional. + reflection_configuration: Reflection configuration file. No default; optional. + reflection_configurations: Reflection configuration file. No default; optional. + jni_configuration: JNI configuration file. No default; optional. + jni_configurations: Multiple JNI configuration files. No default; optional. + resource_configuration: Configuration file for embedded resources. No default; optional. + resource_configurations: Configuration files for embedded resources. No default; optional. + proxy_configuration: Configuration file for Java class proxies. No default; optional. + proxy_configurations: Configuration files for Java class proxies. No default; optional. + serialization_configuration: Configuration file for Java class proxies. No default; optional. + serialization_configurations: Configuration files for Java class proxies. No default; optional. + initialize_at_build_time: Classes or patterns to pass to `--initialize-at-build-time`. No default; optional. + initialize_at_run_time: Classes or patterns to pass to `--initialize-at-run-time`. No default; optional. + native_features: GraalVM `Feature` classes to include and apply. No default; optional. + debug: Whether to include debug symbols; by default, this flag's state is managed by Bazel. Passing + `--compilation_mode=dbg` is sufficient to flip this to `True`, or it can be overridden via this parameter. + optimization_mode: Behaves the same as `debug`; normally, this flag's state is managed by Bazel. Passing + `--compilation_mode=fastbuild|opt|dbg` is sufficient to set this flag, or it can be overridden via this + parameter. + static_zlib: A cc_library or cc_import target that provides zlib as a static library. + On Linux, this is used when Graal statically links zlib into the binary, e.g. with + `-H:+StaticExecutableWithDynamicLibC`. + c_compiler_option: Extra C compiler options to pass through `native-image`. No default; optional. + data: Data files to make available during the compilation. No default; optional. + extra_args: Extra `native-image` args to pass. Last wins. No default; optional. + allow_fallback: Whether to allow fall-back to a partial native image; defaults to `False`. + out_headers: Shared library headers expected to be emitted by the rule (in addition to defaults). + additional_outputs: Additional outputs to expect from the rule (for example, polyglot language resources). + check_toolchains: Whether to perform toolchain checks in `native-image`; defaults to `True` on Windows, `False` otherwise. + native_image_tool: Specific `native-image` executable target to use. + native_image_settings: Suite(s) of Native Image build settings to use. + profiles: Profiles to use for profile-guided optimization (PGO) and obtained from a native image compiled with `--pgo-instrument`. + default_outputs: Whether to consider default output files; when `False`, the developer specifies all outputs on top of the + binary itself. + **kwargs: Extra keyword arguments are passed to the underlying `native_image` rule. + """ + + _native_image_shared_library( + name = name, + deps = deps, + include_resources = include_resources, + reflection_configuration = reflection_configuration, + reflection_configurations = reflection_configurations, + jni_configuration = jni_configuration, + jni_configurations = jni_configurations, + resource_configuration = resource_configuration, + resource_configurations = resource_configurations, + proxy_configuration = proxy_configuration, + proxy_configurations = proxy_configurations, + serialization_configuration = serialization_configuration, + serialization_configurations = serialization_configurations, + initialize_at_build_time = initialize_at_build_time, + initialize_at_run_time = initialize_at_run_time, + native_features = native_features, + debug = debug, + optimization_mode = optimization_mode, + shared_library = True, + data = data, + extra_args = extra_args, + check_toolchains = check_toolchains, + static_zlib = static_zlib, + c_compiler_option = c_compiler_option, + allow_fallback = allow_fallback, + lib_name = lib_name, + native_image_tool = native_image_tool, + native_image_settings = native_image_settings, + profiles = profiles, + out_headers = out_headers, + additional_outputs = additional_outputs, + default_outputs = default_outputs, + **kwargs + ) + +# Aliases. +utils = _NATIVE_IMAGE_UTILS diff --git a/graalvm/testing/BUILD.bazel b/graalvm/testing/BUILD.bazel new file mode 100644 index 00000000..c1c19ef7 --- /dev/null +++ b/graalvm/testing/BUILD.bazel @@ -0,0 +1,23 @@ +load( + "@rules_java//java:defs.bzl", + "java_library", +) + +package(default_visibility = [ + "@//:__subpackages__", +]) + +java_library( + name = "testing", + testonly = True, + srcs = [ + "NativeTestRunner.java", + "NativeTestFeature.java", + "NativeTestLauncher.java", + ], + deps = [ + "@maven_gvm//:org_graalvm_sdk_nativeimage", + "@maven_gvm//:org_graalvm_buildtools_junit_platform_native", + "@maven_gvm//:org_junit_platform_junit_platform_launcher", + ], +) diff --git a/graalvm/testing/NativeTestFeature.java b/graalvm/testing/NativeTestFeature.java new file mode 100644 index 00000000..e644db0a --- /dev/null +++ b/graalvm/testing/NativeTestFeature.java @@ -0,0 +1,15 @@ + +package graalvm.testing; + +import org.graalvm.nativeimage.hosted.Feature; +import java.util.Collections; +import java.util.List; + +public final class NativeTestFeature implements Feature { + @Override + public List> getRequiredFeatures() { + return Collections.singletonList( + org.graalvm.junit.platform.JUnitPlatformFeature.class + ); + } +} diff --git a/graalvm/testing/NativeTestLauncher.java b/graalvm/testing/NativeTestLauncher.java new file mode 100644 index 00000000..641a2f6f --- /dev/null +++ b/graalvm/testing/NativeTestLauncher.java @@ -0,0 +1,16 @@ +package graalvm.testing; + +import org.graalvm.junit.platform.NativeImageJUnitLauncher; +import org.junit.platform.launcher.Launcher; +import org.junit.platform.launcher.TestExecutionListener; +import org.junit.platform.launcher.TestPlan; + +public final class NativeTestLauncher extends NativeImageJUnitLauncher { + public NativeTestLauncher(Launcher launcher, TestPlan testPlan) { + super(launcher, testPlan); + } + + public static void exec(String entry, String suite, boolean discovery, String[] args) { + NativeImageJUnitLauncher.main(); + } +} diff --git a/graalvm/testing/NativeTestRunner.java b/graalvm/testing/NativeTestRunner.java new file mode 100644 index 00000000..958098d0 --- /dev/null +++ b/graalvm/testing/NativeTestRunner.java @@ -0,0 +1,16 @@ +package graalvm.testing; + +public final class NativeTestRunner { + private static final String discoveryProperty = "bazel.graalvm.testing.discovery"; + private static final String entryWrapped = "bazel.graalvm.testing.wrappedEntry"; + private static final String bazelSuite = "bazel.test_suite"; + + public static void main(String[] args) { + NativeTestLauncher.exec( + System.getProperty(entryWrapped), + System.getProperty(bazelSuite), + "true".equals(System.getProperty(discoveryProperty)), + args + ); + } +} diff --git a/graalvm/testing/defs.bzl b/graalvm/testing/defs.bzl new file mode 100644 index 00000000..c7b204d6 --- /dev/null +++ b/graalvm/testing/defs.bzl @@ -0,0 +1,21 @@ +"Defines common values used for native testing." + +load( + "//internal/testing:bzl", + _NATIVE_TEST_ENTRYPOINT = "NATIVE_TEST_ENTRYPOINT", + _DEFAULT_WRAPPED_ENTRYPOINT = "DEFAULT_WRAPPED_ENTRYPOINT", + _DEFAULT_NATIVE_BASE_ENTRYPOINT = "DEFAULT_NATIVE_BASE_ENTRYPOINT", + _NATIVE_TEST_FEATURE = "NATIVE_TEST_FEATURE", +) + +# Top-level entrypoint for native tests (unless user provides their own). +NATIVE_TEST_ENTRYPOINT = _NATIVE_TEST_ENTRYPOINT + +# Default Bazel entrypoint wrapped by the top-level entrypoint. +DEFAULT_WRAPPED_ENTRYPOINT = _DEFAULT_WRAPPED_ENTRYPOINT + +# Default GraalVM test discovery entrypoint overridden by the top-level entrypoint. +DEFAULT_NATIVE_BASE_ENTRYPOINT = _DEFAULT_NATIVE_BASE_ENTRYPOINT + +# Compile-time feature which configures reflective access to entrypoints and tests. +NATIVE_TEST_FEATURE = _NATIVE_TEST_FEATURE diff --git a/internal/graalvm_bindist.bzl b/internal/graalvm_bindist.bzl index 47d55baf..09df6dbe 100644 --- a/internal/graalvm_bindist.bzl +++ b/internal/graalvm_bindist.bzl @@ -518,6 +518,7 @@ graalvm_sdk( name = "gvm", native_image_bin = ":native-image", gvm_files = ":files", + includes = ":includes", ) alias( name = "sdk", @@ -550,6 +551,11 @@ filegroup( srcs = glob(["**/*"]), ) +filegroup( + name = "includes", + srcs = glob(["include/**/*"]), +) + # Tool Targets {rendered_bin_targets} diff --git a/internal/maven.bzl b/internal/maven.bzl index 0b977b3e..375acdc7 100644 --- a/internal/maven.bzl +++ b/internal/maven.bzl @@ -2,7 +2,7 @@ load( "//internal:config.bzl", - "GRAALVM_VERSION", + _GRAALVM_VERSION = "GRAALVM_VERSION", ) def graalvm(artifact, repository = "@maven", version = None, group = None): @@ -25,7 +25,7 @@ def graalvm(artifact, repository = "@maven", version = None, group = None): group = (group or artifact.split(":")[0]).replace(".", "_") name = (group and artifact or artifact.split(":")[1]).replace(".", "_") - resolved_version = version or GRAALVM_VERSION + resolved_version = version or _GRAALVM_VERSION if resolved_version: formatted_version = resolved_version.replace(".", "_") diff --git a/internal/native_image/builder.bzl b/internal/native_image/builder.bzl index fc2a2068..487126d4 100644 --- a/internal/native_image/builder.bzl +++ b/internal/native_image/builder.bzl @@ -1,5 +1,41 @@ "Logic to assemble `native-image` options." +load( + "//internal/native_image:testing.bzl", + _NATIVE_TEST_ENTRYPOINT = "NATIVE_TEST_ENTRYPOINT", +) + +_NATIVE_IMAGE_SHARED_TMP_DIR_TPL = "native-shlib-%s" + +_DEFAULT_NATIVE_IMAGE_ARGS = [ + "-H:+JNI", + "-H:+ReportExceptionStackTraces", +] + +_STRICT_NATIVE_IMAGE_ARGS = [ + "--link-at-build-time", + "--strict-image-heap", +] + +_DEBUG_NATIVE_IMAGE_ARGS = [ + "-g", + "-H:+SourceLevelDebug", + "-H:-DeleteLocalSymbols", +] + +def _expand_var(ctx, arg, context = None, vars = None): + return ctx.expand_make_variables( + "native_image", + ctx.expand_location(arg, context or ctx.attr.data), + vars or ctx.var, + ) + +def _expand_vars(ctx, args, context = None, vars = None): + return [_expand_var(ctx, arg, context, vars or ctx.var) for arg in args] + +def _arg_formatted(ctx, args, value, format = None, context = None, vars = None): + args.add(_expand_var(ctx, value, context, vars), format = format or "%s") + def _configure_static_zlib_compile(ctx, args, direct_inputs): """Configure a static image compile against hermetic/static zlib. @@ -51,7 +87,7 @@ def _configure_debug(ctx, args): """ if ctx.attr.debug: - args.add("-g") + args.add_all(_DEBUG_NATIVE_IMAGE_ARGS) def _configure_optimization_mode(ctx, args): """Configure the Native Image optimization mode to match Bazel's build setting. @@ -67,6 +103,45 @@ def _configure_optimization_mode(ctx, args): format = "-O%s", ) +def _singular_or_multi_but_not_both(args, direct_inputs, singular_label, plural_label, singular, plural, format = "%s", separator = ","): + """Use either the singular form of a file attribute, or the multi-label form, but fail if both are provided. + + Resulting arguments are formatted (if necessary) and appended to the `direct_inputs` list and + suite of args. + + Args: + args: Arguments to add to. + direct_inputs: Direct inputs list to append to for matching files. + singular_label: Label for the singular attribute. Used in error messages. + plural_label: Label for the plural attribute. Used in error messages. + singular: Singular attribute value. + plural: Plural attribute value. + format: Format string for the attribute value. + separator: Separator for the attribute value. + """ + + values = [] + if singular != None: + values.append(singular) + elif plural and len(plural) > 0: + values.extend(plural) + elif (plural == None or len(plural) == 0) and (singular == None): + pass + else: + fail( + "GraalVM Rules: Please provide singular or plural attributes, but not both. Got both: %s and %s." % ( + singular_label, + plural_label + )) + + if len(values) > 0: + args.add_joined( + values, + join_with = separator, + format_joined = format, + ) + direct_inputs.extend(values) + def _configure_reflection(ctx, args, direct_inputs): """Configure reflection settings for a Native Image build. @@ -87,14 +162,33 @@ def _configure_reflection(ctx, args, direct_inputs): format_joined = "--initialize-at-run-time=%s", ) - if ctx.attr.reflection_configuration != None: - args.add(ctx.file.reflection_configuration, format = "-H:ReflectionConfigurationFiles=%s") - direct_inputs.append(ctx.file.reflection_configuration) - - if ctx.attr.jni_configuration != None: - args.add(ctx.file.jni_configuration, format = "-H:JNIConfigurationFiles=%s") - direct_inputs.append(ctx.file.jni_configuration) - args.add("-H:+JNI") + _singular_or_multi_but_not_both( + args, + direct_inputs, + "reflection_configuration", + "reflection_configurations", + ctx.file.reflection_configuration, + ctx.files.reflection_configurations, + format = "-H:ReflectionConfigurationFiles=%s", + ) + _singular_or_multi_but_not_both( + args, + direct_inputs, + "jni_configuration", + "jni_configurations", + ctx.file.jni_configuration, + ctx.files.jni_configurations, + format = "-H:JNIConfigurationFiles=%s", + ) + _singular_or_multi_but_not_both( + args, + direct_inputs, + "resource_configuration", + "resource_configurations", + ctx.file.resource_configuration, + ctx.files.resource_configurations, + format = "-H:ResourceConfigurationFiles=%s", + ) def _configure_native_compiler(ctx, args, c_compiler_path, gvm_toolchain): """Configure native compiler and linker flags for a Native Image build. @@ -121,27 +215,33 @@ def _configure_native_compiler(ctx, args, c_compiler_path, gvm_toolchain): format_each = "-H:CCompilerOption=%s", ) -def _configure_native_test_flags(ctx, args): - """Configure native testing flags; only applies if we are building a test-only target. +def _configure_gvm_features(args, features = []): + """Format and add arguments for GraalVM feature classes. Args: - ctx: Context of the Native Image rule implementation. - args: Args builder for the Native Image build. + args: Args we're adding to. + features: Additional features to inject. """ - if ctx.attr.coverage: - args.add("--tool:coverage") + args.add_joined( + features, + join_with = ",", + format_joined = "--features=%s", + ) def assemble_native_build_options( ctx, args, binary, classpath_depset, + modulepath_depset, direct_inputs, c_compiler_path, path_list_separator, gvm_toolchain = None, - bin_postfix = None): + bin_postfix = None, + injected_features = [], + injected_args = []): """Assemble the effective arguments to `native-image`. This function is responsible for converting the current rule invocation context into a set of arguments @@ -152,16 +252,29 @@ def assemble_native_build_options( args: Args builder for the Native Image build. binary: Target output binary which will be built with Native Image. classpath_depset: Classpath dependency set. + modulepath_depset: Modular dependency set. direct_inputs: Direct inputs into the native image build (mutable). c_compiler_path: Path to the C compiler; resolved via toolchains. path_list_separator: Platform-specific path separator. gvm_toolchain: Resolved GraalVM toolchain, or `None` if a tool target is in use via legacy rules. bin_postfix: Binary postfix expected from the output file (for example, `.exe` or `.dylib`). + injected_features: Additional feature classes to add to the compile invocation. + injected_args: Additional arguments to inject into the compile invocation. + + Returns: + Tempdir path where the native build should occur. """ + # @TODO(sgammon): only append with gvm version > 23.1.x + # "-H:+UnlockExperimentalVMOptions" + + is_test = ctx.attr._is_test + # main class is required unless we are building a shared library if ctx.attr.shared_library: args.add("--shared") + elif is_test: + pass # no main class for tests elif ctx.attr.main_class == None or ctx.attr.main_class == "": fail(""" Native Image build failure: `main_class` attribute is mandatory in `native_image` or `graal_binary` targets, @@ -175,10 +288,50 @@ def assemble_native_build_options( if bin_postfix: trimmed_basename = trimmed_basename[0:-(len(bin_postfix))] - args.add(ctx.attr.main_class, format = "-H:Class=%s") args.add(trimmed_basename, format = "-H:Name=%s") - args.add(binary.dirname, format = "-H:Path=%s") - args.add("-H:+ReportExceptionStackTraces") + if not ctx.attr.shared_library: + if ctx.attr.main_class != None and ctx.attr.main_class != "": + if ctx.attr.main_module != None and ctx.attr.main_module != "": + args.add( + "%s/%s" % (ctx.attr.main_module, ctx.attr.main_class), + format = "-H:Class=%s", + ) + else: + args.add(ctx.attr.main_class, format = "-H:Class=%s") + elif is_test: + # it's a test and we have no entrypoint class, so we should use the default + # entrypoint provided by this package. + args.add( + _NATIVE_TEST_ENTRYPOINT, + format = "-H:Class=%s", + ) + + # binary path supports expansion + _arg_formatted( + ctx, + args, + binary.dirname, + format = "-H:Path=%s", + ) + + # default native image args, and strict args if directed + args.add_all(_DEFAULT_NATIVE_IMAGE_ARGS) + if ctx.attr.strict: + args.add_all(_STRICT_NATIVE_IMAGE_ARGS) + + tempdir = None + if ctx.attr.shared_library: + # declare a temp path for graalvm to use + tempdir = ctx.actions.declare_directory( + _NATIVE_IMAGE_SHARED_TMP_DIR_TPL % (ctx.label.name), + sibling = binary, + ) + + # share temp path with graalvm sandbox, as genfiles root + args.add( + tempdir.path, + format = "-H:TempDirectory=%s", + ) if not ctx.attr.check_toolchains: args.add("-H:-CheckToolchain") @@ -190,10 +343,11 @@ def assemble_native_build_options( join_with = path_list_separator, ) + # assemble module path args.add_joined( - ctx.attr.native_features, - join_with = ",", - format_joined = "-H:Features=%s", + "--module-path", + modulepath_depset, + join_with = path_list_separator, ) # configure the build optimization mode @@ -204,7 +358,14 @@ def assemble_native_build_options( # configure resources if ctx.attr.include_resources != None: - args.add(ctx.attr.include_resources, format = "-H:IncludeResources=%s") + # resources config supports expansion + _arg_formatted( + ctx, + args, + ctx.attr.include_resources, + format = "-H:IncludeResources=%s", + context = ctx.attr.include_resources, + ) # if a static build is being performed against hermetic zlib, configure it if ctx.attr.static_zlib != None: @@ -215,20 +376,23 @@ def assemble_native_build_options( ) if ctx.files.profiles: + # pgo profiles support expansion args.add_joined( - ctx.files.profiles, + _expand_vars(ctx, [f.path for f in ctx.files.profiles], ctx.attr.profiles), join_with = ",", format_joined = "--pgo=%s", ) direct_inputs.extend(ctx.files.profiles) - # add test-related flags, if this is a `testonly` target - if ctx.attr.testonly: - _configure_native_test_flags( - ctx, - args, - ) + # configure feature classes + _configure_gvm_features(args, injected_features) + + # add injected args before user args, so that `extra_args` has a chance to override these. + args.add_all(injected_args) # append extra arguments last - for arg in ctx.attr.extra_args: - args.add(arg) + if len(ctx.attr.extra_args) > 0: + # extra args support location + makefile expansion + args.add_all(_expand_vars(ctx, ctx.attr.extra_args)) + + return tempdir diff --git a/internal/native_image/classic.bzl b/internal/native_image/classic.bzl index f7a78756..2e2f3793 100644 --- a/internal/native_image/classic.bzl +++ b/internal/native_image/classic.bzl @@ -16,6 +16,10 @@ load( "//internal/native_image:toolchain.bzl", _resolve_cc_toolchain = "resolve_cc_toolchain", ) +load( + "@bazel_skylib//lib:paths.bzl", + "paths", +) def _graal_binary_classic_implementation(ctx): graal_attr = ctx.attr.native_image_tool @@ -23,9 +27,13 @@ def _graal_binary_classic_implementation(ctx): dep[JavaInfo].transitive_runtime_jars for dep in ctx.attr.deps ]) + classpath_neverlink_depset = depset(transitive = [ + dep[JavaInfo].transitive_compile_time_jars + for dep in ctx.attr.deps + ]) direct_inputs = [] - transitive_inputs = [classpath_depset] + transitive_inputs = [classpath_depset, classpath_neverlink_depset] if graal_attr != None: # otherwise, use the legacy code path. the `graal` value is used in the run @@ -42,21 +50,26 @@ def _graal_binary_classic_implementation(ctx): or install a GraalVM `native-image` toolchain. """) + # resolve graal_home + graalvm_home = paths.dirname(graal.dirname) + # resolve the native toolchain native_toolchain = _resolve_cc_toolchain( ctx, transitive_inputs, is_windows = ctx.configuration.host_path_separator == ";", + graalvm_home = graalvm_home, ) args = ctx.actions.args() - binary = _prepare_native_image_rule_context( + outputs = _prepare_native_image_rule_context( ctx, args, classpath_depset, direct_inputs, native_toolchain.c_compiler_path, ) + binary = outputs[0] inputs = depset( direct_inputs, @@ -64,7 +77,7 @@ def _graal_binary_classic_implementation(ctx): ) ctx.actions.run( - outputs = [binary], + outputs = outputs, arguments = [args], executable = graal, inputs = inputs, diff --git a/internal/native_image/common.bzl b/internal/native_image/common.bzl index f13132ea..98506ae2 100644 --- a/internal/native_image/common.bzl +++ b/internal/native_image/common.bzl @@ -1,5 +1,9 @@ "Defines common properties shared by modern and legacy Native Image rules." +load( + "@bazel_skylib//lib:dicts.bzl", + "dicts", +) load( "//internal/native_image:builder.bzl", _assemble_native_build_options = "assemble_native_build_options", @@ -13,6 +17,8 @@ _BAZEL_CURRENT_CPP_TOOLCHAIN = "@bazel_tools//tools/cpp:current_cc_toolchain" _LINUX_CONSTRAINT = "@platforms//os:linux" _MACOS_CONSTRAINT = "@platforms//os:macos" _WINDOWS_CONSTRAINT = "@platforms//os:windows" +_GRAALVM_ISOLATE_HEADER = "graal_isolate.h" +_GRAALVM_ISOLATE_DYNAMIC_HEADER = "graal_isolate_dynamic.h" # buildifier: disable=name-conventions _NativeImageOptimization = struct( @@ -38,12 +44,22 @@ _OPTIMIZATION_MODE_CONDITION = select({ "//conditions:default": _NativeImageOptimization.DEFAULT, # becomes `-O2` via GraalVM defaults }) -_NATIVE_IMAGE_ATTRS = { +_OUTPUT_GROUPS = struct( + DEFAULT = "default", + SYMBOLS = "symbols", + HEADERS = "headers", + OBJECTS = "objects", + PROFILES = "profiles", + RESOURCES = "resources", +) + +_NATIVE_IMAGE_BASE_ATTRS = { "deps": attr.label_list( providers = [[JavaInfo]], - mandatory = True, + mandatory = False, ), - "main_class": attr.string( + "module_deps": attr.label_list( + providers = [[JavaInfo]], mandatory = False, ), "shared_library": attr.bool( @@ -61,14 +77,45 @@ _NATIVE_IMAGE_ATTRS = { mandatory = False, allow_single_file = True, ), + "reflection_configurations": attr.label_list( + mandatory = False, + ), "jni_configuration": attr.label( mandatory = False, allow_single_file = True, ), + "jni_configurations": attr.label_list( + mandatory = False, + ), + "resource_configuration": attr.label( + mandatory = False, + allow_single_file = True, + ), + "resource_configurations": attr.label_list( + mandatory = False, + ), + "proxy_configuration": attr.label( + mandatory = False, + allow_single_file = True, + ), + "proxy_configurations": attr.label_list( + mandatory = False, + ), + "serialization_configuration": attr.label( + mandatory = False, + allow_single_file = True, + ), + "serialization_configurations": attr.label_list( + mandatory = False, + ), "debug": attr.bool( mandatory = False, default = False, ), + "strict": attr.bool( + mandatory = False, + default = False, + ), "optimization_mode": attr.string( mandatory = False, values = [ @@ -88,6 +135,9 @@ _NATIVE_IMAGE_ATTRS = { "initialize_at_run_time": attr.string_list( mandatory = False, ), + "initialize_rerun_at_runtime": attr.string_list( + mandatory = False, + ), "native_features": attr.string_list( mandatory = False, ), @@ -106,16 +156,20 @@ _NATIVE_IMAGE_ATTRS = { "c_compiler_option": attr.string_list( mandatory = False, ), - "executable_name": attr.string( - mandatory = True, - ), "profiles": attr.label_list( allow_files = True, mandatory = False, ), + "additional_outputs": attr.output_list(), + "default_outputs": attr.bool( + default = True, + ), "_cc_toolchain": attr.label( default = Label(_BAZEL_CURRENT_CPP_TOOLCHAIN), ), + "_is_test": attr.bool( + default = False, + ), "_linux_constraint": attr.label( default = Label(_LINUX_CONSTRAINT), ), @@ -133,6 +187,57 @@ _NATIVE_IMAGE_ATTRS = { ), } +_NATIVE_IMAGE_BIN_ATTRS = dicts.add(_NATIVE_IMAGE_BASE_ATTRS, **{ + "deps": attr.label_list( + providers = [[JavaInfo]], + mandatory = True, + ), + "main_class": attr.string( + mandatory = True, + ), + "main_module": attr.string( + mandatory = False, + ), + "executable_name": attr.string( + mandatory = True, + ), +}) + +_NATIVE_IMAGE_TEST_ATTRS = dicts.add(_NATIVE_IMAGE_BASE_ATTRS, **{ + "tests": attr.label_list( + providers = [[JavaInfo]], + mandatory = True, + ), + "main_class": attr.string( + mandatory = False, + ), + "main_module": attr.string( + mandatory = False, + ), + "discovery": attr.bool( + default = True, + ), + "executable_name": attr.string( + mandatory = True, + ), + "_is_test": attr.bool( + default = True, + ), +}) + +_NATIVE_IMAGE_SHAREDLIB_ATTRS = dicts.add(_NATIVE_IMAGE_BASE_ATTRS, **{ + "deps": attr.label_list( + providers = [[JavaInfo]], + mandatory = True, + ), + "out_headers": attr.output_list( + # Emitted headers. + ), + "lib_name": attr.string( + # Shared library name. + ), +}) + def _prepare_bin_name( name, bin_postfix = None): @@ -148,12 +253,23 @@ def _prepare_native_image_rule_context( direct_inputs, c_compiler_path, gvm_toolchain = None, - bin_postfix = None): + bin_postfix = None, + modulepath_depset = None, + injected_features = [], + injected_args = []): """Prepare a `native-image` build context.""" - out_bin_name = ctx.attr.executable_name.replace("%target%", ctx.attr.name) + out_bin_name = None + if ctx.attr.shared_library: + out_bin_name = ctx.attr.lib_name.replace("%target%", ctx.attr.name) + else: + out_bin_name = ctx.attr.executable_name.replace("%target%", ctx.attr.name) + binary = ctx.actions.declare_file(_prepare_bin_name(out_bin_name, bin_postfix)) + additional_outputs = [] + outputs = [binary] + # TODO: This check really should be on the exec platform, not the target platform, but that # requires going through a separate rule. Since GraalVM doesn't support cross-compilation, the # distinction doesn't matter for now. @@ -162,18 +278,45 @@ def _prepare_native_image_rule_context( else: path_list_separator = ":" - _assemble_native_build_options( + # if we are building a shared library, headers will be emitted; by default, the `graal_isolate.h` + # and `graal_isolate_dynamic.h` files are included. additional headers can be added by the `out_headers` + # attribute. + if ctx.attr.shared_library and ctx.attr.default_outputs: + additional_outputs.append(_GRAALVM_ISOLATE_HEADER) + additional_outputs.append(_GRAALVM_ISOLATE_DYNAMIC_HEADER) + + # append all out headers + if len(ctx.attr.out_headers) > 0: + outputs.extend(ctx.outputs.out_headers) + + # append all additional outputs + if len(additional_outputs) > 0: + outputs.extend([ctx.actions.declare_file(f) for f in additional_outputs]) + + # append all attr additional outputs + if len(ctx.attr.additional_outputs) > 0: + outputs.extend(ctx.outputs.additional_outputs) + + # generate options with tempdir for build + tempdir = _assemble_native_build_options( ctx, args, binary, classpath_depset, + modulepath_depset or depset([]), direct_inputs, c_compiler_path, path_list_separator, gvm_toolchain, bin_postfix, + injected_features, + injected_args, ) - return binary + + # add native image tempdir to outputs if one was allocated + if tempdir != None: + outputs.append(tempdir) + return outputs ## Exports. @@ -181,6 +324,7 @@ def _prepare_native_image_rule_context( NativeImageOptimization = _NativeImageOptimization RULES_REPO = _RULES_REPO +OUTPUT_GROUPS = _OUTPUT_GROUPS DEFAULT_GVM_REPO = _DEFAULT_GVM_REPO DEBUG_CONDITION = _DEBUG_CONDITION COVERAGE_CONDITION = _COVERAGE_CONDITION @@ -190,5 +334,7 @@ BAZEL_CPP_TOOLCHAIN_TYPE = _BAZEL_CPP_TOOLCHAIN_TYPE BAZEL_CURRENT_CPP_TOOLCHAIN = _BAZEL_CURRENT_CPP_TOOLCHAIN MACOS_CONSTRAINT = _MACOS_CONSTRAINT WINDOWS_CONSTRAINT = _WINDOWS_CONSTRAINT -NATIVE_IMAGE_ATTRS = _NATIVE_IMAGE_ATTRS +NATIVE_IMAGE_ATTRS = _NATIVE_IMAGE_BIN_ATTRS +NATIVE_IMAGE_SHARED_LIB_ATTRS = _NATIVE_IMAGE_SHAREDLIB_ATTRS +NATIVE_IMAGE_TEST_ATTRS = _NATIVE_IMAGE_TEST_ATTRS prepare_native_image_rule_context = _prepare_native_image_rule_context diff --git a/internal/native_image/rules.bzl b/internal/native_image/rules.bzl index 5841baff..899255b0 100644 --- a/internal/native_image/rules.bzl +++ b/internal/native_image/rules.bzl @@ -1,21 +1,37 @@ "Rules for building native binaries using the GraalVM `native-image` tool." +load( + "@bazel_skylib//lib:paths.bzl", + "paths", +) +load( + "@bazel_tools//tools/cpp:toolchain_utils.bzl", + "find_cpp_toolchain", +) load( "@build_bazel_apple_support//lib:apple_support.bzl", "apple_support", ) load( "//internal/native_image:common.bzl", - _BAZEL_CPP_TOOLCHAIN_TYPE = "BAZEL_CPP_TOOLCHAIN_TYPE", _BAZEL_CURRENT_CPP_TOOLCHAIN = "BAZEL_CURRENT_CPP_TOOLCHAIN", _DEBUG_CONDITION = "DEBUG_CONDITION", _DEFAULT_GVM_REPO = "DEFAULT_GVM_REPO", _GVM_TOOLCHAIN_TYPE = "GVM_TOOLCHAIN_TYPE", _NATIVE_IMAGE_ATTRS = "NATIVE_IMAGE_ATTRS", + _NATIVE_IMAGE_SHARED_LIB_ATTRS = "NATIVE_IMAGE_SHARED_LIB_ATTRS", + _NATIVE_IMAGE_TEST_ATTRS = "NATIVE_IMAGE_TEST_ATTRS", _OPTIMIZATION_MODE_CONDITION = "OPTIMIZATION_MODE_CONDITION", + _OUTPUT_GROUPS = "OUTPUT_GROUPS", _RULES_REPO = "RULES_REPO", _prepare_native_image_rule_context = "prepare_native_image_rule_context", ) +load( + "//internal/native_image:testing.bzl", + _DEFAULT_WRAPPED_ENTRYPOINT = "DEFAULT_WRAPPED_ENTRYPOINT", + _DEFAULT_NATIVE_BASE_ENTRYPOINT = "DEFAULT_NATIVE_BASE_ENTRYPOINT", + _NATIVE_TEST_FEATURE = "NATIVE_TEST_FEATURE", +) load( "//internal/native_image:toolchain.bzl", _resolve_cc_toolchain = "resolve_cc_toolchain", @@ -36,18 +52,113 @@ def _build_action_message(ctx): } return (_mode_label[ctx.attr.optimization_mode or "default"]) +def _prepare_execution_env(ctx, base_env = {}): + effective = {} + effective.update(base_env) + effective.update({ + "GRAALVM_BAZEL": "true", + "GENFILES_DIR": ctx.genfiles_dir.path, + }) + return effective + +def _create_testrunner_entry_script(ctx, binary, test_args = []): + """Merge available test args from the user, and from the testrunner script to create a shell entrypoint.""" + + formatted_args = " ".join([ctx.expand_location(i) for i in test_args]) + + # create a wrapper shell script which will invoke the testrunner script with the correct args + script = ctx.actions.declare_file( + "%s-native-testrunner.sh" % ctx.label.name, + ) + ctx.actions.write( + script, + """ +#!/bin/bash +set -euo pipefail +exec {binary} {args} + """.format( + binary = binary.short_path, + args = formatted_args, + ), + ) + return script + def _graal_binary_implementation(ctx): + output_groups = {} + is_test = ctx.attr._is_test graal_attr = ctx.attr.native_image_tool extra_tool_deps = [] + direct_inputs = [] gvm_toolchain = None - classpath_depset = depset(transitive = [ - dep[JavaInfo].transitive_runtime_jars - for dep in ctx.attr.deps + + # build a suite of modular-capable dependencies + modulepath_depset = depset([]) + modular_jars = [] + if ctx.attr.module_deps and len(ctx.attr.module_deps) > 0: + modulepath_depset = depset(transitive = [ + dep.files + for dep in ctx.attr.module_deps + ]) + modular_jars = modulepath_depset.to_list() + + # build deps list of utilities (for example, injected test deps) + utils_deps = [] + if is_test: + utils_deps.append(depset(ctx.files._native_image_test_utils)) + utils_deps.append(depset(transitive = [ + dep[JavaInfo].transitive_runtime_jars + for dep in ctx.attr._native_test_deps + ] + [ + dep[JavaInfo].transitive_compile_time_jars + for dep in ctx.attr._native_test_deps + ])) + + # build classpath depset, withholding any deps which are modular; we include compile-time + # deps here as well, since GVM should be able to see them. + depset_transitive = [ + f for f in + [ + dep[JavaInfo].transitive_runtime_jars + for dep in ctx.attr.deps + ] + if f not in modular_jars + ] + depset_transitive.extend([ + f for f in + [ + dep[JavaInfo].transitive_compile_time_jars + for dep in ctx.attr.deps + ] + if f not in modular_jars ]) + depset_transitive.extend( + utils_deps + ) + + # if this is a test target, include transitive test dependencies + if is_test: + depset_transitive.append(depset(transitive = [ + test[JavaInfo].transitive_runtime_jars + for test in ctx.attr.tests + ] + [ + test[JavaInfo].transitive_compile_time_jars + for test in ctx.attr.tests + ])) + for test in ctx.attr.tests: + depset_transitive.append(test.files) + + # seal our classpath depset, we're ready to use it + classpath_depset = depset(transitive = depset_transitive) graal = None - direct_inputs = [] - transitive_inputs = [classpath_depset] + transitive_inputs = [ + classpath_depset, + modulepath_depset, + ] + + # if this is a test, we need to include the test sources as inputs + if is_test: + direct_inputs.extend(ctx.files.tests) # resolve via toolchains info = ctx.toolchains[_GVM_TOOLCHAIN_TYPE].graalvm @@ -57,6 +168,7 @@ def _graal_binary_implementation(ctx): resolved_graal = graal_attr or info.native_image_bin gvm_toolchain = info extra_tool_deps.append(info.gvm_files) + extra_tool_deps.append(info.includes) graal_inputs, _ = ctx.resolve_tools(tools = [ resolved_graal, @@ -66,6 +178,10 @@ def _graal_binary_implementation(ctx): # add toolchain files to transitive inputs transitive_inputs.append(gvm_toolchain.gvm_files[DefaultInfo].files) + transitive_inputs.append(gvm_toolchain.includes[DefaultInfo].files) + direct_inputs.extend(ctx.files.data) + + graalvm_home = paths.dirname(graal.dirname) # if we're using an explicit tool, add it to the direct inputs if graal: @@ -89,6 +205,7 @@ def _graal_binary_implementation(ctx): ctx, transitive_inputs, is_windows = is_windows, + graalvm_home = graalvm_home, ) # shared libraries on macos are produced with an extension of `dylib`. @@ -102,8 +219,34 @@ def _graal_binary_implementation(ctx): elif (not is_windows and not is_macos) and ctx.attr.shared_library: bin_postfix = _BIN_POSTFIX_SO - args = ctx.actions.args().use_param_file("@%s", use_always=False) - binary = _prepare_native_image_rule_context( + args = ctx.actions.args().use_param_file("@%s", use_always=True) + + # if we're running tests or doing other special stuff, we may need to inject features into + # the graalvm build context. + test_args = [] + injected_args = [] + injected_features = [] + if is_test: + injected_features.append(_NATIVE_TEST_FEATURE) + test_args.append("-Dbazel.graalvm.testing=true") + test_args.append("-Dbazel.graalvm.native=true") + test_args.append("-Dbazel.graalvm.testing.discovery=%s" % (ctx.attr.discovery and "true" or "false")) + test_args.append("-Dbazel.graalvm.testing.nativeEntry=%s" % _DEFAULT_NATIVE_BASE_ENTRYPOINT) + test_args.append("-Dbazel.graalvm.testing.wrappedEntry=%s" % (ctx.attr.main_class or _DEFAULT_WRAPPED_ENTRYPOINT)) + injected_args.append("-R:-Dbazel.graalvm.testing=true") + injected_args.append("-R:-Dbazel.graalvm.native=true") + injected_args.extend(test_args) + + # enable test discovery if requested + if ctx.attr.discovery: + injected_args.append("-DtestDiscovery") + + # if the user provided features via the `native_features` attribute, consider those, too. + if ctx.attr.native_features: + injected_features.extend(ctx.attr.native_features) + + # prepare rule context and outputs + all_outputs = _prepare_native_image_rule_context( ctx, args, classpath_depset, @@ -111,6 +254,15 @@ def _graal_binary_implementation(ctx): native_toolchain.c_compiler_path, gvm_toolchain, bin_postfix = bin_postfix, + modulepath_depset = modulepath_depset, + injected_features = injected_features, + ) + binary = all_outputs[0] + + # prepare execution environment + execution_env = _prepare_execution_env( + ctx, + native_toolchain.env, ) # assemble final inputs @@ -118,16 +270,22 @@ def _graal_binary_implementation(ctx): direct_inputs, transitive = transitive_inputs, ) + target_type = "executable" + if ctx.attr.shared_library: + target_type = "shared lib" + elif is_test: + target_type = "test" + run_params = { - "outputs": [binary], + "outputs": all_outputs, "executable": graal, "inputs": inputs, "mnemonic": "NativeImage", - "env": native_toolchain.env, + "env": execution_env, "execution_requirements": {k: "" for k in native_toolchain.execution_requirements}, "progress_message": "Native Image __target__ (__mode__) %{label}" .replace("__mode__", _build_action_message(ctx)) - .replace("__target__", ctx.attr.shared_library and "[shared lib]" or "[executable]"), + .replace("__target__", "[%s]" % target_type), "toolchain": Label(_GVM_TOOLCHAIN_TYPE), } @@ -159,15 +317,79 @@ def _graal_binary_implementation(ctx): **run_params ) - return [DefaultInfo( - executable = binary, - files = depset([binary]), - runfiles = ctx.runfiles( - collect_data = True, - collect_default = True, - files = [], + # if we are building a shared library, prepare `CcSharedLibraryInfo` for it + output_infos = [] + runfiles = None + if ctx.attr.shared_library: + cc_toolchain = find_cpp_toolchain(ctx) + feature_configuration = cc_common.configure_features( + ctx = ctx, + cc_toolchain = cc_toolchain, + requested_features = ctx.features, + unsupported_features = ctx.disabled_features, + ) + libraries_to_link = [ + cc_common.create_library_to_link( + actions = ctx.actions, + feature_configuration = feature_configuration, + cc_toolchain = cc_toolchain, + dynamic_library = binary, + ), + ] + + ## extend with additional cc info for shared library use + output_groups["main_shared_library_output"] = depset([binary]) + output_infos.extend([ + CcSharedLibraryInfo( + linker_input = cc_common.create_linker_input( + owner = ctx.label, + libraries = depset(libraries_to_link), + ), + ), + ]) + + # add output group for shared headers + # output_groups[_OUTPUT_GROUPS.HEADERS] = depset([binary]) + + # in shared library mode, the shared library is the default output + output_groups[_OUTPUT_GROUPS.DEFAULT] = depset([binary]) + + else: + # if it's not a shared library, our default output is the binary produced + output_groups[_OUTPUT_GROUPS.DEFAULT] = depset([binary]) + + # if we are building a test, we need to create a shell script which wraps the test's + # execution, and sets up the args and environment correctly. then, we need to swap the + # main output binary for this wrapper. + entrypoint = binary + extra_runfiles = [] + if is_test: + entrypoint = _create_testrunner_entry_script( + ctx, + binary, + test_args, + ) + extra_runfiles.append(binary) + + # prepare all runfiles + all_runfiles = ctx.runfiles( + collect_data = True, + collect_default = True, + files = extra_runfiles, + ) + if runfiles != None: + all_runfiles = all_runfiles.merge(runfiles) + + return output_infos + [ + DefaultInfo( + executable = entrypoint, + files = depset(all_outputs), + runfiles = all_runfiles, + ), + OutputGroupInfo( + **output_groups ), - )] + ] def _wrap_actions_for_graal(actions): """Wraps the given ctx.actions struct so that env variables are correctly passed to Graal.""" @@ -198,9 +420,13 @@ def _wrapped_run_for_graal(_original_actions, arguments = [], env = {}, **kwargs RULES_REPO = _RULES_REPO DEFAULT_GVM_REPO = _DEFAULT_GVM_REPO BAZEL_CURRENT_CPP_TOOLCHAIN = _BAZEL_CURRENT_CPP_TOOLCHAIN -BAZEL_CPP_TOOLCHAIN_TYPE = _BAZEL_CPP_TOOLCHAIN_TYPE NATIVE_IMAGE_ATTRS = _NATIVE_IMAGE_ATTRS +NATIVE_IMAGE_SHARED_LIB_ATTRS = _NATIVE_IMAGE_SHARED_LIB_ATTRS +NATIVE_IMAGE_TEST_ATTRS = _NATIVE_IMAGE_TEST_ATTRS GVM_TOOLCHAIN_TYPE = _GVM_TOOLCHAIN_TYPE +OUTPUT_GROUPS = _OUTPUT_GROUPS DEBUG_CONDITION = _DEBUG_CONDITION OPTIMIZATION_MODE_CONDITION = _OPTIMIZATION_MODE_CONDITION graal_binary_implementation = _graal_binary_implementation +graal_shared_binary_implementation = _graal_binary_implementation +graal_test_binary_implementation = _graal_binary_implementation diff --git a/internal/native_image/testing.bzl b/internal/native_image/testing.bzl new file mode 100644 index 00000000..647199b7 --- /dev/null +++ b/internal/native_image/testing.bzl @@ -0,0 +1,13 @@ +"Internals for testing with GraalVM native images." + +# Top-level entrypoint for native tests (unless user provides their own). +NATIVE_TEST_ENTRYPOINT = "graalvm.testing.NativeTestRunner" + +# Default Bazel entrypoint wrapped by the top-level entrypoint. +DEFAULT_WRAPPED_ENTRYPOINT = "com.google.testing.junit.runner.BazelTestRunner" + +# Default GraalVM test discovery entrypoint overridden by the top-level entrypoint. +DEFAULT_NATIVE_BASE_ENTRYPOINT = "org.graalvm.junit.platform.NativeImageJUnitLauncher" + +# Compile-time feature which configures reflective access to entrypoints and tests. +NATIVE_TEST_FEATURE = "graalvm.testing.NativeTestFeature" diff --git a/internal/native_image/toolchain.bzl b/internal/native_image/toolchain.bzl index f3e69b79..d1bc0979 100644 --- a/internal/native_image/toolchain.bzl +++ b/internal/native_image/toolchain.bzl @@ -20,7 +20,7 @@ load( "find_cpp_toolchain", ) -def resolve_cc_toolchain(ctx, transitive_inputs, *, is_windows): +def resolve_cc_toolchain(ctx, transitive_inputs, *, is_windows, graalvm_home): """Build a context struct for accessing the native C toolchain. Available struct properties: @@ -32,6 +32,7 @@ def resolve_cc_toolchain(ctx, transitive_inputs, *, is_windows): ctx: Context from the rule implementation. transitive_inputs: List of transitive inputs (mutated). is_windows: Whether the target (and hence execution) platform is Windows. + graalvm_home: Parent directory which should be used as `GRAALVM_HOME`. Returns: Resulting struct; see method documentation for parameters.""" @@ -118,9 +119,11 @@ def resolve_cc_toolchain(ctx, transitive_inputs, *, is_windows): # seal paths with hack above env["PATH"] = ctx.configuration.host_path_separator.join(paths) + env["GRAALVM_HOME"] = graalvm_home return struct( c_compiler_path = c_compiler_path, env = env, execution_requirements = execution_requirements, + graalvm_home = graalvm_home, ) diff --git a/internal/testing.bzl b/internal/testing.bzl new file mode 100644 index 00000000..defa3fd9 --- /dev/null +++ b/internal/testing.bzl @@ -0,0 +1,21 @@ +"Defines common values used for native testing." + +load( + "//internal/native_image/testing:bzl", + _NATIVE_TEST_ENTRYPOINT = "NATIVE_TEST_ENTRYPOINT", + _DEFAULT_WRAPPED_ENTRYPOINT = "DEFAULT_WRAPPED_ENTRYPOINT", + _DEFAULT_NATIVE_BASE_ENTRYPOINT = "DEFAULT_NATIVE_BASE_ENTRYPOINT", + _NATIVE_TEST_FEATURE = "NATIVE_TEST_FEATURE", +) + +# Top-level entrypoint for native tests (unless user provides their own). +NATIVE_TEST_ENTRYPOINT = _NATIVE_TEST_ENTRYPOINT + +# Default Bazel entrypoint wrapped by the top-level entrypoint. +DEFAULT_WRAPPED_ENTRYPOINT = _DEFAULT_WRAPPED_ENTRYPOINT + +# Default GraalVM test discovery entrypoint overridden by the top-level entrypoint. +DEFAULT_NATIVE_BASE_ENTRYPOINT = _DEFAULT_NATIVE_BASE_ENTRYPOINT + +# Compile-time feature which configures reflective access to entrypoints and tests. +NATIVE_TEST_FEATURE = _NATIVE_TEST_FEATURE diff --git a/internal/toolchain.bzl b/internal/toolchain.bzl index 338709c1..9da9716c 100644 --- a/internal/toolchain.bzl +++ b/internal/toolchain.bzl @@ -8,6 +8,7 @@ GraalVMToolchainInfo = provider( fields = [ "native_image_bin", "gvm_files", + "includes", ], ) @@ -24,6 +25,7 @@ def _gvm_toolchain_impl(ctx): graalvm = GraalVMToolchainInfo( native_image_bin = ctx.attr.native_image_bin, gvm_files = ctx.attr.gvm_files, + includes = ctx.attr.includes, ), ) return [toolchain_info] @@ -72,6 +74,15 @@ Filegroup which holds the full set of constituent files which are part of this G SDK installation. These files are transitive tool dependencies for any binary built with Native Image. +""", + ), + "includes": attr.label( + mandatory = True, + allow_files = True, + cfg = "exec", + doc = """ +Native headers from the GraalVM JDK which should be made available to `native-image` +compile jobs (for example, `jni.h`). """, ), }, diff --git a/maven_install.json b/maven_install.json old mode 100644 new mode 100755 index b83ffb4c..40d03564 --- a/maven_install.json +++ b/maven_install.json @@ -1,8 +1,29 @@ { "__AUTOGENERATED_FILE_DO_NOT_MODIFY_THIS_FILE_MANUALLY": "THERE_IS_NO_DATA_ONLY_ZUUL", - "__INPUT_ARTIFACTS_HASH": -1579394223, - "__RESOLVED_ARTIFACTS_HASH": -1141381396, + "__INPUT_ARTIFACTS_HASH": 617447018, + "__RESOLVED_ARTIFACTS_HASH": -2008138335, "artifacts": { + "junit:junit": { + "shasums": { + "jar": "59721f0805e223d84b90677887d9ff567dc534d7c502ca903c0c2b17f05c116a", + "sources": "9f43fea92033ad82bcad2ae44cec5c82abc9d6ee4b095cab921d11ead98bf2ff" + }, + "version": "4.12" + }, + "org.apiguardian:apiguardian-api": { + "shasums": { + "jar": "b509448ac506d607319f182537f0b35d71007582ec741832a1f111e5b5b70b38", + "sources": "277a7a4315412817beb6655b324dc7276621e95ebff00b8bf65e17a27b685e2d" + }, + "version": "1.1.2" + }, + "org.graalvm.buildtools:junit-platform-native": { + "shasums": { + "jar": "b3f1f35878fdf3d2040e75f0fd5a787f03bf33c567419f81f4ce935726ea38fe", + "sources": "117c6752e28c6335c506c2d5fd945d9b4f6d0aeb9a6a4c960f19e1cc61e8efad" + }, + "version": "0.9.28" + }, "org.graalvm.compiler:compiler": { "shasums": { "jar": "dc6ae2eba4e26d0e049b13f4eee739c3d4d338af92ad9dd489c9399599c9713c", @@ -79,9 +100,94 @@ "sources": "34c3883109533eb82a0a9b43d4852fe7368f35d30d3c79c3dada623681dc3fbb" }, "version": "23.1.1" + }, + "org.hamcrest:hamcrest-core": { + "shasums": { + "jar": "66fdef91e9739348df7a096aa384a5685f4e875584cce89386a7a47251c4d8e9", + "sources": "e223d2d8fbafd66057a8848cc94222d63c3cedd652cc48eddc0ab5c39c0f84df" + }, + "version": "1.3" + }, + "org.junit.jupiter:junit-jupiter": { + "shasums": { + "jar": "8e4bde23ee28fc443975654a7b28c410a3b78d6be96b78c99ab73695ec344f7c", + "sources": "bd628b06b83b0d8830b53747b7f466beebca12d4808f117660ac06e47af99d1c" + }, + "version": "5.10.0" + }, + "org.junit.jupiter:junit-jupiter-api": { + "shasums": { + "jar": "108088fd7ea46a8e65a0ce7f5d75ae3ff7865606770a078715f5a6e5709e17d8", + "sources": "34fbf1f58dac2db51ab44f22f547fcee185b342d046c3ac119ec00dd2ba98e75" + }, + "version": "5.10.0" + }, + "org.junit.jupiter:junit-jupiter-engine": { + "shasums": { + "jar": "57ea48e6f795200791065bbc86b70b84cd05367c5c9f2ac8f9268e27154c88a8", + "sources": "050476b6fa4a57db3152f52403860019a5588d480d653bc7a1df5bcc84376211" + }, + "version": "5.10.0" + }, + "org.junit.jupiter:junit-jupiter-params": { + "shasums": { + "jar": "f259a7322cce375430c2236a2dcb24d4a49d22045b723ad85af88e11704391c2", + "sources": "7d20740d1dded4cb1de5805c3da3293b6a5e2991ad3b64539aa575c9638719dc" + }, + "version": "5.10.0" + }, + "org.junit.platform:junit-platform-commons": { + "shasums": { + "jar": "6083db08ca11fca1e16099d0dcfede0193d80b3762b276349d80d3da536791b2", + "sources": "ebeb653947017ad2eadc5e9f38eab56400003886d9edf6f336890906e8c905b3" + }, + "version": "1.10.0" + }, + "org.junit.platform:junit-platform-console": { + "shasums": { + "jar": "5c43a8dccbb24781a1880ce0287e81290eb8fd23fa6800a346cec219a46b21a8", + "sources": "31abe626be8e567e99366667a1242e2d469e3e828d40efca65017662df4f61c6" + }, + "version": "1.10.0" + }, + "org.junit.platform:junit-platform-engine": { + "shasums": { + "jar": "cd338efd02ee73966ea754e0c0c71e1a11f4af5db9c2003e4b6137e119155abe", + "sources": "17ac74964fcd82c57130623afe72a99105ca107fc96cb53f169b3a8c9c444c83" + }, + "version": "1.10.0" + }, + "org.junit.platform:junit-platform-launcher": { + "shasums": { + "jar": "8c60b661ac170701a635dfc67565efbb8c85b5c5cdd5a4a9576e3a015c7111a4", + "sources": "f98514c156fe6a257659e2c4e964193ffc1d68df1e003d0d0470b24b9055787e" + }, + "version": "1.10.0" + }, + "org.junit.platform:junit-platform-reporting": { + "shasums": { + "jar": "a0cdce1cc588fb902bdd08c7f24624ef72b131873eea09f063e6ee6ff453f654", + "sources": "3da58799df48f4a280f4e4ea7a92d5e97d2e357ac1b98885afc04a4445457713" + }, + "version": "1.10.0" + }, + "org.opentest4j:opentest4j": { + "shasums": { + "jar": "48e2df636cab6563ced64dcdff8abb2355627cb236ef0bf37598682ddf742f1b", + "sources": "724a24e3a68267d5ebac9411389a15638a71e50c62448ffa58f59c34d5c1ebb2" + }, + "version": "1.3.0" } }, "dependencies": { + "junit:junit": [ + "org.hamcrest:hamcrest-core" + ], + "org.graalvm.buildtools:junit-platform-native": [ + "org.junit.jupiter:junit-jupiter", + "org.junit.platform:junit-platform-console", + "org.junit.platform:junit-platform-launcher" + ], "org.graalvm.compiler:compiler": [ "org.graalvm.sdk:collections", "org.graalvm.sdk:word", @@ -118,9 +224,91 @@ ], "org.graalvm.sdk:nativeimage": [ "org.graalvm.sdk:word" + ], + "org.junit.jupiter:junit-jupiter": [ + "org.junit.jupiter:junit-jupiter-api", + "org.junit.jupiter:junit-jupiter-engine", + "org.junit.jupiter:junit-jupiter-params" + ], + "org.junit.jupiter:junit-jupiter-api": [ + "org.apiguardian:apiguardian-api", + "org.junit.platform:junit-platform-commons", + "org.opentest4j:opentest4j" + ], + "org.junit.jupiter:junit-jupiter-engine": [ + "org.apiguardian:apiguardian-api", + "org.junit.jupiter:junit-jupiter-api", + "org.junit.platform:junit-platform-engine" + ], + "org.junit.jupiter:junit-jupiter-params": [ + "org.apiguardian:apiguardian-api", + "org.junit.jupiter:junit-jupiter-api" + ], + "org.junit.platform:junit-platform-commons": [ + "org.apiguardian:apiguardian-api" + ], + "org.junit.platform:junit-platform-console": [ + "org.apiguardian:apiguardian-api", + "org.junit.platform:junit-platform-reporting" + ], + "org.junit.platform:junit-platform-engine": [ + "org.apiguardian:apiguardian-api", + "org.junit.platform:junit-platform-commons", + "org.opentest4j:opentest4j" + ], + "org.junit.platform:junit-platform-launcher": [ + "org.apiguardian:apiguardian-api", + "org.junit.platform:junit-platform-engine" + ], + "org.junit.platform:junit-platform-reporting": [ + "org.apiguardian:apiguardian-api", + "org.junit.platform:junit-platform-launcher" ] }, "packages": { + "junit:junit": [ + "junit.extensions", + "junit.framework", + "junit.runner", + "junit.textui", + "org.junit", + "org.junit.experimental", + "org.junit.experimental.categories", + "org.junit.experimental.max", + "org.junit.experimental.results", + "org.junit.experimental.runners", + "org.junit.experimental.theories", + "org.junit.experimental.theories.internal", + "org.junit.experimental.theories.suppliers", + "org.junit.internal", + "org.junit.internal.builders", + "org.junit.internal.matchers", + "org.junit.internal.requests", + "org.junit.internal.runners", + "org.junit.internal.runners.model", + "org.junit.internal.runners.rules", + "org.junit.internal.runners.statements", + "org.junit.matchers", + "org.junit.rules", + "org.junit.runner", + "org.junit.runner.manipulation", + "org.junit.runner.notification", + "org.junit.runners", + "org.junit.runners.model", + "org.junit.runners.parameterized", + "org.junit.validator" + ], + "org.apiguardian:apiguardian-api": [ + "org.apiguardian.api" + ], + "org.graalvm.buildtools:junit-platform-native": [ + "org.graalvm.junit.platform", + "org.graalvm.junit.platform.config.core", + "org.graalvm.junit.platform.config.jupiter", + "org.graalvm.junit.platform.config.platform", + "org.graalvm.junit.platform.config.util", + "org.graalvm.junit.platform.config.vintage" + ], "org.graalvm.compiler:compiler": [ "org.graalvm.compiler.api.directives", "org.graalvm.compiler.api.replacements", @@ -495,10 +683,109 @@ "com.oracle.truffle.compiler", "com.oracle.truffle.compiler.hotspot", "com.oracle.truffle.compiler.hotspot.libgraal" + ], + "org.hamcrest:hamcrest-core": [ + "org.hamcrest", + "org.hamcrest.core", + "org.hamcrest.internal" + ], + "org.junit.jupiter:junit-jupiter-api": [ + "org.junit.jupiter.api", + "org.junit.jupiter.api.condition", + "org.junit.jupiter.api.extension", + "org.junit.jupiter.api.extension.support", + "org.junit.jupiter.api.function", + "org.junit.jupiter.api.io", + "org.junit.jupiter.api.parallel" + ], + "org.junit.jupiter:junit-jupiter-engine": [ + "org.junit.jupiter.engine", + "org.junit.jupiter.engine.config", + "org.junit.jupiter.engine.descriptor", + "org.junit.jupiter.engine.discovery", + "org.junit.jupiter.engine.discovery.predicates", + "org.junit.jupiter.engine.execution", + "org.junit.jupiter.engine.extension", + "org.junit.jupiter.engine.support" + ], + "org.junit.jupiter:junit-jupiter-params": [ + "org.junit.jupiter.params", + "org.junit.jupiter.params.aggregator", + "org.junit.jupiter.params.converter", + "org.junit.jupiter.params.provider", + "org.junit.jupiter.params.shadow.com.univocity.parsers.annotations", + "org.junit.jupiter.params.shadow.com.univocity.parsers.annotations.helpers", + "org.junit.jupiter.params.shadow.com.univocity.parsers.common", + "org.junit.jupiter.params.shadow.com.univocity.parsers.common.beans", + "org.junit.jupiter.params.shadow.com.univocity.parsers.common.fields", + "org.junit.jupiter.params.shadow.com.univocity.parsers.common.input", + "org.junit.jupiter.params.shadow.com.univocity.parsers.common.input.concurrent", + "org.junit.jupiter.params.shadow.com.univocity.parsers.common.iterators", + "org.junit.jupiter.params.shadow.com.univocity.parsers.common.processor", + "org.junit.jupiter.params.shadow.com.univocity.parsers.common.processor.core", + "org.junit.jupiter.params.shadow.com.univocity.parsers.common.record", + "org.junit.jupiter.params.shadow.com.univocity.parsers.common.routine", + "org.junit.jupiter.params.shadow.com.univocity.parsers.conversions", + "org.junit.jupiter.params.shadow.com.univocity.parsers.csv", + "org.junit.jupiter.params.shadow.com.univocity.parsers.fixed", + "org.junit.jupiter.params.shadow.com.univocity.parsers.tsv", + "org.junit.jupiter.params.support" + ], + "org.junit.platform:junit-platform-commons": [ + "org.junit.platform.commons", + "org.junit.platform.commons.annotation", + "org.junit.platform.commons.function", + "org.junit.platform.commons.logging", + "org.junit.platform.commons.support", + "org.junit.platform.commons.util" + ], + "org.junit.platform:junit-platform-console": [ + "org.junit.platform.console", + "org.junit.platform.console.options", + "org.junit.platform.console.shadow.picocli", + "org.junit.platform.console.tasks" + ], + "org.junit.platform:junit-platform-engine": [ + "org.junit.platform.engine", + "org.junit.platform.engine.discovery", + "org.junit.platform.engine.reporting", + "org.junit.platform.engine.support.config", + "org.junit.platform.engine.support.descriptor", + "org.junit.platform.engine.support.discovery", + "org.junit.platform.engine.support.filter", + "org.junit.platform.engine.support.hierarchical", + "org.junit.platform.engine.support.store" + ], + "org.junit.platform:junit-platform-launcher": [ + "org.junit.platform.launcher", + "org.junit.platform.launcher.core", + "org.junit.platform.launcher.listeners", + "org.junit.platform.launcher.listeners.discovery", + "org.junit.platform.launcher.listeners.session", + "org.junit.platform.launcher.tagexpression" + ], + "org.junit.platform:junit-platform-reporting": [ + "org.junit.platform.reporting.legacy", + "org.junit.platform.reporting.legacy.xml", + "org.junit.platform.reporting.open.xml", + "org.junit.platform.reporting.shadow.org.opentest4j.reporting.events.api", + "org.junit.platform.reporting.shadow.org.opentest4j.reporting.events.core", + "org.junit.platform.reporting.shadow.org.opentest4j.reporting.events.java", + "org.junit.platform.reporting.shadow.org.opentest4j.reporting.events.root", + "org.junit.platform.reporting.shadow.org.opentest4j.reporting.schema" + ], + "org.opentest4j:opentest4j": [ + "org.opentest4j" ] }, "repositories": { "https://maven.pkg.st/": [ + "junit:junit", + "junit:junit:jar:sources", + "org.apiguardian:apiguardian-api", + "org.apiguardian:apiguardian-api:jar:sources", + "org.graalvm.buildtools:junit-platform-native", + "org.graalvm.buildtools:junit-platform-native:jar:sources", "org.graalvm.compiler:compiler", "org.graalvm.compiler:compiler:jar:sources", "org.graalvm.nativeimage:native-image-base", @@ -520,9 +807,37 @@ "org.graalvm.sdk:word", "org.graalvm.sdk:word:jar:sources", "org.graalvm.truffle:truffle-compiler", - "org.graalvm.truffle:truffle-compiler:jar:sources" + "org.graalvm.truffle:truffle-compiler:jar:sources", + "org.hamcrest:hamcrest-core", + "org.hamcrest:hamcrest-core:jar:sources", + "org.junit.jupiter:junit-jupiter", + "org.junit.jupiter:junit-jupiter-api", + "org.junit.jupiter:junit-jupiter-api:jar:sources", + "org.junit.jupiter:junit-jupiter-engine", + "org.junit.jupiter:junit-jupiter-engine:jar:sources", + "org.junit.jupiter:junit-jupiter-params", + "org.junit.jupiter:junit-jupiter-params:jar:sources", + "org.junit.jupiter:junit-jupiter:jar:sources", + "org.junit.platform:junit-platform-commons", + "org.junit.platform:junit-platform-commons:jar:sources", + "org.junit.platform:junit-platform-console", + "org.junit.platform:junit-platform-console:jar:sources", + "org.junit.platform:junit-platform-engine", + "org.junit.platform:junit-platform-engine:jar:sources", + "org.junit.platform:junit-platform-launcher", + "org.junit.platform:junit-platform-launcher:jar:sources", + "org.junit.platform:junit-platform-reporting", + "org.junit.platform:junit-platform-reporting:jar:sources", + "org.opentest4j:opentest4j", + "org.opentest4j:opentest4j:jar:sources" ], "https://maven.google.com/": [ + "junit:junit", + "junit:junit:jar:sources", + "org.apiguardian:apiguardian-api", + "org.apiguardian:apiguardian-api:jar:sources", + "org.graalvm.buildtools:junit-platform-native", + "org.graalvm.buildtools:junit-platform-native:jar:sources", "org.graalvm.compiler:compiler", "org.graalvm.compiler:compiler:jar:sources", "org.graalvm.nativeimage:native-image-base", @@ -544,9 +859,37 @@ "org.graalvm.sdk:word", "org.graalvm.sdk:word:jar:sources", "org.graalvm.truffle:truffle-compiler", - "org.graalvm.truffle:truffle-compiler:jar:sources" + "org.graalvm.truffle:truffle-compiler:jar:sources", + "org.hamcrest:hamcrest-core", + "org.hamcrest:hamcrest-core:jar:sources", + "org.junit.jupiter:junit-jupiter", + "org.junit.jupiter:junit-jupiter-api", + "org.junit.jupiter:junit-jupiter-api:jar:sources", + "org.junit.jupiter:junit-jupiter-engine", + "org.junit.jupiter:junit-jupiter-engine:jar:sources", + "org.junit.jupiter:junit-jupiter-params", + "org.junit.jupiter:junit-jupiter-params:jar:sources", + "org.junit.jupiter:junit-jupiter:jar:sources", + "org.junit.platform:junit-platform-commons", + "org.junit.platform:junit-platform-commons:jar:sources", + "org.junit.platform:junit-platform-console", + "org.junit.platform:junit-platform-console:jar:sources", + "org.junit.platform:junit-platform-engine", + "org.junit.platform:junit-platform-engine:jar:sources", + "org.junit.platform:junit-platform-launcher", + "org.junit.platform:junit-platform-launcher:jar:sources", + "org.junit.platform:junit-platform-reporting", + "org.junit.platform:junit-platform-reporting:jar:sources", + "org.opentest4j:opentest4j", + "org.opentest4j:opentest4j:jar:sources" ], "https://repo1.maven.org/maven2/": [ + "junit:junit", + "junit:junit:jar:sources", + "org.apiguardian:apiguardian-api", + "org.apiguardian:apiguardian-api:jar:sources", + "org.graalvm.buildtools:junit-platform-native", + "org.graalvm.buildtools:junit-platform-native:jar:sources", "org.graalvm.compiler:compiler", "org.graalvm.compiler:compiler:jar:sources", "org.graalvm.nativeimage:native-image-base", @@ -568,7 +911,29 @@ "org.graalvm.sdk:word", "org.graalvm.sdk:word:jar:sources", "org.graalvm.truffle:truffle-compiler", - "org.graalvm.truffle:truffle-compiler:jar:sources" + "org.graalvm.truffle:truffle-compiler:jar:sources", + "org.hamcrest:hamcrest-core", + "org.hamcrest:hamcrest-core:jar:sources", + "org.junit.jupiter:junit-jupiter", + "org.junit.jupiter:junit-jupiter-api", + "org.junit.jupiter:junit-jupiter-api:jar:sources", + "org.junit.jupiter:junit-jupiter-engine", + "org.junit.jupiter:junit-jupiter-engine:jar:sources", + "org.junit.jupiter:junit-jupiter-params", + "org.junit.jupiter:junit-jupiter-params:jar:sources", + "org.junit.jupiter:junit-jupiter:jar:sources", + "org.junit.platform:junit-platform-commons", + "org.junit.platform:junit-platform-commons:jar:sources", + "org.junit.platform:junit-platform-console", + "org.junit.platform:junit-platform-console:jar:sources", + "org.junit.platform:junit-platform-engine", + "org.junit.platform:junit-platform-engine:jar:sources", + "org.junit.platform:junit-platform-launcher", + "org.junit.platform:junit-platform-launcher:jar:sources", + "org.junit.platform:junit-platform-reporting", + "org.junit.platform:junit-platform-reporting:jar:sources", + "org.opentest4j:opentest4j", + "org.opentest4j:opentest4j:jar:sources" ] }, "version": "2" diff --git a/third_party/BUILD.bazel b/third_party/BUILD.bazel new file mode 100644 index 00000000..e69de29b diff --git a/third_party/jacoco/BUILD.bazel b/third_party/jacoco/BUILD.bazel new file mode 100644 index 00000000..32e644ab --- /dev/null +++ b/third_party/jacoco/BUILD.bazel @@ -0,0 +1,13 @@ +load("@rules_java//java:defs.bzl", "java_import") + +java_import( + name = "jacoco", + jars = [ + "org.jacoco.core-0.8.9.jar", + "org.jacoco.agent-0.8.9.jar", + "org.jacoco.agent-0.8.9-runtime.jar", + ], + visibility = [ + "@//:__subpackages__", + ], +) diff --git a/third_party/jacoco/org.jacoco.core-0.8.9.jar b/third_party/jacoco/org.jacoco.core-0.8.9.jar new file mode 100644 index 00000000..f223bd08 Binary files /dev/null and b/third_party/jacoco/org.jacoco.core-0.8.9.jar differ diff --git a/tools/bazel/cache.bazelrc b/tools/bazel/cache.bazelrc index 033730f2..3a7cb095 100644 --- a/tools/bazel/cache.bazelrc +++ b/tools/bazel/cache.bazelrc @@ -1,7 +1,8 @@ build:disk-cache --disk_cache=~/.cache/bazel -build:buildless --remote_cache=https://global.less.build +build:buildless --remote_cache=https://bazel.less.build +build:buildless --remote_upload_local_results=true build --modify_execution_info=PackageTar=+no-remote build --remote_local_fallback @@ -12,4 +13,3 @@ build --incompatible_default_to_explicit_init_py build --experimental_remote_merkle_tree_cache build --experimental_remote_cache_compression build --experimental_guard_against_concurrent_changes - diff --git a/tools/bazel/labs.bazelrc b/tools/bazel/labs.bazelrc index 98498faa..051b936c 100644 --- a/tools/bazel/labs.bazelrc +++ b/tools/bazel/labs.bazelrc @@ -8,7 +8,5 @@ build:labs --incompatible_strict_action_env build:labs --dynamic_local_strategy=worker,sandboxed,standalone build:labs --spawn_strategy=worker,sandboxed,local -build:labs-sandbox --experimental_use_sandboxfs=auto - -build:labs-broken --experimental_strict_java_deps=error +build:labs --experimental_strict_java_deps=error build:labs-broken --experimental_worker_strict_flagfiles diff --git a/tools/defs/BUILD.bazel b/tools/defs/BUILD.bazel new file mode 100644 index 00000000..e69de29b diff --git a/tools/defs/junit5.bzl b/tools/defs/junit5.bzl new file mode 100644 index 00000000..f40cbd9b --- /dev/null +++ b/tools/defs/junit5.bzl @@ -0,0 +1,50 @@ +"JUnit5 test support." + +load("@rules_java//java:defs.bzl", "java_test") + +def java_junit5_test(name, srcs, test_package, deps = [], runtime_deps = [], **kwargs): + """Define a JUnit 5 test. + + Args: + name: Name of the test target. + srcs: Sources for the test. + test_package: The package to test. + deps: List of dependencies. + runtime_deps: List of runtime dependencies. + **kwargs: Additional arguments to pass to java_test. + """ + + FILTER_KWARGS = [ + "main_class", + "use_testrunner", + "args", + ] + + for arg in FILTER_KWARGS: + if arg in kwargs.keys(): + kwargs.pop(arg) + + junit_console_args = [] + if test_package: + junit_console_args.extend([ + "--select-package", test_package + ]) + else: + junit_console_args.append("--scan-class-path") + + java_test( + name = name, + srcs = srcs, + use_testrunner = False, + main_class = "org.junit.platform.console.ConsoleLauncher", + args = junit_console_args, + deps = deps + [ + "@maven_gvm//:org_junit_jupiter_junit_jupiter_api", + "@maven_gvm//:org_junit_jupiter_junit_jupiter_params", + "@maven_gvm//:org_junit_jupiter_junit_jupiter_engine", + ], + runtime_deps = runtime_deps + [ + "@maven_gvm//:org_junit_platform_junit_platform_console", + ], + **kwargs + )