github.com/westcoastroms/westcoastroms-build@v0.0.0-20190928114312-2350e5a73030/build/soong/java/config/makevars.go (about)

     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, " "))
    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  	if ctx.Config().UseD8Desugar() {
    50  		ctx.Strict("DX", "${D8Cmd}")
    51  		ctx.Strict("DX_COMMAND", "${D8Cmd} -JXms16M -JXmx2048M")
    52  		ctx.Strict("USE_D8_DESUGAR", "true")
    53  	} else {
    54  		ctx.Strict("DX", "${DxCmd}")
    55  		ctx.Strict("DX_COMMAND", "${DxCmd} -JXms16M -JXmx2048M")
    56  		ctx.Strict("USE_D8_DESUGAR", "false")
    57  	}
    58  	ctx.Strict("R8_COMPAT_PROGUARD", "${R8Cmd}")
    59  
    60  	ctx.Strict("TURBINE", "${TurbineJar}")
    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  	}
    69  
    70  	if ctx.Config().UseOpenJDK9() {
    71  		ctx.Strict("JLINK", "${JlinkCmd}")
    72  		ctx.Strict("JMOD", "${JmodCmd}")
    73  	}
    74  
    75  	ctx.Strict("SOONG_JAVAC_WRAPPER", "${SoongJavacWrapper}")
    76  	ctx.Strict("ZIPSYNC", "${ZipSyncCmd}")
    77  
    78  	ctx.Strict("JACOCO_CLI_JAR", "${JacocoCLIJar}")
    79  	ctx.Strict("DEFAULT_JACOCO_EXCLUDE_FILTER", strings.Join(DefaultJacocoExcludeFilter, ","))
    80  
    81  	ctx.Strict("EXTRACT_JAR_PACKAGES", "${ExtractJarPackagesCmd}")
    82  }