Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDK 21 support, consistent Zinc analysis format, Zinc classloader improvements, lots of upgrades #44

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
common --config=rules
common:v5.0 --config=rules_v5.0
common:v6.3 --config=rules_v6.3
common:v7.0 --config=rules_v7.0
common:v7.2 --config=rules_v7.2
import %workspace%/.bazelrc_shared
35 changes: 13 additions & 22 deletions .bazelrc_shared
Original file line number Diff line number Diff line change
@@ -1,43 +1,34 @@
common --announce_rc
common --color=yes
common --noenable_bzlmod
# Fix "Failed to fetch blobs because they do not exist remotely" errors
# https://github.com/bazelbuild/bazel/issues/18696#issuecomment-2175561503
common --remote_download_all

build --experimental_strict_action_env
build --javacopt="-source 11 -target 11"
build --java_language_version=11
build --tool_java_language_version=11
build --incompatible_java_common_parameters=false
build --javacopt="-source 21 -target 21"
build --java_language_version="21"
build --java_runtime_version="remotejdk_21"
build --tool_java_language_version="21"
build --tool_java_runtime_version="remotejdk_21"

build --strategy=ScalaCompile=worker
build --worker_max_instances=4
# To re-enable worker sandboxing you will need to revert
# 037d7440cf3b192b9979ff2f2c1b2c674b433afc
# But this will cause AnalysisCache files to be included as
# action inputs. Those files are non-deterministic, so this
# causes cache misses. We should fix that before reverting
# that commit.
#build --worker_sandboxing
build --worker_sandboxing
build --verbose_failures

test --test_output=all

# Disabling these in general. Feel free to turn them on during development.
# Having them on can make testing the rules challenging because, after a clean,
# you hit the disk cache instead of running actions again.
#build:rules --disk_cache=.bazel_cache
#build:tests --disk_cache=../.bazel_cache
build:rules --disk_cache=.bazel_cache
build:tests --disk_cache=../.bazel_cache

common:rules_v5.0 --config=noop
common:rules_v6.3 --config=noop
common:rules_v7.0 --config=noop
common:rules_v7.2 --config=noop

# route potentially unrouted configs to a terminating noop config
# it's a noop because we use the default value
common:rules --config=noop
common:tests --config=noop
common:v5.0 --config=rules_v5.0
common:v6.3 --config=rules_v6.3
common:v7.0 --config=rules_v7.0
common:v7.2 --config=rules_v7.2

# pick something trivial as a "noop"
common:noop --logging=3
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
bazel_version: [6.3.2, 7.0.0]
os: [ubuntu-24.04]
bazel_version: [7.2.0]
steps:
- uses: actions/checkout@v3
- run: ./scripts/ci.sh build
Expand Down
6 changes: 3 additions & 3 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 3.1.0
version = 3.8.2
runner.dialect = scala213source3
align.openParenCallSite = false
align.openParenDefnSite = false
Expand All @@ -7,11 +7,11 @@ danglingParentheses.preset = true
docstrings.style = Asterisk
importSelectors = singleLine
maxColumn = 120
verticalMultiline.newlineBeforeImplicitKW = true
newlines.implicitParamListModifierPrefer = after
rewrite.redundantBraces.stringInterpolation = true
rewrite.rules = [
RedundantParens,
PreferCurlyFors,
SortImports
]
unindentTopLevelOperators = false
trailingCommas = always
13 changes: 13 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")
load(
"@rules_java//toolchains:default_java_toolchain.bzl",
"DEFAULT_TOOLCHAIN_CONFIGURATION",
"default_java_toolchain",
)

default_java_toolchain(
name = "repository_default_toolchain_21",
configuration = DEFAULT_TOOLCHAIN_CONFIGURATION,
java_runtime = "@rules_java//toolchains:remotejdk_21",
source_version = "21",
target_version = "21",
)

