Skip to content

Commit 0a18873

Browse files
committed
Merge branch 'bzlmod-rebuilding' into bzlmod
This merge is actually broken, because the `scala_toolchains` macro is now trying to instantiate some repos multiple times. This is because of the work on `scripts/create_repository.py` leading to more accurate direct dependency lists, which is producing some overlap between artifact dependencies. Rather than try to fix this in one big merge change, I'm going to try to fix it in the next commit. I've a couple ideas to try.
2 parents 66e6081 + e9c7529 commit 0a18873

File tree

93 files changed

+7057
-4259
lines changed

Some content is hidden

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

93 files changed

+7057
-4259
lines changed

.bazelci/presubmit.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ tasks:
8080
platform: macos
8181
shell_commands:
8282
- "./test_version.sh"
83+
thirdparty_version_linux:
84+
name: "./test_thirdparty_version.sh"
85+
platform: ubuntu2204_java17
86+
shell_commands:
87+
- "./test_thirdparty_version.sh"
8388
examples_linux:
8489
name: "./test_examples"
8590
platform: ubuntu2004

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ hash2
66
.DS_store
77
.bazel_cache
88
.ijwb
9+
.bazelbsp
10+
.bsp
911
.metals
1012
.vscode
1113
unformatted-*.backup.scala

