Fix android_test install path.
Test: m nothing + diff soong mk and ninja files. Bug: 140795853 Change-Id: I3667eac951dea7e447cf73219ff89199fca9ed63
This commit is contained in:
@@ -154,6 +154,7 @@ type ModuleContext interface {
|
|||||||
CheckbuildFile(srcPath Path)
|
CheckbuildFile(srcPath Path)
|
||||||
|
|
||||||
InstallInData() bool
|
InstallInData() bool
|
||||||
|
InstallInTestcases() bool
|
||||||
InstallInSanitizerDir() bool
|
InstallInSanitizerDir() bool
|
||||||
InstallInRecovery() bool
|
InstallInRecovery() bool
|
||||||
InstallBypassMake() bool
|
InstallBypassMake() bool
|
||||||
@@ -192,6 +193,7 @@ type Module interface {
|
|||||||
Enabled() bool
|
Enabled() bool
|
||||||
Target() Target
|
Target() Target
|
||||||
InstallInData() bool
|
InstallInData() bool
|
||||||
|
InstallInTestcases() bool
|
||||||
InstallInSanitizerDir() bool
|
InstallInSanitizerDir() bool
|
||||||
InstallInRecovery() bool
|
InstallInRecovery() bool
|
||||||
InstallBypassMake() bool
|
InstallBypassMake() bool
|
||||||
@@ -832,6 +834,10 @@ func (m *ModuleBase) InstallInData() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *ModuleBase) InstallInTestcases() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func (m *ModuleBase) InstallInSanitizerDir() bool {
|
func (m *ModuleBase) InstallInSanitizerDir() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@@ -1504,6 +1510,10 @@ func (m *moduleContext) InstallInData() bool {
|
|||||||
return m.module.InstallInData()
|
return m.module.InstallInData()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *moduleContext) InstallInTestcases() bool {
|
||||||
|
return m.module.InstallInTestcases()
|
||||||
|
}
|
||||||
|
|
||||||
func (m *moduleContext) InstallInSanitizerDir() bool {
|
func (m *moduleContext) InstallInSanitizerDir() bool {
|
||||||
return m.module.InstallInSanitizerDir()
|
return m.module.InstallInSanitizerDir()
|
||||||
}
|
}
|
||||||
|
@@ -44,6 +44,7 @@ type ModuleInstallPathContext interface {
|
|||||||
BaseModuleContext
|
BaseModuleContext
|
||||||
|
|
||||||
InstallInData() bool
|
InstallInData() bool
|
||||||
|
InstallInTestcases() bool
|
||||||
InstallInSanitizerDir() bool
|
InstallInSanitizerDir() bool
|
||||||
InstallInRecovery() bool
|
InstallInRecovery() bool
|
||||||
InstallBypassMake() bool
|
InstallBypassMake() bool
|
||||||
@@ -1155,6 +1156,8 @@ func modulePartition(ctx ModuleInstallPathContext) string {
|
|||||||
var partition string
|
var partition string
|
||||||
if ctx.InstallInData() {
|
if ctx.InstallInData() {
|
||||||
partition = "data"
|
partition = "data"
|
||||||
|
} else if ctx.InstallInTestcases() {
|
||||||
|
partition = "testcases"
|
||||||
} else if ctx.InstallInRecovery() {
|
} else if ctx.InstallInRecovery() {
|
||||||
// the layout of recovery partion is the same as that of system partition
|
// the layout of recovery partion is the same as that of system partition
|
||||||
partition = "recovery/root/system"
|
partition = "recovery/root/system"
|
||||||
|
@@ -201,6 +201,7 @@ type moduleInstallPathContextImpl struct {
|
|||||||
baseModuleContext
|
baseModuleContext
|
||||||
|
|
||||||
inData bool
|
inData bool
|
||||||
|
inTestcases bool
|
||||||
inSanitizerDir bool
|
inSanitizerDir bool
|
||||||
inRecovery bool
|
inRecovery bool
|
||||||
}
|
}
|
||||||
@@ -219,6 +220,10 @@ func (m moduleInstallPathContextImpl) InstallInData() bool {
|
|||||||
return m.inData
|
return m.inData
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m moduleInstallPathContextImpl) InstallInTestcases() bool {
|
||||||
|
return m.inTestcases
|
||||||
|
}
|
||||||
|
|
||||||
func (m moduleInstallPathContextImpl) InstallInSanitizerDir() bool {
|
func (m moduleInstallPathContextImpl) InstallInSanitizerDir() bool {
|
||||||
return m.inSanitizerDir
|
return m.inSanitizerDir
|
||||||
}
|
}
|
||||||
|
26
java/app.go
26
java/app.go
@@ -126,6 +126,8 @@ type AndroidApp struct {
|
|||||||
// the install APK name is normally the same as the module name, but can be overridden with PRODUCT_PACKAGE_NAME_OVERRIDES.
|
// the install APK name is normally the same as the module name, but can be overridden with PRODUCT_PACKAGE_NAME_OVERRIDES.
|
||||||
installApkName string
|
installApkName string
|
||||||
|
|
||||||
|
installDir android.OutputPath
|
||||||
|
|
||||||
additionalAaptFlags []string
|
additionalAaptFlags []string
|
||||||
|
|
||||||
noticeOutputs android.NoticeOutputs
|
noticeOutputs android.NoticeOutputs
|
||||||
@@ -319,7 +321,6 @@ 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")
|
a.dexpreopter.installPath = android.PathForModuleInstall(ctx, installDir, a.installApkName+".apk")
|
||||||
a.dexpreopter.isInstallable = Bool(a.properties.Installable)
|
a.dexpreopter.isInstallable = Bool(a.properties.Installable)
|
||||||
a.dexpreopter.uncompressedDex = a.shouldUncompressDex(ctx)
|
a.dexpreopter.uncompressedDex = a.shouldUncompressDex(ctx)
|
||||||
@@ -352,7 +353,7 @@ func (a *AndroidApp) jniBuildActions(jniLibs []jniLib, ctx android.ModuleContext
|
|||||||
return jniJarFile
|
return jniJarFile
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *AndroidApp) noticeBuildActions(ctx android.ModuleContext, installDir android.OutputPath) {
|
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)
|
||||||
noticePathSet := make(map[android.Path]bool)
|
noticePathSet := make(map[android.Path]bool)
|
||||||
@@ -392,7 +393,7 @@ func (a *AndroidApp) noticeBuildActions(ctx android.ModuleContext, installDir an
|
|||||||
return noticePaths[i].String() < noticePaths[j].String()
|
return noticePaths[i].String() < noticePaths[j].String()
|
||||||
})
|
})
|
||||||
|
|
||||||
a.noticeOutputs = android.BuildNoticeOutput(ctx, installDir, a.installApkName+".apk", noticePaths)
|
a.noticeOutputs = android.BuildNoticeOutput(ctx, a.installDir, a.installApkName+".apk", noticePaths)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reads and prepends a main cert from the default cert dir if it hasn't been set already, i.e. it
|
// Reads and prepends a main cert from the default cert dir if it hasn't been set already, i.e. it
|
||||||
@@ -438,17 +439,18 @@ func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
// Check if the install APK name needs to be overridden.
|
// Check if the install APK name needs to be overridden.
|
||||||
a.installApkName = ctx.DeviceConfig().OverridePackageNameFor(a.Name())
|
a.installApkName = ctx.DeviceConfig().OverridePackageNameFor(a.Name())
|
||||||
|
|
||||||
var installDir android.OutputPath
|
|
||||||
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
|
||||||
installDir = android.PathForModuleInstall(ctx, "framework")
|
a.installDir = android.PathForModuleInstall(ctx, "framework")
|
||||||
} else if Bool(a.appProperties.Privileged) {
|
} else if Bool(a.appProperties.Privileged) {
|
||||||
installDir = android.PathForModuleInstall(ctx, "priv-app", a.installApkName)
|
a.installDir = android.PathForModuleInstall(ctx, "priv-app", a.installApkName)
|
||||||
|
} else if ctx.InstallInTestcases() {
|
||||||
|
a.installDir = android.PathForModuleInstall(ctx, a.installApkName)
|
||||||
} else {
|
} else {
|
||||||
installDir = android.PathForModuleInstall(ctx, "app", a.installApkName)
|
a.installDir = android.PathForModuleInstall(ctx, "app", a.installApkName)
|
||||||
}
|
}
|
||||||
|
|
||||||
a.noticeBuildActions(ctx, installDir)
|
a.noticeBuildActions(ctx)
|
||||||
if Bool(a.appProperties.Embed_notices) || ctx.Config().IsEnvTrue("ALWAYS_EMBED_NOTICES") {
|
if Bool(a.appProperties.Embed_notices) || ctx.Config().IsEnvTrue("ALWAYS_EMBED_NOTICES") {
|
||||||
a.aapt.noticeFile = a.noticeOutputs.HtmlGzOutput
|
a.aapt.noticeFile = a.noticeOutputs.HtmlGzOutput
|
||||||
}
|
}
|
||||||
@@ -494,9 +496,9 @@ func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
a.bundleFile = bundleFile
|
a.bundleFile = bundleFile
|
||||||
|
|
||||||
// Install the app package.
|
// Install the app package.
|
||||||
ctx.InstallFile(installDir, a.installApkName+".apk", a.outputFile)
|
ctx.InstallFile(a.installDir, a.installApkName+".apk", a.outputFile)
|
||||||
for _, split := range a.aapt.splits {
|
for _, split := range a.aapt.splits {
|
||||||
ctx.InstallFile(installDir, a.installApkName+"_"+split.suffix+".apk", split.path)
|
ctx.InstallFile(a.installDir, a.installApkName+"_"+split.suffix+".apk", split.path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -598,6 +600,10 @@ type AndroidTest struct {
|
|||||||
data android.Paths
|
data android.Paths
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *AndroidTest) InstallInTestcases() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
func (a *AndroidTest) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
func (a *AndroidTest) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
// Check if the instrumentation target package is overridden before generating build actions.
|
// Check if the instrumentation target package is overridden before generating build actions.
|
||||||
if a.appTestProperties.Instrumentation_for != nil {
|
if a.appTestProperties.Instrumentation_for != nil {
|
||||||
|
Reference in New Issue
Block a user