kotlin.go 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. package config
  15. import "strings"
  16. var (
  17. KotlinStdlibJar = "external/kotlinc/lib/kotlin-stdlib.jar"
  18. KotlincIllegalFlags = []string{
  19. "-no-jdk",
  20. "-no-stdlib",
  21. }
  22. )
  23. func init() {
  24. pctx.SourcePathVariable("KotlincCmd", "external/kotlinc/bin/kotlinc")
  25. pctx.SourcePathVariable("KotlinCompilerJar", "external/kotlinc/lib/kotlin-compiler.jar")
  26. pctx.SourcePathVariable("KotlinPreloaderJar", "external/kotlinc/lib/kotlin-preloader.jar")
  27. pctx.SourcePathVariable("KotlinReflectJar", "external/kotlinc/lib/kotlin-reflect.jar")
  28. pctx.SourcePathVariable("KotlinScriptRuntimeJar", "external/kotlinc/lib/kotlin-script-runtime.jar")
  29. pctx.SourcePathVariable("KotlinTrove4jJar", "external/kotlinc/lib/trove4j.jar")
  30. pctx.SourcePathVariable("KotlinKaptJar", "external/kotlinc/lib/kotlin-annotation-processing.jar")
  31. pctx.SourcePathVariable("KotlinAnnotationJar", "external/kotlinc/lib/annotations-13.0.jar")
  32. pctx.SourcePathVariable("KotlinStdlibJar", KotlinStdlibJar)
  33. pctx.SourcePathVariable("KotlinAbiGenPluginJar", "external/kotlinc/lib/jvm-abi-gen.jar")
  34. // These flags silence "Illegal reflective access" warnings when running kapt in OpenJDK9+
  35. pctx.StaticVariable("KaptSuppressJDK9Warnings", strings.Join([]string{
  36. "-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
  37. "-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
  38. "-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
  39. "-J--add-opens=java.base/sun.net.www.protocol.jar=ALL-UNNAMED",
  40. }, " "))
  41. // These flags silence "Illegal reflective access" warnings when running kotlinc in OpenJDK9+
  42. pctx.StaticVariable("KotlincSuppressJDK9Warnings", strings.Join([]string{
  43. "-J--add-opens=java.base/java.util=ALL-UNNAMED", // https://youtrack.jetbrains.com/issue/KT-43704
  44. }, " "))
  45. pctx.StaticVariable("KotlincGlobalFlags", strings.Join([]string{
  46. // b/222162908: prevent kotlinc from reading /tmp/build.txt
  47. "-Didea.plugins.compatible.build=999.SNAPSHOT",
  48. }, " "))
  49. }