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

Annex upgrade #46

Merged
merged 3 commits into from
Nov 18, 2024
Merged
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
5 changes: 4 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ build --strategy=worker,sandboxed,local
build --verbose_failures

build --incompatible_strict_action_env
build --experimental_worker_multiplex_sandboxing
# Disable multiplex sandboxing because there is a bug that causes files which
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the same as the following bug we were seeing?

# Configuration: 342536e71b3516bdeefbbed3ceed55b8c3bb68111c6c85cb3fd9ab1d15f641af
# Execution platform: @@platforms//host:host
java.io.FileNotFoundException: __sandbox/3/_main/bazel-out/k8-fastbuild/bin/dependencies/indirect/define_a/analysis_store.gz (No such file or directory)
	at java.base/java.io.FileOutputStream.open0(Native Method)
	at java.base/java.io.FileOutputStream.open(FileOutputStream.java:289)
	at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:230)
	at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:179)
	at sbt.io.Using$.$anonfun$fileOutputChannel$1(Using.scala:118)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. Indeed.

# should be in the sandbox to not be. Not sure if this is a Bazel bug or a rule
# set bug. Something we need to deal with either way.
#build --experimental_worker_multiplex_sandboxing
build --experimental_worker_cancellation
build --worker_sandboxing

Expand Down
32 changes: 18 additions & 14 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -138,37 +138,35 @@ go_rules_dependencies()

go_register_toolchains(version = "1.23.0")

# Also for buildifier. Comes from
# https://github.com/bazelbuild/buildtools/blob/master/buildifier/README.md
protobuf_version = "3.19.4"
# protobuf

protobuf_tag = "28.3"

protobuf_sha256 = "5b2ff0f72e85dc1350b7bb1b4ea94d7e92e297f7a58b630e46fa6b430b5b253b"

http_archive(
name = "com_google_protobuf",
sha256 = "3bd7828aa5af4b13b99c191e8b1e884ebfa9ad371b0ce264605d347f135d2568",
strip_prefix = "protobuf-{}".format(protobuf_version),
url = "https://github.com/protocolbuffers/protobuf/archive/v{}.tar.gz".format(protobuf_version),
sha256 = protobuf_sha256,
strip_prefix = "protobuf-{}".format(protobuf_tag),
type = "zip",
url = "https://github.com/protocolbuffers/protobuf/archive/v{}.zip".format(protobuf_tag),
)

load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")

protobuf_deps()

# higherkindness/rules_scala
rules_scala_annex_version = "f23c16037db66efb541dbbf5e17e6604886c85ff"
rules_scala_annex_version = "lucid_2024-11-17"

http_archive(
name = "rules_scala_annex",
integrity = "sha256-b/cPeh6J1Mq63u6fSWdEHAKL/kWfPhZcNL7m9If7PWM=",
integrity = "sha256-+hiIcio0oFrcBvl43W19GzOytd7zSo7oZkU314w/Xf4=",
strip_prefix = "rules_scala-{}".format(rules_scala_annex_version),
type = "zip",
url = "https://github.com/lucidsoftware/rules_scala/archive/{}.zip".format(rules_scala_annex_version),
)

bind(
name = "default_scala",
actual = "//scala:default_scala",
)

