Skip to content

Commit cb7a448

Browse files
author
James Judd
committed
Turn back on ijars for Scala 3
1 parent 4e4f2ab commit cb7a448

File tree

5 files changed

+7
-19
lines changed

5 files changed

+7
-19
lines changed

rules/private/phases/phase_javainfo.bzl

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,6 @@ def phase_javainfo(ctx, g):
2828
if len(ctx.attr.srcs) == 0 and len(ctx.attr.resources) == 0:
2929
java_info = java_common.merge([g.classpaths.sdeps, sexports, sruntime_deps])
3030
else:
31-
# TODO: why do ijars break Scala 3?
32-
# For some yet unknown reason ijars break Scala 3.
33-
# Bazel now handles .tasty files, but the Scala 3 test fails to pass
34-
# when this ijar is used as the compile jar. My guess is that the
35-
# classfile format changed somehow for Scala 3 and Bazel does not yet
36-
# handle that.
37-
#
38-
# In the meantime, we've added a use_ijar Scala configuration value and
39-
# only use ijars for Scala 2 targets.
4031
compile_jar = ctx.outputs.jar
4132
if (ctx.attr.scala[_ScalaConfiguration].use_ijar):
4233
compile_jar = java_common.run_ijar(

rules/scala.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ configure_bootstrap_scala = rule(
501501
doc = "Scalac options that will always be enabled.",
502502
),
503503
"use_ijar": attr.bool(
504-
doc = "Whether to use ijars for this compiler. Scala 3 currently cannot use ijars.",
504+
doc = "Whether to use ijars for this compiler.",
505505
default = True,
506506
),
507507
},
@@ -535,7 +535,7 @@ _configure_zinc_scala = rule(
535535
default = "warn",
536536
),
537537
"use_ijar": attr.bool(
538-
doc = "Whether to use ijars for this compiler. Scala 3 currently cannot use ijars.",
538+
doc = "Whether to use ijars for this compiler.",
539539
default = True,
540540
),
541541
"deps_direct": attr.string(default = "error"),

src/main/scala/BUILD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ configure_bootstrap_scala(
9696
compiler_classpath = compiler_classpath_3,
9797
global_scalacopts = shared_global_scalacopts,
9898
runtime_classpath = runtime_classpath_3,
99-
use_ijar = False,
99+
use_ijar = True,
100100
version = scala_3_version,
101101
visibility = ["//visibility:public"],
102102
)
@@ -107,7 +107,7 @@ configure_zinc_scala(
107107
compiler_classpath = compiler_classpath_3,
108108
global_scalacopts = shared_global_scalacopts,
109109
runtime_classpath = runtime_classpath_3,
110-
use_ijar = False,
110+
use_ijar = True,
111111
version = scala_3_version,
112112
visibility = ["//visibility:public"],
113113
)

tests/plugins/macros/test

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
#!/bin/bash -e
22
. "$(dirname "$0")"/../../common.sh
33

4-
# TODO: Re-enable this test once Scala 3 works with ijars
5-
# macro = True makes you use full jars, and we're doing that
6-
# all the time now because Scala 3 +ijar breaks. So this always passes
7-
#bazel build :bad_compile 2>&1 | grep 'You may be missing a `macro = True` attribute.'
4+
bazel build :bad_compile 2>&1 | grep 'You may be missing a `macro = True` attribute.'
85
[ "$(bazel run :test_macro)" = "hello world!" ]
96
[ "$(bazel run :test_macro_only)" = $'hello world!\nworld hello!' ]

tests/scala/BUILD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ configure_bootstrap_scala(
110110
name = "bootstrap_3",
111111
compiler_classpath = compiler_classpath_3,
112112
runtime_classpath = runtime_classpath_3,
113-
use_ijar = False,
113+
use_ijar = True,
114114
version = scala_3_version,
115115
visibility = ["//visibility:public"],
116116
)
@@ -120,7 +120,7 @@ configure_zinc_scala(
120120
compiler_bridge = "@annex//:org_scala_lang_scala3_sbt_bridge",
121121
compiler_classpath = compiler_classpath_3,
122122
runtime_classpath = runtime_classpath_3,
123-
use_ijar = False,
123+
use_ijar = True,
124124
version = scala_3_version,
125125
visibility = ["//visibility:public"],
126126
)

0 commit comments

Comments
 (0)