1
- load ("@bazel_skylib//rules:common_settings.bzl" , "BuildSettingInfo" )
2
- load ("@rules_java//java:defs.bzl" , "JavaInfo" , "java_common" )
3
- load (
4
- "//kotlin/internal:defs.bzl" ,
5
- _KT_COMPILER_REPO = "KT_COMPILER_REPO" ,
6
- _TOOLCHAIN_TYPE = "TOOLCHAIN_TYPE" ,
7
- )
8
-
9
1
# Copyright 2018 The Bazel Authors. All rights reserved.
10
2
#
11
3
# Licensed under the Apache License, Version 2.0 (the "License");
19
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
12
# See the License for the specific language governing permissions and
21
13
# limitations under the License.
14
+ load ("@bazel_skylib//rules:common_settings.bzl" , "BuildSettingInfo" )
15
+ load ("@rules_java//java:defs.bzl" , "JavaInfo" , "java_common" )
16
+ load (
17
+ "//kotlin/internal:defs.bzl" ,
18
+ _KT_COMPILER_REPO = "KT_COMPILER_REPO" ,
19
+ _TOOLCHAIN_TYPE = "TOOLCHAIN_TYPE" ,
20
+ )
22
21
load (
23
22
"//kotlin/internal:opts.bzl" ,
24
23
"JavacOptions" ,
@@ -73,6 +72,11 @@ def _kotlin_toolchain_impl(ctx):
73
72
debug = ctx .attr .debug ,
74
73
jvm_target = ctx .attr .jvm_target ,
75
74
kotlinbuilder = ctx .attr .kotlinbuilder ,
75
+ builder_args = [
76
+ "--wrapper_script_flag=--main_advice_classpath=%s" % (
77
+ ":" .join ([f .path for f in ctx .files .jvm_stdlibs ])
78
+ ),
79
+ ],
76
80
jdeps_merger = ctx .attr .jdeps_merger ,
77
81
kotlin_home = ctx .attr .kotlin_home ,
78
82
jvm_stdlibs = java_common .merge (compile_time_providers + runtime_providers ),
@@ -122,7 +126,7 @@ _kt_toolchain = rule(
122
126
),
123
127
"language_version" : attr .string (
124
128
doc = "this is the -language_version flag [see](https://kotlinlang.org/docs/reference/compatibility.html)" ,
125
- default = "2.0 " ,
129
+ default = "1.9 " ,
126
130
values = [
127
131
"1.1" ,
128
132
"1.2" ,
@@ -138,7 +142,7 @@ _kt_toolchain = rule(
138
142
),
139
143
"api_version" : attr .string (
140
144
doc = "this is the -api_version flag [see](https://kotlinlang.org/docs/reference/compatibility.html)." ,
141
- default = "2.0 " ,
145
+ default = "1.9 " ,
142
146
values = [
143
147
"1.1" ,
144
148
"1.2" ,
@@ -161,22 +165,11 @@ _kt_toolchain = rule(
161
165
),
162
166
"jvm_runtime" : attr .label_list (
163
167
doc = "The implicit jvm runtime libraries. This is internal." ,
164
- default = [
165
- Label ("//kotlin/compiler:kotlin-stdlib" ),
166
- ],
167
168
providers = [JavaInfo ],
168
169
cfg = "target" ,
169
170
),
170
171
"jvm_stdlibs" : attr .label_list (
171
172
doc = "The jvm stdlibs. This is internal." ,
172
- default = [
173
- Label ("//kotlin/compiler:annotations" ),
174
- Label ("//kotlin/compiler:kotlin-stdlib" ),
175
- Label ("//kotlin/compiler:kotlin-stdlib-jdk7" ),
176
- # JDK8 is being added blindly but I think we will probably not support bytecode levels 1.6 when the
177
- # repo stabelizes so this should be fine.
178
- Label ("//kotlin/compiler:kotlin-stdlib-jdk8" ),
179
- ],
180
173
providers = [JavaInfo ],
181
174
cfg = "target" ,
182
175
),
@@ -301,6 +294,8 @@ def define_kt_toolchain(
301
294
experimental_multiplex_workers = None ,
302
295
javac_options = Label ("//kotlin/internal:default_javac_options" ),
303
296
kotlinc_options = Label ("//kotlin/internal:default_kotlinc_options" ),
297
+ jvm_stdlibs = None ,
298
+ jvm_runtime = None ,
304
299
jacocorunner = None ,
305
300
exec_compatible_with = None ,
306
301
target_compatible_with = None ,
@@ -327,6 +322,15 @@ def define_kt_toolchain(
327
322
kotlinc_options = kotlinc_options ,
328
323
visibility = ["//visibility:public" ],
329
324
jacocorunner = jacocorunner ,
325
+ jvm_stdlibs = jvm_stdlibs if jvm_stdlibs != None else [
326
+ Label ("//kotlin/compiler:annotations" ),
327
+ Label ("//kotlin/compiler:kotlin-stdlib" ),
328
+ Label ("//kotlin/compiler:kotlin-stdlib-jdk7" ),
329
+ Label ("//kotlin/compiler:kotlin-stdlib-jdk8" ),
330
+ ],
331
+ jvm_runtime = jvm_runtime if jvm_runtime != None else [
332
+ Label ("//kotlin/compiler:kotlin-stdlib" ),
333
+ ],
330
334
)
331
335
native .toolchain (
332
336
name = name ,
0 commit comments