Loading java/androidmk.go +15 −20 Original line number Diff line number Diff line Loading @@ -609,28 +609,23 @@ func (dstubs *Droidstubs) AndroidMk() android.AndroidMkData { } } func (app *AndroidAppImport) AndroidMk() android.AndroidMkData { return android.AndroidMkData{ func (a *AndroidAppImport) AndroidMkEntries() android.AndroidMkEntries { return android.AndroidMkEntries{ Class: "APPS", OutputFile: android.OptionalPathForPath(app.outputFile), OutputFile: android.OptionalPathForPath(a.outputFile), Include: "$(BUILD_SYSTEM)/soong_app_prebuilt.mk", Extra: []android.AndroidMkExtraFunc{ func(w io.Writer, outputFile android.Path) { if Bool(app.properties.Privileged) { fmt.Fprintln(w, "LOCAL_PRIVILEGED_MODULE := true") } if app.certificate != nil { fmt.Fprintln(w, "LOCAL_CERTIFICATE :=", app.certificate.Pem.String()) AddCustomEntries: func(name, prefix, moduleDir string, entries *android.AndroidMkEntries) { entries.SetBoolIfTrue("LOCAL_PRIVILEGED_MODULE", Bool(a.properties.Privileged)) if a.certificate != nil { entries.SetString("LOCAL_CERTIFICATE", a.certificate.Pem.String()) } else { fmt.Fprintln(w, "LOCAL_CERTIFICATE := PRESIGNED") entries.SetString("LOCAL_CERTIFICATE", "PRESIGNED") } if len(app.properties.Overrides) > 0 { fmt.Fprintln(w, "LOCAL_OVERRIDES_PACKAGES :=", strings.Join(app.properties.Overrides, " ")) entries.AddStrings("LOCAL_OVERRIDES_PACKAGES", a.properties.Overrides...) if len(a.dexpreopter.builtInstalled) > 0 { entries.SetString("LOCAL_SOONG_BUILT_INSTALLED", a.dexpreopter.builtInstalled) } if len(app.dexpreopter.builtInstalled) > 0 { fmt.Fprintln(w, "LOCAL_SOONG_BUILT_INSTALLED :=", app.dexpreopter.builtInstalled) } }, entries.AddStrings("LOCAL_INSTALLED_MODULE_STEM", a.installPath.Rel()) }, } } Loading java/app.go +7 −1 Original line number Diff line number Diff line Loading @@ -740,6 +740,8 @@ type AndroidAppImport struct { dexpreopter usesLibrary usesLibrary installPath android.OutputPath } type AndroidAppImportProperties struct { Loading @@ -765,6 +767,9 @@ type AndroidAppImportProperties struct { // binaries would be installed by default (in PRODUCT_PACKAGES) the other binary will be removed // from PRODUCT_PACKAGES. Overrides []string // Optional name for the installed app. If unspecified, it is derived from the module name. Filename *string } // Chooses a source APK path to use based on the module and product specs. Loading Loading @@ -917,7 +922,8 @@ func (a *AndroidAppImport) GenerateAndroidBuildActions(ctx android.ModuleContext // TODO: Optionally compress the output apk. ctx.InstallFile(installDir, a.BaseModuleName()+".apk", a.outputFile) a.installPath = ctx.InstallFile(installDir, proptools.StringDefault(a.properties.Filename, a.BaseModuleName()+".apk"), a.outputFile) // TODO: androidmk converter jni libs } Loading java/app_test.go +47 −0 Original line number Diff line number Diff line Loading @@ -1242,6 +1242,53 @@ func TestAndroidAppImport_DpiVariants(t *testing.T) { } } func TestAndroidAppImport_Filename(t *testing.T) { ctx, config := testJava(t, ` android_app_import { name: "foo", apk: "prebuilts/apk/app.apk", presigned: true, } android_app_import { name: "bar", apk: "prebuilts/apk/app.apk", presigned: true, filename: "bar_sample.apk" } `) testCases := []struct { name string expected string }{ { name: "foo", expected: "foo.apk", }, { name: "bar", expected: "bar_sample.apk", }, } for _, test := range testCases { variant := ctx.ModuleForTests(test.name, "android_common") if variant.MaybeOutput(test.expected).Rule == nil { t.Errorf("can't find output named %q - all outputs: %v", test.expected, variant.AllOutputs()) } a := variant.Module().(*AndroidAppImport) expectedValues := []string{test.expected} actualValues := android.AndroidMkEntriesForTest( t, config, "", a).EntryMap["LOCAL_INSTALLED_MODULE_STEM"] if !reflect.DeepEqual(actualValues, expectedValues) { t.Errorf("Incorrect LOCAL_INSTALLED_MODULE_STEM value '%s', expected '%s'", actualValues, expectedValues) } } } func TestStl(t *testing.T) { ctx, _ := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+` cc_library { Loading Loading
java/androidmk.go +15 −20 Original line number Diff line number Diff line Loading @@ -609,28 +609,23 @@ func (dstubs *Droidstubs) AndroidMk() android.AndroidMkData { } } func (app *AndroidAppImport) AndroidMk() android.AndroidMkData { return android.AndroidMkData{ func (a *AndroidAppImport) AndroidMkEntries() android.AndroidMkEntries { return android.AndroidMkEntries{ Class: "APPS", OutputFile: android.OptionalPathForPath(app.outputFile), OutputFile: android.OptionalPathForPath(a.outputFile), Include: "$(BUILD_SYSTEM)/soong_app_prebuilt.mk", Extra: []android.AndroidMkExtraFunc{ func(w io.Writer, outputFile android.Path) { if Bool(app.properties.Privileged) { fmt.Fprintln(w, "LOCAL_PRIVILEGED_MODULE := true") } if app.certificate != nil { fmt.Fprintln(w, "LOCAL_CERTIFICATE :=", app.certificate.Pem.String()) AddCustomEntries: func(name, prefix, moduleDir string, entries *android.AndroidMkEntries) { entries.SetBoolIfTrue("LOCAL_PRIVILEGED_MODULE", Bool(a.properties.Privileged)) if a.certificate != nil { entries.SetString("LOCAL_CERTIFICATE", a.certificate.Pem.String()) } else { fmt.Fprintln(w, "LOCAL_CERTIFICATE := PRESIGNED") entries.SetString("LOCAL_CERTIFICATE", "PRESIGNED") } if len(app.properties.Overrides) > 0 { fmt.Fprintln(w, "LOCAL_OVERRIDES_PACKAGES :=", strings.Join(app.properties.Overrides, " ")) entries.AddStrings("LOCAL_OVERRIDES_PACKAGES", a.properties.Overrides...) if len(a.dexpreopter.builtInstalled) > 0 { entries.SetString("LOCAL_SOONG_BUILT_INSTALLED", a.dexpreopter.builtInstalled) } if len(app.dexpreopter.builtInstalled) > 0 { fmt.Fprintln(w, "LOCAL_SOONG_BUILT_INSTALLED :=", app.dexpreopter.builtInstalled) } }, entries.AddStrings("LOCAL_INSTALLED_MODULE_STEM", a.installPath.Rel()) }, } } Loading
java/app.go +7 −1 Original line number Diff line number Diff line Loading @@ -740,6 +740,8 @@ type AndroidAppImport struct { dexpreopter usesLibrary usesLibrary installPath android.OutputPath } type AndroidAppImportProperties struct { Loading @@ -765,6 +767,9 @@ type AndroidAppImportProperties struct { // binaries would be installed by default (in PRODUCT_PACKAGES) the other binary will be removed // from PRODUCT_PACKAGES. Overrides []string // Optional name for the installed app. If unspecified, it is derived from the module name. Filename *string } // Chooses a source APK path to use based on the module and product specs. Loading Loading @@ -917,7 +922,8 @@ func (a *AndroidAppImport) GenerateAndroidBuildActions(ctx android.ModuleContext // TODO: Optionally compress the output apk. ctx.InstallFile(installDir, a.BaseModuleName()+".apk", a.outputFile) a.installPath = ctx.InstallFile(installDir, proptools.StringDefault(a.properties.Filename, a.BaseModuleName()+".apk"), a.outputFile) // TODO: androidmk converter jni libs } Loading
java/app_test.go +47 −0 Original line number Diff line number Diff line Loading @@ -1242,6 +1242,53 @@ func TestAndroidAppImport_DpiVariants(t *testing.T) { } } func TestAndroidAppImport_Filename(t *testing.T) { ctx, config := testJava(t, ` android_app_import { name: "foo", apk: "prebuilts/apk/app.apk", presigned: true, } android_app_import { name: "bar", apk: "prebuilts/apk/app.apk", presigned: true, filename: "bar_sample.apk" } `) testCases := []struct { name string expected string }{ { name: "foo", expected: "foo.apk", }, { name: "bar", expected: "bar_sample.apk", }, } for _, test := range testCases { variant := ctx.ModuleForTests(test.name, "android_common") if variant.MaybeOutput(test.expected).Rule == nil { t.Errorf("can't find output named %q - all outputs: %v", test.expected, variant.AllOutputs()) } a := variant.Module().(*AndroidAppImport) expectedValues := []string{test.expected} actualValues := android.AndroidMkEntriesForTest( t, config, "", a).EntryMap["LOCAL_INSTALLED_MODULE_STEM"] if !reflect.DeepEqual(actualValues, expectedValues) { t.Errorf("Incorrect LOCAL_INSTALLED_MODULE_STEM value '%s', expected '%s'", actualValues, expectedValues) } } } func TestStl(t *testing.T) { ctx, _ := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+` cc_library { Loading