Colin Cross | 3e3e72d | 2017-06-22 17:20:19 -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 | |
| 17 | import ( |
| 18 | "strings" |
| 19 | |
| 20 | "android/soong/android" |
| 21 | ) |
| 22 | |
| 23 | func init() { |
| 24 | android.RegisterMakeVarsProvider(pctx, makeVarsProvider) |
| 25 | } |
| 26 | |
| 27 | func makeVarsProvider(ctx android.MakeVarsContext) { |
| 28 | ctx.Strict("TARGET_DEFAULT_JAVA_LIBRARIES", strings.Join(DefaultLibraries, " ")) |
Colin Cross | cb2c929 | 2017-09-23 19:57:16 -0700 | [diff] [blame] | 29 | ctx.Strict("TARGET_DEFAULT_BOOTCLASSPATH_LIBRARIES", strings.Join(DefaultBootclasspathLibraries, " ")) |
Colin Cross | 1369cdb | 2017-09-29 17:58:17 -0700 | [diff] [blame] | 30 | ctx.Strict("DEFAULT_SYSTEM_MODULES", DefaultSystemModules) |
Colin Cross | 6416271 | 2017-08-08 13:17:59 -0700 | [diff] [blame] | 31 | |
Colin Cross | 1369cdb | 2017-09-29 17:58:17 -0700 | [diff] [blame] | 32 | if ctx.Config().TargetOpenJDK9() { |
| 33 | ctx.Strict("DEFAULT_JAVA_LANGUAGE_VERSION", "1.9") |
| 34 | } else { |
| 35 | ctx.Strict("DEFAULT_JAVA_LANGUAGE_VERSION", "1.8") |
| 36 | } |
Colin Cross | 6416271 | 2017-08-08 13:17:59 -0700 | [diff] [blame] | 37 | |
| 38 | ctx.Strict("ANDROID_JAVA_HOME", "${JavaHome}") |
Tobias Thierer | 06ae582 | 2017-12-08 18:03:43 +0000 | [diff] [blame] | 39 | ctx.Strict("ANDROID_JAVA8_HOME", "prebuilts/jdk/jdk8/${hostPrebuiltTag}") |
| 40 | ctx.Strict("ANDROID_JAVA9_HOME", "prebuilts/jdk/jdk9/${hostPrebuiltTag}") |
Colin Cross | 6416271 | 2017-08-08 13:17:59 -0700 | [diff] [blame] | 41 | ctx.Strict("ANDROID_JAVA_TOOLCHAIN", "${JavaToolchain}") |
| 42 | ctx.Strict("JAVA", "${JavaCmd}") |
| 43 | ctx.Strict("JAVAC", "${JavacCmd}") |
| 44 | ctx.Strict("JAR", "${JarCmd}") |
Colin Cross | ded8a97 | 2017-08-15 14:27:52 -0700 | [diff] [blame] | 45 | ctx.Strict("JAR_ARGS", "${JarArgsCmd}") |
Colin Cross | 6416271 | 2017-08-08 13:17:59 -0700 | [diff] [blame] | 46 | ctx.Strict("JAVADOC", "${JavadocCmd}") |
| 47 | ctx.Strict("COMMON_JDK_FLAGS", "${CommonJdkFlags}") |
Alan Leung | 9f31911 | 2017-11-30 15:50:39 -0800 | [diff] [blame] | 48 | |
Alan Leung | c37c634 | 2017-12-13 00:28:49 -0800 | [diff] [blame] | 49 | if ctx.Config().UseD8Desugar() { |
Alan Leung | 9f31911 | 2017-11-30 15:50:39 -0800 | [diff] [blame] | 50 | ctx.Strict("DX", "${D8Cmd}") |
| 51 | ctx.Strict("DX_COMMAND", "${D8Cmd} -JXms16M -JXmx2048M") |
Alan Leung | c37c634 | 2017-12-13 00:28:49 -0800 | [diff] [blame] | 52 | ctx.Strict("USE_D8_DESUGAR", "true") |
Alan Leung | 9f31911 | 2017-11-30 15:50:39 -0800 | [diff] [blame] | 53 | } else { |
| 54 | ctx.Strict("DX", "${DxCmd}") |
| 55 | ctx.Strict("DX_COMMAND", "${DxCmd} -JXms16M -JXmx2048M") |
Alan Leung | c37c634 | 2017-12-13 00:28:49 -0800 | [diff] [blame] | 56 | ctx.Strict("USE_D8_DESUGAR", "false") |
Alan Leung | 9f31911 | 2017-11-30 15:50:39 -0800 | [diff] [blame] | 57 | } |
Colin Cross | 66dbc0b | 2017-12-28 12:23:20 -0800 | [diff] [blame^] | 58 | ctx.Strict("R8_COMPAT_PROGUARD", "${R8Cmd}") |
Alan Leung | 9f31911 | 2017-11-30 15:50:39 -0800 | [diff] [blame] | 59 | |
Nan Zhang | ed19fc3 | 2017-10-19 13:06:22 -0700 | [diff] [blame] | 60 | ctx.Strict("TURBINE", "${TurbineJar}") |
Colin Cross | 2aad9c2 | 2017-08-14 14:17:37 -0700 | [diff] [blame] | 61 | |
| 62 | if ctx.Config().IsEnvTrue("RUN_ERROR_PRONE") { |
| 63 | ctx.Strict("TARGET_JAVAC", "${ErrorProneCmd}") |
| 64 | ctx.Strict("HOST_JAVAC", "${ErrorProneCmd}") |
| 65 | } else { |
| 66 | ctx.Strict("TARGET_JAVAC", "${JavacCmd} ${CommonJdkFlags}") |
| 67 | ctx.Strict("HOST_JAVAC", "${JavacCmd} ${CommonJdkFlags}") |
| 68 | } |
Tobias Thierer | 77d0b41 | 2017-08-31 16:08:39 +0100 | [diff] [blame] | 69 | |
Colin Cross | 1369cdb | 2017-09-29 17:58:17 -0700 | [diff] [blame] | 70 | if ctx.Config().UseOpenJDK9() { |
Tobias Thierer | 77d0b41 | 2017-08-31 16:08:39 +0100 | [diff] [blame] | 71 | ctx.Strict("JLINK", "${JlinkCmd}") |
| 72 | ctx.Strict("JMOD", "${JmodCmd}") |
| 73 | } |
Colin Cross | a482065 | 2017-10-17 13:56:52 -0700 | [diff] [blame] | 74 | |
| 75 | ctx.Strict("SOONG_JAVAC_WRAPPER", "${SoongJavacWrapper}") |
Colin Cross | 1763da8 | 2017-11-15 22:16:57 -0800 | [diff] [blame] | 76 | ctx.Strict("EXTRACT_SRCJARS", "${ExtractSrcJarsCmd}") |
Colin Cross | cb93359 | 2017-11-22 13:49:43 -0800 | [diff] [blame] | 77 | |
| 78 | ctx.Strict("JACOCO_CLI_JAR", "${JacocoCLIJar}") |
| 79 | ctx.Strict("DEFAULT_JACOCO_EXCLUDE_FILTER", strings.Join(DefaultJacocoExcludeFilter, ",")) |
Colin Cross | 3e3e72d | 2017-06-22 17:20:19 -0700 | [diff] [blame] | 80 | } |