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 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, " ")) 29 ctx.Strict("TARGET_DEFAULT_BOOTCLASSPATH_LIBRARIES", strings.Join(DefaultBootclasspathLibraries, " ")) 30 ctx.Strict("DEFAULT_SYSTEM_MODULES", DefaultSystemModules) 31 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 } 37 38 ctx.Strict("ANDROID_JAVA_HOME", "${JavaHome}") 39 ctx.Strict("ANDROID_JAVA8_HOME", "prebuilts/jdk/jdk8/${hostPrebuiltTag}") 40 ctx.Strict("ANDROID_JAVA9_HOME", "prebuilts/jdk/jdk9/${hostPrebuiltTag}") 41 ctx.Strict("ANDROID_JAVA_TOOLCHAIN", "${JavaToolchain}") 42 ctx.Strict("JAVA", "${JavaCmd}") 43 ctx.Strict("JAVAC", "${JavacCmd}") 44 ctx.Strict("JAR", "${JarCmd}") 45 ctx.Strict("JAR_ARGS", "${JarArgsCmd}") 46 ctx.Strict("JAVADOC", "${JavadocCmd}") 47 ctx.Strict("COMMON_JDK_FLAGS", "${CommonJdkFlags}") 48 49 ctx.Strict("DX", "${D8Cmd}") 50 ctx.Strict("DX_COMMAND", "${D8Cmd} -JXms16M -JXmx2048M") 51 ctx.Strict("R8_COMPAT_PROGUARD", "${R8Cmd}") 52 53 ctx.Strict("TURBINE", "${TurbineJar}") 54 55 if ctx.Config().RunErrorProne() { 56 ctx.Strict("ERROR_PRONE_JARS", strings.Join(ErrorProneClasspath, " ")) 57 ctx.Strict("ERROR_PRONE_FLAGS", "${ErrorProneFlags}") 58 ctx.Strict("ERROR_PRONE_CHECKS", "${ErrorProneChecks}") 59 } 60 61 ctx.Strict("TARGET_JAVAC", "${JavacCmd} ${CommonJdkFlags}") 62 ctx.Strict("HOST_JAVAC", "${JavacCmd} ${CommonJdkFlags}") 63 64 ctx.Strict("JLINK", "${JlinkCmd}") 65 ctx.Strict("JMOD", "${JmodCmd}") 66 67 ctx.Strict("SOONG_JAVAC_WRAPPER", "${SoongJavacWrapper}") 68 ctx.Strict("DEXPREOPT_GEN", "${DexpreoptGen}") 69 ctx.Strict("ZIPSYNC", "${ZipSyncCmd}") 70 71 ctx.Strict("JACOCO_CLI_JAR", "${JacocoCLIJar}") 72 ctx.Strict("DEFAULT_JACOCO_EXCLUDE_FILTER", strings.Join(DefaultJacocoExcludeFilter, ",")) 73 74 ctx.Strict("EXTRACT_JAR_PACKAGES", "${ExtractJarPackagesCmd}") 75 76 ctx.Strict("MANIFEST_FIXER", "${ManifestFixerCmd}") 77 78 ctx.Strict("ANDROID_MANIFEST_MERGER", "${ManifestMergerCmd}") 79 80 ctx.Strict("CLASS2GREYLIST", "${Class2Greylist}") 81 ctx.Strict("HIDDENAPI", "${HiddenAPI}") 82 83 ctx.Strict("DEX_FLAGS", "${DexFlags}") 84} 85