2017-06-23 02:20:19 +02:00
|
|
|
// Copyright 2017 Google Inc. All rights reserved.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
package config
|
|
|
|
|
2017-08-08 22:17:59 +02:00
|
|
|
import (
|
2017-11-23 01:19:37 +01:00
|
|
|
"path/filepath"
|
|
|
|
"runtime"
|
2017-08-08 22:17:59 +02:00
|
|
|
"strings"
|
|
|
|
|
|
|
|
_ "github.com/google/blueprint/bootstrap"
|
|
|
|
|
|
|
|
"android/soong/android"
|
2020-04-22 03:36:23 +02:00
|
|
|
"android/soong/remoteexec"
|
2017-08-08 22:17:59 +02:00
|
|
|
)
|
2017-06-23 02:20:19 +02:00
|
|
|
|
|
|
|
var (
|
2022-03-25 17:33:26 +01:00
|
|
|
pctx = android.NewPackageContext("android/soong/java/config")
|
|
|
|
exportedVars = android.NewExportedVariables(pctx)
|
2017-08-08 22:17:59 +02:00
|
|
|
|
2020-07-01 11:48:14 +02:00
|
|
|
LegacyCorePlatformBootclasspathLibraries = []string{"legacy.core.platform.api.stubs", "core-lambda-stubs"}
|
|
|
|
LegacyCorePlatformSystemModules = "legacy-core-platform-api-stubs-system-modules"
|
2020-07-09 19:03:41 +02:00
|
|
|
StableCorePlatformBootclasspathLibraries = []string{"stable.core.platform.api.stubs", "core-lambda-stubs"}
|
|
|
|
StableCorePlatformSystemModules = "stable-core-platform-api-stubs-system-modules"
|
2020-07-01 11:48:14 +02:00
|
|
|
FrameworkLibraries = []string{"ext", "framework"}
|
|
|
|
DefaultLambdaStubsLibrary = "core-lambda-stubs"
|
|
|
|
SdkLambdaStubsPath = "prebuilts/sdk/tools/core-lambda-stubs.jar"
|
2017-11-22 22:49:43 +01:00
|
|
|
|
2020-06-24 22:36:59 +02:00
|
|
|
DefaultMakeJacocoExcludeFilter = []string{"org.junit.*", "org.jacoco.*", "org.mockito.*"}
|
|
|
|
DefaultJacocoExcludeFilter = []string{"org.junit.**", "org.jacoco.**", "org.mockito.**"}
|
2017-11-22 22:49:43 +01:00
|
|
|
|
|
|
|
InstrumentFrameworkModules = []string{
|
|
|
|
"framework",
|
2019-11-08 00:09:15 +01:00
|
|
|
"framework-minus-apex",
|
2017-11-22 22:49:43 +01:00
|
|
|
"telephony-common",
|
|
|
|
"services",
|
|
|
|
"android.car",
|
|
|
|
"android.car7",
|
2019-03-08 15:46:36 +01:00
|
|
|
"conscrypt",
|
2019-08-06 17:57:40 +02:00
|
|
|
"core-icu4j",
|
2017-12-19 16:01:39 +01:00
|
|
|
"core-oj",
|
2018-02-13 16:23:14 +01:00
|
|
|
"core-libart",
|
2017-11-22 22:49:43 +01:00
|
|
|
}
|
2017-06-23 02:20:19 +02:00
|
|
|
)
|
|
|
|
|
2022-03-25 17:33:26 +01:00
|
|
|
var (
|
|
|
|
JavacVmFlags = strings.Join(javacVmFlagsList, " ")
|
|
|
|
javaVmFlagsList = []string{
|
|
|
|
`-XX:OnError="cat hs_err_pid%p.log"`,
|
|
|
|
"-XX:CICompilerCount=6",
|
|
|
|
"-XX:+UseDynamicNumberOfGCThreads",
|
|
|
|
}
|
|
|
|
javacVmFlagsList = []string{
|
|
|
|
`-J-XX:OnError="cat hs_err_pid%p.log"`,
|
|
|
|
"-J-XX:CICompilerCount=6",
|
|
|
|
"-J-XX:+UseDynamicNumberOfGCThreads",
|
|
|
|
"-J-XX:+TieredCompilation",
|
|
|
|
"-J-XX:TieredStopAtLevel=1",
|
|
|
|
}
|
2022-04-22 11:41:36 +02:00
|
|
|
dexerJavaVmFlagsList = []string{
|
|
|
|
`-JXX:OnError="cat hs_err_pid%p.log"`,
|
|
|
|
"-JXX:CICompilerCount=6",
|
|
|
|
"-JXX:+UseDynamicNumberOfGCThreads",
|
|
|
|
}
|
2019-07-11 20:01:22 +02:00
|
|
|
)
|
|
|
|
|
2017-08-08 22:17:59 +02:00
|
|
|
func init() {
|
|
|
|
pctx.Import("github.com/google/blueprint/bootstrap")
|
|
|
|
|
2022-09-14 12:33:58 +02:00
|
|
|
exportedVars.ExportStringStaticVariable("JavacHeapSize", "4096M")
|
2022-03-25 17:33:26 +01:00
|
|
|
exportedVars.ExportStringStaticVariable("JavacHeapFlags", "-J-Xmx${JavacHeapSize}")
|
2022-02-28 22:07:03 +01:00
|
|
|
|
|
|
|
// ErrorProne can use significantly more memory than javac alone, give it a higher heap
|
|
|
|
// size (b/221480398).
|
2022-10-15 00:54:13 +02:00
|
|
|
exportedVars.ExportStringStaticVariable("ErrorProneHeapSize", "8192M")
|
2022-03-25 17:33:26 +01:00
|
|
|
exportedVars.ExportStringStaticVariable("ErrorProneHeapFlags", "-J-Xmx${ErrorProneHeapSize}")
|
2022-02-28 22:07:03 +01:00
|
|
|
|
2022-04-20 22:28:33 +02:00
|
|
|
// D8 invocations are shorter lived, so we restrict their JIT tiering relative to R8.
|
|
|
|
// Note that the `-JXX` prefix syntax is specific to the R8/D8 invocation wrappers.
|
2022-04-22 11:41:36 +02:00
|
|
|
exportedVars.ExportStringListStaticVariable("D8Flags", append([]string{
|
2022-08-08 11:40:15 +02:00
|
|
|
"-JXmx4096M",
|
2022-04-20 22:28:33 +02:00
|
|
|
"-JXX:+TieredCompilation",
|
|
|
|
"-JXX:TieredStopAtLevel=1",
|
2022-04-22 11:41:36 +02:00
|
|
|
}, dexerJavaVmFlagsList...))
|
|
|
|
exportedVars.ExportStringListStaticVariable("R8Flags", append([]string{
|
|
|
|
"-JXmx2048M",
|
2022-05-25 14:00:28 +02:00
|
|
|
// Disable this optimization as it can impact weak reference semantics. See b/233432839.
|
|
|
|
"-JDcom.android.tools.r8.disableEnqueuerDeferredTracing=true",
|
2022-04-22 11:41:36 +02:00
|
|
|
}, dexerJavaVmFlagsList...))
|
2017-08-29 02:23:21 +02:00
|
|
|
|
2022-03-25 17:33:26 +01:00
|
|
|
exportedVars.ExportStringListStaticVariable("CommonJdkFlags", []string{
|
2017-08-08 22:17:59 +02:00
|
|
|
`-Xmaxerrs 9999999`,
|
|
|
|
`-encoding UTF-8`,
|
|
|
|
`-sourcepath ""`,
|
|
|
|
`-g`,
|
2017-09-19 19:52:23 +02:00
|
|
|
// Turbine leaves out bridges which can cause javac to unnecessarily insert them into
|
|
|
|
// subclasses (b/65645120). Setting this flag causes our custom javac to assume that
|
|
|
|
// the missing bridges will exist at runtime and not recreate them in subclasses.
|
|
|
|
// If a different javac is used the flag will be ignored and extra bridges will be inserted.
|
|
|
|
// The flag is implemented by https://android-review.googlesource.com/c/486427
|
|
|
|
`-XDskipDuplicateBridges=true`,
|
2017-08-08 22:17:59 +02:00
|
|
|
|
2017-09-30 02:58:17 +02:00
|
|
|
// b/65004097: prevent using java.lang.invoke.StringConcatFactory when using -target 1.9
|
|
|
|
`-XDstringConcat=inline`,
|
2022-03-25 17:33:26 +01:00
|
|
|
})
|
2019-07-11 20:01:22 +02:00
|
|
|
|
2022-03-25 17:33:26 +01:00
|
|
|
exportedVars.ExportStringListStaticVariable("JavaVmFlags", javaVmFlagsList)
|
|
|
|
exportedVars.ExportStringListStaticVariable("JavacVmFlags", javacVmFlagsList)
|
2017-08-08 22:17:59 +02:00
|
|
|
|
|
|
|
pctx.VariableConfigMethod("hostPrebuiltTag", android.Config.PrebuiltOS)
|
|
|
|
|
2018-03-12 21:24:09 +01:00
|
|
|
pctx.VariableFunc("JavaHome", func(ctx android.PackageVarContext) string {
|
2017-10-30 21:42:06 +01:00
|
|
|
// This is set up and guaranteed by soong_ui
|
2018-03-12 21:24:09 +01:00
|
|
|
return ctx.Config().Getenv("ANDROID_JAVA_HOME")
|
2017-10-06 01:48:56 +02:00
|
|
|
})
|
2019-10-09 18:10:08 +02:00
|
|
|
pctx.VariableFunc("JlinkVersion", func(ctx android.PackageVarContext) string {
|
2019-11-07 19:55:53 +01:00
|
|
|
if override := ctx.Config().Getenv("OVERRIDE_JLINK_VERSION_NUMBER"); override != "" {
|
|
|
|
return override
|
|
|
|
}
|
2022-10-05 10:20:12 +02:00
|
|
|
return "17"
|
2019-10-09 18:10:08 +02:00
|
|
|
})
|
2017-10-06 01:48:56 +02:00
|
|
|
|
2017-08-08 22:17:59 +02:00
|
|
|
pctx.SourcePathVariable("JavaToolchain", "${JavaHome}/bin")
|
|
|
|
pctx.SourcePathVariableWithEnvOverride("JavacCmd",
|
|
|
|
"${JavaToolchain}/javac", "ALTERNATE_JAVAC")
|
|
|
|
pctx.SourcePathVariable("JavaCmd", "${JavaToolchain}/java")
|
|
|
|
pctx.SourcePathVariable("JarCmd", "${JavaToolchain}/jar")
|
2022-10-12 21:57:42 +02:00
|
|
|
pctx.SourcePathVariable("JavadocCmd", "${JavaToolchain}/javadoc")
|
2017-08-31 17:08:39 +02:00
|
|
|
pctx.SourcePathVariable("JlinkCmd", "${JavaToolchain}/jlink")
|
|
|
|
pctx.SourcePathVariable("JmodCmd", "${JavaToolchain}/jmod")
|
2017-09-30 02:58:17 +02:00
|
|
|
pctx.SourcePathVariable("JrtFsJar", "${JavaHome}/lib/jrt-fs.jar")
|
2018-11-06 01:49:08 +01:00
|
|
|
pctx.SourcePathVariable("JavaKytheExtractorJar", "prebuilts/build-tools/common/framework/javac_extractor.jar")
|
2017-10-19 22:06:22 +02:00
|
|
|
pctx.SourcePathVariable("Ziptime", "prebuilts/build-tools/${hostPrebuiltTag}/bin/ziptime")
|
2017-08-08 22:17:59 +02:00
|
|
|
|
2022-09-02 00:20:00 +02:00
|
|
|
pctx.HostBinToolVariable("GenKotlinBuildFileCmd", "gen-kotlin-build-file")
|
2018-02-13 15:32:54 +01:00
|
|
|
|
2017-08-11 02:58:12 +02:00
|
|
|
pctx.SourcePathVariable("JarArgsCmd", "build/soong/scripts/jar-args.sh")
|
2019-04-02 11:29:55 +02:00
|
|
|
pctx.SourcePathVariable("PackageCheckCmd", "build/soong/scripts/package-check.sh")
|
2018-05-02 21:58:28 +02:00
|
|
|
pctx.HostBinToolVariable("ExtractJarPackagesCmd", "extract_jar_packages")
|
2017-10-17 22:56:52 +02:00
|
|
|
pctx.HostBinToolVariable("SoongZipCmd", "soong_zip")
|
|
|
|
pctx.HostBinToolVariable("MergeZipsCmd", "merge_zips")
|
2017-11-22 22:49:43 +01:00
|
|
|
pctx.HostBinToolVariable("Zip2ZipCmd", "zip2zip")
|
2018-03-16 00:24:10 +01:00
|
|
|
pctx.HostBinToolVariable("ZipSyncCmd", "zipsync")
|
2018-05-05 03:49:16 +02:00
|
|
|
pctx.HostBinToolVariable("ApiCheckCmd", "apicheck")
|
2021-11-04 18:25:20 +01:00
|
|
|
pctx.HostBinToolVariable("D8Cmd", "d8")
|
2022-06-20 09:53:04 +02:00
|
|
|
pctx.HostBinToolVariable("R8Cmd", "r8")
|
2022-09-22 10:41:42 +02:00
|
|
|
pctx.HostBinToolVariable("ResourceShrinkerCmd", "resourceshrinker")
|
2019-01-31 23:12:44 +01:00
|
|
|
pctx.HostBinToolVariable("HiddenAPICmd", "hiddenapi")
|
2020-04-23 18:49:59 +02:00
|
|
|
pctx.HostBinToolVariable("ExtractApksCmd", "extract_apks")
|
2018-03-12 21:24:09 +01:00
|
|
|
pctx.VariableFunc("TurbineJar", func(ctx android.PackageVarContext) string {
|
2017-10-25 20:11:37 +02:00
|
|
|
turbine := "turbine.jar"
|
2020-07-07 18:09:23 +02:00
|
|
|
if ctx.Config().AlwaysUsePrebuiltSdks() {
|
2018-03-12 21:24:09 +01:00
|
|
|
return "prebuilts/build-tools/common/framework/" + turbine
|
2017-10-25 20:11:37 +02:00
|
|
|
} else {
|
2019-12-09 22:47:14 +01:00
|
|
|
return ctx.Config().HostJavaToolPath(ctx, turbine).String()
|
2017-10-25 20:11:37 +02:00
|
|
|
}
|
|
|
|
})
|
2017-10-18 03:50:50 +02:00
|
|
|
|
2017-08-08 22:17:59 +02:00
|
|
|
pctx.HostJavaToolVariable("JarjarCmd", "jarjar.jar")
|
2018-01-11 01:06:12 +01:00
|
|
|
pctx.HostJavaToolVariable("JsilverJar", "jsilver.jar")
|
|
|
|
pctx.HostJavaToolVariable("DoclavaJar", "doclava.jar")
|
2018-04-20 03:03:39 +02:00
|
|
|
pctx.HostJavaToolVariable("MetalavaJar", "metalava.jar")
|
2018-08-10 00:33:27 +02:00
|
|
|
pctx.HostJavaToolVariable("DokkaJar", "dokka.jar")
|
2018-08-28 03:31:46 +02:00
|
|
|
pctx.HostJavaToolVariable("JetifierJar", "jetifier.jar")
|
2022-06-20 09:53:04 +02:00
|
|
|
pctx.HostJavaToolVariable("R8Jar", "r8.jar")
|
2020-04-22 03:36:23 +02:00
|
|
|
pctx.HostJavaToolVariable("D8Jar", "d8.jar")
|
2017-08-08 22:17:59 +02:00
|
|
|
|
2017-10-17 22:56:52 +02:00
|
|
|
pctx.HostBinToolVariable("SoongJavacWrapper", "soong_javac_wrapper")
|
2018-11-12 19:13:39 +01:00
|
|
|
pctx.HostBinToolVariable("DexpreoptGen", "dexpreopt_gen")
|
2017-10-17 22:56:52 +02:00
|
|
|
|
2021-03-12 20:28:25 +01:00
|
|
|
pctx.StaticVariableWithEnvOverride("REJavaPool", "RBE_JAVA_POOL", "java16")
|
|
|
|
pctx.StaticVariableWithEnvOverride("REJavacExecStrategy", "RBE_JAVAC_EXEC_STRATEGY", remoteexec.RemoteLocalFallbackExecStrategy)
|
|
|
|
pctx.StaticVariableWithEnvOverride("RED8ExecStrategy", "RBE_D8_EXEC_STRATEGY", remoteexec.RemoteLocalFallbackExecStrategy)
|
|
|
|
pctx.StaticVariableWithEnvOverride("RER8ExecStrategy", "RBE_R8_EXEC_STRATEGY", remoteexec.RemoteLocalFallbackExecStrategy)
|
|
|
|
pctx.StaticVariableWithEnvOverride("RETurbineExecStrategy", "RBE_TURBINE_EXEC_STRATEGY", remoteexec.LocalExecStrategy)
|
|
|
|
pctx.StaticVariableWithEnvOverride("RESignApkExecStrategy", "RBE_SIGNAPK_EXEC_STRATEGY", remoteexec.LocalExecStrategy)
|
|
|
|
pctx.StaticVariableWithEnvOverride("REJarExecStrategy", "RBE_JAR_EXEC_STRATEGY", remoteexec.LocalExecStrategy)
|
|
|
|
pctx.StaticVariableWithEnvOverride("REZipExecStrategy", "RBE_ZIP_EXEC_STRATEGY", remoteexec.LocalExecStrategy)
|
2020-01-27 20:19:44 +01:00
|
|
|
|
2017-11-22 22:49:43 +01:00
|
|
|
pctx.HostJavaToolVariable("JacocoCLIJar", "jacoco-cli.jar")
|
2017-11-23 01:19:37 +01:00
|
|
|
|
2019-05-20 22:14:18 +02:00
|
|
|
pctx.HostBinToolVariable("ManifestCheckCmd", "manifest_check")
|
2019-05-16 22:16:29 +02:00
|
|
|
pctx.HostBinToolVariable("ManifestFixerCmd", "manifest_fixer")
|
2018-05-25 01:11:20 +02:00
|
|
|
|
2019-02-27 07:14:04 +01:00
|
|
|
pctx.HostBinToolVariable("ManifestMergerCmd", "manifest-merger")
|
2018-11-12 19:13:39 +01:00
|
|
|
|
2020-08-12 17:48:23 +02:00
|
|
|
pctx.HostBinToolVariable("Class2NonSdkList", "class2nonsdklist")
|
2019-01-17 00:15:52 +01:00
|
|
|
pctx.HostBinToolVariable("HiddenAPI", "hiddenapi")
|
2019-08-08 21:56:34 +02:00
|
|
|
|
|
|
|
hostBinToolVariableWithSdkToolsPrebuilt("Aapt2Cmd", "aapt2")
|
|
|
|
hostBinToolVariableWithBuildToolsPrebuilt("AidlCmd", "aidl")
|
|
|
|
hostBinToolVariableWithBuildToolsPrebuilt("ZipAlign", "zipalign")
|
|
|
|
|
|
|
|
hostJavaToolVariableWithSdkToolsPrebuilt("SignapkCmd", "signapk")
|
|
|
|
// TODO(ccross): this should come from the signapk dependencies, but we don't have any way
|
|
|
|
// to express host JNI dependencies yet.
|
|
|
|
hostJNIToolVariableWithSdkToolsPrebuilt("SignapkJniLibrary", "libconscrypt_openjdk_jni")
|
|
|
|
}
|
|
|
|
|
2022-03-25 17:33:26 +01:00
|
|
|
func BazelJavaToolchainVars(config android.Config) string {
|
|
|
|
return android.BazelToolchainVars(config, exportedVars)
|
|
|
|
}
|
|
|
|
|
2019-08-08 21:56:34 +02:00
|
|
|
func hostBinToolVariableWithSdkToolsPrebuilt(name, tool string) {
|
|
|
|
pctx.VariableFunc(name, func(ctx android.PackageVarContext) string {
|
2020-05-29 00:28:00 +02:00
|
|
|
if ctx.Config().AlwaysUsePrebuiltSdks() {
|
2019-08-08 21:56:34 +02:00
|
|
|
return filepath.Join("prebuilts/sdk/tools", runtime.GOOS, "bin", tool)
|
|
|
|
} else {
|
2019-12-09 22:47:14 +01:00
|
|
|
return ctx.Config().HostToolPath(ctx, tool).String()
|
2019-08-08 21:56:34 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func hostJavaToolVariableWithSdkToolsPrebuilt(name, tool string) {
|
|
|
|
pctx.VariableFunc(name, func(ctx android.PackageVarContext) string {
|
2020-05-29 00:28:00 +02:00
|
|
|
if ctx.Config().AlwaysUsePrebuiltSdks() {
|
2019-08-08 21:56:34 +02:00
|
|
|
return filepath.Join("prebuilts/sdk/tools/lib", tool+".jar")
|
|
|
|
} else {
|
2019-12-09 22:47:14 +01:00
|
|
|
return ctx.Config().HostJavaToolPath(ctx, tool+".jar").String()
|
2019-08-08 21:56:34 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func hostJNIToolVariableWithSdkToolsPrebuilt(name, tool string) {
|
|
|
|
pctx.VariableFunc(name, func(ctx android.PackageVarContext) string {
|
2020-05-29 00:28:00 +02:00
|
|
|
if ctx.Config().AlwaysUsePrebuiltSdks() {
|
2019-08-08 21:56:34 +02:00
|
|
|
ext := ".so"
|
|
|
|
if runtime.GOOS == "darwin" {
|
|
|
|
ext = ".dylib"
|
|
|
|
}
|
|
|
|
return filepath.Join("prebuilts/sdk/tools", runtime.GOOS, "lib64", tool+ext)
|
|
|
|
} else {
|
2019-12-09 22:47:14 +01:00
|
|
|
return ctx.Config().HostJNIToolPath(ctx, tool).String()
|
2019-08-08 21:56:34 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func hostBinToolVariableWithBuildToolsPrebuilt(name, tool string) {
|
|
|
|
pctx.VariableFunc(name, func(ctx android.PackageVarContext) string {
|
2020-05-29 00:28:00 +02:00
|
|
|
if ctx.Config().AlwaysUsePrebuiltSdks() {
|
2019-08-08 21:56:34 +02:00
|
|
|
return filepath.Join("prebuilts/build-tools", ctx.Config().PrebuiltOS(), "bin", tool)
|
|
|
|
} else {
|
2019-12-09 22:47:14 +01:00
|
|
|
return ctx.Config().HostToolPath(ctx, tool).String()
|
2019-08-08 21:56:34 +02:00
|
|
|
}
|
|
|
|
})
|
2017-08-08 22:17:59 +02:00
|
|
|
}
|
2019-07-11 20:01:22 +02:00
|
|
|
|
|
|
|
// JavaCmd returns a SourcePath object with the path to the java command.
|
|
|
|
func JavaCmd(ctx android.PathContext) android.SourcePath {
|
|
|
|
return javaTool(ctx, "java")
|
|
|
|
}
|
|
|
|
|
|
|
|
// JavadocCmd returns a SourcePath object with the path to the java command.
|
|
|
|
func JavadocCmd(ctx android.PathContext) android.SourcePath {
|
2022-10-12 21:57:42 +02:00
|
|
|
return javaTool(ctx, "javadoc")
|
2019-07-11 20:01:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func javaTool(ctx android.PathContext, tool string) android.SourcePath {
|
|
|
|
type javaToolKey string
|
|
|
|
|
|
|
|
key := android.NewCustomOnceKey(javaToolKey(tool))
|
|
|
|
|
|
|
|
return ctx.Config().OnceSourcePath(key, func() android.SourcePath {
|
|
|
|
return javaToolchain(ctx).Join(ctx, tool)
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var javaToolchainKey = android.NewOnceKey("javaToolchain")
|
|
|
|
|
|
|
|
func javaToolchain(ctx android.PathContext) android.SourcePath {
|
|
|
|
return ctx.Config().OnceSourcePath(javaToolchainKey, func() android.SourcePath {
|
|
|
|
return javaHome(ctx).Join(ctx, "bin")
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
var javaHomeKey = android.NewOnceKey("javaHome")
|
|
|
|
|
|
|
|
func javaHome(ctx android.PathContext) android.SourcePath {
|
|
|
|
return ctx.Config().OnceSourcePath(javaHomeKey, func() android.SourcePath {
|
|
|
|
// This is set up and guaranteed by soong_ui
|
|
|
|
return android.PathForSource(ctx, ctx.Config().Getenv("ANDROID_JAVA_HOME"))
|
|
|
|
})
|
|
|
|
}
|