Merge "Use Stem where output file name is expected in APEX" am: 0e666433cd
am: 611703096e
Change-Id: I94d8f5541deea86310ad3b249b670c61623f3b96
This commit is contained in:
commit
7a12fd11ee
|
@ -183,7 +183,7 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, mo
|
||||||
// soong_java_prebuilt.mk sets LOCAL_MODULE_SUFFIX := .jar Therefore
|
// soong_java_prebuilt.mk sets LOCAL_MODULE_SUFFIX := .jar Therefore
|
||||||
// we need to remove the suffix from LOCAL_MODULE_STEM, otherwise
|
// we need to remove the suffix from LOCAL_MODULE_STEM, otherwise
|
||||||
// we will have foo.jar.jar
|
// we will have foo.jar.jar
|
||||||
fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", strings.TrimSuffix(fi.builtFile.Base(), ".jar"))
|
fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", strings.TrimSuffix(fi.Stem(), ".jar"))
|
||||||
fmt.Fprintln(w, "LOCAL_SOONG_CLASSES_JAR :=", javaModule.ImplementationAndResourcesJars()[0].String())
|
fmt.Fprintln(w, "LOCAL_SOONG_CLASSES_JAR :=", javaModule.ImplementationAndResourcesJars()[0].String())
|
||||||
fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", javaModule.HeaderJars()[0].String())
|
fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", javaModule.HeaderJars()[0].String())
|
||||||
fmt.Fprintln(w, "LOCAL_SOONG_DEX_JAR :=", fi.builtFile.String())
|
fmt.Fprintln(w, "LOCAL_SOONG_DEX_JAR :=", fi.builtFile.String())
|
||||||
|
@ -194,13 +194,13 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, mo
|
||||||
// soong_app_prebuilt.mk sets LOCAL_MODULE_SUFFIX := .apk Therefore
|
// soong_app_prebuilt.mk sets LOCAL_MODULE_SUFFIX := .apk Therefore
|
||||||
// we need to remove the suffix from LOCAL_MODULE_STEM, otherwise
|
// we need to remove the suffix from LOCAL_MODULE_STEM, otherwise
|
||||||
// we will have foo.apk.apk
|
// we will have foo.apk.apk
|
||||||
fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", strings.TrimSuffix(fi.builtFile.Base(), ".apk"))
|
fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", strings.TrimSuffix(fi.Stem(), ".apk"))
|
||||||
if app, ok := fi.module.(*java.AndroidApp); ok && len(app.JniCoverageOutputs()) > 0 {
|
if app, ok := fi.module.(*java.AndroidApp); ok && len(app.JniCoverageOutputs()) > 0 {
|
||||||
fmt.Fprintln(w, "LOCAL_PREBUILT_COVERAGE_ARCHIVE :=", strings.Join(app.JniCoverageOutputs().Strings(), " "))
|
fmt.Fprintln(w, "LOCAL_PREBUILT_COVERAGE_ARCHIVE :=", strings.Join(app.JniCoverageOutputs().Strings(), " "))
|
||||||
}
|
}
|
||||||
fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_app_prebuilt.mk")
|
fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_app_prebuilt.mk")
|
||||||
} else if fi.class == nativeSharedLib || fi.class == nativeExecutable || fi.class == nativeTest {
|
} else if fi.class == nativeSharedLib || fi.class == nativeExecutable || fi.class == nativeTest {
|
||||||
fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", fi.builtFile.Base())
|
fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", fi.Stem())
|
||||||
if cc, ok := fi.module.(*cc.Module); ok {
|
if cc, ok := fi.module.(*cc.Module); ok {
|
||||||
if cc.UnstrippedOutputFile() != nil {
|
if cc.UnstrippedOutputFile() != nil {
|
||||||
fmt.Fprintln(w, "LOCAL_SOONG_UNSTRIPPED_BINARY :=", cc.UnstrippedOutputFile().String())
|
fmt.Fprintln(w, "LOCAL_SOONG_UNSTRIPPED_BINARY :=", cc.UnstrippedOutputFile().String())
|
||||||
|
@ -212,7 +212,7 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, mo
|
||||||
}
|
}
|
||||||
fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_cc_prebuilt.mk")
|
fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_cc_prebuilt.mk")
|
||||||
} else {
|
} else {
|
||||||
fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", fi.builtFile.Base())
|
fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", fi.Stem())
|
||||||
if fi.builtFile == a.manifestPbOut && apexType == flattenedApex {
|
if fi.builtFile == a.manifestPbOut && apexType == flattenedApex {
|
||||||
if a.primaryApexType {
|
if a.primaryApexType {
|
||||||
// Make apex_manifest.pb module for this APEX to override all other
|
// Make apex_manifest.pb module for this APEX to override all other
|
||||||
|
|
23
apex/apex.go
23
apex/apex.go
|
@ -1228,11 +1228,14 @@ 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 {
|
||||||
stem := af.builtFile.Base()
|
return af.apexRelativePath(af.Stem())
|
||||||
|
}
|
||||||
|
|
||||||
|
func (af *apexFile) Stem() string {
|
||||||
if af.stem != "" {
|
if af.stem != "" {
|
||||||
stem = af.stem
|
return af.stem
|
||||||
}
|
}
|
||||||
return af.apexRelativePath(stem)
|
return af.builtFile.Base()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
||||||
|
@ -1971,13 +1974,13 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
case sharedLibTag, jniLibTag:
|
case sharedLibTag, jniLibTag:
|
||||||
isJniLib := depTag == jniLibTag
|
isJniLib := depTag == jniLibTag
|
||||||
if c, ok := child.(*cc.Module); ok {
|
if c, ok := child.(*cc.Module); ok {
|
||||||
// bootstrap bionic libs are treated as provided by system
|
|
||||||
if c.HasStubsVariants() && !cc.InstallToBootstrap(c.BaseModuleName(), ctx.Config()) {
|
|
||||||
provideNativeLibs = append(provideNativeLibs, c.OutputFile().Path().Base())
|
|
||||||
}
|
|
||||||
fi := apexFileForNativeLibrary(ctx, c, handleSpecialLibs)
|
fi := apexFileForNativeLibrary(ctx, c, handleSpecialLibs)
|
||||||
fi.isJniLib = isJniLib
|
fi.isJniLib = isJniLib
|
||||||
filesInfo = append(filesInfo, fi)
|
filesInfo = append(filesInfo, fi)
|
||||||
|
// bootstrap bionic libs are treated as provided by system
|
||||||
|
if c.HasStubsVariants() && !cc.InstallToBootstrap(c.BaseModuleName(), ctx.Config()) {
|
||||||
|
provideNativeLibs = append(provideNativeLibs, fi.Stem())
|
||||||
|
}
|
||||||
return true // track transitive dependencies
|
return true // track transitive dependencies
|
||||||
} else {
|
} else {
|
||||||
propertyName := "native_shared_libs"
|
propertyName := "native_shared_libs"
|
||||||
|
@ -2097,6 +2100,8 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
// don't include it in this APEX
|
// don't include it in this APEX
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
af := apexFileForNativeLibrary(ctx, cc, handleSpecialLibs)
|
||||||
|
af.transitiveDep = true
|
||||||
if !a.Host() && !android.DirectlyInApex(ctx.ModuleName(), ctx.OtherModuleName(cc)) && (cc.IsStubs() || cc.HasStubsVariants()) {
|
if !a.Host() && !android.DirectlyInApex(ctx.ModuleName(), ctx.OtherModuleName(cc)) && (cc.IsStubs() || cc.HasStubsVariants()) {
|
||||||
// If the dependency is a stubs lib, don't include it in this APEX,
|
// If the dependency is a stubs lib, don't include it in this APEX,
|
||||||
// but make sure that the lib is installed on the device.
|
// but make sure that the lib is installed on the device.
|
||||||
|
@ -2108,12 +2113,10 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
if !android.DirectlyInAnyApex(ctx, cc.Name()) && !android.InList(cc.BaseModuleName(), a.requiredDeps) {
|
if !android.DirectlyInAnyApex(ctx, cc.Name()) && !android.InList(cc.BaseModuleName(), a.requiredDeps) {
|
||||||
a.requiredDeps = append(a.requiredDeps, cc.BaseModuleName())
|
a.requiredDeps = append(a.requiredDeps, cc.BaseModuleName())
|
||||||
}
|
}
|
||||||
requireNativeLibs = append(requireNativeLibs, cc.OutputFile().Path().Base())
|
requireNativeLibs = append(requireNativeLibs, af.Stem())
|
||||||
// Don't track further
|
// Don't track further
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
af := apexFileForNativeLibrary(ctx, cc, handleSpecialLibs)
|
|
||||||
af.transitiveDep = true
|
|
||||||
filesInfo = append(filesInfo, af)
|
filesInfo = append(filesInfo, af)
|
||||||
return true // track transitive dependencies
|
return true // track transitive dependencies
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,7 +190,7 @@ func (a *apexBundle) buildManifest(ctx android.ModuleContext, provideNativeLibs,
|
||||||
var jniLibs []string
|
var jniLibs []string
|
||||||
for _, fi := range a.filesInfo {
|
for _, fi := range a.filesInfo {
|
||||||
if fi.isJniLib {
|
if fi.isJniLib {
|
||||||
jniLibs = append(jniLibs, fi.builtFile.Base())
|
jniLibs = append(jniLibs, fi.Stem())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(jniLibs) > 0 {
|
if len(jniLibs) > 0 {
|
||||||
|
@ -417,7 +417,7 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
|
||||||
var readOnlyPaths = []string{"apex_manifest.json", "apex_manifest.pb"}
|
var readOnlyPaths = []string{"apex_manifest.json", "apex_manifest.pb"}
|
||||||
var executablePaths []string // this also includes dirs
|
var executablePaths []string // this also includes dirs
|
||||||
for _, f := range a.filesInfo {
|
for _, f := range a.filesInfo {
|
||||||
pathInApex := filepath.Join(f.installDir, f.builtFile.Base())
|
pathInApex := f.Path()
|
||||||
if f.installDir == "bin" || strings.HasPrefix(f.installDir, "bin/") {
|
if f.installDir == "bin" || strings.HasPrefix(f.installDir, "bin/") {
|
||||||
executablePaths = append(executablePaths, pathInApex)
|
executablePaths = append(executablePaths, pathInApex)
|
||||||
for _, d := range f.dataPaths {
|
for _, d := range f.dataPaths {
|
||||||
|
@ -667,7 +667,7 @@ func (a *apexBundle) buildFilesInfo(ctx android.ModuleContext) {
|
||||||
apexBundleName := a.Name()
|
apexBundleName := a.Name()
|
||||||
for _, fi := range a.filesInfo {
|
for _, fi := range a.filesInfo {
|
||||||
dir := filepath.Join("apex", apexBundleName, fi.installDir)
|
dir := filepath.Join("apex", apexBundleName, fi.installDir)
|
||||||
target := ctx.InstallFile(android.PathForModuleInstall(ctx, dir), fi.builtFile.Base(), fi.builtFile)
|
target := ctx.InstallFile(android.PathForModuleInstall(ctx, dir), fi.Stem(), fi.builtFile)
|
||||||
for _, sym := range fi.symlinks {
|
for _, sym := range fi.symlinks {
|
||||||
ctx.InstallSymlink(android.PathForModuleInstall(ctx, dir), sym, target)
|
ctx.InstallSymlink(android.PathForModuleInstall(ctx, dir), sym, target)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue