Colin Cross | 93e8595 | 2017-08-15 13:34:18 -0700 | [diff] [blame] | 1 | // Copyright 2017 Google Inc. All rights reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package config |
| 16 | |
Colin Cross | afbb173 | 2019-01-17 15:42:52 -0800 | [diff] [blame] | 17 | import "strings" |
| 18 | |
Colin Cross | 93e8595 | 2017-08-15 13:34:18 -0700 | [diff] [blame] | 19 | var ( |
Zoran Jovanovic | 8736ce2 | 2018-08-21 17:10:29 +0200 | [diff] [blame] | 20 | KotlinStdlibJar = "external/kotlinc/lib/kotlin-stdlib.jar" |
| 21 | KotlincIllegalFlags = []string{ |
| 22 | "-no-jdk", |
| 23 | "-no-stdlib", |
| 24 | } |
Colin Cross | 93e8595 | 2017-08-15 13:34:18 -0700 | [diff] [blame] | 25 | ) |
| 26 | |
| 27 | func init() { |
| 28 | pctx.SourcePathVariable("KotlincCmd", "external/kotlinc/bin/kotlinc") |
| 29 | pctx.SourcePathVariable("KotlinCompilerJar", "external/kotlinc/lib/kotlin-compiler.jar") |
Dan Willemsen | aad1960 | 2019-04-07 09:44:35 -0700 | [diff] [blame] | 30 | pctx.SourcePathVariable("KotlinPreloaderJar", "external/kotlinc/lib/kotlin-preloader.jar") |
| 31 | pctx.SourcePathVariable("KotlinReflectJar", "external/kotlinc/lib/kotlin-reflect.jar") |
| 32 | pctx.SourcePathVariable("KotlinScriptRuntimeJar", "external/kotlinc/lib/kotlin-script-runtime.jar") |
| 33 | pctx.SourcePathVariable("KotlinTrove4jJar", "external/kotlinc/lib/trove4j.jar") |
Colin Cross | afbb173 | 2019-01-17 15:42:52 -0800 | [diff] [blame] | 34 | pctx.SourcePathVariable("KotlinKaptJar", "external/kotlinc/lib/kotlin-annotation-processing.jar") |
Dan Willemsen | 1cfbdbe | 2019-06-13 04:59:17 +0000 | [diff] [blame] | 35 | pctx.SourcePathVariable("KotlinAnnotationJar", "external/kotlinc/lib/annotations-13.0.jar") |
Colin Cross | 93e8595 | 2017-08-15 13:34:18 -0700 | [diff] [blame] | 36 | pctx.SourcePathVariable("KotlinStdlibJar", KotlinStdlibJar) |
Colin Cross | 220a9a1 | 2022-03-28 17:08:01 -0700 | [diff] [blame] | 37 | pctx.SourcePathVariable("KotlinAbiGenPluginJar", "external/kotlinc/lib/jvm-abi-gen.jar") |
Colin Cross | afbb173 | 2019-01-17 15:42:52 -0800 | [diff] [blame] | 38 | |
Colin Cross | d47f4ac | 2021-03-26 10:52:02 -0700 | [diff] [blame] | 39 | // These flags silence "Illegal reflective access" warnings when running kapt in OpenJDK9+ |
| 40 | pctx.StaticVariable("KaptSuppressJDK9Warnings", strings.Join([]string{ |
Colin Cross | afbb173 | 2019-01-17 15:42:52 -0800 | [diff] [blame] | 41 | "-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED", |
| 42 | "-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED", |
| 43 | "-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED", |
| 44 | "-J--add-opens=java.base/sun.net.www.protocol.jar=ALL-UNNAMED", |
| 45 | }, " ")) |
Colin Cross | d47f4ac | 2021-03-26 10:52:02 -0700 | [diff] [blame] | 46 | |
| 47 | // These flags silence "Illegal reflective access" warnings when running kotlinc in OpenJDK9+ |
| 48 | pctx.StaticVariable("KotlincSuppressJDK9Warnings", strings.Join([]string{ |
| 49 | "-J--add-opens=java.base/java.util=ALL-UNNAMED", // https://youtrack.jetbrains.com/issue/KT-43704 |
| 50 | }, " ")) |
Colin Cross | c2d5048 | 2022-03-17 12:01:27 -0700 | [diff] [blame] | 51 | |
| 52 | pctx.StaticVariable("KotlincGlobalFlags", strings.Join([]string{ |
| 53 | // b/222162908: prevent kotlinc from reading /tmp/build.txt |
| 54 | "-Didea.plugins.compatible.build=999.SNAPSHOT", |
| 55 | }, " ")) |
Colin Cross | 93e8595 | 2017-08-15 13:34:18 -0700 | [diff] [blame] | 56 | } |