dt_patches/dt_compiler_3.patch

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
diff --git a/compiler/src/dotty/tools/dotc/core/SymbolLoaders.scala b/compiler/src/dotty/tools/dotc/core/SymbolLoaders.scala
3+
--- dotty/tools/dotc/core/SymbolLoaders.scala (revision 91ef92159c628eaeab8311dc82bed7ed4fe03c63)
4+
+++ dotty/tools/dotc/core/SymbolLoaders.scala (date 1730331517451)
5+
@@ -353,6 +353,14 @@
6+
try {
7+
val start = System.currentTimeMillis
8+
trace.onDebug("loading") {
9+
+ root.symbol.associatedFile match {
10+
+ case assocFile: AbstractFile => assocFile.underlyingSource.foreach {
11+
+ case jar: dotty.tools.io.ZipArchive =>
12+
+ report.echo(s"DT:${jar.path}")
13+
+ case _ => ()
14+
+ }
15+
+ case null => ()
16+
+ }
17+
doComplete(root)
18+
}
19+
report.informTime("loaded " + description, start)

dt_patches/dt_patch_test.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@ run_test_local test_compiler_patch 2.13.12
116116
run_test_local test_compiler_patch 2.13.14
117117
run_test_local test_compiler_patch 2.13.15
118118

119+
run_test_local test_compiler_patch 3.1.0 # Minimal supported version
120+
run_test_local test_compiler_patch 3.1.3
121+
run_test_local test_compiler_patch 3.2.2
122+
run_test_local test_compiler_patch 3.3.4
123+
run_test_local test_compiler_patch 3.4.3
124+
run_test_local test_compiler_patch 3.5.2
125+
119126
run_test_local test_compiler_srcjar_error 2.12.11
120127
run_test_local test_compiler_srcjar_error 2.12.12
121128
run_test_local test_compiler_srcjar_error 2.12.13
@@ -139,3 +146,9 @@ run_test_local test_compiler_srcjar_nonhermetic 2.13.11
139146
run_test_local test_compiler_srcjar_nonhermetic 2.13.12
140147
run_test_local test_compiler_srcjar_nonhermetic 2.13.14
141148
run_test_local test_compiler_srcjar_nonhermetic 2.13.15
149+
150+
run_test_local test_compiler_srcjar 3.1.3
151+
run_test_local test_compiler_srcjar 3.2.2
152+
run_test_local test_compiler_srcjar_nonhermetic 3.3.4
153+
run_test_local test_compiler_srcjar 3.4.3
154+
run_test_local test_compiler_srcjar_nonhermetic 3.5.2

dt_patches/test_dt_patches/BUILD

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@ load(
22
"@io_bazel_rules_scala//scala:scala.bzl",
33
"setup_scala_toolchain",
44
)
5+
load("@io_bazel_rules_scala//scala:scala_cross_version_select.bzl", "select_for_scala_version")
56

6-
SCALA_LIBS = [
7-
"@scala_library",
8-
"@scala_reflect",
9-
]
7+
SCALA_LIBS = ["@scala_library"] + select_for_scala_version(
8+
any_2 = ["@scala_reflect"],
9+
any_3 = [
10+
"@scala3_interfaces",
11+
"@scala2_library",
12+
"@tasty_core",
13+
"@scala_asm",
14+
],
15+
since_3_4 = ["@sbt_compiler_interface"],
16+
)
1017

1118
setup_scala_toolchain(
1219
name = "dt_scala_toolchain",

dt_patches/test_dt_patches/extensions.bzl

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,39 @@ load(
88
)
99
load("@io_bazel_rules_scala_config//:config.bzl", "SCALA_VERSION")
1010

11+
SCALA_2_ARTIFACTS = {
12+
"scala_library": "org.scala-lang:scala-library:%s",
13+
"scala_compiler": "org.scala-lang:scala-compiler:%s",
14+
"scala_reflect": "org.scala-lang:scala-reflect:%s",
15+
}
16+
17+
SCALA_3_ARTIFACTS = {
18+
"scala_library": "org.scala-lang:scala3-library_3:%s",
19+
"scala_compiler": "org.scala-lang:scala3-compiler_3:%s",
20+
"scala3_interfaces": "org.scala-lang:scala3-interfaces:%s",
21+
"tasty_core": "org.scala-lang:tasty-core_3:%s",
22+
}
23+
24+
UNVERSIONED_ARTIFACTS = {
25+
"scala2_library": "org.scala-lang:scala-library:2.13.15",
26+
"scala_asm": "org.scala-lang.modules:scala-asm:9.7.0-scala-2",
27+
"sbt_compiler_interface": "org.scala-sbt:compiler-interface:1.9.6",
28+
}
29+
1130
def import_compiler_source_repos():
12-
for artifact in ["library", "compiler", "reflect"]:
31+
versioned_artifact_templates = (
32+
SCALA_2_ARTIFACTS
33+
if SCALA_VERSION.startswith("2.")
34+
else SCALA_3_ARTIFACTS
35+
}
36+
versioned_artifacts = {
37+
k: v % SCALA_VERSION for k, v in versioned_artifact_templates
38+
}
39+
40+
for name, artifact in versioned_artifacts | UNVERSIONED_ARTIFACTS:
1341
scala_maven_import_external(
14-
name = "scala_%s" % artifact,
15-
artifact = "org.scala-lang:scala-%s:%s" % (
16-
artifact,
17-
SCALA_VERSION,
18-
),
42+
name = name,
43+
artifact = artifact,
1944
licenses = ["notice"],
2045
server_urls = default_maven_server_urls(),
2146
)

dt_patches/test_dt_patches_user_srcjar/BUILD

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@ load(
22
"@io_bazel_rules_scala//scala:scala.bzl",
33
"setup_scala_toolchain",
44
)
5+
load("@io_bazel_rules_scala//scala:scala_cross_version_select.bzl", "select_for_scala_version")
56

6-
SCALA_LIBS = [
7-
"@scala_library",
8-
"@scala_reflect",
9-
]
7+
SCALA_LIBS = ["@scala_library"] + select_for_scala_version(
8+
any_2 = ["@scala_reflect"],
9+
any_3 = [
10+
"@scala3_interfaces",
11+
"@scala2_library",
12+
"@tasty_core",
13+
"@scala_asm",
14+
],
15+
since_3_4 = ["@sbt_compiler_interface"],
16+
)
1017

1118
setup_scala_toolchain(
1219
name = "dt_scala_toolchain",

dt_patches/test_dt_patches_user_srcjar/WORKSPACE

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,23 @@ srcjars_by_version = {
8383
"2.13.15": {
8484
"url": "https://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.13.15/scala-compiler-2.13.15-sources.jar?foo",
8585
},
86+
"3.1.3": {
87+
"url": "https://repo1.maven.org/maven2/org/scala-lang/scala3-compiler_3/3.1.3/scala3-compiler_3-3.1.3-sources.jar",
88+
"integrity": "sha384-4J2ihR1QSdP5cvL3y2OUfw4uUX/hsQqcPlJV+IrQdsM/soiIAYfoEeIEt6vl3xBk",
89+
},
90+
"3.2.2": {
91+
"url": "https://repo1.maven.org/maven2/org/scala-lang/scala3-compiler_3/3.2.2/scala3-compiler_3-3.2.2-sources.jar",
92+
"sha256": "669d580fc4a8d3c2e2d13d5735ae9be05d567613fe44482de5bcc5e2e2ee89ea",
93+
},
94+
"3.3.4": {
95+
"url": "https://repo1.maven.org/maven2/org/scala-lang/scala3-compiler_3/3.3.4/scala3-compiler_3-3.3.4-sources.jar",
96+
},
97+
"3.4.3": {
98+
"label": "@scala3_compiler_srcjar//jar:downloaded.jar",
99+
},
100+
"3.5.2": {
101+
"url": "https://repo1.maven.org/maven2/org/scala-lang/scala3-compiler_3/3.5.2/scala3-compiler_3-3.5.2-sources.jar",
102+
},
86103
}
87104

88105
scala_toolchains(

dt_patches/test_dt_patches_user_srcjar/extensions.bzl

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,51 @@ load(
99
)
1010
load("@io_bazel_rules_scala_config//:config.bzl", "SCALA_VERSION")
1111

12+
SCALA_2_ARTIFACTS = {
13+
"scala_library": "org.scala-lang:scala-library:%s",
14+
"scala_compiler": "org.scala-lang:scala-compiler:%s",
15+
"scala_reflect": "org.scala-lang:scala-reflect:%s",
16+
}
17+
18+
SCALA_3_ARTIFACTS = {
19+
"scala_library": "org.scala-lang:scala3-library_3:%s",
20+
"scala_compiler": "org.scala-lang:scala3-compiler_3:%s",
21+
"scala3_interfaces": "org.scala-lang:scala3-interfaces:%s",
22+
"tasty_core": "org.scala-lang:tasty-core_3:%s",
23+
}
24+
25+
UNVERSIONED_ARTIFACTS = {
26+
"scala2_library": "org.scala-lang:scala-library:2.13.15",
27+
"scala_asm": "org.scala-lang.modules:scala-asm:9.7.0-scala-2",
28+
"sbt_compiler_interface": "org.scala-sbt:compiler-interface:1.9.6",
29+
}
30+
1231
def import_compiler_source_repos():
1332
http_jar(
1433
name = "scala_compiler_srcjar",
1534
sha256 = "95c217cc87ee846b39990e0a9c273824a384dffbac57df84d466f866df4a91ea",
1635
url = "https://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.12.16/scala-compiler-2.12.16-sources.jar",
1736
)
1837

19-
for artifact in ["library", "compiler", "reflect"]:
38+
http_jar(
39+
name = "scala3_compiler_srcjar",
40+
sha256 = "3c413efa9a2921ef59da7f065c445ae1b6b97057cbbc6b16957ad052a575a3ce",
41+
url = "https://repo1.maven.org/maven2/org/scala-lang/scala3-compiler_3/3.4.3/scala3-compiler_3-3.4.3-sources.jar",
42+
)
43+
44+
versioned_artifact_templates = (
45+
SCALA_2_ARTIFACTS
46+
if SCALA_VERSION.startswith("2.")
47+
else SCALA_3_ARTIFACTS
48+
}
49+
versioned_artifacts = {
50+
k: v % SCALA_VERSION for k, v in versioned_artifact_templates
51+
}
52+
53+
for name, artifact in versioned_artifacts | UNVERSIONED_ARTIFACTS:
2054
scala_maven_import_external(
21-
name = "scala_%s" % artifact,
22-
artifact = "org.scala-lang:scala-%s:%s" % (
23-
artifact,
24-
SCALA_VERSION,
25-
),
55+
name = name,
56+
artifact = artifact,
2657
licenses = ["notice"],
2758
server_urls = default_maven_server_urls(),
2859
)

examples/crossbuild/.bazelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import ../../.bazelrc

examples/scala3/.bazelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import ../../.bazelrc

examples/semanticdb/.bazelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import ../../.bazelrc
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
build --enable_platform_specific_config
2-
build:windows --enable_runfiles
1+
import ../../../.bazelrc
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import ../../../.bazelrc
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
build --enable_platform_specific_config
2-
build:windows --enable_runfiles
1+
import ../../../.bazelrc

jmh/jmh.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def jmh_repositories(
1717
"io_bazel_rules_scala_org_openjdk_jmh_jmh_core",
1818
"io_bazel_rules_scala_org_openjdk_jmh_jmh_generator_asm",
1919
"io_bazel_rules_scala_org_openjdk_jmh_jmh_generator_reflection",
20-
"io_bazel_rules_scala_org_ows2_asm_asm",
20+
"io_bazel_rules_scala_org_ow2_asm_asm",
2121
"io_bazel_rules_scala_net_sf_jopt_simple_jopt_simple",
2222
"io_bazel_rules_scala_org_apache_commons_commons_math3",
2323
],

scala/extensions/deps.bzl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ _compiler_srcjar = tag_class(
5757
)
5858

5959
_toolchains_defaults = {
60-
"scala": True,
6160
"scalatest": False,
6261
"junit": False,
6362
"specs2": False,
@@ -128,15 +127,12 @@ def _get_toolchains(module_ctx):
128127
for mod in module_ctx.modules:
129128
values = get_tag_values(mod.tags.toolchains, _toolchains_defaults)
130129
result.update({k: True for k in values if values[k]})
131-
if mod.is_root:
132-
root_scala_toolchain = values["scala"]
133130

134131
if result["testing"]:
135132
result["scalatest"] = True
136133
result["specs2"] = True
137134
if result["specs2"]:
138135
result["junit"] = True
139-
result["scala"] = root_scala_toolchain
140136
return result
141137

142138
def _scala_deps_impl(module_ctx):

0 commit comments

Comments
 (0)