Merge "Pass unstripped JNI libraries to Make" am: bf81ed4fd1
am: 9a6d827dc3
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1356262 Change-Id: I99a111aafcab5a8a8a5b704b9dd67904c93b0aea
This commit is contained in:
commit
0add164d0e
|
@ -108,9 +108,10 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, mo
|
||||||
}
|
}
|
||||||
// /apex/<apex_name>/{lib|framework|...}
|
// /apex/<apex_name>/{lib|framework|...}
|
||||||
pathWhenActivated := filepath.Join("$(PRODUCT_OUT)", "apex", apexName, fi.installDir)
|
pathWhenActivated := filepath.Join("$(PRODUCT_OUT)", "apex", apexName, fi.installDir)
|
||||||
|
var modulePath string
|
||||||
if apexType == flattenedApex {
|
if apexType == flattenedApex {
|
||||||
// /system/apex/<name>/{lib|framework|...}
|
// /system/apex/<name>/{lib|framework|...}
|
||||||
modulePath := filepath.Join(a.installDir.ToMakePath().String(), apexBundleName, fi.installDir)
|
modulePath = filepath.Join(a.installDir.ToMakePath().String(), apexBundleName, fi.installDir)
|
||||||
fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", modulePath)
|
fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", modulePath)
|
||||||
if a.primaryApexType && !symbolFilesNotNeeded {
|
if a.primaryApexType && !symbolFilesNotNeeded {
|
||||||
fmt.Fprintln(w, "LOCAL_SOONG_SYMBOL_PATH :=", pathWhenActivated)
|
fmt.Fprintln(w, "LOCAL_SOONG_SYMBOL_PATH :=", pathWhenActivated)
|
||||||
|
@ -134,6 +135,7 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, mo
|
||||||
fmt.Fprintln(w, "LOCAL_NOTICE_FILE :=", strings.Join(fi.module.NoticeFiles().Strings(), " "))
|
fmt.Fprintln(w, "LOCAL_NOTICE_FILE :=", strings.Join(fi.module.NoticeFiles().Strings(), " "))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
modulePath = pathWhenActivated
|
||||||
fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", pathWhenActivated)
|
fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", pathWhenActivated)
|
||||||
|
|
||||||
// For non-flattend APEXes, the merged notice file is attached to the APEX itself.
|
// For non-flattend APEXes, the merged notice file is attached to the APEX itself.
|
||||||
|
@ -196,8 +198,13 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, mo
|
||||||
// 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.Stem(), ".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 {
|
||||||
fmt.Fprintln(w, "LOCAL_PREBUILT_COVERAGE_ARCHIVE :=", strings.Join(app.JniCoverageOutputs().Strings(), " "))
|
if jniCoverageOutputs := app.JniCoverageOutputs(); len(jniCoverageOutputs) > 0 {
|
||||||
|
fmt.Fprintln(w, "LOCAL_PREBUILT_COVERAGE_ARCHIVE :=", strings.Join(jniCoverageOutputs.Strings(), " "))
|
||||||
|
}
|
||||||
|
if jniLibSymbols := app.JNISymbolsInstalls(modulePath); len(jniLibSymbols) > 0 {
|
||||||
|
fmt.Fprintln(w, "LOCAL_SOONG_JNI_LIBS_SYMBOLS :=", jniLibSymbols.String())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_app_prebuilt.mk")
|
fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_app_prebuilt.mk")
|
||||||
case appSet:
|
case appSet:
|
||||||
|
|
|
@ -370,9 +370,15 @@ func (app *AndroidApp) AndroidMkEntries() []android.AndroidMkEntries {
|
||||||
entries.SetString("LOCAL_CERTIFICATE", app.certificate.AndroidMkString())
|
entries.SetString("LOCAL_CERTIFICATE", app.certificate.AndroidMkString())
|
||||||
entries.AddStrings("LOCAL_OVERRIDES_PACKAGES", app.getOverriddenPackages()...)
|
entries.AddStrings("LOCAL_OVERRIDES_PACKAGES", app.getOverriddenPackages()...)
|
||||||
|
|
||||||
for _, jniLib := range app.installJniLibs {
|
if app.embeddedJniLibs {
|
||||||
|
jniSymbols := app.JNISymbolsInstalls(app.installPathForJNISymbols.String())
|
||||||
|
entries.SetString("LOCAL_SOONG_JNI_LIBS_SYMBOLS", jniSymbols.String())
|
||||||
|
} else {
|
||||||
|
for _, jniLib := range app.jniLibs {
|
||||||
entries.AddStrings("LOCAL_SOONG_JNI_LIBS_"+jniLib.target.Arch.ArchType.String(), jniLib.name)
|
entries.AddStrings("LOCAL_SOONG_JNI_LIBS_"+jniLib.target.Arch.ArchType.String(), jniLib.name)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if len(app.jniCoverageOutputs) > 0 {
|
if len(app.jniCoverageOutputs) > 0 {
|
||||||
entries.AddStrings("LOCAL_PREBUILT_COVERAGE_ARCHIVE", app.jniCoverageOutputs.Strings()...)
|
entries.AddStrings("LOCAL_PREBUILT_COVERAGE_ARCHIVE", app.jniCoverageOutputs.Strings()...)
|
||||||
}
|
}
|
||||||
|
|
33
java/app.go
33
java/app.go
|
@ -292,7 +292,9 @@ type AndroidApp struct {
|
||||||
|
|
||||||
overridableAppProperties overridableAppProperties
|
overridableAppProperties overridableAppProperties
|
||||||
|
|
||||||
installJniLibs []jniLib
|
jniLibs []jniLib
|
||||||
|
installPathForJNISymbols android.Path
|
||||||
|
embeddedJniLibs bool
|
||||||
jniCoverageOutputs android.Paths
|
jniCoverageOutputs android.Paths
|
||||||
|
|
||||||
bundleFile android.Path
|
bundleFile android.Path
|
||||||
|
@ -570,8 +572,7 @@ func (a *AndroidApp) proguardBuildActions(ctx android.ModuleContext) {
|
||||||
a.Module.extraProguardFlagFiles = append(a.Module.extraProguardFlagFiles, a.proguardOptionsFile)
|
a.Module.extraProguardFlagFiles = append(a.Module.extraProguardFlagFiles, a.proguardOptionsFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *AndroidApp) dexBuildActions(ctx android.ModuleContext) android.Path {
|
func (a *AndroidApp) installPath(ctx android.ModuleContext) android.InstallPath {
|
||||||
|
|
||||||
var installDir string
|
var installDir string
|
||||||
if ctx.ModuleName() == "framework-res" {
|
if ctx.ModuleName() == "framework-res" {
|
||||||
// framework-res.apk is installed as system/framework/framework-res.apk
|
// framework-res.apk is installed as system/framework/framework-res.apk
|
||||||
|
@ -581,7 +582,12 @@ func (a *AndroidApp) dexBuildActions(ctx android.ModuleContext) android.Path {
|
||||||
} else {
|
} else {
|
||||||
installDir = filepath.Join("app", a.installApkName)
|
installDir = filepath.Join("app", a.installApkName)
|
||||||
}
|
}
|
||||||
a.dexpreopter.installPath = android.PathForModuleInstall(ctx, installDir, a.installApkName+".apk")
|
|
||||||
|
return android.PathForModuleInstall(ctx, installDir, a.installApkName+".apk")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *AndroidApp) dexBuildActions(ctx android.ModuleContext) android.Path {
|
||||||
|
a.dexpreopter.installPath = a.installPath(ctx)
|
||||||
if a.deviceProperties.Uncompress_dex == nil {
|
if a.deviceProperties.Uncompress_dex == nil {
|
||||||
// If the value was not force-set by the user, use reasonable default based on the module.
|
// If the value was not force-set by the user, use reasonable default based on the module.
|
||||||
a.deviceProperties.Uncompress_dex = proptools.BoolPtr(a.shouldUncompressDex(ctx))
|
a.deviceProperties.Uncompress_dex = proptools.BoolPtr(a.shouldUncompressDex(ctx))
|
||||||
|
@ -603,8 +609,10 @@ func (a *AndroidApp) dexBuildActions(ctx android.ModuleContext) android.Path {
|
||||||
func (a *AndroidApp) jniBuildActions(jniLibs []jniLib, ctx android.ModuleContext) android.WritablePath {
|
func (a *AndroidApp) jniBuildActions(jniLibs []jniLib, ctx android.ModuleContext) android.WritablePath {
|
||||||
var jniJarFile android.WritablePath
|
var jniJarFile android.WritablePath
|
||||||
if len(jniLibs) > 0 {
|
if len(jniLibs) > 0 {
|
||||||
|
a.jniLibs = jniLibs
|
||||||
if a.shouldEmbedJnis(ctx) {
|
if a.shouldEmbedJnis(ctx) {
|
||||||
jniJarFile = android.PathForModuleOut(ctx, "jnilibs.zip")
|
jniJarFile = android.PathForModuleOut(ctx, "jnilibs.zip")
|
||||||
|
a.installPathForJNISymbols = a.installPath(ctx).ToMakePath()
|
||||||
TransformJniLibsToJar(ctx, jniJarFile, jniLibs, a.useEmbeddedNativeLibs(ctx))
|
TransformJniLibsToJar(ctx, jniJarFile, jniLibs, a.useEmbeddedNativeLibs(ctx))
|
||||||
for _, jni := range jniLibs {
|
for _, jni := range jniLibs {
|
||||||
if jni.coverageFile.Valid() {
|
if jni.coverageFile.Valid() {
|
||||||
|
@ -622,13 +630,25 @@ func (a *AndroidApp) jniBuildActions(jniLibs []jniLib, ctx android.ModuleContext
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
a.embeddedJniLibs = true
|
||||||
a.installJniLibs = jniLibs
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return jniJarFile
|
return jniJarFile
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *AndroidApp) JNISymbolsInstalls(installPath string) android.RuleBuilderInstalls {
|
||||||
|
var jniSymbols android.RuleBuilderInstalls
|
||||||
|
for _, jniLib := range a.jniLibs {
|
||||||
|
if jniLib.unstrippedFile != nil {
|
||||||
|
jniSymbols = append(jniSymbols, android.RuleBuilderInstall{
|
||||||
|
From: jniLib.unstrippedFile,
|
||||||
|
To: filepath.Join(installPath, targetToJniDir(jniLib.target), jniLib.unstrippedFile.Base()),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return jniSymbols
|
||||||
|
}
|
||||||
|
|
||||||
func (a *AndroidApp) noticeBuildActions(ctx android.ModuleContext) {
|
func (a *AndroidApp) noticeBuildActions(ctx android.ModuleContext) {
|
||||||
// Collect NOTICE files from all dependencies.
|
// Collect NOTICE files from all dependencies.
|
||||||
seenModules := make(map[android.Module]bool)
|
seenModules := make(map[android.Module]bool)
|
||||||
|
@ -862,6 +882,7 @@ func collectAppDeps(ctx android.ModuleContext, app appDepsInterface,
|
||||||
path: path,
|
path: path,
|
||||||
target: module.Target(),
|
target: module.Target(),
|
||||||
coverageFile: dep.CoverageOutputFile(),
|
coverageFile: dep.CoverageOutputFile(),
|
||||||
|
unstrippedFile: dep.UnstrippedOutputFile(),
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
ctx.ModuleErrorf("dependency %q missing output file", otherName)
|
ctx.ModuleErrorf("dependency %q missing output file", otherName)
|
||||||
|
|
|
@ -643,6 +643,7 @@ type jniLib struct {
|
||||||
path android.Path
|
path android.Path
|
||||||
target android.Target
|
target android.Target
|
||||||
coverageFile android.OptionalPath
|
coverageFile android.OptionalPath
|
||||||
|
unstrippedFile android.Path
|
||||||
}
|
}
|
||||||
|
|
||||||
func (j *Module) shouldInstrument(ctx android.BaseModuleContext) bool {
|
func (j *Module) shouldInstrument(ctx android.BaseModuleContext) bool {
|
||||||
|
|
Loading…
Reference in New Issue