Merge "AndroidMkEntries() returns multiple AndroidMkEntries structs"

This commit is contained in:
Treehugger Robot 2019-12-12 03:23:06 +00:00 committed by Gerrit Code Review
commit 8ce3c2c8df
17 changed files with 116 additions and 108 deletions

View File

@ -61,7 +61,7 @@ type AndroidMkExtraFunc func(w io.Writer, outputFile Path)
// Allows modules to customize their Android*.mk output.
type AndroidMkEntriesProvider interface {
AndroidMkEntries() AndroidMkEntries
AndroidMkEntries() []AndroidMkEntries
BaseModuleName() string
}
@ -510,10 +510,10 @@ func translateAndroidMkEntriesModule(ctx SingletonContext, w io.Writer, mod blue
return nil
}
entries := provider.AndroidMkEntries()
entries.fillInEntries(ctx.Config(), ctx.BlueprintFile(mod), mod)
entries.write(w)
for _, entries := range provider.AndroidMkEntries() {
entries.fillInEntries(ctx.Config(), ctx.BlueprintFile(mod), mod)
entries.write(w)
}
return nil
}

View File

@ -165,12 +165,12 @@ func (p *PrebuiltEtc) GenerateAndroidBuildActions(ctx ModuleContext) {
})
}
func (p *PrebuiltEtc) AndroidMkEntries() AndroidMkEntries {
func (p *PrebuiltEtc) AndroidMkEntries() []AndroidMkEntries {
nameSuffix := ""
if p.inRecovery() && !p.onlyInRecovery() {
nameSuffix = ".recovery"
}
return AndroidMkEntries{
return []AndroidMkEntries{AndroidMkEntries{
Class: "ETC",
SubName: nameSuffix,
OutputFile: OptionalPathForPath(p.outputFilePath),
@ -187,7 +187,7 @@ func (p *PrebuiltEtc) AndroidMkEntries() AndroidMkEntries {
}
},
},
}
}}
}
func InitPrebuiltEtcModule(p *PrebuiltEtc, dirBase string) {

View File

@ -142,7 +142,7 @@ func TestPrebuiltEtcAndroidMk(t *testing.T) {
}
mod := ctx.ModuleForTests("foo", "android_arm64_armv8-a_core").Module().(*PrebuiltEtc)
entries := AndroidMkEntriesForTest(t, config, "", mod)
entries := AndroidMkEntriesForTest(t, config, "", mod)[0]
for k, expectedValue := range expected {
if value, ok := entries.EntryMap[k]; ok {
if !reflect.DeepEqual(value, expectedValue) {

View File

@ -135,8 +135,8 @@ func (s *ShBinary) GenerateAndroidBuildActions(ctx ModuleContext) {
})
}
func (s *ShBinary) AndroidMkEntries() AndroidMkEntries {
return AndroidMkEntries{
func (s *ShBinary) AndroidMkEntries() []AndroidMkEntries {
return []AndroidMkEntries{AndroidMkEntries{
Class: "EXECUTABLES",
OutputFile: OptionalPathForPath(s.outputFilePath),
Include: "$(BUILD_SYSTEM)/soong_cc_prebuilt.mk",
@ -145,7 +145,7 @@ func (s *ShBinary) AndroidMkEntries() AndroidMkEntries {
s.customAndroidMkEntries(entries)
},
},
}
}}
}
func (s *ShBinary) customAndroidMkEntries(entries *AndroidMkEntries) {
@ -163,8 +163,8 @@ func (s *ShTest) GenerateAndroidBuildActions(ctx ModuleContext) {
s.data = PathsForModuleSrc(ctx, s.testProperties.Data)
}
func (s *ShTest) AndroidMkEntries() AndroidMkEntries {
return AndroidMkEntries{
func (s *ShTest) AndroidMkEntries() []AndroidMkEntries {
return []AndroidMkEntries{AndroidMkEntries{
Class: "NATIVE_TESTS",
OutputFile: OptionalPathForPath(s.outputFilePath),
Include: "$(BUILD_SYSTEM)/soong_cc_prebuilt.mk",
@ -185,7 +185,7 @@ func (s *ShTest) AndroidMkEntries() AndroidMkEntries {
}
},
},
}
}}
}
func InitShBinaryModule(s *ShBinary) {

View File

@ -42,7 +42,7 @@ func TestShTestTestData(t *testing.T) {
mod := ctx.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*ShTest)
entries := AndroidMkEntriesForTest(t, config, "", mod)
entries := AndroidMkEntriesForTest(t, config, "", mod)[0]
expected := []string{":testdata/data1", ":testdata/sub/data2"}
actual := entries.EntryMap["LOCAL_TEST_DATA"]
if !reflect.DeepEqual(expected, actual) {

View File

@ -403,15 +403,18 @@ func CheckErrorsAgainstExpectations(t *testing.T, errs []error, expectedErrorPat
}
func AndroidMkEntriesForTest(t *testing.T, config Config, bpPath string, mod blueprint.Module) AndroidMkEntries {
func AndroidMkEntriesForTest(t *testing.T, config Config, bpPath string, mod blueprint.Module) []AndroidMkEntries {
var p AndroidMkEntriesProvider
var ok bool
if p, ok = mod.(AndroidMkEntriesProvider); !ok {
t.Errorf("module does not implement AndroidMkEntriesProvider: " + mod.Name())
}
entries := p.AndroidMkEntries()
entries.fillInEntries(config, bpPath, mod)
return entries
entriesList := p.AndroidMkEntries()
for i, _ := range entriesList {
entriesList[i].fillInEntries(config, bpPath, mod)
}
return entriesList
}
func AndroidMkDataForTest(t *testing.T, config Config, bpPath string, mod blueprint.Module) AndroidMkData {

View File

@ -2380,7 +2380,7 @@ func TestPrebuiltOverrides(t *testing.T) {
p := ctx.ModuleForTests("myapex.prebuilt", "android_common").Module().(*Prebuilt)
expected := []string{"myapex"}
actual := android.AndroidMkEntriesForTest(t, config, "", p).EntryMap["LOCAL_OVERRIDES_MODULES"]
actual := android.AndroidMkEntriesForTest(t, config, "", p)[0].EntryMap["LOCAL_OVERRIDES_MODULES"]
if !reflect.DeepEqual(actual, expected) {
t.Errorf("Incorrect LOCAL_OVERRIDES_MODULES value '%s', expected '%s'", actual, expected)
}

View File

@ -181,8 +181,8 @@ func (p *Prebuilt) GenerateAndroidBuildActions(ctx android.ModuleContext) {
// TODO(b/143192278): Add compat symlinks for prebuilt_apex
}
func (p *Prebuilt) AndroidMkEntries() android.AndroidMkEntries {
return android.AndroidMkEntries{
func (p *Prebuilt) AndroidMkEntries() []android.AndroidMkEntries {
return []android.AndroidMkEntries{android.AndroidMkEntries{
Class: "ETC",
OutputFile: android.OptionalPathForPath(p.inputApex),
Include: "$(BUILD_PREBUILT)",
@ -194,5 +194,5 @@ func (p *Prebuilt) AndroidMkEntries() android.AndroidMkEntries {
entries.AddStrings("LOCAL_OVERRIDES_MODULES", p.properties.Overrides...)
},
},
}
}}
}

View File

@ -421,7 +421,7 @@ func TestVndkLibrariesTxtAndroidMk(t *testing.T) {
}`, config)
module := ctx.ModuleForTests("llndk.libraries.txt", "")
entries := android.AndroidMkEntriesForTest(t, config, "", module.Module())
entries := android.AndroidMkEntriesForTest(t, config, "", module.Module())[0]
assertArrayString(t, entries.EntryMap["LOCAL_MODULE_STEM"], []string{"llndk.libraries.VER.txt"})
}

View File

@ -460,8 +460,8 @@ func (txt *vndkLibrariesTxt) GenerateAndroidBuildActions(ctx android.ModuleConte
ctx.InstallFile(installPath, filename, txt.outputFile)
}
func (txt *vndkLibrariesTxt) AndroidMkEntries() android.AndroidMkEntries {
return android.AndroidMkEntries{
func (txt *vndkLibrariesTxt) AndroidMkEntries() []android.AndroidMkEntries {
return []android.AndroidMkEntries{android.AndroidMkEntries{
Class: "ETC",
OutputFile: android.OptionalPathForPath(txt.outputFile),
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
@ -469,7 +469,7 @@ func (txt *vndkLibrariesTxt) AndroidMkEntries() android.AndroidMkEntries {
entries.SetString("LOCAL_MODULE_STEM", txt.outputFile.Base())
},
},
}
}}
}
func (txt *vndkLibrariesTxt) OutputFile() android.OutputPath {

View File

@ -22,8 +22,6 @@ import (
"android/soong/android"
)
// TODO(jungjw): We'll probably want AndroidMkEntriesProvider.AndroidMkEntries to return multiple
// entries so that this can be more error-proof.
func (library *Library) AndroidMkHostDex(w io.Writer, name string, entries *android.AndroidMkEntries) {
if Bool(library.deviceProperties.Hostdex) && !library.Host() {
fmt.Fprintln(w, "include $(CLEAR_VARS)")
@ -57,13 +55,13 @@ func (library *Library) AndroidMkHostDex(w io.Writer, name string, entries *andr
}
}
func (library *Library) AndroidMkEntries() android.AndroidMkEntries {
func (library *Library) AndroidMkEntries() []android.AndroidMkEntries {
if !library.IsForPlatform() {
return android.AndroidMkEntries{
return []android.AndroidMkEntries{android.AndroidMkEntries{
Disabled: true,
}
}}
}
return android.AndroidMkEntries{
return []android.AndroidMkEntries{android.AndroidMkEntries{
Class: "JAVA_LIBRARIES",
OutputFile: android.OptionalPathForPath(library.outputFile),
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
@ -111,7 +109,7 @@ func (library *Library) AndroidMkEntries() android.AndroidMkEntries {
library.AndroidMkHostDex(w, name, entries)
},
},
}
}}
}
// Called for modules that are a component of a test suite.
@ -124,8 +122,9 @@ func testSuiteComponent(entries *android.AndroidMkEntries, test_suites []string)
}
}
func (j *Test) AndroidMkEntries() android.AndroidMkEntries {
entries := j.Library.AndroidMkEntries()
func (j *Test) AndroidMkEntries() []android.AndroidMkEntries {
entriesList := j.Library.AndroidMkEntries()
entries := &entriesList[0]
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
testSuiteComponent(entries, j.testProperties.Test_suites)
if j.testConfig != nil {
@ -134,25 +133,26 @@ func (j *Test) AndroidMkEntries() android.AndroidMkEntries {
androidMkWriteTestData(j.data, entries)
})
return entries
return entriesList
}
func (j *TestHelperLibrary) AndroidMkEntries() android.AndroidMkEntries {
entries := j.Library.AndroidMkEntries()
func (j *TestHelperLibrary) AndroidMkEntries() []android.AndroidMkEntries {
entriesList := j.Library.AndroidMkEntries()
entries := &entriesList[0]
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
testSuiteComponent(entries, j.testHelperLibraryProperties.Test_suites)
})
return entries
return entriesList
}
func (prebuilt *Import) AndroidMkEntries() android.AndroidMkEntries {
func (prebuilt *Import) AndroidMkEntries() []android.AndroidMkEntries {
if !prebuilt.IsForPlatform() || !prebuilt.ContainingSdk().Unversioned() {
return android.AndroidMkEntries{
return []android.AndroidMkEntries{android.AndroidMkEntries{
Disabled: true,
}
}}
}
return android.AndroidMkEntries{
return []android.AndroidMkEntries{android.AndroidMkEntries{
Class: "JAVA_LIBRARIES",
OutputFile: android.OptionalPathForPath(prebuilt.combinedClasspathFile),
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
@ -165,16 +165,16 @@ func (prebuilt *Import) AndroidMkEntries() android.AndroidMkEntries {
entries.SetString("LOCAL_MODULE_STEM", prebuilt.Stem())
},
},
}
}}
}
func (prebuilt *DexImport) AndroidMkEntries() android.AndroidMkEntries {
func (prebuilt *DexImport) AndroidMkEntries() []android.AndroidMkEntries {
if !prebuilt.IsForPlatform() {
return android.AndroidMkEntries{
return []android.AndroidMkEntries{android.AndroidMkEntries{
Disabled: true,
}
}}
}
return android.AndroidMkEntries{
return []android.AndroidMkEntries{android.AndroidMkEntries{
Class: "JAVA_LIBRARIES",
OutputFile: android.OptionalPathForPath(prebuilt.maybeStrippedDexJarFile),
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
@ -193,11 +193,11 @@ func (prebuilt *DexImport) AndroidMkEntries() android.AndroidMkEntries {
entries.SetString("LOCAL_MODULE_STEM", prebuilt.Stem())
},
},
}
}}
}
func (prebuilt *AARImport) AndroidMkEntries() android.AndroidMkEntries {
return android.AndroidMkEntries{
func (prebuilt *AARImport) AndroidMkEntries() []android.AndroidMkEntries {
return []android.AndroidMkEntries{android.AndroidMkEntries{
Class: "JAVA_LIBRARIES",
OutputFile: android.OptionalPathForPath(prebuilt.classpathFile),
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
@ -213,13 +213,13 @@ func (prebuilt *AARImport) AndroidMkEntries() android.AndroidMkEntries {
entries.SetString("LOCAL_SDK_VERSION", prebuilt.sdkVersion())
},
},
}
}}
}
func (binary *Binary) AndroidMkEntries() android.AndroidMkEntries {
func (binary *Binary) AndroidMkEntries() []android.AndroidMkEntries {
if !binary.isWrapperVariant {
return android.AndroidMkEntries{
return []android.AndroidMkEntries{android.AndroidMkEntries{
Class: "JAVA_LIBRARIES",
OutputFile: android.OptionalPathForPath(binary.outputFile),
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
@ -240,9 +240,9 @@ func (binary *Binary) AndroidMkEntries() android.AndroidMkEntries {
fmt.Fprintln(w, "jar_installed_module := $(LOCAL_INSTALLED_MODULE)")
},
},
}
}}
} else {
return android.AndroidMkEntries{
return []android.AndroidMkEntries{android.AndroidMkEntries{
Class: "EXECUTABLES",
OutputFile: android.OptionalPathForPath(binary.wrapperFile),
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
@ -257,17 +257,17 @@ func (binary *Binary) AndroidMkEntries() android.AndroidMkEntries {
fmt.Fprintln(w, "jar_installed_module :=")
},
},
}
}}
}
}
func (app *AndroidApp) AndroidMkEntries() android.AndroidMkEntries {
func (app *AndroidApp) AndroidMkEntries() []android.AndroidMkEntries {
if !app.IsForPlatform() {
return android.AndroidMkEntries{
return []android.AndroidMkEntries{android.AndroidMkEntries{
Disabled: true,
}
}}
}
return android.AndroidMkEntries{
return []android.AndroidMkEntries{android.AndroidMkEntries{
Class: "APPS",
OutputFile: android.OptionalPathForPath(app.outputFile),
Include: "$(BUILD_SYSTEM)/soong_app_prebuilt.mk",
@ -359,7 +359,7 @@ func (app *AndroidApp) AndroidMkEntries() android.AndroidMkEntries {
}
},
},
}
}}
}
func (a *AndroidApp) getOverriddenPackages() []string {
@ -373,8 +373,9 @@ func (a *AndroidApp) getOverriddenPackages() []string {
return overridden
}
func (a *AndroidTest) AndroidMkEntries() android.AndroidMkEntries {
entries := a.AndroidApp.AndroidMkEntries()
func (a *AndroidTest) AndroidMkEntries() []android.AndroidMkEntries {
entriesList := a.AndroidApp.AndroidMkEntries()
entries := &entriesList[0]
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
testSuiteComponent(entries, a.testProperties.Test_suites)
if a.testConfig != nil {
@ -383,20 +384,22 @@ func (a *AndroidTest) AndroidMkEntries() android.AndroidMkEntries {
androidMkWriteTestData(a.data, entries)
})
return entries
return entriesList
}
func (a *AndroidTestHelperApp) AndroidMkEntries() android.AndroidMkEntries {
entries := a.AndroidApp.AndroidMkEntries()
func (a *AndroidTestHelperApp) AndroidMkEntries() []android.AndroidMkEntries {
entriesList := a.AndroidApp.AndroidMkEntries()
entries := &entriesList[0]
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
testSuiteComponent(entries, a.appTestHelperAppProperties.Test_suites)
})
return entries
return entriesList
}
func (a *AndroidLibrary) AndroidMkEntries() android.AndroidMkEntries {
entries := a.Library.AndroidMkEntries()
func (a *AndroidLibrary) AndroidMkEntries() []android.AndroidMkEntries {
entriesList := a.Library.AndroidMkEntries()
entries := &entriesList[0]
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
if a.aarFile != nil {
@ -417,11 +420,11 @@ func (a *AndroidLibrary) AndroidMkEntries() android.AndroidMkEntries {
entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", true)
})
return entries
return entriesList
}
func (jd *Javadoc) AndroidMkEntries() android.AndroidMkEntries {
return android.AndroidMkEntries{
func (jd *Javadoc) AndroidMkEntries() []android.AndroidMkEntries {
return []android.AndroidMkEntries{android.AndroidMkEntries{
Class: "JAVA_LIBRARIES",
OutputFile: android.OptionalPathForPath(jd.stubsSrcJar),
Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk",
@ -435,11 +438,11 @@ func (jd *Javadoc) AndroidMkEntries() android.AndroidMkEntries {
}
},
},
}
}}
}
func (ddoc *Droiddoc) AndroidMkEntries() android.AndroidMkEntries {
return android.AndroidMkEntries{
func (ddoc *Droiddoc) AndroidMkEntries() []android.AndroidMkEntries {
return []android.AndroidMkEntries{android.AndroidMkEntries{
Class: "JAVA_LIBRARIES",
OutputFile: android.OptionalPathForPath(ddoc.stubsSrcJar),
Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk",
@ -520,11 +523,11 @@ func (ddoc *Droiddoc) AndroidMkEntries() android.AndroidMkEntries {
}
},
},
}
}}
}
func (dstubs *Droidstubs) AndroidMkEntries() android.AndroidMkEntries {
return android.AndroidMkEntries{
func (dstubs *Droidstubs) AndroidMkEntries() []android.AndroidMkEntries {
return []android.AndroidMkEntries{android.AndroidMkEntries{
Class: "JAVA_LIBRARIES",
OutputFile: android.OptionalPathForPath(dstubs.stubsSrcJar),
Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk",
@ -636,11 +639,11 @@ func (dstubs *Droidstubs) AndroidMkEntries() android.AndroidMkEntries {
}
},
},
}
}}
}
func (a *AndroidAppImport) AndroidMkEntries() android.AndroidMkEntries {
return android.AndroidMkEntries{
func (a *AndroidAppImport) AndroidMkEntries() []android.AndroidMkEntries {
return []android.AndroidMkEntries{android.AndroidMkEntries{
Class: "APPS",
OutputFile: android.OptionalPathForPath(a.outputFile),
Include: "$(BUILD_SYSTEM)/soong_app_prebuilt.mk",
@ -659,16 +662,17 @@ func (a *AndroidAppImport) AndroidMkEntries() android.AndroidMkEntries {
entries.AddStrings("LOCAL_INSTALLED_MODULE_STEM", a.installPath.Rel())
},
},
}
}}
}
func (a *AndroidTestImport) AndroidMkEntries() android.AndroidMkEntries {
entries := a.AndroidAppImport.AndroidMkEntries()
func (a *AndroidTestImport) AndroidMkEntries() []android.AndroidMkEntries {
entriesList := a.AndroidAppImport.AndroidMkEntries()
entries := &entriesList[0]
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
testSuiteComponent(entries, a.testProperties.Test_suites)
androidMkWriteTestData(a.data, entries)
})
return entries
return entriesList
}
func androidMkWriteTestData(data android.Paths, entries *android.AndroidMkEntries) {

View File

@ -31,7 +31,7 @@ func TestRequired(t *testing.T) {
`)
mod := ctx.ModuleForTests("foo", "android_common").Module()
entries := android.AndroidMkEntriesForTest(t, config, "", mod)
entries := android.AndroidMkEntriesForTest(t, config, "", mod)[0]
expected := []string{"libfoo"}
actual := entries.EntryMap["LOCAL_REQUIRED_MODULES"]
@ -50,7 +50,7 @@ func TestHostdex(t *testing.T) {
`)
mod := ctx.ModuleForTests("foo", "android_common").Module()
entries := android.AndroidMkEntriesForTest(t, config, "", mod)
entries := android.AndroidMkEntriesForTest(t, config, "", mod)[0]
expected := []string{"foo"}
actual := entries.EntryMap["LOCAL_MODULE"]
@ -75,7 +75,7 @@ func TestHostdexRequired(t *testing.T) {
`)
mod := ctx.ModuleForTests("foo", "android_common").Module()
entries := android.AndroidMkEntriesForTest(t, config, "", mod)
entries := android.AndroidMkEntriesForTest(t, config, "", mod)[0]
expected := []string{"libfoo"}
actual := entries.EntryMap["LOCAL_REQUIRED_MODULES"]
@ -104,7 +104,7 @@ func TestHostdexSpecificRequired(t *testing.T) {
`)
mod := ctx.ModuleForTests("foo", "android_common").Module()
entries := android.AndroidMkEntriesForTest(t, config, "", mod)
entries := android.AndroidMkEntriesForTest(t, config, "", mod)[0]
if r, ok := entries.EntryMap["LOCAL_REQUIRED_MODULES"]; ok {
t.Errorf("Unexpected required modules: %q", r)

View File

@ -1529,7 +1529,7 @@ func TestAndroidAppImport_Filename(t *testing.T) {
a := variant.Module().(*AndroidAppImport)
expectedValues := []string{test.expected}
actualValues := android.AndroidMkEntriesForTest(
t, config, "", a).EntryMap["LOCAL_INSTALLED_MODULE_STEM"]
t, config, "", a)[0].EntryMap["LOCAL_INSTALLED_MODULE_STEM"]
if !reflect.DeepEqual(actualValues, expectedValues) {
t.Errorf("Incorrect LOCAL_INSTALLED_MODULE_STEM value '%s', expected '%s'",
actualValues, expectedValues)
@ -1615,7 +1615,7 @@ func TestAndroidTestImport(t *testing.T) {
test := ctx.ModuleForTests("foo", "android_common").Module().(*AndroidTestImport)
// Check android mks.
entries := android.AndroidMkEntriesForTest(t, config, "", test)
entries := android.AndroidMkEntriesForTest(t, config, "", test)[0]
expected := []string{"tests"}
actual := entries.EntryMap["LOCAL_MODULE_TAGS"]
if !reflect.DeepEqual(expected, actual) {

View File

@ -71,8 +71,8 @@ func (p *platformCompatConfig) GenerateAndroidBuildActions(ctx android.ModuleCon
}
func (p *platformCompatConfig) AndroidMkEntries() android.AndroidMkEntries {
return android.AndroidMkEntries{
func (p *platformCompatConfig) AndroidMkEntries() []android.AndroidMkEntries {
return []android.AndroidMkEntries{android.AndroidMkEntries{
Class: "ETC",
OutputFile: android.OptionalPathForPath(p.configFile),
Include: "$(BUILD_PREBUILT)",
@ -82,7 +82,7 @@ func (p *platformCompatConfig) AndroidMkEntries() android.AndroidMkEntries {
entries.SetString("LOCAL_INSTALLED_MODULE_STEM", p.configFile.Base())
},
},
}
}}
}
func platformCompatConfigFactory() android.Module {

View File

@ -158,8 +158,9 @@ func (r *robolectricTest) generateRoboSrcJar(ctx android.ModuleContext, outputFi
TransformResourcesToJar(ctx, outputFile, srcJarArgs, srcJarDeps)
}
func (r *robolectricTest) AndroidMkEntries() android.AndroidMkEntries {
entries := r.Library.AndroidMkEntries()
func (r *robolectricTest) AndroidMkEntries() []android.AndroidMkEntries {
entriesList := r.Library.AndroidMkEntries()
entries := &entriesList[0]
entries.ExtraFooters = []android.AndroidMkExtraFootersFunc{
func(w io.Writer, name, prefix, moduleDir string, entries *android.AndroidMkEntries) {
@ -185,7 +186,7 @@ func (r *robolectricTest) AndroidMkEntries() android.AndroidMkEntries {
},
}
return entries
return entriesList
}
func (r *robolectricTest) writeTestRunner(w io.Writer, module, name string, tests []string) {

View File

@ -194,13 +194,13 @@ func (module *SdkLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext)
})
}
func (module *SdkLibrary) AndroidMkEntries() android.AndroidMkEntries {
entries := module.Library.AndroidMkEntries()
func (module *SdkLibrary) AndroidMkEntries() []android.AndroidMkEntries {
entriesList := module.Library.AndroidMkEntries()
entries := &entriesList[0]
entries.Required = append(entries.Required, module.xmlFileName())
entries.ExtraFooters = []android.AndroidMkExtraFootersFunc{
func(w io.Writer, name, prefix, moduleDir string, entries *android.AndroidMkEntries) {
module.Library.AndroidMkHostDex(w, name, entries)
if !Bool(module.sdkLibraryProperties.No_dist) {
// Create a phony module that installs the impl library, for the case when this lib is
// in PRODUCT_PACKAGES.
@ -252,7 +252,7 @@ func (module *SdkLibrary) AndroidMkEntries() android.AndroidMkEntries {
}
},
}
return entries
return entriesList
}
// Module name of the stubs library

View File

@ -163,12 +163,12 @@ func (s *sdk) GenerateAndroidBuildActions(ctx android.ModuleContext) {
}
}
func (s *sdk) AndroidMkEntries() android.AndroidMkEntries {
func (s *sdk) AndroidMkEntries() []android.AndroidMkEntries {
if !s.snapshotFile.Valid() {
return android.AndroidMkEntries{}
return []android.AndroidMkEntries{}
}
return android.AndroidMkEntries{
return []android.AndroidMkEntries{android.AndroidMkEntries{
Class: "FAKE",
OutputFile: s.snapshotFile,
DistFile: s.snapshotFile,
@ -180,7 +180,7 @@ func (s *sdk) AndroidMkEntries() android.AndroidMkEntries {
fmt.Fprintln(w, s.Name()+":", s.snapshotFile.String())
},
},
}
}}
}
// RegisterPreDepsMutators registers pre-deps mutators to support modules implementing SdkAware