Merge "Use prebuilts for more tools in unbundled builds"
This commit is contained in:
commit
6617b6d624
4 changed files with 71 additions and 38 deletions
|
@ -31,31 +31,13 @@ import (
|
|||
var (
|
||||
Signapk = pctx.AndroidStaticRule("signapk",
|
||||
blueprint.RuleParams{
|
||||
Command: `${config.JavaCmd} ${config.JavaVmFlags} -Djava.library.path=$$(dirname $signapkJniLibrary) ` +
|
||||
`-jar $signapkCmd $flags $certificates $in $out`,
|
||||
CommandDeps: []string{"$signapkCmd", "$signapkJniLibrary"},
|
||||
Command: `${config.JavaCmd} ${config.JavaVmFlags} -Djava.library.path=$$(dirname ${config.SignapkJniLibrary}) ` +
|
||||
`-jar ${config.SignapkCmd} $flags $certificates $in $out`,
|
||||
CommandDeps: []string{"${config.SignapkCmd}", "${config.SignapkJniLibrary}"},
|
||||
},
|
||||
"flags", "certificates")
|
||||
|
||||
androidManifestMerger = pctx.AndroidStaticRule("androidManifestMerger",
|
||||
blueprint.RuleParams{
|
||||
Command: "java -classpath $androidManifestMergerCmd com.android.manifmerger.Main merge " +
|
||||
"--main $in --libs $libsManifests --out $out",
|
||||
CommandDeps: []string{"$androidManifestMergerCmd"},
|
||||
Description: "merge manifest files",
|
||||
},
|
||||
"libsManifests")
|
||||
)
|
||||
|
||||
func init() {
|
||||
pctx.SourcePathVariable("androidManifestMergerCmd", "prebuilts/devtools/tools/lib/manifest-merger.jar")
|
||||
pctx.HostBinToolVariable("aaptCmd", "aapt")
|
||||
pctx.HostJavaToolVariable("signapkCmd", "signapk.jar")
|
||||
// TODO(ccross): this should come from the signapk dependencies, but we don't have any way
|
||||
// to express host JNI dependencies yet.
|
||||
pctx.HostJNIToolVariable("signapkJniLibrary", "libconscrypt_openjdk_jni")
|
||||
}
|
||||
|
||||
var combineApk = pctx.AndroidStaticRule("combineApk",
|
||||
blueprint.RuleParams{
|
||||
Command: `${config.MergeZipsCmd} $out $in`,
|
||||
|
|
|
@ -141,27 +141,66 @@ func init() {
|
|||
|
||||
pctx.HostJavaToolVariable("JacocoCLIJar", "jacoco-cli.jar")
|
||||
|
||||
hostBinToolVariableWithPrebuilt := func(name, prebuiltDir, tool string) {
|
||||
pctx.VariableFunc(name, func(ctx android.PackageVarContext) string {
|
||||
if ctx.Config().UnbundledBuild() || ctx.Config().IsPdkBuild() {
|
||||
return filepath.Join(prebuiltDir, runtime.GOOS, "bin", tool)
|
||||
} else {
|
||||
return pctx.HostBinToolPath(ctx, tool).String()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
hostBinToolVariableWithPrebuilt("Aapt2Cmd", "prebuilts/sdk/tools", "aapt2")
|
||||
|
||||
pctx.HostBinToolVariable("ManifestCheckCmd", "manifest_check")
|
||||
pctx.HostBinToolVariable("ManifestFixerCmd", "manifest_fixer")
|
||||
|
||||
pctx.HostBinToolVariable("ManifestMergerCmd", "manifest-merger")
|
||||
|
||||
pctx.HostBinToolVariable("ZipAlign", "zipalign")
|
||||
|
||||
pctx.HostBinToolVariable("Class2Greylist", "class2greylist")
|
||||
pctx.HostBinToolVariable("HiddenAPI", "hiddenapi")
|
||||
|
||||
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")
|
||||
}
|
||||
|
||||
func hostBinToolVariableWithSdkToolsPrebuilt(name, tool string) {
|
||||
pctx.VariableFunc(name, func(ctx android.PackageVarContext) string {
|
||||
if ctx.Config().UnbundledBuild() || ctx.Config().IsPdkBuild() {
|
||||
return filepath.Join("prebuilts/sdk/tools", runtime.GOOS, "bin", tool)
|
||||
} else {
|
||||
return pctx.HostBinToolPath(ctx, tool).String()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func hostJavaToolVariableWithSdkToolsPrebuilt(name, tool string) {
|
||||
pctx.VariableFunc(name, func(ctx android.PackageVarContext) string {
|
||||
if ctx.Config().UnbundledBuild() || ctx.Config().IsPdkBuild() {
|
||||
return filepath.Join("prebuilts/sdk/tools/lib", tool+".jar")
|
||||
} else {
|
||||
return pctx.HostJavaToolPath(ctx, tool+".jar").String()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func hostJNIToolVariableWithSdkToolsPrebuilt(name, tool string) {
|
||||
pctx.VariableFunc(name, func(ctx android.PackageVarContext) string {
|
||||
if ctx.Config().UnbundledBuild() || ctx.Config().IsPdkBuild() {
|
||||
ext := ".so"
|
||||
if runtime.GOOS == "darwin" {
|
||||
ext = ".dylib"
|
||||
}
|
||||
return filepath.Join("prebuilts/sdk/tools", runtime.GOOS, "lib64", tool+ext)
|
||||
} else {
|
||||
return pctx.HostJNIToolPath(ctx, tool).String()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func hostBinToolVariableWithBuildToolsPrebuilt(name, tool string) {
|
||||
pctx.VariableFunc(name, func(ctx android.PackageVarContext) string {
|
||||
if ctx.Config().UnbundledBuild() || ctx.Config().IsPdkBuild() {
|
||||
return filepath.Join("prebuilts/build-tools", ctx.Config().PrebuiltOS(), "bin", tool)
|
||||
} else {
|
||||
return pctx.HostBinToolPath(ctx, tool).String()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// JavaCmd returns a SourcePath object with the path to the java command.
|
||||
|
|
|
@ -82,4 +82,17 @@ func makeVarsProvider(ctx android.MakeVarsContext) {
|
|||
ctx.Strict("HIDDENAPI", "${HiddenAPI}")
|
||||
|
||||
ctx.Strict("DEX_FLAGS", "${DexFlags}")
|
||||
|
||||
ctx.Strict("AIDL", "${AidlCmd}")
|
||||
ctx.Strict("AAPT2", "${Aapt2Cmd}")
|
||||
ctx.Strict("ZIPALIGN", "${ZipAlign}")
|
||||
ctx.Strict("SIGNAPK_JAR", "${SignapkCmd}")
|
||||
ctx.Strict("SIGNAPK_JNI_LIBRARY_PATH", "${SignapkJniLibrary}")
|
||||
|
||||
ctx.Strict("SOONG_ZIP", "${SoongZipCmd}")
|
||||
ctx.Strict("MERGE_ZIPS", "${MergeZipsCmd}")
|
||||
ctx.Strict("ZIP2ZIP", "${Zip2ZipCmd}")
|
||||
|
||||
ctx.Strict("ZIPTIME", "${Ziptime}")
|
||||
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
pctx.HostBinToolVariable("aidlCmd", "aidl")
|
||||
pctx.HostBinToolVariable("syspropCmd", "sysprop_java")
|
||||
pctx.SourcePathVariable("logtagsCmd", "build/make/tools/java-event-log-tags.py")
|
||||
pctx.SourcePathVariable("mergeLogtagsCmd", "build/make/tools/merge-event-log-tags.py")
|
||||
|
@ -33,8 +32,8 @@ func init() {
|
|||
var (
|
||||
aidl = pctx.AndroidStaticRule("aidl",
|
||||
blueprint.RuleParams{
|
||||
Command: "$aidlCmd -d$depFile $aidlFlags $in $out",
|
||||
CommandDeps: []string{"$aidlCmd"},
|
||||
Command: "${config.AidlCmd} -d$depFile $aidlFlags $in $out",
|
||||
CommandDeps: []string{"${config.AidlCmd}"},
|
||||
},
|
||||
"depFile", "aidlFlags")
|
||||
|
||||
|
|
Loading…
Reference in a new issue