Skip to content

Commit ae550b8

Browse files
authored
Merge pull request #70 from lucidsoftware/path-mapping-stacked-toolchain
Path mapping
2 parents 9c34aad + ee6bbb7 commit ae550b8

File tree

59 files changed

+424
-305
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+424
-305
lines changed

.bazelrc_shared

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
common --announce_rc
22
common --color=yes
3-
# Fix "Failed to fetch blobs because they do not exist remotely" errors
4-
# https://github.com/bazelbuild/bazel/issues/18696#issuecomment-2175561503
5-
common --remote_download_all
3+
# TODO: remove this when we move to Bazel 8. This is the default in Bazel 8.
4+
common --experimental_remote_cache_eviction_retries=5
5+
6+
# TODO: enable path mapping when we move to Bazel 8. There is a bug in 7. See:
7+
# https://github.com/bazelbuild/bazel/issues/23990
8+
# In the meantime, if you need to test path mapping you should disable multiplex
9+
# workers with the following build option:
10+
#build --noworker_multiplex
11+
#common --experimental_output_paths=strip
12+
#common --modify_execution_info=CppCompile=+supports-path-mapping
613

714
build --experimental_strict_action_env
815
build --javacopt="-source 21 -target 21"
@@ -11,14 +18,23 @@ build --java_runtime_version="remotejdk_21"
1118
build --tool_java_language_version="21"
1219
build --tool_java_runtime_version="remotejdk_21"
1320

14-
build --strategy=ScalaCompile=worker
21+
build --strategy=worker,sandboxed,local
22+
1523
build --worker_max_instances=4
1624
build --worker_sandboxing
17-
build --experimental_worker_multiplex_sandboxing
25+
# Disable multiplex sandboxing because there is a bug that causes files which
26+
# should be in the sandbox to not be. Not sure if this is a Bazel bug or a rule
27+
# set bug. Something we need to deal with either way.
28+
# Once we enable path mapping, we should also be able to get rid of the outgoing
29+
# transition that we're currently relying on to prevent an explosion in the number
30+
# of builds.
31+
#build --experimental_worker_multiplex_sandboxing
1832
build --experimental_worker_cancellation
1933
build --verbose_failures
2034

21-
build --experimental_worker_sandbox_hardening
35+
# This is disabled as it was causing some issues with some javac targets when used
36+
# with path mapping. If that is resolved, then we can turn it back on.
37+
#build --experimental_worker_sandbox_hardening
2238
build --experimental_use_hermetic_linux_sandbox
2339

