diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 10ec711..998a912 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -32,4 +32,4 @@ jobs: env: # Bazelisk will download bazel to here XDG_CACHE_HOME: ~/.cache/bazel-repo - run: bazel test //... --jobs 1 # limit number of jobs to prevent broken pipe error + run: bazel test //... diff --git a/BUILD b/BUILD deleted file mode 100644 index 721aa3d..0000000 --- a/BUILD +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2017 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -load("@bazel_gazelle//:def.bzl", "gazelle") - -# Gazelle configuration options. -# See https://github.com/bazelbuild/bazel-gazelle#running-gazelle-with-bazel -# gazelle:prefix github.com/benchsci/rules_python_gazelle -# gazelle:exclude bazel-out -gazelle(name = "gazelle") - -gazelle( - name = "update_go_deps", - args = [ - "-from_file=go.mod", - "-to_macro=gazelle/deps.bzl%gazelle_deps", - "-prune", - ], - command = "update-repos", -) diff --git a/BUILD.bazel b/BUILD.bazel new file mode 100644 index 0000000..f74338d --- /dev/null +++ b/BUILD.bazel @@ -0,0 +1,38 @@ +load("@bazel_gazelle//:def.bzl", "gazelle") + +# Gazelle configuration options. +# See https://github.com/bazelbuild/bazel-gazelle#running-gazelle-with-bazel +# gazelle:prefix github.com/bazelbuild/rules_python/gazelle +# gazelle:exclude bazel-out +gazelle( + name = "gazelle", +) + +gazelle( + name = "gazelle_update_repos", + args = [ + "-from_file=go.mod", + "-to_macro=deps.bzl%go_deps", + "-prune", + ], + command = "update-repos", +) + +filegroup( + name = "distribution", + srcs = [ + ":BUILD.bazel", + ":MODULE.bazel", + ":README.md", + ":WORKSPACE", + ":def.bzl", + ":deps.bzl", + ":go.mod", + ":go.sum", + "//manifest:distribution", + "//modules_mapping:distribution", + "//python:distribution", + "//pythonconfig:distribution", + ], + visibility = ["@rules_python//:__pkg__"], +) diff --git a/MODULE.bazel b/MODULE.bazel index 1ca7548..45efaff 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -4,7 +4,8 @@ module( compatibility_level = 1, ) -bazel_dep(name = "rules_python", version = "0.27.1") +bazel_dep(name = "bazel_skylib", version = "1.6.1") +bazel_dep(name = "rules_python", version = "0.32.2") bazel_dep(name = "rules_go", version = "0.41.0", repo_name = "io_bazel_rules_go") bazel_dep(name = "gazelle", version = "0.33.0", repo_name = "bazel_gazelle") @@ -13,15 +14,21 @@ go_deps.from_file(go_mod = "//:go.mod") use_repo( go_deps, "com_github_bazelbuild_buildtools", + "com_github_bmatcuk_doublestar_v4", "com_github_emirpasic_gods", "com_github_ghodss_yaml", - "com_github_google_uuid", + "com_github_smacker_go_tree_sitter", + "com_github_stretchr_testify", "in_gopkg_yaml_v2", + "org_golang_x_sync", ) -# (Optional) Register a specific python toolchain instead of using the host version -python = use_extension("@rules_python//python/extensions:python.bzl", "python") -python.toolchain( - python_version = "3.9", +python_stdlib_list = use_extension("//python:extensions.bzl", "python_stdlib_list") +use_repo( + python_stdlib_list, + "python_stdlib_list_3_10", + "python_stdlib_list_3_11", + "python_stdlib_list_3_12", + "python_stdlib_list_3_8", + "python_stdlib_list_3_9", ) -use_repo(python, "python_3_9") diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 5476575..9c6b15c 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -1,6 +1,6 @@ { - "lockFileVersion": 3, - "moduleFileHash": "a3a9a2e2ebf4d6f4bf4a956892ef8d4df8fc690c73004fe7ae4564cd87d35a2f", + "lockFileVersion": 6, + "moduleFileHash": "36a9dc9d53f872e231c3dfc3dcf7e90949b064cdaf5f83bb3e48bfa190bab448", "flags": { "cmdRegistries": [ "https://bcr.bazel.build/" @@ -13,7 +13,7 @@ "compatibilityMode": "ERROR" }, "localOverrideHashes": { - "bazel_tools": "922ea6752dc9105de5af957f7a99a6933c0a6a712d23df6aad16a9c399f7e787" + "bazel_tools": "1ae69322ac3823527337acf02016e8ee95813d8d356f47060255b8956fa642f0" }, "moduleDepGraph": { "": { @@ -30,15 +30,18 @@ "usingModule": "", "location": { "file": "@@//:MODULE.bazel", - "line": 11, + "line": 12, "column": 24 }, "imports": { "com_github_bazelbuild_buildtools": "com_github_bazelbuild_buildtools", + "com_github_bmatcuk_doublestar_v4": "com_github_bmatcuk_doublestar_v4", "com_github_emirpasic_gods": "com_github_emirpasic_gods", "com_github_ghodss_yaml": "com_github_ghodss_yaml", - "com_github_google_uuid": "com_github_google_uuid", - "in_gopkg_yaml_v2": "in_gopkg_yaml_v2" + "com_github_smacker_go_tree_sitter": "com_github_smacker_go_tree_sitter", + "com_github_stretchr_testify": "com_github_stretchr_testify", + "in_gopkg_yaml_v2": "in_gopkg_yaml_v2", + "org_golang_x_sync": "org_golang_x_sync" }, "devImports": [], "tags": [ @@ -50,7 +53,7 @@ "devDependency": false, "location": { "file": "@@//:MODULE.bazel", - "line": 12, + "line": 13, "column": 18 } } @@ -59,48 +62,70 @@ "hasNonDevUseExtension": true }, { - "extensionBzlFile": "@rules_python//python/extensions:python.bzl", - "extensionName": "python", + "extensionBzlFile": "@com_github_benchsci_rules_python_gazelle//python:extensions.bzl", + "extensionName": "python_stdlib_list", "usingModule": "", "location": { "file": "@@//:MODULE.bazel", - "line": 23, - "column": 23 + "line": 26, + "column": 35 }, "imports": { - "python_3_9": "python_3_9" + "python_stdlib_list_3_10": "python_stdlib_list_3_10", + "python_stdlib_list_3_11": "python_stdlib_list_3_11", + "python_stdlib_list_3_12": "python_stdlib_list_3_12", + "python_stdlib_list_3_8": "python_stdlib_list_3_8", + "python_stdlib_list_3_9": "python_stdlib_list_3_9" }, "devImports": [], - "tags": [ - { - "tagName": "toolchain", - "attributeValues": { - "python_version": "3.9" - }, - "devDependency": false, - "location": { - "file": "@@//:MODULE.bazel", - "line": 24, - "column": 17 - } - } - ], + "tags": [], "hasDevUseExtension": false, "hasNonDevUseExtension": true } ], "deps": { - "rules_python": "rules_python@0.27.1", + "bazel_skylib": "bazel_skylib@1.6.1", + "rules_python": "rules_python@0.32.2", "io_bazel_rules_go": "rules_go@0.41.0", "bazel_gazelle": "gazelle@0.33.0", "bazel_tools": "bazel_tools@_", "local_config_platform": "local_config_platform@_" } }, - "rules_python@0.27.1": { + "bazel_skylib@1.6.1": { + "name": "bazel_skylib", + "version": "1.6.1", + "key": "bazel_skylib@1.6.1", + "repoName": "bazel_skylib", + "executionPlatformsToRegister": [], + "toolchainsToRegister": [ + "//toolchains/unittest:cmd_toolchain", + "//toolchains/unittest:bash_toolchain" + ], + "extensionUsages": [], + "deps": { + "platforms": "platforms@0.0.7", + "bazel_tools": "bazel_tools@_", + "local_config_platform": "local_config_platform@_" + }, + "repoSpec": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/bazelbuild/bazel-skylib/releases/download/1.6.1/bazel-skylib-1.6.1.tar.gz" + ], + "integrity": "sha256-nziIakBUjG6WwQa3UvJCEw7hGqoGila6flb0UR8z5PI=", + "strip_prefix": "", + "remote_patches": {}, + "remote_patch_strip": 0 + } + } + }, + "rules_python@0.32.2": { "name": "rules_python", - "version": "0.27.1", - "key": "rules_python@0.27.1", + "version": "0.32.2", + "key": "rules_python@0.32.2", "repoName": "rules_python", "executionPlatformsToRegister": [], "toolchainsToRegister": [ @@ -110,10 +135,10 @@ { "extensionBzlFile": "@rules_python//python/private/bzlmod:internal_deps.bzl", "extensionName": "internal_deps", - "usingModule": "rules_python@0.27.1", + "usingModule": "rules_python@0.32.2", "location": { - "file": "https://bcr.bazel.build/modules/rules_python/0.27.1/MODULE.bazel", - "line": 17, + "file": "https://bcr.bazel.build/modules/rules_python/0.32.2/MODULE.bazel", + "line": 16, "column": 30 }, "imports": { @@ -141,8 +166,8 @@ "attributeValues": {}, "devDependency": false, "location": { - "file": "https://bcr.bazel.build/modules/rules_python/0.27.1/MODULE.bazel", - "line": 18, + "file": "https://bcr.bazel.build/modules/rules_python/0.32.2/MODULE.bazel", + "line": 17, "column": 22 } } @@ -153,13 +178,15 @@ { "extensionBzlFile": "@rules_python//python/extensions:python.bzl", "extensionName": "python", - "usingModule": "rules_python@0.27.1", + "usingModule": "rules_python@0.32.2", "location": { - "file": "https://bcr.bazel.build/modules/rules_python/0.27.1/MODULE.bazel", - "line": 43, + "file": "https://bcr.bazel.build/modules/rules_python/0.32.2/MODULE.bazel", + "line": 42, "column": 23 }, "imports": { + "python_3_11": "python_3_11", + "python_versions": "python_versions", "pythons_hub": "pythons_hub" }, "devImports": [], @@ -172,37 +199,72 @@ }, "devDependency": false, "location": { - "file": "https://bcr.bazel.build/modules/rules_python/0.27.1/MODULE.bazel", - "line": 49, + "file": "https://bcr.bazel.build/modules/rules_python/0.32.2/MODULE.bazel", + "line": 48, "column": 17 } } ], "hasDevUseExtension": false, "hasNonDevUseExtension": true + }, + { + "extensionBzlFile": "@rules_python//python/extensions:pip.bzl", + "extensionName": "pip", + "usingModule": "rules_python@0.32.2", + "location": { + "file": "https://bcr.bazel.build/modules/rules_python/0.32.2/MODULE.bazel", + "line": 60, + "column": 20 + }, + "imports": { + "rules_python_publish_deps": "rules_python_publish_deps" + }, + "devImports": [], + "tags": [ + { + "tagName": "parse", + "attributeValues": { + "experimental_index_url": "https://pypi.org/simple", + "hub_name": "rules_python_publish_deps", + "python_version": "3.11", + "requirements_darwin": "//tools/publish:requirements_darwin.txt", + "requirements_lock": "//tools/publish:requirements.txt", + "requirements_windows": "//tools/publish:requirements_windows.txt" + }, + "devDependency": false, + "location": { + "file": "https://bcr.bazel.build/modules/rules_python/0.32.2/MODULE.bazel", + "line": 61, + "column": 10 + } + } + ], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true } ], "deps": { - "bazel_features": "bazel_features@1.1.1", - "bazel_skylib": "bazel_skylib@1.3.0", + "bazel_features": "bazel_features@1.9.1", + "bazel_skylib": "bazel_skylib@1.6.1", + "rules_cc": "rules_cc@0.0.9", "platforms": "platforms@0.0.7", - "rules_proto": "rules_proto@5.3.0-21.7", + "rules_proto": "rules_proto@6.0.0-rc1", "com_google_protobuf": "protobuf@21.7", "bazel_tools": "bazel_tools@_", "local_config_platform": "local_config_platform@_" }, "repoSpec": { - "bzlFile": "@bazel_tools//tools/build_defs/repo:http.bzl", + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_python~0.27.1", "urls": [ - "https://github.com/bazelbuild/rules_python/releases/download/0.27.1/rules_python-0.27.1.tar.gz" + "https://github.com/bazelbuild/rules_python/releases/download/0.32.2/rules_python-0.32.2.tar.gz" ], - "integrity": "sha256-6FrjDeM2JaY+yn/ECpT+qEXmQYiOUvMra+6pHosbJ5M=", - "strip_prefix": "rules_python-0.27.1", + "integrity": "sha256-SRLO1w3BoqjkuGzsIzsZLKBT6CvHLYd7mOEmFW6PIo0=", + "strip_prefix": "rules_python-0.32.2", "remote_patches": { - "https://bcr.bazel.build/modules/rules_python/0.27.1/patches/module_dot_bazel_version.patch": "sha256-Ier7Gb4zhbS273tClCov24gNYdheo4FdegZwaHBrQy0=" + "https://bcr.bazel.build/modules/rules_python/0.32.2/patches/module_dot_bazel_version.patch": "sha256-lfZaBBRr2RFX7bO0wsVwW9urJGDBxoJHEwQ2tMN862k=" }, "remote_patch_strip": 1 } @@ -318,19 +380,18 @@ } ], "deps": { - "bazel_skylib": "bazel_skylib@1.3.0", + "bazel_skylib": "bazel_skylib@1.6.1", "platforms": "platforms@0.0.7", - "rules_proto": "rules_proto@5.3.0-21.7", + "rules_proto": "rules_proto@6.0.0-rc1", "com_google_protobuf": "protobuf@21.7", "gazelle": "gazelle@0.33.0", "bazel_tools": "bazel_tools@_", "local_config_platform": "local_config_platform@_" }, "repoSpec": { - "bzlFile": "@bazel_tools//tools/build_defs/repo:http.bzl", + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_go~0.41.0", "urls": [ "https://github.com/bazelbuild/rules_go/releases/download/v0.41.0/rules_go-v0.41.0.zip" ], @@ -442,18 +503,17 @@ } ], "deps": { - "bazel_skylib": "bazel_skylib@1.3.0", + "bazel_skylib": "bazel_skylib@1.6.1", "com_google_protobuf": "protobuf@21.7", "io_bazel_rules_go": "rules_go@0.41.0", - "rules_proto": "rules_proto@5.3.0-21.7", + "rules_proto": "rules_proto@6.0.0-rc1", "bazel_tools": "bazel_tools@_", "local_config_platform": "local_config_platform@_" }, "repoSpec": { - "bzlFile": "@bazel_tools//tools/build_defs/repo:http.bzl", + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "gazelle~0.33.0", "urls": [ "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.33.0/bazel-gazelle-v0.33.0.tar.gz" ], @@ -481,7 +541,7 @@ "usingModule": "bazel_tools@_", "location": { "file": "@@bazel_tools//:MODULE.bazel", - "line": 17, + "line": 18, "column": 29 }, "imports": { @@ -499,7 +559,7 @@ "usingModule": "bazel_tools@_", "location": { "file": "@@bazel_tools//:MODULE.bazel", - "line": 21, + "line": 22, "column": 32 }, "imports": { @@ -516,7 +576,7 @@ "usingModule": "bazel_tools@_", "location": { "file": "@@bazel_tools//:MODULE.bazel", - "line": 24, + "line": 25, "column": 32 }, "imports": { @@ -538,7 +598,7 @@ "usingModule": "bazel_tools@_", "location": { "file": "@@bazel_tools//:MODULE.bazel", - "line": 35, + "line": 36, "column": 39 }, "imports": { @@ -555,7 +615,7 @@ "usingModule": "bazel_tools@_", "location": { "file": "@@bazel_tools//:MODULE.bazel", - "line": 39, + "line": 40, "column": 48 }, "imports": { @@ -572,7 +632,7 @@ "usingModule": "bazel_tools@_", "location": { "file": "@@bazel_tools//:MODULE.bazel", - "line": 42, + "line": 43, "column": 42 }, "imports": { @@ -583,14 +643,32 @@ "tags": [], "hasDevUseExtension": false, "hasNonDevUseExtension": true + }, + { + "extensionBzlFile": "@buildozer//:buildozer_binary.bzl", + "extensionName": "buildozer_binary", + "usingModule": "bazel_tools@_", + "location": { + "file": "@@bazel_tools//:MODULE.bazel", + "line": 47, + "column": 33 + }, + "imports": { + "buildozer_binary": "buildozer_binary" + }, + "devImports": [], + "tags": [], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true } ], "deps": { "rules_cc": "rules_cc@0.0.9", - "rules_java": "rules_java@7.1.0", + "rules_java": "rules_java@7.4.0", "rules_license": "rules_license@0.0.7", - "rules_proto": "rules_proto@5.3.0-21.7", - "rules_python": "rules_python@0.27.1", + "rules_proto": "rules_proto@6.0.0-rc1", + "rules_python": "rules_python@0.32.2", + "buildozer": "buildozer@6.4.0.2", "platforms": "platforms@0.0.7", "com_google_protobuf": "protobuf@21.7", "zlib": "zlib@1.3", @@ -611,10 +689,37 @@ "bazel_tools": "bazel_tools@_" } }, - "bazel_features@1.1.1": { + "platforms@0.0.7": { + "name": "platforms", + "version": "0.0.7", + "key": "platforms@0.0.7", + "repoName": "platforms", + "executionPlatformsToRegister": [], + "toolchainsToRegister": [], + "extensionUsages": [], + "deps": { + "rules_license": "rules_license@0.0.7", + "bazel_tools": "bazel_tools@_", + "local_config_platform": "local_config_platform@_" + }, + "repoSpec": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/bazelbuild/platforms/releases/download/0.0.7/platforms-0.0.7.tar.gz" + ], + "integrity": "sha256-OlYcmee9vpFzqmU/1Xn+hJ8djWc5V4CrR3Cx84FDHVE=", + "strip_prefix": "", + "remote_patches": {}, + "remote_patch_strip": 0 + } + } + }, + "bazel_features@1.9.1": { "name": "bazel_features", - "version": "1.1.1", - "key": "bazel_features@1.1.1", + "version": "1.9.1", + "key": "bazel_features@1.9.1", "repoName": "bazel_features", "executionPlatformsToRegister": [], "toolchainsToRegister": [], @@ -622,10 +727,10 @@ { "extensionBzlFile": "@bazel_features//private:extensions.bzl", "extensionName": "version_extension", - "usingModule": "bazel_features@1.1.1", + "usingModule": "bazel_features@1.9.1", "location": { - "file": "https://bcr.bazel.build/modules/bazel_features/1.1.1/MODULE.bazel", - "line": 6, + "file": "https://bcr.bazel.build/modules/bazel_features/1.9.1/MODULE.bazel", + "line": 15, "column": 24 }, "imports": { @@ -639,112 +744,102 @@ } ], "deps": { + "bazel_skylib": "bazel_skylib@1.6.1", "bazel_tools": "bazel_tools@_", "local_config_platform": "local_config_platform@_" }, "repoSpec": { - "bzlFile": "@bazel_tools//tools/build_defs/repo:http.bzl", + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "bazel_features~1.1.1", "urls": [ - "https://github.com/bazel-contrib/bazel_features/releases/download/v1.1.1/bazel_features-v1.1.1.tar.gz" + "https://github.com/bazel-contrib/bazel_features/releases/download/v1.9.1/bazel_features-v1.9.1.tar.gz" ], - "integrity": "sha256-YsJuQn5cvHUQJERpJ2IuOYqdzfMsZDJSOIFXCdEcEag=", - "strip_prefix": "bazel_features-1.1.1", + "integrity": "sha256-13h9oomn+0lzUiEa0gDsn2mIIqngdXpJdv2fcT/zcrM=", + "strip_prefix": "bazel_features-1.9.1", "remote_patches": { - "https://bcr.bazel.build/modules/bazel_features/1.1.1/patches/module_dot_bazel_version.patch": "sha256-+56MAEsc7bYN/Pzhn252ZQUxiRzZg9bynXj1qpsmCYs=" + "https://bcr.bazel.build/modules/bazel_features/1.9.1/patches/module_dot_bazel_version.patch": "sha256-a2ofwS5r2Qq+WxzVa7sLbRXhfT3JoYxSlUVQH/nL454=" }, "remote_patch_strip": 1 } } }, - "bazel_skylib@1.3.0": { - "name": "bazel_skylib", - "version": "1.3.0", - "key": "bazel_skylib@1.3.0", - "repoName": "bazel_skylib", + "rules_cc@0.0.9": { + "name": "rules_cc", + "version": "0.0.9", + "key": "rules_cc@0.0.9", + "repoName": "rules_cc", "executionPlatformsToRegister": [], "toolchainsToRegister": [ - "//toolchains/unittest:cmd_toolchain", - "//toolchains/unittest:bash_toolchain" + "@local_config_cc_toolchains//:all" ], - "extensionUsages": [], - "deps": { - "platforms": "platforms@0.0.7", - "bazel_tools": "bazel_tools@_", - "local_config_platform": "local_config_platform@_" - }, - "repoSpec": { - "bzlFile": "@bazel_tools//tools/build_defs/repo:http.bzl", - "ruleClassName": "http_archive", - "attributes": { - "name": "bazel_skylib~1.3.0", - "urls": [ - "https://github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz" - ], - "integrity": "sha256-dNVE2W9KW7Yw1GXKi7z+Ix41lOWq5X4e2/F6brPKJQY=", - "strip_prefix": "", - "remote_patches": {}, - "remote_patch_strip": 0 + "extensionUsages": [ + { + "extensionBzlFile": "@bazel_tools//tools/cpp:cc_configure.bzl", + "extensionName": "cc_configure_extension", + "usingModule": "rules_cc@0.0.9", + "location": { + "file": "https://bcr.bazel.build/modules/rules_cc/0.0.9/MODULE.bazel", + "line": 9, + "column": 29 + }, + "imports": { + "local_config_cc_toolchains": "local_config_cc_toolchains" + }, + "devImports": [], + "tags": [], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true } - } - }, - "platforms@0.0.7": { - "name": "platforms", - "version": "0.0.7", - "key": "platforms@0.0.7", - "repoName": "platforms", - "executionPlatformsToRegister": [], - "toolchainsToRegister": [], - "extensionUsages": [], + ], "deps": { - "rules_license": "rules_license@0.0.7", + "platforms": "platforms@0.0.7", "bazel_tools": "bazel_tools@_", "local_config_platform": "local_config_platform@_" }, "repoSpec": { - "bzlFile": "@bazel_tools//tools/build_defs/repo:http.bzl", + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "platforms", "urls": [ - "https://github.com/bazelbuild/platforms/releases/download/0.0.7/platforms-0.0.7.tar.gz" + "https://github.com/bazelbuild/rules_cc/releases/download/0.0.9/rules_cc-0.0.9.tar.gz" ], - "integrity": "sha256-OlYcmee9vpFzqmU/1Xn+hJ8djWc5V4CrR3Cx84FDHVE=", - "strip_prefix": "", - "remote_patches": {}, + "integrity": "sha256-IDeHW5pEVtzkp50RKorohbvEqtlo5lh9ym5k86CQDN8=", + "strip_prefix": "rules_cc-0.0.9", + "remote_patches": { + "https://bcr.bazel.build/modules/rules_cc/0.0.9/patches/module_dot_bazel_version.patch": "sha256-mM+qzOI0SgAdaJBlWOSMwMPKpaA9b7R37Hj/tp5bb4g=" + }, "remote_patch_strip": 0 } } }, - "rules_proto@5.3.0-21.7": { + "rules_proto@6.0.0-rc1": { "name": "rules_proto", - "version": "5.3.0-21.7", - "key": "rules_proto@5.3.0-21.7", + "version": "6.0.0-rc1", + "key": "rules_proto@6.0.0-rc1", "repoName": "rules_proto", "executionPlatformsToRegister": [], "toolchainsToRegister": [], "extensionUsages": [], "deps": { - "bazel_skylib": "bazel_skylib@1.3.0", - "com_google_protobuf": "protobuf@21.7", - "rules_cc": "rules_cc@0.0.9", + "rules_license": "rules_license@0.0.7", + "bazel_skylib": "bazel_skylib@1.6.1", "bazel_tools": "bazel_tools@_", "local_config_platform": "local_config_platform@_" }, "repoSpec": { - "bzlFile": "@bazel_tools//tools/build_defs/repo:http.bzl", + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_proto~5.3.0-21.7", "urls": [ - "https://github.com/bazelbuild/rules_proto/archive/refs/tags/5.3.0-21.7.tar.gz" + "https://github.com/bazelbuild/rules_proto/releases/download/6.0.0-rc1/rules_proto-6.0.0-rc1.tar.gz" ], - "integrity": "sha256-3D+yBqLLNEG0heseQjFlsjEjWh6psDG0Qzz3vB+kYN0=", - "strip_prefix": "rules_proto-5.3.0-21.7", - "remote_patches": {}, - "remote_patch_strip": 0 + "integrity": "sha256-kEqAl/rkKmkMjgjYBSEOQMzLBp9fmg9nJ89PqnvtLJw=", + "strip_prefix": "rules_proto-6.0.0-rc1", + "remote_patches": { + "https://bcr.bazel.build/modules/rules_proto/6.0.0-rc1/patches/module_dot_bazel_version.patch": "sha256-OepRECTunWiz3WREvMK/pOvpt/HRZ6g87fKfokcnQGE=" + }, + "remote_patch_strip": 1 } } }, @@ -799,11 +894,11 @@ } ], "deps": { - "bazel_skylib": "bazel_skylib@1.3.0", - "rules_python": "rules_python@0.27.1", + "bazel_skylib": "bazel_skylib@1.6.1", + "rules_python": "rules_python@0.32.2", "rules_cc": "rules_cc@0.0.9", - "rules_proto": "rules_proto@5.3.0-21.7", - "rules_java": "rules_java@7.1.0", + "rules_proto": "rules_proto@6.0.0-rc1", + "rules_java": "rules_java@7.4.0", "rules_pkg": "rules_pkg@0.7.0", "com_google_abseil": "abseil-cpp@20211102.0", "zlib": "zlib@1.3", @@ -814,10 +909,9 @@ "local_config_platform": "local_config_platform@_" }, "repoSpec": { - "bzlFile": "@bazel_tools//tools/build_defs/repo:http.bzl", + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "protobuf~21.7", "urls": [ "https://github.com/protocolbuffers/protobuf/releases/download/v21.7/protobuf-all-21.7.zip" ], @@ -833,60 +927,10 @@ } } }, - "rules_cc@0.0.9": { - "name": "rules_cc", - "version": "0.0.9", - "key": "rules_cc@0.0.9", - "repoName": "rules_cc", - "executionPlatformsToRegister": [], - "toolchainsToRegister": [ - "@local_config_cc_toolchains//:all" - ], - "extensionUsages": [ - { - "extensionBzlFile": "@bazel_tools//tools/cpp:cc_configure.bzl", - "extensionName": "cc_configure_extension", - "usingModule": "rules_cc@0.0.9", - "location": { - "file": "https://bcr.bazel.build/modules/rules_cc/0.0.9/MODULE.bazel", - "line": 9, - "column": 29 - }, - "imports": { - "local_config_cc_toolchains": "local_config_cc_toolchains" - }, - "devImports": [], - "tags": [], - "hasDevUseExtension": false, - "hasNonDevUseExtension": true - } - ], - "deps": { - "platforms": "platforms@0.0.7", - "bazel_tools": "bazel_tools@_", - "local_config_platform": "local_config_platform@_" - }, - "repoSpec": { - "bzlFile": "@bazel_tools//tools/build_defs/repo:http.bzl", - "ruleClassName": "http_archive", - "attributes": { - "name": "rules_cc~0.0.9", - "urls": [ - "https://github.com/bazelbuild/rules_cc/releases/download/0.0.9/rules_cc-0.0.9.tar.gz" - ], - "integrity": "sha256-IDeHW5pEVtzkp50RKorohbvEqtlo5lh9ym5k86CQDN8=", - "strip_prefix": "rules_cc-0.0.9", - "remote_patches": { - "https://bcr.bazel.build/modules/rules_cc/0.0.9/patches/module_dot_bazel_version.patch": "sha256-mM+qzOI0SgAdaJBlWOSMwMPKpaA9b7R37Hj/tp5bb4g=" - }, - "remote_patch_strip": 0 - } - } - }, - "rules_java@7.1.0": { + "rules_java@7.4.0": { "name": "rules_java", - "version": "7.1.0", - "key": "rules_java@7.1.0", + "version": "7.4.0", + "key": "rules_java@7.4.0", "repoName": "rules_java", "executionPlatformsToRegister": [], "toolchainsToRegister": [ @@ -919,9 +963,9 @@ { "extensionBzlFile": "@rules_java//java:extensions.bzl", "extensionName": "toolchains", - "usingModule": "rules_java@7.1.0", + "usingModule": "rules_java@7.4.0", "location": { - "file": "https://bcr.bazel.build/modules/rules_java/7.1.0/MODULE.bazel", + "file": "https://bcr.bazel.build/modules/rules_java/7.4.0/MODULE.bazel", "line": 19, "column": 27 }, @@ -963,21 +1007,20 @@ "deps": { "platforms": "platforms@0.0.7", "rules_cc": "rules_cc@0.0.9", - "bazel_skylib": "bazel_skylib@1.3.0", - "rules_proto": "rules_proto@5.3.0-21.7", + "bazel_skylib": "bazel_skylib@1.6.1", + "rules_proto": "rules_proto@6.0.0-rc1", "rules_license": "rules_license@0.0.7", "bazel_tools": "bazel_tools@_", "local_config_platform": "local_config_platform@_" }, "repoSpec": { - "bzlFile": "@bazel_tools//tools/build_defs/repo:http.bzl", + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_java~7.1.0", "urls": [ - "https://github.com/bazelbuild/rules_java/releases/download/7.1.0/rules_java-7.1.0.tar.gz" + "https://github.com/bazelbuild/rules_java/releases/download/7.4.0/rules_java-7.4.0.tar.gz" ], - "integrity": "sha256-o3pOX2OrgnFuXdau75iO2EYcegC46TYnImKJn1h81OE=", + "integrity": "sha256-l27wi0nJKXQfIBeQ5Z44B8cq2B9CjIvJU82+/1/tFes=", "strip_prefix": "", "remote_patches": {}, "remote_patch_strip": 0 @@ -997,17 +1040,82 @@ "local_config_platform": "local_config_platform@_" }, "repoSpec": { - "bzlFile": "@bazel_tools//tools/build_defs/repo:http.bzl", + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/bazelbuild/rules_license/releases/download/0.0.7/rules_license-0.0.7.tar.gz" + ], + "integrity": "sha256-RTHezLkTY5ww5cdRKgVNXYdWmNrrddjPkPKEN1/nw2A=", + "strip_prefix": "", + "remote_patches": {}, + "remote_patch_strip": 0 + } + } + }, + "buildozer@6.4.0.2": { + "name": "buildozer", + "version": "6.4.0.2", + "key": "buildozer@6.4.0.2", + "repoName": "buildozer", + "executionPlatformsToRegister": [], + "toolchainsToRegister": [], + "extensionUsages": [ + { + "extensionBzlFile": "@buildozer//:buildozer_binary.bzl", + "extensionName": "buildozer_binary", + "usingModule": "buildozer@6.4.0.2", + "location": { + "file": "https://bcr.bazel.build/modules/buildozer/6.4.0.2/MODULE.bazel", + "line": 7, + "column": 33 + }, + "imports": { + "buildozer_binary": "buildozer_binary" + }, + "devImports": [], + "tags": [ + { + "tagName": "buildozer", + "attributeValues": { + "sha256": { + "darwin-amd64": "d29e347ecd6b5673d72cb1a8de05bf1b06178dd229ff5eb67fad5100c840cc8e", + "darwin-arm64": "9b9e71bdbec5e7223871e913b65d12f6d8fa026684daf991f00e52ed36a6978d", + "linux-amd64": "8dfd6345da4e9042daa738d7fdf34f699c5dfce4632f7207956fceedd8494119", + "linux-arm64": "6559558fded658c8fa7432a9d011f7c4dcbac6b738feae73d2d5c352e5f605fa", + "windows-amd64": "e7f05bf847f7c3689dd28926460ce6e1097ae97380ac8e6ae7147b7b706ba19b" + }, + "version": "6.4.0" + }, + "devDependency": false, + "location": { + "file": "https://bcr.bazel.build/modules/buildozer/6.4.0.2/MODULE.bazel", + "line": 8, + "column": 27 + } + } + ], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true + } + ], + "deps": { + "bazel_tools": "bazel_tools@_", + "local_config_platform": "local_config_platform@_" + }, + "repoSpec": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_license~0.0.7", "urls": [ - "https://github.com/bazelbuild/rules_license/releases/download/0.0.7/rules_license-0.0.7.tar.gz" + "https://github.com/fmeum/buildozer/releases/download/v6.4.0.2/buildozer-v6.4.0.2.tar.gz" ], - "integrity": "sha256-RTHezLkTY5ww5cdRKgVNXYdWmNrrddjPkPKEN1/nw2A=", - "strip_prefix": "", - "remote_patches": {}, - "remote_patch_strip": 0 + "integrity": "sha256-k7tFKQMR2AygxpmZfH0yEPnQmF3efFgD9rBPkj+Yz/8=", + "strip_prefix": "buildozer-6.4.0.2", + "remote_patches": { + "https://bcr.bazel.build/modules/buildozer/6.4.0.2/patches/module_dot_bazel_version.patch": "sha256-gKANF2HMilj7bWmuXs4lbBIAAansuWC4IhWGB/CerjU=" + }, + "remote_patch_strip": 1 } } }, @@ -1026,10 +1134,9 @@ "local_config_platform": "local_config_platform@_" }, "repoSpec": { - "bzlFile": "@bazel_tools//tools/build_defs/repo:http.bzl", + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "zlib~1.3", "urls": [ "https://github.com/madler/zlib/releases/download/v1.3/zlib-1.3.tar.gz" ], @@ -1073,16 +1180,15 @@ } ], "deps": { - "bazel_skylib": "bazel_skylib@1.3.0", + "bazel_skylib": "bazel_skylib@1.6.1", "platforms": "platforms@0.0.7", "bazel_tools": "bazel_tools@_", "local_config_platform": "local_config_platform@_" }, "repoSpec": { - "bzlFile": "@bazel_tools//tools/build_defs/repo:http.bzl", + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "apple_support~1.5.0", "urls": [ "https://github.com/bazelbuild/apple_support/releases/download/1.5.0/apple_support.1.5.0.tar.gz" ], @@ -1102,17 +1208,16 @@ "toolchainsToRegister": [], "extensionUsages": [], "deps": { - "rules_python": "rules_python@0.27.1", - "bazel_skylib": "bazel_skylib@1.3.0", + "rules_python": "rules_python@0.32.2", + "bazel_skylib": "bazel_skylib@1.6.1", "rules_license": "rules_license@0.0.7", "bazel_tools": "bazel_tools@_", "local_config_platform": "local_config_platform@_" }, "repoSpec": { - "bzlFile": "@bazel_tools//tools/build_defs/repo:http.bzl", + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_pkg~0.7.0", "urls": [ "https://github.com/bazelbuild/rules_pkg/releases/download/0.7.0/rules_pkg-0.7.0.tar.gz" ], @@ -1140,10 +1245,9 @@ "local_config_platform": "local_config_platform@_" }, "repoSpec": { - "bzlFile": "@bazel_tools//tools/build_defs/repo:http.bzl", + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "abseil-cpp~20211102.0", "urls": [ "https://github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.tar.gz" ], @@ -1165,8 +1269,8 @@ "toolchainsToRegister": [], "extensionUsages": [], "deps": { - "bazel_skylib": "bazel_skylib@1.3.0", - "rules_proto": "rules_proto@5.3.0-21.7", + "bazel_skylib": "bazel_skylib@1.6.1", + "rules_proto": "rules_proto@6.0.0-rc1", "com_google_protobuf": "protobuf@21.7", "com_google_absl": "abseil-cpp@20211102.0", "platforms": "platforms@0.0.7", @@ -1174,10 +1278,9 @@ "local_config_platform": "local_config_platform@_" }, "repoSpec": { - "bzlFile": "@bazel_tools//tools/build_defs/repo:http.bzl", + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "upb~0.0.0-20220923-a547704", "urls": [ "https://github.com/protocolbuffers/upb/archive/a5477045acaa34586420942098f5fecd3570f577.tar.gz" ], @@ -1216,7 +1319,7 @@ "hasNonDevUseExtension": true }, { - "extensionBzlFile": ":extensions.bzl", + "extensionBzlFile": "@rules_jvm_external//:extensions.bzl", "extensionName": "maven", "usingModule": "rules_jvm_external@4.4.2", "location": { @@ -1255,16 +1358,15 @@ } ], "deps": { - "bazel_skylib": "bazel_skylib@1.3.0", + "bazel_skylib": "bazel_skylib@1.6.1", "io_bazel_stardoc": "stardoc@0.5.1", "bazel_tools": "bazel_tools@_", "local_config_platform": "local_config_platform@_" }, "repoSpec": { - "bzlFile": "@bazel_tools//tools/build_defs/repo:http.bzl", + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_jvm_external~4.4.2", "urls": [ "https://github.com/bazelbuild/rules_jvm_external/archive/refs/tags/4.4.2.zip" ], @@ -1291,10 +1393,9 @@ "local_config_platform": "local_config_platform@_" }, "repoSpec": { - "bzlFile": "@bazel_tools//tools/build_defs/repo:http.bzl", + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "googletest~1.11.0", "urls": [ "https://github.com/google/googletest/archive/refs/tags/release-1.11.0.tar.gz" ], @@ -1316,16 +1417,15 @@ "toolchainsToRegister": [], "extensionUsages": [], "deps": { - "bazel_skylib": "bazel_skylib@1.3.0", - "rules_java": "rules_java@7.1.0", + "bazel_skylib": "bazel_skylib@1.6.1", + "rules_java": "rules_java@7.4.0", "bazel_tools": "bazel_tools@_", "local_config_platform": "local_config_platform@_" }, "repoSpec": { - "bzlFile": "@bazel_tools//tools/build_defs/repo:http.bzl", + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "stardoc~0.5.1", "urls": [ "https://github.com/bazelbuild/stardoc/releases/download/0.5.1/stardoc-0.5.1.tar.gz" ], @@ -1340,104 +1440,113 @@ } }, "moduleExtensions": { - "@@apple_support~1.5.0//crosstool:setup.bzl%apple_cc_configure_extension": { + "@@apple_support~//crosstool:setup.bzl%apple_cc_configure_extension": { "general": { "bzlTransitiveDigest": "pMLFCYaRPkgXPQ8vtuNkMfiHfPmRBy6QJfnid4sWfv0=", - "accumulatedFileDigests": {}, + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, "envVariables": {}, "generatedRepoSpecs": { "local_config_apple_cc": { - "bzlFile": "@@apple_support~1.5.0//crosstool:setup.bzl", + "bzlFile": "@@apple_support~//crosstool:setup.bzl", "ruleClassName": "_apple_cc_autoconf", - "attributes": { - "name": "apple_support~1.5.0~apple_cc_configure_extension~local_config_apple_cc" - } + "attributes": {} }, "local_config_apple_cc_toolchains": { - "bzlFile": "@@apple_support~1.5.0//crosstool:setup.bzl", + "bzlFile": "@@apple_support~//crosstool:setup.bzl", "ruleClassName": "_apple_cc_autoconf_toolchains", - "attributes": { - "name": "apple_support~1.5.0~apple_cc_configure_extension~local_config_apple_cc_toolchains" - } + "attributes": {} } - } + }, + "recordedRepoMappingEntries": [ + [ + "apple_support~", + "bazel_tools", + "bazel_tools" + ] + ] } }, "@@bazel_tools//tools/cpp:cc_configure.bzl%cc_configure_extension": { "general": { - "bzlTransitiveDigest": "O9sf6ilKWU9Veed02jG9o2HM/xgV/UAyciuFBuxrFRY=", - "accumulatedFileDigests": {}, + "bzlTransitiveDigest": "PHpT2yqMGms2U4L3E/aZ+WcQalmZWm+ILdP3yiLsDhA=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, "envVariables": {}, "generatedRepoSpecs": { "local_config_cc": { "bzlFile": "@@bazel_tools//tools/cpp:cc_configure.bzl", "ruleClassName": "cc_autoconf", - "attributes": { - "name": "bazel_tools~cc_configure_extension~local_config_cc" - } + "attributes": {} }, "local_config_cc_toolchains": { "bzlFile": "@@bazel_tools//tools/cpp:cc_configure.bzl", "ruleClassName": "cc_autoconf_toolchains", - "attributes": { - "name": "bazel_tools~cc_configure_extension~local_config_cc_toolchains" - } + "attributes": {} } - } + }, + "recordedRepoMappingEntries": [ + [ + "bazel_tools", + "bazel_tools", + "bazel_tools" + ] + ] } }, "@@bazel_tools//tools/osx:xcode_configure.bzl%xcode_configure_extension": { "general": { "bzlTransitiveDigest": "Qh2bWTU6QW6wkrd87qrU4YeY+SG37Nvw3A0PR4Y0L2Y=", - "accumulatedFileDigests": {}, + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, "envVariables": {}, "generatedRepoSpecs": { "local_config_xcode": { "bzlFile": "@@bazel_tools//tools/osx:xcode_configure.bzl", "ruleClassName": "xcode_autoconf", "attributes": { - "name": "bazel_tools~xcode_configure_extension~local_config_xcode", "xcode_locator": "@bazel_tools//tools/osx:xcode_locator.m", "remote_xcode": "" } } - } + }, + "recordedRepoMappingEntries": [] } }, "@@bazel_tools//tools/sh:sh_configure.bzl%sh_configure_extension": { "general": { "bzlTransitiveDigest": "hp4NgmNjEg5+xgvzfh6L83bt9/aiiWETuNpwNuF1MSU=", - "accumulatedFileDigests": {}, + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, "envVariables": {}, "generatedRepoSpecs": { "local_config_sh": { "bzlFile": "@@bazel_tools//tools/sh:sh_configure.bzl", "ruleClassName": "sh_config", - "attributes": { - "name": "bazel_tools~sh_configure_extension~local_config_sh" - } + "attributes": {} } - } + }, + "recordedRepoMappingEntries": [] } }, - "@@gazelle~0.33.0//:extensions.bzl%go_deps": { + "@@gazelle~//:extensions.bzl%go_deps": { "general": { - "bzlTransitiveDigest": "0+dZMjfS4Y46rpY0W44rDC3p1dnaLjwpPoJbXts5ojE=", - "accumulatedFileDigests": { - "@@//:go.mod": "ce1f85453c22e1eb9f747899fe5918fded7c6138d0d3476ab2359db1df03dfb0", - "@@gazelle~0.33.0//:go.sum": "afb3c20626470bff206a91f35b0994f514f7a05ca44d9105f5ccb84e0d3ca197", - "@@gazelle~0.33.0//:go.mod": "e915e3f980bea175c80cc30fa7433e69f1251a9ce03046579d7b24588a93e75f", - "@@//:go.sum": "bf2fa472ea998a8e4db4ee753f51b585b1fe6c3a0292e9db8640a98236489f2b", - "@@rules_go~0.41.0//:go.mod": "a7143f329c2a3e0b983ce74a96c0c25b0d0c59d236d75f7e1b069aadd988d55e", - "@@rules_go~0.41.0//:go.sum": "022d36c9ebcc7b5dee1e9b85b3da9c9f3a529ee6f979946d66e4955b8d54614a" + "bzlTransitiveDigest": "Mvn5AAcPCYGfDLXuggkKZJaddA+KvF8zwG9bh4qGgu8=", + "recordedFileInputs": { + "@@//go.mod": "0c277d9255625d22ad237e281eb5bda22a6ba9a22c6e18f11bdee0e2d3a91791", + "@@rules_go~//go.mod": "a7143f329c2a3e0b983ce74a96c0c25b0d0c59d236d75f7e1b069aadd988d55e", + "@@gazelle~//go.sum": "afb3c20626470bff206a91f35b0994f514f7a05ca44d9105f5ccb84e0d3ca197", + "@@//go.sum": "1c1682f15fa617d06478571894c7424bf2a85052d70aa0b31d6d305430b68fc5", + "@@rules_go~//go.sum": "022d36c9ebcc7b5dee1e9b85b3da9c9f3a529ee6f979946d66e4955b8d54614a", + "@@gazelle~//go.mod": "e915e3f980bea175c80cc30fa7433e69f1251a9ce03046579d7b24588a93e75f" }, + "recordedDirentsInputs": {}, "envVariables": {}, "generatedRepoSpecs": { "org_golang_x_tools_go_vcs": { - "bzlFile": "@@gazelle~0.33.0//internal:go_repository.bzl", + "bzlFile": "@@gazelle~//internal:go_repository.bzl", "ruleClassName": "go_repository", "attributes": { - "name": "gazelle~0.33.0~go_deps~org_golang_x_tools_go_vcs", "importpath": "golang.org/x/tools/go/vcs", "build_directives": [], "build_file_generation": "auto", @@ -1449,10 +1558,9 @@ } }, "com_github_ghodss_yaml": { - "bzlFile": "@@gazelle~0.33.0//internal:go_repository.bzl", + "bzlFile": "@@gazelle~//internal:go_repository.bzl", "ruleClassName": "go_repository", "attributes": { - "name": "gazelle~0.33.0~go_deps~com_github_ghodss_yaml", "importpath": "github.com/ghodss/yaml", "build_directives": [], "build_file_generation": "auto", @@ -1464,10 +1572,9 @@ } }, "com_github_fsnotify_fsnotify": { - "bzlFile": "@@gazelle~0.33.0//internal:go_repository.bzl", + "bzlFile": "@@gazelle~//internal:go_repository.bzl", "ruleClassName": "go_repository", "attributes": { - "name": "gazelle~0.33.0~go_deps~com_github_fsnotify_fsnotify", "importpath": "github.com/fsnotify/fsnotify", "build_directives": [], "build_file_generation": "auto", @@ -1479,25 +1586,23 @@ } }, "com_github_bmatcuk_doublestar_v4": { - "bzlFile": "@@gazelle~0.33.0//internal:go_repository.bzl", + "bzlFile": "@@gazelle~//internal:go_repository.bzl", "ruleClassName": "go_repository", "attributes": { - "name": "gazelle~0.33.0~go_deps~com_github_bmatcuk_doublestar_v4", "importpath": "github.com/bmatcuk/doublestar/v4", "build_directives": [], "build_file_generation": "auto", "patches": [], "patch_args": [], - "sum": "h1:HTuxyug8GyFbRkrffIpzNCSK4luc0TY3wzXvzIZhEXc=", + "sum": "h1:FH9SifrbvJhnlQpztAx++wlkk70QBf0iBWDwNy7PA4I=", "replace": "", - "version": "v4.6.0" + "version": "v4.6.1" } }, "com_github_pmezard_go_difflib": { - "bzlFile": "@@gazelle~0.33.0//internal:go_repository.bzl", + "bzlFile": "@@gazelle~//internal:go_repository.bzl", "ruleClassName": "go_repository", "attributes": { - "name": "gazelle~0.33.0~go_deps~com_github_pmezard_go_difflib", "importpath": "github.com/pmezard/go-difflib", "build_directives": [], "build_file_generation": "auto", @@ -1508,26 +1613,24 @@ "version": "v1.0.0" } }, - "in_gopkg_check_v1": { - "bzlFile": "@@gazelle~0.33.0//internal:go_repository.bzl", + "com_github_davecgh_go_spew": { + "bzlFile": "@@gazelle~//internal:go_repository.bzl", "ruleClassName": "go_repository", "attributes": { - "name": "gazelle~0.33.0~go_deps~in_gopkg_check_v1", - "importpath": "gopkg.in/check.v1", + "importpath": "github.com/davecgh/go-spew", "build_directives": [], "build_file_generation": "auto", "patches": [], "patch_args": [], - "sum": "h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=", + "sum": "h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=", "replace": "", - "version": "v1.0.0-20180628173108-788fd7840127" + "version": "v1.1.1" } }, "org_golang_x_tools": { - "bzlFile": "@@gazelle~0.33.0//internal:go_repository.bzl", + "bzlFile": "@@gazelle~//internal:go_repository.bzl", "ruleClassName": "go_repository", "attributes": { - "name": "gazelle~0.33.0~go_deps~org_golang_x_tools", "importpath": "golang.org/x/tools", "build_directives": [], "build_file_generation": "auto", @@ -1539,25 +1642,23 @@ } }, "com_github_bazelbuild_buildtools": { - "bzlFile": "@@gazelle~0.33.0//internal:go_repository.bzl", + "bzlFile": "@@gazelle~//internal:go_repository.bzl", "ruleClassName": "go_repository", "attributes": { - "name": "gazelle~0.33.0~go_deps~com_github_bazelbuild_buildtools", "importpath": "github.com/bazelbuild/buildtools", "build_directives": [], "build_file_generation": "auto", "patches": [], "patch_args": [], - "sum": "h1:6Z/4LXt5mdhuFAx4QhwM0D5pTs1ljYGmhgF3O9OCMF0=", + "sum": "h1:HTepWP/jhtWTC1gvK0RnvKCgjh4gLqiwaOwGozAXcbw=", "replace": "", - "version": "v0.0.0-20230831140646-386244e73fc4" + "version": "v0.0.0-20231103205921-433ea8554e82" } }, "org_golang_x_net": { - "bzlFile": "@@gazelle~0.33.0//internal:go_repository.bzl", + "bzlFile": "@@gazelle~//internal:go_repository.bzl", "ruleClassName": "go_repository", "attributes": { - "name": "gazelle~0.33.0~go_deps~org_golang_x_net", "importpath": "golang.org/x/net", "build_directives": [], "build_file_generation": "auto", @@ -1569,10 +1670,9 @@ } }, "org_golang_google_genproto": { - "bzlFile": "@@gazelle~0.33.0//internal:go_repository.bzl", + "bzlFile": "@@gazelle~//internal:go_repository.bzl", "ruleClassName": "go_repository", "attributes": { - "name": "gazelle~0.33.0~go_deps~org_golang_google_genproto", "importpath": "google.golang.org/genproto", "build_directives": [], "build_file_generation": "auto", @@ -1584,10 +1684,9 @@ } }, "com_github_gogo_protobuf": { - "bzlFile": "@@gazelle~0.33.0//internal:go_repository.bzl", + "bzlFile": "@@gazelle~//internal:go_repository.bzl", "ruleClassName": "go_repository", "attributes": { - "name": "gazelle~0.33.0~go_deps~com_github_gogo_protobuf", "importpath": "github.com/gogo/protobuf", "build_directives": [ "gazelle:proto disable" @@ -1600,41 +1699,52 @@ "version": "v1.3.2" } }, - "in_gopkg_yaml_v2": { - "bzlFile": "@@gazelle~0.33.0//internal:go_repository.bzl", + "com_github_smacker_go_tree_sitter": { + "bzlFile": "@@gazelle~//internal:go_repository.bzl", "ruleClassName": "go_repository", "attributes": { - "name": "gazelle~0.33.0~go_deps~in_gopkg_yaml_v2", - "importpath": "gopkg.in/yaml.v2", + "importpath": "github.com/smacker/go-tree-sitter", "build_directives": [], "build_file_generation": "auto", "patches": [], "patch_args": [], - "sum": "h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=", + "sum": "h1:7QZKUmQfnxncZIJGyvX8M8YeMfn8kM10j3J/2KwVTN4=", "replace": "", - "version": "v2.2.8" + "version": "v0.0.0-20240422154435-0628b34cbf9c" } }, - "com_github_golang_mock": { - "bzlFile": "@@gazelle~0.33.0//internal:go_repository.bzl", + "com_github_stretchr_testify": { + "bzlFile": "@@gazelle~//internal:go_repository.bzl", "ruleClassName": "go_repository", "attributes": { - "name": "gazelle~0.33.0~go_deps~com_github_golang_mock", - "importpath": "github.com/golang/mock", + "importpath": "github.com/stretchr/testify", "build_directives": [], "build_file_generation": "auto", "patches": [], "patch_args": [], - "sum": "h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=", + "sum": "h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=", "replace": "", - "version": "v1.6.0" + "version": "v1.9.0" + } + }, + "in_gopkg_yaml_v2": { + "bzlFile": "@@gazelle~//internal:go_repository.bzl", + "ruleClassName": "go_repository", + "attributes": { + "importpath": "gopkg.in/yaml.v2", + "build_directives": [], + "build_file_generation": "auto", + "patches": [], + "patch_args": [], + "sum": "h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=", + "replace": "", + "version": "v2.4.0" } }, "org_golang_x_sync": { - "bzlFile": "@@gazelle~0.33.0//internal:go_repository.bzl", + "bzlFile": "@@gazelle~//internal:go_repository.bzl", "ruleClassName": "go_repository", "attributes": { - "name": "gazelle~0.33.0~go_deps~org_golang_x_sync", "importpath": "golang.org/x/sync", "build_directives": [], "build_file_generation": "auto", @@ -1645,43 +1755,40 @@ "version": "v0.3.0" } }, - "org_golang_google_grpc": { - "bzlFile": "@@gazelle~0.33.0//internal:go_repository.bzl", + "com_github_golang_mock": { + "bzlFile": "@@gazelle~//internal:go_repository.bzl", "ruleClassName": "go_repository", "attributes": { - "name": "gazelle~0.33.0~go_deps~org_golang_google_grpc", - "importpath": "google.golang.org/grpc", - "build_directives": [ - "gazelle:proto disable" - ], + "importpath": "github.com/golang/mock", + "build_directives": [], "build_file_generation": "auto", "patches": [], "patch_args": [], - "sum": "h1:fPVVDxY9w++VjTZsYvXWqEf9Rqar/e+9zYfxKK+W+YU=", + "sum": "h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=", "replace": "", - "version": "v1.50.0" + "version": "v1.6.0" } }, - "com_github_kr_pretty": { - "bzlFile": "@@gazelle~0.33.0//internal:go_repository.bzl", + "org_golang_google_grpc": { + "bzlFile": "@@gazelle~//internal:go_repository.bzl", "ruleClassName": "go_repository", "attributes": { - "name": "gazelle~0.33.0~go_deps~com_github_kr_pretty", - "importpath": "github.com/kr/pretty", - "build_directives": [], + "importpath": "google.golang.org/grpc", + "build_directives": [ + "gazelle:proto disable" + ], "build_file_generation": "auto", "patches": [], "patch_args": [], - "sum": "h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=", + "sum": "h1:fPVVDxY9w++VjTZsYvXWqEf9Rqar/e+9zYfxKK+W+YU=", "replace": "", - "version": "v0.1.0" + "version": "v1.50.0" } }, "com_github_google_go_cmp": { - "bzlFile": "@@gazelle~0.33.0//internal:go_repository.bzl", + "bzlFile": "@@gazelle~//internal:go_repository.bzl", "ruleClassName": "go_repository", "attributes": { - "name": "gazelle~0.33.0~go_deps~com_github_google_go_cmp", "importpath": "github.com/google/go-cmp", "build_directives": [], "build_file_generation": "auto", @@ -1693,10 +1800,9 @@ } }, "org_golang_x_text": { - "bzlFile": "@@gazelle~0.33.0//internal:go_repository.bzl", + "bzlFile": "@@gazelle~//internal:go_repository.bzl", "ruleClassName": "go_repository", "attributes": { - "name": "gazelle~0.33.0~go_deps~org_golang_x_text", "importpath": "golang.org/x/text", "build_directives": [], "build_file_generation": "auto", @@ -1707,26 +1813,10 @@ "version": "v0.3.3" } }, - "com_github_google_uuid": { - "bzlFile": "@@gazelle~0.33.0//internal:go_repository.bzl", - "ruleClassName": "go_repository", - "attributes": { - "name": "gazelle~0.33.0~go_deps~com_github_google_uuid", - "importpath": "github.com/google/uuid", - "build_directives": [], - "build_file_generation": "auto", - "patches": [], - "patch_args": [], - "sum": "h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=", - "replace": "", - "version": "v1.3.0" - } - }, "org_golang_google_protobuf": { - "bzlFile": "@@gazelle~0.33.0//internal:go_repository.bzl", + "bzlFile": "@@gazelle~//internal:go_repository.bzl", "ruleClassName": "go_repository", "attributes": { - "name": "gazelle~0.33.0~go_deps~org_golang_google_protobuf", "importpath": "google.golang.org/protobuf", "build_directives": [], "build_file_generation": "auto", @@ -1738,25 +1828,23 @@ } }, "com_github_emirpasic_gods": { - "bzlFile": "@@gazelle~0.33.0//internal:go_repository.bzl", + "bzlFile": "@@gazelle~//internal:go_repository.bzl", "ruleClassName": "go_repository", "attributes": { - "name": "gazelle~0.33.0~go_deps~com_github_emirpasic_gods", "importpath": "github.com/emirpasic/gods", "build_directives": [], "build_file_generation": "auto", "patches": [], "patch_args": [], - "sum": "h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg=", + "sum": "h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=", "replace": "", - "version": "v1.12.0" + "version": "v1.18.1" } }, "org_golang_x_mod": { - "bzlFile": "@@gazelle~0.33.0//internal:go_repository.bzl", + "bzlFile": "@@gazelle~//internal:go_repository.bzl", "ruleClassName": "go_repository", "attributes": { - "name": "gazelle~0.33.0~go_deps~org_golang_x_mod", "importpath": "golang.org/x/mod", "build_directives": [], "build_file_generation": "auto", @@ -1767,11 +1855,24 @@ "version": "v0.12.0" } }, + "in_gopkg_yaml_v3": { + "bzlFile": "@@gazelle~//internal:go_repository.bzl", + "ruleClassName": "go_repository", + "attributes": { + "importpath": "gopkg.in/yaml.v3", + "build_directives": [], + "build_file_generation": "auto", + "patches": [], + "patch_args": [], + "sum": "h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=", + "replace": "", + "version": "v3.0.1" + } + }, "com_github_golang_protobuf": { - "bzlFile": "@@gazelle~0.33.0//internal:go_repository.bzl", + "bzlFile": "@@gazelle~//internal:go_repository.bzl", "ruleClassName": "go_repository", "attributes": { - "name": "gazelle~0.33.0~go_deps~com_github_golang_protobuf", "importpath": "github.com/golang/protobuf", "build_directives": [], "build_file_generation": "auto", @@ -1783,50 +1884,49 @@ } }, "bazel_gazelle_go_repository_config": { - "bzlFile": "@@gazelle~0.33.0//internal/bzlmod:go_deps.bzl", + "bzlFile": "@@gazelle~//internal/bzlmod:go_deps.bzl", "ruleClassName": "_go_repository_config", "attributes": { - "name": "gazelle~0.33.0~go_deps~bazel_gazelle_go_repository_config", "importpaths": { - "@gazelle~0.33.0": "github.com/bazelbuild/bazel-gazelle", + "@gazelle~": "github.com/bazelbuild/bazel-gazelle", "com_github_bazelbuild_buildtools": "github.com/bazelbuild/buildtools", - "@rules_go~0.41.0": "github.com/bazelbuild/rules_go", + "@rules_go~": "github.com/bazelbuild/rules_go", + "com_github_bmatcuk_doublestar_v4": "github.com/bmatcuk/doublestar/v4", "com_github_emirpasic_gods": "github.com/emirpasic/gods", "com_github_ghodss_yaml": "github.com/ghodss/yaml", - "com_github_google_uuid": "github.com/google/uuid", + "com_github_smacker_go_tree_sitter": "github.com/smacker/go-tree-sitter", + "com_github_stretchr_testify": "github.com/stretchr/testify", + "org_golang_x_sync": "golang.org/x/sync", "in_gopkg_yaml_v2": "gopkg.in/yaml.v2", + "com_github_davecgh_go_spew": "github.com/davecgh/go-spew", "com_github_google_go_cmp": "github.com/google/go-cmp", - "com_github_kr_pretty": "github.com/kr/pretty", + "com_github_pmezard_go_difflib": "github.com/pmezard/go-difflib", "org_golang_x_mod": "golang.org/x/mod", - "in_gopkg_check_v1": "gopkg.in/check.v1", + "org_golang_x_sys": "golang.org/x/sys", + "org_golang_x_tools": "golang.org/x/tools", + "in_gopkg_yaml_v3": "gopkg.in/yaml.v3", "com_github_gogo_protobuf": "github.com/gogo/protobuf", "com_github_golang_mock": "github.com/golang/mock", "com_github_golang_protobuf": "github.com/golang/protobuf", "org_golang_google_protobuf": "google.golang.org/protobuf", "org_golang_x_net": "golang.org/x/net", - "org_golang_x_sys": "golang.org/x/sys", "org_golang_x_text": "golang.org/x/text", "org_golang_google_genproto": "google.golang.org/genproto", "org_golang_google_grpc": "google.golang.org/grpc", - "org_golang_x_tools": "golang.org/x/tools", - "com_github_bmatcuk_doublestar_v4": "github.com/bmatcuk/doublestar/v4", "com_github_fsnotify_fsnotify": "github.com/fsnotify/fsnotify", - "com_github_pmezard_go_difflib": "github.com/pmezard/go-difflib", - "org_golang_x_sync": "golang.org/x/sync", "org_golang_x_tools_go_vcs": "golang.org/x/tools/go/vcs" }, "module_names": { - "@rules_go~0.41.0": "rules_go", - "@gazelle~0.33.0": "gazelle" + "@rules_go~": "rules_go", + "@gazelle~": "gazelle" }, "build_naming_conventions": {} } }, "org_golang_x_sys": { - "bzlFile": "@@gazelle~0.33.0//internal:go_repository.bzl", + "bzlFile": "@@gazelle~//internal:go_repository.bzl", "ruleClassName": "go_repository", "attributes": { - "name": "gazelle~0.33.0~go_deps~org_golang_x_sys", "importpath": "golang.org/x/sys", "build_directives": [], "build_file_generation": "auto", @@ -1841,61 +1941,87 @@ "moduleExtensionMetadata": { "explicitRootModuleDirectDeps": [ "com_github_bazelbuild_buildtools", + "com_github_bmatcuk_doublestar_v4", "com_github_emirpasic_gods", "com_github_ghodss_yaml", - "com_github_google_uuid", + "com_github_smacker_go_tree_sitter", + "com_github_stretchr_testify", + "org_golang_x_sync", "in_gopkg_yaml_v2" ], "explicitRootModuleDirectDevDeps": [], - "useAllRepos": "NO" - } + "useAllRepos": "NO", + "reproducible": false + }, + "recordedRepoMappingEntries": [ + [ + "gazelle~", + "bazel_tools", + "bazel_tools" + ] + ] } }, - "@@gazelle~0.33.0//internal/bzlmod:non_module_deps.bzl%non_module_deps": { + "@@gazelle~//internal/bzlmod:non_module_deps.bzl%non_module_deps": { "general": { "bzlTransitiveDigest": "idtJXxcHUd75fcvggtK/s6naCFjcaysxF0U5OKBm2LE=", - "accumulatedFileDigests": {}, + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, "envVariables": {}, "generatedRepoSpecs": { "bazel_gazelle_is_bazel_module": { - "bzlFile": "@@gazelle~0.33.0//internal:is_bazel_module.bzl", + "bzlFile": "@@gazelle~//internal:is_bazel_module.bzl", "ruleClassName": "is_bazel_module", "attributes": { - "name": "gazelle~0.33.0~non_module_deps~bazel_gazelle_is_bazel_module", "is_bazel_module": true } }, "bazel_gazelle_go_repository_tools": { - "bzlFile": "@@gazelle~0.33.0//internal:go_repository_tools.bzl", + "bzlFile": "@@gazelle~//internal:go_repository_tools.bzl", "ruleClassName": "go_repository_tools", "attributes": { - "name": "gazelle~0.33.0~non_module_deps~bazel_gazelle_go_repository_tools", - "go_cache": "@@gazelle~0.33.0~non_module_deps~bazel_gazelle_go_repository_cache//:go.env" + "go_cache": "@@gazelle~~non_module_deps~bazel_gazelle_go_repository_cache//:go.env" } }, "bazel_gazelle_go_repository_cache": { - "bzlFile": "@@gazelle~0.33.0//internal:go_repository_cache.bzl", + "bzlFile": "@@gazelle~//internal:go_repository_cache.bzl", "ruleClassName": "go_repository_cache", "attributes": { - "name": "gazelle~0.33.0~non_module_deps~bazel_gazelle_go_repository_cache", - "go_sdk_name": "@rules_go~0.41.0~go_sdk~go_default_sdk", + "go_sdk_name": "@rules_go~~go_sdk~go_default_sdk", "go_env": {} } } - } + }, + "recordedRepoMappingEntries": [ + [ + "gazelle~", + "bazel_gazelle_go_repository_cache", + "gazelle~~non_module_deps~bazel_gazelle_go_repository_cache" + ], + [ + "gazelle~", + "go_host_compatible_sdk_label", + "rules_go~~go_sdk~go_host_compatible_sdk_label" + ], + [ + "rules_go~~go_sdk~go_host_compatible_sdk_label", + "go_default_sdk", + "rules_go~~go_sdk~go_default_sdk" + ] + ] } }, - "@@rules_go~0.41.0//go:extensions.bzl%go_sdk": { + "@@rules_go~//go:extensions.bzl%go_sdk": { "general": { - "bzlTransitiveDigest": "QaU0mhA+aom4ENV5sBUAEDa9IQt53GtspLCjl89277c=", - "accumulatedFileDigests": {}, + "bzlTransitiveDigest": "eGDLbciJngLG8USN6/HoLZ91MLuFliA9P4tEvCXvuec=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, "envVariables": {}, "generatedRepoSpecs": { "go_default_sdk": { - "bzlFile": "@@rules_go~0.41.0//go/private:sdk.bzl", + "bzlFile": "@@rules_go~//go/private:sdk.bzl", "ruleClassName": "go_download_sdk_rule", "attributes": { - "name": "rules_go~0.41.0~go_sdk~go_default_sdk", "goos": "", "goarch": "", "sdks": {}, @@ -1906,18 +2032,16 @@ } }, "go_host_compatible_sdk_label": { - "bzlFile": "@@rules_go~0.41.0//go/private:extensions.bzl", + "bzlFile": "@@rules_go~//go/private:extensions.bzl", "ruleClassName": "host_compatible_toolchain", "attributes": { - "name": "rules_go~0.41.0~go_sdk~go_host_compatible_sdk_label", "toolchain": "@go_default_sdk//:ROOT" } }, "go_toolchains": { - "bzlFile": "@@rules_go~0.41.0//go/private:sdk.bzl", + "bzlFile": "@@rules_go~//go/private:sdk.bzl", "ruleClassName": "go_multiple_toolchains", "attributes": { - "name": "rules_go~0.41.0~go_sdk~go_toolchains", "prefixes": [ "_0000_go_default_sdk_" ], @@ -1938,20 +2062,27 @@ ] } } - } + }, + "recordedRepoMappingEntries": [ + [ + "rules_go~", + "bazel_tools", + "bazel_tools" + ] + ] } }, - "@@rules_go~0.41.0//go/private:extensions.bzl%non_module_dependencies": { + "@@rules_go~//go/private:extensions.bzl%non_module_dependencies": { "general": { - "bzlTransitiveDigest": "CZeQbYwfBEc0H27WqrnwfsnHiarm8whm1PFFxE1fMl4=", - "accumulatedFileDigests": {}, + "bzlTransitiveDigest": "GXCPP6l+bsdqcRscjGNCRds6cxpRP2wigCJx3uwfGn0=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, "envVariables": {}, "generatedRepoSpecs": { "bazel_skylib": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_go~0.41.0~non_module_dependencies~bazel_skylib", "urls": [ "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.4.2/bazel-skylib-1.4.2.tar.gz", "https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.2/bazel-skylib-1.4.2.tar.gz" @@ -1964,7 +2095,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_go~0.41.0~non_module_dependencies~com_github_gogo_protobuf", "urls": [ "https://mirror.bazel.build/github.com/gogo/protobuf/archive/refs/tags/v1.3.2.zip", "https://github.com/gogo/protobuf/archive/refs/tags/v1.3.2.zip" @@ -1972,7 +2102,7 @@ "sha256": "f89f8241af909ce3226562d135c25b28e656ae173337b3e58ede917aa26e1e3c", "strip_prefix": "protobuf-1.3.2", "patches": [ - "@@rules_go~0.41.0//third_party:com_github_gogo_protobuf-gazelle.patch" + "@@rules_go~//third_party:com_github_gogo_protobuf-gazelle.patch" ], "patch_args": [ "-p1" @@ -1983,7 +2113,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_go~0.41.0~non_module_dependencies~org_golang_x_xerrors", "urls": [ "https://mirror.bazel.build/github.com/golang/xerrors/archive/04be3eba64a22a838cdb17b8dca15a52871c08b4.zip", "https://github.com/golang/xerrors/archive/04be3eba64a22a838cdb17b8dca15a52871c08b4.zip" @@ -1991,7 +2120,7 @@ "sha256": "ffad2b06ef2e09d040da2ff08077865e99ab95d4d0451737fc8e33706bb01634", "strip_prefix": "xerrors-04be3eba64a22a838cdb17b8dca15a52871c08b4", "patches": [ - "@@rules_go~0.41.0//third_party:org_golang_x_xerrors-gazelle.patch" + "@@rules_go~//third_party:org_golang_x_xerrors-gazelle.patch" ], "patch_args": [ "-p1" @@ -2002,7 +2131,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_go~0.41.0~non_module_dependencies~com_github_golang_protobuf", "urls": [ "https://mirror.bazel.build/github.com/golang/protobuf/archive/refs/tags/v1.5.3.zip", "https://github.com/golang/protobuf/archive/refs/tags/v1.5.3.zip" @@ -2010,7 +2138,7 @@ "sha256": "2dced4544ae5372281e20f1e48ca76368355a01b31353724718c4d6e3dcbb430", "strip_prefix": "protobuf-1.5.3", "patches": [ - "@@rules_go~0.41.0//third_party:com_github_golang_protobuf-gazelle.patch" + "@@rules_go~//third_party:com_github_golang_protobuf-gazelle.patch" ], "patch_args": [ "-p1" @@ -2018,31 +2146,27 @@ } }, "io_bazel_rules_nogo": { - "bzlFile": "@@rules_go~0.41.0//go/private:nogo.bzl", + "bzlFile": "@@rules_go~//go/private:nogo.bzl", "ruleClassName": "go_register_nogo", "attributes": { - "name": "rules_go~0.41.0~non_module_dependencies~io_bazel_rules_nogo", "nogo": "@io_bazel_rules_go//:default_nogo" } }, "gogo_special_proto": { - "bzlFile": "@@rules_go~0.41.0//proto:gogo.bzl", + "bzlFile": "@@rules_go~//proto:gogo.bzl", "ruleClassName": "gogo_special_proto", - "attributes": { - "name": "rules_go~0.41.0~non_module_dependencies~gogo_special_proto" - } + "attributes": {} }, "com_github_golang_mock": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_go~0.41.0~non_module_dependencies~com_github_golang_mock", "urls": [ "https://mirror.bazel.build/github.com/golang/mock/archive/refs/tags/v1.7.0-rc.1.zip", "https://github.com/golang/mock/archive/refs/tags/v1.7.0-rc.1.zip" ], "patches": [ - "@@rules_go~0.41.0//third_party:com_github_golang_mock-gazelle.patch" + "@@rules_go~//third_party:com_github_golang_mock-gazelle.patch" ], "patch_args": [ "-p1" @@ -2055,7 +2179,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_go~0.41.0~non_module_dependencies~org_golang_google_protobuf", "sha256": "cb1a05581c33b3705ede6c08edf9b9c1dbc579559ba30f532704c324e42bf801", "urls": [ "https://mirror.bazel.build/github.com/protocolbuffers/protobuf-go/archive/refs/tags/v1.30.0.zip", @@ -2063,7 +2186,7 @@ ], "strip_prefix": "protobuf-go-1.30.0", "patches": [ - "@@rules_go~0.41.0//third_party:org_golang_google_protobuf-gazelle.patch" + "@@rules_go~//third_party:org_golang_google_protobuf-gazelle.patch" ], "patch_args": [ "-p1" @@ -2074,7 +2197,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_go~0.41.0~non_module_dependencies~com_github_mwitkow_go_proto_validators", "urls": [ "https://mirror.bazel.build/github.com/mwitkow/go-proto-validators/archive/refs/tags/v0.3.2.zip", "https://github.com/mwitkow/go-proto-validators/archive/refs/tags/v0.3.2.zip" @@ -2087,7 +2209,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_go~0.41.0~non_module_dependencies~org_golang_x_tools", "urls": [ "https://mirror.bazel.build/github.com/golang/tools/archive/refs/tags/v0.7.0.zip", "https://github.com/golang/tools/archive/refs/tags/v0.7.0.zip" @@ -2095,8 +2216,8 @@ "sha256": "9f20a20f29f4008d797a8be882ef82b69cf8f7f2b96dbdfe3814c57d8280fa4b", "strip_prefix": "tools-0.7.0", "patches": [ - "@@rules_go~0.41.0//third_party:org_golang_x_tools-deletegopls.patch", - "@@rules_go~0.41.0//third_party:org_golang_x_tools-gazelle.patch" + "@@rules_go~//third_party:org_golang_x_tools-deletegopls.patch", + "@@rules_go~//third_party:org_golang_x_tools-gazelle.patch" ], "patch_args": [ "-p1" @@ -2107,7 +2228,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_go~0.41.0~non_module_dependencies~org_golang_x_sys", "urls": [ "https://mirror.bazel.build/github.com/golang/sys/archive/refs/tags/v0.8.0.zip", "https://github.com/golang/sys/archive/refs/tags/v0.8.0.zip" @@ -2115,7 +2235,7 @@ "sha256": "58ef1f478ba923715bc493f2e0a431d4b2d428f1e3409f6acaac452945f6fd2f", "strip_prefix": "sys-0.8.0", "patches": [ - "@@rules_go~0.41.0//third_party:org_golang_x_sys-gazelle.patch" + "@@rules_go~//third_party:org_golang_x_sys-gazelle.patch" ], "patch_args": [ "-p1" @@ -2126,7 +2246,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_go~0.41.0~non_module_dependencies~org_golang_google_genproto", "urls": [ "https://mirror.bazel.build/github.com/googleapis/go-genproto/archive/e85fd2cbaebc35e54b279b5e9b1057db87dacd57.zip", "https://github.com/googleapis/go-genproto/archive/e85fd2cbaebc35e54b279b5e9b1057db87dacd57.zip" @@ -2134,59 +2253,62 @@ "sha256": "da966a75fdc2f9d8006bc51e683490ff969ff637bbc030812cd9c5697e3a7cab", "strip_prefix": "go-genproto-e85fd2cbaebc35e54b279b5e9b1057db87dacd57", "patches": [ - "@@rules_go~0.41.0//third_party:org_golang_google_genproto-gazelle.patch" + "@@rules_go~//third_party:org_golang_google_genproto-gazelle.patch" ], "patch_args": [ "-p1" ] } } - } + }, + "recordedRepoMappingEntries": [ + [ + "rules_go~", + "bazel_tools", + "bazel_tools" + ] + ] } }, - "@@rules_java~7.1.0//java:extensions.bzl%toolchains": { + "@@rules_java~//java:extensions.bzl%toolchains": { "general": { - "bzlTransitiveDigest": "iUIRqCK7tkhvcDJCAfPPqSd06IHG0a8HQD0xeQyVAqw=", - "accumulatedFileDigests": {}, + "bzlTransitiveDigest": "tJHbmWnq7m+9eUBnUdv7jZziQ26FmcGL9C5/hU3Q9UQ=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, "envVariables": {}, "generatedRepoSpecs": { "remotejdk21_linux_toolchain_config_repo": { - "bzlFile": "@@rules_java~7.1.0//toolchains:remote_java_repository.bzl", + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk21_linux_toolchain_config_repo", "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_21\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"21\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk21_linux//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk21_linux//:jdk\",\n)\n" } }, "remotejdk17_linux_s390x_toolchain_config_repo": { - "bzlFile": "@@rules_java~7.1.0//toolchains:remote_java_repository.bzl", + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk17_linux_s390x_toolchain_config_repo", "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_17\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"17\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:s390x\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk17_linux_s390x//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:s390x\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk17_linux_s390x//:jdk\",\n)\n" } }, "remotejdk17_macos_toolchain_config_repo": { - "bzlFile": "@@rules_java~7.1.0//toolchains:remote_java_repository.bzl", + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk17_macos_toolchain_config_repo", "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_17\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"17\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk17_macos//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk17_macos//:jdk\",\n)\n" } }, "remotejdk21_macos_aarch64_toolchain_config_repo": { - "bzlFile": "@@rules_java~7.1.0//toolchains:remote_java_repository.bzl", + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk21_macos_aarch64_toolchain_config_repo", "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_21\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"21\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk21_macos_aarch64//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk21_macos_aarch64//:jdk\",\n)\n" } }, "remotejdk17_linux_aarch64_toolchain_config_repo": { - "bzlFile": "@@rules_java~7.1.0//toolchains:remote_java_repository.bzl", + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk17_linux_aarch64_toolchain_config_repo", "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_17\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"17\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk17_linux_aarch64//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk17_linux_aarch64//:jdk\",\n)\n" } }, @@ -2194,21 +2316,19 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk21_macos_aarch64", "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 21,\n)\n", - "sha256": "2a7a99a3ea263dbd8d32a67d1e6e363ba8b25c645c826f5e167a02bbafaff1fa", - "strip_prefix": "zulu21.28.85-ca-jdk21.0.0-macosx_aarch64", + "sha256": "e8260516de8b60661422a725f1df2c36ef888f6fb35393566b00e7325db3d04e", + "strip_prefix": "zulu21.32.17-ca-jdk21.0.2-macosx_aarch64", "urls": [ - "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.28.85-ca-jdk21.0.0-macosx_aarch64.tar.gz", - "https://cdn.azul.com/zulu/bin/zulu21.28.85-ca-jdk21.0.0-macosx_aarch64.tar.gz" + "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-macosx_aarch64.tar.gz", + "https://cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-macosx_aarch64.tar.gz" ] } }, "remotejdk17_linux_toolchain_config_repo": { - "bzlFile": "@@rules_java~7.1.0//toolchains:remote_java_repository.bzl", + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk17_linux_toolchain_config_repo", "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_17\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"17\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk17_linux//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk17_linux//:jdk\",\n)\n" } }, @@ -2216,7 +2336,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk17_macos_aarch64", "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 17,\n)\n", "sha256": "314b04568ec0ae9b36ba03c9cbd42adc9e1265f74678923b19297d66eb84dcca", "strip_prefix": "zulu17.44.53-ca-jdk17.0.8.1-macosx_aarch64", @@ -2230,11 +2349,10 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_java~7.1.0~toolchains~remote_java_tools_windows", - "sha256": "c5c70c214a350f12cbf52da8270fa43ba629b795f3dd328028a38f8f0d39c2a1", + "sha256": "fe2f88169696d6c6fc6e90ba61bb46be7d0ae3693cbafdf336041bf56679e8d1", "urls": [ - "https://mirror.bazel.build/bazel_java_tools/releases/java/v13.1/java_tools_windows-v13.1.zip", - "https://github.com/bazelbuild/java_tools/releases/download/java_v13.1/java_tools_windows-v13.1.zip" + "https://mirror.bazel.build/bazel_java_tools/releases/java/v13.4/java_tools_windows-v13.4.zip", + "https://github.com/bazelbuild/java_tools/releases/download/java_v13.4/java_tools_windows-v13.4.zip" ] } }, @@ -2242,7 +2360,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk11_win", "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 11,\n)\n", "sha256": "43408193ce2fa0862819495b5ae8541085b95660153f2adcf91a52d3a1710e83", "strip_prefix": "zulu11.66.15-ca-jdk11.0.20-win_x64", @@ -2253,10 +2370,9 @@ } }, "remotejdk11_win_toolchain_config_repo": { - "bzlFile": "@@rules_java~7.1.0//toolchains:remote_java_repository.bzl", + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk11_win_toolchain_config_repo", "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_11\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"11\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:windows\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk11_win//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:windows\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk11_win//:jdk\",\n)\n" } }, @@ -2264,7 +2380,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk11_linux_aarch64", "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 11,\n)\n", "sha256": "54174439f2b3fddd11f1048c397fe7bb45d4c9d66d452d6889b013d04d21c4de", "strip_prefix": "zulu11.66.15-ca-jdk11.0.20-linux_aarch64", @@ -2278,7 +2393,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk17_linux", "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 17,\n)\n", "sha256": "b9482f2304a1a68a614dfacddcf29569a72f0fac32e6c74f83dc1b9a157b8340", "strip_prefix": "zulu17.44.53-ca-jdk17.0.8.1-linux_x64", @@ -2289,18 +2403,16 @@ } }, "remotejdk11_linux_s390x_toolchain_config_repo": { - "bzlFile": "@@rules_java~7.1.0//toolchains:remote_java_repository.bzl", + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk11_linux_s390x_toolchain_config_repo", "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_11\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"11\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:s390x\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk11_linux_s390x//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:s390x\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk11_linux_s390x//:jdk\",\n)\n" } }, "remotejdk11_linux_toolchain_config_repo": { - "bzlFile": "@@rules_java~7.1.0//toolchains:remote_java_repository.bzl", + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk11_linux_toolchain_config_repo", "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_11\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"11\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk11_linux//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk11_linux//:jdk\",\n)\n" } }, @@ -2308,7 +2420,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk11_macos", "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 11,\n)\n", "sha256": "bcaab11cfe586fae7583c6d9d311c64384354fb2638eb9a012eca4c3f1a1d9fd", "strip_prefix": "zulu11.66.15-ca-jdk11.0.20-macosx_x64", @@ -2322,7 +2433,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk11_win_arm64", "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 11,\n)\n", "sha256": "b8a28e6e767d90acf793ea6f5bed0bb595ba0ba5ebdf8b99f395266161e53ec2", "strip_prefix": "jdk-11.0.13+8", @@ -2335,7 +2445,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk17_macos", "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 17,\n)\n", "sha256": "640453e8afe8ffe0fb4dceb4535fb50db9c283c64665eebb0ba68b19e65f4b1f", "strip_prefix": "zulu17.44.53-ca-jdk17.0.8.1-macosx_x64", @@ -2349,29 +2458,26 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk21_macos", "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 21,\n)\n", - "sha256": "9639b87db586d0c89f7a9892ae47f421e442c64b97baebdff31788fbe23265bd", - "strip_prefix": "zulu21.28.85-ca-jdk21.0.0-macosx_x64", + "sha256": "3ad8fe288eb57d975c2786ae453a036aa46e47ab2ac3d81538ebae2a54d3c025", + "strip_prefix": "zulu21.32.17-ca-jdk21.0.2-macosx_x64", "urls": [ - "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.28.85-ca-jdk21.0.0-macosx_x64.tar.gz", - "https://cdn.azul.com/zulu/bin/zulu21.28.85-ca-jdk21.0.0-macosx_x64.tar.gz" + "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-macosx_x64.tar.gz", + "https://cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-macosx_x64.tar.gz" ] } }, "remotejdk21_macos_toolchain_config_repo": { - "bzlFile": "@@rules_java~7.1.0//toolchains:remote_java_repository.bzl", + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk21_macos_toolchain_config_repo", "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_21\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"21\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk21_macos//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk21_macos//:jdk\",\n)\n" } }, "remotejdk17_macos_aarch64_toolchain_config_repo": { - "bzlFile": "@@rules_java~7.1.0//toolchains:remote_java_repository.bzl", + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk17_macos_aarch64_toolchain_config_repo", "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_17\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"17\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk17_macos_aarch64//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk17_macos_aarch64//:jdk\",\n)\n" } }, @@ -2379,7 +2485,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk17_win", "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 17,\n)\n", "sha256": "192f2afca57701de6ec496234f7e45d971bf623ff66b8ee4a5c81582054e5637", "strip_prefix": "zulu17.44.53-ca-jdk17.0.8.1-win_x64", @@ -2390,18 +2495,16 @@ } }, "remotejdk11_macos_aarch64_toolchain_config_repo": { - "bzlFile": "@@rules_java~7.1.0//toolchains:remote_java_repository.bzl", + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk11_macos_aarch64_toolchain_config_repo", "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_11\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"11\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk11_macos_aarch64//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk11_macos_aarch64//:jdk\",\n)\n" } }, "remotejdk11_linux_ppc64le_toolchain_config_repo": { - "bzlFile": "@@rules_java~7.1.0//toolchains:remote_java_repository.bzl", + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk11_linux_ppc64le_toolchain_config_repo", "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_11\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"11\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:ppc\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk11_linux_ppc64le//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:ppc\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk11_linux_ppc64le//:jdk\",\n)\n" } }, @@ -2409,13 +2512,12 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk21_linux", "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 21,\n)\n", - "sha256": "0c0eadfbdc47a7ca64aeab51b9c061f71b6e4d25d2d87674512e9b6387e9e3a6", - "strip_prefix": "zulu21.28.85-ca-jdk21.0.0-linux_x64", + "sha256": "5ad730fbee6bb49bfff10bf39e84392e728d89103d3474a7e5def0fd134b300a", + "strip_prefix": "zulu21.32.17-ca-jdk21.0.2-linux_x64", "urls": [ - "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.28.85-ca-jdk21.0.0-linux_x64.tar.gz", - "https://cdn.azul.com/zulu/bin/zulu21.28.85-ca-jdk21.0.0-linux_x64.tar.gz" + "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-linux_x64.tar.gz", + "https://cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-linux_x64.tar.gz" ] } }, @@ -2423,11 +2525,10 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_java~7.1.0~toolchains~remote_java_tools_linux", - "sha256": "d134da9b04c9023fb6e56a5d4bffccee73f7bc9572ddc4e747778dacccd7a5a7", + "sha256": "ba10f09a138cf185d04cbc807d67a3da42ab13d618c5d1ce20d776e199c33a39", "urls": [ - "https://mirror.bazel.build/bazel_java_tools/releases/java/v13.1/java_tools_linux-v13.1.zip", - "https://github.com/bazelbuild/java_tools/releases/download/java_v13.1/java_tools_linux-v13.1.zip" + "https://mirror.bazel.build/bazel_java_tools/releases/java/v13.4/java_tools_linux-v13.4.zip", + "https://github.com/bazelbuild/java_tools/releases/download/java_v13.4/java_tools_linux-v13.4.zip" ] } }, @@ -2435,13 +2536,12 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk21_win", "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 21,\n)\n", - "sha256": "e9959d500a0d9a7694ac243baf657761479da132f0f94720cbffd092150bd802", - "strip_prefix": "zulu21.28.85-ca-jdk21.0.0-win_x64", + "sha256": "f7cc15ca17295e69c907402dfe8db240db446e75d3b150da7bf67243cded93de", + "strip_prefix": "zulu21.32.17-ca-jdk21.0.2-win_x64", "urls": [ - "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.28.85-ca-jdk21.0.0-win_x64.zip", - "https://cdn.azul.com/zulu/bin/zulu21.28.85-ca-jdk21.0.0-win_x64.zip" + "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-win_x64.zip", + "https://cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-win_x64.zip" ] } }, @@ -2449,21 +2549,19 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk21_linux_aarch64", "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 21,\n)\n", - "sha256": "1fb64b8036c5d463d8ab59af06bf5b6b006811e6012e3b0eb6bccf57f1c55835", - "strip_prefix": "zulu21.28.85-ca-jdk21.0.0-linux_aarch64", + "sha256": "ce7df1af5d44a9f455617c4b8891443fbe3e4b269c777d8b82ed66f77167cfe0", + "strip_prefix": "zulu21.32.17-ca-jdk21.0.2-linux_aarch64", "urls": [ - "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.28.85-ca-jdk21.0.0-linux_aarch64.tar.gz", - "https://cdn.azul.com/zulu/bin/zulu21.28.85-ca-jdk21.0.0-linux_aarch64.tar.gz" + "https://cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-linux_aarch64.tar.gz", + "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-linux_aarch64.tar.gz" ] } }, "remotejdk11_linux_aarch64_toolchain_config_repo": { - "bzlFile": "@@rules_java~7.1.0//toolchains:remote_java_repository.bzl", + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk11_linux_aarch64_toolchain_config_repo", "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_11\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"11\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk11_linux_aarch64//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk11_linux_aarch64//:jdk\",\n)\n" } }, @@ -2471,7 +2569,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk11_linux_s390x", "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 11,\n)\n", "sha256": "a58fc0361966af0a5d5a31a2d8a208e3c9bb0f54f345596fd80b99ea9a39788b", "strip_prefix": "jdk-11.0.15+10", @@ -2485,7 +2582,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk17_linux_aarch64", "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 17,\n)\n", "sha256": "6531cef61e416d5a7b691555c8cf2bdff689201b8a001ff45ab6740062b44313", "strip_prefix": "zulu17.44.53-ca-jdk17.0.8.1-linux_aarch64", @@ -2496,10 +2592,9 @@ } }, "remotejdk17_win_arm64_toolchain_config_repo": { - "bzlFile": "@@rules_java~7.1.0//toolchains:remote_java_repository.bzl", + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk17_win_arm64_toolchain_config_repo", "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_17\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"17\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:windows\", \"@platforms//cpu:arm64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk17_win_arm64//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:windows\", \"@platforms//cpu:arm64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk17_win_arm64//:jdk\",\n)\n" } }, @@ -2507,7 +2602,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk11_linux", "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 11,\n)\n", "sha256": "a34b404f87a08a61148b38e1416d837189e1df7a040d949e743633daf4695a3c", "strip_prefix": "zulu11.66.15-ca-jdk11.0.20-linux_x64", @@ -2518,18 +2612,16 @@ } }, "remotejdk11_macos_toolchain_config_repo": { - "bzlFile": "@@rules_java~7.1.0//toolchains:remote_java_repository.bzl", + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk11_macos_toolchain_config_repo", "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_11\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"11\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk11_macos//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk11_macos//:jdk\",\n)\n" } }, "remotejdk17_linux_ppc64le_toolchain_config_repo": { - "bzlFile": "@@rules_java~7.1.0//toolchains:remote_java_repository.bzl", + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk17_linux_ppc64le_toolchain_config_repo", "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_17\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"17\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:ppc\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk17_linux_ppc64le//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:ppc\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk17_linux_ppc64le//:jdk\",\n)\n" } }, @@ -2537,7 +2629,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk17_win_arm64", "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 17,\n)\n", "sha256": "6802c99eae0d788e21f52d03cab2e2b3bf42bc334ca03cbf19f71eb70ee19f85", "strip_prefix": "zulu17.44.53-ca-jdk17.0.8.1-win_aarch64", @@ -2551,11 +2642,10 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_java~7.1.0~toolchains~remote_java_tools_darwin_arm64", - "sha256": "dab5bb87ec43e980faea6e1cec14bafb217b8e2f5346f53aa784fd715929a930", + "sha256": "076a7e198ad077f8c7d997986ef5102427fae6bbfce7a7852d2e080ed8767528", "urls": [ - "https://mirror.bazel.build/bazel_java_tools/releases/java/v13.1/java_tools_darwin_arm64-v13.1.zip", - "https://github.com/bazelbuild/java_tools/releases/download/java_v13.1/java_tools_darwin_arm64-v13.1.zip" + "https://mirror.bazel.build/bazel_java_tools/releases/java/v13.4/java_tools_darwin_arm64-v13.4.zip", + "https://github.com/bazelbuild/java_tools/releases/download/java_v13.4/java_tools_darwin_arm64-v13.4.zip" ] } }, @@ -2563,7 +2653,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk17_linux_ppc64le", "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 17,\n)\n", "sha256": "00a4c07603d0218cd678461b5b3b7e25b3253102da4022d31fc35907f21a2efd", "strip_prefix": "jdk-17.0.8.1+1", @@ -2574,26 +2663,23 @@ } }, "remotejdk21_linux_aarch64_toolchain_config_repo": { - "bzlFile": "@@rules_java~7.1.0//toolchains:remote_java_repository.bzl", + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk21_linux_aarch64_toolchain_config_repo", "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_21\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"21\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk21_linux_aarch64//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk21_linux_aarch64//:jdk\",\n)\n" } }, "remotejdk11_win_arm64_toolchain_config_repo": { - "bzlFile": "@@rules_java~7.1.0//toolchains:remote_java_repository.bzl", + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk11_win_arm64_toolchain_config_repo", "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_11\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"11\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:windows\", \"@platforms//cpu:arm64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk11_win_arm64//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:windows\", \"@platforms//cpu:arm64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk11_win_arm64//:jdk\",\n)\n" } }, "local_jdk": { - "bzlFile": "@@rules_java~7.1.0//toolchains:local_java_repository.bzl", + "bzlFile": "@@rules_java~//toolchains:local_java_repository.bzl", "ruleClassName": "_local_java_repository_rule", "attributes": { - "name": "rules_java~7.1.0~toolchains~local_jdk", "java_home": "", "version": "", "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = {RUNTIME_VERSION},\n)\n" @@ -2603,11 +2689,10 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_java~7.1.0~toolchains~remote_java_tools_darwin_x86_64", - "sha256": "0db40d8505a2b65ef0ed46e4256757807db8162f7acff16225be57c1d5726dbc", + "sha256": "4523aec4d09c587091a2dae6f5c9bc6922c220f3b6030e5aba9c8f015913cc65", "urls": [ - "https://mirror.bazel.build/bazel_java_tools/releases/java/v13.1/java_tools_darwin_x86_64-v13.1.zip", - "https://github.com/bazelbuild/java_tools/releases/download/java_v13.1/java_tools_darwin_x86_64-v13.1.zip" + "https://mirror.bazel.build/bazel_java_tools/releases/java/v13.4/java_tools_darwin_x86_64-v13.4.zip", + "https://github.com/bazelbuild/java_tools/releases/download/java_v13.4/java_tools_darwin_x86_64-v13.4.zip" ] } }, @@ -2615,11 +2700,10 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_java~7.1.0~toolchains~remote_java_tools", - "sha256": "286bdbbd66e616fc4ed3f90101418729a73baa7e8c23a98ffbef558f74c0ad14", + "sha256": "e025fd260ac39b47c111f5212d64ec0d00d85dec16e49368aae82fc626a940cf", "urls": [ - "https://mirror.bazel.build/bazel_java_tools/releases/java/v13.1/java_tools-v13.1.zip", - "https://github.com/bazelbuild/java_tools/releases/download/java_v13.1/java_tools-v13.1.zip" + "https://mirror.bazel.build/bazel_java_tools/releases/java/v13.4/java_tools-v13.4.zip", + "https://github.com/bazelbuild/java_tools/releases/download/java_v13.4/java_tools-v13.4.zip" ] } }, @@ -2627,7 +2711,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk17_linux_s390x", "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 17,\n)\n", "sha256": "ffacba69c6843d7ca70d572489d6cc7ab7ae52c60f0852cedf4cf0d248b6fc37", "strip_prefix": "jdk-17.0.8.1+1", @@ -2638,10 +2721,9 @@ } }, "remotejdk17_win_toolchain_config_repo": { - "bzlFile": "@@rules_java~7.1.0//toolchains:remote_java_repository.bzl", + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk17_win_toolchain_config_repo", "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_17\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"17\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:windows\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk17_win//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:windows\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk17_win//:jdk\",\n)\n" } }, @@ -2649,7 +2731,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk11_linux_ppc64le", "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 11,\n)\n", "sha256": "a8fba686f6eb8ae1d1a9566821dbd5a85a1108b96ad857fdbac5c1e4649fc56f", "strip_prefix": "jdk-11.0.15+10", @@ -2663,7 +2744,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk11_macos_aarch64", "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 11,\n)\n", "sha256": "7632bc29f8a4b7d492b93f3bc75a7b61630894db85d136456035ab2a24d38885", "strip_prefix": "zulu11.66.15-ca-jdk11.0.20-macosx_aarch64", @@ -2674,53 +2754,45 @@ } }, "remotejdk21_win_toolchain_config_repo": { - "bzlFile": "@@rules_java~7.1.0//toolchains:remote_java_repository.bzl", + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", "ruleClassName": "_toolchain_config", "attributes": { - "name": "rules_java~7.1.0~toolchains~remotejdk21_win_toolchain_config_repo", "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_21\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"21\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:windows\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk21_win//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:windows\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk21_win//:jdk\",\n)\n" } } - } + }, + "recordedRepoMappingEntries": [ + [ + "rules_java~", + "bazel_tools", + "bazel_tools" + ], + [ + "rules_java~", + "remote_java_tools", + "rules_java~~toolchains~remote_java_tools" + ] + ] } }, - "@@rules_python~0.27.1//python/extensions:python.bzl%python": { + "@@rules_python~//python/extensions:python.bzl%python": { "general": { - "bzlTransitiveDigest": "sBUIrhzhZtq8rynvWnwm1dcZK05YfGluNUI/gOjLs2A=", - "accumulatedFileDigests": {}, + "bzlTransitiveDigest": "QIgyqZIIKqo2p1U8K64RdUfCLCKWDVsrlc/GfE1CJho=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, "envVariables": {}, "generatedRepoSpecs": { "python_3_11_s390x-unknown-linux-gnu": { - "bzlFile": "@@rules_python~0.27.1//python:repositories.bzl", + "bzlFile": "@@rules_python~//python:repositories.bzl", "ruleClassName": "python_repository", "attributes": { - "name": "rules_python~0.27.1~python~python_3_11_s390x-unknown-linux-gnu", - "sha256": "f9f19823dba3209cedc4647b00f46ed0177242917db20fb7fb539970e384531c", + "sha256": "3f7a0dd64fa292977c4da09e865ee504a48e55dbc2dbfd9ff4b991af891e4446", "patches": [], "platform": "s390x-unknown-linux-gnu", - "python_version": "3.11.6", - "release_filename": "20231002/cpython-3.11.6+20231002-s390x-unknown-linux-gnu-install_only.tar.gz", - "urls": [ - "https://github.com/indygreg/python-build-standalone/releases/download/20231002/cpython-3.11.6+20231002-s390x-unknown-linux-gnu-install_only.tar.gz" - ], - "distutils_content": "", - "strip_prefix": "python", - "coverage_tool": "", - "ignore_root_user_error": false - } - }, - "python_3_11_aarch64-unknown-linux-gnu": { - "bzlFile": "@@rules_python~0.27.1//python:repositories.bzl", - "ruleClassName": "python_repository", - "attributes": { - "name": "rules_python~0.27.1~python~python_3_11_aarch64-unknown-linux-gnu", - "sha256": "3e26a672df17708c4dc928475a5974c3fb3a34a9b45c65fb4bd1e50504cc84ec", - "patches": [], - "platform": "aarch64-unknown-linux-gnu", - "python_version": "3.11.6", - "release_filename": "20231002/cpython-3.11.6+20231002-aarch64-unknown-linux-gnu-install_only.tar.gz", + "python_version": "3.11.9", + "release_filename": "20240415/cpython-3.11.9+20240415-s390x-unknown-linux-gnu-install_only.tar.gz", "urls": [ - "https://github.com/indygreg/python-build-standalone/releases/download/20231002/cpython-3.11.6+20231002-aarch64-unknown-linux-gnu-install_only.tar.gz" + "https://github.com/indygreg/python-build-standalone/releases/download/20240415/cpython-3.11.9+20240415-s390x-unknown-linux-gnu-install_only.tar.gz" ], "distutils_content": "", "strip_prefix": "python", @@ -2728,13 +2800,12 @@ "ignore_root_user_error": false } }, - "python_3_9": { - "bzlFile": "@@rules_python~0.27.1//python/private:toolchains_repo.bzl", - "ruleClassName": "toolchain_aliases", + "python_3_11_host": { + "bzlFile": "@@rules_python~//python/private:toolchains_repo.bzl", + "ruleClassName": "host_toolchain", "attributes": { - "name": "rules_python~0.27.1~python~python_3_9", - "python_version": "3.9.18", - "user_repository_name": "python_3_9", + "python_version": "3.11.9", + "user_repository_name": "python_3_11", "platforms": [ "aarch64-apple-darwin", "aarch64-unknown-linux-gnu", @@ -2746,61 +2817,34 @@ ] } }, - "python_3_11_aarch64-apple-darwin": { - "bzlFile": "@@rules_python~0.27.1//python:repositories.bzl", - "ruleClassName": "python_repository", - "attributes": { - "name": "rules_python~0.27.1~python~python_3_11_aarch64-apple-darwin", - "sha256": "916c35125b5d8323a21526d7a9154ca626453f63d0878e95b9f613a95006c990", - "patches": [], - "platform": "aarch64-apple-darwin", - "python_version": "3.11.6", - "release_filename": "20231002/cpython-3.11.6+20231002-aarch64-apple-darwin-install_only.tar.gz", - "urls": [ - "https://github.com/indygreg/python-build-standalone/releases/download/20231002/cpython-3.11.6+20231002-aarch64-apple-darwin-install_only.tar.gz" - ], - "distutils_content": "", - "strip_prefix": "python", - "coverage_tool": "", - "ignore_root_user_error": false - } - }, - "pythons_hub": { - "bzlFile": "@@rules_python~0.27.1//python/private/bzlmod:pythons_hub.bzl", - "ruleClassName": "hub_repo", + "python_3_11": { + "bzlFile": "@@rules_python~//python/private:toolchains_repo.bzl", + "ruleClassName": "toolchain_aliases", "attributes": { - "name": "rules_python~0.27.1~python~pythons_hub", - "default_python_version": "3.9", - "toolchain_prefixes": [ - "_0000_python_3_11_", - "_0001_python_3_9_" - ], - "toolchain_python_versions": [ - "3.11", - "3.9" - ], - "toolchain_set_python_version_constraints": [ - "True", - "False" - ], - "toolchain_user_repository_names": [ - "python_3_11", - "python_3_9" + "python_version": "3.11.9", + "user_repository_name": "python_3_11", + "platforms": [ + "aarch64-apple-darwin", + "aarch64-unknown-linux-gnu", + "ppc64le-unknown-linux-gnu", + "s390x-unknown-linux-gnu", + "x86_64-apple-darwin", + "x86_64-pc-windows-msvc", + "x86_64-unknown-linux-gnu" ] } }, - "python_3_11_x86_64-pc-windows-msvc": { - "bzlFile": "@@rules_python~0.27.1//python:repositories.bzl", + "python_3_11_aarch64-unknown-linux-gnu": { + "bzlFile": "@@rules_python~//python:repositories.bzl", "ruleClassName": "python_repository", "attributes": { - "name": "rules_python~0.27.1~python~python_3_11_x86_64-pc-windows-msvc", - "sha256": "3933545e6d41462dd6a47e44133ea40995bc6efeed8c2e4cbdf1a699303e95ea", + "sha256": "b3a7199ac2615d75fb906e5ba556432efcf24baf8651fc70370d9f052d4069ee", "patches": [], - "platform": "x86_64-pc-windows-msvc", - "python_version": "3.11.6", - "release_filename": "20231002/cpython-3.11.6+20231002-x86_64-pc-windows-msvc-shared-install_only.tar.gz", + "platform": "aarch64-unknown-linux-gnu", + "python_version": "3.11.9", + "release_filename": "20240415/cpython-3.11.9+20240415-aarch64-unknown-linux-gnu-install_only.tar.gz", "urls": [ - "https://github.com/indygreg/python-build-standalone/releases/download/20231002/cpython-3.11.6+20231002-x86_64-pc-windows-msvc-shared-install_only.tar.gz" + "https://github.com/indygreg/python-build-standalone/releases/download/20240415/cpython-3.11.9+20240415-aarch64-unknown-linux-gnu-install_only.tar.gz" ], "distutils_content": "", "strip_prefix": "python", @@ -2808,37 +2852,17 @@ "ignore_root_user_error": false } }, - "python_3_9_aarch64-apple-darwin": { - "bzlFile": "@@rules_python~0.27.1//python:repositories.bzl", + "python_3_11_aarch64-apple-darwin": { + "bzlFile": "@@rules_python~//python:repositories.bzl", "ruleClassName": "python_repository", "attributes": { - "name": "rules_python~0.27.1~python~python_3_9_aarch64-apple-darwin", - "sha256": "fdc4054837e37b69798c2ef796222a480bc1f80e8ad3a01a95d0168d8282a007", + "sha256": "7af7058f7c268b4d87ed7e08c2c7844ef8460863b3e679db3afdce8bb1eedfae", "patches": [], "platform": "aarch64-apple-darwin", - "python_version": "3.9.18", - "release_filename": "20231002/cpython-3.9.18+20231002-aarch64-apple-darwin-install_only.tar.gz", - "urls": [ - "https://github.com/indygreg/python-build-standalone/releases/download/20231002/cpython-3.9.18+20231002-aarch64-apple-darwin-install_only.tar.gz" - ], - "distutils_content": "", - "strip_prefix": "python", - "coverage_tool": "", - "ignore_root_user_error": false - } - }, - "python_3_9_x86_64-pc-windows-msvc": { - "bzlFile": "@@rules_python~0.27.1//python:repositories.bzl", - "ruleClassName": "python_repository", - "attributes": { - "name": "rules_python~0.27.1~python~python_3_9_x86_64-pc-windows-msvc", - "sha256": "02ea7bb64524886bd2b05d6b6be4401035e4ba4319146f274f0bcd992822cd75", - "patches": [], - "platform": "x86_64-pc-windows-msvc", - "python_version": "3.9.18", - "release_filename": "20231002/cpython-3.9.18+20231002-x86_64-pc-windows-msvc-shared-install_only.tar.gz", + "python_version": "3.11.9", + "release_filename": "20240415/cpython-3.11.9+20240415-aarch64-apple-darwin-install_only.tar.gz", "urls": [ - "https://github.com/indygreg/python-build-standalone/releases/download/20231002/cpython-3.9.18+20231002-x86_64-pc-windows-msvc-shared-install_only.tar.gz" + "https://github.com/indygreg/python-build-standalone/releases/download/20240415/cpython-3.11.9+20240415-aarch64-apple-darwin-install_only.tar.gz" ], "distutils_content": "", "strip_prefix": "python", @@ -2846,18 +2870,17 @@ "ignore_root_user_error": false } }, - "python_3_9_ppc64le-unknown-linux-gnu": { - "bzlFile": "@@rules_python~0.27.1//python:repositories.bzl", + "python_3_11_ppc64le-unknown-linux-gnu": { + "bzlFile": "@@rules_python~//python:repositories.bzl", "ruleClassName": "python_repository", "attributes": { - "name": "rules_python~0.27.1~python~python_3_9_ppc64le-unknown-linux-gnu", - "sha256": "101c38b22fb2f5a0945156da4259c8e9efa0c08de9d7f59afa51e7ce6e22a1cc", + "sha256": "03f62d1e2d400c9662cdd12ae33a6f328c34ae8e2b872f8563a144834742bd6a", "patches": [], "platform": "ppc64le-unknown-linux-gnu", - "python_version": "3.9.18", - "release_filename": "20231002/cpython-3.9.18+20231002-ppc64le-unknown-linux-gnu-install_only.tar.gz", + "python_version": "3.11.9", + "release_filename": "20240415/cpython-3.11.9+20240415-ppc64le-unknown-linux-gnu-install_only.tar.gz", "urls": [ - "https://github.com/indygreg/python-build-standalone/releases/download/20231002/cpython-3.9.18+20231002-ppc64le-unknown-linux-gnu-install_only.tar.gz" + "https://github.com/indygreg/python-build-standalone/releases/download/20240415/cpython-3.11.9+20240415-ppc64le-unknown-linux-gnu-install_only.tar.gz" ], "distutils_content": "", "strip_prefix": "python", @@ -2865,18 +2888,17 @@ "ignore_root_user_error": false } }, - "python_3_9_aarch64-unknown-linux-gnu": { - "bzlFile": "@@rules_python~0.27.1//python:repositories.bzl", + "python_3_11_x86_64-apple-darwin": { + "bzlFile": "@@rules_python~//python:repositories.bzl", "ruleClassName": "python_repository", "attributes": { - "name": "rules_python~0.27.1~python~python_3_9_aarch64-unknown-linux-gnu", - "sha256": "1e0a3e8ce8e58901a259748c0ab640d2b8294713782d14229e882c6898b2fb36", + "sha256": "9afd734f63a23783cf0257bef25c9231ffc80e7747486dc54cf72f325213fd15", "patches": [], - "platform": "aarch64-unknown-linux-gnu", - "python_version": "3.9.18", - "release_filename": "20231002/cpython-3.9.18+20231002-aarch64-unknown-linux-gnu-install_only.tar.gz", + "platform": "x86_64-apple-darwin", + "python_version": "3.11.9", + "release_filename": "20240415/cpython-3.11.9+20240415-x86_64-apple-darwin-install_only.tar.gz", "urls": [ - "https://github.com/indygreg/python-build-standalone/releases/download/20231002/cpython-3.9.18+20231002-aarch64-unknown-linux-gnu-install_only.tar.gz" + "https://github.com/indygreg/python-build-standalone/releases/download/20240415/cpython-3.11.9+20240415-x86_64-apple-darwin-install_only.tar.gz" ], "distutils_content": "", "strip_prefix": "python", @@ -2884,123 +2906,45 @@ "ignore_root_user_error": false } }, - "python_3_11": { - "bzlFile": "@@rules_python~0.27.1//python/private:toolchains_repo.bzl", - "ruleClassName": "toolchain_aliases", - "attributes": { - "name": "rules_python~0.27.1~python~python_3_11", - "python_version": "3.11.6", - "user_repository_name": "python_3_11", - "platforms": [ - "aarch64-apple-darwin", - "aarch64-unknown-linux-gnu", - "ppc64le-unknown-linux-gnu", - "s390x-unknown-linux-gnu", - "x86_64-apple-darwin", - "x86_64-pc-windows-msvc", - "x86_64-unknown-linux-gnu" - ] - } - }, - "python_3_11_ppc64le-unknown-linux-gnu": { - "bzlFile": "@@rules_python~0.27.1//python:repositories.bzl", - "ruleClassName": "python_repository", + "pythons_hub": { + "bzlFile": "@@rules_python~//python/private/bzlmod:pythons_hub.bzl", + "ruleClassName": "hub_repo", "attributes": { - "name": "rules_python~0.27.1~python~python_3_11_ppc64le-unknown-linux-gnu", - "sha256": "7937035f690a624dba4d014ffd20c342e843dd46f89b0b0a1e5726b85deb8eaf", - "patches": [], - "platform": "ppc64le-unknown-linux-gnu", - "python_version": "3.11.6", - "release_filename": "20231002/cpython-3.11.6+20231002-ppc64le-unknown-linux-gnu-install_only.tar.gz", - "urls": [ - "https://github.com/indygreg/python-build-standalone/releases/download/20231002/cpython-3.11.6+20231002-ppc64le-unknown-linux-gnu-install_only.tar.gz" + "default_python_version": "3.11", + "toolchain_prefixes": [ + "_0000_python_3_11_" ], - "distutils_content": "", - "strip_prefix": "python", - "coverage_tool": "", - "ignore_root_user_error": false - } - }, - "python_3_11_x86_64-apple-darwin": { - "bzlFile": "@@rules_python~0.27.1//python:repositories.bzl", - "ruleClassName": "python_repository", - "attributes": { - "name": "rules_python~0.27.1~python~python_3_11_x86_64-apple-darwin", - "sha256": "178cb1716c2abc25cb56ae915096c1a083e60abeba57af001996e8bc6ce1a371", - "patches": [], - "platform": "x86_64-apple-darwin", - "python_version": "3.11.6", - "release_filename": "20231002/cpython-3.11.6+20231002-x86_64-apple-darwin-install_only.tar.gz", - "urls": [ - "https://github.com/indygreg/python-build-standalone/releases/download/20231002/cpython-3.11.6+20231002-x86_64-apple-darwin-install_only.tar.gz" + "toolchain_python_versions": [ + "3.11" ], - "distutils_content": "", - "strip_prefix": "python", - "coverage_tool": "", - "ignore_root_user_error": false + "toolchain_set_python_version_constraints": [ + "False" + ], + "toolchain_user_repository_names": [ + "python_3_11" + ] } }, "python_versions": { - "bzlFile": "@@rules_python~0.27.1//python/private:toolchains_repo.bzl", + "bzlFile": "@@rules_python~//python/private:toolchains_repo.bzl", "ruleClassName": "multi_toolchain_aliases", "attributes": { - "name": "rules_python~0.27.1~python~python_versions", "python_versions": { - "3.9": "python_3_9", "3.11": "python_3_11" } } }, - "python_3_9_x86_64-apple-darwin": { - "bzlFile": "@@rules_python~0.27.1//python:repositories.bzl", - "ruleClassName": "python_repository", - "attributes": { - "name": "rules_python~0.27.1~python~python_3_9_x86_64-apple-darwin", - "sha256": "82231cb77d4a5c8081a1a1d5b8ae440abe6993514eb77a926c826e9a69a94fb1", - "patches": [], - "platform": "x86_64-apple-darwin", - "python_version": "3.9.18", - "release_filename": "20231002/cpython-3.9.18+20231002-x86_64-apple-darwin-install_only.tar.gz", - "urls": [ - "https://github.com/indygreg/python-build-standalone/releases/download/20231002/cpython-3.9.18+20231002-x86_64-apple-darwin-install_only.tar.gz" - ], - "distutils_content": "", - "strip_prefix": "python", - "coverage_tool": "", - "ignore_root_user_error": false - } - }, - "python_3_9_x86_64-unknown-linux-gnu": { - "bzlFile": "@@rules_python~0.27.1//python:repositories.bzl", - "ruleClassName": "python_repository", - "attributes": { - "name": "rules_python~0.27.1~python~python_3_9_x86_64-unknown-linux-gnu", - "sha256": "f3ff38b1ccae7dcebd8bbf2e533c9a984fac881de0ffd1636fbb61842bd924de", - "patches": [], - "platform": "x86_64-unknown-linux-gnu", - "python_version": "3.9.18", - "release_filename": "20231002/cpython-3.9.18+20231002-x86_64-unknown-linux-gnu-install_only.tar.gz", - "urls": [ - "https://github.com/indygreg/python-build-standalone/releases/download/20231002/cpython-3.9.18+20231002-x86_64-unknown-linux-gnu-install_only.tar.gz" - ], - "distutils_content": "", - "strip_prefix": "python", - "coverage_tool": "", - "ignore_root_user_error": false - } - }, - "python_3_9_s390x-unknown-linux-gnu": { - "bzlFile": "@@rules_python~0.27.1//python:repositories.bzl", + "python_3_11_x86_64-pc-windows-msvc": { + "bzlFile": "@@rules_python~//python:repositories.bzl", "ruleClassName": "python_repository", "attributes": { - "name": "rules_python~0.27.1~python~python_3_9_s390x-unknown-linux-gnu", - "sha256": "eee31e55ffbc1f460d7b17f05dd89e45a2636f374a6f8dc29ea13d0497f7f586", + "sha256": "368474c69f476e7de4adaf50b61d9fcf6ec8b4db88cc43c5f71c860b3cd29c69", "patches": [], - "platform": "s390x-unknown-linux-gnu", - "python_version": "3.9.18", - "release_filename": "20231002/cpython-3.9.18+20231002-s390x-unknown-linux-gnu-install_only.tar.gz", + "platform": "x86_64-pc-windows-msvc", + "python_version": "3.11.9", + "release_filename": "20240415/cpython-3.11.9+20240415-x86_64-pc-windows-msvc-shared-install_only.tar.gz", "urls": [ - "https://github.com/indygreg/python-build-standalone/releases/download/20231002/cpython-3.9.18+20231002-s390x-unknown-linux-gnu-install_only.tar.gz" + "https://github.com/indygreg/python-build-standalone/releases/download/20240415/cpython-3.11.9+20240415-x86_64-pc-windows-msvc-shared-install_only.tar.gz" ], "distutils_content": "", "strip_prefix": "python", @@ -3009,17 +2953,16 @@ } }, "python_3_11_x86_64-unknown-linux-gnu": { - "bzlFile": "@@rules_python~0.27.1//python:repositories.bzl", + "bzlFile": "@@rules_python~//python:repositories.bzl", "ruleClassName": "python_repository", "attributes": { - "name": "rules_python~0.27.1~python~python_3_11_x86_64-unknown-linux-gnu", - "sha256": "ee37a7eae6e80148c7e3abc56e48a397c1664f044920463ad0df0fc706eacea8", + "sha256": "78b1c16a9fd032997ba92a60f46a64f795cd18ff335659dfdf6096df277b24d5", "patches": [], "platform": "x86_64-unknown-linux-gnu", - "python_version": "3.11.6", - "release_filename": "20231002/cpython-3.11.6+20231002-x86_64-unknown-linux-gnu-install_only.tar.gz", + "python_version": "3.11.9", + "release_filename": "20240415/cpython-3.11.9+20240415-x86_64-unknown-linux-gnu-install_only.tar.gz", "urls": [ - "https://github.com/indygreg/python-build-standalone/releases/download/20231002/cpython-3.11.6+20231002-x86_64-unknown-linux-gnu-install_only.tar.gz" + "https://github.com/indygreg/python-build-standalone/releases/download/20240415/cpython-3.11.9+20240415-x86_64-unknown-linux-gnu-install_only.tar.gz" ], "distutils_content": "", "strip_prefix": "python", @@ -3027,20 +2970,32 @@ "ignore_root_user_error": false } } - } + }, + "recordedRepoMappingEntries": [ + [ + "rules_python~", + "bazel_skylib", + "bazel_skylib~" + ], + [ + "rules_python~", + "bazel_tools", + "bazel_tools" + ] + ] } }, - "@@rules_python~0.27.1//python/private/bzlmod:internal_deps.bzl%internal_deps": { + "@@rules_python~//python/private/bzlmod:internal_deps.bzl%internal_deps": { "general": { - "bzlTransitiveDigest": "xr7pKQvGhawsuA61pquXxuhuxlzM5QyWfF9UXfyr2Y4=", - "accumulatedFileDigests": {}, + "bzlTransitiveDigest": "fDqhuyt2dROfO6qL4WlobPgyJCNlwP0fPCgW6fEpFMg=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, "envVariables": {}, "generatedRepoSpecs": { "pypi__wheel": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_python~0.27.1~internal_deps~pypi__wheel", "url": "https://files.pythonhosted.org/packages/b8/8b/31273bf66016be6ad22bb7345c37ff350276cfd46e389a0c2ac5da9d9073/wheel-0.41.2-py3-none-any.whl", "sha256": "75909db2664838d015e3d9139004ee16711748a52c8f336b52882266540215d8", "type": "zip", @@ -3051,7 +3006,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_python~0.27.1~internal_deps~pypi__click", "url": "https://files.pythonhosted.org/packages/00/2e/d53fa4befbf2cfa713304affc7ca780ce4fc1fd8710527771b58311a3229/click-8.1.7-py3-none-any.whl", "sha256": "ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28", "type": "zip", @@ -3062,7 +3016,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_python~0.27.1~internal_deps~pypi__importlib_metadata", "url": "https://files.pythonhosted.org/packages/cc/37/db7ba97e676af155f5fcb1a35466f446eadc9104e25b83366e8088c9c926/importlib_metadata-6.8.0-py3-none-any.whl", "sha256": "3ebb78df84a805d7698245025b975d9d67053cd94c79245ba4b3eb694abe68bb", "type": "zip", @@ -3073,7 +3026,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_python~0.27.1~internal_deps~pypi__pyproject_hooks", "url": "https://files.pythonhosted.org/packages/d5/ea/9ae603de7fbb3df820b23a70f6aff92bf8c7770043254ad8d2dc9d6bcba4/pyproject_hooks-1.0.0-py3-none-any.whl", "sha256": "283c11acd6b928d2f6a7c73fa0d01cb2bdc5f07c57a2eeb6e83d5e56b97976f8", "type": "zip", @@ -3084,7 +3036,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_python~0.27.1~internal_deps~pypi__pep517", "url": "https://files.pythonhosted.org/packages/ee/2f/ef63e64e9429111e73d3d6cbee80591672d16f2725e648ebc52096f3d323/pep517-0.13.0-py3-none-any.whl", "sha256": "4ba4446d80aed5b5eac6509ade100bff3e7943a8489de249654a5ae9b33ee35b", "type": "zip", @@ -3095,7 +3046,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_python~0.27.1~internal_deps~pypi__packaging", "url": "https://files.pythonhosted.org/packages/ab/c3/57f0601a2d4fe15de7a553c00adbc901425661bf048f2a22dfc500caf121/packaging-23.1-py3-none-any.whl", "sha256": "994793af429502c4ea2ebf6bf664629d07c1a9fe974af92966e4b8d2df7edc61", "type": "zip", @@ -3106,9 +3056,8 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_python~0.27.1~internal_deps~pypi__pip_tools", - "url": "https://files.pythonhosted.org/packages/e8/df/47e6267c6b5cdae867adbdd84b437393e6202ce4322de0a5e0b92960e1d6/pip_tools-7.3.0-py3-none-any.whl", - "sha256": "8717693288720a8c6ebd07149c93ab0be1fced0b5191df9e9decd3263e20d85e", + "url": "https://files.pythonhosted.org/packages/0d/dc/38f4ce065e92c66f058ea7a368a9c5de4e702272b479c0992059f7693941/pip_tools-7.4.1-py3-none-any.whl", + "sha256": "4c690e5fbae2f21e87843e89c26191f0d9454f362d8acdbd695716493ec8b3a9", "type": "zip", "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:defs.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude in /python/pip_install/tools/bazel.py\n # to avoid non-determinism following pip install's behavior.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/* *\",\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" } @@ -3117,7 +3066,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_python~0.27.1~internal_deps~pypi__setuptools", "url": "https://files.pythonhosted.org/packages/4f/ab/0bcfebdfc3bfa8554b2b2c97a555569c4c1ebc74ea288741ea8326c51906/setuptools-68.1.2-py3-none-any.whl", "sha256": "3d8083eed2d13afc9426f227b24fd1659489ec107c0e86cec2ffdde5c92e790b", "type": "zip", @@ -3128,7 +3076,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_python~0.27.1~internal_deps~pypi__zipp", "url": "https://files.pythonhosted.org/packages/8c/08/d3006317aefe25ea79d3b76c9650afabaf6d63d1c8443b236e7405447503/zipp-3.16.2-py3-none-any.whl", "sha256": "679e51dd4403591b2d6838a48de3d283f3d188412a9782faadf845f298736ba0", "type": "zip", @@ -3139,7 +3086,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_python~0.27.1~internal_deps~pypi__colorama", "url": "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", "sha256": "4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", "type": "zip", @@ -3150,25 +3096,21 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_python~0.27.1~internal_deps~pypi__build", - "url": "https://files.pythonhosted.org/packages/58/91/17b00d5fac63d3dca605f1b8269ba3c65e98059e1fd99d00283e42a454f0/build-0.10.0-py3-none-any.whl", - "sha256": "af266720050a66c893a6096a2f410989eeac74ff9a68ba194b3f6473e8e26171", + "url": "https://files.pythonhosted.org/packages/e2/03/f3c8ba0a6b6e30d7d18c40faab90807c9bb5e9a1e3b2fe2008af624a9c97/build-1.2.1-py3-none-any.whl", + "sha256": "75e10f767a433d9a86e50d83f418e83efc18ede923ee5ff7df93b6cb0306c5d4", "type": "zip", "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:defs.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude in /python/pip_install/tools/bazel.py\n # to avoid non-determinism following pip install's behavior.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/* *\",\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" } }, "rules_python_internal": { - "bzlFile": "@@rules_python~0.27.1//python/private:internal_config_repo.bzl", + "bzlFile": "@@rules_python~//python/private:internal_config_repo.bzl", "ruleClassName": "internal_config_repo", - "attributes": { - "name": "rules_python~0.27.1~internal_deps~rules_python_internal" - } + "attributes": {} }, "pypi__pip": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_python~0.27.1~internal_deps~pypi__pip", "url": "https://files.pythonhosted.org/packages/50/c2/e06851e8cc28dcad7c155f4753da8833ac06a5c704c109313b8d5a62968a/pip-23.2.1-py3-none-any.whl", "sha256": "7ccf472345f20d35bdc9d1841ff5f313260c2c33fe417f48c30ac46cccabf5be", "type": "zip", @@ -3179,7 +3121,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_python~0.27.1~internal_deps~pypi__installer", "url": "https://files.pythonhosted.org/packages/e5/ca/1172b6638d52f2d6caa2dd262ec4c811ba59eee96d54a7701930726bce18/installer-0.7.0-py3-none-any.whl", "sha256": "05d1933f0a5ba7d8d6296bb6d5018e7c94fa473ceb10cf198a92ccea19c27b53", "type": "zip", @@ -3190,7 +3131,6 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_python~0.27.1~internal_deps~pypi__more_itertools", "url": "https://files.pythonhosted.org/packages/5a/cb/6dce742ea14e47d6f565589e859ad225f2a5de576d7696e0623b784e226b/more_itertools-10.1.0-py3-none-any.whl", "sha256": "64e0735fcfdc6f3464ea133afe8ea4483b1c5fe3a3d69852e6503b43a0b222e6", "type": "zip", @@ -3201,14 +3141,20 @@ "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", "attributes": { - "name": "rules_python~0.27.1~internal_deps~pypi__tomli", "url": "https://files.pythonhosted.org/packages/97/75/10a9ebee3fd790d20926a90a2547f0bf78f371b2f13aa822c759680ca7b9/tomli-2.0.1-py3-none-any.whl", "sha256": "939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc", "type": "zip", "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:defs.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude in /python/pip_install/tools/bazel.py\n # to avoid non-determinism following pip install's behavior.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/* *\",\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" } } - } + }, + "recordedRepoMappingEntries": [ + [ + "rules_python~", + "bazel_tools", + "bazel_tools" + ] + ] } } } diff --git a/WORKSPACE b/WORKSPACE index 5f26926..d9f0645 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1,65 +1,44 @@ -# Copyright 2023 The benchsci Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -workspace(name = "com_github_benchsci_rules_python_gazelle") +workspace(name = "rules_python_gazelle_plugin") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "io_bazel_rules_go", - sha256 = "91585017debb61982f7054c9688857a2ad1fd823fc3f9cb05048b0025c47d023", + sha256 = "278b7ff5a826f3dc10f04feaf0b70d48b68748ccd512d7f98bf442077f043fe3", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.42.0/rules_go-v0.42.0.zip", - "https://github.com/bazelbuild/rules_go/releases/download/v0.42.0/rules_go-v0.42.0.zip", + "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.41.0/rules_go-v0.41.0.zip", + "https://github.com/bazelbuild/rules_go/releases/download/v0.41.0/rules_go-v0.41.0.zip", ], ) http_archive( name = "bazel_gazelle", - sha256 = "b7387f72efb59f876e4daae42f1d3912d0d45563eac7cb23d1de0b094ab588cf", + sha256 = "29d5dafc2a5582995488c6735115d1d366fcd6a0fc2e2a153f02988706349825", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.34.0/bazel-gazelle-v0.34.0.tar.gz", - "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.34.0/bazel-gazelle-v0.34.0.tar.gz", + "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.31.0/bazel-gazelle-v0.31.0.tar.gz", + "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.31.0/bazel-gazelle-v0.31.0.tar.gz", ], ) -load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") -load("//gazelle:deps.bzl", "gazelle_deps") - -# gazelle:repository_macro gazelle/deps.bzl%gazelle_deps -gazelle_deps() +load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") go_rules_dependencies() -go_register_toolchains(version = "1.20.5") +go_register_toolchains(version = "1.19.4") gazelle_dependencies() -http_archive( +local_repository( name = "rules_python", - sha256 = "9d04041ac92a0985e344235f5d946f71ac543f1b1565f2cdbc9a2aaee8adf55b", - strip_prefix = "rules_python-0.26.0", - url = "https://github.com/bazelbuild/rules_python/releases/download/0.26.0/rules_python-0.26.0.tar.gz", + path = "..", ) -load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains") - -# Add python 3.11 toolchain -python_register_toolchains( - name = "python_3_11", - python_version = "3.11", -) +load("@rules_python//python:repositories.bzl", "py_repositories") py_repositories() + +load("//:deps.bzl", _py_gazelle_deps = "gazelle_deps") + +# gazelle:repository_macro deps.bzl%go_deps +_py_gazelle_deps() diff --git a/def.bzl b/def.bzl new file mode 100644 index 0000000..084b5a4 --- /dev/null +++ b/def.bzl @@ -0,0 +1,19 @@ +# Copyright 2023 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This module contains the Gazelle runtime dependencies for the Python extension. +""" + +GAZELLE_PYTHON_RUNTIME_DEPS = [ +] diff --git a/gazelle/deps.bzl b/deps.bzl similarity index 61% rename from gazelle/deps.bzl rename to deps.bzl index 63ad6c3..f4f4c24 100644 --- a/gazelle/deps.bzl +++ b/deps.bzl @@ -1,6 +1,68 @@ -load("@bazel_gazelle//:deps.bzl", "go_repository") +# Copyright 2023 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"This file managed by `bazel run //:gazelle_update_repos`" + +load( + "@bazel_gazelle//:deps.bzl", + _go_repository = "go_repository", +) +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file") + +def go_repository(name, **kwargs): + if name not in native.existing_rules(): + _go_repository(name = name, **kwargs) + +def python_stdlib_list_deps(): + "Fetch python stdlib list dependencies" + http_file( + name = "python_stdlib_list_3_8", + sha256 = "ee6dc367011ff298b906dbaab408940aa57086d5f8f47278f4b7523b9aa13ae3", + url = "https://raw.githubusercontent.com/pypi/stdlib-list/8cbc2067a4a0f9eee57fb541e4cd7727724b7db4/stdlib_list/lists/3.8.txt", + downloaded_file_path = "3.8.txt", + ) + http_file( + name = "python_stdlib_list_3_9", + sha256 = "a4340e5ffe2e75bb18f548028cef6e6ac15384c44ae0a776e04dd869da1d1fd7", + url = "https://raw.githubusercontent.com/pypi/stdlib-list/8cbc2067a4a0f9eee57fb541e4cd7727724b7db4/stdlib_list/lists/3.9.txt", + downloaded_file_path = "3.9.txt", + ) + http_file( + name = "python_stdlib_list_3_10", + sha256 = "0b867738b78ac98944237de2600093a1c6ef259d1810017e46f01a29f3d199e7", + url = "https://raw.githubusercontent.com/pypi/stdlib-list/8cbc2067a4a0f9eee57fb541e4cd7727724b7db4/stdlib_list/lists/3.10.txt", + downloaded_file_path = "3.10.txt", + ) + http_file( + name = "python_stdlib_list_3_11", + sha256 = "3c1dbf991b17178d6ed3772f4fa8f64302feaf9c3385fef328a0c7ab736a79b1", + url = "https://raw.githubusercontent.com/pypi/stdlib-list/8cbc2067a4a0f9eee57fb541e4cd7727724b7db4/stdlib_list/lists/3.11.txt", + downloaded_file_path = "3.11.txt", + ) + http_file( + name = "python_stdlib_list_3_12", + sha256 = "6d3d53194218b43ee1d04bf9a4f0b6a9309bb59cdcaddede7d9cfe8b6835d34a", + url = "https://raw.githubusercontent.com/pypi/stdlib-list/8cbc2067a4a0f9eee57fb541e4cd7727724b7db4/stdlib_list/lists/3.12.txt", + downloaded_file_path = "3.12.txt", + ) def gazelle_deps(): + go_deps() + python_stdlib_list_deps() + +def go_deps(): + "Fetch go dependencies" go_repository( name = "co_honnef_go_tools", importpath = "honnef.co/go/tools", @@ -10,14 +72,16 @@ def gazelle_deps(): go_repository( name = "com_github_bazelbuild_bazel_gazelle", importpath = "github.com/bazelbuild/bazel-gazelle", - sum = "h1:WnJGYk1bMIjw8FCYA/UxKBK/Y6hUnOItrtR+vjFIIKo=", - version = "v0.33.0", + sum = "h1:ROyUyUHzoEdvoOs1e0haxJx1l5EjZX6AOqiKdVlaBbg=", + version = "v0.31.1", ) + go_repository( name = "com_github_bazelbuild_buildtools", + build_naming_convention = "go_default_library", importpath = "github.com/bazelbuild/buildtools", - sum = "h1:6Z/4LXt5mdhuFAx4QhwM0D5pTs1ljYGmhgF3O9OCMF0=", - version = "v0.0.0-20230831140646-386244e73fc4", + sum = "h1:HTepWP/jhtWTC1gvK0RnvKCgjh4gLqiwaOwGozAXcbw=", + version = "v0.0.0-20231103205921-433ea8554e82", ) go_repository( name = "com_github_bazelbuild_rules_go", @@ -25,12 +89,14 @@ def gazelle_deps(): sum = "h1:JzlRxsFNhlX+g4drDRPhIaU5H5LnI978wdMJ0vK4I+k=", version = "v0.41.0", ) + go_repository( name = "com_github_bmatcuk_doublestar_v4", importpath = "github.com/bmatcuk/doublestar/v4", - sum = "h1:HTuxyug8GyFbRkrffIpzNCSK4luc0TY3wzXvzIZhEXc=", - version = "v4.6.0", + sum = "h1:FH9SifrbvJhnlQpztAx++wlkk70QBf0iBWDwNy7PA4I=", + version = "v4.6.1", ) + go_repository( name = "com_github_burntsushi_toml", importpath = "github.com/BurntSushi/toml", @@ -67,11 +133,18 @@ def gazelle_deps(): sum = "h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI=", version = "v0.3.4", ) + go_repository( + name = "com_github_davecgh_go_spew", + importpath = "github.com/davecgh/go-spew", + sum = "h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=", + version = "v1.1.1", + ) + go_repository( name = "com_github_emirpasic_gods", importpath = "github.com/emirpasic/gods", - sum = "h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg=", - version = "v1.12.0", + sum = "h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=", + version = "v1.18.1", ) go_repository( name = "com_github_envoyproxy_go_control_plane", @@ -91,6 +164,7 @@ def gazelle_deps(): sum = "h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=", version = "v1.6.0", ) + go_repository( name = "com_github_ghodss_yaml", importpath = "github.com/ghodss/yaml", @@ -121,42 +195,44 @@ def gazelle_deps(): sum = "h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=", version = "v0.5.9", ) - go_repository( - name = "com_github_google_uuid", - importpath = "github.com/google/uuid", - sum = "h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=", - version = "v1.3.0", - ) - go_repository( - name = "com_github_kr_pretty", - importpath = "github.com/kr/pretty", - sum = "h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=", - version = "v0.1.0", - ) - go_repository( - name = "com_github_kr_pty", - importpath = "github.com/kr/pty", - sum = "h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=", - version = "v1.1.1", - ) - go_repository( - name = "com_github_kr_text", - importpath = "github.com/kr/text", - sum = "h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=", - version = "v0.1.0", - ) go_repository( name = "com_github_pmezard_go_difflib", importpath = "github.com/pmezard/go-difflib", sum = "h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=", version = "v1.0.0", ) + go_repository( name = "com_github_prometheus_client_model", importpath = "github.com/prometheus/client_model", sum = "h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM=", version = "v0.0.0-20190812154241-14fe0d1b01d4", ) + go_repository( + name = "com_github_smacker_go_tree_sitter", + importpath = "github.com/smacker/go-tree-sitter", + sum = "h1:7QZKUmQfnxncZIJGyvX8M8YeMfn8kM10j3J/2KwVTN4=", + version = "v0.0.0-20240422154435-0628b34cbf9c", + ) + go_repository( + name = "com_github_stretchr_objx", + importpath = "github.com/stretchr/objx", + sum = "h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=", + version = "v0.5.2", + ) + go_repository( + name = "com_github_stretchr_testify", + importpath = "github.com/stretchr/testify", + sum = "h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=", + version = "v1.9.0", + ) + + go_repository( + name = "com_github_yuin_goldmark", + importpath = "github.com/yuin/goldmark", + sum = "h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE=", + version = "v1.4.13", + ) go_repository( name = "com_google_cloud_go", importpath = "cloud.google.com/go", @@ -166,15 +242,22 @@ def gazelle_deps(): go_repository( name = "in_gopkg_check_v1", importpath = "gopkg.in/check.v1", - sum = "h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=", - version = "v1.0.0-20180628173108-788fd7840127", + sum = "h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=", + version = "v0.0.0-20161208181325-20d25e280405", ) go_repository( name = "in_gopkg_yaml_v2", importpath = "gopkg.in/yaml.v2", - sum = "h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=", - version = "v2.2.8", + sum = "h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=", + version = "v2.4.0", ) + go_repository( + name = "in_gopkg_yaml_v3", + importpath = "gopkg.in/yaml.v3", + sum = "h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=", + version = "v3.0.1", + ) + go_repository( name = "net_starlark_go", importpath = "go.starlark.net", @@ -226,14 +309,14 @@ def gazelle_deps(): go_repository( name = "org_golang_x_mod", importpath = "golang.org/x/mod", - sum = "h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=", - version = "v0.12.0", + sum = "h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk=", + version = "v0.10.0", ) go_repository( name = "org_golang_x_net", importpath = "golang.org/x/net", - sum = "h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0=", - version = "v0.0.0-20210405180319-a5a99cb37ef4", + sum = "h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=", + version = "v0.10.0", ) go_repository( name = "org_golang_x_oauth2", @@ -244,14 +327,14 @@ def gazelle_deps(): go_repository( name = "org_golang_x_sync", importpath = "golang.org/x/sync", - sum = "h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=", - version = "v0.3.0", + sum = "h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI=", + version = "v0.2.0", ) go_repository( name = "org_golang_x_sys", importpath = "golang.org/x/sys", - sum = "h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=", - version = "v0.12.0", + sum = "h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=", + version = "v0.8.0", ) go_repository( name = "org_golang_x_text", @@ -261,15 +344,12 @@ def gazelle_deps(): ) go_repository( name = "org_golang_x_tools", + build_directives = [ + "gazelle:exclude **/testdata/**/*", + ], importpath = "golang.org/x/tools", - sum = "h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU=", - version = "v0.1.12", - ) - go_repository( - name = "org_golang_x_tools_go_vcs", - importpath = "golang.org/x/tools/go/vcs", - sum = "h1:cOIJqWBl99H1dH5LWizPa+0ImeeJq3t3cJjaeOWUAL4=", - version = "v0.1.0-deprecated", + sum = "h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo=", + version = "v0.9.1", ) go_repository( name = "org_golang_x_xerrors", diff --git a/gazelle/BUILD.bazel b/gazelle/BUILD.bazel index d71ddbe..e2834ba 100644 --- a/gazelle/BUILD.bazel +++ b/gazelle/BUILD.bazel @@ -1,73 +1,4 @@ -load("@bazel_gazelle//:def.bzl", "gazelle_binary") -load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") -load("@rules_python//python:defs.bzl", "py_binary") - -go_library( - name = "gazelle", - srcs = [ - "configure.go", - "fix.go", - "generate.go", - "kinds.go", - "language.go", - "lifecycle.go", - "parser.go", - "resolve.go", - "std_modules.go", - "target.go", - ], - embedsrcs = [":helper.zip"], # keep - importpath = "github.com/benchsci/rules_python_gazelle/gazelle", - visibility = ["//visibility:public"], - deps = [ - "//gazelle/manifest", - "//gazelle/pythonconfig", - "@bazel_gazelle//config:go_default_library", - "@bazel_gazelle//label:go_default_library", - "@bazel_gazelle//language:go_default_library", - "@bazel_gazelle//repo:go_default_library", - "@bazel_gazelle//resolve:go_default_library", - "@bazel_gazelle//rule:go_default_library", - "@com_github_bazelbuild_buildtools//build:go_default_library", - "@com_github_emirpasic_gods//sets/treeset:go_default_library", - "@com_github_emirpasic_gods//utils:go_default_library", - "@com_github_google_uuid//:go_default_library", - "@io_bazel_rules_go//go/tools/bazel:go_default_library", - ], -) - -py_binary( - name = "parse", - srcs = ["parse.py"], - main = "parse.py", - visibility = ["//visibility:public"], -) - -py_binary( - name = "std_modules", - srcs = ["std_modules.py"], - main = "std_modules.py", - visibility = ["//visibility:public"], -) - -py_binary( - name = "helper", - srcs = [ - "__main__.py", - "parse.py", - "std_modules.py", - ], - # This is to make sure that the current directory is added to PYTHONPATH - imports = ["."], - main = "__main__.py", - visibility = ["//visibility:public"], -) - -filegroup( - name = "helper.zip", - srcs = [":helper"], - output_group = "python_zip_file", -) +load("@io_bazel_rules_go//go:def.bzl", "go_test") TEST_DEPS = [ "@bazel_gazelle//testtools:go_default_library", @@ -77,9 +8,7 @@ TEST_DEPS = [ ] TEST_DATA = [ - ":gazelle_python_binary", - ":parse", - ":std_modules", + "//python:gazelle_binary", ] [ @@ -92,13 +21,5 @@ TEST_DATA = [ for t in [ "simple", "django_test", - "pycheck", - "py_module", ] ] - -gazelle_binary( - name = "gazelle_python_binary", - languages = ["//gazelle"], - visibility = ["//visibility:public"], -) diff --git a/gazelle/README.md b/gazelle/README.md deleted file mode 100644 index 7d138e3..0000000 --- a/gazelle/README.md +++ /dev/null @@ -1,190 +0,0 @@ -# Python Gazelle plugin - -This directory contains a plugin for -[Gazelle](https://github.com/bazelbuild/bazel-gazelle) -that generates BUILD file content for Python code. - -## Installation - -First, you'll need to add Gazelle to your `WORKSPACE` file. -Follow the instructions at https://github.com/bazelbuild/bazel-gazelle#running-gazelle-with-bazel - -Next, we need to fetch the third-party Go libraries that the python extension -depends on. - -Add this to your `WORKSPACE`: - -```starlark -# To compile the rules_python gazelle extension from source, -# we must fetch some third-party go dependencies that it uses. -load("@rules_python//gazelle:deps.bzl", _py_gazelle_deps = "gazelle_deps") - -_py_gazelle_deps() -``` - -Next, we'll fetch metadata about your Python dependencies, so that gazelle can -determine which package a given import statement comes from. This is provided -by the `modules_mapping` rule. We'll make a target for consuming this -`modules_mapping`, and writing it as a manifest file for Gazelle to read. -This is checked into the repo for speed, as it takes some time to calculate -in a large monorepo. - -Create a file `gazelle_python.yaml` next to your `requirements.txt` -file. (You can just use `touch` at this point, it just needs to exist.) - -Then put this in your `BUILD.bazel` file next to the `requirements.txt`: - -```starlark -load("@pip//:requirements.bzl", "all_whl_requirements") -load("@rules_python//gazelle/manifest:defs.bzl", "gazelle_python_manifest") -load("@rules_python//gazelle/modules_mapping:def.bzl", "modules_mapping") - -# This rule fetches the metadata for python packages we depend on. That data is -# required for the gazelle_python_manifest rule to update our manifest file. -modules_mapping( - name = "modules_map", - wheels = all_whl_requirements, -) - -# Gazelle python extension needs a manifest file mapping from -# an import to the installed package that provides it. -# This macro produces two targets: -# - //:gazelle_python_manifest.update can be used with `bazel run` -# to recalculate the manifest -# - //:gazelle_python_manifest.test is a test target ensuring that -# the manifest doesn't need to be updated -gazelle_python_manifest( - name = "gazelle_python_manifest", - modules_mapping = ":modules_map", - # This is what we called our `pip_install` rule, where third-party - # python libraries are loaded in BUILD files. - pip_repository_name = "pip", - # When using pip_parse instead of pip_install, set the following. - # pip_repository_incremental = True, - # This should point to wherever we declare our python dependencies - # (the same as what we passed to the modules_mapping rule in WORKSPACE) - requirements = "//:requirements_lock.txt", -) -``` - -Finally, you create a target that you'll invoke to run the Gazelle tool -with the rules_python extension included. This typically goes in your root -`/BUILD.bazel` file: - -``` -load("@bazel_gazelle//:def.bzl", "gazelle") -load("@rules_python//gazelle:def.bzl", "GAZELLE_PYTHON_RUNTIME_DEPS") - -# Our gazelle target points to the python gazelle binary. -# This is the simple case where we only need one language supported. -# If you also had proto, go, or other gazelle-supported languages, -# you would also need a gazelle_binary rule. -# See https://github.com/bazelbuild/bazel-gazelle/blob/master/extend.rst#example -gazelle( - name = "gazelle", - data = GAZELLE_PYTHON_RUNTIME_DEPS, - gazelle = "@rules_python//gazelle:gazelle_python_binary", -) -``` - -That's it, now you can finally run `bazel run //:gazelle` anytime -you edit Python code, and it should update your `BUILD` files correctly. - -A fully-working example is in [`examples/build_file_generation`](examples/build_file_generation). - -## Usage - -Gazelle is non-destructive. -It will try to leave your edits to BUILD files alone, only making updates to `py_*` targets. -However it will remove dependencies that appear to be unused, so it's a -good idea to check in your work before running Gazelle so you can easily -revert any changes it made. - -The rules_python extension assumes some conventions about your Python code. -These are noted below, and might require changes to your existing code. - -Note that the `gazelle` program has multiple commands. At present, only the `update` command (the default) does anything for Python code. - -### Directives - -You can configure the extension using directives, just like for other -languages. These are just comments in the `BUILD.bazel` file which -govern behavior of the extension when processing files under that -folder. - -See https://github.com/bazelbuild/bazel-gazelle#directives -for some general directives that may be useful. -In particular, the `resolve` directive is language-specific -and can be used with Python. -Examples of these directives in use can be found in the -/gazelle/testdata folder in the rules_python repo. - -Python-specific directives are as follows: - -| **Directive** | **Default value** | -|--------------------------------------|-------------------| -| `# gazelle:python_extension` | `enabled` | -| Controls whether the Python extension is enabled or not. Sub-packages inherit this value. Can be either "enabled" or "disabled". | | -| `# gazelle:python_root` | n/a | -| Sets a Bazel package as a Python root. This is used on monorepos with multiple Python projects that don't share the top-level of the workspace as the root. | | -| `# gazelle:python_manifest_file_name`| `gazelle_python.yaml` | -| Overrides the default manifest file name. | | -| `# gazelle:python_ignore_files` | n/a | -| Controls the files which are ignored from the generated targets. | | -| `# gazelle:python_ignore_dependencies`| n/a | -| Controls the ignored dependencies from the generated targets. | | -| `# gazelle:python_validate_import_statements`| `true` | -| Controls whether the Python import statements should be validated. Can be "true" or "false" | | -| `# gazelle:python_generation_mode`| `package` | -| Controls the target generation mode. Can be "package" or "project" | | -| `# gazelle:python_library_naming_convention`| `$package_name$` | -| Controls the `py_library` naming convention. It interpolates $package_name$ with the Bazel package name. E.g. if the Bazel package name is `foo`, setting this to `$package_name$_my_lib` would result in a generated target named `foo_my_lib`. | | -| `# gazelle:python_binary_naming_convention` | `$package_name$_bin` | -| Controls the `py_binary` naming convention. Follows the same interpolation rules as `python_library_naming_convention`. | | -| `# gazelle:python_test_naming_convention` | `$package_name$_test` | -| Controls the `py_test` naming convention. Follows the same interpolation rules as `python_library_naming_convention`. | | -| `# gazelle:resolve py ...` | n/a | -| Instructs the plugin what target to add as a dependency to satisfy a given import statement. The syntax is `# gazelle:resolve py import-string label` where `import-string` is the symbol in the python `import` statement, and `label` is the Bazel label that Gazelle should write in `deps`. | | - -### Libraries - -Python source files are those ending in `.py` but not ending in `_test.py`. - -First, we look for the nearest ancestor BUILD file starting from the folder -containing the Python source file. - -If there is no `py_library` in this BUILD file, one is created, using the -package name as the target's name. This makes it the default target in the -package. - -Next, all source files are collected into the `srcs` of the `py_library`. - -Finally, the `import` statements in the source files are parsed, and -dependencies are added to the `deps` attribute. - -### Tests - -Python test files are those ending in `_test.py`. - -A `py_test` target is added containing all test files as `srcs`. - -### Binaries - -When a `__main__.py` file is encountered, this indicates the entry point -of a Python program. - -A `py_binary` target will be created, named `[package]_bin`. - -## Developing on the extension - -Gazelle extensions are written in Go. Ours is a hybrid, which also spawns -a Python interpreter as a subprocess to parse python files. - -The Go dependencies are managed by the go.mod file. -After changing that file, run `go mod tidy` to get a `go.sum` file, -then run `bazel run //:update_go_deps` to convert that to the `gazelle/deps.bzl` file. -The latter is loaded in our `/WORKSPACE` to define the external repos -that we can load Go dependencies from. - -Then after editing Go code, run `bazel run //:gazelle` to generate/update -go_* rules in the BUILD.bazel files in our repo. diff --git a/gazelle/__main__.py b/gazelle/__main__.py deleted file mode 100644 index 18bc1ca..0000000 --- a/gazelle/__main__.py +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright 2023 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# parse.py is a long-living program that communicates over STDIN and STDOUT. -# STDIN receives parse requests, one per line. It outputs the parsed modules and -# comments from all the files from each request. - -import sys - -import parse -import std_modules - -if __name__ == "__main__": - if len(sys.argv) < 2: - sys.exit("Please provide subcommand, either print or std_modules") - if sys.argv[1] == "parse": - sys.exit(parse.main(sys.stdin, sys.stdout)) - elif sys.argv[1] == "std_modules": - sys.exit(std_modules.main(sys.stdin, sys.stdout)) - else: - sys.exit("Unknown subcommand: " + sys.argv[1]) diff --git a/gazelle/bazel_gazelle.pr1095.patch b/gazelle/bazel_gazelle.pr1095.patch deleted file mode 100644 index a417c94..0000000 --- a/gazelle/bazel_gazelle.pr1095.patch +++ /dev/null @@ -1,19 +0,0 @@ -commit b1c61c0b77648f7345a7c42cce941e32d87c84bf -Author: Alex Eagle -Date: Wed Aug 18 17:55:13 2021 -0700 - - Merge the private attribute - -diff --git a/rule/merge.go b/rule/merge.go -index d5fbe94..e13e547 100644 ---- a/rule/merge.go -+++ b/rule/merge.go -@@ -79,6 +79,8 @@ func MergeRules(src, dst *Rule, mergeable map[string]bool, filename string) { - } - } - } -+ -+ dst.private = src.private - } - - // mergeExprs combines information from src and dst and returns a merged diff --git a/gazelle/def.bzl b/gazelle/def.bzl deleted file mode 100644 index 4cdae9c..0000000 --- a/gazelle/def.bzl +++ /dev/null @@ -1,7 +0,0 @@ -"""This module contains the Gazelle runtime dependencies for the Python extension. -""" - -GAZELLE_PYTHON_RUNTIME_DEPS = [ - "@com_github_benchsci_rules_python_gazelle//gazelle:parse", - "@com_github_benchsci_rules_python_gazelle//gazelle:std_modules", -] diff --git a/gazelle/fix.go b/gazelle/fix.go deleted file mode 100644 index b9a7814..0000000 --- a/gazelle/fix.go +++ /dev/null @@ -1,24 +0,0 @@ -package python - -import ( - "github.com/bazelbuild/bazel-gazelle/config" - "github.com/bazelbuild/bazel-gazelle/rule" -) - -// Fix repairs deprecated usage of language-specific rules in f. This is -// called before the file is indexed. Unless c.ShouldFix is true, fixes -// that delete or rename rules should not be performed. -func (py *Python) Fix(c *config.Config, f *rule.File) { - for _, r := range f.Rules { - // delete deprecated js_import rule - if r.Kind() == "old_django_test" { - r.Delete() - } - } - for _, l := range f.Loads { - - if l.Has("old_django_test") { - l.Remove("old_django_test") - } - } -} diff --git a/gazelle/generate.go b/gazelle/generate.go deleted file mode 100644 index 6c17d31..0000000 --- a/gazelle/generate.go +++ /dev/null @@ -1,165 +0,0 @@ -package python - -import ( - "log" - "path/filepath" - "strings" - - "github.com/bazelbuild/bazel-gazelle/config" - "github.com/bazelbuild/bazel-gazelle/label" - "github.com/bazelbuild/bazel-gazelle/language" - "github.com/bazelbuild/bazel-gazelle/rule" - "github.com/emirpasic/gods/sets/treeset" - godsutils "github.com/emirpasic/gods/utils" - "github.com/google/uuid" - - "github.com/benchsci/rules_python_gazelle/gazelle/pythonconfig" -) - -// GenerateRules extracts build metadata from source files in a directory. -// GenerateRules is called in each directory where an update is requested -// in depth-first post-order. -func (py *Python) GenerateRules(args language.GenerateArgs) language.GenerateResult { - cfgs := args.Config.Exts[languageName].(pythonconfig.Configs) - cfg := cfgs[args.Rel] - - if !cfg.ExtensionEnabled() { - return language.GenerateResult{} - } - check_deps := treeset.NewWith(godsutils.StringComparator) - - pythonProjectRoot := cfg.PythonProjectRoot() - - pyFilenames := treeset.NewWith(godsutils.StringComparator) - pyLibrarySources := treeset.NewWith(godsutils.StringComparator) - pyLibraryDeps := treeset.NewWith(moduleComparator) - - parser0 := newPython3Parser(args.Config.RepoRoot, args.Rel, cfg.IgnoresDependency) - - var result language.GenerateResult - result.Gen = make([]*rule.Rule, 0) - - django_test_deps := treeset.NewWith(moduleComparator) - django_test_files := treeset.NewWith(godsutils.StringComparator) - - for _, f := range args.RegularFiles { - if cfg.IgnoresFile(filepath.Base(f)) { - continue - } - ext := filepath.Ext(f) - - if ext != ".py" { - continue - } - pyFilenames.Add(f) - } - parserOutput, err := parser0.parseMultipe(pyFilenames) - if err != nil { - log.Fatalf("ERROR: %v\n", err) - } - for _, parserOut := range parserOutput { - f := parserOut.FileName - ext := filepath.Ext(f) - - deps := parserOut.Modules - targetName := strings.TrimSuffix(f, ext) - - if parserOut.RuleType == "py_test" { - - pyTestTarget := newTargetBuilder(getKind(args.Config, pyTestKind), targetName, pythonProjectRoot, args.Rel). - addSrc(f). - setMain(f). - addModuleDependencies(deps) - - pyTest := pyTestTarget.build() - check_deps.Add(label.Label{Repo: "", Pkg: "", Name: targetName, Relative: true}.String()) - - result.Gen = append(result.Gen, pyTest) - result.Imports = append(result.Imports, pyTest.PrivateAttr(config.GazelleImportsKey)) - - } else if parserOut.RuleType == "py_binary" { - - pyBinaryTarget := newTargetBuilder(getKind(args.Config, pyBinaryKind), targetName, pythonProjectRoot, args.Rel). - setMain(f). - addSrc(f). - addModuleDependencies(deps) - - pyBinary := pyBinaryTarget.build() - - result.Gen = append(result.Gen, pyBinary) - result.Imports = append(result.Imports, pyBinary.PrivateAttr(config.GazelleImportsKey)) - check_deps.Add(label.Label{Repo: "", Pkg: "", Name: targetName, Relative: true}.String()) - } else if parserOut.RuleType == "django_test" { - django_test_files.Add(f) - it := deps.Iterator() - for it.Next() { - django_test_deps.Add(it.Value().(module)) - } - - } else { - - if !cfg.PyModule() { - - pyLibrary := newTargetBuilder(getKind(args.Config, pyLibraryKind), targetName, pythonProjectRoot, args.Rel). - setUUID(uuid.Must(uuid.NewUUID()).String()). - addSrc(f). - addModuleDependencies(deps). - build() - - result.Gen = append(result.Gen, pyLibrary) - result.Imports = append(result.Imports, pyLibrary.PrivateAttr(config.GazelleImportsKey)) - check_deps.Add(label.Label{Repo: "", Pkg: "", Name: targetName, Relative: true}.String()) - } else { - - it := deps.Iterator() - for it.Next() { - pyLibraryDeps.Add(it.Value().(module)) - } - pyLibrarySources.Add(f) - } - } - - } - if !pyLibrarySources.Empty() { - targetName := filepath.Base(args.Dir) - pyLibrary := newTargetBuilder(getKind(args.Config, pyLibraryKind), targetName, pythonProjectRoot, args.Rel). - setUUID(uuid.Must(uuid.NewUUID()).String()). - addSrcs(pyLibrarySources). - addModuleDependencies(pyLibraryDeps). - build() - - result.Gen = append(result.Gen, pyLibrary) - result.Imports = append(result.Imports, pyLibrary.PrivateAttr(config.GazelleImportsKey)) - - } - if !django_test_files.Empty() { - djangoTestTarget := newTargetBuilder(getKind(args.Config, djangoTestKind), "django_test", pythonProjectRoot, args.Rel). - addSrcs(django_test_files). - setConftest(cfg.PytestConfTest()). - addModuleDependencies(django_test_deps).build() - - result.Gen = append(result.Gen, djangoTestTarget) - result.Imports = append(result.Imports, djangoTestTarget.PrivateAttr(config.GazelleImportsKey)) - check_deps.Add(label.Label{Repo: "", Pkg: "", Name: "django_test", Relative: true}.String()) - } - if !check_deps.Empty() && cfg.PyCheck() == "enabled" { - pyCheck := newTargetBuilder(getKind(args.Config, pyCheckKind), "check", pythonProjectRoot, args.Rel). - setUUID(uuid.Must(uuid.NewUUID()).String()). - addSrcs(check_deps). - build() - - result.Gen = append(result.Gen, pyCheck) - result.Imports = append(result.Imports, pyCheck.PrivateAttr(config.GazelleImportsKey)) - } - - return result -} - -func getKind(c *config.Config, kind_name string) string { - // Extract kind_name from KindMap - if kind, ok := c.KindMap[kind_name]; ok { - return kind.KindName - - } - return kind_name -} diff --git a/gazelle/language.go b/gazelle/language.go deleted file mode 100644 index 3b13278..0000000 --- a/gazelle/language.go +++ /dev/null @@ -1,19 +0,0 @@ -package python - -import ( - "github.com/bazelbuild/bazel-gazelle/language" -) - -// Python satisfies the language.Language interface. It is the Gazelle extension -// for Python rules. -type Python struct { - Configurer - Resolver - LifeCycleManager -} - -// NewLanguage initializes a new Python that satisfies the language.Language -// interface. This is the entrypoint for the extension initialization. -func NewLanguage() language.Language { - return &Python{} -} diff --git a/gazelle/lifecycle.go b/gazelle/lifecycle.go deleted file mode 100644 index 6d628e9..0000000 --- a/gazelle/lifecycle.go +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2023 The Bazel Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package python - -import ( - "context" - _ "embed" - "github.com/bazelbuild/bazel-gazelle/language" - "log" - "os" -) - -var ( - //go:embed helper.zip - helperZip []byte - helperPath string -) - -type LifeCycleManager struct { - language.BaseLifecycleManager - pyzFilePath string -} - -func (l *LifeCycleManager) Before(ctx context.Context) { - helperPath = os.Getenv("GAZELLE_PYTHON_HELPER") - if helperPath == "" { - pyzFile, err := os.CreateTemp("", "python_zip_") - if err != nil { - log.Fatalf("failed to write parser zip: %v", err) - } - defer pyzFile.Close() - helperPath = pyzFile.Name() - l.pyzFilePath = helperPath - if _, err := pyzFile.Write(helperZip); err != nil { - log.Fatalf("cannot write %q: %v", helperPath, err) - } - } - startParserProcess(ctx) - startStdModuleProcess(ctx) -} - -func (l *LifeCycleManager) DoneGeneratingRules() { - shutdownParserProcess() -} - -func (l *LifeCycleManager) AfterResolvingDeps(ctx context.Context) { - shutdownStdModuleProcess() - if l.pyzFilePath != "" { - os.Remove(l.pyzFilePath) - } -} diff --git a/gazelle/manifest/test/run.sh b/gazelle/manifest/test/run.sh deleted file mode 100755 index 4b24b51..0000000 --- a/gazelle/manifest/test/run.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -# This file exists to allow passing the runfile paths to the Go program via -# environment variables. - -set -o errexit -o nounset - -"${_TEST_BINARY}" --requirements "${_TEST_REQUIREMENTS}" --manifest "${_TEST_MANIFEST}" \ No newline at end of file diff --git a/gazelle/modules_mapping/BUILD.bazel b/gazelle/modules_mapping/BUILD.bazel deleted file mode 100644 index 0ef8db8..0000000 --- a/gazelle/modules_mapping/BUILD.bazel +++ /dev/null @@ -1,24 +0,0 @@ -load("@rules_python//python:defs.bzl", "py_binary", "py_test") - -py_binary( - name = "generator", - srcs = ["generator.py"], - imports = ["."], - main = "generator.py", - visibility = ["//visibility:public"], -) - -py_test( - name = "test_generator", - srcs = ["test_generator.py"], - data = glob(["testdata/**"]), - imports = ["."], - main = "test_generator.py", - deps = [":generator"], -) - -filegroup( - name = "distribution", - srcs = glob(["**"]), - visibility = ["//:__pkg__"], -) diff --git a/gazelle/modules_mapping/generator.py b/gazelle/modules_mapping/generator.py deleted file mode 100644 index 9208bd6..0000000 --- a/gazelle/modules_mapping/generator.py +++ /dev/null @@ -1,82 +0,0 @@ -import json -import pathlib -import sys -import zipfile - - -# Generator is the modules_mapping.json file generator. -class Generator: - stderr = None - output_file = None - - def __init__(self, stderr, output_file): - self.stderr = stderr - self.output_file = output_file - - # dig_wheel analyses the wheel .whl file determining the modules it provides - # by looking at the directory structure. - def dig_wheel(self, whl): - mapping = {} - wheel_name = get_wheel_name(whl) - if wheel_name.endswith(("_stubs", "_types")): - mapping[wheel_name.lower()] = wheel_name.lower() - with zipfile.ZipFile(whl, "r") as zip_file: - for path in zip_file.namelist(): - if is_metadata(path): - continue - ext = pathlib.Path(path).suffix - if ext == ".py" or ext == ".so": - # Note the '/' here means that the __init__.py is not in the - # root of the wheel, therefore we can index the directory - # where this file is as an importable package. - if path.endswith("/__init__.py"): - module = path[: -len("/__init__.py")].replace("/", ".") - mapping[module] = wheel_name - # Always index the module file. - if ext == ".so": - # Also remove extra metadata that is embeded as part of - # the file name as an extra extension. - ext = "".join(pathlib.Path(path).suffixes) - module = path[: -len(ext)].replace("/", ".") - mapping[module] = wheel_name - return mapping - - # run is the entrypoint for the generator. - def run(self, wheels): - mapping = {} - for whl in wheels: - try: - mapping.update(self.dig_wheel(whl)) - except AssertionError as error: - print(error, file=self.stderr) - return 1 - mapping_json = json.dumps(mapping) - with open(self.output_file, "w") as f: - f.write(mapping_json) - return 0 - - -def get_wheel_name(path): - pp = pathlib.PurePath(path) - if pp.suffix != ".whl": - raise RuntimeError( - "{} is not a valid wheel file name: the wheel doesn't follow ".format( - pp.name - ) - + "https://www.python.org/dev/peps/pep-0427/#file-name-convention" - ) - return pp.name[: pp.name.find("-")] - - -# is_metadata checks if the path is in a metadata directory. -# Ref: https://www.python.org/dev/peps/pep-0427/#file-contents. -def is_metadata(path): - top_level = path.split("/")[0].lower() - return top_level.endswith(".dist-info") or top_level.endswith(".data") - - -if __name__ == "__main__": - output_file = sys.argv[1] - wheels = sys.argv[2:] - generator = Generator(sys.stderr, output_file) - exit(generator.run(wheels)) diff --git a/gazelle/modules_mapping/test_generator.py b/gazelle/modules_mapping/test_generator.py deleted file mode 100644 index 50200fc..0000000 --- a/gazelle/modules_mapping/test_generator.py +++ /dev/null @@ -1,40 +0,0 @@ -import pathlib -import unittest - -from generator import Generator - - -class GeneratorTest(unittest.TestCase): - def test_generator(self): - whl = pathlib.Path( - pathlib.Path(__file__).parent, "testdata", "pytest-7.1.1-py3-none-any.whl" - ) - gen = Generator(None, None) - mapping = gen.dig_wheel(whl) - self.assertLessEqual( - { - "_pytest": "pytest", - "_pytest.__init__": "pytest", - "_pytest._argcomplete": "pytest", - }.items(), - mapping.items(), - ) - - def test_stub_generator(self): - whl = pathlib.Path( - pathlib.Path(__file__).parent, - "testdata", - "django_types-0.15.0-py3-none-any.whl", - ) - gen = Generator(None, None) - mapping = gen.dig_wheel(whl) - self.assertLessEqual( - { - "django_types": "django_types", - }.items(), - mapping.items(), - ) - - -if __name__ == "__main__": - unittest.main() diff --git a/gazelle/modules_mapping/testdata/django_types-0.15.0-py3-none-any.whl b/gazelle/modules_mapping/testdata/django_types-0.15.0-py3-none-any.whl deleted file mode 100644 index 96468a8..0000000 Binary files a/gazelle/modules_mapping/testdata/django_types-0.15.0-py3-none-any.whl and /dev/null differ diff --git a/gazelle/modules_mapping/testdata/pytest-7.1.1-py3-none-any.whl b/gazelle/modules_mapping/testdata/pytest-7.1.1-py3-none-any.whl deleted file mode 100644 index a5b6a4c..0000000 Binary files a/gazelle/modules_mapping/testdata/pytest-7.1.1-py3-none-any.whl and /dev/null differ diff --git a/gazelle/parser.go b/gazelle/parser.go deleted file mode 100644 index f649677..0000000 --- a/gazelle/parser.go +++ /dev/null @@ -1,360 +0,0 @@ -package python - -import ( - "bufio" - "context" - _ "embed" - "encoding/json" - "fmt" - "io" - "log" - "os" - "os/exec" - "sort" - "strings" - "sync" - - "github.com/emirpasic/gods/sets/treeset" - godsutils "github.com/emirpasic/gods/utils" -) - -var ( - parserCmd *exec.Cmd - parserStdin io.WriteCloser - parserStdout io.Reader - parserMutex sync.Mutex -) - -func startParserProcess(ctx context.Context) { - // due to #691, we need a system interpreter to boostrap, part of which is - // to locate the hermetic interpreter. - parserCmd = exec.CommandContext(ctx, "python3", helperPath, "parse") - parserCmd.Stderr = os.Stderr - - stdin, err := parserCmd.StdinPipe() - if err != nil { - log.Printf("failed to initialize parser: %v\n", err) - os.Exit(1) - } - parserStdin = stdin - - stdout, err := parserCmd.StdoutPipe() - if err != nil { - log.Printf("failed to initialize parser: %v\n", err) - os.Exit(1) - } - parserStdout = stdout - - if err := parserCmd.Start(); err != nil { - log.Printf("failed to initialize parser: %v\n", err) - os.Exit(1) - } -} - -func shutdownParserProcess() { - if err := parserStdin.Close(); err != nil { - fmt.Fprintf(os.Stderr, "error closing parser: %v", err) - } - - if err := parserCmd.Wait(); err != nil { - log.Printf("failed to wait for parser: %v\n", err) - } -} - -// python3Parser implements a parser for Python files that extracts the modules -// as seen in the import statements. -type python3Parser struct { - // The value of language.GenerateArgs.Config.RepoRoot. - repoRoot string - // The value of language.GenerateArgs.Rel. - relPackagePath string - // The function that determines if a dependency is ignored from a Gazelle - // directive. It's the signature of pythonconfig.Config.IgnoresDependency. - ignoresDependency func(dep string) bool -} - -// newPython3Parser constructs a new python3Parser. -func newPython3Parser( - repoRoot string, - relPackagePath string, - ignoresDependency func(dep string) bool, -) *python3Parser { - return &python3Parser{ - repoRoot: repoRoot, - relPackagePath: relPackagePath, - ignoresDependency: ignoresDependency, - } -} - -// parseSingle parses a single Python file and returns the extracted modules -// from the import statements as well as the parsed comments. -func (p *python3Parser) parseSingle(pyFilename string) (*parserOut, error) { - pyFilenames := treeset.NewWith(godsutils.StringComparator) - pyFilenames.Add(pyFilename) - return p.parse(pyFilenames) -} - -// parse parses multiple Python files and returns the extracted modules from -// the import statements as well as the parsed comments. -func (p *python3Parser) parseMultipe(pyFilenames *treeset.Set) ([]parserOutput, error) { - parserMutex.Lock() - defer parserMutex.Unlock() - - req := map[string]interface{}{ - "repo_root": p.repoRoot, - "rel_package_path": p.relPackagePath, - "filenames": pyFilenames.Values(), - } - encoder := json.NewEncoder(parserStdin) - if err := encoder.Encode(&req); err != nil { - return nil, fmt.Errorf("failed to parse: %w", err) - } - - reader := bufio.NewReader(parserStdout) - data, err := reader.ReadBytes(0) - if err != nil { - return nil, fmt.Errorf("failed to parse: %w", err) - } - data = data[:len(data)-1] - - var allRes []parserResponse - var output []parserOutput - - if err := json.Unmarshal(data, &allRes); err != nil { - return nil, fmt.Errorf("failed to parse: %w", err) - } - - for _, res := range allRes { - modules := treeset.NewWith(moduleComparator) - annotations := annotationsFromComments(res.Comments) - rule_type := res.RuleType - - for _, m := range res.Modules { - // Check for ignored dependencies set via an annotation to the Python - // module. - if annotations.ignores(m.Name) { - continue - } - - // Check for ignored dependencies set via a Gazelle directive in a BUILD - // file. - if p.ignoresDependency(m.Name) { - continue - } - - modules.Add(m) - - } - parO := parserOutput{FileName: res.FileName, Modules: modules, RuleType: rule_type} - output = append(output, parO) - } - - sort.Slice(output, func(i, j int) bool { - return output[i].FileName < output[j].FileName - - }) - - return output, nil -} - -// parse parses multiple Python files and returns the extracted modules from -// the import statements as well as the parsed comments. -func (p *python3Parser) parse(pyFilenames *treeset.Set) (*parserOut, error) { - parserMutex.Lock() - defer parserMutex.Unlock() - - modules := treeset.NewWith(moduleComparator) - - req := map[string]interface{}{ - "repo_root": p.repoRoot, - "rel_package_path": p.relPackagePath, - "filenames": pyFilenames.Values(), - } - encoder := json.NewEncoder(parserStdin) - if err := encoder.Encode(&req); err != nil { - return nil, fmt.Errorf("failed to parse: %w", err) - } - - reader := bufio.NewReader(parserStdout) - data, err := reader.ReadBytes(0) - if err != nil { - return nil, fmt.Errorf("failed to parse: %w", err) - } - data = data[:len(data)-1] - var allRes []parserResponse - if err := json.Unmarshal(data, &allRes); err != nil { - return nil, fmt.Errorf("failed to parse: %w", err) - } - - rule_type := "py_library" - for _, res := range allRes { - annotations := annotationsFromComments(res.Comments) - rule_type = res.RuleType - - for _, m := range res.Modules { - // Check for ignored dependencies set via an annotation to the Python - // module. - if annotations.ignores(m.Name) { - continue - } - - // Check for ignored dependencies set via a Gazelle directive in a BUILD - // file. - if p.ignoresDependency(m.Name) { - continue - } - - modules.Add(m) - } - } - parO := parserOut{Modules: modules, RuleType: rule_type} - - return &parO, nil -} - -// parserResponse represents a response returned by the parser.py for a given -// parsed Python module. -type parserOut struct { - // The modules depended by the parsed module. - Modules *treeset.Set - RuleType string -} - -// parsed Python module. -type parserOutput struct { - // The modules depended by the parsed module. - Modules *treeset.Set - RuleType string - FileName string -} - -// parserResponse represents a response returned by the parser.py for a given -// parsed Python module. -type parserResponse struct { - // The modules depended by the parsed module. - Modules []module `json:"modules"` - // The comments contained in the parsed module. This contains the - // annotations as they are comments in the Python module. - Comments []comment `json:"comments"` - - RuleType string `json:"rules_type"` - - FileName string `json:"filename"` -} - -// module represents a fully-qualified, dot-separated, Python module as seen on -// the import statement, alongside the line number where it happened. -type module struct { - // The fully-qualified, dot-separated, Python module name as seen on import - // statements. - Name string `json:"name"` - // The line number where the import happened. - LineNumber uint32 `json:"lineno"` - // The path to the module file relative to the Bazel workspace root. - Filepath string `json:"filepath"` - - SubName []string `json:"subname"` -} - -// moduleComparator compares modules by name. - -func linenoComparator(a, b interface{}) int { - return godsutils.UInt32Comparator(a.(module).LineNumber, b.(module).LineNumber) -} - -// StringComparator provides a fast comparison on strings -func moduleComparator(a, b interface{}) int { - s1 := fmt.Sprintf("%v-%v-%v", a.(module).LineNumber, a.(module).Name, a.(module).SubName) - s2 := fmt.Sprintf("%v-%v-%v", b.(module).LineNumber, b.(module).Name, b.(module).SubName) - min := len(s2) - if len(s1) < len(s2) { - min = len(s1) - } - diff := 0 - for i := 0; i < min && diff == 0; i++ { - diff = int(s1[i]) - int(s2[i]) - } - if diff == 0 { - diff = len(s1) - len(s2) - } - if diff < 0 { - return -1 - } - if diff > 0 { - return 1 - } - return 0 -} - -// annotationKind represents Gazelle annotation kinds. -type annotationKind string - -const ( - // The Gazelle annotation prefix. - annotationPrefix string = "gazelle:" - // The ignore annotation kind. E.g. '# gazelle:ignore '. - annotationKindIgnore annotationKind = "ignore" -) - -// comment represents a Python comment. -type comment string - -// asAnnotation returns an annotation object if the comment has the -// annotationPrefix. -func (c *comment) asAnnotation() *annotation { - uncomment := strings.TrimLeft(string(*c), "# ") - if !strings.HasPrefix(uncomment, annotationPrefix) { - return nil - } - withoutPrefix := strings.TrimPrefix(uncomment, annotationPrefix) - annotationParts := strings.SplitN(withoutPrefix, " ", 2) - return &annotation{ - kind: annotationKind(annotationParts[0]), - value: annotationParts[1], - } -} - -// annotation represents a single Gazelle annotation parsed from a Python -// comment. -type annotation struct { - kind annotationKind - value string -} - -// annotations represent the collection of all Gazelle annotations parsed out of -// the comments of a Python module. -type annotations struct { - // The parsed modules to be ignored by Gazelle. - ignore map[string]struct{} -} - -// annotationsFromComments returns all the annotations parsed out of the -// comments of a Python module. -func annotationsFromComments(comments []comment) *annotations { - ignore := make(map[string]struct{}) - for _, comment := range comments { - annotation := comment.asAnnotation() - if annotation != nil { - if annotation.kind == annotationKindIgnore { - modules := strings.Split(annotation.value, ",") - for _, m := range modules { - if m == "" { - continue - } - m = strings.TrimSpace(m) - ignore[m] = struct{}{} - } - } - } - } - return &annotations{ - ignore: ignore, - } -} - -// ignored returns true if the given module was ignored via the ignore -// annotation. -func (a *annotations) ignores(module string) bool { - _, ignores := a.ignore[module] - return ignores -} diff --git a/gazelle/python_test.go b/gazelle/python_test.go index ad1cdce..2dbb603 100644 --- a/gazelle/python_test.go +++ b/gazelle/python_test.go @@ -41,7 +41,7 @@ import ( const ( extensionDir = "gazelle/" testDataPath = extensionDir + "testdata/" - gazelleBinaryName = "gazelle_python_binary" + gazelleBinaryName = "gazelle_binary" ) var gazellePath = mustFindGazelle() @@ -195,7 +195,7 @@ func testPath(t *testing.T, name string, files []bazel.RunfileEntry) { } func mustFindGazelle() string { - gazellePath, ok := bazel.FindBinary(extensionDir, gazelleBinaryName) + gazellePath, ok := bazel.FindBinary("python", gazelleBinaryName) if !ok { panic("could not find gazelle binary") } diff --git a/gazelle/pythonconfig/BUILD.bazel b/gazelle/pythonconfig/BUILD.bazel deleted file mode 100644 index b7cab8a..0000000 --- a/gazelle/pythonconfig/BUILD.bazel +++ /dev/null @@ -1,16 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library") - -go_library( - name = "pythonconfig", - srcs = [ - "pythonconfig.go", - "types.go", - ], - importpath = "github.com/benchsci/rules_python_gazelle/gazelle/pythonconfig", - visibility = ["//visibility:public"], - deps = [ - "//gazelle/manifest", - "@bazel_gazelle//label:go_default_library", - "@com_github_emirpasic_gods//lists/singlylinkedlist:go_default_library", - ], -) diff --git a/gazelle/std_modules.go b/gazelle/std_modules.go deleted file mode 100644 index 8a016af..0000000 --- a/gazelle/std_modules.go +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright 2023 The Bazel Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package python - -import ( - "bufio" - "context" - _ "embed" - "fmt" - "io" - "log" - "os" - "os/exec" - "strconv" - "strings" - "sync" -) - -var ( - stdModulesCmd *exec.Cmd - stdModulesStdin io.WriteCloser - stdModulesStdout io.Reader - stdModulesMutex sync.Mutex - stdModulesSeen map[string]struct{} -) - -func startStdModuleProcess(ctx context.Context) { - stdModulesSeen = make(map[string]struct{}) - - // due to #691, we need a system interpreter to boostrap, part of which is - // to locate the hermetic interpreter. - stdModulesCmd = exec.CommandContext(ctx, "python3", helperPath, "std_modules") - stdModulesCmd.Stderr = os.Stderr - // All userland site-packages should be ignored. - stdModulesCmd.Env = []string{"PYTHONNOUSERSITE=1"} - - stdin, err := stdModulesCmd.StdinPipe() - if err != nil { - log.Printf("failed to initialize std_modules: %v\n", err) - os.Exit(1) - } - stdModulesStdin = stdin - - stdout, err := stdModulesCmd.StdoutPipe() - if err != nil { - log.Printf("failed to initialize std_modules: %v\n", err) - os.Exit(1) - } - stdModulesStdout = stdout - - if err := stdModulesCmd.Start(); err != nil { - log.Printf("failed to initialize std_modules: %v\n", err) - os.Exit(1) - } -} - -func shutdownStdModuleProcess() { - if err := stdModulesStdin.Close(); err != nil { - fmt.Fprintf(os.Stderr, "error closing std module: %v", err) - } - - if err := stdModulesCmd.Wait(); err != nil { - log.Printf("failed to wait for std_modules: %v\n", err) - } -} - -func isStdModule(m module) (bool, error) { - if _, seen := stdModulesSeen[m.Name]; seen { - return true, nil - } - stdModulesMutex.Lock() - defer stdModulesMutex.Unlock() - - fmt.Fprintf(stdModulesStdin, "%s\n", m.Name) - - stdoutReader := bufio.NewReader(stdModulesStdout) - line, err := stdoutReader.ReadString('\n') - if err != nil { - return false, err - } - if len(line) == 0 { - return false, fmt.Errorf("unexpected empty output from std_modules") - } - - isStd, err := strconv.ParseBool(strings.TrimSpace(line)) - if err != nil { - return false, err - } - - if isStd { - stdModulesSeen[m.Name] = struct{}{} - return true, nil - } - return false, nil -} diff --git a/gazelle/std_modules.py b/gazelle/std_modules.py deleted file mode 100644 index 779a325..0000000 --- a/gazelle/std_modules.py +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright 2023 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# std_modules.py is a long-living program that communicates over STDIN and -# STDOUT. STDIN receives module names, one per line. For each module statement -# it evaluates, it outputs true/false for whether the module is part of the -# standard library or not. - -import os -import sys -from contextlib import redirect_stdout - - -def is_std_modules(module): - # If for some reason a module (such as pygame, see https://github.com/pygame/pygame/issues/542) - # prints to stdout upon import, - # the output of this script should still be parseable by golang. - # Therefore, redirect stdout while running the import. - with redirect_stdout(os.devnull): - try: - __import__(module, globals(), locals(), [], 0) - return True - except Exception: - return False - - -def main(stdin, stdout): - for module in stdin: - module = module.strip() - # Don't print the boolean directly as it is capitalized in Python. - print( - "true" if is_std_modules(module) else "false", - end="\n", - file=stdout, - ) - stdout.flush() - - -if __name__ == "__main__": - exit(main(sys.stdin, sys.stdout)) diff --git a/gazelle/testdata/py_module/BUILD.in b/gazelle/testdata/py_module/BUILD.in deleted file mode 100644 index b151086..0000000 --- a/gazelle/testdata/py_module/BUILD.in +++ /dev/null @@ -1 +0,0 @@ -# gazelle:py_module enabled diff --git a/gazelle/testdata/py_module/BUILD.out b/gazelle/testdata/py_module/BUILD.out deleted file mode 100644 index 213a672..0000000 --- a/gazelle/testdata/py_module/BUILD.out +++ /dev/null @@ -1,28 +0,0 @@ -load("@rules_python//python:defs.bzl", "py_binary", "py_library", "pytest") - -# gazelle:py_module enabled - -py_binary( - name = "__main__", - srcs = ["__main__.py"], - main = "__main__.py", - deps = [":py_module"], -) - -pytest( - name = "__test__", - srcs = ["__test__.py"], - main = "__test__.py", - deps = [ - ":__main__", - ":py_module", - ], -) - -py_library( - name = "py_module", - srcs = [ - "__init__.py", - "foo.py", - ], -) diff --git a/gazelle/testdata/py_module/README.md b/gazelle/testdata/py_module/README.md deleted file mode 100644 index 0cfbbeb..0000000 --- a/gazelle/testdata/py_module/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Simple test - -This test case asserts that a simple `py_test` is generated as expected. diff --git a/gazelle/testdata/py_module/WORKSPACE b/gazelle/testdata/py_module/WORKSPACE deleted file mode 100644 index faff6af..0000000 --- a/gazelle/testdata/py_module/WORKSPACE +++ /dev/null @@ -1 +0,0 @@ -# This is a Bazel workspace for the Gazelle test data. diff --git a/gazelle/testdata/py_module/__init__.py b/gazelle/testdata/py_module/__init__.py deleted file mode 100644 index 6a49193..0000000 --- a/gazelle/testdata/py_module/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from foo import foo - -_ = foo diff --git a/gazelle/testdata/py_module/__main__.py b/gazelle/testdata/py_module/__main__.py deleted file mode 100644 index d4b7650..0000000 --- a/gazelle/testdata/py_module/__main__.py +++ /dev/null @@ -1,10 +0,0 @@ -# For test purposes only. -from foo import foo - - -def main(): - foo() - - -if __name__ == "__main__": - main() diff --git a/gazelle/testdata/py_module/__test__.py b/gazelle/testdata/py_module/__test__.py deleted file mode 100644 index 00f48ec..0000000 --- a/gazelle/testdata/py_module/__test__.py +++ /dev/null @@ -1,13 +0,0 @@ -import unittest - -from __init__ import foo -from __main__ import main - - -class FooTest(unittest.TestCase): - def test_foo(self): - self.assertEqual("foo", foo()) - - -if __name__ == "__main__": - unittest.main() diff --git a/gazelle/testdata/py_module/foo.py b/gazelle/testdata/py_module/foo.py deleted file mode 100644 index cf68624..0000000 --- a/gazelle/testdata/py_module/foo.py +++ /dev/null @@ -1,2 +0,0 @@ -def foo(): - return "foo" diff --git a/gazelle/testdata/py_module/test.yaml b/gazelle/testdata/py_module/test.yaml deleted file mode 100644 index 36dd656..0000000 --- a/gazelle/testdata/py_module/test.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -expect: - exit_code: 0 diff --git a/gazelle/testdata/pycheck/BUILD.in b/gazelle/testdata/pycheck/BUILD.in deleted file mode 100644 index 5b77948..0000000 --- a/gazelle/testdata/pycheck/BUILD.in +++ /dev/null @@ -1 +0,0 @@ -# gazelle:py_check enabled diff --git a/gazelle/testdata/pycheck/BUILD.out b/gazelle/testdata/pycheck/BUILD.out deleted file mode 100644 index ebdc5c4..0000000 --- a/gazelle/testdata/pycheck/BUILD.out +++ /dev/null @@ -1,41 +0,0 @@ -load("@rules_python//python:defs.bzl", "py_binary", "py_library", "pytest") -load("@com_github_benchsci_rules_python_gazelle:defs.bzl", "py_check") - -# gazelle:py_check enabled - -py_library( - name = "__init__", - srcs = ["__init__.py"], - deps = [":foo"], -) - -py_binary( - name = "__main__", - srcs = ["__main__.py"], - main = "__main__.py", -) - -pytest( - name = "__test__", - srcs = ["__test__.py"], - main = "__test__.py", - deps = [ - ":__init__", - ":__main__", - ], -) - -py_library( - name = "foo", - srcs = ["foo.py"], -) - -py_check( - name = "check", - srcs = [ - ":__init__", - ":__main__", - ":__test__", - ":foo", - ], -) diff --git a/gazelle/testdata/pycheck/README.md b/gazelle/testdata/pycheck/README.md deleted file mode 100644 index 0cfbbeb..0000000 --- a/gazelle/testdata/pycheck/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Simple test - -This test case asserts that a simple `py_test` is generated as expected. diff --git a/gazelle/testdata/pycheck/WORKSPACE b/gazelle/testdata/pycheck/WORKSPACE deleted file mode 100644 index faff6af..0000000 --- a/gazelle/testdata/pycheck/WORKSPACE +++ /dev/null @@ -1 +0,0 @@ -# This is a Bazel workspace for the Gazelle test data. diff --git a/gazelle/testdata/pycheck/__init__.py b/gazelle/testdata/pycheck/__init__.py deleted file mode 100644 index 6a49193..0000000 --- a/gazelle/testdata/pycheck/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from foo import foo - -_ = foo diff --git a/gazelle/testdata/pycheck/__main__.py b/gazelle/testdata/pycheck/__main__.py deleted file mode 100644 index 38ffdf7..0000000 --- a/gazelle/testdata/pycheck/__main__.py +++ /dev/null @@ -1,7 +0,0 @@ -# For test purposes only. -def main(): - pass - - -if __name__ == "__main__": - main() diff --git a/gazelle/testdata/pycheck/__test__.py b/gazelle/testdata/pycheck/__test__.py deleted file mode 100644 index 00f48ec..0000000 --- a/gazelle/testdata/pycheck/__test__.py +++ /dev/null @@ -1,13 +0,0 @@ -import unittest - -from __init__ import foo -from __main__ import main - - -class FooTest(unittest.TestCase): - def test_foo(self): - self.assertEqual("foo", foo()) - - -if __name__ == "__main__": - unittest.main() diff --git a/gazelle/testdata/pycheck/foo.py b/gazelle/testdata/pycheck/foo.py deleted file mode 100644 index cf68624..0000000 --- a/gazelle/testdata/pycheck/foo.py +++ /dev/null @@ -1,2 +0,0 @@ -def foo(): - return "foo" diff --git a/gazelle/testdata/pycheck/test.yaml b/gazelle/testdata/pycheck/test.yaml deleted file mode 100644 index 36dd656..0000000 --- a/gazelle/testdata/pycheck/test.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -expect: - exit_code: 0 diff --git a/gazelle/testdata/simple/BUILD.out b/gazelle/testdata/simple/BUILD.out index 4522f61..47bc468 100644 --- a/gazelle/testdata/simple/BUILD.out +++ b/gazelle/testdata/simple/BUILD.out @@ -12,6 +12,11 @@ py_binary( main = "__main__.py", ) +py_library( + name = "foo", + srcs = ["foo.py"], +) + pytest( name = "__test__", srcs = ["__test__.py"], @@ -21,8 +26,3 @@ pytest( ":__main__", ], ) - -py_library( - name = "foo", - srcs = ["foo.py"], -) diff --git a/go.mod b/go.mod index 9178af8..0dc2166 100644 --- a/go.mod +++ b/go.mod @@ -1,20 +1,26 @@ -module github.com/benchsci/rules_python_gazelle +module github.com/benchsci/rules_python_gazelle/gazelle go 1.19 require ( - github.com/bazelbuild/bazel-gazelle v0.33.0 - github.com/bazelbuild/buildtools v0.0.0-20230831140646-386244e73fc4 + github.com/bazelbuild/bazel-gazelle v0.31.1 + github.com/bazelbuild/buildtools v0.0.0-20231103205921-433ea8554e82 github.com/bazelbuild/rules_go v0.41.0 - github.com/emirpasic/gods v1.12.0 + github.com/bmatcuk/doublestar/v4 v4.6.1 + github.com/emirpasic/gods v1.18.1 github.com/ghodss/yaml v1.0.0 - github.com/google/uuid v1.3.0 - gopkg.in/yaml.v2 v2.2.8 + github.com/smacker/go-tree-sitter v0.0.0-20240422154435-0628b34cbf9c + github.com/stretchr/testify v1.9.0 + golang.org/x/sync v0.2.0 + gopkg.in/yaml.v2 v2.4.0 ) require ( + github.com/davecgh/go-spew v1.1.1 // indirect github.com/google/go-cmp v0.5.9 // indirect - github.com/kr/pretty v0.1.0 // indirect - golang.org/x/mod v0.12.0 // indirect - gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + golang.org/x/mod v0.10.0 // indirect + golang.org/x/sys v0.8.0 // indirect + golang.org/x/tools v0.9.1 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index f6e7fe1..46e0127 100644 --- a/go.sum +++ b/go.sum @@ -1,18 +1,23 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/bazelbuild/bazel-gazelle v0.33.0 h1:WnJGYk1bMIjw8FCYA/UxKBK/Y6hUnOItrtR+vjFIIKo= -github.com/bazelbuild/bazel-gazelle v0.33.0/go.mod h1:6BWjSqjc2gr7YfzMRCbkHiJZy5YRxIKj7iLButu58Jk= -github.com/bazelbuild/buildtools v0.0.0-20230831140646-386244e73fc4 h1:6Z/4LXt5mdhuFAx4QhwM0D5pTs1ljYGmhgF3O9OCMF0= -github.com/bazelbuild/buildtools v0.0.0-20230831140646-386244e73fc4/go.mod h1:689QdV3hBP7Vo9dJMmzhoYIyo/9iMhEmHkJcnaPRCbo= +github.com/bazelbuild/bazel-gazelle v0.31.1 h1:ROyUyUHzoEdvoOs1e0haxJx1l5EjZX6AOqiKdVlaBbg= +github.com/bazelbuild/bazel-gazelle v0.31.1/go.mod h1:Ul0pqz50f5wxz0QNzsZ+mrEu4AVAVJZEB5xLnHgIG9c= +github.com/bazelbuild/buildtools v0.0.0-20231103205921-433ea8554e82 h1:HTepWP/jhtWTC1gvK0RnvKCgjh4gLqiwaOwGozAXcbw= +github.com/bazelbuild/buildtools v0.0.0-20231103205921-433ea8554e82/go.mod h1:689QdV3hBP7Vo9dJMmzhoYIyo/9iMhEmHkJcnaPRCbo= github.com/bazelbuild/rules_go v0.41.0 h1:JzlRxsFNhlX+g4drDRPhIaU5H5LnI978wdMJ0vK4I+k= github.com/bazelbuild/rules_go v0.41.0/go.mod h1:TMHmtfpvyfsxaqfL9WnahCsXMWDMICTw7XeK9yVb+YU= +github.com/bmatcuk/doublestar/v4 v4.6.1 h1:FH9SifrbvJhnlQpztAx++wlkk70QBf0iBWDwNy7PA4I= +github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg= -github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= +github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= @@ -36,22 +41,25 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/smacker/go-tree-sitter v0.0.0-20240422154435-0628b34cbf9c h1:7QZKUmQfnxncZIJGyvX8M8YeMfn8kM10j3J/2KwVTN4= +github.com/smacker/go-tree-sitter v0.0.0-20240422154435-0628b34cbf9c/go.mod h1:q99oHDsbP0xRwmn7Vmob8gbSMNyvJ83OauXPSuHQuKE= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.4/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= go.starlark.net v0.0.0-20210223155950-e043a3d3c984/go.mod h1:t3mmBBPzAVvK0L0n1drDmrQsJ8FoIx4INCqVMTr/Zo0= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= +golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -60,16 +68,20 @@ golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAG golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= +golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU= -golang.org/x/tools/go/vcs v0.1.0-deprecated h1:cOIJqWBl99H1dH5LWizPa+0ImeeJq3t3cJjaeOWUAL4= +golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo= +golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= @@ -89,10 +101,12 @@ google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/gazelle/manifest/BUILD.bazel b/manifest/BUILD.bazel similarity index 56% rename from gazelle/manifest/BUILD.bazel rename to manifest/BUILD.bazel index 42ab3a4..8195f40 100644 --- a/gazelle/manifest/BUILD.bazel +++ b/manifest/BUILD.bazel @@ -1,13 +1,18 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") +exports_files([ + # This gets wrapped up into a py_binary with args inside of the gazelle_python_manifest macro. + "copy_to_source.py", +]) + go_library( name = "manifest", srcs = ["manifest.go"], importpath = "github.com/benchsci/rules_python_gazelle/gazelle/manifest", visibility = ["//visibility:public"], deps = [ - "@com_github_emirpasic_gods//sets/treeset:go_default_library", - "@in_gopkg_yaml_v2//:go_default_library", + "@com_github_emirpasic_gods//sets/treeset", + "@in_gopkg_yaml_v2//:yaml_v2", ], ) @@ -21,9 +26,9 @@ go_test( filegroup( name = "distribution", srcs = glob(["**"]) + [ - "@com_github_benchsci_rules_python_gazelle//gazelle/manifest/generate:distribution", - "@com_github_benchsci_rules_python_gazelle//gazelle/manifest/hasher:distribution", - "@com_github_benchsci_rules_python_gazelle//gazelle/manifest/test:distribution", + "//manifest/generate:distribution", + "//manifest/hasher:distribution", + "//manifest/test:distribution", ], visibility = ["//:__pkg__"], ) diff --git a/manifest/copy_to_source.py b/manifest/copy_to_source.py new file mode 100644 index 0000000..4ebb958 --- /dev/null +++ b/manifest/copy_to_source.py @@ -0,0 +1,36 @@ +"""Copy a generated file to the source tree. + +Run like: + copy_to_source path/to/generated_file path/to/source_file_to_overwrite +""" + +import os +import shutil +import stat +import sys +from pathlib import Path + + +def copy_to_source(generated_relative_path: Path, target_relative_path: Path) -> None: + """Copy the generated file to the target file path. + + Expands the relative paths by looking at Bazel env vars to figure out which absolute paths to use. + """ + # This script normally gets executed from the runfiles dir, so find the absolute path to the generated file based on that. + generated_absolute_path = Path.cwd() / generated_relative_path + + # Similarly, the target is relative to the source directory. + target_absolute_path = os.getenv("BUILD_WORKSPACE_DIRECTORY") / target_relative_path + + print(f"Copying {generated_absolute_path} to {target_absolute_path}") + target_absolute_path.parent.mkdir(parents=True, exist_ok=True) + shutil.copy(generated_absolute_path, target_absolute_path) + + target_absolute_path.chmod(0o664) + + +if __name__ == "__main__": + if len(sys.argv) != 3: + sys.exit("Usage: copy_to_source ") + + copy_to_source(Path(sys.argv[1]), Path(sys.argv[2])) diff --git a/gazelle/manifest/defs.bzl b/manifest/defs.bzl similarity index 57% rename from gazelle/manifest/defs.bzl rename to manifest/defs.bzl index d1fa8dd..ccabfd2 100644 --- a/gazelle/manifest/defs.bzl +++ b/manifest/defs.bzl @@ -16,32 +16,34 @@ for updating and testing the Gazelle manifest file. """ -load("@io_bazel_rules_go//go:def.bzl", "GoSource", "go_binary", "go_test") +load("@bazel_skylib//rules:diff_test.bzl", "diff_test") +load("@io_bazel_rules_go//go:def.bzl", "GoSource", "go_test") +load("@rules_python//python:defs.bzl", "py_binary") def gazelle_python_manifest( name, - requirements, modules_mapping, + requirements = [], pip_repository_name = "", pip_deps_repository_name = "", manifest = ":gazelle_python.yaml", - use_pip_repository_aliases = True, **kwargs): """A macro for defining the updating and testing targets for the Gazelle manifest file. Args: name: the name used as a base for the targets. + modules_mapping: the target for the generated modules_mapping.json file. requirements: the target for the requirements.txt file or a list of requirements files that will be concatenated before passing on to - the manifest generator. + the manifest generator. If unset, no integrity field is added to the + manifest, meaning testing it is just as expensive as generating it, + but modifying it is much less likely to result in a merge conflict. pip_repository_name: the name of the pip_install or pip_repository target. - use_pip_repository_aliases: boolean flag to enable using user-friendly - python package aliases. pip_deps_repository_name: deprecated - the old pip_install target name. - modules_mapping: the target for the generated modules_mapping.json file. - manifest: the target for the Gazelle manifest file. - **kwargs: other bazel attributes passed to the target target generated by - this macro. + manifest: the Gazelle manifest file. + defaults to the same value as manifest. + **kwargs: other bazel attributes passed to the generate and test targets + generated by this macro. """ if pip_deps_repository_name != "": # buildifier: disable=print @@ -55,12 +57,17 @@ def gazelle_python_manifest( # This is a temporary check while pip_deps_repository_name exists as deprecated. fail("pip_repository_name must be set in //{}:{}".format(native.package_name(), name)) + test_target = "{}.test".format(name) update_target = "{}.update".format(name) update_target_label = "//{}:{}".format(native.package_name(), update_target) - manifest_generator_hash = Label("@com_github_benchsci_rules_python_gazelle//gazelle/manifest/generate:generate_lib_sources_hash") + manifest_genrule = name + ".genrule" + generated_manifest = name + ".generated_manifest" + manifest_generator = Label("//manifest/generate:generate") + manifest_generator_hash = Label("//manifest/generate:generate_lib_sources_hash") - if type(requirements) == "list": + if requirements and type(requirements) == "list": + # This runs if requirements is a list or is unset (default value is empty list) native.genrule( name = name + "_requirements_gen", srcs = sorted(requirements), @@ -71,62 +78,71 @@ def gazelle_python_manifest( requirements = name + "_requirements_gen" update_args = [ - "--manifest-generator-hash", - "$(rootpath {})".format(manifest_generator_hash), - "--requirements", - "$(rootpath {})".format(requirements), - "--pip-repository-name", - pip_repository_name, - "--modules-mapping", - "$(rootpath {})".format(modules_mapping), - "--output", - "$(rootpath {})".format(manifest), - "--update-target", - update_target_label, + "--manifest-generator-hash=$(execpath {})".format(manifest_generator_hash), + "--requirements=$(rootpath {})".format(requirements) if requirements else "--requirements=", + "--pip-repository-name={}".format(pip_repository_name), + "--modules-mapping=$(execpath {})".format(modules_mapping), + "--output=$(execpath {})".format(generated_manifest), + "--update-target={}".format(update_target_label), ] - if use_pip_repository_aliases: - update_args += [ - "--use-pip-repository-aliases", - "true", - ] - - go_binary( - name = update_target, - embed = ["@com_github_benchsci_rules_python_gazelle//gazelle/manifest/generate:generate_lib"], - data = [ - manifest, + native.genrule( + name = manifest_genrule, + outs = [generated_manifest], + cmd = "$(execpath {}) {}".format(manifest_generator, " ".join(update_args)), + tools = [manifest_generator], + srcs = [ modules_mapping, - requirements, manifest_generator_hash, - ], - args = update_args, - visibility = ["//visibility:private"], - tags = ["manual"], + ] + ([requirements] if requirements else []), ) - attrs = { - "env": { - "_TEST_MANIFEST": "$(rootpath {})".format(manifest), - "_TEST_MANIFEST_GENERATOR_HASH": "$(rootpath {})".format(manifest_generator_hash), - "_TEST_REQUIREMENTS": "$(rootpath {})".format(requirements), - }, - "size": "small", - } - go_test( - name = "{}.test".format(name), - srcs = [Label("@com_github_benchsci_rules_python_gazelle//gazelle/manifest/test:test.go")], + py_binary( + name = update_target, + srcs = [Label("//manifest:copy_to_source.py")], + main = Label("//manifest:copy_to_source.py"), + args = [ + "$(rootpath {})".format(generated_manifest), + "$(rootpath {})".format(manifest), + ], data = [ + generated_manifest, manifest, - requirements, - manifest_generator_hash, ], - rundir = ".", - deps = [Label("@com_github_benchsci_rules_python_gazelle//gazelle/manifest")], - # kwargs could contain test-specific attributes like size or timeout - **dict(attrs, **kwargs) + **kwargs ) + if requirements: + attrs = { + "env": { + "_TEST_MANIFEST": "$(rootpath {})".format(manifest), + "_TEST_MANIFEST_GENERATOR_HASH": "$(rootpath {})".format(manifest_generator_hash), + "_TEST_REQUIREMENTS": "$(rootpath {})".format(requirements), + }, + "size": "small", + } + go_test( + name = test_target, + srcs = [Label("//manifest/test:test.go")], + data = [ + manifest, + requirements, + manifest_generator_hash, + ], + rundir = ".", + deps = [Label("//manifest")], + # kwargs could contain test-specific attributes like size or timeout + **dict(attrs, **kwargs) + ) + else: + diff_test( + name = test_target, + file1 = generated_manifest, + file2 = manifest, + failure_message = "Gazelle manifest is out of date. Run 'bazel run {}' to update it.".format(native.package_relative_label(update_target)), + **kwargs + ) + native.filegroup( name = name, srcs = [manifest], @@ -181,7 +197,7 @@ sources_hash = rule( ), "_hasher": attr.label( cfg = "exec", - default = Label("@com_github_benchsci_rules_python_gazelle//gazelle/manifest/hasher"), + default = Label("//manifest/hasher"), executable = True, ), }, diff --git a/gazelle/manifest/generate/BUILD.bazel b/manifest/generate/BUILD.bazel similarity index 61% rename from gazelle/manifest/generate/BUILD.bazel rename to manifest/generate/BUILD.bazel index 296d1e2..96248f4 100644 --- a/gazelle/manifest/generate/BUILD.bazel +++ b/manifest/generate/BUILD.bazel @@ -1,12 +1,12 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") -load("@com_github_benchsci_rules_python_gazelle//gazelle/manifest:defs.bzl", "sources_hash") +load("//manifest:defs.bzl", "sources_hash") go_library( name = "generate_lib", srcs = ["generate.go"], - importpath = "github.com/benchsci/rules_python_gazelle/gazelle/manifest/generate", + importpath = "github.com/bazelbuild/rules_python/gazelle/manifest/generate", visibility = ["//visibility:public"], - deps = ["//gazelle/manifest"], + deps = ["//manifest"], ) sources_hash( @@ -24,5 +24,5 @@ go_binary( filegroup( name = "distribution", srcs = glob(["**"]), - visibility = ["@com_github_benchsci_rules_python_gazelle//gazelle/manifest:__pkg__"], + visibility = ["//manifest:__pkg__"], ) diff --git a/gazelle/manifest/generate/generate.go b/manifest/generate/generate.go similarity index 78% rename from gazelle/manifest/generate/generate.go rename to manifest/generate/generate.go index cf0d03b..66c74ca 100644 --- a/gazelle/manifest/generate/generate.go +++ b/manifest/generate/generate.go @@ -31,18 +31,11 @@ import ( "github.com/benchsci/rules_python_gazelle/gazelle/manifest" ) -func init() { - if os.Getenv("BUILD_WORKSPACE_DIRECTORY") == "" { - log.Fatalln("ERROR: this program must run under Bazel") - } -} - func main() { var ( manifestGeneratorHashPath string requirementsPath string pipRepositoryName string - usePipRepositoryAliases bool modulesMappingPath string outputPath string updateTarget string @@ -63,11 +56,6 @@ func main() { "pip-repository-name", "", "The name of the pip_install or pip_repository target.") - flag.BoolVar( - &usePipRepositoryAliases, - "use-pip-repository-aliases", - true, - "Whether to use the pip-repository aliases, which are generated when passing 'incompatible_generate_aliases = True'.") flag.StringVar( &modulesMappingPath, "modules-mapping", @@ -85,10 +73,6 @@ func main() { "The Bazel target to update the YAML manifest file.") flag.Parse() - if requirementsPath == "" { - log.Fatalln("ERROR: --requirements must be set") - } - if modulesMappingPath == "" { log.Fatalln("ERROR: --modules-mapping must be set") } @@ -107,12 +91,13 @@ func main() { } header := generateHeader(updateTarget) + repository := manifest.PipRepository{ + Name: pipRepositoryName, + } manifestFile := manifest.NewFile(&manifest.Manifest{ ModulesMapping: modulesMapping, - PipRepository: &manifest.PipRepository{ - Name: pipRepositoryName, - }, + PipRepository: &repository, }) if err := writeOutput( outputPath, @@ -160,12 +145,7 @@ func writeOutput( manifestGeneratorHashPath string, requirementsPath string, ) error { - stat, err := os.Stat(outputPath) - if err != nil { - return fmt.Errorf("failed to write output: %w", err) - } - - outputFile, err := os.OpenFile(outputPath, os.O_WRONLY|os.O_TRUNC, stat.Mode()) + outputFile, err := os.OpenFile(outputPath, os.O_WRONLY|os.O_TRUNC|os.O_CREATE, 0644) if err != nil { return fmt.Errorf("failed to write output: %w", err) } @@ -175,20 +155,26 @@ func writeOutput( return fmt.Errorf("failed to write output: %w", err) } - manifestGeneratorHash, err := os.Open(manifestGeneratorHashPath) - if err != nil { - return fmt.Errorf("failed to write output: %w", err) - } - defer manifestGeneratorHash.Close() - - requirements, err := os.Open(requirementsPath) - if err != nil { - return fmt.Errorf("failed to write output: %w", err) - } - defer requirements.Close() - - if err := manifestFile.Encode(outputFile, manifestGeneratorHash, requirements); err != nil { - return fmt.Errorf("failed to write output: %w", err) + if requirementsPath != "" { + manifestGeneratorHash, err := os.Open(manifestGeneratorHashPath) + if err != nil { + return fmt.Errorf("failed to write output: %w", err) + } + defer manifestGeneratorHash.Close() + + requirements, err := os.Open(requirementsPath) + if err != nil { + return fmt.Errorf("failed to write output: %w", err) + } + defer requirements.Close() + + if err := manifestFile.EncodeWithIntegrity(outputFile, manifestGeneratorHash, requirements); err != nil { + return fmt.Errorf("failed to write output: %w", err) + } + } else { + if err := manifestFile.EncodeWithoutIntegrity(outputFile); err != nil { + return fmt.Errorf("failed to write output: %w", err) + } } return nil diff --git a/gazelle/manifest/hasher/BUILD.bazel b/manifest/hasher/BUILD.bazel similarity index 66% rename from gazelle/manifest/hasher/BUILD.bazel rename to manifest/hasher/BUILD.bazel index 93cebb5..2e7b125 100644 --- a/gazelle/manifest/hasher/BUILD.bazel +++ b/manifest/hasher/BUILD.bazel @@ -3,7 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") go_library( name = "hasher_lib", srcs = ["main.go"], - importpath = "github.com/benchsci/rules_python_gazelle/gazelle/manifest/hasher", + importpath = "github.com/bazelbuild/rules_python/gazelle/manifest/hasher", visibility = ["//visibility:private"], ) @@ -16,5 +16,5 @@ go_binary( filegroup( name = "distribution", srcs = glob(["**"]), - visibility = ["@com_github_benchsci_rules_python_gazelle//gazelle/manifest:__pkg__"], + visibility = ["//manifest:__pkg__"], ) diff --git a/gazelle/manifest/hasher/main.go b/manifest/hasher/main.go similarity index 100% rename from gazelle/manifest/hasher/main.go rename to manifest/hasher/main.go diff --git a/gazelle/manifest/manifest.go b/manifest/manifest.go similarity index 89% rename from gazelle/manifest/manifest.go rename to manifest/manifest.go index e95ef06..26b0dfb 100644 --- a/gazelle/manifest/manifest.go +++ b/manifest/manifest.go @@ -31,7 +31,7 @@ type File struct { // Integrity is the hash of the requirements.txt file and the Manifest for // ensuring the integrity of the entire gazelle_python.yaml file. This // controls the testing to keep the gazelle_python.yaml file up-to-date. - Integrity string `yaml:"integrity"` + Integrity string `yaml:"integrity,omitempty"` } // NewFile creates a new File with a given Manifest. @@ -40,12 +40,21 @@ func NewFile(manifest *Manifest) *File { } // Encode encodes the manifest file to the given writer. -func (f *File) Encode(w io.Writer, manifestGeneratorHashFile, requirements io.Reader) error { +func (f *File) EncodeWithIntegrity(w io.Writer, manifestGeneratorHashFile, requirements io.Reader) error { integrityBytes, err := f.calculateIntegrity(manifestGeneratorHashFile, requirements) if err != nil { return fmt.Errorf("failed to encode manifest file: %w", err) } f.Integrity = fmt.Sprintf("%x", integrityBytes) + + return f.encode(w) +} + +func (f *File) EncodeWithoutIntegrity(w io.Writer) error { + return f.encode(w) +} + +func (f *File) encode(w io.Writer) error { encoder := yaml.NewEncoder(w) defer encoder.Close() if err := encoder.Encode(f); err != nil { @@ -133,18 +142,15 @@ type Manifest struct { // ModulesMapping is the mapping from importable modules to which Python // wheel name provides these modules. ModulesMapping ModulesMapping `yaml:"modules_mapping"` - // PipDepsRepositoryName is the name of the pip_install repository target. + // PipDepsRepositoryName is the name of the pip_parse repository target. // DEPRECATED PipDepsRepositoryName string `yaml:"pip_deps_repository_name,omitempty"` - // PipRepository contains the information for pip_install or pip_repository + // PipRepository contains the information for pip_parse or pip_repository // target. PipRepository *PipRepository `yaml:"pip_repository,omitempty"` } type PipRepository struct { - // The name of the pip_install or pip_repository target. + // The name of the pip_parse or pip_repository target. Name string - // UsePipRepositoryAliases allows to use aliases generated pip_repository - // when passing incompatible_generate_aliases = True. - UsePipRepositoryAliases *bool `yaml:"use_pip_repository_aliases,omitempty"` } diff --git a/gazelle/manifest/manifest_test.go b/manifest/manifest_test.go similarity index 95% rename from gazelle/manifest/manifest_test.go rename to manifest/manifest_test.go index 1861abe..1caa04e 100644 --- a/gazelle/manifest/manifest_test.go +++ b/manifest/manifest_test.go @@ -40,7 +40,7 @@ var modulesMapping = manifest.ModulesMapping{ const pipDepsRepositoryName = "test_repository_name" func TestFile(t *testing.T) { - t.Run("Encode", func(t *testing.T) { + t.Run("EncodeWithIntegrity", func(t *testing.T) { f := manifest.NewFile(&manifest.Manifest{ ModulesMapping: modulesMapping, PipDepsRepositoryName: pipDepsRepositoryName, @@ -53,7 +53,7 @@ func TestFile(t *testing.T) { t.FailNow() } defer requirements.Close() - if err := f.Encode(&b, manifestGeneratorHashFile, requirements); err != nil { + if err := f.EncodeWithIntegrity(&b, manifestGeneratorHashFile, requirements); err != nil { log.Println(err) t.FailNow() } diff --git a/gazelle/manifest/test/BUILD.bazel b/manifest/test/BUILD.bazel similarity index 55% rename from gazelle/manifest/test/BUILD.bazel rename to manifest/test/BUILD.bazel index c681c02..28c6c54 100644 --- a/gazelle/manifest/test/BUILD.bazel +++ b/manifest/test/BUILD.bazel @@ -5,5 +5,5 @@ exports_files(["test.go"]) filegroup( name = "distribution", srcs = glob(["**"]), - visibility = ["@com_github_benchsci_rules_python_gazelle//gazelle/manifest:__pkg__"], + visibility = ["//manifest:__pkg__"], ) diff --git a/gazelle/manifest/test/test.go b/manifest/test/test.go similarity index 97% rename from gazelle/manifest/test/test.go rename to manifest/test/test.go index 9c2c570..72cb260 100644 --- a/gazelle/manifest/test/test.go +++ b/manifest/test/test.go @@ -26,7 +26,7 @@ import ( "path/filepath" "testing" - "github.com/benchsci/rules_python_gazelle/gazelle/manifest" + "github.com/bazelbuild/rules_python/gazelle/manifest" ) func TestGazelleManifestIsUpdated(t *testing.T) { diff --git a/gazelle/manifest/testdata/gazelle_python.yaml b/manifest/testdata/gazelle_python.yaml similarity index 100% rename from gazelle/manifest/testdata/gazelle_python.yaml rename to manifest/testdata/gazelle_python.yaml diff --git a/gazelle/manifest/testdata/requirements.txt b/manifest/testdata/requirements.txt similarity index 100% rename from gazelle/manifest/testdata/requirements.txt rename to manifest/testdata/requirements.txt diff --git a/modules_mapping/BUILD.bazel b/modules_mapping/BUILD.bazel new file mode 100644 index 0000000..d78b1fb --- /dev/null +++ b/modules_mapping/BUILD.bazel @@ -0,0 +1,15 @@ +load("@rules_python//python:defs.bzl", "py_binary") + +# gazelle:exclude *.py + +py_binary( + name = "generator", + srcs = ["generator.py"], + visibility = ["//visibility:public"], +) + +filegroup( + name = "distribution", + srcs = glob(["**"]), + visibility = ["//:__pkg__"], +) diff --git a/gazelle/modules_mapping/def.bzl b/modules_mapping/def.bzl similarity index 61% rename from gazelle/modules_mapping/def.bzl rename to modules_mapping/def.bzl index 0a9b1b7..4da6267 100644 --- a/gazelle/modules_mapping/def.bzl +++ b/modules_mapping/def.bzl @@ -1,3 +1,17 @@ +# Copyright 2023 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + """Definitions for the modules_mapping.json generation. The modules_mapping.json file is a mapping from Python modules to the wheel @@ -16,9 +30,9 @@ def _modules_mapping_impl(ctx): [whl for whl in ctx.files.wheels], transitive = [dep[DefaultInfo].files for dep in ctx.attr.wheels] + [dep[DefaultInfo].data_runfiles.files for dep in ctx.attr.wheels], ) - args.add(modules_mapping.path) - args.add_all([whl.path for whl in all_wheels.to_list()]) - + args.add("--output_file", modules_mapping.path) + args.add_all("--exclude_patterns", ctx.attr.exclude_patterns) + args.add_all("--wheels", [whl.path for whl in all_wheels.to_list()]) ctx.actions.run( inputs = all_wheels.to_list(), outputs = [modules_mapping], @@ -31,6 +45,11 @@ def _modules_mapping_impl(ctx): modules_mapping = rule( _modules_mapping_impl, attrs = { + "exclude_patterns": attr.string_list( + default = ["^_|(\\._)+"], + doc = "A set of regex patterns to match against each calculated module path. By default, exclude the modules starting with underscores.", + mandatory = False, + ), "modules_mapping_name": attr.string( default = "modules_mapping.json", doc = "The name for the output JSON file.", @@ -42,8 +61,8 @@ modules_mapping = rule( mandatory = True, ), "_generator": attr.label( - cfg = "host", - default = "//gazelle/modules_mapping:generator", + cfg = "exec", + default = "//modules_mapping:generator", executable = True, ), }, diff --git a/modules_mapping/generator.py b/modules_mapping/generator.py new file mode 100644 index 0000000..be57eac --- /dev/null +++ b/modules_mapping/generator.py @@ -0,0 +1,133 @@ +# Copyright 2023 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import argparse +import json +import pathlib +import re +import sys +import zipfile + + +# Generator is the modules_mapping.json file generator. +class Generator: + stderr = None + output_file = None + excluded_patterns = None + mapping = {} + + def __init__(self, stderr, output_file, excluded_patterns): + self.stderr = stderr + self.output_file = output_file + self.excluded_patterns = [re.compile(pattern) for pattern in excluded_patterns] + + # dig_wheel analyses the wheel .whl file determining the modules it provides + # by looking at the directory structure. + def dig_wheel(self, whl): + with zipfile.ZipFile(whl, "r") as zip_file: + for path in zip_file.namelist(): + if is_metadata(path): + if data_has_purelib_or_platlib(path): + self.module_for_path(path, whl) + else: + continue + else: + self.module_for_path(path, whl) + + def module_for_path(self, path, whl): + ext = pathlib.Path(path).suffix + if ext == ".py" or ext == ".so": + if "purelib" in path or "platlib" in path: + root = "/".join(path.split("/")[2:]) + else: + root = path + + wheel_name = get_wheel_name(whl) + + if root.endswith("/__init__.py"): + # Note the '/' here means that the __init__.py is not in the + # root of the wheel, therefore we can index the directory + # where this file is as an importable package. + module = root[: -len("/__init__.py")].replace("/", ".") + if not self.is_excluded(module): + self.mapping[module] = wheel_name + + # Always index the module file. + if ext == ".so": + # Also remove extra metadata that is embeded as part of + # the file name as an extra extension. + ext = "".join(pathlib.Path(root).suffixes) + module = root[: -len(ext)].replace("/", ".") + if not self.is_excluded(module): + self.mapping[module] = wheel_name + + def is_excluded(self, module): + for pattern in self.excluded_patterns: + if pattern.search(module): + return True + return False + + # run is the entrypoint for the generator. + def run(self, wheels): + for whl in wheels: + try: + self.dig_wheel(whl) + except AssertionError as error: + print(error, file=self.stderr) + return 1 + mapping_json = json.dumps(self.mapping) + with open(self.output_file, "w") as f: + f.write(mapping_json) + return 0 + + +def get_wheel_name(path): + pp = pathlib.PurePath(path) + if pp.suffix != ".whl": + raise RuntimeError( + "{} is not a valid wheel file name: the wheel doesn't follow ".format( + pp.name + ) + + "https://www.python.org/dev/peps/pep-0427/#file-name-convention" + ) + return pp.name[: pp.name.find("-")] + + +# is_metadata checks if the path is in a metadata directory. +# Ref: https://www.python.org/dev/peps/pep-0427/#file-contents. +def is_metadata(path): + top_level = path.split("/")[0].lower() + return top_level.endswith(".dist-info") or top_level.endswith(".data") + + +# The .data is allowed to contain a full purelib or platlib directory +# These get unpacked into site-packages, so require indexing too. +# This is the same if "Root-Is-Purelib: true" is set and the files are at the root. +# Ref: https://peps.python.org/pep-0427/#what-s-the-deal-with-purelib-vs-platlib +def data_has_purelib_or_platlib(path): + maybe_lib = path.split("/")[1].lower() + return is_metadata(path) and (maybe_lib == "purelib" or maybe_lib == "platlib") + + +if __name__ == "__main__": + parser = argparse.ArgumentParser( + prog="generator", + description="Generates the modules mapping used by the Gazelle manifest.", + ) + parser.add_argument("--output_file", type=str) + parser.add_argument("--exclude_patterns", nargs="+", default=[]) + parser.add_argument("--wheels", nargs="+", default=[]) + args = parser.parse_args() + generator = Generator(sys.stderr, args.output_file, args.exclude_patterns) + exit(generator.run(args.wheels)) diff --git a/python/BUILD.bazel b/python/BUILD.bazel new file mode 100644 index 0000000..2b84dc1 --- /dev/null +++ b/python/BUILD.bazel @@ -0,0 +1,114 @@ +load("@bazel_gazelle//:def.bzl", "gazelle_binary") +load("@bazel_skylib//rules:copy_file.bzl", "copy_file") +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") +load(":gazelle_test.bzl", "gazelle_test") + +go_library( + name = "python", + srcs = [ + "configure.go", + "file_parser.go", + "fix.go", + "generate.go", + "kinds.go", + "language.go", + "parser.go", + "resolve.go", + "std_modules.go", + "target.go", + ], + # NOTE @aignas 2023-12-03: currently gazelle does not support embedding + # generated files, but 3.11.txt is generated by a build rule. + # + # You will get a benign error like when running gazelle locally: + # > 8 gazelle: .../rules_python/gazelle/python/std_modules.go:24:3: pattern 3.11.txt: matched no files + # + # See following for more info: + # https://github.com/bazelbuild/bazel-gazelle/issues/1513 + embedsrcs = ["stdlib_list.txt"], # keep # TODO: use user-defined version? + importpath = "github.com/benchsci/rules_python_gazelle/gazelle/python", + visibility = ["//visibility:public"], + deps = [ + "//manifest", + "//pythonconfig", + "@bazel_gazelle//config:go_default_library", + "@bazel_gazelle//label:go_default_library", + "@bazel_gazelle//language:go_default_library", + "@bazel_gazelle//repo:go_default_library", + "@bazel_gazelle//resolve:go_default_library", + "@bazel_gazelle//rule:go_default_library", + "@com_github_bazelbuild_buildtools//build:go_default_library", + "@com_github_bmatcuk_doublestar_v4//:doublestar", + "@com_github_emirpasic_gods//lists/singlylinkedlist", + "@com_github_emirpasic_gods//sets/treeset", + "@com_github_emirpasic_gods//utils", + "@com_github_smacker_go_tree_sitter//:go-tree-sitter", + "@com_github_smacker_go_tree_sitter//python", + "@org_golang_x_sync//errgroup", + ], +) + +copy_file( + name = "stdlib_list", + src = select( + { + "@rules_python//python/config_settings:is_python_3.10": "@python_stdlib_list_3_10//file", + "@rules_python//python/config_settings:is_python_3.11": "@python_stdlib_list_3_11//file", + "@rules_python//python/config_settings:is_python_3.12": "@python_stdlib_list_3_12//file", + "@rules_python//python/config_settings:is_python_3.8": "@python_stdlib_list_3_8//file", + "@rules_python//python/config_settings:is_python_3.9": "@python_stdlib_list_3_9//file", + # This is the same behaviour as previously + "//conditions:default": "@python_stdlib_list_3_11//file", + }, + ), + out = "stdlib_list.txt", + allow_symlink = True, +) + +# gazelle:exclude testdata/ + +gazelle_test( + name = "python_test", + srcs = ["python_test.go"], + data = [ + ":gazelle_binary", + ], + test_dirs = glob( + # Use this so that we don't need to manually maintain the list. + ["testdata/*"], + exclude = ["testdata/*.md"], + # The directories aren't inputs themselves; we just want their + # names. + exclude_directories = 0, + ), + deps = [ + "@bazel_gazelle//testtools:go_default_library", + "@com_github_ghodss_yaml//:yaml", + "@io_bazel_rules_go//go/runfiles:go_default_library", + "@io_bazel_rules_go//go/tools/bazel:go_default_library", + ], +) + +gazelle_binary( + name = "gazelle_binary", + languages = [":python"], + visibility = ["//visibility:public"], +) + +filegroup( + name = "distribution", + srcs = glob(["**"]), + visibility = ["//:__pkg__"], +) + +go_test( + name = "default_test", + srcs = [ + "file_parser_test.go", + "std_modules_test.go", + ], + embed = [":python"], + deps = [ + "@com_github_stretchr_testify//assert", + ], +) diff --git a/gazelle/configure.go b/python/configure.go similarity index 69% rename from gazelle/configure.go rename to python/configure.go index 104c67f..61b8a9b 100644 --- a/gazelle/configure.go +++ b/python/configure.go @@ -1,3 +1,17 @@ +// Copyright 2023 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package python import ( @@ -11,9 +25,9 @@ import ( "github.com/bazelbuild/bazel-gazelle/config" "github.com/bazelbuild/bazel-gazelle/rule" - "github.com/benchsci/rules_python_gazelle/gazelle/manifest" "github.com/benchsci/rules_python_gazelle/gazelle/pythonconfig" + "github.com/bmatcuk/doublestar/v4" ) // Configurer satisfies the config.Configurer interface. It's the @@ -45,12 +59,14 @@ func (py *Configurer) KnownDirectives() []string { pythonconfig.IgnoreDependenciesDirective, pythonconfig.ValidateImportStatementsDirective, pythonconfig.GenerationMode, + pythonconfig.GenerationModePerFileIncludeInit, pythonconfig.LibraryNamingConvention, pythonconfig.BinaryNamingConvention, pythonconfig.TestNamingConvention, pythonconfig.PytestConfTest, - pythonconfig.PyCheck, - pythonconfig.PyModule, + pythonconfig.DefaultVisibilty, + pythonconfig.Visibility, + pythonconfig.TestFilePattern, } } @@ -92,7 +108,7 @@ func (py *Configurer) Configure(c *config.Config, rel string, f *rule.File) { case "exclude": // We record the exclude directive for coarse-grained packages // since we do manual tree traversal in this mode. - config.AddExcludedPattern(strings.TrimSpace(d.Value)) + config.AddExcludedPattern(filepath.Join(rel, strings.TrimSpace(d.Value))) case pythonconfig.PythonExtensionDirective: switch d.Value { case "enabled": @@ -104,30 +120,9 @@ func (py *Configurer) Configure(c *config.Config, rel string, f *rule.File) { pythonconfig.PythonExtensionDirective, d.Value) log.Fatal(err) } - case pythonconfig.PyModule: - switch d.Value { - case "enabled": - config.SetPyModule(true) - case "disabled": - config.SetPyModule(false) - default: - err := fmt.Errorf("invalid value for directive %q: %s: possible values are enabled/disabled", - pythonconfig.PyModule, d.Value) - log.Fatal(err) - } - case pythonconfig.PyCheck: - switch d.Value { - case "enabled": - config.SetPyCheck(d.Value) - case "disabled": - config.SetPyCheck(d.Value) - default: - err := fmt.Errorf("invalid value for directive %q: %s: possible values are enabled/disabled", - pythonconfig.PyCheck, d.Value) - log.Fatal(err) - } case pythonconfig.PythonRootDirective: config.SetPythonProjectRoot(rel) + config.SetDefaultVisibility([]string{fmt.Sprintf(pythonconfig.DefaultVisibilityFmtString, rel)}) case pythonconfig.PythonManifestFileNameDirective: gazelleManifestFilename = strings.TrimSpace(d.Value) case pythonconfig.IgnoreFilesDirective: @@ -148,13 +143,24 @@ func (py *Configurer) Configure(c *config.Config, rel string, f *rule.File) { switch pythonconfig.GenerationModeType(strings.TrimSpace(d.Value)) { case pythonconfig.GenerationModePackage: config.SetCoarseGrainedGeneration(false) + config.SetPerFileGeneration(false) + case pythonconfig.GenerationModeFile: + config.SetCoarseGrainedGeneration(false) + config.SetPerFileGeneration(true) case pythonconfig.GenerationModeProject: config.SetCoarseGrainedGeneration(true) + config.SetPerFileGeneration(false) default: err := fmt.Errorf("invalid value for directive %q: %s", pythonconfig.GenerationMode, d.Value) log.Fatal(err) } + case pythonconfig.GenerationModePerFileIncludeInit: + v, err := strconv.ParseBool(strings.TrimSpace(d.Value)) + if err != nil { + log.Fatal(err) + } + config.SetPerFileGenerationIncludeInit(v) case pythonconfig.LibraryNamingConvention: config.SetLibraryNamingConvention(strings.TrimSpace(d.Value)) case pythonconfig.BinaryNamingConvention: @@ -163,6 +169,35 @@ func (py *Configurer) Configure(c *config.Config, rel string, f *rule.File) { config.SetTestNamingConvention(strings.TrimSpace(d.Value)) case pythonconfig.PytestConfTest: config.SetPytestConfTest(strings.TrimSpace(d.Value)) + case pythonconfig.DefaultVisibilty: + switch directiveArg := strings.TrimSpace(d.Value); directiveArg { + case "NONE": + config.SetDefaultVisibility([]string{}) + case "DEFAULT": + pythonProjectRoot := config.PythonProjectRoot() + defaultVisibility := fmt.Sprintf(pythonconfig.DefaultVisibilityFmtString, pythonProjectRoot) + config.SetDefaultVisibility([]string{defaultVisibility}) + default: + // Handle injecting the python root. Assume that the user used the + // exact string "$python_root$". + labels := strings.ReplaceAll(directiveArg, "$python_root$", config.PythonProjectRoot()) + config.SetDefaultVisibility(strings.Split(labels, ",")) + } + case pythonconfig.Visibility: + labels := strings.ReplaceAll(strings.TrimSpace(d.Value), "$python_root$", config.PythonProjectRoot()) + config.AppendVisibility(labels) + case pythonconfig.TestFilePattern: + value := strings.TrimSpace(d.Value) + if value == "" { + log.Fatal("directive 'python_test_file_pattern' requires a value") + } + globStrings := strings.Split(value, ",") + for _, g := range globStrings { + if !doublestar.ValidatePattern(g) { + log.Fatalf("invalid glob pattern '%s'", g) + } + } + config.SetTestFilePattern(globStrings) } } diff --git a/python/extensions.bzl b/python/extensions.bzl new file mode 100644 index 0000000..8d339c0 --- /dev/null +++ b/python/extensions.bzl @@ -0,0 +1,5 @@ +"python_stdlib_list module extension for use with bzlmod" + +load("//python/private:extensions.bzl", _python_stdlib_list = "python_stdlib_list") + +python_stdlib_list = _python_stdlib_list diff --git a/python/file_parser.go b/python/file_parser.go new file mode 100644 index 0000000..a2b22c2 --- /dev/null +++ b/python/file_parser.go @@ -0,0 +1,201 @@ +// Copyright 2023 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package python + +import ( + "context" + "fmt" + "os" + "path/filepath" + "strings" + + sitter "github.com/smacker/go-tree-sitter" + "github.com/smacker/go-tree-sitter/python" +) + +const ( + sitterNodeTypeString = "string" + sitterNodeTypeComment = "comment" + sitterNodeTypeIdentifier = "identifier" + sitterNodeTypeDottedName = "dotted_name" + sitterNodeTypeIfStatement = "if_statement" + sitterNodeTypeAliasedImport = "aliased_import" + sitterNodeTypeWildcardImport = "wildcard_import" + sitterNodeTypeImportStatement = "import_statement" + sitterNodeTypeComparisonOperator = "comparison_operator" + sitterNodeTypeImportFromStatement = "import_from_statement" +) + +type ParserOutput struct { + FileName string + Modules []module + Comments []comment + HasMain bool +} + +type FileParser struct { + code []byte + relFilepath string + output ParserOutput +} + +func NewFileParser() *FileParser { + return &FileParser{} +} + +func ParseCode(code []byte) (*sitter.Node, error) { + parser := sitter.NewParser() + parser.SetLanguage(python.GetLanguage()) + + tree, err := parser.ParseCtx(context.Background(), nil, code) + if err != nil { + return nil, err + } + + return tree.RootNode(), nil +} + +func (p *FileParser) parseMain(ctx context.Context, node *sitter.Node) bool { + for i := 0; i < int(node.ChildCount()); i++ { + if err := ctx.Err(); err != nil { + return false + } + child := node.Child(i) + if child.Type() == sitterNodeTypeIfStatement && + child.Child(1).Type() == sitterNodeTypeComparisonOperator && child.Child(1).Child(1).Type() == "==" { + statement := child.Child(1) + a, b := statement.Child(0), statement.Child(2) + // convert "'__main__' == __name__" to "__name__ == '__main__'" + if b.Type() == sitterNodeTypeIdentifier { + a, b = b, a + } + if a.Type() == sitterNodeTypeIdentifier && a.Content(p.code) == "__name__" && + // at github.com/smacker/go-tree-sitter@latest (after v0.0.0-20240422154435-0628b34cbf9c we used) + // "__main__" is the second child of b. But now, it isn't. + // we cannot use the latest go-tree-sitter because of the top level reference in scanner.c. + // https://github.com/smacker/go-tree-sitter/blob/04d6b33fe138a98075210f5b770482ded024dc0f/python/scanner.c#L1 + b.Type() == sitterNodeTypeString && string(p.code[b.StartByte()+1:b.EndByte()-1]) == "__main__" { + return true + } + } + } + return false +} + +func parseImportStatement(node *sitter.Node, code []byte) (module, bool) { + switch node.Type() { + case sitterNodeTypeDottedName: + return module{ + Name: node.Content(code), + LineNumber: node.StartPoint().Row + 1, + }, true + case sitterNodeTypeAliasedImport: + return parseImportStatement(node.Child(0), code) + case sitterNodeTypeWildcardImport: + return module{ + Name: "*", + LineNumber: node.StartPoint().Row + 1, + }, true + } + return module{}, false +} + +func (p *FileParser) parseImportStatements(node *sitter.Node) bool { + if node.Type() == sitterNodeTypeImportStatement { + for j := 1; j < int(node.ChildCount()); j++ { + m, ok := parseImportStatement(node.Child(j), p.code) + if !ok { + continue + } + m.Filepath = p.relFilepath + if strings.HasPrefix(m.Name, ".") { + continue + } + p.output.Modules = append(p.output.Modules, m) + } + } else if node.Type() == sitterNodeTypeImportFromStatement { + from := node.Child(1).Content(p.code) + if strings.HasPrefix(from, ".") { + return true + } + for j := 3; j < int(node.ChildCount()); j++ { + m, ok := parseImportStatement(node.Child(j), p.code) + if !ok { + continue + } + m.Filepath = p.relFilepath + m.From = from + m.Name = fmt.Sprintf("%s.%s", from, m.Name) + p.output.Modules = append(p.output.Modules, m) + } + } else { + return false + } + return true +} + +func (p *FileParser) parseComments(node *sitter.Node) bool { + if node.Type() == sitterNodeTypeComment { + p.output.Comments = append(p.output.Comments, comment(node.Content(p.code))) + return true + } + return false +} + +func (p *FileParser) SetCodeAndFile(code []byte, relPackagePath, filename string) { + p.code = code + p.relFilepath = filepath.Join(relPackagePath, filename) + p.output.FileName = filename +} + +func (p *FileParser) parse(ctx context.Context, node *sitter.Node) { + if node == nil { + return + } + for i := 0; i < int(node.ChildCount()); i++ { + if err := ctx.Err(); err != nil { + return + } + child := node.Child(i) + if p.parseImportStatements(child) { + continue + } + if p.parseComments(child) { + continue + } + p.parse(ctx, child) + } +} + +func (p *FileParser) Parse(ctx context.Context) (*ParserOutput, error) { + rootNode, err := ParseCode(p.code) + if err != nil { + return nil, err + } + + p.output.HasMain = p.parseMain(ctx, rootNode) + + p.parse(ctx, rootNode) + return &p.output, nil +} + +func (p *FileParser) ParseFile(ctx context.Context, repoRoot, relPackagePath, filename string) (*ParserOutput, error) { + code, err := os.ReadFile(filepath.Join(repoRoot, relPackagePath, filename)) + if err != nil { + return nil, err + } + p.SetCodeAndFile(code, relPackagePath, filename) + return p.Parse(ctx) +} diff --git a/python/file_parser_test.go b/python/file_parser_test.go new file mode 100644 index 0000000..3682cff --- /dev/null +++ b/python/file_parser_test.go @@ -0,0 +1,256 @@ +// Copyright 2023 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package python + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestParseImportStatements(t *testing.T) { + t.Parallel() + units := []struct { + name string + code string + filepath string + result []module + }{ + { + name: "not has import", + code: "a = 1\nb = 2", + filepath: "", + result: nil, + }, + { + name: "has import", + code: "import unittest\nimport os.path\nfrom foo.bar import abc.xyz", + filepath: "abc.py", + result: []module{ + { + Name: "unittest", + LineNumber: 1, + Filepath: "abc.py", + From: "", + }, + { + Name: "os.path", + LineNumber: 2, + Filepath: "abc.py", + From: "", + }, + { + Name: "foo.bar.abc.xyz", + LineNumber: 3, + Filepath: "abc.py", + From: "foo.bar", + }, + }, + }, + { + name: "has import in def", + code: `def foo(): + import unittest +`, + filepath: "abc.py", + result: []module{ + { + Name: "unittest", + LineNumber: 2, + Filepath: "abc.py", + From: "", + }, + }, + }, + { + name: "invalid syntax", + code: "import os\nimport", + filepath: "abc.py", + result: []module{ + { + Name: "os", + LineNumber: 1, + Filepath: "abc.py", + From: "", + }, + }, + }, + { + name: "import as", + code: "import os as b\nfrom foo import bar as c# 123", + filepath: "abc.py", + result: []module{ + { + Name: "os", + LineNumber: 1, + Filepath: "abc.py", + From: "", + }, + { + Name: "foo.bar", + LineNumber: 2, + Filepath: "abc.py", + From: "foo", + }, + }, + }, + // align to https://docs.python.org/3/reference/simple_stmts.html#index-34 + { + name: "complex import", + code: "from unittest import *\nfrom foo import (bar as c, baz, qux as d)\nfrom . import abc", + result: []module{ + { + Name: "unittest.*", + LineNumber: 1, + From: "unittest", + }, + { + Name: "foo.bar", + LineNumber: 2, + From: "foo", + }, + { + Name: "foo.baz", + LineNumber: 2, + From: "foo", + }, + { + Name: "foo.qux", + LineNumber: 2, + From: "foo", + }, + }, + }, + } + for _, u := range units { + t.Run(u.name, func(t *testing.T) { + p := NewFileParser() + code := []byte(u.code) + p.SetCodeAndFile(code, "", u.filepath) + output, err := p.Parse(context.Background()) + assert.NoError(t, err) + assert.Equal(t, u.result, output.Modules) + }) + } +} + +func TestParseComments(t *testing.T) { + t.Parallel() + units := []struct { + name string + code string + result []comment + }{ + { + name: "not has comment", + code: "a = 1\nb = 2", + result: nil, + }, + { + name: "has comment", + code: "# a = 1\n# b = 2", + result: []comment{"# a = 1", "# b = 2"}, + }, + { + name: "has comment in if", + code: "if True:\n # a = 1\n # b = 2", + result: []comment{"# a = 1", "# b = 2"}, + }, + { + name: "has comment inline", + code: "import os# 123\nfrom pathlib import Path as b#456", + result: []comment{"# 123", "#456"}, + }, + } + for _, u := range units { + t.Run(u.name, func(t *testing.T) { + p := NewFileParser() + code := []byte(u.code) + p.SetCodeAndFile(code, "", "") + output, err := p.Parse(context.Background()) + assert.NoError(t, err) + assert.Equal(t, u.result, output.Comments) + }) + } +} + +func TestParseMain(t *testing.T) { + t.Parallel() + units := []struct { + name string + code string + result bool + }{ + { + name: "not has main", + code: "a = 1\nb = 2", + result: false, + }, + { + name: "has main in function", + code: `def foo(): + if __name__ == "__main__": + a = 3 +`, + result: false, + }, + { + name: "has main", + code: ` +import unittest + +from lib import main + + +class ExampleTest(unittest.TestCase): + def test_main(self): + self.assertEqual( + "", + main([["A", 1], ["B", 2]]), + ) + + +if __name__ == "__main__": + unittest.main() +`, + result: true, + }, + } + for _, u := range units { + t.Run(u.name, func(t *testing.T) { + p := NewFileParser() + code := []byte(u.code) + p.SetCodeAndFile(code, "", "") + output, err := p.Parse(context.Background()) + assert.NoError(t, err) + assert.Equal(t, u.result, output.HasMain) + }) + } +} + +func TestParseFull(t *testing.T) { + p := NewFileParser() + code := []byte(`from bar import abc`) + p.SetCodeAndFile(code, "foo", "a.py") + output, err := p.Parse(context.Background()) + assert.NoError(t, err) + assert.Equal(t, ParserOutput{ + Modules: []module{{Name: "bar.abc", LineNumber: 1, Filepath: "foo/a.py", From: "bar"}}, + Comments: nil, + HasMain: false, + FileName: "a.py", + }, *output) +} diff --git a/python/fix.go b/python/fix.go new file mode 100644 index 0000000..e0b8bb0 --- /dev/null +++ b/python/fix.go @@ -0,0 +1,32 @@ +// Copyright 2023 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package python + +import ( + "github.com/bazelbuild/bazel-gazelle/config" + "github.com/bazelbuild/bazel-gazelle/rule" +) + +// Fix repairs deprecated usage of language-specific rules in f. This is +// called before the file is indexed. Unless c.ShouldFix is true, fixes +// that delete or rename rules should not be performed. +func (py *Python) Fix(c *config.Config, f *rule.File) { + // TODO(f0rmiga): implement. + for _, t := range f.Rules { + if t.Kind() == "py_library" && t.Attr("main") != nil { + t.DelAttr("main") + } + } +} diff --git a/python/gazelle_test.bzl b/python/gazelle_test.bzl new file mode 100644 index 0000000..7c0c242 --- /dev/null +++ b/python/gazelle_test.bzl @@ -0,0 +1,49 @@ +# Copyright 2023 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"" + +load("@io_bazel_rules_go//go:def.bzl", "go_test") + +def gazelle_test(*, name, test_dirs, **kwargs): + """A simple macro to better cache gazelle integration tests + + Args: + name (str): The name of the test suite target to be created and + the prefix to all of the individual test targets. + test_dirs (list[str]): The list of dirs in the 'testdata' + directory that we should create separate 'go_test' cases for. + Each of them will be prefixed with '{name}'. + **kwargs: extra arguments passed to 'go_test'. + """ + tests = [] + + data = kwargs.pop("data", []) + + for dir in test_dirs: + _, _, basename = dir.rpartition("/") + + test = "{}_{}".format(name, basename) + tests.append(test) + + go_test( + name = test, + data = native.glob(["{}/**".format(dir)]) + data, + **kwargs + ) + + native.test_suite( + name = name, + tests = tests, + ) diff --git a/python/generate.go b/python/generate.go new file mode 100644 index 0000000..9ab8bdd --- /dev/null +++ b/python/generate.go @@ -0,0 +1,461 @@ +// Copyright 2023 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package python + +import ( + "bufio" + "fmt" + "io/fs" + "log" + "os" + "path/filepath" + "regexp" + "sort" + "strings" + + "github.com/bazelbuild/bazel-gazelle/config" + "github.com/bazelbuild/bazel-gazelle/label" + "github.com/bazelbuild/bazel-gazelle/language" + "github.com/bazelbuild/bazel-gazelle/rule" + "github.com/bmatcuk/doublestar/v4" + "github.com/emirpasic/gods/lists/singlylinkedlist" + "github.com/emirpasic/gods/sets/treeset" + godsutils "github.com/emirpasic/gods/utils" + + "github.com/benchsci/rules_python_gazelle/gazelle/pythonconfig" +) + +const ( + pyLibraryEntrypointFilename = "__init__.py" + pyBinaryEntrypointFilename = "__main__.py" + pyTestEntrypointFilename = "__test__.py" + pyTestEntrypointTargetname = "__test__" + conftestFilename = "conftest.py" + conftestTargetname = "conftest" +) + +var ( + buildFilenames = []string{"BUILD", "BUILD.bazel"} +) + +func GetActualKindName(kind string, args language.GenerateArgs) string { + if kindOverride, ok := args.Config.KindMap[kind]; ok { + return kindOverride.KindName + } + return kind +} + +func matchesAnyGlob(s string, globs []string) bool { + // This function assumes that the globs have already been validated. If a glob is + // invalid, it's considered a non-match and we move on to the next pattern. + for _, g := range globs { + if ok, _ := doublestar.Match(g, s); ok { + return true + } + } + return false +} + +// GenerateRules extracts build metadata from source files in a directory. +// GenerateRules is called in each directory where an update is requested +// in depth-first post-order. +func (py *Python) GenerateRules(args language.GenerateArgs) language.GenerateResult { + cfgs := args.Config.Exts[languageName].(pythonconfig.Configs) + cfg := cfgs[args.Rel] + + if !cfg.ExtensionEnabled() { + return language.GenerateResult{} + } + + if !isBazelPackage(args.Dir) { + if cfg.CoarseGrainedGeneration() { + // Determine if the current directory is the root of the coarse-grained + // generation. If not, return without generating anything. + parent := cfg.Parent() + if parent != nil && parent.CoarseGrainedGeneration() { + return language.GenerateResult{} + } + } else if !hasEntrypointFile(args.Dir) { + return language.GenerateResult{} + } + } + + actualPyBinaryKind := GetActualKindName(pyBinaryKind, args) + actualPyLibraryKind := GetActualKindName(pyLibraryKind, args) + actualPyTestKind := GetActualKindName(pyTestKind, args) + actualDjangoTestKind := GetActualKindName(djangoTestKind, args) + + pythonProjectRoot := cfg.PythonProjectRoot() + + packageName := filepath.Base(args.Dir) + + pyLibraryFilenames := treeset.NewWith(godsutils.StringComparator) + pyTestFilenames := treeset.NewWith(godsutils.StringComparator) + pyFileNames := treeset.NewWith(godsutils.StringComparator) + djangoTestFilesNames := treeset.NewWith(godsutils.StringComparator) + + testFileGlobs := cfg.TestFilePattern() + + for _, f := range args.RegularFiles { + if cfg.IgnoresFile(filepath.Base(f)) { + continue + } + ext := filepath.Ext(f) + if ext == ".py" { + pyFileNames.Add(f) + if isDjangoTestFile(filepath.Join(args.Dir, f)) && matchesAnyGlob(f, testFileGlobs) { + djangoTestFilesNames.Add(f) + + } else if matchesAnyGlob(f, testFileGlobs) { + pyTestFilenames.Add(f) + } else { + pyLibraryFilenames.Add(f) + } + } + } + + // Add files from subdirectories if they meet the criteria. + for _, d := range args.Subdirs { + // boundaryPackages represents child Bazel packages that are used as a + // boundary to stop processing under that tree. + boundaryPackages := make(map[string]struct{}) + err := filepath.WalkDir( + filepath.Join(args.Dir, d), + func(path string, entry fs.DirEntry, err error) error { + if err != nil { + return err + } + // Ignore the path if it crosses any boundary package. Walking + // the tree is still important because subsequent paths can + // represent files that have not crossed any boundaries. + for bp := range boundaryPackages { + if strings.HasPrefix(path, bp) { + return nil + } + } + if entry.IsDir() { + // If we are visiting a directory, we determine if we should + // halt digging the tree based on a few criterias: + // 1. We are using per-file generation. + // 2. The directory has a BUILD or BUILD.bazel files. Then + // it doesn't matter at all what it has since it's a + // separate Bazel package. + // 3. (only for package generation) The directory has an + // __init__.py, __main__.py or __test__.py, meaning a + // BUILD file will be generated. + if cfg.PerFileGeneration() { + return fs.SkipDir + } + + if isBazelPackage(path) { + boundaryPackages[path] = struct{}{} + return nil + } + + if !cfg.CoarseGrainedGeneration() && hasEntrypointFile(path) { + return fs.SkipDir + } + + return nil + } + if filepath.Ext(path) == ".py" { + if cfg.CoarseGrainedGeneration() || !isEntrypointFile(path) { + srcPath, _ := filepath.Rel(args.Dir, path) + repoPath := filepath.Join(args.Rel, srcPath) + excludedPatterns := cfg.ExcludedPatterns() + if excludedPatterns != nil { + it := excludedPatterns.Iterator() + for it.Next() { + excludedPattern := it.Value().(string) + isExcluded, err := doublestar.Match(excludedPattern, repoPath) + if err != nil { + return err + } + if isExcluded { + return nil + } + } + } + baseName := filepath.Base(path) + if matchesAnyGlob(baseName, testFileGlobs) { + pyTestFilenames.Add(srcPath) + } else { + pyLibraryFilenames.Add(srcPath) + } + } + } + return nil + }, + ) + if err != nil { + log.Printf("ERROR: %v\n", err) + return language.GenerateResult{} + } + } + + parser := newPython3Parser(args.Config.RepoRoot, args.Rel, cfg.IgnoresDependency) + + var result language.GenerateResult + result.Gen = make([]*rule.Rule, 0) + + collisionErrors := singlylinkedlist.New() + + appendPyLibrary := func(srcs *treeset.Set, pyLibraryTargetName string) { + allDeps, mainModules, annotations, err := parser.parse(srcs) + if err != nil { + log.Fatalf("ERROR: %v\n", err) + } + + // Creating one py_binary target per main module when __main__.py doesn't exist. + mainFileNames := make([]string, 0, len(mainModules)) + for name := range mainModules { + mainFileNames = append(mainFileNames, name) + + // Remove the file from srcs if we're doing per-file library generation so + // that we don't also generate a py_library target for it. + if cfg.PerFileGeneration() { + srcs.Remove(name) + } + } + sort.Strings(mainFileNames) + for _, filename := range mainFileNames { + pyBinaryTargetName := strings.TrimSuffix(filepath.Base(filename), ".py") + if err := ensureNoCollision(args.File, pyBinaryTargetName, actualPyBinaryKind); err != nil { + fqTarget := label.New("", args.Rel, pyBinaryTargetName) + log.Printf("failed to generate target %q of kind %q: %v", + fqTarget.String(), actualPyBinaryKind, err) + continue + } + pyBinary := newTargetBuilder(pyBinaryKind, pyBinaryTargetName, pythonProjectRoot, args.Rel, pyFileNames). + addSrc(filename). + setMain(filename). + addModuleDependencies(mainModules[filename]). + addResolvedDependencies(annotations.includeDeps). + generateImportsAttribute().build() + result.Gen = append(result.Gen, pyBinary) + result.Imports = append(result.Imports, pyBinary.PrivateAttr(config.GazelleImportsKey)) + } + + // If we're doing per-file generation, srcs could be empty at this point, meaning we shouldn't make a py_library. + if srcs.Empty() { + return + } + + // Check if a target with the same name we are generating already + // exists, and if it is of a different kind from the one we are + // generating. If so, we have to throw an error since Gazelle won't + // generate it correctly. + if err := ensureNoCollision(args.File, pyLibraryTargetName, actualPyLibraryKind); err != nil { + fqTarget := label.New("", args.Rel, pyLibraryTargetName) + err := fmt.Errorf("failed to generate target %q of kind %q: %w. "+ + "Use the '# gazelle:%s' directive to change the naming convention.", + fqTarget.String(), actualPyLibraryKind, err, pythonconfig.LibraryNamingConvention) + collisionErrors.Add(err) + } + + pyLibrary := newTargetBuilder(pyLibraryKind, pyLibraryTargetName, pythonProjectRoot, args.Rel, pyFileNames). + addSrcs(srcs). + addModuleDependencies(allDeps). + addResolvedDependencies(annotations.includeDeps). + generateImportsAttribute(). + build() + + // If py_library is reanmed from py_binary, remove the main attribute + pyLibrary.DelAttr("main") + result.Gen = append(result.Gen, pyLibrary) + result.Imports = append(result.Imports, pyLibrary.PrivateAttr(config.GazelleImportsKey)) + } + + var pyTestTargets []*targetBuilder + newPyTestTargetBuilder := func(srcs *treeset.Set, pyTestTargetName string) *targetBuilder { + deps, _, annotations, err := parser.parse(srcs) + if err != nil { + log.Fatalf("ERROR: %v\n", err) + } + // Check if a target with the same name we are generating already + // exists, and if it is of a different kind from the one we are + // generating. If so, we have to throw an error since Gazelle won't + // generate it correctly. + if err := ensureNoCollision(args.File, pyTestTargetName, actualPyTestKind); err != nil { + fqTarget := label.New("", args.Rel, pyTestTargetName) + err := fmt.Errorf("failed to generate target %q of kind %q: %w. "+ + "Use the '# gazelle:%s' directive to change the naming convention.", + fqTarget.String(), actualPyTestKind, err, pythonconfig.TestNamingConvention) + collisionErrors.Add(err) + } + return newTargetBuilder(pyTestKind, pyTestTargetName, pythonProjectRoot, args.Rel, pyFileNames). + addSrcs(srcs). + addModuleDependencies(deps). + addResolvedDependencies(annotations.includeDeps). + generateImportsAttribute() + } + newDjangoTestBuilder := func(srcs *treeset.Set, djangoTestTargetName string) *targetBuilder { + deps, _, annotations, err := parser.parse(srcs) + if err != nil { + log.Fatalf("ERROR: %v\n", err) + } + // Check if a target with the same name we are generating already + // exists, and if it is of a different kind from the one we are + // generating. If so, we have to throw an error since Gazelle won't + // generate it correctly. + if err := ensureNoCollision(args.File, djangoTestTargetName, actualDjangoTestKind); err != nil { + fqTarget := label.New("", args.Rel, actualDjangoTestKind) + err := fmt.Errorf("failed to generate target %q of kind %q: %w. "+ + "Use the '# gazelle:%s' directive to change the naming convention.", + fqTarget.String(), actualDjangoTestKind, err, pythonconfig.TestNamingConvention) + collisionErrors.Add(err) + } + return newTargetBuilder(djangoTestKind, djangoTestTargetName, pythonProjectRoot, args.Rel, pyFileNames). + addSrcs(srcs). + addModuleDependencies(deps). + addResolvedDependencies(annotations.includeDeps). + generateImportsAttribute() + } + if cfg.PerFileGeneration() { + hasInit, nonEmptyInit := hasLibraryEntrypointFile(args.Dir) + pyLibraryFilenames.Each(func(index int, filename interface{}) { + pyLibraryTargetName := strings.TrimSuffix(filepath.Base(filename.(string)), ".py") + if filename == pyLibraryEntrypointFilename && !nonEmptyInit { + return // ignore empty __init__.py. + } + srcs := treeset.NewWith(godsutils.StringComparator, filename) + if cfg.PerFileGenerationIncludeInit() && hasInit && nonEmptyInit { + srcs.Add(pyLibraryEntrypointFilename) + } + appendPyLibrary(srcs, pyLibraryTargetName) + }) + } else { + appendPyLibrary(pyLibraryFilenames, cfg.RenderLibraryName(packageName)) + } + // Create one py_test target per file + pyTestFilenames.Each(func(index int, testFile interface{}) { + srcs := treeset.NewWith(godsutils.StringComparator, testFile) + pyTestTargetName := strings.TrimSuffix(filepath.Base(testFile.(string)), ".py") + pyTestTarget := newPyTestTargetBuilder(srcs, pyTestTargetName) + + pyTestTarget.setMain(testFile.(string)) + pyTestTargets = append(pyTestTargets, pyTestTarget) + }) + + for _, pyTestTarget := range pyTestTargets { + pyTest := pyTestTarget.build() + + result.Gen = append(result.Gen, pyTest) + result.Imports = append(result.Imports, pyTest.PrivateAttr(config.GazelleImportsKey)) + } + if !djangoTestFilesNames.Empty() { + //pyTestTargetName := cfg.RenderTestName(packageName) + djangoTestTarget := newDjangoTestBuilder(djangoTestFilesNames, "django_test").setConftest(cfg.PytestConfTest()).build() + + result.Gen = append(result.Gen, djangoTestTarget) + result.Imports = append(result.Imports, djangoTestTarget.PrivateAttr(config.GazelleImportsKey)) + } + + if !collisionErrors.Empty() { + it := collisionErrors.Iterator() + for it.Next() { + log.Printf("ERROR: %v\n", it.Value()) + } + os.Exit(1) + } + + return result +} + +// isBazelPackage determines if the directory is a Bazel package by probing for +// the existence of a known BUILD file name. +func isBazelPackage(dir string) bool { + for _, buildFilename := range buildFilenames { + path := filepath.Join(dir, buildFilename) + if _, err := os.Stat(path); err == nil { + return true + } + } + return false +} + +// hasEntrypointFile determines if the directory has any of the established +// entrypoint filenames. +func hasEntrypointFile(dir string) bool { + for _, entrypointFilename := range []string{ + pyLibraryEntrypointFilename, + pyBinaryEntrypointFilename, + pyTestEntrypointFilename, + } { + path := filepath.Join(dir, entrypointFilename) + if _, err := os.Stat(path); err == nil { + return true + } + } + return false +} + +// hasLibraryEntrypointFile returns if the given directory has the library +// entrypoint file, and if it is non-empty. +func hasLibraryEntrypointFile(dir string) (bool, bool) { + stat, err := os.Stat(filepath.Join(dir, pyLibraryEntrypointFilename)) + if os.IsNotExist(err) { + return false, false + } + if err != nil { + log.Fatalf("ERROR: %v\n", err) + } + return true, stat.Size() != 0 +} + +// isEntrypointFile returns whether the given path is an entrypoint file. The +// given path can be absolute or relative. +func isEntrypointFile(path string) bool { + basePath := filepath.Base(path) + switch basePath { + case pyLibraryEntrypointFilename, + pyBinaryEntrypointFilename, + pyTestEntrypointFilename: + return true + default: + return false + } +} + +func ensureNoCollision(file *rule.File, targetName, kind string) error { + if file == nil { + return nil + } + for _, t := range file.Rules { + if t.Name() == targetName && t.Kind() != kind { + return fmt.Errorf("a target of kind %q with the same name already exists", t.Kind()) + } + } + return nil +} + +// isDjangoTestFile returns whether the given path contains the following +// regex regexp.MustCompile(`from django\.test import.*TestCase|pytest\.mark\.django_db|gazelle: django_test`) +func isDjangoTestFile(path string) bool { + re := regexp.MustCompile(`from django\.test import.*TestCase|pytest\.mark\.django_db|gazelle: django_test`) + file, err := os.Open(path) + if err != nil { + log.Fatalf("ERROR: %v\n", err) + panic(err) + } + defer file.Close() + scanner := bufio.NewScanner(file) + for scanner.Scan() { + if re.MatchString(scanner.Text()) { + return true + } + } + return false +} diff --git a/gazelle/kinds.go b/python/kinds.go similarity index 64% rename from gazelle/kinds.go rename to python/kinds.go index 32607f3..ff20943 100644 --- a/gazelle/kinds.go +++ b/python/kinds.go @@ -1,3 +1,17 @@ +// Copyright 2023 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package python import ( @@ -9,7 +23,6 @@ const ( pyLibraryKind = "py_library" pyTestKind = "pytest" djangoTestKind = "django_test" - pyCheckKind = "py_check" ) // Kinds returns a map that maps rule names (kinds) and information on how to @@ -22,28 +35,28 @@ var pyKinds = map[string]rule.KindInfo{ pyBinaryKind: { MatchAny: false, NonEmptyAttrs: map[string]bool{ - "deps": true, - "main": true, - "srcs": true, - "imports": true, - "visibility": true, + "deps": true, + "main": true, + "srcs": true, + "imports": true, }, + SubstituteAttrs: map[string]bool{}, MergeableAttrs: map[string]bool{ "srcs": true, - "main": true, }, ResolveAttrs: map[string]bool{ "deps": true, }, }, pyLibraryKind: { - MatchAny: false, + MatchAny: false, + MatchAttrs: []string{"srcs"}, NonEmptyAttrs: map[string]bool{ - "deps": true, - "srcs": true, - "imports": true, - "visibility": true, + "deps": true, + "srcs": true, + "imports": true, }, + SubstituteAttrs: map[string]bool{}, MergeableAttrs: map[string]bool{ "srcs": true, }, @@ -51,28 +64,17 @@ var pyKinds = map[string]rule.KindInfo{ "deps": true, }, }, - pyCheckKind: { - MatchAny: false, - NonEmptyAttrs: map[string]bool{ - "srcs": true, - "visibility": true, - }, - MergeableAttrs: map[string]bool{ - "srcs": true, - }, - }, pyTestKind: { MatchAny: false, NonEmptyAttrs: map[string]bool{ - "deps": true, - "main": true, - "srcs": true, - "imports": true, - "visibility": true, + "deps": true, + "main": true, + "srcs": true, + "imports": true, }, + SubstituteAttrs: map[string]bool{}, MergeableAttrs: map[string]bool{ "srcs": true, - "main": true, }, ResolveAttrs: map[string]bool{ "deps": true, @@ -113,11 +115,11 @@ var pyLoads = []rule.LoadInfo{ pyLibraryKind, pyTestKind, }, - }, { + }, + { Name: "@com_github_benchsci_rules_python_gazelle:defs.bzl", Symbols: []string{ djangoTestKind, - pyCheckKind, }, }, } diff --git a/python/language.go b/python/language.go new file mode 100644 index 0000000..56eb97b --- /dev/null +++ b/python/language.go @@ -0,0 +1,32 @@ +// Copyright 2023 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package python + +import ( + "github.com/bazelbuild/bazel-gazelle/language" +) + +// Python satisfies the language.Language interface. It is the Gazelle extension +// for Python rules. +type Python struct { + Configurer + Resolver +} + +// NewLanguage initializes a new Python that satisfies the language.Language +// interface. This is the entrypoint for the extension initialization. +func NewLanguage() language.Language { + return &Python{} +} diff --git a/python/parser.go b/python/parser.go new file mode 100644 index 0000000..1b2a90d --- /dev/null +++ b/python/parser.go @@ -0,0 +1,260 @@ +// Copyright 2023 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package python + +import ( + "context" + _ "embed" + "fmt" + "strings" + + "github.com/emirpasic/gods/sets/treeset" + godsutils "github.com/emirpasic/gods/utils" + "golang.org/x/sync/errgroup" +) + +// python3Parser implements a parser for Python files that extracts the modules +// as seen in the import statements. +type python3Parser struct { + // The value of language.GenerateArgs.Config.RepoRoot. + repoRoot string + // The value of language.GenerateArgs.Rel. + relPackagePath string + // The function that determines if a dependency is ignored from a Gazelle + // directive. It's the signature of pythonconfig.Config.IgnoresDependency. + ignoresDependency func(dep string) bool +} + +// newPython3Parser constructs a new python3Parser. +func newPython3Parser( + repoRoot string, + relPackagePath string, + ignoresDependency func(dep string) bool, +) *python3Parser { + return &python3Parser{ + repoRoot: repoRoot, + relPackagePath: relPackagePath, + ignoresDependency: ignoresDependency, + } +} + +// parseSingle parses a single Python file and returns the extracted modules +// from the import statements as well as the parsed comments. +func (p *python3Parser) parseSingle(pyFilename string) (*treeset.Set, map[string]*treeset.Set, *annotations, error) { + pyFilenames := treeset.NewWith(godsutils.StringComparator) + pyFilenames.Add(pyFilename) + return p.parse(pyFilenames) +} + +// parse parses multiple Python files and returns the extracted modules from +// the import statements as well as the parsed comments. +func (p *python3Parser) parse(pyFilenames *treeset.Set) (*treeset.Set, map[string]*treeset.Set, *annotations, error) { + modules := treeset.NewWith(moduleComparator) + + g, ctx := errgroup.WithContext(context.Background()) + ch := make(chan struct{}, 6) // Limit the number of concurrent parses. + chRes := make(chan *ParserOutput, len(pyFilenames.Values())) + for _, v := range pyFilenames.Values() { + ch <- struct{}{} + g.Go(func(filename string) func() error { + return func() error { + defer func() { + <-ch + }() + res, err := NewFileParser().ParseFile(ctx, p.repoRoot, p.relPackagePath, filename) + if err != nil { + return err + } + chRes <- res + return nil + } + }(v.(string))) + } + if err := g.Wait(); err != nil { + return nil, nil, nil, err + } + close(ch) + close(chRes) + mainModules := make(map[string]*treeset.Set, len(chRes)) + allAnnotations := new(annotations) + allAnnotations.ignore = make(map[string]struct{}) + for res := range chRes { + if res.HasMain { + mainModules[res.FileName] = treeset.NewWith(moduleComparator) + } + annotations, err := annotationsFromComments(res.Comments) + if err != nil { + return nil, nil, nil, fmt.Errorf("failed to parse annotations: %w", err) + } + + for _, m := range res.Modules { + // Check for ignored dependencies set via an annotation to the Python + // module. + if annotations.ignores(m.Name) || annotations.ignores(m.From) { + continue + } + + // Check for ignored dependencies set via a Gazelle directive in a BUILD + // file. + if p.ignoresDependency(m.Name) || p.ignoresDependency(m.From) { + continue + } + + modules.Add(m) + if res.HasMain { + mainModules[res.FileName].Add(m) + } + } + + // Collect all annotations from each file into a single annotations struct. + for k, v := range annotations.ignore { + allAnnotations.ignore[k] = v + } + allAnnotations.includeDeps = append(allAnnotations.includeDeps, annotations.includeDeps...) + } + + allAnnotations.includeDeps = removeDupesFromStringTreeSetSlice(allAnnotations.includeDeps) + + return modules, mainModules, allAnnotations, nil +} + +// removeDupesFromStringTreeSetSlice takes a []string, makes a set out of the +// elements, and then returns a new []string with all duplicates removed. Order +// is preserved. +func removeDupesFromStringTreeSetSlice(array []string) []string { + s := treeset.NewWith(godsutils.StringComparator) + for _, v := range array { + s.Add(v) + } + dedupe := make([]string, s.Size()) + for i, v := range s.Values() { + dedupe[i] = fmt.Sprint(v) + } + return dedupe +} + +// module represents a fully-qualified, dot-separated, Python module as seen on +// the import statement, alongside the line number where it happened. +type module struct { + // The fully-qualified, dot-separated, Python module name as seen on import + // statements. + Name string `json:"name"` + // The line number where the import happened. + LineNumber uint32 `json:"lineno"` + // The path to the module file relative to the Bazel workspace root. + Filepath string `json:"filepath"` + // If this was a from import, e.g. from foo import bar, From indicates the module + // from which it is imported. + From string `json:"from"` +} + +// moduleComparator compares modules by name. +func moduleComparator(a, b interface{}) int { + return godsutils.StringComparator(a.(module).Name, b.(module).Name) +} + +// annotationKind represents Gazelle annotation kinds. +type annotationKind string + +const ( + // The Gazelle annotation prefix. + annotationPrefix string = "gazelle:" + // The ignore annotation kind. E.g. '# gazelle:ignore '. + annotationKindIgnore annotationKind = "ignore" + annotationKindIncludeDep annotationKind = "include_dep" +) + +// comment represents a Python comment. +type comment string + +// asAnnotation returns an annotation object if the comment has the +// annotationPrefix. +func (c *comment) asAnnotation() (*annotation, error) { + uncomment := strings.TrimLeft(string(*c), "# ") + if !strings.HasPrefix(uncomment, annotationPrefix) { + return nil, nil + } + withoutPrefix := strings.TrimPrefix(uncomment, annotationPrefix) + annotationParts := strings.SplitN(withoutPrefix, " ", 2) + if len(annotationParts) < 2 { + return nil, fmt.Errorf("`%s` requires a value", *c) + } + return &annotation{ + kind: annotationKind(annotationParts[0]), + value: annotationParts[1], + }, nil +} + +// annotation represents a single Gazelle annotation parsed from a Python +// comment. +type annotation struct { + kind annotationKind + value string +} + +// annotations represent the collection of all Gazelle annotations parsed out of +// the comments of a Python module. +type annotations struct { + // The parsed modules to be ignored by Gazelle. + ignore map[string]struct{} + // Labels that Gazelle should include as deps of the generated target. + includeDeps []string +} + +// annotationsFromComments returns all the annotations parsed out of the +// comments of a Python module. +func annotationsFromComments(comments []comment) (*annotations, error) { + ignore := make(map[string]struct{}) + includeDeps := []string{} + for _, comment := range comments { + annotation, err := comment.asAnnotation() + if err != nil { + return nil, err + } + if annotation != nil { + if annotation.kind == annotationKindIgnore { + modules := strings.Split(annotation.value, ",") + for _, m := range modules { + if m == "" { + continue + } + m = strings.TrimSpace(m) + ignore[m] = struct{}{} + } + } + if annotation.kind == annotationKindIncludeDep { + targets := strings.Split(annotation.value, ",") + for _, t := range targets { + if t == "" { + continue + } + t = strings.TrimSpace(t) + includeDeps = append(includeDeps, t) + } + } + } + } + return &annotations{ + ignore: ignore, + includeDeps: includeDeps, + }, nil +} + +// ignored returns true if the given module was ignored via the ignore +// annotation. +func (a *annotations) ignores(module string) bool { + _, ignores := a.ignore[module] + return ignores +} diff --git a/python/private/BUILD.bazel b/python/private/BUILD.bazel new file mode 100644 index 0000000..e69de29 diff --git a/python/private/extensions.bzl b/python/private/extensions.bzl new file mode 100644 index 0000000..5de0713 --- /dev/null +++ b/python/private/extensions.bzl @@ -0,0 +1,9 @@ +"python_stdlib_list module extension for use with bzlmod" + +load("@bazel_skylib//lib:modules.bzl", "modules") +load("//:deps.bzl", "python_stdlib_list_deps") + +python_stdlib_list = modules.as_extension( + python_stdlib_list_deps, + doc = "This extension registers python stdlib list dependencies.", +) diff --git a/python/python_test.go b/python/python_test.go new file mode 100644 index 0000000..dd8c241 --- /dev/null +++ b/python/python_test.go @@ -0,0 +1,204 @@ +/* Copyright 2020 The Bazel Authors. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// This test file was first seen on: +// https://github.com/bazelbuild/bazel-skylib/blob/f80bc733d4b9f83d427ce3442be2e07427b2cc8d/gazelle/bzl/BUILD. +// It was modified for the needs of this extension. + +package python_test + +import ( + "bytes" + "context" + "errors" + "os" + "os/exec" + "path/filepath" + "strings" + "testing" + "time" + + "github.com/bazelbuild/bazel-gazelle/testtools" + "github.com/bazelbuild/rules_go/go/tools/bazel" + "github.com/ghodss/yaml" +) + +const ( + extensionDir = "python" + string(os.PathSeparator) + testDataPath = extensionDir + "testdata" + string(os.PathSeparator) + gazelleBinaryName = "gazelle_binary" +) + +func TestGazelleBinary(t *testing.T) { + gazellePath := mustFindGazelle() + tests := map[string][]bazel.RunfileEntry{} + + runfiles, err := bazel.ListRunfiles() + if err != nil { + t.Fatalf("bazel.ListRunfiles() error: %v", err) + } + for _, f := range runfiles { + if strings.HasPrefix(f.ShortPath, testDataPath) { + relativePath := strings.TrimPrefix(f.ShortPath, testDataPath) + parts := strings.SplitN(relativePath, string(os.PathSeparator), 2) + if len(parts) < 2 { + // This file is not a part of a testcase since it must be in a dir that + // is the test case and then have a path inside of that. + continue + } + + tests[parts[0]] = append(tests[parts[0]], f) + } + } + if len(tests) == 0 { + t.Fatal("no tests found") + } + for testName, files := range tests { + testPath(t, gazellePath, testName, files) + } +} + +func testPath(t *testing.T, gazellePath, name string, files []bazel.RunfileEntry) { + t.Run(name, func(t *testing.T) { + t.Parallel() + var inputs, goldens []testtools.FileSpec + + var config *testYAML + for _, f := range files { + path := f.Path + trim := filepath.Join(testDataPath, name) + string(os.PathSeparator) + shortPath := strings.TrimPrefix(f.ShortPath, trim) + info, err := os.Stat(path) + if err != nil { + t.Fatalf("os.Stat(%q) error: %v", path, err) + } + + if info.IsDir() { + continue + } + + content, err := os.ReadFile(path) + if err != nil { + t.Errorf("os.ReadFile(%q) error: %v", path, err) + } + + if filepath.Base(shortPath) == "test.yaml" { + if config != nil { + t.Fatal("only 1 test.yaml is supported") + } + config = new(testYAML) + if err := yaml.Unmarshal(content, config); err != nil { + t.Fatal(err) + } + } + + if strings.HasSuffix(shortPath, ".in") { + inputs = append(inputs, testtools.FileSpec{ + Path: filepath.Join(name, strings.TrimSuffix(shortPath, ".in")), + Content: string(content), + }) + continue + } + + if strings.HasSuffix(shortPath, ".out") { + goldens = append(goldens, testtools.FileSpec{ + Path: filepath.Join(name, strings.TrimSuffix(shortPath, ".out")), + Content: string(content), + }) + continue + } + + inputs = append(inputs, testtools.FileSpec{ + Path: filepath.Join(name, shortPath), + Content: string(content), + }) + goldens = append(goldens, testtools.FileSpec{ + Path: filepath.Join(name, shortPath), + Content: string(content), + }) + } + + testdataDir, cleanup := testtools.CreateFiles(t, inputs) + t.Cleanup(cleanup) + t.Cleanup(func() { + if !t.Failed() { + return + } + + filepath.Walk(testdataDir, func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + t.Logf("%q exists", strings.TrimPrefix(path, testdataDir)) + return nil + }) + }) + + workspaceRoot := filepath.Join(testdataDir, name) + + args := []string{"-build_file_name=BUILD,BUILD.bazel"} + + ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) + t.Cleanup(cancel) + cmd := exec.CommandContext(ctx, gazellePath, args...) + var stdout, stderr bytes.Buffer + cmd.Stdout = &stdout + cmd.Stderr = &stderr + cmd.Dir = workspaceRoot + if err := cmd.Run(); err != nil { + var e *exec.ExitError + if !errors.As(err, &e) { + t.Fatal(err) + } + } + + actualExitCode := cmd.ProcessState.ExitCode() + if config.Expect.ExitCode != actualExitCode { + t.Errorf("expected gazelle exit code: %d\ngot: %d", + config.Expect.ExitCode, actualExitCode) + } + actualStdout := stdout.String() + if strings.TrimSpace(config.Expect.Stdout) != strings.TrimSpace(actualStdout) { + t.Errorf("expected gazelle stdout: %s\ngot: %s", + config.Expect.Stdout, actualStdout) + } + actualStderr := stderr.String() + if strings.TrimSpace(config.Expect.Stderr) != strings.TrimSpace(actualStderr) { + t.Errorf("expected gazelle stderr: %s\ngot: %s", + config.Expect.Stderr, actualStderr) + } + if t.Failed() { + t.FailNow() + } + + testtools.CheckFiles(t, testdataDir, goldens) + }) +} + +func mustFindGazelle() string { + gazellePath, ok := bazel.FindBinary(extensionDir, gazelleBinaryName) + if !ok { + panic("could not find gazelle binary") + } + return gazellePath +} + +type testYAML struct { + Expect struct { + ExitCode int `json:"exit_code"` + Stdout string `json:"stdout"` + Stderr string `json:"stderr"` + } `json:"expect"` +} diff --git a/python/resolve.go b/python/resolve.go new file mode 100644 index 0000000..caeb2d5 --- /dev/null +++ b/python/resolve.go @@ -0,0 +1,318 @@ +// Copyright 2023 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package python + +import ( + "fmt" + "log" + "os" + "path/filepath" + "strings" + + "github.com/bazelbuild/bazel-gazelle/config" + "github.com/bazelbuild/bazel-gazelle/label" + "github.com/bazelbuild/bazel-gazelle/repo" + "github.com/bazelbuild/bazel-gazelle/resolve" + "github.com/bazelbuild/bazel-gazelle/rule" + bzl "github.com/bazelbuild/buildtools/build" + "github.com/emirpasic/gods/sets/treeset" + godsutils "github.com/emirpasic/gods/utils" + + "github.com/benchsci/rules_python_gazelle/gazelle/pythonconfig" +) + +const languageName = "py" + +const ( + // resolvedDepsKey is the attribute key used to pass dependencies that don't + // need to be resolved by the dependency resolver in the Resolver step. + resolvedDepsKey = "_gazelle_python_resolved_deps" +) + +// Resolver satisfies the resolve.Resolver interface. It resolves dependencies +// in rules generated by this extension. +type Resolver struct{} + +// Name returns the name of the language. This is the prefix of the kinds of +// rules generated. E.g. py_library and py_binary. +func (*Resolver) Name() string { return languageName } + +// Imports returns a list of ImportSpecs that can be used to import the rule +// r. This is used to populate RuleIndex. +// +// If nil is returned, the rule will not be indexed. If any non-nil slice is +// returned, including an empty slice, the rule will be indexed. +func (py *Resolver) Imports(c *config.Config, r *rule.Rule, f *rule.File) []resolve.ImportSpec { + cfgs := c.Exts[languageName].(pythonconfig.Configs) + cfg := cfgs[f.Pkg] + srcs := r.AttrStrings("srcs") + provides := make([]resolve.ImportSpec, 0, len(srcs)+1) + for _, src := range srcs { + ext := filepath.Ext(src) + if ext != ".py" { + continue + } + if cfg.PerFileGeneration() && len(srcs) > 1 && src == pyLibraryEntrypointFilename { + // Do not provide import spec from __init__.py when it is being included as + // part of another module. + continue + } + pythonProjectRoot := cfg.PythonProjectRoot() + provide := importSpecFromSrc(pythonProjectRoot, f.Pkg, src) + provides = append(provides, provide) + } + // Provide possible typings + if f.Pkg == "typings" { + provide := resolve.ImportSpec{ + Lang: languageName, + Imp: fmt.Sprintf("typings.%s", r.Name()), + } + provides = append(provides, provide) + + } + if len(provides) == 0 { + return nil + } + return provides +} + +// importSpecFromSrc determines the ImportSpec based on the target that contains the src so that +// the target can be indexed for import statements that match the calculated src relative to the its +// Python project root. +func importSpecFromSrc(pythonProjectRoot, bzlPkg, src string) resolve.ImportSpec { + pythonPkgDir := filepath.Join(bzlPkg, filepath.Dir(src)) + relPythonPkgDir, err := filepath.Rel(pythonProjectRoot, pythonPkgDir) + if err != nil { + panic(fmt.Errorf("unexpected failure: %v", err)) + } + if relPythonPkgDir == "." { + relPythonPkgDir = "" + } + pythonPkg := strings.ReplaceAll(relPythonPkgDir, "/", ".") + filename := filepath.Base(src) + if filename == pyLibraryEntrypointFilename { + if pythonPkg != "" { + return resolve.ImportSpec{ + Lang: languageName, + Imp: pythonPkg, + } + } + } + moduleName := strings.TrimSuffix(filename, ".py") + var imp string + if pythonPkg == "" { + imp = moduleName + } else { + imp = fmt.Sprintf("%s.%s", pythonPkg, moduleName) + } + return resolve.ImportSpec{ + Lang: languageName, + Imp: imp, + } +} + +// Embeds returns a list of labels of rules that the given rule embeds. If +// a rule is embedded by another importable rule of the same language, only +// the embedding rule will be indexed. The embedding rule will inherit +// the imports of the embedded rule. +func (py *Resolver) Embeds(r *rule.Rule, from label.Label) []label.Label { + // TODO(f0rmiga): implement. + return make([]label.Label, 0) +} + +// Resolve translates imported libraries for a given rule into Bazel +// dependencies. Information about imported libraries is returned for each +// rule generated by language.GenerateRules in +// language.GenerateResult.Imports. Resolve generates a "deps" attribute (or +// the appropriate language-specific equivalent) for each import according to +// language-specific rules and heuristics. +func (py *Resolver) Resolve( + c *config.Config, + ix *resolve.RuleIndex, + rc *repo.RemoteCache, + r *rule.Rule, + modulesRaw interface{}, + from label.Label, +) { + // TODO(f0rmiga): may need to be defensive here once this Gazelle extension + // join with the main Gazelle binary with other rules. It may conflict with + // other generators that generate py_* targets. + deps := treeset.NewWith(godsutils.StringComparator) + if modulesRaw != nil { + cfgs := c.Exts[languageName].(pythonconfig.Configs) + cfg := cfgs[from.Pkg] + modules := modulesRaw.(*treeset.Set) + it := modules.Iterator() + explainDependency := os.Getenv("EXPLAIN_DEPENDENCY") + hasFatalError := false + MODULES_LOOP: + for it.Next() { + mod := it.Value().(module) + moduleParts := strings.Split(mod.Name, ".") + possibleModules := []string{mod.Name} + for len(moduleParts) > 1 { + // Iterate back through the possible imports until + // a match is found. + // For example, "from foo.bar import baz" where baz is a module, we should try `foo.bar.baz` first, then + // `foo.bar`, then `foo`. + // In the first case, the import could be file `baz.py` in the directory `foo/bar`. + // Or, the import could be variable `baz` in file `foo/bar.py`. + // The import could also be from a standard module, e.g. `six.moves`, where + // the dependency is actually `six`. + moduleParts = moduleParts[:len(moduleParts)-1] + possibleModules = append(possibleModules, strings.Join(moduleParts, ".")) + } + errs := []error{} + POSSIBLE_MODULE_LOOP: + for _, moduleName := range possibleModules { + imp := resolve.ImportSpec{Lang: languageName, Imp: moduleName} + if override, ok := resolve.FindRuleWithOverride(c, imp, languageName); ok { + if override.Repo == "" { + override.Repo = from.Repo + } + if !override.Equal(from) { + if override.Repo == from.Repo { + override.Repo = "" + } + dep := override.Rel(from.Repo, from.Pkg).String() + deps.Add(dep) + if explainDependency == dep { + log.Printf("Explaining dependency (%s): "+ + "in the target %q, the file %q imports %q at line %d, "+ + "which resolves using the \"gazelle:resolve\" directive.\n", + explainDependency, from.String(), mod.Filepath, moduleName, mod.LineNumber) + } + continue MODULES_LOOP + } + } else { + if dep, distributionName, ok := cfg.FindThirdPartyDependency(moduleName); ok { + deps.Add(dep) + typings := fmt.Sprintf("typings.%s", distributionName) + imp := resolve.ImportSpec{Lang: languageName, Imp: typings} + matches := ix.FindRulesByImportWithConfig(c, imp, languageName) + if len(matches) > 0 { + + matchLabel := matches[0].Label.Rel(from.Repo, from.Pkg) + dep := matchLabel.String() + deps.Add(dep) + } + typeModule := fmt.Sprintf("%s_types", strings.ToLower(distributionName)) + if dep, _, ok := cfg.FindThirdPartyDependency(typeModule); ok { + deps.Add(dep) + + } + stubModule := fmt.Sprintf("%s_stubs", strings.ToLower(distributionName)) + if dep, _, ok := cfg.FindThirdPartyDependency(stubModule); ok { + deps.Add(dep) + } + if explainDependency == dep { + log.Printf("Explaining dependency (%s): "+ + "in the target %q, the file %q imports %q at line %d, "+ + "which resolves from the third-party module %q from the wheel %q.\n", + explainDependency, from.String(), mod.Filepath, moduleName, mod.LineNumber, mod.Name, dep) + } + continue MODULES_LOOP + } else { + matches := ix.FindRulesByImportWithConfig(c, imp, languageName) + if len(matches) == 0 { + // Check if the imported module is part of the standard library. + if isStdModule(module{Name: moduleName}) { + continue MODULES_LOOP + } else if cfg.ValidateImportStatements() { + err := fmt.Errorf( + "%[1]q at line %[2]d from %[3]q is an invalid dependency: possible solutions:\n"+ + "\t1. Add it as a dependency in the requirements.txt file.\n"+ + "\t2. Instruct Gazelle to resolve to a known dependency using the gazelle:resolve directive.\n"+ + "\t3. Ignore it with a comment '# gazelle:ignore %[1]s' in the Python file.\n", + moduleName, mod.LineNumber, mod.Filepath, + ) + errs = append(errs, err) + continue POSSIBLE_MODULE_LOOP + } + } + filteredMatches := make([]resolve.FindResult, 0, len(matches)) + for _, match := range matches { + if match.IsSelfImport(from) { + // Prevent from adding itself as a dependency. + continue MODULES_LOOP + } + filteredMatches = append(filteredMatches, match) + } + if len(filteredMatches) == 0 { + continue POSSIBLE_MODULE_LOOP + } + for _, match := range filteredMatches { + matchLabel := match.Label.Rel(from.Repo, from.Pkg) + dep := matchLabel.String() + deps.Add(dep) + if explainDependency == dep { + log.Printf("Explaining dependency (%s): "+ + "in the target %q, the file %q imports %q at line %d, "+ + "which resolves from the first-party indexed labels.\n", + explainDependency, from.String(), mod.Filepath, mod.Name, mod.LineNumber) + } + } + continue MODULES_LOOP + } + } + } // End possible modules loop. + if len(errs) > 0 { + // If, after trying all possible modules, we still haven't found anything, error out. + joinedErrs := "" + for _, err := range errs { + joinedErrs = fmt.Sprintf("%s%s\n", joinedErrs, err) + } + log.Printf("EEEEEEEEEEEERROR: failed to validate dependencies for target %q: %v\n", from.String(), joinedErrs) + hasFatalError = true + } + } + if hasFatalError { + fmt.Printf("EEEEEEEEEEEERROR: failed to validate dependencies for target %q\n", from.String()) + //os.Exit(1) + } + } + resolvedDeps := r.PrivateAttr(resolvedDepsKey).(*treeset.Set) + if !resolvedDeps.Empty() { + it := resolvedDeps.Iterator() + for it.Next() { + deps.Add(it.Value()) + } + } + if !deps.Empty() { + r.SetAttr("deps", convertDependencySetToExpr(deps)) + } +} + +// targetListFromResults returns a string with the human-readable list of +// targets contained in the given results. +func targetListFromResults(results []resolve.FindResult) string { + list := make([]string, len(results)) + for i, result := range results { + list[i] = result.Label.String() + } + return strings.Join(list, ", ") +} + +// convertDependencySetToExpr converts the given set of dependencies to an +// expression to be used in the deps attribute. +func convertDependencySetToExpr(set *treeset.Set) bzl.Expr { + deps := make([]bzl.Expr, set.Size()) + it := set.Iterator() + for it.Next() { + dep := it.Value().(string) + deps[it.Index()] = &bzl.StringExpr{Value: dep} + } + return &bzl.ListExpr{List: deps} +} diff --git a/python/std_modules.go b/python/std_modules.go new file mode 100644 index 0000000..e10f87b --- /dev/null +++ b/python/std_modules.go @@ -0,0 +1,40 @@ +// Copyright 2023 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package python + +import ( + "bufio" + _ "embed" + "strings" +) + +var ( + //go:embed stdlib_list.txt + stdlibList string + stdModules map[string]struct{} +) + +func init() { + stdModules = make(map[string]struct{}) + scanner := bufio.NewScanner(strings.NewReader(stdlibList)) + for scanner.Scan() { + stdModules[scanner.Text()] = struct{}{} + } +} + +func isStdModule(m module) bool { + _, ok := stdModules[m.Name] + return ok +} diff --git a/python/std_modules_test.go b/python/std_modules_test.go new file mode 100644 index 0000000..bc22638 --- /dev/null +++ b/python/std_modules_test.go @@ -0,0 +1,27 @@ +// Copyright 2023 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package python + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestIsStdModule(t *testing.T) { + assert.True(t, isStdModule(module{Name: "unittest"})) + assert.True(t, isStdModule(module{Name: "os.path"})) + assert.False(t, isStdModule(module{Name: "foo"})) +} diff --git a/gazelle/target.go b/python/target.go similarity index 63% rename from gazelle/target.go rename to python/target.go index df66ac9..9d990d7 100644 --- a/gazelle/target.go +++ b/python/target.go @@ -1,3 +1,17 @@ +// Copyright 2023 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package python import ( @@ -15,39 +29,32 @@ type targetBuilder struct { name string pythonProjectRoot string bzlPackage string - uuid string srcs *treeset.Set + siblingSrcs *treeset.Set deps *treeset.Set resolvedDeps *treeset.Set visibility *treeset.Set main *string conftest *string imports []string + testonly bool } // newTargetBuilder constructs a new targetBuilder. -func newTargetBuilder(kind, name, pythonProjectRoot, bzlPackage string) *targetBuilder { +func newTargetBuilder(kind, name, pythonProjectRoot, bzlPackage string, siblingSrcs *treeset.Set) *targetBuilder { return &targetBuilder{ kind: kind, name: name, pythonProjectRoot: pythonProjectRoot, bzlPackage: bzlPackage, srcs: treeset.NewWith(godsutils.StringComparator), + siblingSrcs: siblingSrcs, deps: treeset.NewWith(moduleComparator), resolvedDeps: treeset.NewWith(godsutils.StringComparator), visibility: treeset.NewWith(godsutils.StringComparator), } } -// setUUID sets the given UUID for the target. It's used to index the generated -// target based on this value in addition to the other ways the targets can be -// imported. py_{binary,test} targets in the same Bazel package can add a -// virtual dependency to this UUID that gets resolved in the Resolver interface. -func (t *targetBuilder) setUUID(uuid string) *targetBuilder { - t.uuid = uuid - return t -} - // addSrc adds a single src to the target. func (t *targetBuilder) addSrc(src string) *targetBuilder { t.srcs.Add(src) @@ -65,6 +72,15 @@ func (t *targetBuilder) addSrcs(srcs *treeset.Set) *targetBuilder { // addModuleDependency adds a single module dep to the target. func (t *targetBuilder) addModuleDependency(dep module) *targetBuilder { + fileName := dep.Name + ".py" + if dep.From != "" { + fileName = dep.From + ".py" + } + if t.siblingSrcs.Contains(fileName) && fileName != filepath.Base(dep.Filepath) { + // importing another module from the same package, converting to absolute imports to make + // dependency resolution easier + dep.Name = importSpecFromSrc(t.pythonProjectRoot, t.bzlPackage, fileName).Imp + } t.deps.Add(dep) return t } @@ -73,7 +89,7 @@ func (t *targetBuilder) addModuleDependency(dep module) *targetBuilder { func (t *targetBuilder) addModuleDependencies(deps *treeset.Set) *targetBuilder { it := deps.Iterator() for it.Next() { - t.deps.Add(it.Value().(module)) + t.addModuleDependency(it.Value().(module)) } return t } @@ -85,9 +101,20 @@ func (t *targetBuilder) addResolvedDependency(dep string) *targetBuilder { return t } -// addVisibility adds a visibility to the target. -func (t *targetBuilder) addVisibility(visibility string) *targetBuilder { - t.visibility.Add(visibility) +// addResolvedDependencies adds multiple dependencies, that have already been +// resolved or generated, to the target. +func (t *targetBuilder) addResolvedDependencies(deps []string) *targetBuilder { + for _, dep := range deps { + t.addResolvedDependency(dep) + } + return t +} + +// addVisibility adds visibility labels to the target. +func (t *targetBuilder) addVisibility(visibility []string) *targetBuilder { + for _, item := range visibility { + t.visibility.Add(item) + } return t } @@ -103,13 +130,25 @@ func (t *targetBuilder) setConftest(conftest string) *targetBuilder { return t } +// setTestonly sets the testonly attribute to true. +func (t *targetBuilder) setTestonly() *targetBuilder { + t.testonly = true + return t +} + // generateImportsAttribute generates the imports attribute. // These are a list of import directories to be added to the PYTHONPATH. In our // case, the value we add is on Bazel sub-packages to be able to perform imports // relative to the root project package. func (t *targetBuilder) generateImportsAttribute() *targetBuilder { + if t.pythonProjectRoot == "" { + // When gazelle:python_root is not set or is at the root of the repo, we don't need + // to set imports, because that's the Bazel's default. + return t + } p, _ := filepath.Rel(t.bzlPackage, t.pythonProjectRoot) p = filepath.Clean(p) + if p == "." { return t } @@ -120,27 +159,27 @@ func (t *targetBuilder) generateImportsAttribute() *targetBuilder { // build returns the assembled *rule.Rule for the target. func (t *targetBuilder) build() *rule.Rule { r := rule.NewRule(t.kind, t.name) - if t.uuid != "" { - r.SetPrivateAttr(uuidKey, t.uuid) - } if !t.srcs.Empty() { r.SetAttr("srcs", t.srcs.Values()) } if !t.visibility.Empty() { r.SetAttr("visibility", t.visibility.Values()) } - if t.main != nil { - r.SetAttr("main", *t.main) - } if t.conftest != nil { r.SetAttr("conftest", *t.conftest) } + if t.main != nil { + r.SetAttr("main", *t.main) + } if t.imports != nil { r.SetAttr("imports", t.imports) } if !t.deps.Empty() { r.SetPrivateAttr(config.GazelleImportsKey, t.deps) } + if t.testonly { + r.SetAttr("testonly", true) + } r.SetPrivateAttr(resolvedDepsKey, t.resolvedDeps) return r } diff --git a/pythonconfig/BUILD.bazel b/pythonconfig/BUILD.bazel new file mode 100644 index 0000000..6e2160b --- /dev/null +++ b/pythonconfig/BUILD.bazel @@ -0,0 +1,28 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "pythonconfig", + srcs = [ + "pythonconfig.go", + "types.go", + ], + importpath = "github.com/benchsci/rules_python_gazelle/gazelle/pythonconfig", + visibility = ["//visibility:public"], + deps = [ + "//manifest", + "@bazel_gazelle//label:go_default_library", + "@com_github_emirpasic_gods//lists/singlylinkedlist", + ], +) + +go_test( + name = "pythonconfig_test", + srcs = ["pythonconfig_test.go"], + embed = [":pythonconfig"], +) + +filegroup( + name = "distribution", + srcs = glob(["**"]), + visibility = ["//:__pkg__"], +) diff --git a/gazelle/pythonconfig/pythonconfig.go b/pythonconfig/pythonconfig.go similarity index 62% rename from gazelle/pythonconfig/pythonconfig.go rename to pythonconfig/pythonconfig.go index 5b92713..8e42184 100644 --- a/gazelle/pythonconfig/pythonconfig.go +++ b/pythonconfig/pythonconfig.go @@ -1,8 +1,22 @@ +// Copyright 2023 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package pythonconfig import ( "fmt" - "path/filepath" + "path" "strings" "github.com/emirpasic/gods/lists/singlylinkedlist" @@ -36,6 +50,10 @@ const ( // GenerationMode represents the directive that controls the target generation // mode. See below for the GenerationModeType constants. GenerationMode = "python_generation_mode" + // GenerationModePerFileIncludeInit represents the directive that augments + // the "per_file" GenerationMode by including the package's __init__.py file. + // This is a boolean directive. + GenerationModePerFileIncludeInit = "python_generation_mode_per_file_include_init" // LibraryNamingConvention represents the directive that controls the // py_library naming convention. It interpolates $package_name$ with the // Bazel package name. E.g. if the Bazel package name is `foo`, setting this @@ -49,10 +67,17 @@ const ( // naming convention. See python_library_naming_convention for more info on // the package name interpolation. TestNamingConvention = "python_test_naming_convention" - - PytestConfTest = "pytest_conftest" - PyCheck = "py_check" - PyModule = "py_module" + PytestConfTest = "pytest_conftest" + // DefaultVisibilty represents the directive that controls what visibility + // labels are added to generated python targets. + DefaultVisibilty = "python_default_visibility" + // Visibility represents the directive that controls what additional + // visibility labels are added to generated targets. It mimics the behavior + // of the `go_visibility` directive. + Visibility = "python_visibility" + // TestFilePattern represents the directive that controls which python + // files are mapped to `py_test` targets. + TestFilePattern = "python_test_file_pattern" ) // GenerationModeType represents one of the generation modes for the Python @@ -68,25 +93,41 @@ const ( // GenerationModeProject defines the mode in which a coarse-grained target will // be generated englobing sub-directories containing Python files. GenerationModeProject GenerationModeType = "project" + GenerationModeFile GenerationModeType = "file" ) const ( packageNameNamingConventionSubstitution = "$package_name$" ) +const ( + // The default visibility label, including a format placeholder for `python_root`. + DefaultVisibilityFmtString = "//%s:__subpackages__" + // The default globs used to determine pt_test targets. + DefaultTestFilePatternString = "__test__.py,test_*.py" +) + // defaultIgnoreFiles is the list of default values used in the // python_ignore_files option. var defaultIgnoreFiles = map[string]struct{}{ "setup.py": {}, } +func SanitizeDistribution(distributionName string) string { + sanitizedDistribution := strings.ToLower(distributionName) + sanitizedDistribution = strings.ReplaceAll(sanitizedDistribution, "-", "_") + sanitizedDistribution = strings.ReplaceAll(sanitizedDistribution, ".", "_") + + return sanitizedDistribution +} + // Configs is an extension of map[string]*Config. It provides finding methods // on top of the mapping. type Configs map[string]*Config // ParentForPackage returns the parent Config for the given Bazel package. func (c *Configs) ParentForPackage(pkg string) *Config { - dir := filepath.Dir(pkg) + dir := path.Dir(pkg) if dir == "." { dir = "" } @@ -99,21 +140,24 @@ type Config struct { parent *Config extensionEnabled bool - pyModule bool - pyCheck string repoRoot string pythonProjectRoot string pytestConfTest string gazelleManifest *manifest.Manifest - excludedPatterns *singlylinkedlist.List - ignoreFiles map[string]struct{} - ignoreDependencies map[string]struct{} - validateImportStatements bool - coarseGrainedGeneration bool - libraryNamingConvention string - binaryNamingConvention string - testNamingConvention string + excludedPatterns *singlylinkedlist.List + ignoreFiles map[string]struct{} + ignoreDependencies map[string]struct{} + validateImportStatements bool + coarseGrainedGeneration bool + perFileGeneration bool + perFileGenerationIncludeInit bool + libraryNamingConvention string + binaryNamingConvention string + testNamingConvention string + defaultVisibility []string + visibility []string + testFilePattern []string } // New creates a new Config. @@ -122,20 +166,23 @@ func New( pythonProjectRoot string, ) *Config { return &Config{ - extensionEnabled: true, - pyModule: false, - pyCheck: "", - repoRoot: repoRoot, - pythonProjectRoot: pythonProjectRoot, - excludedPatterns: singlylinkedlist.New(), - ignoreFiles: make(map[string]struct{}), - ignoreDependencies: make(map[string]struct{}), - validateImportStatements: true, - coarseGrainedGeneration: false, - libraryNamingConvention: packageNameNamingConventionSubstitution, - binaryNamingConvention: fmt.Sprintf("%s_bin", packageNameNamingConventionSubstitution), - testNamingConvention: fmt.Sprintf("%s_test", packageNameNamingConventionSubstitution), - pytestConfTest: ":conftest", + extensionEnabled: true, + repoRoot: repoRoot, + pythonProjectRoot: pythonProjectRoot, + excludedPatterns: singlylinkedlist.New(), + ignoreFiles: make(map[string]struct{}), + ignoreDependencies: make(map[string]struct{}), + validateImportStatements: true, + coarseGrainedGeneration: false, + perFileGeneration: true, + perFileGenerationIncludeInit: false, + libraryNamingConvention: packageNameNamingConventionSubstitution, + binaryNamingConvention: fmt.Sprintf("%s_bin", packageNameNamingConventionSubstitution), + testNamingConvention: fmt.Sprintf("%s_test", packageNameNamingConventionSubstitution), + defaultVisibility: []string{fmt.Sprintf(DefaultVisibilityFmtString, "")}, + visibility: []string{}, + testFilePattern: strings.Split(DefaultTestFilePatternString, ","), + pytestConfTest: ":conftest", } } @@ -148,21 +195,24 @@ func (c *Config) Parent() *Config { // current Config and sets itself as the parent to the child. func (c *Config) NewChild() *Config { return &Config{ - parent: c, - extensionEnabled: c.extensionEnabled, - repoRoot: c.repoRoot, - pythonProjectRoot: c.pythonProjectRoot, - excludedPatterns: c.excludedPatterns, - ignoreFiles: make(map[string]struct{}), - ignoreDependencies: make(map[string]struct{}), - validateImportStatements: c.validateImportStatements, - coarseGrainedGeneration: c.coarseGrainedGeneration, - libraryNamingConvention: c.libraryNamingConvention, - binaryNamingConvention: c.binaryNamingConvention, - testNamingConvention: c.testNamingConvention, - pytestConfTest: c.pytestConfTest, - pyCheck: c.pyCheck, - pyModule: c.pyModule, + parent: c, + extensionEnabled: c.extensionEnabled, + repoRoot: c.repoRoot, + pythonProjectRoot: c.pythonProjectRoot, + excludedPatterns: c.excludedPatterns, + ignoreFiles: make(map[string]struct{}), + ignoreDependencies: make(map[string]struct{}), + validateImportStatements: c.validateImportStatements, + coarseGrainedGeneration: c.coarseGrainedGeneration, + perFileGeneration: c.perFileGeneration, + perFileGenerationIncludeInit: c.perFileGenerationIncludeInit, + libraryNamingConvention: c.libraryNamingConvention, + binaryNamingConvention: c.binaryNamingConvention, + testNamingConvention: c.testNamingConvention, + pytestConfTest: c.pytestConfTest, + defaultVisibility: c.defaultVisibility, + visibility: c.visibility, + testFilePattern: c.testFilePattern, } } @@ -182,14 +232,6 @@ func (c *Config) SetExtensionEnabled(enabled bool) { c.extensionEnabled = enabled } -func (c *Config) PyModule() bool { - return c.pyModule -} - -func (c *Config) SetPyModule(enabled bool) { - c.pyModule = enabled -} - // ExtensionEnabled returns whether the extension is enabled or not. func (c *Config) ExtensionEnabled() bool { return c.extensionEnabled @@ -200,11 +242,6 @@ func (c *Config) SetPythonProjectRoot(pythonProjectRoot string) { c.pythonProjectRoot = pythonProjectRoot } -// PythonProjectRoot returns the Python project root. -func (c *Config) PythonProjectRoot() string { - return c.pythonProjectRoot -} - // SetPytestConfTest sets the conftest file func (c *Config) SetPytestConfTest(pytestConfTest string) { c.pytestConfTest = pytestConfTest @@ -215,22 +252,9 @@ func (c *Config) PytestConfTest() string { return c.pytestConfTest } -// Enable pyCheck rule -func (c *Config) PyCheck() string { - parent := c.parent - for parent != nil { - if parent.pyCheck == "enabled" && c.pyCheck == "" { - return parent.pyCheck - - } - parent = parent.parent - } - return c.pyCheck -} - -// Enable pyCheck rule -func (c *Config) SetPyCheck(enabled string) { - c.pyCheck = enabled +// PythonProjectRoot returns the Python project root. +func (c *Config) PythonProjectRoot() string { + return c.pythonProjectRoot } // SetGazelleManifest sets the Gazelle manifest parsed from the @@ -253,17 +277,10 @@ func (c *Config) FindThirdPartyDependency(modName string) (string, string, bool) } else if gazelleManifest.PipRepository != nil { distributionRepositoryName = gazelleManifest.PipRepository.Name } - sanitizedDistribution := strings.ToLower(distributionName) - sanitizedDistribution = strings.ReplaceAll(sanitizedDistribution, "-", "_") - var lbl label.Label - if repo := gazelleManifest.PipRepository; repo != nil && (repo.UsePipRepositoryAliases != nil && *repo.UsePipRepositoryAliases == false) { - // @_//:pkg - distributionRepositoryName = distributionRepositoryName + "_" + sanitizedDistribution - lbl = label.New(distributionRepositoryName, "", "pkg") - } else { - // @// - lbl = label.New(distributionRepositoryName, sanitizedDistribution, sanitizedDistribution) - } + sanitizedDistribution := SanitizeDistribution(distributionName) + + // @// + lbl := label.New(distributionRepositoryName, sanitizedDistribution, sanitizedDistribution) return lbl.String(), distributionName, true } } @@ -354,6 +371,30 @@ func (c *Config) CoarseGrainedGeneration() bool { return c.coarseGrainedGeneration } +// SetPerFileGneration sets whether a separate py_library target should be +// generated for each file. +func (c *Config) SetPerFileGeneration(perFile bool) { + c.perFileGeneration = perFile +} + +// PerFileGeneration returns whether a separate py_library target should be +// generated for each file. +func (c *Config) PerFileGeneration() bool { + return c.perFileGeneration +} + +// SetPerFileGenerationIncludeInit sets whether py_library targets should +// include __init__.py files when PerFileGeneration() is true. +func (c *Config) SetPerFileGenerationIncludeInit(includeInit bool) { + c.perFileGenerationIncludeInit = includeInit +} + +// PerFileGenerationIncludeInit returns whether py_library targets should +// include __init__.py files when PerFileGeneration() is true. +func (c *Config) PerFileGenerationIncludeInit() bool { + return c.perFileGenerationIncludeInit +} + // SetLibraryNamingConvention sets the py_library target naming convention. func (c *Config) SetLibraryNamingConvention(libraryNamingConvention string) { c.libraryNamingConvention = libraryNamingConvention @@ -386,3 +427,33 @@ func (c *Config) SetTestNamingConvention(testNamingConvention string) { func (c *Config) RenderTestName(packageName string) string { return strings.ReplaceAll(c.testNamingConvention, packageNameNamingConventionSubstitution, packageName) } + +// AppendVisibility adds additional items to the target's visibility. +func (c *Config) AppendVisibility(visibility string) { + c.visibility = append(c.visibility, visibility) +} + +// Visibility returns the target's visibility. +func (c *Config) Visibility() []string { + return append(c.defaultVisibility, c.visibility...) +} + +// SetDefaultVisibility sets the default visibility of the target. +func (c *Config) SetDefaultVisibility(visibility []string) { + c.defaultVisibility = visibility +} + +// DefaultVisibilty returns the target's default visibility. +func (c *Config) DefaultVisibilty() []string { + return c.defaultVisibility +} + +// SetTestFilePattern sets the file patterns that should be mapped to 'py_test' rules. +func (c *Config) SetTestFilePattern(patterns []string) { + c.testFilePattern = patterns +} + +// TestFilePattern returns the patterns that should be mapped to 'py_test' rules. +func (c *Config) TestFilePattern() []string { + return c.testFilePattern +} diff --git a/pythonconfig/pythonconfig_test.go b/pythonconfig/pythonconfig_test.go new file mode 100644 index 0000000..bf31106 --- /dev/null +++ b/pythonconfig/pythonconfig_test.go @@ -0,0 +1,26 @@ +package pythonconfig + +import ( + "testing" +) + +func TestDistributionSanitizing(t *testing.T) { + tests := map[string]struct { + input string + want string + }{ + "upper case": {input: "DistWithUpperCase", want: "distwithuppercase"}, + "dashes": {input: "dist-with-dashes", want: "dist_with_dashes"}, + "dots": {input: "dist.with.dots", want: "dist_with_dots"}, + "mixed": {input: "To-be.sanitized", want: "to_be_sanitized"}, + } + + for name, tc := range tests { + t.Run(name, func(t *testing.T) { + got := SanitizeDistribution(tc.input) + if tc.want != got { + t.Fatalf("expected %q, got %q", tc.want, got) + } + }) + } +} diff --git a/gazelle/pythonconfig/types.go b/pythonconfig/types.go similarity index 80% rename from gazelle/pythonconfig/types.go rename to pythonconfig/types.go index bdb535b..d83d35f 100644 --- a/gazelle/pythonconfig/types.go +++ b/pythonconfig/types.go @@ -1,3 +1,17 @@ +// Copyright 2023 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package pythonconfig import (