Merge "apex respects stem of java_library modules" am: 00f5701ade
Change-Id: I6b6ebf0dbfe5c0ff6a63339bc1c8180b1aa89fcd
This commit is contained in:
15
apex/apex.go
15
apex/apex.go
@@ -1144,6 +1144,7 @@ func (class apexFileClass) NameInMake() string {
|
|||||||
// apexFile represents a file in an APEX bundle
|
// apexFile represents a file in an APEX bundle
|
||||||
type apexFile struct {
|
type apexFile struct {
|
||||||
builtFile android.Path
|
builtFile android.Path
|
||||||
|
stem string
|
||||||
moduleName string
|
moduleName string
|
||||||
installDir string
|
installDir string
|
||||||
class apexFileClass
|
class apexFileClass
|
||||||
@@ -1192,7 +1193,11 @@ func (af *apexFile) apexRelativePath(path string) string {
|
|||||||
|
|
||||||
// Path() returns path of this apex file relative to the APEX root
|
// Path() returns path of this apex file relative to the APEX root
|
||||||
func (af *apexFile) Path() string {
|
func (af *apexFile) Path() string {
|
||||||
return af.apexRelativePath(af.builtFile.Base())
|
stem := af.builtFile.Base()
|
||||||
|
if af.stem != "" {
|
||||||
|
stem = af.stem
|
||||||
|
}
|
||||||
|
return af.apexRelativePath(stem)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SymlinkPaths() returns paths of the symlinks (if any) relative to the APEX root
|
// SymlinkPaths() returns paths of the symlinks (if any) relative to the APEX root
|
||||||
@@ -1639,11 +1644,17 @@ func apexFileForShBinary(ctx android.BaseModuleContext, sh *android.ShBinary) ap
|
|||||||
return af
|
return af
|
||||||
}
|
}
|
||||||
|
|
||||||
func apexFileForJavaLibrary(ctx android.BaseModuleContext, lib java.Dependency, module android.Module) apexFile {
|
type javaDependency interface {
|
||||||
|
java.Dependency
|
||||||
|
Stem() string
|
||||||
|
}
|
||||||
|
|
||||||
|
func apexFileForJavaLibrary(ctx android.BaseModuleContext, lib javaDependency, module android.Module) apexFile {
|
||||||
dirInApex := "javalib"
|
dirInApex := "javalib"
|
||||||
fileToCopy := lib.DexJar()
|
fileToCopy := lib.DexJar()
|
||||||
af := newApexFile(ctx, fileToCopy, module.Name(), dirInApex, javaSharedLib, module)
|
af := newApexFile(ctx, fileToCopy, module.Name(), dirInApex, javaSharedLib, module)
|
||||||
af.jacocoReportClassesFile = lib.JacocoReportClassesFile()
|
af.jacocoReportClassesFile = lib.JacocoReportClassesFile()
|
||||||
|
af.stem = lib.Stem() + ".jar"
|
||||||
return af
|
return af
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -424,6 +424,7 @@ func TestBasicApex(t *testing.T) {
|
|||||||
java_library {
|
java_library {
|
||||||
name: "myjar",
|
name: "myjar",
|
||||||
srcs: ["foo/bar/MyClass.java"],
|
srcs: ["foo/bar/MyClass.java"],
|
||||||
|
stem: "myjar_stem",
|
||||||
sdk_version: "none",
|
sdk_version: "none",
|
||||||
system_modules: "none",
|
system_modules: "none",
|
||||||
static_libs: ["myotherjar"],
|
static_libs: ["myotherjar"],
|
||||||
@@ -478,7 +479,7 @@ func TestBasicApex(t *testing.T) {
|
|||||||
// Ensure that both direct and indirect deps are copied into apex
|
// Ensure that both direct and indirect deps are copied into apex
|
||||||
ensureContains(t, copyCmds, "image.apex/lib64/mylib.so")
|
ensureContains(t, copyCmds, "image.apex/lib64/mylib.so")
|
||||||
ensureContains(t, copyCmds, "image.apex/lib64/mylib2.so")
|
ensureContains(t, copyCmds, "image.apex/lib64/mylib2.so")
|
||||||
ensureContains(t, copyCmds, "image.apex/javalib/myjar.jar")
|
ensureContains(t, copyCmds, "image.apex/javalib/myjar_stem.jar")
|
||||||
// .. but not for java libs
|
// .. but not for java libs
|
||||||
ensureNotContains(t, copyCmds, "image.apex/javalib/myotherjar.jar")
|
ensureNotContains(t, copyCmds, "image.apex/javalib/myotherjar.jar")
|
||||||
ensureNotContains(t, copyCmds, "image.apex/javalib/msharedjar.jar")
|
ensureNotContains(t, copyCmds, "image.apex/javalib/msharedjar.jar")
|
||||||
|
@@ -1878,7 +1878,7 @@ func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
extraInstallDeps = j.InstallMixin(ctx, j.outputFile)
|
extraInstallDeps = j.InstallMixin(ctx, j.outputFile)
|
||||||
}
|
}
|
||||||
j.installFile = ctx.InstallFile(android.PathForModuleInstall(ctx, "framework"),
|
j.installFile = ctx.InstallFile(android.PathForModuleInstall(ctx, "framework"),
|
||||||
ctx.ModuleName()+".jar", j.outputFile, extraInstallDeps...)
|
j.Stem()+".jar", j.outputFile, extraInstallDeps...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify Dist.Tag is set to a supported output
|
// Verify Dist.Tag is set to a supported output
|
||||||
@@ -2728,7 +2728,7 @@ func (j *DexImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
j.maybeStrippedDexJarFile = dexOutputFile
|
j.maybeStrippedDexJarFile = dexOutputFile
|
||||||
|
|
||||||
ctx.InstallFile(android.PathForModuleInstall(ctx, "framework"),
|
ctx.InstallFile(android.PathForModuleInstall(ctx, "framework"),
|
||||||
ctx.ModuleName()+".jar", dexOutputFile)
|
j.Stem()+".jar", dexOutputFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (j *DexImport) DexJar() android.Path {
|
func (j *DexImport) DexJar() android.Path {
|
||||||
|
Reference in New Issue
Block a user