Loading apex/apex.go +25 −0 Original line number Diff line number Diff line Loading @@ -142,6 +142,7 @@ var ( keyTag = dependencyTag{name: "key"} certificateTag = dependencyTag{name: "certificate"} usesTag = dependencyTag{name: "uses"} androidAppTag = dependencyTag{name: "androidApp"} ) var ( Loading Loading @@ -333,6 +334,9 @@ type apexBundleProperties struct { // A txt file containing list of files that are whitelisted to be included in this APEX. Whitelisted_files *string // List of APKs to package inside APEX Apps []string } type apexTargetBundleProperties struct { Loading Loading @@ -367,6 +371,7 @@ const ( goBinary javaSharedLib nativeTest app ) type apexPackaging int Loading Loading @@ -431,6 +436,8 @@ func (class apexFileClass) NameInMake() string { return "JAVA_LIBRARIES" case nativeTest: return "NATIVE_TESTS" case app: return "APPS" default: panic(fmt.Errorf("unknown class %d", class)) } Loading Loading @@ -633,6 +640,10 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) { {Mutator: "arch", Variation: "android_common"}, }, javaLibTag, a.properties.Java_libs...) ctx.AddFarVariationDependencies([]blueprint.Variation{ {Mutator: "arch", Variation: "android_common"}, }, androidAppTag, a.properties.Apps...) if String(a.properties.Key) == "" { ctx.ModuleErrorf("key is missing") return Loading Loading @@ -813,6 +824,12 @@ func getCopyManifestForPrebuiltEtc(prebuilt *android.PrebuiltEtc) (fileToCopy an return } func getCopyManifestForAndroidApp(app *java.AndroidApp, pkgName string) (fileToCopy android.Path, dirInApex string) { dirInApex = filepath.Join("app", pkgName) fileToCopy = app.OutputFile() return } // Context "decorator", overriding the InstallBypassMake method to always reply `true`. type flattenedApexContext struct { android.ModuleContext Loading Loading @@ -977,6 +994,14 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) { if prebuilt, ok := child.(*Prebuilt); ok && prebuilt.isForceDisabled() { a.prebuiltFileToDelete = prebuilt.InstallFilename() } case androidAppTag: if ap, ok := child.(*java.AndroidApp); ok { fileToCopy, dirInApex := getCopyManifestForAndroidApp(ap, ctx.DeviceConfig().OverridePackageNameFor(depName)) filesInfo = append(filesInfo, apexFile{fileToCopy, depName, dirInApex, app, ap, nil}) return true } else { ctx.PropertyErrorf("apps", "%q is not an android_app module", depName) } } } else { // indirect dependencies Loading apex/apex_test.go +60 −25 Original line number Diff line number Diff line Loading @@ -103,6 +103,7 @@ func testApexContext(t *testing.T, bp string) (*android.TestContext, android.Con ctx.RegisterModuleType("filegroup", android.ModuleFactoryAdaptor(android.FileGroupFactory)) ctx.RegisterModuleType("java_library", android.ModuleFactoryAdaptor(java.LibraryFactory)) ctx.RegisterModuleType("java_import", android.ModuleFactoryAdaptor(java.ImportFactory)) ctx.RegisterModuleType("android_app", android.ModuleFactoryAdaptor(java.AndroidAppFactory)) ctx.PreArchMutators(func(ctx android.RegisterMutatorsContext) { ctx.BottomUp("prebuilts", android.PrebuiltMutator).Parallel() Loading Loading @@ -235,6 +236,8 @@ func testApexContext(t *testing.T, bp string) (*android.TestContext, android.Con "myapex-arm64.apex": nil, "myapex-arm.apex": nil, "frameworks/base/api/current.txt": nil, "build/make/core/proguard.flags": nil, "build/make/core/proguard_basic_keeps.flags": nil, }) return ctx, config Loading Loading @@ -1977,6 +1980,38 @@ func TestErrorsIfDepsAreNotEnabled(t *testing.T) { `) } func TestApexWithApps(t *testing.T) { ctx, _ := testApex(t, ` apex { name: "myapex", key: "myapex.key", apps: [ "AppFoo", ], } apex_key { name: "myapex.key", public_key: "testkey.avbpubkey", private_key: "testkey.pem", } android_app { name: "AppFoo", srcs: ["foo/bar/MyClass.java"], sdk_version: "none", system_modules: "none", } `) module := ctx.ModuleForTests("myapex", "android_common_myapex") apexRule := module.Rule("apexRule") copyCmds := apexRule.Args["copy_commands"] ensureContains(t, copyCmds, "image.apex/app/AppFoo/AppFoo.apk") } func TestMain(m *testing.M) { run := func() int { setUp() Loading java/app.go +4 −0 Original line number Diff line number Diff line Loading @@ -139,6 +139,10 @@ func (a *AndroidApp) ExportedStaticPackages() android.Paths { return nil } func (a *AndroidApp) OutputFile() android.Path { return a.outputFile } var _ AndroidLibraryDependency = (*AndroidApp)(nil) type Certificate struct { Loading Loading
apex/apex.go +25 −0 Original line number Diff line number Diff line Loading @@ -142,6 +142,7 @@ var ( keyTag = dependencyTag{name: "key"} certificateTag = dependencyTag{name: "certificate"} usesTag = dependencyTag{name: "uses"} androidAppTag = dependencyTag{name: "androidApp"} ) var ( Loading Loading @@ -333,6 +334,9 @@ type apexBundleProperties struct { // A txt file containing list of files that are whitelisted to be included in this APEX. Whitelisted_files *string // List of APKs to package inside APEX Apps []string } type apexTargetBundleProperties struct { Loading Loading @@ -367,6 +371,7 @@ const ( goBinary javaSharedLib nativeTest app ) type apexPackaging int Loading Loading @@ -431,6 +436,8 @@ func (class apexFileClass) NameInMake() string { return "JAVA_LIBRARIES" case nativeTest: return "NATIVE_TESTS" case app: return "APPS" default: panic(fmt.Errorf("unknown class %d", class)) } Loading Loading @@ -633,6 +640,10 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) { {Mutator: "arch", Variation: "android_common"}, }, javaLibTag, a.properties.Java_libs...) ctx.AddFarVariationDependencies([]blueprint.Variation{ {Mutator: "arch", Variation: "android_common"}, }, androidAppTag, a.properties.Apps...) if String(a.properties.Key) == "" { ctx.ModuleErrorf("key is missing") return Loading Loading @@ -813,6 +824,12 @@ func getCopyManifestForPrebuiltEtc(prebuilt *android.PrebuiltEtc) (fileToCopy an return } func getCopyManifestForAndroidApp(app *java.AndroidApp, pkgName string) (fileToCopy android.Path, dirInApex string) { dirInApex = filepath.Join("app", pkgName) fileToCopy = app.OutputFile() return } // Context "decorator", overriding the InstallBypassMake method to always reply `true`. type flattenedApexContext struct { android.ModuleContext Loading Loading @@ -977,6 +994,14 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) { if prebuilt, ok := child.(*Prebuilt); ok && prebuilt.isForceDisabled() { a.prebuiltFileToDelete = prebuilt.InstallFilename() } case androidAppTag: if ap, ok := child.(*java.AndroidApp); ok { fileToCopy, dirInApex := getCopyManifestForAndroidApp(ap, ctx.DeviceConfig().OverridePackageNameFor(depName)) filesInfo = append(filesInfo, apexFile{fileToCopy, depName, dirInApex, app, ap, nil}) return true } else { ctx.PropertyErrorf("apps", "%q is not an android_app module", depName) } } } else { // indirect dependencies Loading
apex/apex_test.go +60 −25 Original line number Diff line number Diff line Loading @@ -103,6 +103,7 @@ func testApexContext(t *testing.T, bp string) (*android.TestContext, android.Con ctx.RegisterModuleType("filegroup", android.ModuleFactoryAdaptor(android.FileGroupFactory)) ctx.RegisterModuleType("java_library", android.ModuleFactoryAdaptor(java.LibraryFactory)) ctx.RegisterModuleType("java_import", android.ModuleFactoryAdaptor(java.ImportFactory)) ctx.RegisterModuleType("android_app", android.ModuleFactoryAdaptor(java.AndroidAppFactory)) ctx.PreArchMutators(func(ctx android.RegisterMutatorsContext) { ctx.BottomUp("prebuilts", android.PrebuiltMutator).Parallel() Loading Loading @@ -235,6 +236,8 @@ func testApexContext(t *testing.T, bp string) (*android.TestContext, android.Con "myapex-arm64.apex": nil, "myapex-arm.apex": nil, "frameworks/base/api/current.txt": nil, "build/make/core/proguard.flags": nil, "build/make/core/proguard_basic_keeps.flags": nil, }) return ctx, config Loading Loading @@ -1977,6 +1980,38 @@ func TestErrorsIfDepsAreNotEnabled(t *testing.T) { `) } func TestApexWithApps(t *testing.T) { ctx, _ := testApex(t, ` apex { name: "myapex", key: "myapex.key", apps: [ "AppFoo", ], } apex_key { name: "myapex.key", public_key: "testkey.avbpubkey", private_key: "testkey.pem", } android_app { name: "AppFoo", srcs: ["foo/bar/MyClass.java"], sdk_version: "none", system_modules: "none", } `) module := ctx.ModuleForTests("myapex", "android_common_myapex") apexRule := module.Rule("apexRule") copyCmds := apexRule.Args["copy_commands"] ensureContains(t, copyCmds, "image.apex/app/AppFoo/AppFoo.apk") } func TestMain(m *testing.M) { run := func() int { setUp() Loading
java/app.go +4 −0 Original line number Diff line number Diff line Loading @@ -139,6 +139,10 @@ func (a *AndroidApp) ExportedStaticPackages() android.Paths { return nil } func (a *AndroidApp) OutputFile() android.Path { return a.outputFile } var _ AndroidLibraryDependency = (*AndroidApp)(nil) type Certificate struct { Loading