2440
test --test_output=all

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.4.0
1+
7.4.1

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
fail-fast: false
1515
matrix:
1616
os: [ubuntu-24.04]
17-
bazel_version: [bazelbuild/7.4.0]
17+
bazel_version: [bazelbuild/7.4.1]
1818
steps:
1919
- uses: actions/checkout@v3
2020
- uses: bazel-contrib/[email protected]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ load("@rules_scala_annex//rules/scala:workspace.bzl", "scala_register_toolchains
7474
scala_repositories()
7575
load("@annex//:defs.bzl", annex_pinned_maven_install = "pinned_maven_install")
7676
annex_pinned_maven_install()
77-
scala_register_toolchains(default_scala_toolchain_name = "zinc_3")
77+
scala_register_toolchains(default_scala_toolchain_name = "annex_zinc_3")
7878

7979
load("@rules_scala_annex//rules/scalafmt:workspace.bzl", "scalafmt_default_config", "scalafmt_repositories")
8080
scalafmt_repositories()
@@ -116,7 +116,7 @@ protobuf_deps()
116116
# Specify the scala compiler we wish to use; in this case, we'll use the default one specified in rules_scala_annex
117117
bind(
118118
name = "default_scala",
119-
actual = "@rules_scala_annex//src/main/scala:zinc_2_13",
119+
actual = "@rules_scala_annex//src/main/scala:annex_zinc_2_13",
120120
)
121121
```
122122

WORKSPACE

Lines changed: 57 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@ workspace(name = "rules_scala_annex")
22

33
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
44

5+
# rules_license
6+
rules_license_tag = "1.0.0"
7+
8+
http_archive(
9+
name = "rules_license",
10+
sha256 = "26d4021f6898e23b82ef953078389dd49ac2b5618ac564ade4ef87cced147b38",
11+
urls = [
12+
"https://mirror.bazel.build/github.com/bazelbuild/rules_license/releases/download/{tag}/rules_license-{tag}.tar.gz".format(tag = rules_license_tag),
13+
"https://github.com/bazelbuild/rules_license/releases/download/{tag}/rules_license-{tag}.tar.gz".format(tag = rules_license_tag),
14+
],
15+
)
16+
517
# skylib
618

719
bazel_skylib_tag = "1.7.1"
@@ -21,11 +33,26 @@ load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
2133

2234
bazel_skylib_workspace()
2335

36+
# rules_java
37+
http_archive(
38+
name = "rules_java",
39+
sha256 = "a9690bc00c538246880d5c83c233e4deb83fe885f54c21bb445eb8116a180b83",
40+
urls = [
41+
"https://github.com/bazelbuild/rules_java/releases/download/7.12.2/rules_java-7.12.2.tar.gz",
42+
],
43+
)
44+
45+
load("@rules_java//java:repositories.bzl", "rules_java_dependencies")
46+
47+
rules_java_dependencies()
48+
49+
register_toolchains("//:repository_default_toolchain_21_definition")
50+
2451
# com_github_bazelbuild_buildtools
2552

26-
buildtools_tag = "7.1.2"
53+
buildtools_tag = "7.3.1"
2754

28-
buildtools_sha256 = "4c63e823e6944c950401f92155416c631a65657dd32e1021451fc015faf22ecb"
55+
buildtools_sha256 = "118602587d5804c720c1617db30f56c93ec7a2bdda5e915125fccf7421e78412"
2956

3057
http_archive(
3158
name = "com_github_bazelbuild_buildtools",
@@ -47,48 +74,12 @@ http_archive(
4774
urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.16/rules_cc-0.0.16.tar.gz"],
4875
)
4976

50-
# io_bazel_rules_go
51-
52-
rules_go_tag = "v0.43.0"
53-
54-
rules_go_sha256 = "8e968b5fcea1d2d64071872b12737bbb5514524ee5f0a4f54f5920266c261acb"
55-
56-
http_archive(
57-
name = "io_bazel_rules_go",
58-
integrity = "sha256-1qtrV+SMCVI+kwUPE2mPcIQoz9XmGSUuNp03evZZdwc=",
59-
urls = [
60-
"https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/rules_go/releases/download/{tag}/rules_go-{tag}.zip".format(tag = rules_go_tag),
61-
"https://github.com/bazelbuild/rules_go/releases/download/{tag}/rules_go-{tag}.zip".format(tag = rules_go_tag),
62-
],
63-
)
64-
65-
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
66-
67-
go_rules_dependencies()
68-
69-
go_register_toolchains(version = "1.17")
70-
71-
# rules_java
72-
http_archive(
73-
name = "rules_java",
74-
sha256 = "a9690bc00c538246880d5c83c233e4deb83fe885f54c21bb445eb8116a180b83",
75-
urls = [
76-
"https://github.com/bazelbuild/rules_java/releases/download/7.12.2/rules_java-7.12.2.tar.gz",
77-
],
78-
)
79-
80-
load("@rules_java//java:repositories.bzl", "rules_java_dependencies")
81-
82-
rules_java_dependencies()
83-
84-
register_toolchains("//:repository_default_toolchain_21_definition")
85-
8677
# rules_jvm_external
87-
rules_jvm_external_tag = "6.1"
78+
rules_jvm_external_tag = "6.5"
8879

8980
http_archive(
9081
name = "rules_jvm_external",
91-
sha256 = "42a6d48eb2c08089961c715a813304f30dc434df48e371ebdd868fc3636f0e82",
82+
sha256 = "c5b27928eeb8f0761f0805540587660f0ecc6946e9c04bf0d4c89e2f7d332b2b",
9283
strip_prefix = "rules_jvm_external-{}".format(rules_jvm_external_tag),
9384
url = "https://github.com/bazelbuild/rules_jvm_external/archive/{}.zip".format(rules_jvm_external_tag),
9485
)
@@ -110,7 +101,7 @@ load("@annex//:defs.bzl", annex_pinned_maven_install = "pinned_maven_install")
110101

111102
annex_pinned_maven_install()
112103

113-
scala_register_toolchains(default_scala_toolchain_name = "zinc_2_13")
104+
scala_register_toolchains(default_scala_toolchain_name = "annex_zinc_2_13")
114105

115106
# Scala 2.12
116107

@@ -185,6 +176,27 @@ load("@rules_proto//proto:setup.bzl", "rules_proto_setup")
185176

186177
rules_proto_setup()
187178

179+
# rules_go
180+
181+
rules_go_tag = "v0.43.0"
182+
183+
rules_go_sha256 = "d6ab6b57e48c09523e93050f13698f708428cfd5e619252e369d377af6597707"
184+
185+
http_archive(
186+
name = "io_bazel_rules_go",
187+
sha256 = rules_go_sha256,
188+
urls = [
189+
"https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/rules_go/releases/download/{tag}/rules_go-{tag}.zip".format(tag = rules_go_tag),
190+
"https://github.com/bazelbuild/rules_go/releases/download/{tag}/rules_go-{tag}.zip".format(tag = rules_go_tag),
191+
],
192+
)
193+
194+
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
195+
196+
go_rules_dependencies()
197+
198+
go_register_toolchains(version = "1.17")
199+
188200
# Stardoc
189201

190202
http_archive(
@@ -210,11 +222,11 @@ stardoc_pinned_maven_install()
210222

211223
# rules_pkg
212224

213-
rules_pkg_version = "1.0.0"
225+
rules_pkg_version = "1.0.1"
214226

215227
http_archive(
216228
name = "rules_pkg",
217-
sha256 = "cad05f864a32799f6f9022891de91ac78f30e0fa07dc68abac92a628121b5b11",
229+
sha256 = "d20c951960ed77cb7b341c2a59488534e494d5ad1d30c4818c736d57772a9fef",
218230
urls = [
219231
"https://github.com/bazelbuild/rules_pkg/releases/download/{v}/rules_pkg-{v}.tar.gz".format(v = rules_pkg_version),
220232
],
@@ -225,11 +237,11 @@ load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
225237
rules_pkg_dependencies()
226238

227239
# rules_python - this is needed by rules_jvm_external for some reason
228-
rules_python_tag = "0.33.2"
240+
rules_python_tag = "0.36.0"
229241

230242
http_archive(
231243
name = "rules_python",
232-
sha256 = "e3f1cc7a04d9b09635afb3130731ed82b5f58eadc8233d4efb59944d92ffc06f",
244+
sha256 = "ca77768989a7f311186a29747e3e95c936a41dffac779aff6b443db22290d913",
233245
strip_prefix = "rules_python-{}".format(rules_python_tag),
234246
url = "https://github.com/bazelbuild/rules_python/releases/download/{}/rules_python-{}.tar.gz".format(rules_python_tag, rules_python_tag),
235247
)

docs/newdocs/scala_versions.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ compiler_classpath_2_13 = [
3535
runtime_classpath_2_13 = ["@scala_library_2_13//jar"]
3636

3737
register_bootstrap_toolchain(
38-
name = "bootstrap_2_13",
38+
name = "annex_bootstrap_2_13",
3939
compiler_classpath = compiler_classpath_2_13,
4040
runtime_classpath = runtime_classpath_2_13,
4141
version = "2.13.14",
@@ -46,7 +46,7 @@ register_bootstrap_toolchain(
4646
scala_library(
4747
name = "compiler_bridge_2_13",
4848
srcs = ["@compiler_bridge_2_13//:src"],
49-
scala_toolchain_name = "bootstrap_2_13",
49+
scala_toolchain_name = "annex_bootstrap_2_13",
5050
visibility = ["//visibility:public"],
5151
deps = compiler_classpath_2_13 + [
5252
"@scala_annex_org_scala_sbt_compiler_interface//jar",
@@ -56,7 +56,7 @@ scala_library(
5656

5757
# This augments the configuration to configure the zinc compiler
5858
register_zinc_toolchain(
59-
name = "zinc_2_13",
59+
name = "annex_zinc_2_13",
6060
compiler_bridge = ":compiler_bridge_2_13",
6161
compiler_classpath = compiler_classpath_2_13,
6262
runtime_classpath = runtime_classpath_2_13,
@@ -72,8 +72,8 @@ load("@rules_scala_annex//rules/scala:workspace.bzl", "scala_register_toolchains
7272
...
7373

7474
scala_register_toolchains(
75-
toolchains = ["//:bootstrap_2_13", "//:zinc_2_13"],
76-
default_scala_toolchain_name = "zinc_2_13",
75+
toolchains = ["//:annex_bootstrap_2_13", "//:annex_zinc_2_13"],
76+
default_scala_toolchain_name = "annex_zinc_2_13",
7777
)
7878

7979
...
@@ -90,13 +90,13 @@ For example:
9090
scala_library(
9191
name = "example_compiled_with_scalac",
9292
srcs = glob(["**/*.scala"])
93-
scala_toolchain_name = "bootstrap_2_13",
93+
scala_toolchain_name = "annex_bootstrap_2_13",
9494
)
9595

9696
scala_library(
9797
name = "example_compiled_with_zinc",
9898
srcs = glob(["**/*.scala"])
99-
scala_toolchain_name = "zinc_2_13",
99+
scala_toolchain_name = "annex_zinc_2_13",
100100
)
101101

102102
# This would use the default toolchain, which we configured via `scala_register_toolchains` above

docs/stardoc/scala_workspace.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ scala_repositories(<a href="#scala_repositories-java_launcher_version">java_laun
5454

5555
| Name | Description | Default Value |
5656
| :------------- | :------------- | :------------- |
57-
| <a id="scala_repositories-java_launcher_version"></a>java_launcher_version | <p align="center"> - </p> | `"7.4.0"` |
57+
| <a id="scala_repositories-java_launcher_version"></a>java_launcher_version | <p align="center"> - </p> | `"7.4.1"` |
5858
| <a id="scala_repositories-java_launcher_template_sha"></a>java_launcher_template_sha | <p align="center"> - </p> | `"ee4aa47ae5e639632c67be5cc0ccbc4e941a67a1b884a1ce0c4329357a4b62b2"` |
5959

6060

0 commit comments

Comments
 (0)