-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fb38ac3
commit 44879e7
Showing
3 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
JDK_VERSIONS = ["11", "15", "16", "17"] | ||
PLATFORMS = ["linux", "macos", "macos_aarch64", "win"] | ||
|
||
# Remote JDK repos for those Linux platforms are only defined for JDK 11. | ||
EXTRA_REMOTE_JDK11_REPOS = [ | ||
"remotejdk11_linux_aarch64", | ||
"remotejdk11_linux_ppc64le", | ||
"remotejdk11_linux_s390x", | ||
] | ||
|
||
REMOTE_JDK_REPOS = [("remotejdk" + version + "_" + platform) for version in JDK_VERSIONS for platform in PLATFORMS] + EXTRA_REMOTE_JDK11_REPOS | ||
|
||
REMOTE_JAVA_TOOLCHAINS = [("@" + name + "_toolchain_config_repo//:toolchain") for name in REMOTE_JDK_REPOS] | ||
|
||
module( | ||
name = "rules_java", | ||
version = "4.0.0", | ||
compatibility_level = 1, | ||
toolchains_to_register = [ | ||
"//toolchains:all", | ||
"@local_jdk//:runtime_toolchain_definition", | ||
] + REMOTE_JAVA_TOOLCHAINS, | ||
) | ||
|
||
bazel_dep(name = "bazel_skylib", version = "1.0.3") | ||
bazel_dep(name = "platforms", version = "0.0.4") | ||
bazel_dep(name = "rules_cc", version = "0.0.1") | ||
bazel_dep(name = "rules_proto", version = "4.0.0") | ||
bazel_dep(name = "rules_python", version = "0.4.0") | ||
|
||
toolchains = use_extension("//java:extensions.bzl", "toolchains") | ||
|
||
# Declare remote java tools repos | ||
use_repo(toolchains, "remote_java_tools") | ||
use_repo(toolchains, "remote_java_tools_linux") | ||
use_repo(toolchains, "remote_java_tools_windows") | ||
use_repo(toolchains, "remote_java_tools_darwin") | ||
|
||
# Declare local jdk repo | ||
use_repo(toolchains, "local_jdk") | ||
|
||
# Declare all remote jdk toolchain config repos | ||
[use_repo(toolchains, repo + "_toolchain_config_repo") for repo in REMOTE_JDK_REPOS] | ||
|
||
# Dev dependencies | ||
bazel_dep(name = "rules_pkg", version = "0.5.1", dev_dependency = True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# A completely empty WORKSPACE file to replace the original WORKSPACE content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Copyright 2021 The Bazel Authors. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
"""Module extensions for rules_java.""" | ||
|
||
load("//java:repositories.bzl", "java_tools_javac11_repos", "local_jdk_repo", "remote_jdk11_repos", "remote_jdk15_repos", "remote_jdk16_repos", "remote_jdk17_repos") | ||
|
||
def _toolchains_impl(ctx): | ||
local_jdk_repo() | ||
java_tools_javac11_repos() | ||
remote_jdk11_repos() | ||
remote_jdk15_repos() | ||
remote_jdk16_repos() | ||
remote_jdk17_repos() | ||
|
||
toolchains = module_extension(implementation = _toolchains_impl) |