load(
"@rules_scala_annex//rules/scala:workspace.bzl",
"scala_register_toolchains",
Expand All @@ -181,7 +179,13 @@ load("@annex//:defs.bzl", annex_pinned_maven_install = "pinned_maven_install")

annex_pinned_maven_install()

scala_register_toolchains()
scala_register_toolchains(
default_scala_toolchain_name = "zinc_3",
toolchains = [
"@rules_twirl//scala:zinc_2_13",
"@rules_twirl//scala:zinc_3",
],
)

# rules_pkg
rules_pkg_version = "1.0.1"
Expand Down
16 changes: 4 additions & 12 deletions scala/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
load(
"@rules_scala_annex//rules:scala.bzl",
"configure_bootstrap_scala",
"configure_zinc_scala",
"@rules_scala_annex//rules:register_toolchain.bzl",
"register_zinc_toolchain",
)
load("//:workspace.bzl", "scala_2_13_version", "scala_3_version")

Expand All @@ -17,14 +16,7 @@ runtime_classpath_3 = [
"@twirl_compiler_cli_3//:org_scala_lang_tasty_core_3",
]

configure_bootstrap_scala(
name = "bootstrap_3",
compiler_classpath = compiler_classpath_3,
runtime_classpath = runtime_classpath_3,
version = scala_3_version,
)

configure_zinc_scala(
register_zinc_toolchain(
name = "zinc_3",
compiler_bridge = "@twirl_compiler_cli_3//:org_scala_lang_scala3_sbt_bridge",
compiler_classpath = compiler_classpath_3,
Expand All @@ -50,7 +42,7 @@ runtime_classpath_2_13 = [
"@twirl_compiler_cli_2_13//:org_scala_lang_scala_library",
]

configure_zinc_scala(
register_zinc_toolchain(
name = "zinc_2_13",
compiler_bridge = "@twirl_compiler_cli_2_13//:org_scala_sbt_compiler_bridge_2_13",
compiler_classpath = compiler_classpath_2_13,
Expand Down
2 changes: 1 addition & 1 deletion test/twirl-compiler-test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def generate_twirl_test_targets(scala_version):
# For example 2.13 -> 2-13 or 2_13
scala_version_dash = scala_version.replace(".", "-")
scala_version_underscore = scala_version.replace(".", "_")
scala = "//scala:zinc_{}".format(scala_version_underscore)
scala = "zinc_{}".format(scala_version_underscore)

if scala_version == "3":
twirl_toolchain_name = "twirl-3"
Expand Down
2 changes: 1 addition & 1 deletion twirl-compiler-cli/twirl-compiler-cli.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def generate_twirl_compiler_targets(scala_version):
"@rules_scala_annex//src/main/scala/higherkindness/rules_scala/common/sandbox",
"@rules_scala_annex//src/main/scala/higherkindness/rules_scala/common/worker",
],
scala = "//scala:zinc_{}".format(scala_version_underscore),
scala_toolchain_name = "zinc_{}".format(scala_version_underscore),
)

java_binary(
Expand Down
13 changes: 5 additions & 8 deletions twirl_compiler_cli_2_13_install.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
{
"__AUTOGENERATED_FILE_DO_NOT_MODIFY_THIS_FILE_MANUALLY": "THERE_IS_NO_DATA_ONLY_ZUUL",
"__INPUT_ARTIFACTS_HASH": -672116877,
"__RESOLVED_ARTIFACTS_HASH": 1507769908,
"conflict_resolution": {
"com.google.protobuf:protobuf-java:3.19.4": "com.google.protobuf:protobuf-java:3.19.6"
},
"__INPUT_ARTIFACTS_HASH": 1604980415,
"__RESOLVED_ARTIFACTS_HASH": -512094826,
"artifacts": {
"com.eed3si9n:shaded-jawn-parser_2.13": {
"shasums": {
Expand Down Expand Up @@ -43,10 +40,10 @@
},
"com.google.protobuf:protobuf-java": {
"shasums": {
"jar": "6a9a2dff91dcf71f85be71ae971f6164b5a631dcd34bff08f0618535ca44ad02",
"sources": "98118edf28c74f173b25d8fce03f86ff95d61009df0c66324333573ec842f5d3"
"jar": "ba02977c0fef8b40af9f85fe69af362d8e13f2685b49a9752750b18da726157e",
"sources": "d368a684a2fd70c482dc7f842099a939b562effeee45c9a562dba8682f7133bc"
},
"version": "3.19.6"
"version": "4.28.3"
},
"com.lihaoyi:sourcecode_2.13": {
"shasums": {
Expand Down
13 changes: 5 additions & 8 deletions twirl_compiler_cli_3_install.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
{
"__AUTOGENERATED_FILE_DO_NOT_MODIFY_THIS_FILE_MANUALLY": "THERE_IS_NO_DATA_ONLY_ZUUL",
"__INPUT_ARTIFACTS_HASH": -99106801,
"__RESOLVED_ARTIFACTS_HASH": 2083207216,
"conflict_resolution": {
"com.google.protobuf:protobuf-java:3.19.4": "com.google.protobuf:protobuf-java:3.19.6"
},
"__INPUT_ARTIFACTS_HASH": 863368003,
"__RESOLVED_ARTIFACTS_HASH": 1103106450,
"artifacts": {
"com.eed3si9n:shaded-jawn-parser_2.13": {
"shasums": {
Expand Down Expand Up @@ -43,10 +40,10 @@
},
"com.google.protobuf:protobuf-java": {
"shasums": {
"jar": "6a9a2dff91dcf71f85be71ae971f6164b5a631dcd34bff08f0618535ca44ad02",
"sources": "98118edf28c74f173b25d8fce03f86ff95d61009df0c66324333573ec842f5d3"
"jar": "ba02977c0fef8b40af9f85fe69af362d8e13f2685b49a9752750b18da726157e",
"sources": "d368a684a2fd70c482dc7f842099a939b562effeee45c9a562dba8682f7133bc"
},
"version": "3.19.6"
"version": "4.28.3"
},
"com.lihaoyi:sourcecode_2.13": {
"shasums": {
Expand Down
2 changes: 1 addition & 1 deletion workspace.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ scala_2_13_version = "2.13.14"

twirl_version = "2.0.7"
zinc_version = "1.10.1"
protobuf_version = "3.19.4"
protobuf_version = "4.28.3"
scopt_version = "4.1.0"

def twirl_compiler_cli_3_repositories():
Expand Down