File tree 3 files changed +24
-0
lines changed
3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,10 @@ _scala_binary_attrs = {
52
52
"main_class" : attr .string (mandatory = True ),
53
53
"classpath_resources" : attr .label_list (allow_files = True ),
54
54
"jvm_flags" : attr .string_list (),
55
+ "runtime_jdk" : attr .label (
56
+ default = Label ("@bazel_tools//tools/jdk:current_java_runtime" ),
57
+ providers = [java_common .JavaRuntimeInfo ],
58
+ ),
55
59
}
56
60
57
61
_scala_binary_attrs .update (launcher_template )
Original file line number Diff line number Diff line change @@ -471,8 +471,17 @@ scala_specs2_junit_test(
471
471
"//test/src/main/scala/scalarules/test/twitter_scrooge:justscrooge2b_binary" ,
472
472
"//test/src/main/scala/scalarules/test/large_classpath:largeClasspath" ,
473
473
"//test:test_scala_proto_server" ,
474
+ "//test:scala_binary_jdk_11" ,
474
475
]]
475
476
477
+ # Make sure scala_binary respects runtime_jdk on bazel run
478
+ scala_binary (
479
+ name = "scala_binary_jdk_11" ,
480
+ srcs = ["ScalaBinaryJdk11.scala" ],
481
+ main_class = "scalarules.test.ScalaBinaryJdk11" ,
482
+ runtime_jdk = "@bazel_tools//tools/jdk:remote_jdk11" ,
483
+ )
484
+
476
485
# Generate a file containing the rootpaths of a Scala binary.
477
486
genrule (
478
487
name = "rootpath-script" ,
Original file line number Diff line number Diff line change
1
+ package scalarules .test
2
+
3
+ object ScalaBinaryJdk11 {
4
+ def main (args : Array [String ]): Unit = {
5
+ val expectedMajorVersion = " 11" ;
6
+ val version = System .getProperty(" java.version" );
7
+ val majorVersionMatches = version.startsWith(expectedMajorVersion + " ." );
8
+ val failureMsg = " Expected major version of " + expectedMajorVersion + " but got version: " + version;
9
+ require(majorVersionMatches, failureMsg);
10
+ }
11
+ }
You can’t perform that action at this time.
0 commit comments