buildifier(
name = "buildifier",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ protobuf_deps()
# Specify the scala compiler we wish to use; in this case, we'll use the default one specified in rules_scala_annex
bind(
name = "default_scala",
actual = "@rules_scala_annex//src/main/scala:zinc_2_13_11",
actual = "@rules_scala_annex//src/main/scala:zinc_2_13",
)
```

Expand Down
98 changes: 52 additions & 46 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# skylib

bazel_skylib_tag = "1.0.3"
bazel_skylib_tag = "1.7.1"

bazel_skylib_sha256 = "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c"
bazel_skylib_sha256 = "bc283cdfcd526a52c3201279cda4bc298652efa898b10b4db0837dc51652756f"

http_archive(
name = "bazel_skylib",
Expand All @@ -17,17 +17,21 @@ http_archive(
],
)

load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")

bazel_skylib_workspace()

# com_github_bazelbuild_buildtools

buildtools_tag = "0.29.0"
buildtools_tag = "7.1.2"

buildtools_sha256 = "05eb52437fb250c7591dd6cbcfd1f9b5b61d85d6b20f04b041e0830dd1ab39b3"
buildtools_sha256 = "4c63e823e6944c950401f92155416c631a65657dd32e1021451fc015faf22ecb"

http_archive(
name = "com_github_bazelbuild_buildtools",
sha256 = buildtools_sha256,
strip_prefix = "buildtools-{}".format(buildtools_tag),
url = "https://github.com/bazelbuild/buildtools/archive/{}.zip".format(buildtools_tag),
url = "https://github.com/bazelbuild/buildtools/archive/v{}.zip".format(buildtools_tag),
)

load("@com_github_bazelbuild_buildtools//buildifier:deps.bzl", "buildifier_dependencies")
Expand Down Expand Up @@ -57,9 +61,9 @@ go_register_toolchains(version = "1.17")

# protobuf

protobuf_tag = "3.15.8"
protobuf_tag = "3.19.6"

protobuf_sha256 = "dd513a79c7d7e45cbaeaf7655289f78fd6b806e52dbbd7018ef4e3cf5cff697a"
protobuf_sha256 = "387e2c559bb2c7c1bc3798c4e6cff015381a79b2758696afcbf8e88730b47389"

http_archive(
name = "com_google_protobuf",
Expand All @@ -73,43 +77,42 @@ load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")

protobuf_deps()

jdk_build_file_content = """
filegroup(
name = "jdk",
srcs = glob(["**/*"]),
visibility = ["//visibility:public"],
)
filegroup(
name = "java",
srcs = ["bin/java"],
visibility = ["//visibility:public"],
)
"""

# rules_java
http_archive(
name = "jdk11-linux",
build_file_content = jdk_build_file_content,
strip_prefix = "jdk-11.0.11%2B9",
url = "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.11%2B9/OpenJDK11U-jdk_x64_linux_hotspot_11.0.11_9.tar.gz",
name = "rules_java",
sha256 = "80e61f508ff79a3fde4a549b8b1f6ec7f8a82c259e51240a4403e5be36f88142",
urls = [
"https://github.com/bazelbuild/rules_java/releases/download/7.6.4/rules_java-7.6.4.tar.gz",
],
)

http_archive(
name = "jdk11-osx",
build_file_content = jdk_build_file_content,
strip_prefix = "jdk-11.0.11%2B9",
url = "https:/github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.11%2B9/OpenJDK11U-jdk_x64_mac_hotspot_11.0.11_9.tar.gz",
)
load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains")

rules_java_dependencies()

rules_java_toolchains()

rules_jvm_external_tag = "5.3"
register_toolchains("//:repository_default_toolchain_21_definition")

# rules_jvm_external
rules_jvm_external_tag = "6.1"

http_archive(
name = "rules_jvm_external",
sha256 = "6cc8444b20307113a62b676846c29ff018402fd4c7097fcd6d0a0fd5f2e86429",
sha256 = "42a6d48eb2c08089961c715a813304f30dc434df48e371ebdd868fc3636f0e82",
strip_prefix = "rules_jvm_external-{}".format(rules_jvm_external_tag),
url = "https://github.com/bazelbuild/rules_jvm_external/archive/{}.zip".format(rules_jvm_external_tag),
)

# Scala
load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps")

rules_jvm_external_deps()

load("@rules_jvm_external//:setup.bzl", "rules_jvm_external_setup")

rules_jvm_external_setup()

# Scala 2_13 and 3
load("//rules/scala:workspace.bzl", "scala_register_toolchains", "scala_repositories")

scala_repositories()
Expand All @@ -130,16 +133,6 @@ load("@annex_2_12//:defs.bzl", annex_2_12_pinned_maven_install = "pinned_maven_i

annex_2_12_pinned_maven_install()

# Scala 3

load("//rules/scala:workspace_3.bzl", "scala_3_repositories")

scala_3_repositories()

load("@annex_3//:defs.bzl", annex_3_pinned_maven_install = "pinned_maven_install")

annex_3_pinned_maven_install()

# Scala fmt

load("//rules/scalafmt:workspace.bzl", "scalafmt_default_config", "scalafmt_repositories")
Expand Down Expand Up @@ -170,17 +163,30 @@ annex_proto_pinned_maven_install()

# rules_pkg

rules_pkg_version = "0.7.0"
rules_pkg_version = "1.0.0"

http_archive(
name = "rules_pkg",
sha256 = "8a298e832762eda1830597d64fe7db58178aa84cd5926d76d5b744d6558941c2",
sha256 = "cad05f864a32799f6f9022891de91ac78f30e0fa07dc68abac92a628121b5b11",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/{v}/rules_pkg-{v}.tar.gz".format(v = rules_pkg_version),
"https://github.com/bazelbuild/rules_pkg/releases/download/{v}/rules_pkg-{v}.tar.gz".format(v = rules_pkg_version),
],
)

load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")

rules_pkg_dependencies()

# rules_python - this is needed by rules_jvm_external for some reason
rules_python_tag = "0.33.2"

http_archive(
name = "rules_python",
sha256 = "e3f1cc7a04d9b09635afb3130731ed82b5f58eadc8233d4efb59944d92ffc06f",
strip_prefix = "rules_python-{}".format(rules_python_tag),
url = "https://github.com/bazelbuild/rules_python/releases/download/{}/rules_python-{}.tar.gz".format(rules_python_tag, rules_python_tag),
)

load("@rules_python//python:repositories.bzl", "py_repositories")

py_repositories()
Loading
Loading