blob: 7e125d59d8b663dcb208b6d41d4f324e938f389a [file] [log] [blame]
Colin Cross3e3e72d2017-06-22 17:20:19 -07001// 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
15package config
16
17import (
18 "strings"
19
20 "android/soong/android"
21)
22
23func init() {
24 android.RegisterMakeVarsProvider(pctx, makeVarsProvider)
25}
26
27func makeVarsProvider(ctx android.MakeVarsContext) {
28 ctx.Strict("TARGET_DEFAULT_JAVA_LIBRARIES", strings.Join(DefaultLibraries, " "))
Colin Crosscb2c9292017-09-23 19:57:16 -070029 ctx.Strict("TARGET_DEFAULT_BOOTCLASSPATH_LIBRARIES", strings.Join(DefaultBootclasspathLibraries, " "))
Colin Cross1369cdb2017-09-29 17:58:17 -070030 ctx.Strict("DEFAULT_SYSTEM_MODULES", DefaultSystemModules)
Colin Cross64162712017-08-08 13:17:59 -070031
Colin Cross1369cdb2017-09-29 17:58:17 -070032 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 Cross64162712017-08-08 13:17:59 -070037
38 ctx.Strict("ANDROID_JAVA_HOME", "${JavaHome}")
Tobias Thierer06ae5822017-12-08 18:03:43 +000039 ctx.Strict("ANDROID_JAVA8_HOME", "prebuilts/jdk/jdk8/${hostPrebuiltTag}")
40 ctx.Strict("ANDROID_JAVA9_HOME", "prebuilts/jdk/jdk9/${hostPrebuiltTag}")
Colin Cross64162712017-08-08 13:17:59 -070041 ctx.Strict("ANDROID_JAVA_TOOLCHAIN", "${JavaToolchain}")
42 ctx.Strict("JAVA", "${JavaCmd}")
43 ctx.Strict("JAVAC", "${JavacCmd}")
44 ctx.Strict("JAR", "${JarCmd}")
Colin Crossded8a972017-08-15 14:27:52 -070045 ctx.Strict("JAR_ARGS", "${JarArgsCmd}")
Colin Cross64162712017-08-08 13:17:59 -070046 ctx.Strict("JAVADOC", "${JavadocCmd}")
47 ctx.Strict("COMMON_JDK_FLAGS", "${CommonJdkFlags}")
Alan Leung9f319112017-11-30 15:50:39 -080048
Alan Leungc37c6342017-12-13 00:28:49 -080049 if ctx.Config().UseD8Desugar() {
Alan Leung9f319112017-11-30 15:50:39 -080050 ctx.Strict("DX", "${D8Cmd}")
51 ctx.Strict("DX_COMMAND", "${D8Cmd} -JXms16M -JXmx2048M")
Alan Leungc37c6342017-12-13 00:28:49 -080052 ctx.Strict("USE_D8_DESUGAR", "true")
Alan Leung9f319112017-11-30 15:50:39 -080053 } else {
54 ctx.Strict("DX", "${DxCmd}")
55 ctx.Strict("DX_COMMAND", "${DxCmd} -JXms16M -JXmx2048M")
Alan Leungc37c6342017-12-13 00:28:49 -080056 ctx.Strict("USE_D8_DESUGAR", "false")
Alan Leung9f319112017-11-30 15:50:39 -080057 }
Colin Cross66dbc0b2017-12-28 12:23:20 -080058 ctx.Strict("R8_COMPAT_PROGUARD", "${R8Cmd}")
Alan Leung9f319112017-11-30 15:50:39 -080059
Nan Zhanged19fc32017-10-19 13:06:22 -070060 ctx.Strict("TURBINE", "${TurbineJar}")
Colin Cross2aad9c22017-08-14 14:17:37 -070061
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 Thierer77d0b412017-08-31 16:08:39 +010069
Colin Cross1369cdb2017-09-29 17:58:17 -070070 if ctx.Config().UseOpenJDK9() {
Tobias Thierer77d0b412017-08-31 16:08:39 +010071 ctx.Strict("JLINK", "${JlinkCmd}")
72 ctx.Strict("JMOD", "${JmodCmd}")
73 }
Colin Crossa4820652017-10-17 13:56:52 -070074
75 ctx.Strict("SOONG_JAVAC_WRAPPER", "${SoongJavacWrapper}")
Colin Cross1763da82017-11-15 22:16:57 -080076 ctx.Strict("EXTRACT_SRCJARS", "${ExtractSrcJarsCmd}")
Colin Crosscb933592017-11-22 13:49:43 -080077
78 ctx.Strict("JACOCO_CLI_JAR", "${JacocoCLIJar}")
79 ctx.Strict("DEFAULT_JACOCO_EXCLUDE_FILTER", strings.Join(DefaultJacocoExcludeFilter, ","))
Colin Cross3e3e72d2017-06-22 17:20:19 -070080}