blob: 2fa6f89696d8853d77944f6c563d22c573c24182 [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}")
Pete Gillin1f52e932019-10-09 17:10:08 +010041 ctx.Strict("ANDROID_JAVA11_HOME", "prebuilts/jdk/jdk11/${hostPrebuiltTag}")
Colin Cross64162712017-08-08 13:17:59 -070042 ctx.Strict("ANDROID_JAVA_TOOLCHAIN", "${JavaToolchain}")
Sasha Smundak26c6d9e2019-06-11 13:30:13 -070043 ctx.Strict("JAVA", "${JavaCmd} ${JavaVmFlags}")
44 ctx.Strict("JAVAC", "${JavacCmd} ${JavacVmFlags}")
Colin Cross64162712017-08-08 13:17:59 -070045 ctx.Strict("JAR", "${JarCmd}")
Colin Crossded8a972017-08-15 14:27:52 -070046 ctx.Strict("JAR_ARGS", "${JarArgsCmd}")
Colin Cross64162712017-08-08 13:17:59 -070047 ctx.Strict("JAVADOC", "${JavadocCmd}")
48 ctx.Strict("COMMON_JDK_FLAGS", "${CommonJdkFlags}")
Alan Leung9f319112017-11-30 15:50:39 -080049
Colin Crossbafb8972018-06-06 21:46:32 +000050 ctx.Strict("DX", "${D8Cmd}")
51 ctx.Strict("DX_COMMAND", "${D8Cmd} -JXms16M -JXmx2048M")
Colin Cross66dbc0b2017-12-28 12:23:20 -080052 ctx.Strict("R8_COMPAT_PROGUARD", "${R8Cmd}")
Alan Leung9f319112017-11-30 15:50:39 -080053
Nan Zhanged19fc32017-10-19 13:06:22 -070054 ctx.Strict("TURBINE", "${TurbineJar}")
Colin Cross2aad9c22017-08-14 14:17:37 -070055
Colin Cross66548102018-06-19 22:47:35 -070056 if ctx.Config().RunErrorProne() {
57 ctx.Strict("ERROR_PRONE_JARS", strings.Join(ErrorProneClasspath, " "))
58 ctx.Strict("ERROR_PRONE_FLAGS", "${ErrorProneFlags}")
59 ctx.Strict("ERROR_PRONE_CHECKS", "${ErrorProneChecks}")
Colin Cross2aad9c22017-08-14 14:17:37 -070060 }
Tobias Thierer77d0b412017-08-31 16:08:39 +010061
Sasha Smundak26c6d9e2019-06-11 13:30:13 -070062 ctx.Strict("TARGET_JAVAC", "${JavacCmd} ${JavacVmFlags} ${CommonJdkFlags}")
63 ctx.Strict("HOST_JAVAC", "${JavacCmd} ${JavacVmFlags} ${CommonJdkFlags}")
Colin Cross66548102018-06-19 22:47:35 -070064
Colin Cross997262f2018-06-19 22:49:39 -070065 ctx.Strict("JLINK", "${JlinkCmd}")
66 ctx.Strict("JMOD", "${JmodCmd}")
Colin Crossa4820652017-10-17 13:56:52 -070067
68 ctx.Strict("SOONG_JAVAC_WRAPPER", "${SoongJavacWrapper}")
Colin Cross43f08db2018-11-12 10:13:39 -080069 ctx.Strict("DEXPREOPT_GEN", "${DexpreoptGen}")
Colin Cross436b7652018-03-15 16:24:10 -070070 ctx.Strict("ZIPSYNC", "${ZipSyncCmd}")
Colin Crosscb933592017-11-22 13:49:43 -080071
72 ctx.Strict("JACOCO_CLI_JAR", "${JacocoCLIJar}")
73 ctx.Strict("DEFAULT_JACOCO_EXCLUDE_FILTER", strings.Join(DefaultJacocoExcludeFilter, ","))
Colin Cross66f78822018-05-02 12:58:28 -070074
75 ctx.Strict("EXTRACT_JAR_PACKAGES", "${ExtractJarPackagesCmd}")
Colin Cross8bb10e82018-06-07 16:46:02 -070076
Colin Cross72119102019-05-20 13:14:18 -070077 ctx.Strict("MANIFEST_CHECK", "${ManifestCheckCmd}")
Colin Cross8bb10e82018-06-07 16:46:02 -070078 ctx.Strict("MANIFEST_FIXER", "${ManifestFixerCmd}")
Colin Cross31656952018-05-24 16:11:20 -070079
Colin Cross87ecbfe2019-02-26 22:14:04 -080080 ctx.Strict("ANDROID_MANIFEST_MERGER", "${ManifestMergerCmd}")
Colin Cross8faf8fc2019-01-16 15:15:52 -080081
82 ctx.Strict("CLASS2GREYLIST", "${Class2Greylist}")
83 ctx.Strict("HIDDENAPI", "${HiddenAPI}")
Colin Cross6db4d4e2019-02-21 14:58:58 -080084
85 ctx.Strict("DEX_FLAGS", "${DexFlags}")
Colin Crossbdf95142019-08-08 12:56:34 -070086
87 ctx.Strict("AIDL", "${AidlCmd}")
88 ctx.Strict("AAPT2", "${Aapt2Cmd}")
89 ctx.Strict("ZIPALIGN", "${ZipAlign}")
90 ctx.Strict("SIGNAPK_JAR", "${SignapkCmd}")
91 ctx.Strict("SIGNAPK_JNI_LIBRARY_PATH", "${SignapkJniLibrary}")
92
93 ctx.Strict("SOONG_ZIP", "${SoongZipCmd}")
94 ctx.Strict("MERGE_ZIPS", "${MergeZipsCmd}")
95 ctx.Strict("ZIP2ZIP", "${Zip2ZipCmd}")
96
97 ctx.Strict("ZIPTIME", "${Ziptime}")
98
Colin Cross3e3e72d2017-06-22 17:20:19 -070099}