Merge changes from topic "soong-java-install"
* changes: Revert "Temporarily add method to get java binary tool" Move java module installation into Soong Fix ctx.InstallFile calls for java modules Make HostJavaToolPath use pathForInstall
This commit is contained in:
@@ -592,12 +592,11 @@ func (c *config) HostJNIToolPath(ctx PathContext, lib string) Path {
|
|||||||
return path
|
return path
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *config) HostJavaToolPath(ctx PathContext, path string) Path {
|
func (c *config) HostJavaToolPath(ctx PathContext, tool string) Path {
|
||||||
return PathForOutput(ctx, "host", c.PrebuiltOS(), "framework", path)
|
path := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "framework", false, tool)
|
||||||
}
|
if ctx.Config().KatiEnabled() {
|
||||||
|
path = path.ToMakePath()
|
||||||
func (c *config) HostJavaBinToolPath(ctx PathContext, tool string) Path {
|
}
|
||||||
path := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "bin", false, tool)
|
|
||||||
return path
|
return path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -177,16 +177,6 @@ func (p PackageContext) HostBinToolVariable(name, path string) blueprint.Variabl
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// HostJavaBinToolVariable returns a Variable whose value is the path to a host java tool
|
|
||||||
// in the bin directory for host java targets. It may only be called during a Go
|
|
||||||
// package's initialization - either from the init() function or as part of a
|
|
||||||
// package-scoped variable's initialization.
|
|
||||||
func (p PackageContext) HostJavaBinToolVariable(name, path string) blueprint.Variable {
|
|
||||||
return p.VariableFunc(name, func(ctx PackageVarContext) string {
|
|
||||||
return ctx.Config().HostJavaBinToolPath(ctx, path).String()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// HostJNIToolVariable returns a Variable whose value is the path to a host tool
|
// HostJNIToolVariable returns a Variable whose value is the path to a host tool
|
||||||
// in the lib directory for host targets. It may only be called during a Go
|
// in the lib directory for host targets. It may only be called during a Go
|
||||||
// package's initialization - either from the init() function or as part of a
|
// package's initialization - either from the init() function or as part of a
|
||||||
|
@@ -1661,6 +1661,12 @@ func PathForModuleInstall(ctx ModuleInstallPathContext, pathComponents ...string
|
|||||||
return makePathForInstall(ctx, os, arch, partition, ctx.Debug(), pathComponents...)
|
return makePathForInstall(ctx, os, arch, partition, ctx.Debug(), pathComponents...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PathForHostDexInstall returns an InstallPath representing the install path for the
|
||||||
|
// module appended with paths...
|
||||||
|
func PathForHostDexInstall(ctx ModuleInstallPathContext, pathComponents ...string) InstallPath {
|
||||||
|
return makePathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "", ctx.Debug(), pathComponents...)
|
||||||
|
}
|
||||||
|
|
||||||
// PathForModuleInPartitionInstall is similar to PathForModuleInstall but partition is provided by the caller
|
// PathForModuleInPartitionInstall is similar to PathForModuleInstall but partition is provided by the caller
|
||||||
func PathForModuleInPartitionInstall(ctx ModuleInstallPathContext, partition string, pathComponents ...string) InstallPath {
|
func PathForModuleInPartitionInstall(ctx ModuleInstallPathContext, partition string, pathComponents ...string) InstallPath {
|
||||||
os, arch := osAndArch(ctx)
|
os, arch := osAndArch(ctx)
|
||||||
|
@@ -285,11 +285,6 @@ func (binary *Binary) AndroidMkEntries() []android.AndroidMkEntries {
|
|||||||
}}
|
}}
|
||||||
} else {
|
} else {
|
||||||
outputFile := binary.wrapperFile
|
outputFile := binary.wrapperFile
|
||||||
// Have Make installation trigger Soong installation by using Soong's install path as
|
|
||||||
// the output file.
|
|
||||||
if binary.Host() {
|
|
||||||
outputFile = binary.binaryFile
|
|
||||||
}
|
|
||||||
|
|
||||||
return []android.AndroidMkEntries{android.AndroidMkEntries{
|
return []android.AndroidMkEntries{android.AndroidMkEntries{
|
||||||
Class: "EXECUTABLES",
|
Class: "EXECUTABLES",
|
||||||
|
@@ -721,10 +721,12 @@ func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
|
|
||||||
// Install the app package.
|
// Install the app package.
|
||||||
if (Bool(a.Module.properties.Installable) || ctx.Host()) && apexInfo.IsForPlatform() {
|
if (Bool(a.Module.properties.Installable) || ctx.Host()) && apexInfo.IsForPlatform() {
|
||||||
ctx.InstallFile(a.installDir, a.outputFile.Base(), a.outputFile)
|
var extraInstalledPaths android.Paths
|
||||||
for _, extra := range a.extraOutputFiles {
|
for _, extra := range a.extraOutputFiles {
|
||||||
ctx.InstallFile(a.installDir, extra.Base(), extra)
|
installed := ctx.InstallFile(a.installDir, extra.Base(), extra)
|
||||||
|
extraInstalledPaths = append(extraInstalledPaths, installed)
|
||||||
}
|
}
|
||||||
|
ctx.InstallFile(a.installDir, a.outputFile.Base(), a.outputFile, extraInstalledPaths...)
|
||||||
}
|
}
|
||||||
|
|
||||||
a.buildAppDependencyInfo(ctx)
|
a.buildAppDependencyInfo(ctx)
|
||||||
|
@@ -108,6 +108,8 @@ func (a *AndroidAppImport) IsInstallable() bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *AndroidAppImport) InstallBypassMake() bool { return true }
|
||||||
|
|
||||||
// Updates properties with variant-specific values.
|
// Updates properties with variant-specific values.
|
||||||
func (a *AndroidAppImport) processVariants(ctx android.LoadHookContext) {
|
func (a *AndroidAppImport) processVariants(ctx android.LoadHookContext) {
|
||||||
config := ctx.Config()
|
config := ctx.Config()
|
||||||
|
@@ -124,8 +124,8 @@ func init() {
|
|||||||
pctx.HostBinToolVariable("Zip2ZipCmd", "zip2zip")
|
pctx.HostBinToolVariable("Zip2ZipCmd", "zip2zip")
|
||||||
pctx.HostBinToolVariable("ZipSyncCmd", "zipsync")
|
pctx.HostBinToolVariable("ZipSyncCmd", "zipsync")
|
||||||
pctx.HostBinToolVariable("ApiCheckCmd", "apicheck")
|
pctx.HostBinToolVariable("ApiCheckCmd", "apicheck")
|
||||||
pctx.HostJavaBinToolVariable("D8Cmd", "d8")
|
pctx.HostBinToolVariable("D8Cmd", "d8")
|
||||||
pctx.HostJavaBinToolVariable("R8Cmd", "r8-compat-proguard")
|
pctx.HostBinToolVariable("R8Cmd", "r8-compat-proguard")
|
||||||
pctx.HostBinToolVariable("HiddenAPICmd", "hiddenapi")
|
pctx.HostBinToolVariable("HiddenAPICmd", "hiddenapi")
|
||||||
pctx.HostBinToolVariable("ExtractApksCmd", "extract_apks")
|
pctx.HostBinToolVariable("ExtractApksCmd", "extract_apks")
|
||||||
pctx.VariableFunc("TurbineJar", func(ctx android.PackageVarContext) string {
|
pctx.VariableFunc("TurbineJar", func(ctx android.PackageVarContext) string {
|
||||||
|
@@ -335,17 +335,19 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Wr
|
|||||||
|
|
||||||
dexpreoptRule.Build("dexpreopt", "dexpreopt")
|
dexpreoptRule.Build("dexpreopt", "dexpreopt")
|
||||||
|
|
||||||
if global.ApexSystemServerJars.ContainsJar(moduleName(ctx)) {
|
for _, install := range dexpreoptRule.Installs() {
|
||||||
// APEX variants of java libraries are hidden from Make, so their dexpreopt outputs need special
|
// Remove the "/" prefix because the path should be relative to $ANDROID_PRODUCT_OUT.
|
||||||
// handling. Currently, for APEX variants of java libraries, only those in the system server
|
installDir := strings.TrimPrefix(filepath.Dir(install.To), "/")
|
||||||
// classpath are handled here. Preopting of boot classpath jars in the ART APEX are handled in
|
installBase := filepath.Base(install.To)
|
||||||
// java/dexpreopt_bootjars.go, and other APEX jars are not preopted.
|
arch := filepath.Base(installDir)
|
||||||
for _, install := range dexpreoptRule.Installs() {
|
installPath := android.PathForModuleInPartitionInstall(ctx, "", installDir)
|
||||||
// Remove the "/" prefix because the path should be relative to $ANDROID_PRODUCT_OUT.
|
|
||||||
installDir := strings.TrimPrefix(filepath.Dir(install.To), "/")
|
if global.ApexSystemServerJars.ContainsJar(moduleName(ctx)) {
|
||||||
installBase := filepath.Base(install.To)
|
// APEX variants of java libraries are hidden from Make, so their dexpreopt
|
||||||
arch := filepath.Base(installDir)
|
// outputs need special handling. Currently, for APEX variants of java
|
||||||
installPath := android.PathForModuleInPartitionInstall(ctx, "", installDir)
|
// libraries, only those in the system server classpath are handled here.
|
||||||
|
// Preopting of boot classpath jars in the ART APEX are handled in
|
||||||
|
// java/dexpreopt_bootjars.go, and other APEX jars are not preopted.
|
||||||
// The installs will be handled by Make as sub-modules of the java library.
|
// The installs will be handled by Make as sub-modules of the java library.
|
||||||
d.builtInstalledForApex = append(d.builtInstalledForApex, dexpreopterInstall{
|
d.builtInstalledForApex = append(d.builtInstalledForApex, dexpreopterInstall{
|
||||||
name: arch + "-" + installBase,
|
name: arch + "-" + installBase,
|
||||||
@@ -354,10 +356,12 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Wr
|
|||||||
installDirOnDevice: installPath,
|
installDirOnDevice: installPath,
|
||||||
installFileOnDevice: installBase,
|
installFileOnDevice: installBase,
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
ctx.InstallFile(installPath, installBase, install.From)
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
// The installs will be handled by Make as LOCAL_SOONG_BUILT_INSTALLED of the java library
|
|
||||||
// module.
|
if !global.ApexSystemServerJars.ContainsJar(moduleName(ctx)) {
|
||||||
d.builtInstalled = dexpreoptRule.Installs().String()
|
d.builtInstalled = dexpreoptRule.Installs().String()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -769,8 +769,8 @@ func (d *Droiddoc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
|
|
||||||
d.Javadoc.docZip = android.PathForModuleOut(ctx, ctx.ModuleName()+"-"+"docs.zip")
|
d.Javadoc.docZip = android.PathForModuleOut(ctx, ctx.ModuleName()+"-"+"docs.zip")
|
||||||
|
|
||||||
jsilver := android.PathForOutput(ctx, "host", ctx.Config().PrebuiltOS(), "framework", "jsilver.jar")
|
jsilver := ctx.Config().HostJavaToolPath(ctx, "jsilver.jar")
|
||||||
doclava := android.PathForOutput(ctx, "host", ctx.Config().PrebuiltOS(), "framework", "doclava.jar")
|
doclava := ctx.Config().HostJavaToolPath(ctx, "doclava.jar")
|
||||||
|
|
||||||
outDir := android.PathForModuleOut(ctx, "out")
|
outDir := android.PathForModuleOut(ctx, "out")
|
||||||
srcJarDir := android.PathForModuleOut(ctx, "srcjars")
|
srcJarDir := android.PathForModuleOut(ctx, "srcjars")
|
||||||
|
47
java/java.go
47
java/java.go
@@ -265,6 +265,8 @@ func (j *Module) XrefJavaFiles() android.Paths {
|
|||||||
return j.kytheFiles
|
return j.kytheFiles
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (j *Module) InstallBypassMake() bool { return true }
|
||||||
|
|
||||||
type dependencyTag struct {
|
type dependencyTag struct {
|
||||||
blueprint.BaseDependencyTag
|
blueprint.BaseDependencyTag
|
||||||
name string
|
name string
|
||||||
@@ -567,8 +569,22 @@ func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
if j.InstallMixin != nil {
|
if j.InstallMixin != nil {
|
||||||
extraInstallDeps = j.InstallMixin(ctx, j.outputFile)
|
extraInstallDeps = j.InstallMixin(ctx, j.outputFile)
|
||||||
}
|
}
|
||||||
j.installFile = ctx.InstallFile(android.PathForModuleInstall(ctx, "framework"),
|
hostDexNeeded := Bool(j.deviceProperties.Hostdex) && !ctx.Host()
|
||||||
j.Stem()+".jar", j.outputFile, extraInstallDeps...)
|
if hostDexNeeded {
|
||||||
|
ctx.InstallFile(android.PathForHostDexInstall(ctx, "framework"),
|
||||||
|
j.Stem()+"-hostdex.jar", j.outputFile)
|
||||||
|
}
|
||||||
|
var installDir android.InstallPath
|
||||||
|
if ctx.InstallInTestcases() {
|
||||||
|
var archDir string
|
||||||
|
if !ctx.Host() {
|
||||||
|
archDir = ctx.DeviceConfig().DeviceArch()
|
||||||
|
}
|
||||||
|
installDir = android.PathForModuleInstall(ctx, ctx.ModuleName(), archDir)
|
||||||
|
} else {
|
||||||
|
installDir = android.PathForModuleInstall(ctx, "framework")
|
||||||
|
}
|
||||||
|
j.installFile = ctx.InstallFile(installDir, j.Stem()+".jar", j.outputFile, extraInstallDeps...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -842,6 +858,20 @@ type JavaTestImport struct {
|
|||||||
dexJarFile android.Path
|
dexJarFile android.Path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (j *Test) InstallInTestcases() bool {
|
||||||
|
// Host java tests install into $(HOST_OUT_JAVA_LIBRARIES), and then are copied into
|
||||||
|
// testcases by base_rules.mk.
|
||||||
|
return !j.Host()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (j *TestHelperLibrary) InstallInTestcases() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (j *JavaTestImport) InstallInTestcases() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
func (j *TestHost) DepsMutator(ctx android.BottomUpMutatorContext) {
|
func (j *TestHost) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||||
if len(j.testHostProperties.Data_native_bins) > 0 {
|
if len(j.testHostProperties.Data_native_bins) > 0 {
|
||||||
for _, target := range ctx.MultiTargets() {
|
for _, target := range ctx.MultiTargets() {
|
||||||
@@ -1376,8 +1406,17 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if Bool(j.properties.Installable) {
|
if Bool(j.properties.Installable) {
|
||||||
ctx.InstallFile(android.PathForModuleInstall(ctx, "framework"),
|
var installDir android.InstallPath
|
||||||
jarName, outputFile)
|
if ctx.InstallInTestcases() {
|
||||||
|
var archDir string
|
||||||
|
if !ctx.Host() {
|
||||||
|
archDir = ctx.DeviceConfig().DeviceArch()
|
||||||
|
}
|
||||||
|
installDir = android.PathForModuleInstall(ctx, ctx.ModuleName(), archDir)
|
||||||
|
} else {
|
||||||
|
installDir = android.PathForModuleInstall(ctx, "framework")
|
||||||
|
}
|
||||||
|
ctx.InstallFile(installDir, jarName, outputFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
j.exportAidlIncludeDirs = android.PathsForModuleSrc(ctx, j.properties.Aidl.Export_include_dirs)
|
j.exportAidlIncludeDirs = android.PathsForModuleSrc(ctx, j.properties.Aidl.Export_include_dirs)
|
||||||
|
Reference in New Issue
Block a user