Merge changes I6f116385,Id77f514d,I73479de1,If58f4b53 into main
* changes: Convert ModuleProvder to generic providers API Convert OtherModuleProvider to generic providers API Convert Provider to generic providers API Convert SetProvider to generic providers API
This commit is contained in:
@@ -134,16 +134,13 @@ func (module *DeclarationsModule) GenerateAndroidBuildActions(ctx android.Module
|
|||||||
// Get the values that came from the global RELEASE_ACONFIG_VALUE_SETS flag
|
// Get the values that came from the global RELEASE_ACONFIG_VALUE_SETS flag
|
||||||
valuesFiles := make([]android.Path, 0)
|
valuesFiles := make([]android.Path, 0)
|
||||||
ctx.VisitDirectDeps(func(dep android.Module) {
|
ctx.VisitDirectDeps(func(dep android.Module) {
|
||||||
if !ctx.OtherModuleHasProvider(dep, valueSetProviderKey) {
|
if depData, ok := android.OtherModuleProvider(ctx, dep, valueSetProviderKey); ok {
|
||||||
// Other modules get injected as dependencies too, for example the license modules
|
paths, ok := depData.AvailablePackages[module.properties.Package]
|
||||||
return
|
if ok {
|
||||||
}
|
valuesFiles = append(valuesFiles, paths...)
|
||||||
depData := ctx.OtherModuleProvider(dep, valueSetProviderKey).(valueSetProviderData)
|
for _, path := range paths {
|
||||||
paths, ok := depData.AvailablePackages[module.properties.Package]
|
module.properties.Values = append(module.properties.Values, path.String())
|
||||||
if ok {
|
}
|
||||||
valuesFiles = append(valuesFiles, paths...)
|
|
||||||
for _, path := range paths {
|
|
||||||
module.properties.Values = append(module.properties.Values, path.String())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -177,7 +174,7 @@ func (module *DeclarationsModule) GenerateAndroidBuildActions(ctx android.Module
|
|||||||
Description: "aconfig_text",
|
Description: "aconfig_text",
|
||||||
})
|
})
|
||||||
|
|
||||||
ctx.SetProvider(DeclarationsProviderKey, DeclarationsProviderData{
|
android.SetProvider(ctx, DeclarationsProviderKey, DeclarationsProviderData{
|
||||||
Package: module.properties.Package,
|
Package: module.properties.Package,
|
||||||
Container: module.properties.Container,
|
Container: module.properties.Container,
|
||||||
IntermediateCacheOutputPath: intermediateCacheFilePath,
|
IntermediateCacheOutputPath: intermediateCacheFilePath,
|
||||||
@@ -190,11 +187,11 @@ func CollectDependencyAconfigFiles(ctx android.ModuleContext, mergedAconfigFiles
|
|||||||
*mergedAconfigFiles = make(map[string]android.Paths)
|
*mergedAconfigFiles = make(map[string]android.Paths)
|
||||||
}
|
}
|
||||||
ctx.VisitDirectDeps(func(module android.Module) {
|
ctx.VisitDirectDeps(func(module android.Module) {
|
||||||
if dep := ctx.OtherModuleProvider(module, DeclarationsProviderKey).(DeclarationsProviderData); dep.IntermediateCacheOutputPath != nil {
|
if dep, _ := android.OtherModuleProvider(ctx, module, DeclarationsProviderKey); dep.IntermediateCacheOutputPath != nil {
|
||||||
(*mergedAconfigFiles)[dep.Container] = append((*mergedAconfigFiles)[dep.Container], dep.IntermediateCacheOutputPath)
|
(*mergedAconfigFiles)[dep.Container] = append((*mergedAconfigFiles)[dep.Container], dep.IntermediateCacheOutputPath)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if dep := ctx.OtherModuleProvider(module, TransitiveDeclarationsInfoProvider).(TransitiveDeclarationsInfo); len(dep.AconfigFiles) > 0 {
|
if dep, _ := android.OtherModuleProvider(ctx, module, TransitiveDeclarationsInfoProvider); len(dep.AconfigFiles) > 0 {
|
||||||
for container, v := range dep.AconfigFiles {
|
for container, v := range dep.AconfigFiles {
|
||||||
(*mergedAconfigFiles)[container] = append((*mergedAconfigFiles)[container], v...)
|
(*mergedAconfigFiles)[container] = append((*mergedAconfigFiles)[container], v...)
|
||||||
}
|
}
|
||||||
@@ -205,7 +202,7 @@ func CollectDependencyAconfigFiles(ctx android.ModuleContext, mergedAconfigFiles
|
|||||||
(*mergedAconfigFiles)[container] = mergeAconfigFiles(ctx, aconfigFiles)
|
(*mergedAconfigFiles)[container] = mergeAconfigFiles(ctx, aconfigFiles)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.SetProvider(TransitiveDeclarationsInfoProvider, TransitiveDeclarationsInfo{
|
android.SetProvider(ctx, TransitiveDeclarationsInfoProvider, TransitiveDeclarationsInfo{
|
||||||
AconfigFiles: *mergedAconfigFiles,
|
AconfigFiles: *mergedAconfigFiles,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@@ -38,7 +38,7 @@ func TestAconfigDeclarations(t *testing.T) {
|
|||||||
module := result.ModuleForTests("module_name", "").Module().(*DeclarationsModule)
|
module := result.ModuleForTests("module_name", "").Module().(*DeclarationsModule)
|
||||||
|
|
||||||
// Check that the provider has the right contents
|
// Check that the provider has the right contents
|
||||||
depData := result.ModuleProvider(module, DeclarationsProviderKey).(DeclarationsProviderData)
|
depData, _ := android.SingletonModuleProvider(result, module, DeclarationsProviderKey)
|
||||||
android.AssertStringEquals(t, "package", depData.Package, "com.example.package")
|
android.AssertStringEquals(t, "package", depData.Package, "com.example.package")
|
||||||
android.AssertStringEquals(t, "container", depData.Container, "com.android.foo")
|
android.AssertStringEquals(t, "container", depData.Container, "com.android.foo")
|
||||||
if !strings.HasSuffix(depData.IntermediateCacheOutputPath.String(), "/intermediate.pb") {
|
if !strings.HasSuffix(depData.IntermediateCacheOutputPath.String(), "/intermediate.pb") {
|
||||||
|
@@ -73,18 +73,14 @@ func (module *ValueSetModule) GenerateAndroidBuildActions(ctx android.ModuleCont
|
|||||||
// to append values to their aconfig actions.
|
// to append values to their aconfig actions.
|
||||||
packages := make(map[string]android.Paths)
|
packages := make(map[string]android.Paths)
|
||||||
ctx.VisitDirectDeps(func(dep android.Module) {
|
ctx.VisitDirectDeps(func(dep android.Module) {
|
||||||
if !ctx.OtherModuleHasProvider(dep, valuesProviderKey) {
|
if depData, ok := android.OtherModuleProvider(ctx, dep, valuesProviderKey); ok {
|
||||||
// Other modules get injected as dependencies too, for example the license modules
|
srcs := make([]android.Path, len(depData.Values))
|
||||||
return
|
copy(srcs, depData.Values)
|
||||||
|
packages[depData.Package] = srcs
|
||||||
}
|
}
|
||||||
depData := ctx.OtherModuleProvider(dep, valuesProviderKey).(valuesProviderData)
|
|
||||||
|
|
||||||
srcs := make([]android.Path, len(depData.Values))
|
|
||||||
copy(srcs, depData.Values)
|
|
||||||
packages[depData.Package] = srcs
|
|
||||||
|
|
||||||
})
|
})
|
||||||
ctx.SetProvider(valueSetProviderKey, valueSetProviderData{
|
android.SetProvider(ctx, valueSetProviderKey, valueSetProviderData{
|
||||||
AvailablePackages: packages,
|
AvailablePackages: packages,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@@ -38,6 +38,6 @@ func TestAconfigValueSet(t *testing.T) {
|
|||||||
module := result.ModuleForTests("module_name", "").Module().(*ValueSetModule)
|
module := result.ModuleForTests("module_name", "").Module().(*ValueSetModule)
|
||||||
|
|
||||||
// Check that the provider has the right contents
|
// Check that the provider has the right contents
|
||||||
depData := result.ModuleProvider(module, valueSetProviderKey).(valueSetProviderData)
|
depData, _ := android.SingletonModuleProvider(result, module, valueSetProviderKey)
|
||||||
android.AssertStringEquals(t, "AvailablePackages", "blah.aconfig_values", depData.AvailablePackages["foo.package"][0].String())
|
android.AssertStringEquals(t, "AvailablePackages", "blah.aconfig_values", depData.AvailablePackages["foo.package"][0].String())
|
||||||
}
|
}
|
||||||
|
@@ -64,5 +64,5 @@ func (module *ValuesModule) GenerateAndroidBuildActions(ctx android.ModuleContex
|
|||||||
Package: module.properties.Package,
|
Package: module.properties.Package,
|
||||||
Values: android.PathsForModuleSrc(ctx, module.properties.Srcs),
|
Values: android.PathsForModuleSrc(ctx, module.properties.Srcs),
|
||||||
}
|
}
|
||||||
ctx.SetProvider(valuesProviderKey, providerData)
|
android.SetProvider(ctx, valuesProviderKey, providerData)
|
||||||
}
|
}
|
||||||
|
@@ -33,7 +33,7 @@ func TestAconfigValues(t *testing.T) {
|
|||||||
module := result.ModuleForTests("module_name", "").Module().(*ValuesModule)
|
module := result.ModuleForTests("module_name", "").Module().(*ValuesModule)
|
||||||
|
|
||||||
// Check that the provider has the right contents
|
// Check that the provider has the right contents
|
||||||
depData := result.ModuleProvider(module, valuesProviderKey).(valuesProviderData)
|
depData, _ := android.SingletonModuleProvider(result, module, valuesProviderKey)
|
||||||
android.AssertStringEquals(t, "package", "foo.package", depData.Package)
|
android.AssertStringEquals(t, "package", "foo.package", depData.Package)
|
||||||
android.AssertPathsEndWith(t, "srcs", []string{"blah.aconfig_values"}, depData.Values)
|
android.AssertPathsEndWith(t, "srcs", []string{"blah.aconfig_values"}, depData.Values)
|
||||||
}
|
}
|
||||||
|
@@ -37,10 +37,10 @@ func (this *allAconfigDeclarationsSingleton) GenerateBuildActions(ctx android.Si
|
|||||||
// Find all of the aconfig_declarations modules
|
// Find all of the aconfig_declarations modules
|
||||||
var cacheFiles android.Paths
|
var cacheFiles android.Paths
|
||||||
ctx.VisitAllModules(func(module android.Module) {
|
ctx.VisitAllModules(func(module android.Module) {
|
||||||
if !ctx.ModuleHasProvider(module, DeclarationsProviderKey) {
|
decl, ok := android.SingletonModuleProvider(ctx, module, DeclarationsProviderKey)
|
||||||
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
decl := ctx.ModuleProvider(module, DeclarationsProviderKey).(DeclarationsProviderData)
|
|
||||||
cacheFiles = append(cacheFiles, decl.IntermediateCacheOutputPath)
|
cacheFiles = append(cacheFiles, decl.IntermediateCacheOutputPath)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@@ -92,7 +92,7 @@ func (this *CcAconfigLibraryCallbacks) GeneratorSources(ctx cc.ModuleContext) cc
|
|||||||
if len(declarationsModules) != 1 {
|
if len(declarationsModules) != 1 {
|
||||||
panic(fmt.Errorf("Exactly one aconfig_declarations property required"))
|
panic(fmt.Errorf("Exactly one aconfig_declarations property required"))
|
||||||
}
|
}
|
||||||
declarations := ctx.OtherModuleProvider(declarationsModules[0], aconfig.DeclarationsProviderKey).(aconfig.DeclarationsProviderData)
|
declarations, _ := android.OtherModuleProvider(ctx, declarationsModules[0], aconfig.DeclarationsProviderKey)
|
||||||
|
|
||||||
// Figure out the generated file paths. This has to match aconfig's codegen_cpp.rs.
|
// Figure out the generated file paths. This has to match aconfig's codegen_cpp.rs.
|
||||||
this.generatedDir = android.PathForModuleGen(ctx)
|
this.generatedDir = android.PathForModuleGen(ctx)
|
||||||
@@ -122,7 +122,7 @@ func (this *CcAconfigLibraryCallbacks) GeneratorBuildActions(ctx cc.ModuleContex
|
|||||||
if len(declarationsModules) != 1 {
|
if len(declarationsModules) != 1 {
|
||||||
panic(fmt.Errorf("Exactly one aconfig_declarations property required"))
|
panic(fmt.Errorf("Exactly one aconfig_declarations property required"))
|
||||||
}
|
}
|
||||||
declarations := ctx.OtherModuleProvider(declarationsModules[0], aconfig.DeclarationsProviderKey).(aconfig.DeclarationsProviderData)
|
declarations, _ := android.OtherModuleProvider(ctx, declarationsModules[0], aconfig.DeclarationsProviderKey)
|
||||||
|
|
||||||
mode := proptools.StringDefault(this.properties.Mode, "production")
|
mode := proptools.StringDefault(this.properties.Mode, "production")
|
||||||
if !isModeSupported(mode) {
|
if !isModeSupported(mode) {
|
||||||
|
@@ -74,7 +74,7 @@ func (callbacks *JavaAconfigDeclarationsLibraryCallbacks) GenerateSourceJarBuild
|
|||||||
if len(declarationsModules) != 1 {
|
if len(declarationsModules) != 1 {
|
||||||
panic(fmt.Errorf("Exactly one aconfig_declarations property required"))
|
panic(fmt.Errorf("Exactly one aconfig_declarations property required"))
|
||||||
}
|
}
|
||||||
declarations := ctx.OtherModuleProvider(declarationsModules[0], aconfig.DeclarationsProviderKey).(aconfig.DeclarationsProviderData)
|
declarations, _ := android.OtherModuleProvider(ctx, declarationsModules[0], aconfig.DeclarationsProviderKey)
|
||||||
|
|
||||||
// Generate the action to build the srcjar
|
// Generate the action to build the srcjar
|
||||||
srcJarPath := android.PathForModuleGen(ctx, ctx.ModuleName()+".srcjar")
|
srcJarPath := android.PathForModuleGen(ctx, ctx.ModuleName()+".srcjar")
|
||||||
|
@@ -65,7 +65,7 @@ func (a *aconfigDecorator) GenerateSource(ctx rust.ModuleContext, deps rust.Path
|
|||||||
if len(declarationsModules) != 1 {
|
if len(declarationsModules) != 1 {
|
||||||
panic(fmt.Errorf("Exactly one aconfig_declarations property required"))
|
panic(fmt.Errorf("Exactly one aconfig_declarations property required"))
|
||||||
}
|
}
|
||||||
declarations := ctx.OtherModuleProvider(declarationsModules[0], aconfig.DeclarationsProviderKey).(aconfig.DeclarationsProviderData)
|
declarations, _ := android.OtherModuleProvider(ctx, declarationsModules[0], aconfig.DeclarationsProviderKey)
|
||||||
|
|
||||||
mode := proptools.StringDefault(a.Properties.Mode, "production")
|
mode := proptools.StringDefault(a.Properties.Mode, "production")
|
||||||
if !isModeSupported(mode) {
|
if !isModeSupported(mode) {
|
||||||
|
@@ -30,10 +30,10 @@ func (this *exportedJavaDeclarationsLibrarySingleton) GenerateBuildActions(ctx a
|
|||||||
// Find all of the aconfig_declarations modules
|
// Find all of the aconfig_declarations modules
|
||||||
var cacheFiles android.Paths
|
var cacheFiles android.Paths
|
||||||
ctx.VisitAllModules(func(module android.Module) {
|
ctx.VisitAllModules(func(module android.Module) {
|
||||||
if !ctx.ModuleHasProvider(module, DeclarationsProviderKey) {
|
decl, ok := android.SingletonModuleProvider(ctx, module, DeclarationsProviderKey)
|
||||||
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
decl := ctx.ModuleProvider(module, DeclarationsProviderKey).(DeclarationsProviderData)
|
|
||||||
cacheFiles = append(cacheFiles, decl.IntermediateCacheOutputPath)
|
cacheFiles = append(cacheFiles, decl.IntermediateCacheOutputPath)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@@ -99,14 +99,13 @@ func (lib *AidlLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
includeDirsDepSetBuilder.Direct(includeDir)
|
includeDirsDepSetBuilder.Direct(includeDir)
|
||||||
|
|
||||||
for _, dep := range ctx.GetDirectDepsWithTag(aidlLibraryTag) {
|
for _, dep := range ctx.GetDirectDepsWithTag(aidlLibraryTag) {
|
||||||
if ctx.OtherModuleHasProvider(dep, AidlLibraryProvider) {
|
if info, ok := android.OtherModuleProvider(ctx, dep, AidlLibraryProvider); ok {
|
||||||
info := ctx.OtherModuleProvider(dep, AidlLibraryProvider).(AidlLibraryInfo)
|
|
||||||
includeDirsDepSetBuilder.Transitive(&info.IncludeDirs)
|
includeDirsDepSetBuilder.Transitive(&info.IncludeDirs)
|
||||||
hdrsDepSetBuilder.Transitive(&info.Hdrs)
|
hdrsDepSetBuilder.Transitive(&info.Hdrs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.SetProvider(AidlLibraryProvider, AidlLibraryInfo{
|
android.SetProvider(ctx, AidlLibraryProvider, AidlLibraryInfo{
|
||||||
Srcs: srcs,
|
Srcs: srcs,
|
||||||
IncludeDirs: *includeDirsDepSetBuilder.Build(),
|
IncludeDirs: *includeDirsDepSetBuilder.Build(),
|
||||||
Hdrs: *hdrsDepSetBuilder.Build(),
|
Hdrs: *hdrsDepSetBuilder.Build(),
|
||||||
|
@@ -46,7 +46,7 @@ func TestAidlLibrary(t *testing.T) {
|
|||||||
).RunTest(t).TestContext
|
).RunTest(t).TestContext
|
||||||
|
|
||||||
foo := ctx.ModuleForTests("foo", "").Module().(*AidlLibrary)
|
foo := ctx.ModuleForTests("foo", "").Module().(*AidlLibrary)
|
||||||
actualInfo := ctx.ModuleProvider(foo, AidlLibraryProvider).(AidlLibraryInfo)
|
actualInfo, _ := android.SingletonModuleProvider(ctx, foo, AidlLibraryProvider)
|
||||||
|
|
||||||
android.AssertArrayString(
|
android.AssertArrayString(
|
||||||
t,
|
t,
|
||||||
@@ -95,7 +95,7 @@ func TestAidlLibraryWithoutStripImportPrefix(t *testing.T) {
|
|||||||
).RunTest(t).TestContext
|
).RunTest(t).TestContext
|
||||||
|
|
||||||
foo := ctx.ModuleForTests("foo", "").Module().(*AidlLibrary)
|
foo := ctx.ModuleForTests("foo", "").Module().(*AidlLibrary)
|
||||||
actualInfo := ctx.ModuleProvider(foo, AidlLibraryProvider).(AidlLibraryInfo)
|
actualInfo, _ := android.SingletonModuleProvider(ctx, foo, AidlLibraryProvider)
|
||||||
|
|
||||||
android.AssertArrayString(
|
android.AssertArrayString(
|
||||||
t,
|
t,
|
||||||
|
@@ -492,8 +492,6 @@ type fillInEntriesContext interface {
|
|||||||
ModuleDir(module blueprint.Module) string
|
ModuleDir(module blueprint.Module) string
|
||||||
ModuleSubDir(module blueprint.Module) string
|
ModuleSubDir(module blueprint.Module) string
|
||||||
Config() Config
|
Config() Config
|
||||||
ModuleProvider(module blueprint.Module, provider blueprint.AnyProviderKey) any
|
|
||||||
ModuleHasProvider(module blueprint.Module, provider blueprint.AnyProviderKey) bool
|
|
||||||
moduleProvider(module blueprint.Module, provider blueprint.AnyProviderKey) (any, bool)
|
moduleProvider(module blueprint.Module, provider blueprint.AnyProviderKey) (any, bool)
|
||||||
ModuleType(module blueprint.Module) string
|
ModuleType(module blueprint.Module) string
|
||||||
}
|
}
|
||||||
@@ -624,8 +622,7 @@ func (a *AndroidMkEntries) fillInEntries(ctx fillInEntriesContext, mod blueprint
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.ModuleHasProvider(mod, LicenseMetadataProvider) {
|
if licenseMetadata, ok := SingletonModuleProvider(ctx, mod, LicenseMetadataProvider); ok {
|
||||||
licenseMetadata := ctx.ModuleProvider(mod, LicenseMetadataProvider).(*LicenseMetadataInfo)
|
|
||||||
a.SetPath("LOCAL_SOONG_LICENSE_METADATA", licenseMetadata.LicenseMetadataPath)
|
a.SetPath("LOCAL_SOONG_LICENSE_METADATA", licenseMetadata.LicenseMetadataPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -119,7 +119,7 @@ func (a *allApexContributions) SetPrebuiltSelectionInfoProvider(ctx BaseModuleCo
|
|||||||
ctx.ModuleErrorf("%s is not an apex_contributions module\n", child.Name())
|
ctx.ModuleErrorf("%s is not an apex_contributions module\n", child.Name())
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
ctx.SetProvider(PrebuiltSelectionInfoProvider, p)
|
SetProvider(ctx, PrebuiltSelectionInfoProvider, p)
|
||||||
}
|
}
|
||||||
|
|
||||||
// A provider containing metadata about whether source or prebuilt should be used
|
// A provider containing metadata about whether source or prebuilt should be used
|
||||||
|
@@ -150,7 +150,7 @@ type RequiresFilesFromPrebuiltApexTag interface {
|
|||||||
func FindDeapexerProviderForModule(ctx ModuleContext) *DeapexerInfo {
|
func FindDeapexerProviderForModule(ctx ModuleContext) *DeapexerInfo {
|
||||||
var di *DeapexerInfo
|
var di *DeapexerInfo
|
||||||
ctx.VisitDirectDepsWithTag(DeapexerTag, func(m Module) {
|
ctx.VisitDirectDepsWithTag(DeapexerTag, func(m Module) {
|
||||||
c := ctx.OtherModuleProvider(m, DeapexerProvider).(DeapexerInfo)
|
c, _ := OtherModuleProvider(ctx, m, DeapexerProvider)
|
||||||
p := &c
|
p := &c
|
||||||
if di != nil {
|
if di != nil {
|
||||||
// If two DeapexerInfo providers have been found then check if they are
|
// If two DeapexerInfo providers have been found then check if they are
|
||||||
@@ -167,7 +167,7 @@ func FindDeapexerProviderForModule(ctx ModuleContext) *DeapexerInfo {
|
|||||||
if di != nil {
|
if di != nil {
|
||||||
return di
|
return di
|
||||||
}
|
}
|
||||||
ai := ctx.Provider(ApexInfoProvider).(ApexInfo)
|
ai, _ := ModuleProvider(ctx, ApexInfoProvider)
|
||||||
ctx.ModuleErrorf("No prebuilt APEX provides a deapexer module for APEX variant %s", ai.ApexVariationName)
|
ctx.ModuleErrorf("No prebuilt APEX provides a deapexer module for APEX variant %s", ai.ApexVariationName)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@@ -92,7 +92,7 @@ func (fg *fileGroup) GenerateAndroidBuildActions(ctx ModuleContext) {
|
|||||||
if fg.properties.Path != nil {
|
if fg.properties.Path != nil {
|
||||||
fg.srcs = PathsWithModuleSrcSubDir(ctx, fg.srcs, String(fg.properties.Path))
|
fg.srcs = PathsWithModuleSrcSubDir(ctx, fg.srcs, String(fg.properties.Path))
|
||||||
}
|
}
|
||||||
ctx.SetProvider(blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: fg.srcs.Strings()})
|
SetProvider(ctx, blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: fg.srcs.Strings()})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fg *fileGroup) Srcs() Paths {
|
func (fg *fileGroup) Srcs() Paths {
|
||||||
|
@@ -78,8 +78,7 @@ func buildLicenseMetadata(ctx ModuleContext, licenseMetadataFile WritablePath) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.OtherModuleHasProvider(dep, LicenseMetadataProvider) {
|
if info, ok := OtherModuleProvider(ctx, dep, LicenseMetadataProvider); ok {
|
||||||
info := ctx.OtherModuleProvider(dep, LicenseMetadataProvider).(*LicenseMetadataInfo)
|
|
||||||
allDepMetadataFiles = append(allDepMetadataFiles, info.LicenseMetadataPath)
|
allDepMetadataFiles = append(allDepMetadataFiles, info.LicenseMetadataPath)
|
||||||
if isContainer || isInstallDepNeeded(dep, ctx.OtherModuleDependencyTag(dep)) {
|
if isContainer || isInstallDepNeeded(dep, ctx.OtherModuleDependencyTag(dep)) {
|
||||||
allDepMetadataDepSets = append(allDepMetadataDepSets, info.LicenseMetadataDepSet)
|
allDepMetadataDepSets = append(allDepMetadataDepSets, info.LicenseMetadataDepSet)
|
||||||
@@ -175,7 +174,7 @@ func buildLicenseMetadata(ctx ModuleContext, licenseMetadataFile WritablePath) {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
ctx.SetProvider(LicenseMetadataProvider, &LicenseMetadataInfo{
|
SetProvider(ctx, LicenseMetadataProvider, &LicenseMetadataInfo{
|
||||||
LicenseMetadataPath: licenseMetadataFile,
|
LicenseMetadataPath: licenseMetadataFile,
|
||||||
LicenseMetadataDepSet: NewDepSet(TOPOLOGICAL, Paths{licenseMetadataFile}, allDepMetadataDepSets),
|
LicenseMetadataDepSet: NewDepSet(TOPOLOGICAL, Paths{licenseMetadataFile}, allDepMetadataDepSets),
|
||||||
})
|
})
|
||||||
|
@@ -230,7 +230,7 @@ func licensesPropertyFlattener(ctx ModuleContext) {
|
|||||||
licenseInfo := LicenseInfo{
|
licenseInfo := LicenseInfo{
|
||||||
Licenses: licenses,
|
Licenses: licenses,
|
||||||
}
|
}
|
||||||
ctx.SetProvider(LicenseInfoProvider, licenseInfo)
|
SetProvider(ctx, LicenseInfoProvider, licenseInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update a property string array with a distinct union of its values and a list of new values.
|
// Update a property string array with a distinct union of its values and a list of new values.
|
||||||
|
@@ -92,7 +92,6 @@ type MakeVarsContext interface {
|
|||||||
ModuleDir(module blueprint.Module) string
|
ModuleDir(module blueprint.Module) string
|
||||||
ModuleSubDir(module blueprint.Module) string
|
ModuleSubDir(module blueprint.Module) string
|
||||||
ModuleType(module blueprint.Module) string
|
ModuleType(module blueprint.Module) string
|
||||||
ModuleProvider(module blueprint.Module, key blueprint.AnyProviderKey) any
|
|
||||||
moduleProvider(module blueprint.Module, key blueprint.AnyProviderKey) (any, bool)
|
moduleProvider(module blueprint.Module, key blueprint.AnyProviderKey) (any, bool)
|
||||||
BlueprintFile(module blueprint.Module) string
|
BlueprintFile(module blueprint.Module) string
|
||||||
|
|
||||||
|
@@ -1648,7 +1648,7 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
|
|||||||
if !ctx.PrimaryArch() {
|
if !ctx.PrimaryArch() {
|
||||||
suffix = append(suffix, ctx.Arch().ArchType.String())
|
suffix = append(suffix, ctx.Arch().ArchType.String())
|
||||||
}
|
}
|
||||||
if apexInfo := ctx.Provider(ApexInfoProvider).(ApexInfo); !apexInfo.IsForPlatform() {
|
if apexInfo, _ := ModuleProvider(ctx, ApexInfoProvider); !apexInfo.IsForPlatform() {
|
||||||
suffix = append(suffix, apexInfo.ApexVariationName)
|
suffix = append(suffix, apexInfo.ApexVariationName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -461,8 +461,8 @@ func PrebuiltSelectModuleMutator(ctx BottomUpMutatorContext) {
|
|||||||
// Propagate the provider received from `all_apex_contributions`
|
// Propagate the provider received from `all_apex_contributions`
|
||||||
// to the source module
|
// to the source module
|
||||||
ctx.VisitDirectDepsWithTag(acDepTag, func(am Module) {
|
ctx.VisitDirectDepsWithTag(acDepTag, func(am Module) {
|
||||||
psi := ctx.OtherModuleProvider(am, PrebuiltSelectionInfoProvider).(PrebuiltSelectionInfoMap)
|
psi, _ := OtherModuleProvider(ctx, am, PrebuiltSelectionInfoProvider)
|
||||||
ctx.SetProvider(PrebuiltSelectionInfoProvider, psi)
|
SetProvider(ctx, PrebuiltSelectionInfoProvider, psi)
|
||||||
})
|
})
|
||||||
|
|
||||||
} else if s, ok := ctx.Module().(Module); ok {
|
} else if s, ok := ctx.Module().(Module); ok {
|
||||||
@@ -548,9 +548,7 @@ func (p *Prebuilt) usePrebuilt(ctx BaseMutatorContext, source Module, prebuilt M
|
|||||||
// Use `all_apex_contributions` for source vs prebuilt selection.
|
// Use `all_apex_contributions` for source vs prebuilt selection.
|
||||||
psi := PrebuiltSelectionInfoMap{}
|
psi := PrebuiltSelectionInfoMap{}
|
||||||
ctx.VisitDirectDepsWithTag(PrebuiltDepTag, func(am Module) {
|
ctx.VisitDirectDepsWithTag(PrebuiltDepTag, func(am Module) {
|
||||||
if ctx.OtherModuleHasProvider(am, PrebuiltSelectionInfoProvider) {
|
psi, _ = OtherModuleProvider(ctx, am, PrebuiltSelectionInfoProvider)
|
||||||
psi = ctx.OtherModuleProvider(am, PrebuiltSelectionInfoProvider).(PrebuiltSelectionInfoMap)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// If the source module is explicitly listed in the metadata module, use that
|
// If the source module is explicitly listed in the metadata module, use that
|
||||||
|
@@ -35,16 +35,6 @@ type SingletonContext interface {
|
|||||||
// Allows generating build actions for `referer` based on the metadata for `name` deferred until the singleton context.
|
// Allows generating build actions for `referer` based on the metadata for `name` deferred until the singleton context.
|
||||||
ModuleVariantsFromName(referer Module, name string) []Module
|
ModuleVariantsFromName(referer Module, name string) []Module
|
||||||
|
|
||||||
// ModuleProvider returns the value, if any, for the provider for a module. If the value for the
|
|
||||||
// provider was not set it returns the zero value of the type of the provider, which means the
|
|
||||||
// return value can always be type-asserted to the type of the provider. The return value should
|
|
||||||
// always be considered read-only. It panics if called before the appropriate mutator or
|
|
||||||
// GenerateBuildActions pass for the provider on the module.
|
|
||||||
ModuleProvider(module blueprint.Module, provider blueprint.AnyProviderKey) any
|
|
||||||
|
|
||||||
// ModuleHasProvider returns true if the provider for the given module has been set.
|
|
||||||
ModuleHasProvider(module blueprint.Module, provider blueprint.AnyProviderKey) bool
|
|
||||||
|
|
||||||
moduleProvider(module blueprint.Module, provider blueprint.AnyProviderKey) (any, bool)
|
moduleProvider(module blueprint.Module, provider blueprint.AnyProviderKey) (any, bool)
|
||||||
|
|
||||||
ModuleErrorf(module blueprint.Module, format string, args ...interface{})
|
ModuleErrorf(module blueprint.Module, format string, args ...interface{})
|
||||||
@@ -291,17 +281,6 @@ func (s *singletonContextAdaptor) ModuleVariantsFromName(referer Module, name st
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *singletonContextAdaptor) ModuleProvider(module blueprint.Module, provider blueprint.AnyProviderKey) any {
|
|
||||||
value, _ := s.SingletonContext.ModuleProvider(module, provider)
|
|
||||||
return value
|
|
||||||
}
|
|
||||||
|
|
||||||
// ModuleHasProvider returns true if the provider for the given module has been set.
|
|
||||||
func (s *singletonContextAdaptor) ModuleHasProvider(module blueprint.Module, provider blueprint.AnyProviderKey) bool {
|
|
||||||
_, ok := s.SingletonContext.ModuleProvider(module, provider)
|
|
||||||
return ok
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *singletonContextAdaptor) moduleProvider(module blueprint.Module, provider blueprint.AnyProviderKey) (any, bool) {
|
func (s *singletonContextAdaptor) moduleProvider(module blueprint.Module, provider blueprint.AnyProviderKey) (any, bool) {
|
||||||
return s.SingletonContext.ModuleProvider(module, provider)
|
return s.SingletonContext.ModuleProvider(module, provider)
|
||||||
}
|
}
|
||||||
|
26
apex/apex.go
26
apex/apex.go
@@ -1020,7 +1020,7 @@ func (a *apexBundle) ApexInfoMutator(mctx android.TopDownMutatorContext) {
|
|||||||
|
|
||||||
// The membership information is saved for later access
|
// The membership information is saved for later access
|
||||||
apexContents := android.NewApexContents(contents)
|
apexContents := android.NewApexContents(contents)
|
||||||
mctx.SetProvider(ApexBundleInfoProvider, ApexBundleInfo{
|
android.SetProvider(mctx, ApexBundleInfoProvider, ApexBundleInfo{
|
||||||
Contents: apexContents,
|
Contents: apexContents,
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -1058,7 +1058,7 @@ func (a *apexBundle) ApexInfoMutator(mctx android.TopDownMutatorContext) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if a.dynamic_common_lib_apex() {
|
if a.dynamic_common_lib_apex() {
|
||||||
mctx.SetProvider(DCLAInfoProvider, DCLAInfo{
|
android.SetProvider(mctx, DCLAInfoProvider, DCLAInfo{
|
||||||
ProvidedLibs: a.properties.Native_shared_libs,
|
ProvidedLibs: a.properties.Native_shared_libs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -1201,10 +1201,10 @@ func apexTestForMutator(mctx android.BottomUpMutatorContext) {
|
|||||||
if _, ok := mctx.Module().(android.ApexModule); ok {
|
if _, ok := mctx.Module().(android.ApexModule); ok {
|
||||||
var contents []*android.ApexContents
|
var contents []*android.ApexContents
|
||||||
for _, testFor := range mctx.GetDirectDepsWithTag(testForTag) {
|
for _, testFor := range mctx.GetDirectDepsWithTag(testForTag) {
|
||||||
abInfo := mctx.OtherModuleProvider(testFor, ApexBundleInfoProvider).(ApexBundleInfo)
|
abInfo, _ := android.OtherModuleProvider(mctx, testFor, ApexBundleInfoProvider)
|
||||||
contents = append(contents, abInfo.Contents)
|
contents = append(contents, abInfo.Contents)
|
||||||
}
|
}
|
||||||
mctx.SetProvider(android.ApexTestForInfoProvider, android.ApexTestForInfo{
|
android.SetProvider(mctx, android.ApexTestForInfoProvider, android.ApexTestForInfo{
|
||||||
ApexContents: contents,
|
ApexContents: contents,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -1465,7 +1465,7 @@ func (a *apexBundle) libs_to_trim(ctx android.ModuleContext) []string {
|
|||||||
panic(fmt.Errorf("expected exactly at most one dcla dependency, got %d", len(dclaModules)))
|
panic(fmt.Errorf("expected exactly at most one dcla dependency, got %d", len(dclaModules)))
|
||||||
}
|
}
|
||||||
if len(dclaModules) > 0 {
|
if len(dclaModules) > 0 {
|
||||||
DCLAInfo := ctx.OtherModuleProvider(dclaModules[0], DCLAInfoProvider).(DCLAInfo)
|
DCLAInfo, _ := android.OtherModuleProvider(ctx, dclaModules[0], DCLAInfoProvider)
|
||||||
return DCLAInfo.ProvidedLibs
|
return DCLAInfo.ProvidedLibs
|
||||||
}
|
}
|
||||||
return []string{}
|
return []string{}
|
||||||
@@ -1783,7 +1783,7 @@ func (a *apexBundle) WalkPayloadDeps(ctx android.ModuleContext, do android.Paylo
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
ai := ctx.OtherModuleProvider(child, android.ApexInfoProvider).(android.ApexInfo)
|
ai, _ := android.OtherModuleProvider(ctx, child, android.ApexInfoProvider)
|
||||||
externalDep := !android.InList(ctx.ModuleName(), ai.InApexVariants)
|
externalDep := !android.InList(ctx.ModuleName(), ai.InApexVariants)
|
||||||
|
|
||||||
// Visit actually
|
// Visit actually
|
||||||
@@ -2150,7 +2150,7 @@ func (a *apexBundle) depVisitor(vctx *visitorContext, ctx android.ModuleContext,
|
|||||||
af := apexFileForNativeLibrary(ctx, ch, vctx.handleSpecialLibs)
|
af := apexFileForNativeLibrary(ctx, ch, vctx.handleSpecialLibs)
|
||||||
af.transitiveDep = true
|
af.transitiveDep = true
|
||||||
|
|
||||||
abInfo := ctx.Provider(ApexBundleInfoProvider).(ApexBundleInfo)
|
abInfo, _ := android.ModuleProvider(ctx, ApexBundleInfoProvider)
|
||||||
if !abInfo.Contents.DirectlyInApex(depName) && (ch.IsStubs() || ch.HasStubsVariants()) {
|
if !abInfo.Contents.DirectlyInApex(depName) && (ch.IsStubs() || ch.HasStubsVariants()) {
|
||||||
// If the dependency is a stubs lib, don't include it in this APEX,
|
// If the dependency is a stubs lib, don't include it in this APEX,
|
||||||
// but make sure that the lib is installed on the device.
|
// but make sure that the lib is installed on the device.
|
||||||
@@ -2272,7 +2272,7 @@ func (a *apexBundle) depVisitor(vctx *visitorContext, ctx android.ModuleContext,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func addAconfigFiles(vctx *visitorContext, ctx android.ModuleContext, module blueprint.Module) {
|
func addAconfigFiles(vctx *visitorContext, ctx android.ModuleContext, module blueprint.Module) {
|
||||||
dep := ctx.OtherModuleProvider(module, aconfig.TransitiveDeclarationsInfoProvider).(aconfig.TransitiveDeclarationsInfo)
|
dep, _ := android.OtherModuleProvider(ctx, module, aconfig.TransitiveDeclarationsInfoProvider)
|
||||||
if len(dep.AconfigFiles) > 0 && dep.AconfigFiles[ctx.ModuleName()] != nil {
|
if len(dep.AconfigFiles) > 0 && dep.AconfigFiles[ctx.ModuleName()] != nil {
|
||||||
vctx.aconfigFiles = append(vctx.aconfigFiles, dep.AconfigFiles[ctx.ModuleName()]...)
|
vctx.aconfigFiles = append(vctx.aconfigFiles, dep.AconfigFiles[ctx.ModuleName()]...)
|
||||||
}
|
}
|
||||||
@@ -2376,7 +2376,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
// apexBootclasspathFragmentFiles returns the list of apexFile structures defining the files that
|
// apexBootclasspathFragmentFiles returns the list of apexFile structures defining the files that
|
||||||
// the bootclasspath_fragment contributes to the apex.
|
// the bootclasspath_fragment contributes to the apex.
|
||||||
func apexBootclasspathFragmentFiles(ctx android.ModuleContext, module blueprint.Module) []apexFile {
|
func apexBootclasspathFragmentFiles(ctx android.ModuleContext, module blueprint.Module) []apexFile {
|
||||||
bootclasspathFragmentInfo := ctx.OtherModuleProvider(module, java.BootclasspathFragmentApexContentInfoProvider).(java.BootclasspathFragmentApexContentInfo)
|
bootclasspathFragmentInfo, _ := android.OtherModuleProvider(ctx, module, java.BootclasspathFragmentApexContentInfoProvider)
|
||||||
var filesToAdd []apexFile
|
var filesToAdd []apexFile
|
||||||
|
|
||||||
// Add classpaths.proto config.
|
// Add classpaths.proto config.
|
||||||
@@ -2425,7 +2425,7 @@ func apexBootclasspathFragmentFiles(ctx android.ModuleContext, module blueprint.
|
|||||||
// apexClasspathFragmentProtoFile returns *apexFile structure defining the classpath.proto config that
|
// apexClasspathFragmentProtoFile returns *apexFile structure defining the classpath.proto config that
|
||||||
// the module contributes to the apex; or nil if the proto config was not generated.
|
// the module contributes to the apex; or nil if the proto config was not generated.
|
||||||
func apexClasspathFragmentProtoFile(ctx android.ModuleContext, module blueprint.Module) *apexFile {
|
func apexClasspathFragmentProtoFile(ctx android.ModuleContext, module blueprint.Module) *apexFile {
|
||||||
info := ctx.OtherModuleProvider(module, java.ClasspathFragmentProtoContentInfoProvider).(java.ClasspathFragmentProtoContentInfo)
|
info, _ := android.OtherModuleProvider(ctx, module, java.ClasspathFragmentProtoContentInfoProvider)
|
||||||
if !info.ClasspathFragmentProtoGenerated {
|
if !info.ClasspathFragmentProtoGenerated {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -2437,7 +2437,7 @@ func apexClasspathFragmentProtoFile(ctx android.ModuleContext, module blueprint.
|
|||||||
// apexFileForBootclasspathFragmentContentModule creates an apexFile for a bootclasspath_fragment
|
// apexFileForBootclasspathFragmentContentModule creates an apexFile for a bootclasspath_fragment
|
||||||
// content module, i.e. a library that is part of the bootclasspath.
|
// content module, i.e. a library that is part of the bootclasspath.
|
||||||
func apexFileForBootclasspathFragmentContentModule(ctx android.ModuleContext, fragmentModule blueprint.Module, javaModule javaModule) apexFile {
|
func apexFileForBootclasspathFragmentContentModule(ctx android.ModuleContext, fragmentModule blueprint.Module, javaModule javaModule) apexFile {
|
||||||
bootclasspathFragmentInfo := ctx.OtherModuleProvider(fragmentModule, java.BootclasspathFragmentApexContentInfoProvider).(java.BootclasspathFragmentApexContentInfo)
|
bootclasspathFragmentInfo, _ := android.OtherModuleProvider(ctx, fragmentModule, java.BootclasspathFragmentApexContentInfoProvider)
|
||||||
|
|
||||||
// Get the dexBootJar from the bootclasspath_fragment as that is responsible for performing the
|
// Get the dexBootJar from the bootclasspath_fragment as that is responsible for performing the
|
||||||
// hidden API encpding.
|
// hidden API encpding.
|
||||||
@@ -2589,7 +2589,7 @@ func (a *apexBundle) checkStaticLinkingToStubLibraries(ctx android.ModuleContext
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
abInfo := ctx.Provider(ApexBundleInfoProvider).(ApexBundleInfo)
|
abInfo, _ := android.ModuleProvider(ctx, ApexBundleInfoProvider)
|
||||||
|
|
||||||
a.WalkPayloadDeps(ctx, func(ctx android.ModuleContext, from blueprint.Module, to android.ApexModule, externalDep bool) bool {
|
a.WalkPayloadDeps(ctx, func(ctx android.ModuleContext, from blueprint.Module, to android.ApexModule, externalDep bool) bool {
|
||||||
if ccm, ok := to.(*cc.Module); ok {
|
if ccm, ok := to.(*cc.Module); ok {
|
||||||
@@ -2650,7 +2650,7 @@ func (a *apexBundle) checkUpdatable(ctx android.ModuleContext) {
|
|||||||
func (a *apexBundle) checkClasspathFragments(ctx android.ModuleContext) {
|
func (a *apexBundle) checkClasspathFragments(ctx android.ModuleContext) {
|
||||||
ctx.VisitDirectDeps(func(module android.Module) {
|
ctx.VisitDirectDeps(func(module android.Module) {
|
||||||
if tag := ctx.OtherModuleDependencyTag(module); tag == bcpfTag || tag == sscpfTag {
|
if tag := ctx.OtherModuleDependencyTag(module); tag == bcpfTag || tag == sscpfTag {
|
||||||
info := ctx.OtherModuleProvider(module, java.ClasspathFragmentProtoContentInfoProvider).(java.ClasspathFragmentProtoContentInfo)
|
info, _ := android.OtherModuleProvider(ctx, module, java.ClasspathFragmentProtoContentInfoProvider)
|
||||||
if !info.ClasspathFragmentProtoGenerated {
|
if !info.ClasspathFragmentProtoGenerated {
|
||||||
ctx.OtherModuleErrorf(module, "is included in updatable apex %v, it must not set generate_classpaths_proto to false", ctx.ModuleName())
|
ctx.OtherModuleErrorf(module, "is included in updatable apex %v, it must not set generate_classpaths_proto to false", ctx.ModuleName())
|
||||||
}
|
}
|
||||||
|
@@ -83,7 +83,7 @@ func (s *apexDepsInfoSingleton) GenerateBuildActions(ctx android.SingletonContex
|
|||||||
updatableFlatLists := android.Paths{}
|
updatableFlatLists := android.Paths{}
|
||||||
ctx.VisitAllModules(func(module android.Module) {
|
ctx.VisitAllModules(func(module android.Module) {
|
||||||
if binaryInfo, ok := module.(android.ApexBundleDepsInfoIntf); ok {
|
if binaryInfo, ok := module.(android.ApexBundleDepsInfoIntf); ok {
|
||||||
apexInfo := ctx.ModuleProvider(module, android.ApexInfoProvider).(android.ApexInfo)
|
apexInfo, _ := android.SingletonModuleProvider(ctx, module, android.ApexInfoProvider)
|
||||||
if path := binaryInfo.FlatListPath(); path != nil {
|
if path := binaryInfo.FlatListPath(); path != nil {
|
||||||
if binaryInfo.Updatable() || apexInfo.Updatable {
|
if binaryInfo.Updatable() || apexInfo.Updatable {
|
||||||
updatableFlatLists = append(updatableFlatLists, path)
|
updatableFlatLists = append(updatableFlatLists, path)
|
||||||
|
@@ -152,7 +152,7 @@ func TestBootclasspathFragments_FragmentDependency(t *testing.T) {
|
|||||||
|
|
||||||
// Check stub dex paths exported by art.
|
// Check stub dex paths exported by art.
|
||||||
artFragment := result.Module("art-bootclasspath-fragment", "android_common")
|
artFragment := result.Module("art-bootclasspath-fragment", "android_common")
|
||||||
artInfo := result.ModuleProvider(artFragment, java.HiddenAPIInfoProvider).(java.HiddenAPIInfo)
|
artInfo, _ := android.SingletonModuleProvider(result, artFragment, java.HiddenAPIInfoProvider)
|
||||||
|
|
||||||
bazPublicStubs := "out/soong/.intermediates/baz.stubs/android_common/dex/baz.stubs.jar"
|
bazPublicStubs := "out/soong/.intermediates/baz.stubs/android_common/dex/baz.stubs.jar"
|
||||||
bazSystemStubs := "out/soong/.intermediates/baz.stubs.system/android_common/dex/baz.stubs.system.jar"
|
bazSystemStubs := "out/soong/.intermediates/baz.stubs.system/android_common/dex/baz.stubs.system.jar"
|
||||||
@@ -165,7 +165,7 @@ func TestBootclasspathFragments_FragmentDependency(t *testing.T) {
|
|||||||
|
|
||||||
// Check stub dex paths exported by other.
|
// Check stub dex paths exported by other.
|
||||||
otherFragment := result.Module("other-bootclasspath-fragment", "android_common")
|
otherFragment := result.Module("other-bootclasspath-fragment", "android_common")
|
||||||
otherInfo := result.ModuleProvider(otherFragment, java.HiddenAPIInfoProvider).(java.HiddenAPIInfo)
|
otherInfo, _ := android.SingletonModuleProvider(result, otherFragment, java.HiddenAPIInfoProvider)
|
||||||
|
|
||||||
fooPublicStubs := "out/soong/.intermediates/foo.stubs/android_common/dex/foo.stubs.jar"
|
fooPublicStubs := "out/soong/.intermediates/foo.stubs/android_common/dex/foo.stubs.jar"
|
||||||
fooSystemStubs := "out/soong/.intermediates/foo.stubs.system/android_common/dex/foo.stubs.system.jar"
|
fooSystemStubs := "out/soong/.intermediates/foo.stubs.system/android_common/dex/foo.stubs.system.jar"
|
||||||
@@ -655,7 +655,7 @@ func TestBootclasspathFragmentContentsNoName(t *testing.T) {
|
|||||||
// Make sure that the fragment provides the hidden API encoded dex jars to the APEX.
|
// Make sure that the fragment provides the hidden API encoded dex jars to the APEX.
|
||||||
fragment := result.Module("mybootclasspathfragment", "android_common_apex10000")
|
fragment := result.Module("mybootclasspathfragment", "android_common_apex10000")
|
||||||
|
|
||||||
info := result.ModuleProvider(fragment, java.BootclasspathFragmentApexContentInfoProvider).(java.BootclasspathFragmentApexContentInfo)
|
info, _ := android.SingletonModuleProvider(result, fragment, java.BootclasspathFragmentApexContentInfoProvider)
|
||||||
|
|
||||||
checkFragmentExportedDexJar := func(name string, expectedDexJar string) {
|
checkFragmentExportedDexJar := func(name string, expectedDexJar string) {
|
||||||
module := result.Module(name, "android_common_apex10000")
|
module := result.Module(name, "android_common_apex10000")
|
||||||
|
@@ -20,7 +20,6 @@ import (
|
|||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
"android/soong/java"
|
"android/soong/java"
|
||||||
"github.com/google/blueprint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Contains tests for java.CreateClasspathElements logic from java/classpath_element.go that
|
// Contains tests for java.CreateClasspathElements logic from java/classpath_element.go that
|
||||||
@@ -28,19 +27,12 @@ import (
|
|||||||
|
|
||||||
// testClasspathElementContext is a ClasspathElementContext suitable for use in tests.
|
// testClasspathElementContext is a ClasspathElementContext suitable for use in tests.
|
||||||
type testClasspathElementContext struct {
|
type testClasspathElementContext struct {
|
||||||
|
android.OtherModuleProviderContext
|
||||||
testContext *android.TestContext
|
testContext *android.TestContext
|
||||||
module android.Module
|
module android.Module
|
||||||
errs []error
|
errs []error
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *testClasspathElementContext) OtherModuleHasProvider(module blueprint.Module, provider blueprint.AnyProviderKey) bool {
|
|
||||||
return t.testContext.ModuleHasProvider(module, provider)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *testClasspathElementContext) OtherModuleProvider(module blueprint.Module, provider blueprint.AnyProviderKey) interface{} {
|
|
||||||
return t.testContext.ModuleProvider(module, provider)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *testClasspathElementContext) ModuleErrorf(fmt string, args ...interface{}) {
|
func (t *testClasspathElementContext) ModuleErrorf(fmt string, args ...interface{}) {
|
||||||
t.errs = append(t.errs, t.testContext.ModuleErrorf(t.module, fmt, args...))
|
t.errs = append(t.errs, t.testContext.ModuleErrorf(t.module, fmt, args...))
|
||||||
}
|
}
|
||||||
@@ -238,7 +230,11 @@ func TestCreateClasspathElements(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
newCtx := func() *testClasspathElementContext {
|
newCtx := func() *testClasspathElementContext {
|
||||||
return &testClasspathElementContext{testContext: result.TestContext, module: bootclasspath}
|
return &testClasspathElementContext{
|
||||||
|
OtherModuleProviderContext: result.TestContext.OtherModuleProviderAdaptor(),
|
||||||
|
testContext: result.TestContext,
|
||||||
|
module: bootclasspath,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify that CreateClasspathElements works when given valid input.
|
// Verify that CreateClasspathElements works when given valid input.
|
||||||
|
@@ -127,7 +127,7 @@ func (p *Deapexer) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
if len(exports) > 0 {
|
if len(exports) > 0 {
|
||||||
// Make the information available for other modules.
|
// Make the information available for other modules.
|
||||||
di := android.NewDeapexerInfo(apexModuleName(ctx.ModuleName()), exports)
|
di := android.NewDeapexerInfo(apexModuleName(ctx.ModuleName()), exports)
|
||||||
ctx.SetProvider(android.DeapexerProvider, di)
|
android.SetProvider(ctx, android.DeapexerProvider, di)
|
||||||
|
|
||||||
// Create a sorted list of the files that this exports.
|
// Create a sorted list of the files that this exports.
|
||||||
exportedPaths = android.SortedUniquePaths(exportedPaths)
|
exportedPaths = android.SortedUniquePaths(exportedPaths)
|
||||||
|
@@ -152,7 +152,7 @@ func TestPlatformBootclasspath_Fragments(t *testing.T) {
|
|||||||
).RunTest(t)
|
).RunTest(t)
|
||||||
|
|
||||||
pbcp := result.Module("platform-bootclasspath", "android_common")
|
pbcp := result.Module("platform-bootclasspath", "android_common")
|
||||||
info := result.ModuleProvider(pbcp, java.MonolithicHiddenAPIInfoProvider).(java.MonolithicHiddenAPIInfo)
|
info, _ := android.SingletonModuleProvider(result, pbcp, java.MonolithicHiddenAPIInfoProvider)
|
||||||
|
|
||||||
for _, category := range java.HiddenAPIFlagFileCategories {
|
for _, category := range java.HiddenAPIFlagFileCategories {
|
||||||
name := category.PropertyName
|
name := category.PropertyName
|
||||||
@@ -234,7 +234,7 @@ func TestPlatformBootclasspath_LegacyPrebuiltFragment(t *testing.T) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
pbcp := result.Module("myplatform-bootclasspath", "android_common")
|
pbcp := result.Module("myplatform-bootclasspath", "android_common")
|
||||||
info := result.ModuleProvider(pbcp, java.MonolithicHiddenAPIInfoProvider).(java.MonolithicHiddenAPIInfo)
|
info, _ := android.SingletonModuleProvider(result, pbcp, java.MonolithicHiddenAPIInfoProvider)
|
||||||
|
|
||||||
android.AssertArrayString(t, "stub flags", []string{"prebuilt-stub-flags.csv:out/soong/.intermediates/mybootclasspath-fragment/android_common_myapex/modular-hiddenapi/signature-patterns.csv"}, info.StubFlagSubsets.RelativeToTop())
|
android.AssertArrayString(t, "stub flags", []string{"prebuilt-stub-flags.csv:out/soong/.intermediates/mybootclasspath-fragment/android_common_myapex/modular-hiddenapi/signature-patterns.csv"}, info.StubFlagSubsets.RelativeToTop())
|
||||||
android.AssertArrayString(t, "all flags", []string{"prebuilt-all-flags.csv:out/soong/.intermediates/mybootclasspath-fragment/android_common_myapex/modular-hiddenapi/signature-patterns.csv"}, info.FlagSubsets.RelativeToTop())
|
android.AssertArrayString(t, "all flags", []string{"prebuilt-all-flags.csv:out/soong/.intermediates/mybootclasspath-fragment/android_common_myapex/modular-hiddenapi/signature-patterns.csv"}, info.FlagSubsets.RelativeToTop())
|
||||||
|
@@ -428,7 +428,7 @@ func (p *prebuiltCommon) apexInfoMutator(mctx android.TopDownMutatorContext) {
|
|||||||
|
|
||||||
// Create contents for the prebuilt_apex and store it away for later use.
|
// Create contents for the prebuilt_apex and store it away for later use.
|
||||||
apexContents := android.NewApexContents(contents)
|
apexContents := android.NewApexContents(contents)
|
||||||
mctx.SetProvider(ApexBundleInfoProvider, ApexBundleInfo{
|
android.SetProvider(mctx, ApexBundleInfoProvider, ApexBundleInfo{
|
||||||
Contents: apexContents,
|
Contents: apexContents,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@@ -73,7 +73,7 @@ func MeasureSizeForPaths(ctx android.ModuleContext, paths ...android.OptionalPat
|
|||||||
mf.paths = append(mf.paths, p)
|
mf.paths = append(mf.paths, p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ctx.SetProvider(fileSizeMeasurerKey, mf)
|
android.SetProvider(ctx, fileSizeMeasurerKey, mf)
|
||||||
}
|
}
|
||||||
|
|
||||||
type sizesSingleton struct{}
|
type sizesSingleton struct{}
|
||||||
@@ -85,10 +85,10 @@ func fileSizesSingleton() android.Singleton {
|
|||||||
func (singleton *sizesSingleton) GenerateBuildActions(ctx android.SingletonContext) {
|
func (singleton *sizesSingleton) GenerateBuildActions(ctx android.SingletonContext) {
|
||||||
var deps android.Paths
|
var deps android.Paths
|
||||||
ctx.VisitAllModules(func(m android.Module) {
|
ctx.VisitAllModules(func(m android.Module) {
|
||||||
if !ctx.ModuleHasProvider(m, fileSizeMeasurerKey) {
|
filePaths, ok := android.SingletonModuleProvider(ctx, m, fileSizeMeasurerKey)
|
||||||
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
filePaths := ctx.ModuleProvider(m, fileSizeMeasurerKey).(measuredFiles)
|
|
||||||
for _, path := range filePaths.paths {
|
for _, path := range filePaths.paths {
|
||||||
filePath := path.(android.ModuleOutPath)
|
filePath := path.(android.ModuleOutPath)
|
||||||
sizeFile := filePath.InSameDir(ctx, filePath.Base()+bloatyDescriptorExt)
|
sizeFile := filePath.InSameDir(ctx, filePath.Base()+bloatyDescriptorExt)
|
||||||
|
@@ -203,7 +203,7 @@ func (bpf *bpf) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
ctx.SetProvider(blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: srcs.Strings()})
|
android.SetProvider(ctx, blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: srcs.Strings()})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bpf *bpf) AndroidMk() android.AndroidMkData {
|
func (bpf *bpf) AndroidMk() android.AndroidMkData {
|
||||||
|
@@ -137,8 +137,7 @@ func (c *Module) fdoProfileMutator(ctx android.BottomUpMutatorContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ctx.VisitDirectDepsWithTag(FdoProfileTag, func(m android.Module) {
|
ctx.VisitDirectDepsWithTag(FdoProfileTag, func(m android.Module) {
|
||||||
if ctx.OtherModuleHasProvider(m, FdoProfileProvider) {
|
if info, ok := android.OtherModuleProvider(ctx, m, FdoProfileProvider); ok {
|
||||||
info := ctx.OtherModuleProvider(m, FdoProfileProvider).(FdoProfileInfo)
|
|
||||||
c.afdo.Properties.FdoProfilePath = proptools.StringPtr(info.Path.String())
|
c.afdo.Properties.FdoProfilePath = proptools.StringPtr(info.Path.String())
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
56
cc/cc.go
56
cc/cc.go
@@ -1744,11 +1744,13 @@ func (ctx *moduleContextImpl) getVndkExtendsModuleName() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ctx *moduleContextImpl) isForPlatform() bool {
|
func (ctx *moduleContextImpl) isForPlatform() bool {
|
||||||
return ctx.ctx.Provider(android.ApexInfoProvider).(android.ApexInfo).IsForPlatform()
|
apexInfo, _ := android.ModuleProvider(ctx.ctx, android.ApexInfoProvider)
|
||||||
|
return apexInfo.IsForPlatform()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ctx *moduleContextImpl) apexVariationName() string {
|
func (ctx *moduleContextImpl) apexVariationName() string {
|
||||||
return ctx.ctx.Provider(android.ApexInfoProvider).(android.ApexInfo).ApexVariationName
|
apexInfo, _ := android.ModuleProvider(ctx.ctx, android.ApexInfoProvider)
|
||||||
|
return apexInfo.ApexVariationName
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ctx *moduleContextImpl) apexSdkVersion() android.ApiLevel {
|
func (ctx *moduleContextImpl) apexSdkVersion() android.ApiLevel {
|
||||||
@@ -1991,7 +1993,7 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
c.Properties.SubName = GetSubnameProperty(actx, c)
|
c.Properties.SubName = GetSubnameProperty(actx, c)
|
||||||
apexInfo := actx.Provider(android.ApexInfoProvider).(android.ApexInfo)
|
apexInfo, _ := android.ModuleProvider(actx, android.ApexInfoProvider)
|
||||||
if !apexInfo.IsForPlatform() {
|
if !apexInfo.IsForPlatform() {
|
||||||
c.hideApexVariantFromMake = true
|
c.hideApexVariantFromMake = true
|
||||||
}
|
}
|
||||||
@@ -2131,9 +2133,9 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if c.testModule {
|
if c.testModule {
|
||||||
ctx.SetProvider(testing.TestModuleProviderKey, testing.TestModuleProviderData{})
|
android.SetProvider(ctx, testing.TestModuleProviderKey, testing.TestModuleProviderData{})
|
||||||
}
|
}
|
||||||
ctx.SetProvider(blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: deps.GeneratedSources.Strings()})
|
android.SetProvider(ctx, blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: deps.GeneratedSources.Strings()})
|
||||||
|
|
||||||
aconfig.CollectDependencyAconfigFiles(ctx, &c.mergedAconfigFiles)
|
aconfig.CollectDependencyAconfigFiles(ctx, &c.mergedAconfigFiles)
|
||||||
|
|
||||||
@@ -2368,9 +2370,9 @@ func GetApiImports(c LinkableInterface, actx android.BottomUpMutatorContext) mul
|
|||||||
if actx.OtherModuleExists("api_imports") {
|
if actx.OtherModuleExists("api_imports") {
|
||||||
apiImportModule = actx.AddDependency(c, nil, "api_imports")
|
apiImportModule = actx.AddDependency(c, nil, "api_imports")
|
||||||
if len(apiImportModule) > 0 && apiImportModule[0] != nil {
|
if len(apiImportModule) > 0 && apiImportModule[0] != nil {
|
||||||
apiInfo := actx.OtherModuleProvider(apiImportModule[0], multitree.ApiImportsProvider).(multitree.ApiImportInfo)
|
apiInfo, _ := android.OtherModuleProvider(actx, apiImportModule[0], multitree.ApiImportsProvider)
|
||||||
apiImportInfo = apiInfo
|
apiImportInfo = apiInfo
|
||||||
actx.SetProvider(multitree.ApiImportsProvider, apiInfo)
|
android.SetProvider(actx, multitree.ApiImportsProvider, apiInfo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2391,10 +2393,10 @@ func GetSnapshot(c LinkableInterface, snapshotInfo **SnapshotInfo, actx android.
|
|||||||
snapshotModule = actx.AddVariationDependencies(nil, nil, "recovery_snapshot")
|
snapshotModule = actx.AddVariationDependencies(nil, nil, "recovery_snapshot")
|
||||||
}
|
}
|
||||||
if len(snapshotModule) > 0 && snapshotModule[0] != nil {
|
if len(snapshotModule) > 0 && snapshotModule[0] != nil {
|
||||||
snapshot := actx.OtherModuleProvider(snapshotModule[0], SnapshotInfoProvider).(SnapshotInfo)
|
snapshot, _ := android.OtherModuleProvider(actx, snapshotModule[0], SnapshotInfoProvider)
|
||||||
*snapshotInfo = &snapshot
|
*snapshotInfo = &snapshot
|
||||||
// republish the snapshot for use in later mutators on this module
|
// republish the snapshot for use in later mutators on this module
|
||||||
actx.SetProvider(SnapshotInfoProvider, snapshot)
|
android.SetProvider(actx, SnapshotInfoProvider, snapshot)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if *snapshotInfo == nil {
|
if *snapshotInfo == nil {
|
||||||
@@ -2982,7 +2984,7 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
depPaths.ReexportedGeneratedHeaders = append(depPaths.ReexportedGeneratedHeaders, exporter.GeneratedHeaders...)
|
depPaths.ReexportedGeneratedHeaders = append(depPaths.ReexportedGeneratedHeaders, exporter.GeneratedHeaders...)
|
||||||
}
|
}
|
||||||
|
|
||||||
apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
|
apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider)
|
||||||
c.apexSdkVersion = findApexSdkVersion(ctx, apexInfo)
|
c.apexSdkVersion = findApexSdkVersion(ctx, apexInfo)
|
||||||
|
|
||||||
skipModuleList := map[string]bool{}
|
skipModuleList := map[string]bool{}
|
||||||
@@ -2992,7 +2994,7 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
|
|
||||||
ctx.VisitDirectDeps(func(dep android.Module) {
|
ctx.VisitDirectDeps(func(dep android.Module) {
|
||||||
if dep.Name() == "api_imports" {
|
if dep.Name() == "api_imports" {
|
||||||
apiImportInfo = ctx.OtherModuleProvider(dep, multitree.ApiImportsProvider).(multitree.ApiImportInfo)
|
apiImportInfo, _ = android.OtherModuleProvider(ctx, dep, multitree.ApiImportsProvider)
|
||||||
hasApiImportInfo = true
|
hasApiImportInfo = true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -3043,12 +3045,10 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if depTag == aidlLibraryTag {
|
if depTag == aidlLibraryTag {
|
||||||
if ctx.OtherModuleHasProvider(dep, aidl_library.AidlLibraryProvider) {
|
if aidlLibraryInfo, ok := android.OtherModuleProvider(ctx, dep, aidl_library.AidlLibraryProvider); ok {
|
||||||
depPaths.AidlLibraryInfos = append(
|
depPaths.AidlLibraryInfos = append(
|
||||||
depPaths.AidlLibraryInfos,
|
depPaths.AidlLibraryInfos,
|
||||||
ctx.OtherModuleProvider(
|
aidlLibraryInfo,
|
||||||
dep,
|
|
||||||
aidl_library.AidlLibraryProvider).(aidl_library.AidlLibraryInfo),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3113,10 +3113,10 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
// version mutator, so the stubs variant is created from the shared variant that
|
// version mutator, so the stubs variant is created from the shared variant that
|
||||||
// already has the reuseObjTag dependency on the static variant.
|
// already has the reuseObjTag dependency on the static variant.
|
||||||
if !c.library.buildStubs() {
|
if !c.library.buildStubs() {
|
||||||
staticAnalogue := ctx.OtherModuleProvider(dep, StaticLibraryInfoProvider).(StaticLibraryInfo)
|
staticAnalogue, _ := android.OtherModuleProvider(ctx, dep, StaticLibraryInfoProvider)
|
||||||
objs := staticAnalogue.ReuseObjects
|
objs := staticAnalogue.ReuseObjects
|
||||||
depPaths.Objs = depPaths.Objs.Append(objs)
|
depPaths.Objs = depPaths.Objs.Append(objs)
|
||||||
depExporterInfo := ctx.OtherModuleProvider(dep, FlagExporterInfoProvider).(FlagExporterInfo)
|
depExporterInfo, _ := android.OtherModuleProvider(ctx, dep, FlagExporterInfoProvider)
|
||||||
reexportExporter(depExporterInfo)
|
reexportExporter(depExporterInfo)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
@@ -3137,7 +3137,7 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
depExporterInfo := ctx.OtherModuleProvider(dep, FlagExporterInfoProvider).(FlagExporterInfo)
|
depExporterInfo, _ := android.OtherModuleProvider(ctx, dep, FlagExporterInfoProvider)
|
||||||
|
|
||||||
var ptr *android.Paths
|
var ptr *android.Paths
|
||||||
var depPtr *android.Paths
|
var depPtr *android.Paths
|
||||||
@@ -3146,7 +3146,7 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
|
|
||||||
switch {
|
switch {
|
||||||
case libDepTag.header():
|
case libDepTag.header():
|
||||||
if !ctx.OtherModuleHasProvider(dep, HeaderLibraryInfoProvider) {
|
if _, isHeaderLib := android.OtherModuleProvider(ctx, dep, HeaderLibraryInfoProvider); !isHeaderLib {
|
||||||
if !ctx.Config().AllowMissingDependencies() {
|
if !ctx.Config().AllowMissingDependencies() {
|
||||||
ctx.ModuleErrorf("module %q is not a header library", depName)
|
ctx.ModuleErrorf("module %q is not a header library", depName)
|
||||||
} else {
|
} else {
|
||||||
@@ -3155,7 +3155,7 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
case libDepTag.shared():
|
case libDepTag.shared():
|
||||||
if !ctx.OtherModuleHasProvider(dep, SharedLibraryInfoProvider) {
|
if _, isSharedLib := android.OtherModuleProvider(ctx, dep, SharedLibraryInfoProvider); !isSharedLib {
|
||||||
if !ctx.Config().AllowMissingDependencies() {
|
if !ctx.Config().AllowMissingDependencies() {
|
||||||
ctx.ModuleErrorf("module %q is not a shared library", depName)
|
ctx.ModuleErrorf("module %q is not a shared library", depName)
|
||||||
} else {
|
} else {
|
||||||
@@ -3192,7 +3192,8 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
panic(fmt.Errorf("unexpected library dependency order %d", libDepTag.Order))
|
panic(fmt.Errorf("unexpected library dependency order %d", libDepTag.Order))
|
||||||
}
|
}
|
||||||
case libDepTag.static():
|
case libDepTag.static():
|
||||||
if !ctx.OtherModuleHasProvider(dep, StaticLibraryInfoProvider) {
|
staticLibraryInfo, isStaticLib := android.OtherModuleProvider(ctx, dep, StaticLibraryInfoProvider)
|
||||||
|
if !isStaticLib {
|
||||||
if !ctx.Config().AllowMissingDependencies() {
|
if !ctx.Config().AllowMissingDependencies() {
|
||||||
ctx.ModuleErrorf("module %q is not a static library", depName)
|
ctx.ModuleErrorf("module %q is not a static library", depName)
|
||||||
} else {
|
} else {
|
||||||
@@ -3207,7 +3208,6 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
staticLibraryInfo := ctx.OtherModuleProvider(dep, StaticLibraryInfoProvider).(StaticLibraryInfo)
|
|
||||||
linkFile = android.OptionalPathForPath(staticLibraryInfo.StaticLibrary)
|
linkFile = android.OptionalPathForPath(staticLibraryInfo.StaticLibrary)
|
||||||
if libDepTag.wholeStatic {
|
if libDepTag.wholeStatic {
|
||||||
ptr = &depPaths.WholeStaticLibs
|
ptr = &depPaths.WholeStaticLibs
|
||||||
@@ -3317,7 +3317,7 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
if lib.buildStubs() && dep.(android.ApexModule).InAnyApex() {
|
if lib.buildStubs() && dep.(android.ApexModule).InAnyApex() {
|
||||||
// Add the dependency to the APEX(es) providing the library so that
|
// Add the dependency to the APEX(es) providing the library so that
|
||||||
// m <module> can trigger building the APEXes as well.
|
// m <module> can trigger building the APEXes as well.
|
||||||
depApexInfo := ctx.OtherModuleProvider(dep, android.ApexInfoProvider).(android.ApexInfo)
|
depApexInfo, _ := android.OtherModuleProvider(ctx, dep, android.ApexInfoProvider)
|
||||||
for _, an := range depApexInfo.InApexVariants {
|
for _, an := range depApexInfo.InApexVariants {
|
||||||
c.Properties.ApexesProvidingSharedLibs = append(
|
c.Properties.ApexesProvidingSharedLibs = append(
|
||||||
c.Properties.ApexesProvidingSharedLibs, an)
|
c.Properties.ApexesProvidingSharedLibs, an)
|
||||||
@@ -3402,7 +3402,7 @@ func ShouldUseStubForApex(ctx android.ModuleContext, dep android.Module) bool {
|
|||||||
bootstrap = linkable.Bootstrap()
|
bootstrap = linkable.Bootstrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
|
apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider)
|
||||||
|
|
||||||
useStubs := false
|
useStubs := false
|
||||||
|
|
||||||
@@ -3436,7 +3436,7 @@ func ShouldUseStubForApex(ctx android.ModuleContext, dep android.Module) bool {
|
|||||||
// Another exception: if this module is a test for an APEX, then
|
// Another exception: if this module is a test for an APEX, then
|
||||||
// it is linked with the non-stub variant of a module in the APEX
|
// it is linked with the non-stub variant of a module in the APEX
|
||||||
// as if this is part of the APEX.
|
// as if this is part of the APEX.
|
||||||
testFor := ctx.Provider(android.ApexTestForInfoProvider).(android.ApexTestForInfo)
|
testFor, _ := android.ModuleProvider(ctx, android.ApexTestForInfoProvider)
|
||||||
for _, apexContents := range testFor.ApexContents {
|
for _, apexContents := range testFor.ApexContents {
|
||||||
if apexContents.DirectlyInApex(depName) {
|
if apexContents.DirectlyInApex(depName) {
|
||||||
useStubs = false
|
useStubs = false
|
||||||
@@ -3482,9 +3482,9 @@ func ChooseStubOrImpl(ctx android.ModuleContext, dep android.Module) (SharedLibr
|
|||||||
panic(fmt.Errorf("Unexpected dependency tag: %T", depTag))
|
panic(fmt.Errorf("Unexpected dependency tag: %T", depTag))
|
||||||
}
|
}
|
||||||
|
|
||||||
sharedLibraryInfo := ctx.OtherModuleProvider(dep, SharedLibraryInfoProvider).(SharedLibraryInfo)
|
sharedLibraryInfo, _ := android.OtherModuleProvider(ctx, dep, SharedLibraryInfoProvider)
|
||||||
depExporterInfo := ctx.OtherModuleProvider(dep, FlagExporterInfoProvider).(FlagExporterInfo)
|
depExporterInfo, _ := android.OtherModuleProvider(ctx, dep, FlagExporterInfoProvider)
|
||||||
sharedLibraryStubsInfo := ctx.OtherModuleProvider(dep, SharedLibraryStubsProvider).(SharedLibraryStubsInfo)
|
sharedLibraryStubsInfo, _ := android.OtherModuleProvider(ctx, dep, SharedLibraryStubsProvider)
|
||||||
|
|
||||||
if !libDepTag.explicitlyVersioned && len(sharedLibraryStubsInfo.SharedStubLibraries) > 0 {
|
if !libDepTag.explicitlyVersioned && len(sharedLibraryStubsInfo.SharedStubLibraries) > 0 {
|
||||||
// when to use (unspecified) stubs, use the latest one.
|
// when to use (unspecified) stubs, use the latest one.
|
||||||
|
@@ -2544,8 +2544,8 @@ func TestStaticLibDepReordering(t *testing.T) {
|
|||||||
|
|
||||||
variant := "android_arm64_armv8-a_static"
|
variant := "android_arm64_armv8-a_static"
|
||||||
moduleA := ctx.ModuleForTests("a", variant).Module().(*Module)
|
moduleA := ctx.ModuleForTests("a", variant).Module().(*Module)
|
||||||
actual := android.Paths(ctx.ModuleProvider(moduleA, StaticLibraryInfoProvider).(StaticLibraryInfo).
|
staticLibInfo, _ := android.SingletonModuleProvider(ctx, moduleA, StaticLibraryInfoProvider)
|
||||||
TransitiveStaticLibrariesForOrdering.ToList()).RelativeToTop()
|
actual := android.Paths(staticLibInfo.TransitiveStaticLibrariesForOrdering.ToList()).RelativeToTop()
|
||||||
expected := GetOutputPaths(ctx, variant, []string{"a", "c", "b", "d"})
|
expected := GetOutputPaths(ctx, variant, []string{"a", "c", "b", "d"})
|
||||||
|
|
||||||
if !reflect.DeepEqual(actual, expected) {
|
if !reflect.DeepEqual(actual, expected) {
|
||||||
@@ -2580,8 +2580,8 @@ func TestStaticLibDepReorderingWithShared(t *testing.T) {
|
|||||||
|
|
||||||
variant := "android_arm64_armv8-a_static"
|
variant := "android_arm64_armv8-a_static"
|
||||||
moduleA := ctx.ModuleForTests("a", variant).Module().(*Module)
|
moduleA := ctx.ModuleForTests("a", variant).Module().(*Module)
|
||||||
actual := android.Paths(ctx.ModuleProvider(moduleA, StaticLibraryInfoProvider).(StaticLibraryInfo).
|
staticLibInfo, _ := android.SingletonModuleProvider(ctx, moduleA, StaticLibraryInfoProvider)
|
||||||
TransitiveStaticLibrariesForOrdering.ToList()).RelativeToTop()
|
actual := android.Paths(staticLibInfo.TransitiveStaticLibrariesForOrdering.ToList()).RelativeToTop()
|
||||||
expected := GetOutputPaths(ctx, variant, []string{"a", "c", "b"})
|
expected := GetOutputPaths(ctx, variant, []string{"a", "c", "b"})
|
||||||
|
|
||||||
if !reflect.DeepEqual(actual, expected) {
|
if !reflect.DeepEqual(actual, expected) {
|
||||||
@@ -2681,7 +2681,7 @@ func TestLlndkLibrary(t *testing.T) {
|
|||||||
checkExportedIncludeDirs := func(module, variant string, expectedDirs ...string) {
|
checkExportedIncludeDirs := func(module, variant string, expectedDirs ...string) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
m := result.ModuleForTests(module, variant).Module()
|
m := result.ModuleForTests(module, variant).Module()
|
||||||
f := result.ModuleProvider(m, FlagExporterInfoProvider).(FlagExporterInfo)
|
f, _ := android.SingletonModuleProvider(result, m, FlagExporterInfoProvider)
|
||||||
android.AssertPathsRelativeToTopEquals(t, "exported include dirs for "+module+"["+variant+"]",
|
android.AssertPathsRelativeToTopEquals(t, "exported include dirs for "+module+"["+variant+"]",
|
||||||
expectedDirs, f.IncludeDirs)
|
expectedDirs, f.IncludeDirs)
|
||||||
}
|
}
|
||||||
@@ -4113,7 +4113,7 @@ func TestIncludeDirsExporting(t *testing.T) {
|
|||||||
|
|
||||||
checkIncludeDirs := func(t *testing.T, ctx *android.TestContext, module android.Module, checkers ...exportedChecker) {
|
checkIncludeDirs := func(t *testing.T, ctx *android.TestContext, module android.Module, checkers ...exportedChecker) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
exported := ctx.ModuleProvider(module, FlagExporterInfoProvider).(FlagExporterInfo)
|
exported, _ := android.SingletonModuleProvider(ctx, module, FlagExporterInfoProvider)
|
||||||
name := module.Name()
|
name := module.Name()
|
||||||
|
|
||||||
for _, checker := range checkers {
|
for _, checker := range checkers {
|
||||||
|
@@ -62,7 +62,7 @@ func (fp *fdoProfile) GenerateAndroidBuildActions(ctx android.ModuleContext) {}
|
|||||||
func (fp *fdoProfile) fdoProfileMutator(ctx android.BottomUpMutatorContext) {
|
func (fp *fdoProfile) fdoProfileMutator(ctx android.BottomUpMutatorContext) {
|
||||||
if fp.properties.Profile != nil {
|
if fp.properties.Profile != nil {
|
||||||
path := android.PathForModuleSrc(ctx, *fp.properties.Profile)
|
path := android.PathForModuleSrc(ctx, *fp.properties.Profile)
|
||||||
ctx.SetProvider(FdoProfileProvider, FdoProfileInfo{
|
android.SetProvider(ctx, FdoProfileProvider, FdoProfileInfo{
|
||||||
Path: path,
|
Path: path,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@@ -544,7 +544,8 @@ func CollectAllSharedDependencies(ctx android.ModuleContext) (android.RuleBuilde
|
|||||||
if !IsValidSharedDependency(dep) {
|
if !IsValidSharedDependency(dep) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !ctx.OtherModuleHasProvider(dep, SharedLibraryInfoProvider) {
|
sharedLibraryInfo, hasSharedLibraryInfo := android.OtherModuleProvider(ctx, dep, SharedLibraryInfoProvider)
|
||||||
|
if !hasSharedLibraryInfo {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if seen[ctx.OtherModuleName(dep)] {
|
if seen[ctx.OtherModuleName(dep)] {
|
||||||
@@ -553,7 +554,6 @@ func CollectAllSharedDependencies(ctx android.ModuleContext) (android.RuleBuilde
|
|||||||
seen[ctx.OtherModuleName(dep)] = true
|
seen[ctx.OtherModuleName(dep)] = true
|
||||||
deps = append(deps, dep)
|
deps = append(deps, dep)
|
||||||
|
|
||||||
sharedLibraryInfo := ctx.OtherModuleProvider(dep, SharedLibraryInfoProvider).(SharedLibraryInfo)
|
|
||||||
installDestination := sharedLibraryInfo.SharedLibrary.Base()
|
installDestination := sharedLibraryInfo.SharedLibrary.Base()
|
||||||
ruleBuilderInstall := android.RuleBuilderInstall{android.OutputFileForModule(ctx, dep, "unstripped"), installDestination}
|
ruleBuilderInstall := android.RuleBuilderInstall{android.OutputFileForModule(ctx, dep, "unstripped"), installDestination}
|
||||||
sharedLibraries = append(sharedLibraries, ruleBuilderInstall)
|
sharedLibraries = append(sharedLibraries, ruleBuilderInstall)
|
||||||
@@ -574,14 +574,14 @@ func CollectAllSharedDependencies(ctx android.ModuleContext) (android.RuleBuilde
|
|||||||
if !IsValidSharedDependency(child) {
|
if !IsValidSharedDependency(child) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if !ctx.OtherModuleHasProvider(child, SharedLibraryInfoProvider) {
|
sharedLibraryInfo, hasSharedLibraryInfo := android.OtherModuleProvider(ctx, child, SharedLibraryInfoProvider)
|
||||||
|
if !hasSharedLibraryInfo {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if !seen[ctx.OtherModuleName(child)] {
|
if !seen[ctx.OtherModuleName(child)] {
|
||||||
seen[ctx.OtherModuleName(child)] = true
|
seen[ctx.OtherModuleName(child)] = true
|
||||||
deps = append(deps, child)
|
deps = append(deps, child)
|
||||||
|
|
||||||
sharedLibraryInfo := ctx.OtherModuleProvider(child, SharedLibraryInfoProvider).(SharedLibraryInfo)
|
|
||||||
installDestination := sharedLibraryInfo.SharedLibrary.Base()
|
installDestination := sharedLibraryInfo.SharedLibrary.Base()
|
||||||
ruleBuilderInstall := android.RuleBuilderInstall{android.OutputFileForModule(ctx, child, "unstripped"), installDestination}
|
ruleBuilderInstall := android.RuleBuilderInstall{android.OutputFileForModule(ctx, child, "unstripped"), installDestination}
|
||||||
sharedLibraries = append(sharedLibraries, ruleBuilderInstall)
|
sharedLibraries = append(sharedLibraries, ruleBuilderInstall)
|
||||||
|
@@ -341,7 +341,7 @@ func (f *flagExporter) addExportedGeneratedHeaders(headers ...android.Path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (f *flagExporter) setProvider(ctx android.ModuleContext) {
|
func (f *flagExporter) setProvider(ctx android.ModuleContext) {
|
||||||
ctx.SetProvider(FlagExporterInfoProvider, FlagExporterInfo{
|
android.SetProvider(ctx, FlagExporterInfoProvider, FlagExporterInfo{
|
||||||
// Comes from Export_include_dirs property, and those of exported transitive deps
|
// Comes from Export_include_dirs property, and those of exported transitive deps
|
||||||
IncludeDirs: android.FirstUniquePaths(f.dirs),
|
IncludeDirs: android.FirstUniquePaths(f.dirs),
|
||||||
// Comes from Export_system_include_dirs property, and those of exported transitive deps
|
// Comes from Export_system_include_dirs property, and those of exported transitive deps
|
||||||
@@ -1071,7 +1071,7 @@ func (library *libraryDecorator) linkStatic(ctx ModuleContext,
|
|||||||
ctx.CheckbuildFile(outputFile)
|
ctx.CheckbuildFile(outputFile)
|
||||||
|
|
||||||
if library.static() {
|
if library.static() {
|
||||||
ctx.SetProvider(StaticLibraryInfoProvider, StaticLibraryInfo{
|
android.SetProvider(ctx, StaticLibraryInfoProvider, StaticLibraryInfo{
|
||||||
StaticLibrary: outputFile,
|
StaticLibrary: outputFile,
|
||||||
ReuseObjects: library.reuseObjects,
|
ReuseObjects: library.reuseObjects,
|
||||||
Objects: library.objects,
|
Objects: library.objects,
|
||||||
@@ -1085,7 +1085,7 @@ func (library *libraryDecorator) linkStatic(ctx ModuleContext,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if library.header() {
|
if library.header() {
|
||||||
ctx.SetProvider(HeaderLibraryInfoProvider, HeaderLibraryInfo{})
|
android.SetProvider(ctx, HeaderLibraryInfoProvider, HeaderLibraryInfo{})
|
||||||
}
|
}
|
||||||
|
|
||||||
return outputFile
|
return outputFile
|
||||||
@@ -1235,11 +1235,11 @@ func (library *libraryDecorator) linkShared(ctx ModuleContext,
|
|||||||
|
|
||||||
var transitiveStaticLibrariesForOrdering *android.DepSet[android.Path]
|
var transitiveStaticLibrariesForOrdering *android.DepSet[android.Path]
|
||||||
if static := ctx.GetDirectDepsWithTag(staticVariantTag); len(static) > 0 {
|
if static := ctx.GetDirectDepsWithTag(staticVariantTag); len(static) > 0 {
|
||||||
s := ctx.OtherModuleProvider(static[0], StaticLibraryInfoProvider).(StaticLibraryInfo)
|
s, _ := android.OtherModuleProvider(ctx, static[0], StaticLibraryInfoProvider)
|
||||||
transitiveStaticLibrariesForOrdering = s.TransitiveStaticLibrariesForOrdering
|
transitiveStaticLibrariesForOrdering = s.TransitiveStaticLibrariesForOrdering
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.SetProvider(SharedLibraryInfoProvider, SharedLibraryInfo{
|
android.SetProvider(ctx, SharedLibraryInfoProvider, SharedLibraryInfo{
|
||||||
TableOfContents: android.OptionalPathForPath(tocFile),
|
TableOfContents: android.OptionalPathForPath(tocFile),
|
||||||
SharedLibrary: unstrippedOutputFile,
|
SharedLibrary: unstrippedOutputFile,
|
||||||
TransitiveStaticLibrariesForOrdering: transitiveStaticLibrariesForOrdering,
|
TransitiveStaticLibrariesForOrdering: transitiveStaticLibrariesForOrdering,
|
||||||
@@ -1256,15 +1256,15 @@ func addStubDependencyProviders(ctx ModuleContext) {
|
|||||||
if len(stubs) > 0 {
|
if len(stubs) > 0 {
|
||||||
var stubsInfo []SharedStubLibrary
|
var stubsInfo []SharedStubLibrary
|
||||||
for _, stub := range stubs {
|
for _, stub := range stubs {
|
||||||
stubInfo := ctx.OtherModuleProvider(stub, SharedLibraryInfoProvider).(SharedLibraryInfo)
|
stubInfo, _ := android.OtherModuleProvider(ctx, stub, SharedLibraryInfoProvider)
|
||||||
flagInfo := ctx.OtherModuleProvider(stub, FlagExporterInfoProvider).(FlagExporterInfo)
|
flagInfo, _ := android.OtherModuleProvider(ctx, stub, FlagExporterInfoProvider)
|
||||||
stubsInfo = append(stubsInfo, SharedStubLibrary{
|
stubsInfo = append(stubsInfo, SharedStubLibrary{
|
||||||
Version: moduleLibraryInterface(stub).stubsVersion(),
|
Version: moduleLibraryInterface(stub).stubsVersion(),
|
||||||
SharedLibraryInfo: stubInfo,
|
SharedLibraryInfo: stubInfo,
|
||||||
FlagExporterInfo: flagInfo,
|
FlagExporterInfo: flagInfo,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
ctx.SetProvider(SharedLibraryStubsProvider, SharedLibraryStubsInfo{
|
android.SetProvider(ctx, SharedLibraryStubsProvider, SharedLibraryStubsInfo{
|
||||||
SharedStubLibraries: stubsInfo,
|
SharedStubLibraries: stubsInfo,
|
||||||
IsLLNDK: ctx.IsLlndk(),
|
IsLLNDK: ctx.IsLlndk(),
|
||||||
})
|
})
|
||||||
|
@@ -511,7 +511,7 @@ func (p *nativeLibInfoProperties) PopulateFromVariant(ctx android.SdkMemberConte
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exportedInfo := ctx.SdkModuleContext().OtherModuleProvider(variant, FlagExporterInfoProvider).(FlagExporterInfo)
|
exportedInfo, _ := android.OtherModuleProvider(ctx.SdkModuleContext(), variant, FlagExporterInfoProvider)
|
||||||
|
|
||||||
// Separate out the generated include dirs (which are arch specific) from the
|
// Separate out the generated include dirs (which are arch specific) from the
|
||||||
// include dirs (which may not be).
|
// include dirs (which may not be).
|
||||||
|
@@ -244,7 +244,7 @@ func (d *apiLibraryDecorator) link(ctx ModuleContext, flags Flags, deps PathDeps
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
ctx.SetProvider(SharedLibraryInfoProvider, SharedLibraryInfo{
|
android.SetProvider(ctx, SharedLibraryInfoProvider, SharedLibraryInfo{
|
||||||
SharedLibrary: outputFile,
|
SharedLibrary: outputFile,
|
||||||
Target: ctx.Target(),
|
Target: ctx.Target(),
|
||||||
|
|
||||||
@@ -262,15 +262,15 @@ func (d *apiLibraryDecorator) shareStubs(ctx ModuleContext) {
|
|||||||
if len(stubs) > 0 {
|
if len(stubs) > 0 {
|
||||||
var stubsInfo []SharedStubLibrary
|
var stubsInfo []SharedStubLibrary
|
||||||
for _, stub := range stubs {
|
for _, stub := range stubs {
|
||||||
stubInfo := ctx.OtherModuleProvider(stub, SharedLibraryInfoProvider).(SharedLibraryInfo)
|
stubInfo, _ := android.OtherModuleProvider(ctx, stub, SharedLibraryInfoProvider)
|
||||||
flagInfo := ctx.OtherModuleProvider(stub, FlagExporterInfoProvider).(FlagExporterInfo)
|
flagInfo, _ := android.OtherModuleProvider(ctx, stub, FlagExporterInfoProvider)
|
||||||
stubsInfo = append(stubsInfo, SharedStubLibrary{
|
stubsInfo = append(stubsInfo, SharedStubLibrary{
|
||||||
Version: moduleLibraryInterface(stub).stubsVersion(),
|
Version: moduleLibraryInterface(stub).stubsVersion(),
|
||||||
SharedLibraryInfo: stubInfo,
|
SharedLibraryInfo: stubInfo,
|
||||||
FlagExporterInfo: flagInfo,
|
FlagExporterInfo: flagInfo,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
ctx.SetProvider(SharedLibraryStubsProvider, SharedLibraryStubsInfo{
|
android.SetProvider(ctx, SharedLibraryStubsProvider, SharedLibraryStubsInfo{
|
||||||
SharedStubLibraries: stubsInfo,
|
SharedStubLibraries: stubsInfo,
|
||||||
|
|
||||||
IsLLNDK: ctx.IsLlndk(),
|
IsLLNDK: ctx.IsLlndk(),
|
||||||
|
@@ -117,13 +117,13 @@ func (ndk *ndkPrebuiltStlLinker) link(ctx ModuleContext, flags Flags,
|
|||||||
|
|
||||||
if ndk.static() {
|
if ndk.static() {
|
||||||
depSet := android.NewDepSetBuilder[android.Path](android.TOPOLOGICAL).Direct(lib).Build()
|
depSet := android.NewDepSetBuilder[android.Path](android.TOPOLOGICAL).Direct(lib).Build()
|
||||||
ctx.SetProvider(StaticLibraryInfoProvider, StaticLibraryInfo{
|
android.SetProvider(ctx, StaticLibraryInfoProvider, StaticLibraryInfo{
|
||||||
StaticLibrary: lib,
|
StaticLibrary: lib,
|
||||||
|
|
||||||
TransitiveStaticLibrariesForOrdering: depSet,
|
TransitiveStaticLibrariesForOrdering: depSet,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
ctx.SetProvider(SharedLibraryInfoProvider, SharedLibraryInfo{
|
android.SetProvider(ctx, SharedLibraryInfoProvider, SharedLibraryInfo{
|
||||||
SharedLibrary: lib,
|
SharedLibrary: lib,
|
||||||
Target: ctx.Target(),
|
Target: ctx.Target(),
|
||||||
})
|
})
|
||||||
|
@@ -132,7 +132,7 @@ func (p *prebuiltLibraryLinker) link(ctx ModuleContext,
|
|||||||
|
|
||||||
if p.static() {
|
if p.static() {
|
||||||
depSet := android.NewDepSetBuilder[android.Path](android.TOPOLOGICAL).Direct(in).Build()
|
depSet := android.NewDepSetBuilder[android.Path](android.TOPOLOGICAL).Direct(in).Build()
|
||||||
ctx.SetProvider(StaticLibraryInfoProvider, StaticLibraryInfo{
|
android.SetProvider(ctx, StaticLibraryInfoProvider, StaticLibraryInfo{
|
||||||
StaticLibrary: in,
|
StaticLibrary: in,
|
||||||
|
|
||||||
TransitiveStaticLibrariesForOrdering: depSet,
|
TransitiveStaticLibrariesForOrdering: depSet,
|
||||||
@@ -190,7 +190,7 @@ func (p *prebuiltLibraryLinker) link(ctx ModuleContext,
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
ctx.SetProvider(SharedLibraryInfoProvider, SharedLibraryInfo{
|
android.SetProvider(ctx, SharedLibraryInfoProvider, SharedLibraryInfo{
|
||||||
SharedLibrary: outputFile,
|
SharedLibrary: outputFile,
|
||||||
Target: ctx.Target(),
|
Target: ctx.Target(),
|
||||||
|
|
||||||
@@ -213,7 +213,7 @@ func (p *prebuiltLibraryLinker) link(ctx ModuleContext,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if p.header() {
|
if p.header() {
|
||||||
ctx.SetProvider(HeaderLibraryInfoProvider, HeaderLibraryInfo{})
|
android.SetProvider(ctx, HeaderLibraryInfoProvider, HeaderLibraryInfo{})
|
||||||
|
|
||||||
// Need to return an output path so that the AndroidMk logic doesn't skip
|
// Need to return an output path so that the AndroidMk logic doesn't skip
|
||||||
// the prebuilt header. For compatibility, in case Android.mk files use a
|
// the prebuilt header. For compatibility, in case Android.mk files use a
|
||||||
|
@@ -194,8 +194,8 @@ func shouldCreateSourceAbiDumpForLibrary(ctx android.BaseModuleContext) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
isPlatformVariant := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo).IsForPlatform()
|
apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider)
|
||||||
if isPlatformVariant {
|
if apexInfo.IsForPlatform() {
|
||||||
// Bionic libraries that are installed to the bootstrap directory are not ABI checked.
|
// Bionic libraries that are installed to the bootstrap directory are not ABI checked.
|
||||||
// Only the runtime APEX variants, which are the implementation libraries of bionic NDK stubs,
|
// Only the runtime APEX variants, which are the implementation libraries of bionic NDK stubs,
|
||||||
// are checked.
|
// are checked.
|
||||||
|
@@ -1627,7 +1627,7 @@ func sanitizerRuntimeMutator(mctx android.BottomUpMutatorContext) {
|
|||||||
|
|
||||||
addStaticDeps := func(dep string, hideSymbols bool) {
|
addStaticDeps := func(dep string, hideSymbols bool) {
|
||||||
// If we're using snapshots, redirect to snapshot whenever possible
|
// If we're using snapshots, redirect to snapshot whenever possible
|
||||||
snapshot := mctx.Provider(SnapshotInfoProvider).(SnapshotInfo)
|
snapshot, _ := android.ModuleProvider(mctx, SnapshotInfoProvider)
|
||||||
if lib, ok := snapshot.StaticLibs[dep]; ok {
|
if lib, ok := snapshot.StaticLibs[dep]; ok {
|
||||||
dep = lib
|
dep = lib
|
||||||
}
|
}
|
||||||
@@ -1714,7 +1714,7 @@ func sanitizerRuntimeMutator(mctx android.BottomUpMutatorContext) {
|
|||||||
addStaticDeps(runtimeSharedLibrary, true)
|
addStaticDeps(runtimeSharedLibrary, true)
|
||||||
} else if !c.static() && !c.Header() {
|
} else if !c.static() && !c.Header() {
|
||||||
// If we're using snapshots, redirect to snapshot whenever possible
|
// If we're using snapshots, redirect to snapshot whenever possible
|
||||||
snapshot := mctx.Provider(SnapshotInfoProvider).(SnapshotInfo)
|
snapshot, _ := android.ModuleProvider(mctx, SnapshotInfoProvider)
|
||||||
if lib, ok := snapshot.SharedLibs[runtimeSharedLibrary]; ok {
|
if lib, ok := snapshot.SharedLibs[runtimeSharedLibrary]; ok {
|
||||||
runtimeSharedLibrary = lib
|
runtimeSharedLibrary = lib
|
||||||
}
|
}
|
||||||
|
@@ -22,8 +22,6 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var prepareForAsanTest = android.FixtureAddFile("asan/Android.bp", []byte(`
|
var prepareForAsanTest = android.FixtureAddFile("asan/Android.bp", []byte(`
|
||||||
@@ -49,7 +47,7 @@ var prepareForTsanTest = android.FixtureAddFile("tsan/Android.bp", []byte(`
|
|||||||
`))
|
`))
|
||||||
|
|
||||||
type providerInterface interface {
|
type providerInterface interface {
|
||||||
ModuleProvider(blueprint.Module, blueprint.AnyProviderKey) interface{}
|
android.SingletonModuleProviderContext
|
||||||
}
|
}
|
||||||
|
|
||||||
// expectSharedLinkDep verifies that the from module links against the to module as a
|
// expectSharedLinkDep verifies that the from module links against the to module as a
|
||||||
@@ -57,7 +55,7 @@ type providerInterface interface {
|
|||||||
func expectSharedLinkDep(t *testing.T, ctx providerInterface, from, to android.TestingModule) {
|
func expectSharedLinkDep(t *testing.T, ctx providerInterface, from, to android.TestingModule) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
fromLink := from.Description("link")
|
fromLink := from.Description("link")
|
||||||
toInfo := ctx.ModuleProvider(to.Module(), SharedLibraryInfoProvider).(SharedLibraryInfo)
|
toInfo, _ := android.SingletonModuleProvider(ctx, to.Module(), SharedLibraryInfoProvider)
|
||||||
|
|
||||||
if g, w := fromLink.OrderOnly.Strings(), toInfo.SharedLibrary.RelativeToTop().String(); !android.InList(w, g) {
|
if g, w := fromLink.OrderOnly.Strings(), toInfo.SharedLibrary.RelativeToTop().String(); !android.InList(w, g) {
|
||||||
t.Errorf("%s should link against %s, expected %q, got %q",
|
t.Errorf("%s should link against %s, expected %q, got %q",
|
||||||
@@ -70,7 +68,7 @@ func expectSharedLinkDep(t *testing.T, ctx providerInterface, from, to android.T
|
|||||||
func expectNoSharedLinkDep(t *testing.T, ctx providerInterface, from, to android.TestingModule) {
|
func expectNoSharedLinkDep(t *testing.T, ctx providerInterface, from, to android.TestingModule) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
fromLink := from.Description("link")
|
fromLink := from.Description("link")
|
||||||
toInfo := ctx.ModuleProvider(to.Module(), SharedLibraryInfoProvider).(SharedLibraryInfo)
|
toInfo, _ := android.SingletonModuleProvider(ctx, to.Module(), SharedLibraryInfoProvider)
|
||||||
|
|
||||||
if g, w := fromLink.OrderOnly.Strings(), toInfo.SharedLibrary.RelativeToTop().String(); android.InList(w, g) {
|
if g, w := fromLink.OrderOnly.Strings(), toInfo.SharedLibrary.RelativeToTop().String(); android.InList(w, g) {
|
||||||
t.Errorf("%s should not link against %s, expected %q, got %q",
|
t.Errorf("%s should not link against %s, expected %q, got %q",
|
||||||
@@ -83,7 +81,7 @@ func expectNoSharedLinkDep(t *testing.T, ctx providerInterface, from, to android
|
|||||||
func expectStaticLinkDep(t *testing.T, ctx providerInterface, from, to android.TestingModule) {
|
func expectStaticLinkDep(t *testing.T, ctx providerInterface, from, to android.TestingModule) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
fromLink := from.Description("link")
|
fromLink := from.Description("link")
|
||||||
toInfo := ctx.ModuleProvider(to.Module(), StaticLibraryInfoProvider).(StaticLibraryInfo)
|
toInfo, _ := android.SingletonModuleProvider(ctx, to.Module(), StaticLibraryInfoProvider)
|
||||||
|
|
||||||
if g, w := fromLink.Implicits.Strings(), toInfo.StaticLibrary.RelativeToTop().String(); !android.InList(w, g) {
|
if g, w := fromLink.Implicits.Strings(), toInfo.StaticLibrary.RelativeToTop().String(); !android.InList(w, g) {
|
||||||
t.Errorf("%s should link against %s, expected %q, got %q",
|
t.Errorf("%s should link against %s, expected %q, got %q",
|
||||||
@@ -97,7 +95,7 @@ func expectStaticLinkDep(t *testing.T, ctx providerInterface, from, to android.T
|
|||||||
func expectNoStaticLinkDep(t *testing.T, ctx providerInterface, from, to android.TestingModule) {
|
func expectNoStaticLinkDep(t *testing.T, ctx providerInterface, from, to android.TestingModule) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
fromLink := from.Description("link")
|
fromLink := from.Description("link")
|
||||||
toInfo := ctx.ModuleProvider(to.Module(), StaticLibraryInfoProvider).(StaticLibraryInfo)
|
toInfo, _ := android.SingletonModuleProvider(ctx, to.Module(), StaticLibraryInfoProvider)
|
||||||
|
|
||||||
if g, w := fromLink.Implicits.Strings(), toInfo.StaticLibrary.RelativeToTop().String(); android.InList(w, g) {
|
if g, w := fromLink.Implicits.Strings(), toInfo.StaticLibrary.RelativeToTop().String(); android.InList(w, g) {
|
||||||
t.Errorf("%s should not link against %s, expected %q, got %q",
|
t.Errorf("%s should not link against %s, expected %q, got %q",
|
||||||
|
@@ -194,7 +194,7 @@ func (s *snapshotModule) DepsMutator(ctx android.BottomUpMutatorContext) {
|
|||||||
sharedLibs[k] = v
|
sharedLibs[k] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.SetProvider(SnapshotInfoProvider, SnapshotInfo{
|
android.SetProvider(ctx, SnapshotInfoProvider, SnapshotInfo{
|
||||||
HeaderLibs: headers,
|
HeaderLibs: headers,
|
||||||
Binaries: binaries,
|
Binaries: binaries,
|
||||||
Objects: objects,
|
Objects: objects,
|
||||||
@@ -494,7 +494,7 @@ func (p *snapshotLibraryDecorator) link(ctx ModuleContext, flags Flags, deps Pat
|
|||||||
p.tocFile = android.OptionalPathForPath(tocFile)
|
p.tocFile = android.OptionalPathForPath(tocFile)
|
||||||
TransformSharedObjectToToc(ctx, in, tocFile)
|
TransformSharedObjectToToc(ctx, in, tocFile)
|
||||||
|
|
||||||
ctx.SetProvider(SharedLibraryInfoProvider, SharedLibraryInfo{
|
android.SetProvider(ctx, SharedLibraryInfoProvider, SharedLibraryInfo{
|
||||||
SharedLibrary: in,
|
SharedLibrary: in,
|
||||||
Target: ctx.Target(),
|
Target: ctx.Target(),
|
||||||
|
|
||||||
@@ -504,7 +504,7 @@ func (p *snapshotLibraryDecorator) link(ctx ModuleContext, flags Flags, deps Pat
|
|||||||
|
|
||||||
if p.static() {
|
if p.static() {
|
||||||
depSet := android.NewDepSetBuilder[android.Path](android.TOPOLOGICAL).Direct(in).Build()
|
depSet := android.NewDepSetBuilder[android.Path](android.TOPOLOGICAL).Direct(in).Build()
|
||||||
ctx.SetProvider(StaticLibraryInfoProvider, StaticLibraryInfo{
|
android.SetProvider(ctx, StaticLibraryInfoProvider, StaticLibraryInfo{
|
||||||
StaticLibrary: in,
|
StaticLibrary: in,
|
||||||
|
|
||||||
TransitiveStaticLibrariesForOrdering: depSet,
|
TransitiveStaticLibrariesForOrdering: depSet,
|
||||||
|
@@ -275,7 +275,7 @@ var ccSnapshotAction snapshot.GenerateSnapshotAction = func(s snapshot.SnapshotS
|
|||||||
var propOut string
|
var propOut string
|
||||||
|
|
||||||
if m.IsSnapshotLibrary() {
|
if m.IsSnapshotLibrary() {
|
||||||
exporterInfo := ctx.ModuleProvider(m.Module(), FlagExporterInfoProvider).(FlagExporterInfo)
|
exporterInfo, _ := android.SingletonModuleProvider(ctx, m.Module(), FlagExporterInfoProvider)
|
||||||
|
|
||||||
// library flags
|
// library flags
|
||||||
prop.ExportedFlags = exporterInfo.Flags
|
prop.ExportedFlags = exporterInfo.Flags
|
||||||
@@ -407,7 +407,7 @@ var ccSnapshotAction snapshot.GenerateSnapshotAction = func(s snapshot.SnapshotS
|
|||||||
|
|
||||||
moduleDir := ctx.ModuleDir(module)
|
moduleDir := ctx.ModuleDir(module)
|
||||||
inProprietaryPath := s.Image.IsProprietaryPath(moduleDir, ctx.DeviceConfig())
|
inProprietaryPath := s.Image.IsProprietaryPath(moduleDir, ctx.DeviceConfig())
|
||||||
apexInfo := ctx.ModuleProvider(module, android.ApexInfoProvider).(android.ApexInfo)
|
apexInfo, _ := android.SingletonModuleProvider(ctx, module, android.ApexInfoProvider)
|
||||||
|
|
||||||
if s.Image.ExcludeFromSnapshot(m) {
|
if s.Image.ExcludeFromSnapshot(m) {
|
||||||
if inProprietaryPath {
|
if inProprietaryPath {
|
||||||
|
@@ -772,7 +772,7 @@ func (c *vndkSnapshotSingleton) GenerateBuildActions(ctx android.SingletonContex
|
|||||||
prop.MinSdkVersion = m.MinSdkVersion()
|
prop.MinSdkVersion = m.MinSdkVersion()
|
||||||
|
|
||||||
if ctx.Config().VndkSnapshotBuildArtifacts() {
|
if ctx.Config().VndkSnapshotBuildArtifacts() {
|
||||||
exportedInfo := ctx.ModuleProvider(m, FlagExporterInfoProvider).(FlagExporterInfo)
|
exportedInfo, _ := android.SingletonModuleProvider(ctx, m, FlagExporterInfoProvider)
|
||||||
prop.ExportedFlags = exportedInfo.Flags
|
prop.ExportedFlags = exportedInfo.Flags
|
||||||
prop.ExportedDirs = exportedInfo.IncludeDirs.Strings()
|
prop.ExportedDirs = exportedInfo.IncludeDirs.Strings()
|
||||||
prop.ExportedSystemDirs = exportedInfo.SystemIncludeDirs.Strings()
|
prop.ExportedSystemDirs = exportedInfo.SystemIncludeDirs.Strings()
|
||||||
@@ -797,7 +797,7 @@ func (c *vndkSnapshotSingleton) GenerateBuildActions(ctx android.SingletonContex
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
apexInfo := ctx.ModuleProvider(module, android.ApexInfoProvider).(android.ApexInfo)
|
apexInfo, _ := android.SingletonModuleProvider(ctx, module, android.ApexInfoProvider)
|
||||||
|
|
||||||
vndkType, ok := isVndkSnapshotAware(ctx.DeviceConfig(), m, apexInfo)
|
vndkType, ok := isVndkSnapshotAware(ctx.DeviceConfig(), m, apexInfo)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@@ -171,7 +171,7 @@ func (p *vndkPrebuiltLibraryDecorator) link(ctx ModuleContext,
|
|||||||
p.androidMkSuffix = ""
|
p.androidMkSuffix = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.SetProvider(SharedLibraryInfoProvider, SharedLibraryInfo{
|
android.SetProvider(ctx, SharedLibraryInfoProvider, SharedLibraryInfo{
|
||||||
SharedLibrary: in,
|
SharedLibrary: in,
|
||||||
Target: ctx.Target(),
|
Target: ctx.Target(),
|
||||||
|
|
||||||
|
@@ -393,7 +393,7 @@ func (g *Module) generateCommonBuildActions(ctx android.ModuleContext) {
|
|||||||
return srcFiles
|
return srcFiles
|
||||||
}
|
}
|
||||||
srcFiles := addLabelsForInputs("srcs", g.properties.Srcs, g.properties.Exclude_srcs)
|
srcFiles := addLabelsForInputs("srcs", g.properties.Srcs, g.properties.Exclude_srcs)
|
||||||
ctx.SetProvider(blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: srcFiles.Strings()})
|
android.SetProvider(ctx, blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: srcFiles.Strings()})
|
||||||
|
|
||||||
var copyFrom android.Paths
|
var copyFrom android.Paths
|
||||||
var outputFiles android.WritablePaths
|
var outputFiles android.WritablePaths
|
||||||
|
18
java/aar.go
18
java/aar.go
@@ -805,7 +805,8 @@ func (a *AndroidLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext)
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
a.hideApexVariantFromMake = !ctx.Provider(android.ApexInfoProvider).(android.ApexInfo).IsForPlatform()
|
apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider)
|
||||||
|
a.hideApexVariantFromMake = !apexInfo.IsForPlatform()
|
||||||
|
|
||||||
a.stem = proptools.StringDefault(a.overridableDeviceProperties.Stem, ctx.ModuleName())
|
a.stem = proptools.StringDefault(a.overridableDeviceProperties.Stem, ctx.ModuleName())
|
||||||
|
|
||||||
@@ -825,7 +826,7 @@ func (a *AndroidLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext)
|
|||||||
a.linter.resources = a.aapt.resourceFiles
|
a.linter.resources = a.aapt.resourceFiles
|
||||||
|
|
||||||
proguardSpecInfo := a.collectProguardSpecInfo(ctx)
|
proguardSpecInfo := a.collectProguardSpecInfo(ctx)
|
||||||
ctx.SetProvider(ProguardSpecInfoProvider, proguardSpecInfo)
|
android.SetProvider(ctx, ProguardSpecInfoProvider, proguardSpecInfo)
|
||||||
exportedProguardFlagsFiles := proguardSpecInfo.ProguardFlagsFiles.ToList()
|
exportedProguardFlagsFiles := proguardSpecInfo.ProguardFlagsFiles.ToList()
|
||||||
a.extraProguardFlagsFiles = append(a.extraProguardFlagsFiles, exportedProguardFlagsFiles...)
|
a.extraProguardFlagsFiles = append(a.extraProguardFlagsFiles, exportedProguardFlagsFiles...)
|
||||||
a.extraProguardFlagsFiles = append(a.extraProguardFlagsFiles, a.proguardOptionsFile)
|
a.extraProguardFlagsFiles = append(a.extraProguardFlagsFiles, a.proguardOptionsFile)
|
||||||
@@ -860,12 +861,12 @@ func (a *AndroidLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext)
|
|||||||
|
|
||||||
prebuiltJniPackages := android.Paths{}
|
prebuiltJniPackages := android.Paths{}
|
||||||
ctx.VisitDirectDeps(func(module android.Module) {
|
ctx.VisitDirectDeps(func(module android.Module) {
|
||||||
if info, ok := ctx.OtherModuleProvider(module, JniPackageProvider).(JniPackageInfo); ok {
|
if info, ok := android.OtherModuleProvider(ctx, module, JniPackageProvider); ok {
|
||||||
prebuiltJniPackages = append(prebuiltJniPackages, info.JniPackages...)
|
prebuiltJniPackages = append(prebuiltJniPackages, info.JniPackages...)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if len(prebuiltJniPackages) > 0 {
|
if len(prebuiltJniPackages) > 0 {
|
||||||
ctx.SetProvider(JniPackageProvider, JniPackageInfo{
|
android.SetProvider(ctx, JniPackageProvider, JniPackageInfo{
|
||||||
JniPackages: prebuiltJniPackages,
|
JniPackages: prebuiltJniPackages,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -1106,7 +1107,8 @@ func (a *AARImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
a.sdkVersion = a.SdkVersion(ctx)
|
a.sdkVersion = a.SdkVersion(ctx)
|
||||||
a.minSdkVersion = a.MinSdkVersion(ctx)
|
a.minSdkVersion = a.MinSdkVersion(ctx)
|
||||||
|
|
||||||
a.hideApexVariantFromMake = !ctx.Provider(android.ApexInfoProvider).(android.ApexInfo).IsForPlatform()
|
apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider)
|
||||||
|
a.hideApexVariantFromMake = !apexInfo.IsForPlatform()
|
||||||
|
|
||||||
aarName := ctx.ModuleName() + ".aar"
|
aarName := ctx.ModuleName() + ".aar"
|
||||||
a.aarPath = android.PathForModuleSrc(ctx, a.properties.Aars[0])
|
a.aarPath = android.PathForModuleSrc(ctx, a.properties.Aars[0])
|
||||||
@@ -1123,7 +1125,7 @@ func (a *AARImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
aarRTxt := extractedAARDir.Join(ctx, "R.txt")
|
aarRTxt := extractedAARDir.Join(ctx, "R.txt")
|
||||||
a.assetsPackage = android.PathForModuleOut(ctx, "assets.zip")
|
a.assetsPackage = android.PathForModuleOut(ctx, "assets.zip")
|
||||||
a.proguardFlags = extractedAARDir.Join(ctx, "proguard.txt")
|
a.proguardFlags = extractedAARDir.Join(ctx, "proguard.txt")
|
||||||
ctx.SetProvider(ProguardSpecInfoProvider, ProguardSpecInfo{
|
android.SetProvider(ctx, ProguardSpecInfoProvider, ProguardSpecInfo{
|
||||||
ProguardFlagsFiles: android.NewDepSet[android.Path](
|
ProguardFlagsFiles: android.NewDepSet[android.Path](
|
||||||
android.POSTORDER,
|
android.POSTORDER,
|
||||||
android.Paths{a.proguardFlags},
|
android.Paths{a.proguardFlags},
|
||||||
@@ -1228,7 +1230,7 @@ func (a *AARImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
a.transitiveAaptResourcePackagesFile = transitiveAaptResourcePackagesFile
|
a.transitiveAaptResourcePackagesFile = transitiveAaptResourcePackagesFile
|
||||||
|
|
||||||
a.collectTransitiveHeaderJars(ctx)
|
a.collectTransitiveHeaderJars(ctx)
|
||||||
ctx.SetProvider(JavaInfoProvider, JavaInfo{
|
android.SetProvider(ctx, JavaInfoProvider, JavaInfo{
|
||||||
HeaderJars: android.PathsIfNonNil(a.classpathFile),
|
HeaderJars: android.PathsIfNonNil(a.classpathFile),
|
||||||
TransitiveLibsHeaderJars: a.transitiveLibsHeaderJars,
|
TransitiveLibsHeaderJars: a.transitiveLibsHeaderJars,
|
||||||
TransitiveStaticLibsHeaderJars: a.transitiveStaticLibsHeaderJars,
|
TransitiveStaticLibsHeaderJars: a.transitiveStaticLibsHeaderJars,
|
||||||
@@ -1258,7 +1260,7 @@ func (a *AARImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.SetProvider(JniPackageProvider, JniPackageInfo{
|
android.SetProvider(ctx, JniPackageProvider, JniPackageInfo{
|
||||||
JniPackages: a.jniPackages,
|
JniPackages: a.jniPackages,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@@ -52,7 +52,7 @@ func TestAarImportProducesJniPackages(t *testing.T) {
|
|||||||
appMod := ctx.Module(tc.name, "android_common")
|
appMod := ctx.Module(tc.name, "android_common")
|
||||||
appTestMod := ctx.ModuleForTests(tc.name, "android_common")
|
appTestMod := ctx.ModuleForTests(tc.name, "android_common")
|
||||||
|
|
||||||
info, ok := ctx.ModuleProvider(appMod, JniPackageProvider).(JniPackageInfo)
|
info, ok := android.SingletonModuleProvider(ctx, appMod, JniPackageProvider)
|
||||||
if !ok {
|
if !ok {
|
||||||
t.Errorf("expected android_library_import to have JniPackageProvider")
|
t.Errorf("expected android_library_import to have JniPackageProvider")
|
||||||
}
|
}
|
||||||
|
17
java/app.go
17
java/app.go
@@ -411,7 +411,7 @@ func (a *AndroidApp) useEmbeddedNativeLibs(ctx android.ModuleContext) bool {
|
|||||||
ctx.PropertyErrorf("min_sdk_version", "invalid value %q: %s", a.MinSdkVersion(ctx), err)
|
ctx.PropertyErrorf("min_sdk_version", "invalid value %q: %s", a.MinSdkVersion(ctx), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
|
apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider)
|
||||||
return (minSdkVersion.FinalOrFutureInt() >= 23 && Bool(a.appProperties.Use_embedded_native_libs)) ||
|
return (minSdkVersion.FinalOrFutureInt() >= 23 && Bool(a.appProperties.Use_embedded_native_libs)) ||
|
||||||
!apexInfo.IsForPlatform()
|
!apexInfo.IsForPlatform()
|
||||||
}
|
}
|
||||||
@@ -436,7 +436,7 @@ func (a *AndroidApp) shouldUncompressDex(ctx android.ModuleContext) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *AndroidApp) shouldEmbedJnis(ctx android.BaseModuleContext) bool {
|
func (a *AndroidApp) shouldEmbedJnis(ctx android.BaseModuleContext) bool {
|
||||||
apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
|
apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider)
|
||||||
return ctx.Config().UnbundledBuild() || Bool(a.appProperties.Use_embedded_native_libs) ||
|
return ctx.Config().UnbundledBuild() || Bool(a.appProperties.Use_embedded_native_libs) ||
|
||||||
!apexInfo.IsForPlatform() || a.appProperties.AlwaysPackageNativeLibs
|
!apexInfo.IsForPlatform() || a.appProperties.AlwaysPackageNativeLibs
|
||||||
}
|
}
|
||||||
@@ -509,7 +509,7 @@ func (a *AndroidApp) aaptBuildActions(ctx android.ModuleContext) {
|
|||||||
|
|
||||||
var aconfigTextFilePaths android.Paths
|
var aconfigTextFilePaths android.Paths
|
||||||
ctx.VisitDirectDepsWithTag(aconfigDeclarationTag, func(dep android.Module) {
|
ctx.VisitDirectDepsWithTag(aconfigDeclarationTag, func(dep android.Module) {
|
||||||
if provider, ok := ctx.OtherModuleProvider(dep, aconfig.DeclarationsProviderKey).(aconfig.DeclarationsProviderData); ok {
|
if provider, ok := android.OtherModuleProvider(ctx, dep, aconfig.DeclarationsProviderKey); ok {
|
||||||
aconfigTextFilePaths = append(aconfigTextFilePaths, provider.IntermediateDumpOutputPath)
|
aconfigTextFilePaths = append(aconfigTextFilePaths, provider.IntermediateDumpOutputPath)
|
||||||
} else {
|
} else {
|
||||||
ctx.ModuleErrorf("Only aconfig_declarations module type is allowed for "+
|
ctx.ModuleErrorf("Only aconfig_declarations module type is allowed for "+
|
||||||
@@ -537,7 +537,7 @@ func (a *AndroidApp) aaptBuildActions(ctx android.ModuleContext) {
|
|||||||
func (a *AndroidApp) proguardBuildActions(ctx android.ModuleContext) {
|
func (a *AndroidApp) proguardBuildActions(ctx android.ModuleContext) {
|
||||||
var staticLibProguardFlagFiles android.Paths
|
var staticLibProguardFlagFiles android.Paths
|
||||||
ctx.VisitDirectDeps(func(m android.Module) {
|
ctx.VisitDirectDeps(func(m android.Module) {
|
||||||
depProguardInfo := ctx.OtherModuleProvider(m, ProguardSpecInfoProvider).(ProguardSpecInfo)
|
depProguardInfo, _ := android.OtherModuleProvider(ctx, m, ProguardSpecInfoProvider)
|
||||||
staticLibProguardFlagFiles = append(staticLibProguardFlagFiles, depProguardInfo.UnconditionallyExportedProguardFlags.ToList()...)
|
staticLibProguardFlagFiles = append(staticLibProguardFlagFiles, depProguardInfo.UnconditionallyExportedProguardFlags.ToList()...)
|
||||||
if ctx.OtherModuleDependencyTag(m) == staticLibTag {
|
if ctx.OtherModuleDependencyTag(m) == staticLibTag {
|
||||||
staticLibProguardFlagFiles = append(staticLibProguardFlagFiles, depProguardInfo.ProguardFlagsFiles.ToList()...)
|
staticLibProguardFlagFiles = append(staticLibProguardFlagFiles, depProguardInfo.ProguardFlagsFiles.ToList()...)
|
||||||
@@ -745,7 +745,8 @@ func (a *AndroidApp) createPrivappAllowlist(ctx android.ModuleContext) android.P
|
|||||||
func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) {
|
func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
var apkDeps android.Paths
|
var apkDeps android.Paths
|
||||||
|
|
||||||
if !ctx.Provider(android.ApexInfoProvider).(android.ApexInfo).IsForPlatform() {
|
apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider)
|
||||||
|
if !apexInfo.IsForPlatform() {
|
||||||
a.hideApexVariantFromMake = true
|
a.hideApexVariantFromMake = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -890,8 +891,6 @@ func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
a.privAppAllowlist = android.OptionalPathForPath(allowlist)
|
a.privAppAllowlist = android.OptionalPathForPath(allowlist)
|
||||||
}
|
}
|
||||||
|
|
||||||
apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
|
|
||||||
|
|
||||||
// Install the app package.
|
// Install the app package.
|
||||||
shouldInstallAppPackage := (Bool(a.Module.properties.Installable) || ctx.Host()) && apexInfo.IsForPlatform() && !a.appProperties.PreventInstall
|
shouldInstallAppPackage := (Bool(a.Module.properties.Installable) || ctx.Host()) && apexInfo.IsForPlatform() && !a.appProperties.PreventInstall
|
||||||
if shouldInstallAppPackage {
|
if shouldInstallAppPackage {
|
||||||
@@ -975,7 +974,7 @@ func collectAppDeps(ctx android.ModuleContext, app appDepsInterface,
|
|||||||
return shouldCollectRecursiveNativeDeps
|
return shouldCollectRecursiveNativeDeps
|
||||||
}
|
}
|
||||||
|
|
||||||
if info, ok := ctx.OtherModuleProvider(module, JniPackageProvider).(JniPackageInfo); ok {
|
if info, ok := android.OtherModuleProvider(ctx, module, JniPackageProvider); ok {
|
||||||
prebuiltJniPackages = append(prebuiltJniPackages, info.JniPackages...)
|
prebuiltJniPackages = append(prebuiltJniPackages, info.JniPackages...)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1295,7 +1294,7 @@ func (a *AndroidTest) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
a.testConfig = a.FixTestConfig(ctx, testConfig)
|
a.testConfig = a.FixTestConfig(ctx, testConfig)
|
||||||
a.extraTestConfigs = android.PathsForModuleSrc(ctx, a.testProperties.Test_options.Extra_test_configs)
|
a.extraTestConfigs = android.PathsForModuleSrc(ctx, a.testProperties.Test_options.Extra_test_configs)
|
||||||
a.data = android.PathsForModuleSrc(ctx, a.testProperties.Data)
|
a.data = android.PathsForModuleSrc(ctx, a.testProperties.Data)
|
||||||
ctx.SetProvider(testing.TestModuleProviderKey, testing.TestModuleProviderData{})
|
android.SetProvider(ctx, testing.TestModuleProviderKey, testing.TestModuleProviderData{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *AndroidTest) FixTestConfig(ctx android.ModuleContext, testConfig android.Path) android.Path {
|
func (a *AndroidTest) FixTestConfig(ctx android.ModuleContext, testConfig android.Path) android.Path {
|
||||||
|
@@ -257,7 +257,7 @@ func (a *AndroidAppImport) generateAndroidBuildActions(ctx android.ModuleContext
|
|||||||
ctx.ModuleErrorf("prebuilt_framework-res found. This used to have special handling in soong, but was removed due to prebuilt_framework-res no longer existing. This check is to ensure it doesn't come back without readding the special handling.")
|
ctx.ModuleErrorf("prebuilt_framework-res found. This used to have special handling in soong, but was removed due to prebuilt_framework-res no longer existing. This check is to ensure it doesn't come back without readding the special handling.")
|
||||||
}
|
}
|
||||||
|
|
||||||
apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
|
apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider)
|
||||||
if !apexInfo.IsForPlatform() {
|
if !apexInfo.IsForPlatform() {
|
||||||
a.hideApexVariantFromMake = true
|
a.hideApexVariantFromMake = true
|
||||||
}
|
}
|
||||||
|
37
java/base.go
37
java/base.go
@@ -618,7 +618,7 @@ func (j *Module) provideHiddenAPIPropertyInfo(ctx android.ModuleContext) {
|
|||||||
// Populate with package rules from the properties.
|
// Populate with package rules from the properties.
|
||||||
hiddenAPIInfo.extractPackageRulesFromProperties(&j.deviceProperties.HiddenAPIPackageProperties)
|
hiddenAPIInfo.extractPackageRulesFromProperties(&j.deviceProperties.HiddenAPIPackageProperties)
|
||||||
|
|
||||||
ctx.SetProvider(hiddenAPIPropertyInfoProvider, hiddenAPIInfo)
|
android.SetProvider(ctx, hiddenAPIPropertyInfoProvider, hiddenAPIInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (j *Module) OutputFiles(tag string) (android.Paths, error) {
|
func (j *Module) OutputFiles(tag string) (android.Paths, error) {
|
||||||
@@ -685,7 +685,7 @@ func (j *Module) shouldInstrumentInApex(ctx android.BaseModuleContext) bool {
|
|||||||
// Force enable the instrumentation for java code that is built for APEXes ...
|
// Force enable the instrumentation for java code that is built for APEXes ...
|
||||||
// except for the jacocoagent itself (because instrumenting jacocoagent using jacocoagent
|
// except for the jacocoagent itself (because instrumenting jacocoagent using jacocoagent
|
||||||
// doesn't make sense) or framework libraries (e.g. libraries found in the InstrumentFrameworkModules list) unless EMMA_INSTRUMENT_FRAMEWORK is true.
|
// doesn't make sense) or framework libraries (e.g. libraries found in the InstrumentFrameworkModules list) unless EMMA_INSTRUMENT_FRAMEWORK is true.
|
||||||
apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
|
apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider)
|
||||||
isJacocoAgent := ctx.ModuleName() == "jacocoagent"
|
isJacocoAgent := ctx.ModuleName() == "jacocoagent"
|
||||||
if j.DirectlyInAnyApex() && !isJacocoAgent && !apexInfo.IsForPlatform() {
|
if j.DirectlyInAnyApex() && !isJacocoAgent && !apexInfo.IsForPlatform() {
|
||||||
if !inList(ctx.ModuleName(), config.InstrumentFrameworkModules) {
|
if !inList(ctx.ModuleName(), config.InstrumentFrameworkModules) {
|
||||||
@@ -1143,7 +1143,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
|
|||||||
uniqueSrcFiles = append(uniqueSrcFiles, uniqueJavaFiles...)
|
uniqueSrcFiles = append(uniqueSrcFiles, uniqueJavaFiles...)
|
||||||
uniqueSrcFiles = append(uniqueSrcFiles, uniqueKtFiles...)
|
uniqueSrcFiles = append(uniqueSrcFiles, uniqueKtFiles...)
|
||||||
j.uniqueSrcFiles = uniqueSrcFiles
|
j.uniqueSrcFiles = uniqueSrcFiles
|
||||||
ctx.SetProvider(blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: uniqueSrcFiles.Strings()})
|
android.SetProvider(ctx, blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: uniqueSrcFiles.Strings()})
|
||||||
|
|
||||||
// We don't currently run annotation processors in turbine, which means we can't use turbine
|
// We don't currently run annotation processors in turbine, which means we can't use turbine
|
||||||
// generated header jars when an annotation processor that generates API is enabled. One
|
// generated header jars when an annotation processor that generates API is enabled. One
|
||||||
@@ -1178,7 +1178,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.SetProvider(JavaInfoProvider, JavaInfo{
|
android.SetProvider(ctx, JavaInfoProvider, JavaInfo{
|
||||||
HeaderJars: android.PathsIfNonNil(j.headerJarFile),
|
HeaderJars: android.PathsIfNonNil(j.headerJarFile),
|
||||||
TransitiveLibsHeaderJars: j.transitiveLibsHeaderJars,
|
TransitiveLibsHeaderJars: j.transitiveLibsHeaderJars,
|
||||||
TransitiveStaticLibsHeaderJars: j.transitiveStaticLibsHeaderJars,
|
TransitiveStaticLibsHeaderJars: j.transitiveStaticLibsHeaderJars,
|
||||||
@@ -1572,7 +1572,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
|
|||||||
|
|
||||||
// Enable dex compilation for the APEX variants, unless it is disabled explicitly
|
// Enable dex compilation for the APEX variants, unless it is disabled explicitly
|
||||||
compileDex := j.dexProperties.Compile_dex
|
compileDex := j.dexProperties.Compile_dex
|
||||||
apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
|
apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider)
|
||||||
if j.DirectlyInAnyApex() && !apexInfo.IsForPlatform() {
|
if j.DirectlyInAnyApex() && !apexInfo.IsForPlatform() {
|
||||||
if compileDex == nil {
|
if compileDex == nil {
|
||||||
compileDex = proptools.BoolPtr(true)
|
compileDex = proptools.BoolPtr(true)
|
||||||
@@ -1696,7 +1696,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
|
|||||||
|
|
||||||
aconfig.CollectDependencyAconfigFiles(ctx, &j.mergedAconfigFiles)
|
aconfig.CollectDependencyAconfigFiles(ctx, &j.mergedAconfigFiles)
|
||||||
|
|
||||||
ctx.SetProvider(JavaInfoProvider, JavaInfo{
|
android.SetProvider(ctx, JavaInfoProvider, JavaInfo{
|
||||||
HeaderJars: android.PathsIfNonNil(j.headerJarFile),
|
HeaderJars: android.PathsIfNonNil(j.headerJarFile),
|
||||||
TransitiveLibsHeaderJars: j.transitiveLibsHeaderJars,
|
TransitiveLibsHeaderJars: j.transitiveLibsHeaderJars,
|
||||||
TransitiveStaticLibsHeaderJars: j.transitiveStaticLibsHeaderJars,
|
TransitiveStaticLibsHeaderJars: j.transitiveStaticLibsHeaderJars,
|
||||||
@@ -1726,7 +1726,7 @@ func (j *Module) collectProguardSpecInfo(ctx android.ModuleContext) ProguardSpec
|
|||||||
transitiveProguardFlags := []*android.DepSet[android.Path]{}
|
transitiveProguardFlags := []*android.DepSet[android.Path]{}
|
||||||
|
|
||||||
ctx.VisitDirectDeps(func(m android.Module) {
|
ctx.VisitDirectDeps(func(m android.Module) {
|
||||||
depProguardInfo := ctx.OtherModuleProvider(m, ProguardSpecInfoProvider).(ProguardSpecInfo)
|
depProguardInfo, _ := android.OtherModuleProvider(ctx, m, ProguardSpecInfoProvider)
|
||||||
depTag := ctx.OtherModuleDependencyTag(m)
|
depTag := ctx.OtherModuleDependencyTag(m)
|
||||||
|
|
||||||
if depProguardInfo.UnconditionallyExportedProguardFlags != nil {
|
if depProguardInfo.UnconditionallyExportedProguardFlags != nil {
|
||||||
@@ -1912,7 +1912,7 @@ func (j *providesTransitiveHeaderJars) collectTransitiveHeaderJars(ctx android.M
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
dep := ctx.OtherModuleProvider(module, JavaInfoProvider).(JavaInfo)
|
dep, _ := android.OtherModuleProvider(ctx, module, JavaInfoProvider)
|
||||||
tag := ctx.OtherModuleDependencyTag(module)
|
tag := ctx.OtherModuleDependencyTag(module)
|
||||||
_, isUsesLibDep := tag.(usesLibraryDependencyTag)
|
_, isUsesLibDep := tag.(usesLibraryDependencyTag)
|
||||||
if tag == libTag || tag == r8LibraryJarTag || isUsesLibDep {
|
if tag == libTag || tag == r8LibraryJarTag || isUsesLibDep {
|
||||||
@@ -2037,7 +2037,7 @@ func (j *Module) collectTransitiveSrcFiles(ctx android.ModuleContext, mine andro
|
|||||||
ctx.VisitDirectDeps(func(module android.Module) {
|
ctx.VisitDirectDeps(func(module android.Module) {
|
||||||
tag := ctx.OtherModuleDependencyTag(module)
|
tag := ctx.OtherModuleDependencyTag(module)
|
||||||
if tag == staticLibTag {
|
if tag == staticLibTag {
|
||||||
depInfo := ctx.OtherModuleProvider(module, JavaInfoProvider).(JavaInfo)
|
depInfo, _ := android.OtherModuleProvider(ctx, module, JavaInfoProvider)
|
||||||
if depInfo.TransitiveSrcFiles != nil {
|
if depInfo.TransitiveSrcFiles != nil {
|
||||||
fromDeps = append(fromDeps, depInfo.TransitiveSrcFiles)
|
fromDeps = append(fromDeps, depInfo.TransitiveSrcFiles)
|
||||||
}
|
}
|
||||||
@@ -2209,15 +2209,14 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
|
|||||||
case staticLibTag:
|
case staticLibTag:
|
||||||
ctx.ModuleErrorf("dependency on java_sdk_library %q can only be in libs", otherName)
|
ctx.ModuleErrorf("dependency on java_sdk_library %q can only be in libs", otherName)
|
||||||
}
|
}
|
||||||
} else if ctx.OtherModuleHasProvider(module, JavaInfoProvider) {
|
} else if dep, ok := android.OtherModuleProvider(ctx, module, JavaInfoProvider); ok {
|
||||||
dep := ctx.OtherModuleProvider(module, JavaInfoProvider).(JavaInfo)
|
if sdkLinkType != javaPlatform {
|
||||||
if sdkLinkType != javaPlatform &&
|
if syspropDep, ok := android.OtherModuleProvider(ctx, module, SyspropPublicStubInfoProvider); ok {
|
||||||
ctx.OtherModuleHasProvider(module, SyspropPublicStubInfoProvider) {
|
// dep is a sysprop implementation library, but this module is not linking against
|
||||||
// dep is a sysprop implementation library, but this module is not linking against
|
// the platform, so it gets the sysprop public stubs library instead. Replace
|
||||||
// the platform, so it gets the sysprop public stubs library instead. Replace
|
// dep with the JavaInfo from the SyspropPublicStubInfoProvider.
|
||||||
// dep with the JavaInfo from the SyspropPublicStubInfoProvider.
|
dep = syspropDep.JavaInfo
|
||||||
syspropDep := ctx.OtherModuleProvider(module, SyspropPublicStubInfoProvider).(SyspropPublicStubInfo)
|
}
|
||||||
dep = syspropDep.JavaInfo
|
|
||||||
}
|
}
|
||||||
switch tag {
|
switch tag {
|
||||||
case bootClasspathTag:
|
case bootClasspathTag:
|
||||||
@@ -2289,7 +2288,7 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
|
|||||||
case syspropPublicStubDepTag:
|
case syspropPublicStubDepTag:
|
||||||
// This is a sysprop implementation library, forward the JavaInfoProvider from
|
// This is a sysprop implementation library, forward the JavaInfoProvider from
|
||||||
// the corresponding sysprop public stub library as SyspropPublicStubInfoProvider.
|
// the corresponding sysprop public stub library as SyspropPublicStubInfoProvider.
|
||||||
ctx.SetProvider(SyspropPublicStubInfoProvider, SyspropPublicStubInfo{
|
android.SetProvider(ctx, SyspropPublicStubInfoProvider, SyspropPublicStubInfo{
|
||||||
JavaInfo: dep,
|
JavaInfo: dep,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@@ -500,7 +500,7 @@ func (b *BootclasspathFragmentModule) GenerateAndroidBuildActions(ctx android.Mo
|
|||||||
if ctx.Module() != ctx.FinalModule() {
|
if ctx.Module() != ctx.FinalModule() {
|
||||||
b.HideFromMake()
|
b.HideFromMake()
|
||||||
}
|
}
|
||||||
ctx.SetProvider(testing.TestModuleProviderKey, testing.TestModuleProviderData{})
|
android.SetProvider(ctx, testing.TestModuleProviderKey, testing.TestModuleProviderData{})
|
||||||
}
|
}
|
||||||
|
|
||||||
// getProfileProviderApex returns the name of the apex that provides a boot image profile, or an
|
// getProfileProviderApex returns the name of the apex that provides a boot image profile, or an
|
||||||
@@ -512,7 +512,7 @@ func (b *BootclasspathFragmentModule) getProfileProviderApex(ctx android.BaseMod
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Bootclasspath fragment modules that are for the platform do not produce boot related files.
|
// Bootclasspath fragment modules that are for the platform do not produce boot related files.
|
||||||
apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
|
apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider)
|
||||||
for _, apex := range apexInfo.InApexVariants {
|
for _, apex := range apexInfo.InApexVariants {
|
||||||
if isProfileProviderApex(ctx, apex) {
|
if isProfileProviderApex(ctx, apex) {
|
||||||
return apex
|
return apex
|
||||||
@@ -537,7 +537,7 @@ func (b *BootclasspathFragmentModule) provideApexContentInfo(ctx android.ModuleC
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make the apex content info available for other modules.
|
// Make the apex content info available for other modules.
|
||||||
ctx.SetProvider(BootclasspathFragmentApexContentInfoProvider, info)
|
android.SetProvider(ctx, BootclasspathFragmentApexContentInfoProvider, info)
|
||||||
}
|
}
|
||||||
|
|
||||||
// generateClasspathProtoBuildActions generates all required build actions for classpath.proto config
|
// generateClasspathProtoBuildActions generates all required build actions for classpath.proto config
|
||||||
@@ -623,7 +623,7 @@ func (b *BootclasspathFragmentModule) generateHiddenAPIBuildActions(ctx android.
|
|||||||
hiddenAPIInfo.HiddenAPIFlagOutput = output.HiddenAPIFlagOutput
|
hiddenAPIInfo.HiddenAPIFlagOutput = output.HiddenAPIFlagOutput
|
||||||
|
|
||||||
// Provide it for use by other modules.
|
// Provide it for use by other modules.
|
||||||
ctx.SetProvider(HiddenAPIInfoProvider, hiddenAPIInfo)
|
android.SetProvider(ctx, HiddenAPIInfoProvider, hiddenAPIInfo)
|
||||||
|
|
||||||
return output
|
return output
|
||||||
}
|
}
|
||||||
@@ -744,7 +744,7 @@ func (b *BootclasspathFragmentModule) produceHiddenAPIOutput(ctx android.ModuleC
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make the information available for the sdk snapshot.
|
// Make the information available for the sdk snapshot.
|
||||||
ctx.SetProvider(HiddenAPIInfoForSdkProvider, HiddenAPIInfoForSdk{
|
android.SetProvider(ctx, HiddenAPIInfoForSdkProvider, HiddenAPIInfoForSdk{
|
||||||
FlagFilesByCategory: flagFilesByCategory,
|
FlagFilesByCategory: flagFilesByCategory,
|
||||||
HiddenAPIFlagOutput: flagOutput,
|
HiddenAPIFlagOutput: flagOutput,
|
||||||
})
|
})
|
||||||
@@ -876,7 +876,7 @@ func (b *bootclasspathFragmentSdkMemberProperties) PopulateFromVariant(ctx andro
|
|||||||
|
|
||||||
// Get the hidden API information from the module.
|
// Get the hidden API information from the module.
|
||||||
mctx := ctx.SdkModuleContext()
|
mctx := ctx.SdkModuleContext()
|
||||||
hiddenAPIInfo := mctx.OtherModuleProvider(module, HiddenAPIInfoForSdkProvider).(HiddenAPIInfoForSdk)
|
hiddenAPIInfo, _ := android.OtherModuleProvider(mctx, module, HiddenAPIInfoForSdkProvider)
|
||||||
b.Flag_files_by_category = hiddenAPIInfo.FlagFilesByCategory
|
b.Flag_files_by_category = hiddenAPIInfo.FlagFilesByCategory
|
||||||
|
|
||||||
// Copy all the generated file paths.
|
// Copy all the generated file paths.
|
||||||
|
@@ -272,7 +272,7 @@ func TestBootclasspathFragment_StubLibs(t *testing.T) {
|
|||||||
`)
|
`)
|
||||||
|
|
||||||
fragment := result.Module("myfragment", "android_common")
|
fragment := result.Module("myfragment", "android_common")
|
||||||
info := result.ModuleProvider(fragment, HiddenAPIInfoProvider).(HiddenAPIInfo)
|
info, _ := android.SingletonModuleProvider(result, fragment, HiddenAPIInfoProvider)
|
||||||
|
|
||||||
stubsJar := "out/soong/.intermediates/mystublib/android_common/dex/mystublib.jar"
|
stubsJar := "out/soong/.intermediates/mystublib/android_common/dex/mystublib.jar"
|
||||||
|
|
||||||
@@ -456,7 +456,7 @@ func TestSnapshotWithBootclasspathFragment_HiddenAPI(t *testing.T) {
|
|||||||
|
|
||||||
// Make sure that the library exports hidden API properties for use by the bootclasspath_fragment.
|
// Make sure that the library exports hidden API properties for use by the bootclasspath_fragment.
|
||||||
library := result.Module("mynewlibrary", "android_common")
|
library := result.Module("mynewlibrary", "android_common")
|
||||||
info := result.ModuleProvider(library, hiddenAPIPropertyInfoProvider).(HiddenAPIPropertyInfo)
|
info, _ := android.SingletonModuleProvider(result, library, hiddenAPIPropertyInfoProvider)
|
||||||
android.AssertArrayString(t, "split packages", []string{"sdklibrary", "newlibrary"}, info.SplitPackages)
|
android.AssertArrayString(t, "split packages", []string{"sdklibrary", "newlibrary"}, info.SplitPackages)
|
||||||
android.AssertArrayString(t, "package prefixes", []string{"newlibrary.all.mine"}, info.PackagePrefixes)
|
android.AssertArrayString(t, "package prefixes", []string{"newlibrary.all.mine"}, info.PackagePrefixes)
|
||||||
android.AssertArrayString(t, "single packages", []string{"newlibrary.mine"}, info.SinglePackages)
|
android.AssertArrayString(t, "single packages", []string{"newlibrary.mine"}, info.SinglePackages)
|
||||||
|
@@ -21,7 +21,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
"github.com/google/blueprint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Supports constructing a list of ClasspathElement from a set of fragments and modules.
|
// Supports constructing a list of ClasspathElement from a set of fragments and modules.
|
||||||
@@ -72,8 +71,7 @@ var _ ClasspathElement = (*ClasspathLibraryElement)(nil)
|
|||||||
|
|
||||||
// ClasspathElementContext defines the context methods needed by CreateClasspathElements
|
// ClasspathElementContext defines the context methods needed by CreateClasspathElements
|
||||||
type ClasspathElementContext interface {
|
type ClasspathElementContext interface {
|
||||||
OtherModuleHasProvider(m blueprint.Module, provider blueprint.AnyProviderKey) bool
|
android.OtherModuleProviderContext
|
||||||
OtherModuleProvider(m blueprint.Module, provider blueprint.AnyProviderKey) interface{}
|
|
||||||
ModuleErrorf(fmt string, args ...interface{})
|
ModuleErrorf(fmt string, args ...interface{})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,12 +121,12 @@ func CreateClasspathElements(ctx ClasspathElementContext, libraries []android.Mo
|
|||||||
// associated with a particular apex.
|
// associated with a particular apex.
|
||||||
apexToFragment := map[string]android.Module{}
|
apexToFragment := map[string]android.Module{}
|
||||||
for _, fragment := range fragments {
|
for _, fragment := range fragments {
|
||||||
if !ctx.OtherModuleHasProvider(fragment, android.ApexInfoProvider) {
|
apexInfo, ok := android.OtherModuleProvider(ctx, fragment, android.ApexInfoProvider)
|
||||||
|
if !ok {
|
||||||
ctx.ModuleErrorf("fragment %s is not part of an apex", fragment)
|
ctx.ModuleErrorf("fragment %s is not part of an apex", fragment)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
apexInfo := ctx.OtherModuleProvider(fragment, android.ApexInfoProvider).(android.ApexInfo)
|
|
||||||
for _, apex := range apexInfo.InApexVariants {
|
for _, apex := range apexInfo.InApexVariants {
|
||||||
if existing, ok := apexToFragment[apex]; ok {
|
if existing, ok := apexToFragment[apex]; ok {
|
||||||
ctx.ModuleErrorf("apex %s has multiple fragments, %s and %s", apex, fragment, existing)
|
ctx.ModuleErrorf("apex %s has multiple fragments, %s and %s", apex, fragment, existing)
|
||||||
@@ -146,8 +144,7 @@ skipLibrary:
|
|||||||
// Iterate over the libraries to construct the ClasspathElements list.
|
// Iterate over the libraries to construct the ClasspathElements list.
|
||||||
for _, library := range libraries {
|
for _, library := range libraries {
|
||||||
var element ClasspathElement
|
var element ClasspathElement
|
||||||
if ctx.OtherModuleHasProvider(library, android.ApexInfoProvider) {
|
if apexInfo, ok := android.OtherModuleProvider(ctx, library, android.ApexInfoProvider); ok {
|
||||||
apexInfo := ctx.OtherModuleProvider(library, android.ApexInfoProvider).(android.ApexInfo)
|
|
||||||
|
|
||||||
var fragment android.Module
|
var fragment android.Module
|
||||||
|
|
||||||
|
@@ -178,7 +178,7 @@ func (c *ClasspathFragmentBase) generateClasspathProtoBuildActions(ctx android.M
|
|||||||
ClasspathFragmentProtoInstallDir: c.installDirPath,
|
ClasspathFragmentProtoInstallDir: c.installDirPath,
|
||||||
ClasspathFragmentProtoOutput: c.outputFilepath,
|
ClasspathFragmentProtoOutput: c.outputFilepath,
|
||||||
}
|
}
|
||||||
ctx.SetProvider(ClasspathFragmentProtoContentInfoProvider, classpathProtoInfo)
|
android.SetProvider(ctx, ClasspathFragmentProtoContentInfoProvider, classpathProtoInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
func writeClasspathsTextproto(ctx android.ModuleContext, output android.WritablePath, jars []classpathJar) {
|
func writeClasspathsTextproto(ctx android.ModuleContext, output android.WritablePath, jars []classpathJar) {
|
||||||
|
@@ -30,9 +30,7 @@ func TestCodeMetadata(t *testing.T) {
|
|||||||
).Module().(*soongTesting.CodeMetadataModule)
|
).Module().(*soongTesting.CodeMetadataModule)
|
||||||
|
|
||||||
// Check that the provider has the right contents
|
// Check that the provider has the right contents
|
||||||
data := result.ModuleProvider(
|
data, _ := android.SingletonModuleProvider(result, module, soongTesting.CodeMetadataProviderKey)
|
||||||
module, soongTesting.CodeMetadataProviderKey,
|
|
||||||
).(soongTesting.CodeMetadataProviderData)
|
|
||||||
if !strings.HasSuffix(
|
if !strings.HasSuffix(
|
||||||
data.IntermediatePath.String(), "/intermediateCodeMetadata.pb",
|
data.IntermediatePath.String(), "/intermediateCodeMetadata.pb",
|
||||||
) {
|
) {
|
||||||
|
@@ -97,8 +97,7 @@ func (d *DeviceHostConverter) GenerateAndroidBuildActions(ctx android.ModuleCont
|
|||||||
}
|
}
|
||||||
|
|
||||||
ctx.VisitDirectDepsWithTag(deviceHostConverterDepTag, func(m android.Module) {
|
ctx.VisitDirectDepsWithTag(deviceHostConverterDepTag, func(m android.Module) {
|
||||||
if ctx.OtherModuleHasProvider(m, JavaInfoProvider) {
|
if dep, ok := android.OtherModuleProvider(ctx, m, JavaInfoProvider); ok {
|
||||||
dep := ctx.OtherModuleProvider(m, JavaInfoProvider).(JavaInfo)
|
|
||||||
d.headerJars = append(d.headerJars, dep.HeaderJars...)
|
d.headerJars = append(d.headerJars, dep.HeaderJars...)
|
||||||
d.implementationJars = append(d.implementationJars, dep.ImplementationJars...)
|
d.implementationJars = append(d.implementationJars, dep.ImplementationJars...)
|
||||||
d.implementationAndResourceJars = append(d.implementationAndResourceJars, dep.ImplementationAndResourcesJars...)
|
d.implementationAndResourceJars = append(d.implementationAndResourceJars, dep.ImplementationAndResourcesJars...)
|
||||||
@@ -131,7 +130,7 @@ func (d *DeviceHostConverter) GenerateAndroidBuildActions(ctx android.ModuleCont
|
|||||||
d.combinedHeaderJar = d.headerJars[0]
|
d.combinedHeaderJar = d.headerJars[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.SetProvider(JavaInfoProvider, JavaInfo{
|
android.SetProvider(ctx, JavaInfoProvider, JavaInfo{
|
||||||
HeaderJars: d.headerJars,
|
HeaderJars: d.headerJars,
|
||||||
ImplementationAndResourcesJars: d.implementationAndResourceJars,
|
ImplementationAndResourcesJars: d.implementationAndResourceJars,
|
||||||
ImplementationJars: d.implementationJars,
|
ImplementationJars: d.implementationJars,
|
||||||
|
@@ -261,7 +261,7 @@ func (d *dexer) r8Flags(ctx android.ModuleContext, flags javaBuilderFlags) (r8Fl
|
|||||||
// See b/20667396
|
// See b/20667396
|
||||||
var proguardRaiseDeps classpath
|
var proguardRaiseDeps classpath
|
||||||
ctx.VisitDirectDepsWithTag(proguardRaiseTag, func(m android.Module) {
|
ctx.VisitDirectDepsWithTag(proguardRaiseTag, func(m android.Module) {
|
||||||
dep := ctx.OtherModuleProvider(m, JavaInfoProvider).(JavaInfo)
|
dep, _ := android.OtherModuleProvider(ctx, m, JavaInfoProvider)
|
||||||
proguardRaiseDeps = append(proguardRaiseDeps, dep.HeaderJars...)
|
proguardRaiseDeps = append(proguardRaiseDeps, dep.HeaderJars...)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@@ -166,12 +166,12 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func isApexVariant(ctx android.BaseModuleContext) bool {
|
func isApexVariant(ctx android.BaseModuleContext) bool {
|
||||||
apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
|
apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider)
|
||||||
return !apexInfo.IsForPlatform()
|
return !apexInfo.IsForPlatform()
|
||||||
}
|
}
|
||||||
|
|
||||||
func forPrebuiltApex(ctx android.BaseModuleContext) bool {
|
func forPrebuiltApex(ctx android.BaseModuleContext) bool {
|
||||||
apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
|
apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider)
|
||||||
return apexInfo.ForPrebuiltApex
|
return apexInfo.ForPrebuiltApex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -544,7 +544,7 @@ func gatherBootclasspathFragments(ctx android.ModuleContext) map[string]android.
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if tag == bootclasspathFragmentDepTag {
|
if tag == bootclasspathFragmentDepTag {
|
||||||
apexInfo := ctx.OtherModuleProvider(child, android.ApexInfoProvider).(android.ApexInfo)
|
apexInfo, _ := android.OtherModuleProvider(ctx, child, android.ApexInfoProvider)
|
||||||
for _, apex := range apexInfo.InApexVariants {
|
for _, apex := range apexInfo.InApexVariants {
|
||||||
fragments[apex] = child
|
fragments[apex] = child
|
||||||
}
|
}
|
||||||
@@ -682,7 +682,7 @@ func extractEncodedDexJarsFromModulesOrBootclasspathFragments(ctx android.Module
|
|||||||
pair.jarModule.Name(),
|
pair.jarModule.Name(),
|
||||||
pair.apex)
|
pair.apex)
|
||||||
}
|
}
|
||||||
bootclasspathFragmentInfo := ctx.OtherModuleProvider(fragment, BootclasspathFragmentApexContentInfoProvider).(BootclasspathFragmentApexContentInfo)
|
bootclasspathFragmentInfo, _ := android.OtherModuleProvider(ctx, fragment, BootclasspathFragmentApexContentInfoProvider)
|
||||||
jar, err := bootclasspathFragmentInfo.DexBootJarPathForContentModule(pair.jarModule)
|
jar, err := bootclasspathFragmentInfo.DexBootJarPathForContentModule(pair.jarModule)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.ModuleErrorf("%s", err)
|
ctx.ModuleErrorf("%s", err)
|
||||||
|
@@ -363,8 +363,7 @@ func (j *Javadoc) collectDeps(ctx android.ModuleContext) deps {
|
|||||||
|
|
||||||
switch tag {
|
switch tag {
|
||||||
case bootClasspathTag:
|
case bootClasspathTag:
|
||||||
if ctx.OtherModuleHasProvider(module, JavaInfoProvider) {
|
if dep, ok := android.OtherModuleProvider(ctx, module, JavaInfoProvider); ok {
|
||||||
dep := ctx.OtherModuleProvider(module, JavaInfoProvider).(JavaInfo)
|
|
||||||
deps.bootClasspath = append(deps.bootClasspath, dep.ImplementationJars...)
|
deps.bootClasspath = append(deps.bootClasspath, dep.ImplementationJars...)
|
||||||
} else if sm, ok := module.(SystemModulesProvider); ok {
|
} else if sm, ok := module.(SystemModulesProvider); ok {
|
||||||
// A system modules dependency has been added to the bootclasspath
|
// A system modules dependency has been added to the bootclasspath
|
||||||
@@ -376,8 +375,7 @@ func (j *Javadoc) collectDeps(ctx android.ModuleContext) deps {
|
|||||||
case libTag, sdkLibTag:
|
case libTag, sdkLibTag:
|
||||||
if dep, ok := module.(SdkLibraryDependency); ok {
|
if dep, ok := module.(SdkLibraryDependency); ok {
|
||||||
deps.classpath = append(deps.classpath, dep.SdkHeaderJars(ctx, j.SdkVersion(ctx))...)
|
deps.classpath = append(deps.classpath, dep.SdkHeaderJars(ctx, j.SdkVersion(ctx))...)
|
||||||
} else if ctx.OtherModuleHasProvider(module, JavaInfoProvider) {
|
} else if dep, ok := android.OtherModuleProvider(ctx, module, JavaInfoProvider); ok {
|
||||||
dep := ctx.OtherModuleProvider(module, JavaInfoProvider).(JavaInfo)
|
|
||||||
deps.classpath = append(deps.classpath, dep.HeaderJars...)
|
deps.classpath = append(deps.classpath, dep.HeaderJars...)
|
||||||
deps.aidlIncludeDirs = append(deps.aidlIncludeDirs, dep.AidlIncludeDirs...)
|
deps.aidlIncludeDirs = append(deps.aidlIncludeDirs, dep.AidlIncludeDirs...)
|
||||||
} else if dep, ok := module.(android.SourceFileProducer); ok {
|
} else if dep, ok := module.(android.SourceFileProducer); ok {
|
||||||
@@ -387,8 +385,7 @@ func (j *Javadoc) collectDeps(ctx android.ModuleContext) deps {
|
|||||||
ctx.ModuleErrorf("depends on non-java module %q", otherName)
|
ctx.ModuleErrorf("depends on non-java module %q", otherName)
|
||||||
}
|
}
|
||||||
case java9LibTag:
|
case java9LibTag:
|
||||||
if ctx.OtherModuleHasProvider(module, JavaInfoProvider) {
|
if dep, ok := android.OtherModuleProvider(ctx, module, JavaInfoProvider); ok {
|
||||||
dep := ctx.OtherModuleProvider(module, JavaInfoProvider).(JavaInfo)
|
|
||||||
deps.java9Classpath = append(deps.java9Classpath, dep.HeaderJars...)
|
deps.java9Classpath = append(deps.java9Classpath, dep.HeaderJars...)
|
||||||
} else {
|
} else {
|
||||||
ctx.ModuleErrorf("depends on non-java module %q", otherName)
|
ctx.ModuleErrorf("depends on non-java module %q", otherName)
|
||||||
|
@@ -121,7 +121,7 @@ func (j *JavaFuzzTest) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
|
|
||||||
_, sharedDeps := cc.CollectAllSharedDependencies(ctx)
|
_, sharedDeps := cc.CollectAllSharedDependencies(ctx)
|
||||||
for _, dep := range sharedDeps {
|
for _, dep := range sharedDeps {
|
||||||
sharedLibInfo := ctx.OtherModuleProvider(dep, cc.SharedLibraryInfoProvider).(cc.SharedLibraryInfo)
|
sharedLibInfo, _ := android.OtherModuleProvider(ctx, dep, cc.SharedLibraryInfoProvider)
|
||||||
if sharedLibInfo.SharedLibrary != nil {
|
if sharedLibInfo.SharedLibrary != nil {
|
||||||
arch := "lib"
|
arch := "lib"
|
||||||
if sharedLibInfo.Target.Arch.ArchType.Multilib == "lib64" {
|
if sharedLibInfo.Target.Arch.ArchType.Multilib == "lib64" {
|
||||||
|
@@ -94,7 +94,7 @@ func (h *hiddenAPI) initHiddenAPI(ctx android.ModuleContext, dexJar OptionalDexJ
|
|||||||
// processing.
|
// processing.
|
||||||
classesJars := android.Paths{classesJar}
|
classesJars := android.Paths{classesJar}
|
||||||
ctx.VisitDirectDepsWithTag(hiddenApiAnnotationsTag, func(dep android.Module) {
|
ctx.VisitDirectDepsWithTag(hiddenApiAnnotationsTag, func(dep android.Module) {
|
||||||
javaInfo := ctx.OtherModuleProvider(dep, JavaInfoProvider).(JavaInfo)
|
javaInfo, _ := android.OtherModuleProvider(ctx, dep, JavaInfoProvider)
|
||||||
classesJars = append(classesJars, javaInfo.ImplementationJars...)
|
classesJars = append(classesJars, javaInfo.ImplementationJars...)
|
||||||
})
|
})
|
||||||
h.classesJarPaths = classesJars
|
h.classesJarPaths = classesJars
|
||||||
|
@@ -579,8 +579,7 @@ func (i *HiddenAPIInfo) mergeFromFragmentDeps(ctx android.ModuleContext, fragmen
|
|||||||
// Merge all the information from the fragments. The fragments form a DAG so it is possible that
|
// Merge all the information from the fragments. The fragments form a DAG so it is possible that
|
||||||
// this will introduce duplicates so they will be resolved after processing all the fragments.
|
// this will introduce duplicates so they will be resolved after processing all the fragments.
|
||||||
for _, fragment := range fragments {
|
for _, fragment := range fragments {
|
||||||
if ctx.OtherModuleHasProvider(fragment, HiddenAPIInfoProvider) {
|
if info, ok := android.OtherModuleProvider(ctx, fragment, HiddenAPIInfoProvider); ok {
|
||||||
info := ctx.OtherModuleProvider(fragment, HiddenAPIInfoProvider).(HiddenAPIInfo)
|
|
||||||
i.TransitiveStubDexJarsByScope.addStubDexJarsByModule(info.TransitiveStubDexJarsByScope)
|
i.TransitiveStubDexJarsByScope.addStubDexJarsByModule(info.TransitiveStubDexJarsByScope)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -777,8 +776,7 @@ func (i *HiddenAPIPropertyInfo) extractPackageRulesFromProperties(p *HiddenAPIPa
|
|||||||
|
|
||||||
func (i *HiddenAPIPropertyInfo) gatherPropertyInfo(ctx android.ModuleContext, contents []android.Module) {
|
func (i *HiddenAPIPropertyInfo) gatherPropertyInfo(ctx android.ModuleContext, contents []android.Module) {
|
||||||
for _, module := range contents {
|
for _, module := range contents {
|
||||||
if ctx.OtherModuleHasProvider(module, hiddenAPIPropertyInfoProvider) {
|
if info, ok := android.OtherModuleProvider(ctx, module, hiddenAPIPropertyInfoProvider); ok {
|
||||||
info := ctx.OtherModuleProvider(module, hiddenAPIPropertyInfoProvider).(HiddenAPIPropertyInfo)
|
|
||||||
i.FlagFilesByCategory.append(info.FlagFilesByCategory)
|
i.FlagFilesByCategory.append(info.FlagFilesByCategory)
|
||||||
i.PackagePrefixes = append(i.PackagePrefixes, info.PackagePrefixes...)
|
i.PackagePrefixes = append(i.PackagePrefixes, info.PackagePrefixes...)
|
||||||
i.SinglePackages = append(i.SinglePackages, info.SinglePackages...)
|
i.SinglePackages = append(i.SinglePackages, info.SinglePackages...)
|
||||||
@@ -1404,7 +1402,7 @@ func deferReportingMissingBootDexJar(ctx android.ModuleContext, module android.M
|
|||||||
}
|
}
|
||||||
|
|
||||||
if am, ok := module.(android.ApexModule); ok && am.InAnyApex() {
|
if am, ok := module.(android.ApexModule); ok && am.InAnyApex() {
|
||||||
apexInfo := ctx.OtherModuleProvider(module, android.ApexInfoProvider).(android.ApexInfo)
|
apexInfo, _ := android.OtherModuleProvider(ctx, module, android.ApexInfoProvider)
|
||||||
if apexInfo.IsForPlatform() {
|
if apexInfo.IsForPlatform() {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@@ -67,8 +67,7 @@ func newMonolithicHiddenAPIInfo(ctx android.ModuleContext, flagFilesByCategory F
|
|||||||
|
|
||||||
case *ClasspathFragmentElement:
|
case *ClasspathFragmentElement:
|
||||||
fragment := e.Module()
|
fragment := e.Module()
|
||||||
if ctx.OtherModuleHasProvider(fragment, HiddenAPIInfoProvider) {
|
if info, ok := android.OtherModuleProvider(ctx, fragment, HiddenAPIInfoProvider); ok {
|
||||||
info := ctx.OtherModuleProvider(fragment, HiddenAPIInfoProvider).(HiddenAPIInfo)
|
|
||||||
monolithicInfo.append(&info)
|
monolithicInfo.append(&info)
|
||||||
} else {
|
} else {
|
||||||
ctx.ModuleErrorf("%s does not provide hidden API information", fragment)
|
ctx.ModuleErrorf("%s does not provide hidden API information", fragment)
|
||||||
|
@@ -162,7 +162,7 @@ func isModuleInConfiguredList(ctx android.BaseModuleContext, module android.Modu
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
apexInfo := ctx.OtherModuleProvider(module, android.ApexInfoProvider).(android.ApexInfo)
|
apexInfo, _ := android.OtherModuleProvider(ctx, module, android.ApexInfoProvider)
|
||||||
|
|
||||||
// Now match the apex part of the boot image configuration.
|
// Now match the apex part of the boot image configuration.
|
||||||
requiredApex := configuredBootJars.Apex(index)
|
requiredApex := configuredBootJars.Apex(index)
|
||||||
|
36
java/java.go
36
java/java.go
@@ -647,7 +647,7 @@ func (j *Library) PermittedPackagesForUpdatableBootJars() []string {
|
|||||||
|
|
||||||
func shouldUncompressDex(ctx android.ModuleContext, dexpreopter *dexpreopter) bool {
|
func shouldUncompressDex(ctx android.ModuleContext, dexpreopter *dexpreopter) bool {
|
||||||
// Store uncompressed (and aligned) any dex files from jars in APEXes.
|
// Store uncompressed (and aligned) any dex files from jars in APEXes.
|
||||||
if apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo); !apexInfo.IsForPlatform() {
|
if apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider); !apexInfo.IsForPlatform() {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -687,7 +687,7 @@ func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
j.stem = proptools.StringDefault(j.overridableDeviceProperties.Stem, ctx.ModuleName())
|
j.stem = proptools.StringDefault(j.overridableDeviceProperties.Stem, ctx.ModuleName())
|
||||||
|
|
||||||
proguardSpecInfo := j.collectProguardSpecInfo(ctx)
|
proguardSpecInfo := j.collectProguardSpecInfo(ctx)
|
||||||
ctx.SetProvider(ProguardSpecInfoProvider, proguardSpecInfo)
|
android.SetProvider(ctx, ProguardSpecInfoProvider, proguardSpecInfo)
|
||||||
exportedProguardFlagsFiles := proguardSpecInfo.ProguardFlagsFiles.ToList()
|
exportedProguardFlagsFiles := proguardSpecInfo.ProguardFlagsFiles.ToList()
|
||||||
j.extraProguardFlagsFiles = append(j.extraProguardFlagsFiles, exportedProguardFlagsFiles...)
|
j.extraProguardFlagsFiles = append(j.extraProguardFlagsFiles, exportedProguardFlagsFiles...)
|
||||||
|
|
||||||
@@ -695,7 +695,7 @@ func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
writeCombinedProguardFlagsFile(ctx, combinedExportedProguardFlagFile, exportedProguardFlagsFiles)
|
writeCombinedProguardFlagsFile(ctx, combinedExportedProguardFlagFile, exportedProguardFlagsFiles)
|
||||||
j.combinedExportedProguardFlagsFile = combinedExportedProguardFlagFile
|
j.combinedExportedProguardFlagsFile = combinedExportedProguardFlagFile
|
||||||
|
|
||||||
apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
|
apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider)
|
||||||
if !apexInfo.IsForPlatform() {
|
if !apexInfo.IsForPlatform() {
|
||||||
j.hideApexVariantFromMake = true
|
j.hideApexVariantFromMake = true
|
||||||
}
|
}
|
||||||
@@ -1216,12 +1216,12 @@ func (j *TestHost) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
j.Test.generateAndroidBuildActionsWithConfig(ctx, configs)
|
j.Test.generateAndroidBuildActionsWithConfig(ctx, configs)
|
||||||
ctx.SetProvider(testing.TestModuleProviderKey, testing.TestModuleProviderData{})
|
android.SetProvider(ctx, testing.TestModuleProviderKey, testing.TestModuleProviderData{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (j *Test) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
func (j *Test) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
j.generateAndroidBuildActionsWithConfig(ctx, nil)
|
j.generateAndroidBuildActionsWithConfig(ctx, nil)
|
||||||
ctx.SetProvider(testing.TestModuleProviderKey, testing.TestModuleProviderData{})
|
android.SetProvider(ctx, testing.TestModuleProviderKey, testing.TestModuleProviderData{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (j *Test) generateAndroidBuildActionsWithConfig(ctx android.ModuleContext, configs []tradefed.Config) {
|
func (j *Test) generateAndroidBuildActionsWithConfig(ctx android.ModuleContext, configs []tradefed.Config) {
|
||||||
@@ -1257,7 +1257,7 @@ func (j *Test) generateAndroidBuildActionsWithConfig(ctx android.ModuleContext,
|
|||||||
})
|
})
|
||||||
|
|
||||||
ctx.VisitDirectDepsWithTag(jniLibTag, func(dep android.Module) {
|
ctx.VisitDirectDepsWithTag(jniLibTag, func(dep android.Module) {
|
||||||
sharedLibInfo := ctx.OtherModuleProvider(dep, cc.SharedLibraryInfoProvider).(cc.SharedLibraryInfo)
|
sharedLibInfo, _ := android.OtherModuleProvider(ctx, dep, cc.SharedLibraryInfoProvider)
|
||||||
if sharedLibInfo.SharedLibrary != nil {
|
if sharedLibInfo.SharedLibrary != nil {
|
||||||
// Copy to an intermediate output directory to append "lib[64]" to the path,
|
// Copy to an intermediate output directory to append "lib[64]" to the path,
|
||||||
// so that it's compatible with the default rpath values.
|
// so that it's compatible with the default rpath values.
|
||||||
@@ -1632,7 +1632,7 @@ func (ap *JavaApiContribution) GenerateAndroidBuildActions(ctx android.ModuleCon
|
|||||||
apiFile = android.PathForModuleSrc(ctx, String(apiFileString))
|
apiFile = android.PathForModuleSrc(ctx, String(apiFileString))
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.SetProvider(JavaApiImportProvider, JavaApiImportInfo{
|
android.SetProvider(ctx, JavaApiImportProvider, JavaApiImportInfo{
|
||||||
ApiFile: apiFile,
|
ApiFile: apiFile,
|
||||||
ApiSurface: proptools.String(ap.properties.Api_surface),
|
ApiSurface: proptools.String(ap.properties.Api_surface),
|
||||||
})
|
})
|
||||||
@@ -1902,19 +1902,19 @@ func (al *ApiLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
tag := ctx.OtherModuleDependencyTag(dep)
|
tag := ctx.OtherModuleDependencyTag(dep)
|
||||||
switch tag {
|
switch tag {
|
||||||
case javaApiContributionTag:
|
case javaApiContributionTag:
|
||||||
provider := ctx.OtherModuleProvider(dep, JavaApiImportProvider).(JavaApiImportInfo)
|
provider, _ := android.OtherModuleProvider(ctx, dep, JavaApiImportProvider)
|
||||||
if provider.ApiFile == nil && !ctx.Config().AllowMissingDependencies() {
|
if provider.ApiFile == nil && !ctx.Config().AllowMissingDependencies() {
|
||||||
ctx.ModuleErrorf("Error: %s has an empty api file.", dep.Name())
|
ctx.ModuleErrorf("Error: %s has an empty api file.", dep.Name())
|
||||||
}
|
}
|
||||||
srcFilesInfo = append(srcFilesInfo, provider)
|
srcFilesInfo = append(srcFilesInfo, provider)
|
||||||
case libTag:
|
case libTag:
|
||||||
provider := ctx.OtherModuleProvider(dep, JavaInfoProvider).(JavaInfo)
|
provider, _ := android.OtherModuleProvider(ctx, dep, JavaInfoProvider)
|
||||||
classPaths = append(classPaths, provider.HeaderJars...)
|
classPaths = append(classPaths, provider.HeaderJars...)
|
||||||
case staticLibTag:
|
case staticLibTag:
|
||||||
provider := ctx.OtherModuleProvider(dep, JavaInfoProvider).(JavaInfo)
|
provider, _ := android.OtherModuleProvider(ctx, dep, JavaInfoProvider)
|
||||||
staticLibs = append(staticLibs, provider.HeaderJars...)
|
staticLibs = append(staticLibs, provider.HeaderJars...)
|
||||||
case depApiSrcsTag:
|
case depApiSrcsTag:
|
||||||
provider := ctx.OtherModuleProvider(dep, JavaInfoProvider).(JavaInfo)
|
provider, _ := android.OtherModuleProvider(ctx, dep, JavaInfoProvider)
|
||||||
depApiSrcsStubsJar = provider.HeaderJars[0]
|
depApiSrcsStubsJar = provider.HeaderJars[0]
|
||||||
case systemModulesTag:
|
case systemModulesTag:
|
||||||
module := dep.(SystemModulesProvider)
|
module := dep.(SystemModulesProvider)
|
||||||
@@ -2002,7 +2002,7 @@ func (al *ApiLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
|
|
||||||
ctx.Phony(ctx.ModuleName(), al.stubsJar)
|
ctx.Phony(ctx.ModuleName(), al.stubsJar)
|
||||||
|
|
||||||
ctx.SetProvider(JavaInfoProvider, JavaInfo{
|
android.SetProvider(ctx, JavaInfoProvider, JavaInfo{
|
||||||
HeaderJars: android.PathsIfNonNil(al.stubsJar),
|
HeaderJars: android.PathsIfNonNil(al.stubsJar),
|
||||||
ImplementationAndResourcesJars: android.PathsIfNonNil(al.stubsJar),
|
ImplementationAndResourcesJars: android.PathsIfNonNil(al.stubsJar),
|
||||||
ImplementationJars: android.PathsIfNonNil(al.stubsJar),
|
ImplementationJars: android.PathsIfNonNil(al.stubsJar),
|
||||||
@@ -2188,7 +2188,8 @@ func (j *Import) commonBuildActions(ctx android.ModuleContext) {
|
|||||||
j.sdkVersion = j.SdkVersion(ctx)
|
j.sdkVersion = j.SdkVersion(ctx)
|
||||||
j.minSdkVersion = j.MinSdkVersion(ctx)
|
j.minSdkVersion = j.MinSdkVersion(ctx)
|
||||||
|
|
||||||
if !ctx.Provider(android.ApexInfoProvider).(android.ApexInfo).IsForPlatform() {
|
apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider)
|
||||||
|
if !apexInfo.IsForPlatform() {
|
||||||
j.hideApexVariantFromMake = true
|
j.hideApexVariantFromMake = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2219,8 +2220,7 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
j.collectTransitiveHeaderJars(ctx)
|
j.collectTransitiveHeaderJars(ctx)
|
||||||
ctx.VisitDirectDeps(func(module android.Module) {
|
ctx.VisitDirectDeps(func(module android.Module) {
|
||||||
tag := ctx.OtherModuleDependencyTag(module)
|
tag := ctx.OtherModuleDependencyTag(module)
|
||||||
if ctx.OtherModuleHasProvider(module, JavaInfoProvider) {
|
if dep, ok := android.OtherModuleProvider(ctx, module, JavaInfoProvider); ok {
|
||||||
dep := ctx.OtherModuleProvider(module, JavaInfoProvider).(JavaInfo)
|
|
||||||
switch tag {
|
switch tag {
|
||||||
case libTag, sdkLibTag:
|
case libTag, sdkLibTag:
|
||||||
flags.classpath = append(flags.classpath, dep.HeaderJars...)
|
flags.classpath = append(flags.classpath, dep.HeaderJars...)
|
||||||
@@ -2247,7 +2247,7 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
if ctx.Device() {
|
if ctx.Device() {
|
||||||
// If this is a variant created for a prebuilt_apex then use the dex implementation jar
|
// If this is a variant created for a prebuilt_apex then use the dex implementation jar
|
||||||
// obtained from the associated deapexer module.
|
// obtained from the associated deapexer module.
|
||||||
ai := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
|
ai, _ := android.ModuleProvider(ctx, android.ApexInfoProvider)
|
||||||
if ai.ForPrebuiltApex {
|
if ai.ForPrebuiltApex {
|
||||||
// Get the path of the dex implementation jar from the `deapexer` module.
|
// Get the path of the dex implementation jar from the `deapexer` module.
|
||||||
di := android.FindDeapexerProviderForModule(ctx)
|
di := android.FindDeapexerProviderForModule(ctx)
|
||||||
@@ -2320,7 +2320,7 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.SetProvider(JavaInfoProvider, JavaInfo{
|
android.SetProvider(ctx, JavaInfoProvider, JavaInfo{
|
||||||
HeaderJars: android.PathsIfNonNil(j.combinedClasspathFile),
|
HeaderJars: android.PathsIfNonNil(j.combinedClasspathFile),
|
||||||
TransitiveLibsHeaderJars: j.transitiveLibsHeaderJars,
|
TransitiveLibsHeaderJars: j.transitiveLibsHeaderJars,
|
||||||
TransitiveStaticLibsHeaderJars: j.transitiveStaticLibsHeaderJars,
|
TransitiveStaticLibsHeaderJars: j.transitiveStaticLibsHeaderJars,
|
||||||
@@ -2570,7 +2570,7 @@ func (j *DexImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
ctx.PropertyErrorf("jars", "exactly one jar must be provided")
|
ctx.PropertyErrorf("jars", "exactly one jar must be provided")
|
||||||
}
|
}
|
||||||
|
|
||||||
apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
|
apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider)
|
||||||
if !apexInfo.IsForPlatform() {
|
if !apexInfo.IsForPlatform() {
|
||||||
j.hideApexVariantFromMake = true
|
j.hideApexVariantFromMake = true
|
||||||
}
|
}
|
||||||
|
@@ -2226,7 +2226,8 @@ func TestTransitiveSrcFiles(t *testing.T) {
|
|||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
c := ctx.ModuleForTests("c", "android_common").Module()
|
c := ctx.ModuleForTests("c", "android_common").Module()
|
||||||
transitiveSrcFiles := android.Paths(ctx.ModuleProvider(c, JavaInfoProvider).(JavaInfo).TransitiveSrcFiles.ToList())
|
javaInfo, _ := android.SingletonModuleProvider(ctx, c, JavaInfoProvider)
|
||||||
|
transitiveSrcFiles := android.Paths(javaInfo.TransitiveSrcFiles.ToList())
|
||||||
android.AssertArrayString(t, "unexpected jar deps", []string{"b.java", "c.java"}, transitiveSrcFiles.Strings())
|
android.AssertArrayString(t, "unexpected jar deps", []string{"b.java", "c.java"}, transitiveSrcFiles.Strings())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -89,8 +89,7 @@ func (j *jdepsGeneratorSingleton) GenerateBuildActions(ctx android.SingletonCont
|
|||||||
dpInfo.Classes = append(dpInfo.Classes, data.Class)
|
dpInfo.Classes = append(dpInfo.Classes, data.Class)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.ModuleHasProvider(module, JavaInfoProvider) {
|
if dep, ok := android.SingletonModuleProvider(ctx, module, JavaInfoProvider); ok {
|
||||||
dep := ctx.ModuleProvider(module, JavaInfoProvider).(JavaInfo)
|
|
||||||
dpInfo.Installed_paths = append(dpInfo.Installed_paths, dep.ImplementationJars.Strings()...)
|
dpInfo.Installed_paths = append(dpInfo.Installed_paths, dep.ImplementationJars.Strings()...)
|
||||||
}
|
}
|
||||||
dpInfo.Classes = android.FirstUniqueStrings(dpInfo.Classes)
|
dpInfo.Classes = android.FirstUniqueStrings(dpInfo.Classes)
|
||||||
|
@@ -413,8 +413,7 @@ func (l *linter) lint(ctx android.ModuleContext) {
|
|||||||
|
|
||||||
extraLintCheckModules := ctx.GetDirectDepsWithTag(extraLintCheckTag)
|
extraLintCheckModules := ctx.GetDirectDepsWithTag(extraLintCheckTag)
|
||||||
for _, extraLintCheckModule := range extraLintCheckModules {
|
for _, extraLintCheckModule := range extraLintCheckModules {
|
||||||
if ctx.OtherModuleHasProvider(extraLintCheckModule, JavaInfoProvider) {
|
if dep, ok := android.OtherModuleProvider(ctx, extraLintCheckModule, JavaInfoProvider); ok {
|
||||||
dep := ctx.OtherModuleProvider(extraLintCheckModule, JavaInfoProvider).(JavaInfo)
|
|
||||||
l.extraLintCheckJars = append(l.extraLintCheckJars, dep.ImplementationAndResourcesJars...)
|
l.extraLintCheckJars = append(l.extraLintCheckJars, dep.ImplementationAndResourcesJars...)
|
||||||
} else {
|
} else {
|
||||||
ctx.PropertyErrorf("lint.extra_check_modules",
|
ctx.PropertyErrorf("lint.extra_check_modules",
|
||||||
@@ -661,7 +660,7 @@ func (l *lintSingleton) generateLintReportZips(ctx android.SingletonContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if apex, ok := m.(android.ApexModule); ok && apex.NotAvailableForPlatform() {
|
if apex, ok := m.(android.ApexModule); ok && apex.NotAvailableForPlatform() {
|
||||||
apexInfo := ctx.ModuleProvider(m, android.ApexInfoProvider).(android.ApexInfo)
|
apexInfo, _ := android.SingletonModuleProvider(ctx, m, android.ApexInfoProvider)
|
||||||
if apexInfo.IsForPlatform() {
|
if apexInfo.IsForPlatform() {
|
||||||
// There are stray platform variants of modules in apexes that are not available for
|
// There are stray platform variants of modules in apexes that are not available for
|
||||||
// the platform, and they sometimes can't be built. Don't depend on them.
|
// the platform, and they sometimes can't be built. Don't depend on them.
|
||||||
|
@@ -180,7 +180,7 @@ func (b *platformBootclasspathModule) GenerateAndroidBuildActions(ctx android.Mo
|
|||||||
|
|
||||||
var transitiveSrcFiles android.Paths
|
var transitiveSrcFiles android.Paths
|
||||||
for _, module := range allModules {
|
for _, module := range allModules {
|
||||||
depInfo := ctx.OtherModuleProvider(module, JavaInfoProvider).(JavaInfo)
|
depInfo, _ := android.OtherModuleProvider(ctx, module, JavaInfoProvider)
|
||||||
if depInfo.TransitiveSrcFiles != nil {
|
if depInfo.TransitiveSrcFiles != nil {
|
||||||
transitiveSrcFiles = append(transitiveSrcFiles, depInfo.TransitiveSrcFiles.ToList()...)
|
transitiveSrcFiles = append(transitiveSrcFiles, depInfo.TransitiveSrcFiles.ToList()...)
|
||||||
}
|
}
|
||||||
@@ -219,7 +219,7 @@ func (b *platformBootclasspathModule) configuredJars(ctx android.ModuleContext)
|
|||||||
// Include jars from APEXes that don't populate their classpath proto config.
|
// Include jars from APEXes that don't populate their classpath proto config.
|
||||||
remainingJars := dexpreopt.GetGlobalConfig(ctx).ApexBootJars
|
remainingJars := dexpreopt.GetGlobalConfig(ctx).ApexBootJars
|
||||||
for _, fragment := range b.fragments {
|
for _, fragment := range b.fragments {
|
||||||
info := ctx.OtherModuleProvider(fragment, ClasspathFragmentProtoContentInfoProvider).(ClasspathFragmentProtoContentInfo)
|
info, _ := android.OtherModuleProvider(ctx, fragment, ClasspathFragmentProtoContentInfoProvider)
|
||||||
if info.ClasspathFragmentProtoGenerated {
|
if info.ClasspathFragmentProtoGenerated {
|
||||||
remainingJars = remainingJars.RemoveList(info.ClasspathFragmentProtoContents)
|
remainingJars = remainingJars.RemoveList(info.ClasspathFragmentProtoContents)
|
||||||
}
|
}
|
||||||
@@ -241,7 +241,7 @@ func (b *platformBootclasspathModule) platformJars(ctx android.PathContext) andr
|
|||||||
func (b *platformBootclasspathModule) checkPlatformModules(ctx android.ModuleContext, modules []android.Module) {
|
func (b *platformBootclasspathModule) checkPlatformModules(ctx android.ModuleContext, modules []android.Module) {
|
||||||
// TODO(satayev): change this check to only allow core-icu4j, all apex jars should not be here.
|
// TODO(satayev): change this check to only allow core-icu4j, all apex jars should not be here.
|
||||||
for _, m := range modules {
|
for _, m := range modules {
|
||||||
apexInfo := ctx.OtherModuleProvider(m, android.ApexInfoProvider).(android.ApexInfo)
|
apexInfo, _ := android.OtherModuleProvider(ctx, m, android.ApexInfoProvider)
|
||||||
fromUpdatableApex := apexInfo.Updatable
|
fromUpdatableApex := apexInfo.Updatable
|
||||||
if fromUpdatableApex {
|
if fromUpdatableApex {
|
||||||
// error: this jar is part of an updatable apex
|
// error: this jar is part of an updatable apex
|
||||||
@@ -255,7 +255,7 @@ func (b *platformBootclasspathModule) checkPlatformModules(ctx android.ModuleCon
|
|||||||
// checkApexModules ensures that the apex modules supplied are not from the platform.
|
// checkApexModules ensures that the apex modules supplied are not from the platform.
|
||||||
func (b *platformBootclasspathModule) checkApexModules(ctx android.ModuleContext, modules []android.Module) {
|
func (b *platformBootclasspathModule) checkApexModules(ctx android.ModuleContext, modules []android.Module) {
|
||||||
for _, m := range modules {
|
for _, m := range modules {
|
||||||
apexInfo := ctx.OtherModuleProvider(m, android.ApexInfoProvider).(android.ApexInfo)
|
apexInfo, _ := android.OtherModuleProvider(ctx, m, android.ApexInfoProvider)
|
||||||
fromUpdatableApex := apexInfo.Updatable
|
fromUpdatableApex := apexInfo.Updatable
|
||||||
if fromUpdatableApex {
|
if fromUpdatableApex {
|
||||||
// ok: this jar is part of an updatable apex
|
// ok: this jar is part of an updatable apex
|
||||||
@@ -389,7 +389,7 @@ func (b *platformBootclasspathModule) createAndProvideMonolithicHiddenAPIInfo(ct
|
|||||||
monolithicInfo := newMonolithicHiddenAPIInfo(ctx, temporaryInput.FlagFilesByCategory, classpathElements)
|
monolithicInfo := newMonolithicHiddenAPIInfo(ctx, temporaryInput.FlagFilesByCategory, classpathElements)
|
||||||
|
|
||||||
// Store the information for testing.
|
// Store the information for testing.
|
||||||
ctx.SetProvider(MonolithicHiddenAPIInfoProvider, monolithicInfo)
|
android.SetProvider(ctx, MonolithicHiddenAPIInfoProvider, monolithicInfo)
|
||||||
return monolithicInfo
|
return monolithicInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -193,7 +193,7 @@ func (r *robolectricTest) GenerateAndroidBuildActions(ctx android.ModuleContext)
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleLibDeps := func(dep android.Module) {
|
handleLibDeps := func(dep android.Module) {
|
||||||
m := ctx.OtherModuleProvider(dep, JavaInfoProvider).(JavaInfo)
|
m, _ := android.OtherModuleProvider(ctx, dep, JavaInfoProvider)
|
||||||
r.libs = append(r.libs, ctx.OtherModuleName(dep))
|
r.libs = append(r.libs, ctx.OtherModuleName(dep))
|
||||||
if !android.InList(ctx.OtherModuleName(dep), config.FrameworkLibraries) {
|
if !android.InList(ctx.OtherModuleName(dep), config.FrameworkLibraries) {
|
||||||
combinedJarJars = append(combinedJarJars, m.ImplementationAndResourcesJars...)
|
combinedJarJars = append(combinedJarJars, m.ImplementationAndResourcesJars...)
|
||||||
@@ -254,7 +254,7 @@ func (r *robolectricTest) GenerateAndroidBuildActions(ctx android.ModuleContext)
|
|||||||
}
|
}
|
||||||
|
|
||||||
r.installFile = ctx.InstallFile(installPath, ctx.ModuleName()+".jar", r.combinedJar, installDeps...)
|
r.installFile = ctx.InstallFile(installPath, ctx.ModuleName()+".jar", r.combinedJar, installDeps...)
|
||||||
ctx.SetProvider(testing.TestModuleProviderKey, testing.TestModuleProviderData{})
|
android.SetProvider(ctx, testing.TestModuleProviderKey, testing.TestModuleProviderData{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateRoboTestConfig(ctx android.ModuleContext, outputFile android.WritablePath,
|
func generateRoboTestConfig(ctx android.ModuleContext, outputFile android.WritablePath,
|
||||||
@@ -305,8 +305,7 @@ func (r *robolectricTest) generateRoboSrcJar(ctx android.ModuleContext, outputFi
|
|||||||
srcJarDeps := append(android.Paths(nil), instrumentedApp.srcJarDeps...)
|
srcJarDeps := append(android.Paths(nil), instrumentedApp.srcJarDeps...)
|
||||||
|
|
||||||
for _, m := range ctx.GetDirectDepsWithTag(roboCoverageLibsTag) {
|
for _, m := range ctx.GetDirectDepsWithTag(roboCoverageLibsTag) {
|
||||||
if ctx.OtherModuleHasProvider(m, JavaInfoProvider) {
|
if dep, ok := android.OtherModuleProvider(ctx, m, JavaInfoProvider); ok {
|
||||||
dep := ctx.OtherModuleProvider(m, JavaInfoProvider).(JavaInfo)
|
|
||||||
srcJarArgs = append(srcJarArgs, dep.SrcJarArgs...)
|
srcJarArgs = append(srcJarArgs, dep.SrcJarArgs...)
|
||||||
srcJarDeps = append(srcJarDeps, dep.SrcJarDeps...)
|
srcJarDeps = append(srcJarDeps, dep.SrcJarDeps...)
|
||||||
}
|
}
|
||||||
|
@@ -262,8 +262,7 @@ func createFrameworkAidl(stubsModules []string, path android.WritablePath, ctx a
|
|||||||
|
|
||||||
ctx.VisitAllModules(func(module android.Module) {
|
ctx.VisitAllModules(func(module android.Module) {
|
||||||
// Collect dex jar paths for the modules listed above.
|
// Collect dex jar paths for the modules listed above.
|
||||||
if ctx.ModuleHasProvider(module, JavaInfoProvider) {
|
if j, ok := android.SingletonModuleProvider(ctx, module, JavaInfoProvider); ok {
|
||||||
j := ctx.ModuleProvider(module, JavaInfoProvider).(JavaInfo)
|
|
||||||
name := ctx.ModuleName(module)
|
name := ctx.ModuleName(module)
|
||||||
if i := android.IndexList(name, stubsModules); i != -1 {
|
if i := android.IndexList(name, stubsModules); i != -1 {
|
||||||
stubsJars[i] = j.HeaderJars
|
stubsJars[i] = j.HeaderJars
|
||||||
|
@@ -673,8 +673,7 @@ type scopePaths struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (paths *scopePaths) extractStubsLibraryInfoFromDependency(ctx android.ModuleContext, dep android.Module) error {
|
func (paths *scopePaths) extractStubsLibraryInfoFromDependency(ctx android.ModuleContext, dep android.Module) error {
|
||||||
if ctx.OtherModuleHasProvider(dep, JavaInfoProvider) {
|
if lib, ok := android.OtherModuleProvider(ctx, dep, JavaInfoProvider); ok {
|
||||||
lib := ctx.OtherModuleProvider(dep, JavaInfoProvider).(JavaInfo)
|
|
||||||
paths.stubsHeaderPath = lib.HeaderJars
|
paths.stubsHeaderPath = lib.HeaderJars
|
||||||
paths.stubsImplPath = lib.ImplementationJars
|
paths.stubsImplPath = lib.ImplementationJars
|
||||||
|
|
||||||
@@ -1451,7 +1450,7 @@ func (module *SdkLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext)
|
|||||||
|
|
||||||
// Make the set of components exported by this module available for use elsewhere.
|
// Make the set of components exported by this module available for use elsewhere.
|
||||||
exportedComponentInfo := android.ExportedComponentsInfo{Components: android.SortedKeys(exportedComponents)}
|
exportedComponentInfo := android.ExportedComponentsInfo{Components: android.SortedKeys(exportedComponents)}
|
||||||
ctx.SetProvider(android.ExportedComponentsInfoProvider, exportedComponentInfo)
|
android.SetProvider(ctx, android.ExportedComponentsInfoProvider, exportedComponentInfo)
|
||||||
|
|
||||||
// Provide additional information for inclusion in an sdk's generated .info file.
|
// Provide additional information for inclusion in an sdk's generated .info file.
|
||||||
additionalSdkInfo := map[string]interface{}{}
|
additionalSdkInfo := map[string]interface{}{}
|
||||||
@@ -1471,7 +1470,7 @@ func (module *SdkLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext)
|
|||||||
scopeInfo["latest_removed_api"] = p.Path().String()
|
scopeInfo["latest_removed_api"] = p.Path().String()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ctx.SetProvider(android.AdditionalSdkInfoProvider, android.AdditionalSdkInfo{additionalSdkInfo})
|
android.SetProvider(ctx, android.AdditionalSdkInfoProvider, android.AdditionalSdkInfo{additionalSdkInfo})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (module *SdkLibrary) AndroidMkEntries() []android.AndroidMkEntries {
|
func (module *SdkLibrary) AndroidMkEntries() []android.AndroidMkEntries {
|
||||||
@@ -2036,8 +2035,8 @@ func PrebuiltJars(ctx android.BaseModuleContext, baseName string, s android.SdkS
|
|||||||
// If either this or the other module are on the platform then this will return
|
// If either this or the other module are on the platform then this will return
|
||||||
// false.
|
// false.
|
||||||
func withinSameApexesAs(ctx android.BaseModuleContext, other android.Module) bool {
|
func withinSameApexesAs(ctx android.BaseModuleContext, other android.Module) bool {
|
||||||
apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
|
apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider)
|
||||||
otherApexInfo := ctx.OtherModuleProvider(other, android.ApexInfoProvider).(android.ApexInfo)
|
otherApexInfo, _ := android.OtherModuleProvider(ctx, other, android.ApexInfoProvider)
|
||||||
return len(otherApexInfo.InApexVariants) > 0 && reflect.DeepEqual(apexInfo.InApexVariants, otherApexInfo.InApexVariants)
|
return len(otherApexInfo.InApexVariants) > 0 && reflect.DeepEqual(apexInfo.InApexVariants, otherApexInfo.InApexVariants)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2693,7 +2692,7 @@ func (module *SdkLibraryImport) GenerateAndroidBuildActions(ctx android.ModuleCo
|
|||||||
if ctx.Device() {
|
if ctx.Device() {
|
||||||
// If this is a variant created for a prebuilt_apex then use the dex implementation jar
|
// If this is a variant created for a prebuilt_apex then use the dex implementation jar
|
||||||
// obtained from the associated deapexer module.
|
// obtained from the associated deapexer module.
|
||||||
ai := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
|
ai, _ := android.ModuleProvider(ctx, android.ApexInfoProvider)
|
||||||
if ai.ForPrebuiltApex {
|
if ai.ForPrebuiltApex {
|
||||||
// Get the path of the dex implementation jar from the `deapexer` module.
|
// Get the path of the dex implementation jar from the `deapexer` module.
|
||||||
di := android.FindDeapexerProviderForModule(ctx)
|
di := android.FindDeapexerProviderForModule(ctx)
|
||||||
@@ -2960,7 +2959,7 @@ func (module *sdkLibraryXml) ShouldSupportSdkVersion(ctx android.BaseModuleConte
|
|||||||
// File path to the runtime implementation library
|
// File path to the runtime implementation library
|
||||||
func (module *sdkLibraryXml) implPath(ctx android.ModuleContext) string {
|
func (module *sdkLibraryXml) implPath(ctx android.ModuleContext) string {
|
||||||
implName := proptools.String(module.properties.Lib_name)
|
implName := proptools.String(module.properties.Lib_name)
|
||||||
if apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo); !apexInfo.IsForPlatform() {
|
if apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider); !apexInfo.IsForPlatform() {
|
||||||
// TODO(b/146468504): ApexVariationName() is only a soong module name, not apex name.
|
// TODO(b/146468504): ApexVariationName() is only a soong module name, not apex name.
|
||||||
// In most cases, this works fine. But when apex_name is set or override_apex is used
|
// In most cases, this works fine. But when apex_name is set or override_apex is used
|
||||||
// this can be wrong.
|
// this can be wrong.
|
||||||
@@ -3067,7 +3066,8 @@ func (module *sdkLibraryXml) permissionsContents(ctx android.ModuleContext) stri
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (module *sdkLibraryXml) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
func (module *sdkLibraryXml) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
module.hideApexVariantFromMake = !ctx.Provider(android.ApexInfoProvider).(android.ApexInfo).IsForPlatform()
|
apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider)
|
||||||
|
module.hideApexVariantFromMake = !apexInfo.IsForPlatform()
|
||||||
|
|
||||||
libName := proptools.String(module.properties.Lib_name)
|
libName := proptools.String(module.properties.Lib_name)
|
||||||
module.selfValidate(ctx)
|
module.selfValidate(ctx)
|
||||||
|
@@ -132,7 +132,7 @@ func TestJavaSdkLibrary(t *testing.T) {
|
|||||||
result.ModuleForTests("foo.api.system.28", "")
|
result.ModuleForTests("foo.api.system.28", "")
|
||||||
result.ModuleForTests("foo.api.test.28", "")
|
result.ModuleForTests("foo.api.test.28", "")
|
||||||
|
|
||||||
exportedComponentsInfo := result.ModuleProvider(foo.Module(), android.ExportedComponentsInfoProvider).(android.ExportedComponentsInfo)
|
exportedComponentsInfo, _ := android.SingletonModuleProvider(result, foo.Module(), android.ExportedComponentsInfoProvider)
|
||||||
expectedFooExportedComponents := []string{
|
expectedFooExportedComponents := []string{
|
||||||
"foo-removed.api.public.latest",
|
"foo-removed.api.public.latest",
|
||||||
"foo-removed.api.system.latest",
|
"foo-removed.api.system.latest",
|
||||||
|
@@ -159,7 +159,7 @@ func (system *SystemModules) GenerateAndroidBuildActions(ctx android.ModuleConte
|
|||||||
var jars android.Paths
|
var jars android.Paths
|
||||||
|
|
||||||
ctx.VisitDirectDepsWithTag(systemModulesLibsTag, func(module android.Module) {
|
ctx.VisitDirectDepsWithTag(systemModulesLibsTag, func(module android.Module) {
|
||||||
dep, _ := ctx.OtherModuleProvider(module, JavaInfoProvider).(JavaInfo)
|
dep, _ := android.OtherModuleProvider(ctx, module, JavaInfoProvider)
|
||||||
jars = append(jars, dep.HeaderJars...)
|
jars = append(jars, dep.HeaderJars...)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@@ -24,7 +24,7 @@ func getModuleHeaderJarsAsRelativeToTopPaths(result *android.TestResult, moduleN
|
|||||||
paths := []string{}
|
paths := []string{}
|
||||||
for _, moduleName := range moduleNames {
|
for _, moduleName := range moduleNames {
|
||||||
module := result.Module(moduleName, "android_common")
|
module := result.Module(moduleName, "android_common")
|
||||||
info := result.ModuleProvider(module, JavaInfoProvider).(JavaInfo)
|
info, _ := android.SingletonModuleProvider(result, module, JavaInfoProvider)
|
||||||
paths = append(paths, info.HeaderJars.RelativeToTop().Strings()...)
|
paths = append(paths, info.HeaderJars.RelativeToTop().Strings()...)
|
||||||
}
|
}
|
||||||
return paths
|
return paths
|
||||||
|
@@ -34,9 +34,7 @@ func TestTestSpec(t *testing.T) {
|
|||||||
).Module().(*soongTesting.TestSpecModule)
|
).Module().(*soongTesting.TestSpecModule)
|
||||||
|
|
||||||
// Check that the provider has the right contents
|
// Check that the provider has the right contents
|
||||||
data := result.ModuleProvider(
|
data, _ := android.SingletonModuleProvider(result, module, soongTesting.TestSpecProviderKey)
|
||||||
module, soongTesting.TestSpecProviderKey,
|
|
||||||
).(soongTesting.TestSpecProviderData)
|
|
||||||
if !strings.HasSuffix(
|
if !strings.HasSuffix(
|
||||||
data.IntermediatePath.String(), "/intermediateTestSpecMetadata.pb",
|
data.IntermediatePath.String(), "/intermediateTestSpecMetadata.pb",
|
||||||
) {
|
) {
|
||||||
|
@@ -617,7 +617,7 @@ func CheckPlatformBootclasspathModules(t *testing.T, result *android.TestResult,
|
|||||||
func CheckClasspathFragmentProtoContentInfoProvider(t *testing.T, result *android.TestResult, generated bool, contents, outputFilename, installDir string) {
|
func CheckClasspathFragmentProtoContentInfoProvider(t *testing.T, result *android.TestResult, generated bool, contents, outputFilename, installDir string) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
p := result.Module("platform-bootclasspath", "android_common").(*platformBootclasspathModule)
|
p := result.Module("platform-bootclasspath", "android_common").(*platformBootclasspathModule)
|
||||||
info := result.ModuleProvider(p, ClasspathFragmentProtoContentInfoProvider).(ClasspathFragmentProtoContentInfo)
|
info, _ := android.SingletonModuleProvider(result, p, ClasspathFragmentProtoContentInfoProvider)
|
||||||
|
|
||||||
android.AssertBoolEquals(t, "classpath proto generated", generated, info.ClasspathFragmentProtoGenerated)
|
android.AssertBoolEquals(t, "classpath proto generated", generated, info.ClasspathFragmentProtoGenerated)
|
||||||
android.AssertStringEquals(t, "classpath proto contents", contents, info.ClasspathFragmentProtoContents.String())
|
android.AssertStringEquals(t, "classpath proto contents", contents, info.ClasspathFragmentProtoContents.String())
|
||||||
@@ -637,7 +637,7 @@ func ApexNamePairsFromModules(ctx *android.TestContext, modules []android.Module
|
|||||||
func apexNamePairFromModule(ctx *android.TestContext, module android.Module) string {
|
func apexNamePairFromModule(ctx *android.TestContext, module android.Module) string {
|
||||||
name := module.Name()
|
name := module.Name()
|
||||||
var apex string
|
var apex string
|
||||||
apexInfo := ctx.ModuleProvider(module, android.ApexInfoProvider).(android.ApexInfo)
|
apexInfo, _ := android.SingletonModuleProvider(ctx, module, android.ApexInfoProvider)
|
||||||
if apexInfo.IsForPlatform() {
|
if apexInfo.IsForPlatform() {
|
||||||
apex = "platform"
|
apex = "platform"
|
||||||
} else {
|
} else {
|
||||||
|
@@ -81,7 +81,7 @@ func (imports *ApiImports) DepsMutator(ctx android.BottomUpMutatorContext) {
|
|||||||
headerLibs := generateNameMapWithSuffix(imports.properties.Header_libs)
|
headerLibs := generateNameMapWithSuffix(imports.properties.Header_libs)
|
||||||
apexSharedLibs := generateNameMapWithSuffix(imports.properties.Apex_shared_libs)
|
apexSharedLibs := generateNameMapWithSuffix(imports.properties.Apex_shared_libs)
|
||||||
|
|
||||||
ctx.SetProvider(ApiImportsProvider, ApiImportInfo{
|
android.SetProvider(ctx, ApiImportsProvider, ApiImportInfo{
|
||||||
SharedLibs: sharedLibs,
|
SharedLibs: sharedLibs,
|
||||||
HeaderLibs: headerLibs,
|
HeaderLibs: headerLibs,
|
||||||
ApexSharedLibs: apexSharedLibs,
|
ApexSharedLibs: apexSharedLibs,
|
||||||
|
@@ -420,7 +420,7 @@ func (p *PythonLibraryModule) AddDepsOnPythonLauncherAndStdlib(ctx android.Botto
|
|||||||
// GenerateAndroidBuildActions performs build actions common to all Python modules
|
// GenerateAndroidBuildActions performs build actions common to all Python modules
|
||||||
func (p *PythonLibraryModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
func (p *PythonLibraryModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
expandedSrcs := android.PathsForModuleSrcExcludes(ctx, p.properties.Srcs, p.properties.Exclude_srcs)
|
expandedSrcs := android.PathsForModuleSrcExcludes(ctx, p.properties.Srcs, p.properties.Exclude_srcs)
|
||||||
ctx.SetProvider(blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: expandedSrcs.Strings()})
|
android.SetProvider(ctx, blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: expandedSrcs.Strings()})
|
||||||
|
|
||||||
// expand data files from "data" property.
|
// expand data files from "data" property.
|
||||||
expandedData := android.PathsForModuleSrc(ctx, p.properties.Data)
|
expandedData := android.PathsForModuleSrc(ctx, p.properties.Data)
|
||||||
|
@@ -208,7 +208,7 @@ func (p *PythonTestModule) GenerateAndroidBuildActions(ctx android.ModuleContext
|
|||||||
installedData := ctx.InstallTestData(installDir, p.data)
|
installedData := ctx.InstallTestData(installDir, p.data)
|
||||||
p.installedDest = ctx.InstallFile(installDir, p.installSource.Base(), p.installSource, installedData...)
|
p.installedDest = ctx.InstallFile(installDir, p.installSource.Base(), p.installSource, installedData...)
|
||||||
|
|
||||||
ctx.SetProvider(testing.TestModuleProviderKey, testing.TestModuleProviderData{})
|
android.SetProvider(ctx, testing.TestModuleProviderKey, testing.TestModuleProviderData{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PythonTestModule) AndroidMkEntries() []android.AndroidMkEntries {
|
func (p *PythonTestModule) AndroidMkEntries() []android.AndroidMkEntries {
|
||||||
|
@@ -67,8 +67,7 @@ func (afdo *afdo) flags(ctx android.ModuleContext, flags Flags, deps PathDeps) (
|
|||||||
}
|
}
|
||||||
|
|
||||||
ctx.VisitDirectDepsWithTag(cc.FdoProfileTag, func(m android.Module) {
|
ctx.VisitDirectDepsWithTag(cc.FdoProfileTag, func(m android.Module) {
|
||||||
if ctx.OtherModuleHasProvider(m, cc.FdoProfileProvider) {
|
if info, ok := android.OtherModuleProvider(ctx, m, cc.FdoProfileProvider); ok {
|
||||||
info := ctx.OtherModuleProvider(m, cc.FdoProfileProvider).(cc.FdoProfileInfo)
|
|
||||||
path := info.Path
|
path := info.Path
|
||||||
profileUseFlag := fmt.Sprintf(afdoFlagFormat, path.String())
|
profileUseFlag := fmt.Sprintf(afdoFlagFormat, path.String())
|
||||||
flags.RustFlags = append(flags.RustFlags, profileUseFlag)
|
flags.RustFlags = append(flags.RustFlags, profileUseFlag)
|
||||||
|
@@ -547,7 +547,7 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa
|
|||||||
}
|
}
|
||||||
|
|
||||||
if library.static() || library.shared() {
|
if library.static() || library.shared() {
|
||||||
ctx.SetProvider(cc.FlagExporterInfoProvider, cc.FlagExporterInfo{
|
android.SetProvider(ctx, cc.FlagExporterInfoProvider, cc.FlagExporterInfo{
|
||||||
IncludeDirs: library.includeDirs,
|
IncludeDirs: library.includeDirs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -559,7 +559,7 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa
|
|||||||
library.tocFile = android.OptionalPathForPath(tocFile)
|
library.tocFile = android.OptionalPathForPath(tocFile)
|
||||||
cc.TransformSharedObjectToToc(ctx, outputFile, tocFile)
|
cc.TransformSharedObjectToToc(ctx, outputFile, tocFile)
|
||||||
|
|
||||||
ctx.SetProvider(cc.SharedLibraryInfoProvider, cc.SharedLibraryInfo{
|
android.SetProvider(ctx, cc.SharedLibraryInfoProvider, cc.SharedLibraryInfo{
|
||||||
TableOfContents: android.OptionalPathForPath(tocFile),
|
TableOfContents: android.OptionalPathForPath(tocFile),
|
||||||
SharedLibrary: outputFile,
|
SharedLibrary: outputFile,
|
||||||
Target: ctx.Target(),
|
Target: ctx.Target(),
|
||||||
@@ -568,7 +568,7 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa
|
|||||||
|
|
||||||
if library.static() {
|
if library.static() {
|
||||||
depSet := android.NewDepSetBuilder[android.Path](android.TOPOLOGICAL).Direct(outputFile).Build()
|
depSet := android.NewDepSetBuilder[android.Path](android.TOPOLOGICAL).Direct(outputFile).Build()
|
||||||
ctx.SetProvider(cc.StaticLibraryInfoProvider, cc.StaticLibraryInfo{
|
android.SetProvider(ctx, cc.StaticLibraryInfoProvider, cc.StaticLibraryInfo{
|
||||||
StaticLibrary: outputFile,
|
StaticLibrary: outputFile,
|
||||||
|
|
||||||
TransitiveStaticLibrariesForOrdering: depSet,
|
TransitiveStaticLibrariesForOrdering: depSet,
|
||||||
|
@@ -178,7 +178,7 @@ func (proto *protobufDecorator) GenerateSource(ctx ModuleContext, deps PathDeps)
|
|||||||
// stemFile must be first here as the first path in BaseSourceProvider.OutputFiles is the library entry-point.
|
// stemFile must be first here as the first path in BaseSourceProvider.OutputFiles is the library entry-point.
|
||||||
proto.BaseSourceProvider.OutputFiles = append(android.Paths{stemFile}, outputs.Paths()...)
|
proto.BaseSourceProvider.OutputFiles = append(android.Paths{stemFile}, outputs.Paths()...)
|
||||||
|
|
||||||
ctx.SetProvider(cc.FlagExporterInfoProvider, cc.FlagExporterInfo{
|
android.SetProvider(ctx, cc.FlagExporterInfoProvider, cc.FlagExporterInfo{
|
||||||
IncludeDirs: android.PathsForModuleSrc(ctx, proto.Properties.Exported_include_dirs),
|
IncludeDirs: android.PathsForModuleSrc(ctx, proto.Properties.Exported_include_dirs),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
25
rust/rust.go
25
rust/rust.go
@@ -509,7 +509,7 @@ func (flagExporter *flagExporter) exportLinkObjects(flags ...string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (flagExporter *flagExporter) setProvider(ctx ModuleContext) {
|
func (flagExporter *flagExporter) setProvider(ctx ModuleContext) {
|
||||||
ctx.SetProvider(FlagExporterInfoProvider, FlagExporterInfo{
|
android.SetProvider(ctx, FlagExporterInfoProvider, FlagExporterInfo{
|
||||||
LinkDirs: flagExporter.linkDirs,
|
LinkDirs: flagExporter.linkDirs,
|
||||||
LinkObjects: flagExporter.linkObjects,
|
LinkObjects: flagExporter.linkObjects,
|
||||||
})
|
})
|
||||||
@@ -747,7 +747,8 @@ func (mod *Module) installable(apexInfo android.ApexInfo) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ctx moduleContext) apexVariationName() string {
|
func (ctx moduleContext) apexVariationName() string {
|
||||||
return ctx.Provider(android.ApexInfoProvider).(android.ApexInfo).ApexVariationName
|
apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider)
|
||||||
|
return apexInfo.ApexVariationName
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ cc.LinkableInterface = (*Module)(nil)
|
var _ cc.LinkableInterface = (*Module)(nil)
|
||||||
@@ -897,7 +898,7 @@ func (mod *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
|
|||||||
ModuleContext: actx,
|
ModuleContext: actx,
|
||||||
}
|
}
|
||||||
|
|
||||||
apexInfo := actx.Provider(android.ApexInfoProvider).(android.ApexInfo)
|
apexInfo, _ := android.ModuleProvider(actx, android.ApexInfoProvider)
|
||||||
if !apexInfo.IsForPlatform() {
|
if !apexInfo.IsForPlatform() {
|
||||||
mod.hideApexVariantFromMake = true
|
mod.hideApexVariantFromMake = true
|
||||||
}
|
}
|
||||||
@@ -950,7 +951,7 @@ func (mod *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
|
|||||||
sourceLib := sourceMod.(*Module).compiler.(*libraryDecorator)
|
sourceLib := sourceMod.(*Module).compiler.(*libraryDecorator)
|
||||||
mod.sourceProvider.setOutputFiles(sourceLib.sourceProvider.Srcs())
|
mod.sourceProvider.setOutputFiles(sourceLib.sourceProvider.Srcs())
|
||||||
}
|
}
|
||||||
ctx.SetProvider(blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: mod.sourceProvider.Srcs().Strings()})
|
android.SetProvider(ctx, blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: mod.sourceProvider.Srcs().Strings()})
|
||||||
}
|
}
|
||||||
|
|
||||||
if mod.compiler != nil && !mod.compiler.Disabled() {
|
if mod.compiler != nil && !mod.compiler.Disabled() {
|
||||||
@@ -978,7 +979,7 @@ func (mod *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apexInfo := actx.Provider(android.ApexInfoProvider).(android.ApexInfo)
|
apexInfo, _ := android.ModuleProvider(actx, android.ApexInfoProvider)
|
||||||
if !proptools.BoolDefault(mod.Installable(), mod.EverInstallable()) && !mod.ProcMacro() {
|
if !proptools.BoolDefault(mod.Installable(), mod.EverInstallable()) && !mod.ProcMacro() {
|
||||||
// If the module has been specifically configure to not be installed then
|
// If the module has been specifically configure to not be installed then
|
||||||
// hide from make as otherwise it will break when running inside make as the
|
// hide from make as otherwise it will break when running inside make as the
|
||||||
@@ -1003,7 +1004,7 @@ func (mod *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
|
|||||||
ctx.Phony("rust", ctx.RustModule().OutputFile().Path())
|
ctx.Phony("rust", ctx.RustModule().OutputFile().Path())
|
||||||
}
|
}
|
||||||
if mod.testModule {
|
if mod.testModule {
|
||||||
ctx.SetProvider(testing.TestModuleProviderKey, testing.TestModuleProviderData{})
|
android.SetProvider(ctx, testing.TestModuleProviderKey, testing.TestModuleProviderData{})
|
||||||
}
|
}
|
||||||
|
|
||||||
aconfig.CollectDependencyAconfigFiles(ctx, &mod.mergedAconfigFiles)
|
aconfig.CollectDependencyAconfigFiles(ctx, &mod.mergedAconfigFiles)
|
||||||
@@ -1148,7 +1149,7 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
|
|
||||||
// For the dependency from platform to apex, use the latest stubs
|
// For the dependency from platform to apex, use the latest stubs
|
||||||
mod.apexSdkVersion = android.FutureApiLevel
|
mod.apexSdkVersion = android.FutureApiLevel
|
||||||
apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
|
apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider)
|
||||||
if !apexInfo.IsForPlatform() {
|
if !apexInfo.IsForPlatform() {
|
||||||
mod.apexSdkVersion = apexInfo.MinSdkVersion
|
mod.apexSdkVersion = apexInfo.MinSdkVersion
|
||||||
}
|
}
|
||||||
@@ -1167,7 +1168,7 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
|
|
||||||
ctx.VisitDirectDeps(func(dep android.Module) {
|
ctx.VisitDirectDeps(func(dep android.Module) {
|
||||||
if dep.Name() == "api_imports" {
|
if dep.Name() == "api_imports" {
|
||||||
apiImportInfo = ctx.OtherModuleProvider(dep, multitree.ApiImportsProvider).(multitree.ApiImportInfo)
|
apiImportInfo, _ = android.OtherModuleProvider(ctx, dep, multitree.ApiImportsProvider)
|
||||||
hasApiImportInfo = true
|
hasApiImportInfo = true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -1278,7 +1279,7 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
|
|
||||||
//Append the dependencies exportedDirs, except for proc-macros which target a different arch/OS
|
//Append the dependencies exportedDirs, except for proc-macros which target a different arch/OS
|
||||||
if depTag != procMacroDepTag {
|
if depTag != procMacroDepTag {
|
||||||
exportedInfo := ctx.OtherModuleProvider(dep, FlagExporterInfoProvider).(FlagExporterInfo)
|
exportedInfo, _ := android.OtherModuleProvider(ctx, dep, FlagExporterInfoProvider)
|
||||||
depPaths.linkDirs = append(depPaths.linkDirs, exportedInfo.LinkDirs...)
|
depPaths.linkDirs = append(depPaths.linkDirs, exportedInfo.LinkDirs...)
|
||||||
depPaths.depFlags = append(depPaths.depFlags, exportedInfo.Flags...)
|
depPaths.depFlags = append(depPaths.depFlags, exportedInfo.Flags...)
|
||||||
depPaths.linkObjects = append(depPaths.linkObjects, exportedInfo.LinkObjects...)
|
depPaths.linkObjects = append(depPaths.linkObjects, exportedInfo.LinkObjects...)
|
||||||
@@ -1294,7 +1295,7 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
if depTag == sourceDepTag {
|
if depTag == sourceDepTag {
|
||||||
if _, ok := mod.sourceProvider.(*protobufDecorator); ok && mod.Source() {
|
if _, ok := mod.sourceProvider.(*protobufDecorator); ok && mod.Source() {
|
||||||
if _, ok := rustDep.sourceProvider.(*protobufDecorator); ok {
|
if _, ok := rustDep.sourceProvider.(*protobufDecorator); ok {
|
||||||
exportedInfo := ctx.OtherModuleProvider(dep, cc.FlagExporterInfoProvider).(cc.FlagExporterInfo)
|
exportedInfo, _ := android.OtherModuleProvider(ctx, dep, cc.FlagExporterInfoProvider)
|
||||||
depPaths.depIncludePaths = append(depPaths.depIncludePaths, exportedInfo.IncludeDirs...)
|
depPaths.depIncludePaths = append(depPaths.depIncludePaths, exportedInfo.IncludeDirs...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1347,7 +1348,7 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
depPaths.linkObjects = append(depPaths.linkObjects, linkObject.String())
|
depPaths.linkObjects = append(depPaths.linkObjects, linkObject.String())
|
||||||
depPaths.linkDirs = append(depPaths.linkDirs, linkPath)
|
depPaths.linkDirs = append(depPaths.linkDirs, linkPath)
|
||||||
|
|
||||||
exportedInfo := ctx.OtherModuleProvider(dep, cc.FlagExporterInfoProvider).(cc.FlagExporterInfo)
|
exportedInfo, _ := android.OtherModuleProvider(ctx, dep, cc.FlagExporterInfoProvider)
|
||||||
depPaths.depIncludePaths = append(depPaths.depIncludePaths, exportedInfo.IncludeDirs...)
|
depPaths.depIncludePaths = append(depPaths.depIncludePaths, exportedInfo.IncludeDirs...)
|
||||||
depPaths.depSystemIncludePaths = append(depPaths.depSystemIncludePaths, exportedInfo.SystemIncludeDirs...)
|
depPaths.depSystemIncludePaths = append(depPaths.depSystemIncludePaths, exportedInfo.SystemIncludeDirs...)
|
||||||
depPaths.depClangFlags = append(depPaths.depClangFlags, exportedInfo.Flags...)
|
depPaths.depClangFlags = append(depPaths.depClangFlags, exportedInfo.Flags...)
|
||||||
@@ -1391,7 +1392,7 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
directAndroidMkSharedLibs = append(directAndroidMkSharedLibs, makeLibName)
|
directAndroidMkSharedLibs = append(directAndroidMkSharedLibs, makeLibName)
|
||||||
exportDep = true
|
exportDep = true
|
||||||
case cc.IsHeaderDepTag(depTag):
|
case cc.IsHeaderDepTag(depTag):
|
||||||
exportedInfo := ctx.OtherModuleProvider(dep, cc.FlagExporterInfoProvider).(cc.FlagExporterInfo)
|
exportedInfo, _ := android.OtherModuleProvider(ctx, dep, cc.FlagExporterInfoProvider)
|
||||||
depPaths.depIncludePaths = append(depPaths.depIncludePaths, exportedInfo.IncludeDirs...)
|
depPaths.depIncludePaths = append(depPaths.depIncludePaths, exportedInfo.IncludeDirs...)
|
||||||
depPaths.depSystemIncludePaths = append(depPaths.depSystemIncludePaths, exportedInfo.SystemIncludeDirs...)
|
depPaths.depSystemIncludePaths = append(depPaths.depSystemIncludePaths, exportedInfo.SystemIncludeDirs...)
|
||||||
depPaths.depGeneratedHeaders = append(depPaths.depGeneratedHeaders, exportedInfo.GeneratedHeaders...)
|
depPaths.depGeneratedHeaders = append(depPaths.depGeneratedHeaders, exportedInfo.GeneratedHeaders...)
|
||||||
|
@@ -270,7 +270,7 @@ func rustSanitizerRuntimeMutator(mctx android.BottomUpMutatorContext) {
|
|||||||
}
|
}
|
||||||
// If we're using snapshots, redirect to snapshot whenever possible
|
// If we're using snapshots, redirect to snapshot whenever possible
|
||||||
// TODO(b/178470649): clean manual snapshot redirections
|
// TODO(b/178470649): clean manual snapshot redirections
|
||||||
snapshot := mctx.Provider(cc.SnapshotInfoProvider).(cc.SnapshotInfo)
|
snapshot, _ := android.ModuleProvider(mctx, cc.SnapshotInfoProvider)
|
||||||
if lib, ok := snapshot.StaticLibs[noteDep]; ok {
|
if lib, ok := snapshot.StaticLibs[noteDep]; ok {
|
||||||
noteDep = lib
|
noteDep = lib
|
||||||
}
|
}
|
||||||
|
@@ -166,10 +166,7 @@ func (s *sdk) collectMembers(ctx android.ModuleContext) {
|
|||||||
// Keep track of which multilib variants are used by the sdk.
|
// Keep track of which multilib variants are used by the sdk.
|
||||||
s.multilibUsages = s.multilibUsages.addArchType(child.Target().Arch.ArchType)
|
s.multilibUsages = s.multilibUsages.addArchType(child.Target().Arch.ArchType)
|
||||||
|
|
||||||
var exportedComponentsInfo android.ExportedComponentsInfo
|
exportedComponentsInfo, _ := android.OtherModuleProvider(ctx, child, android.ExportedComponentsInfoProvider)
|
||||||
if ctx.OtherModuleHasProvider(child, android.ExportedComponentsInfoProvider) {
|
|
||||||
exportedComponentsInfo = ctx.OtherModuleProvider(child, android.ExportedComponentsInfoProvider).(android.ExportedComponentsInfo)
|
|
||||||
}
|
|
||||||
|
|
||||||
var container android.Module
|
var container android.Module
|
||||||
if parent != ctx.Module() {
|
if parent != ctx.Module() {
|
||||||
@@ -607,7 +604,7 @@ func (s *sdk) generateInfoData(ctx android.ModuleContext, memberVariantDeps []sd
|
|||||||
name: name,
|
name: name,
|
||||||
}
|
}
|
||||||
|
|
||||||
additionalSdkInfo := ctx.OtherModuleProvider(module, android.AdditionalSdkInfoProvider).(android.AdditionalSdkInfo)
|
additionalSdkInfo, _ := android.OtherModuleProvider(ctx, module, android.AdditionalSdkInfoProvider)
|
||||||
info.memberSpecific = additionalSdkInfo.Properties
|
info.memberSpecific = additionalSdkInfo.Properties
|
||||||
|
|
||||||
name2Info[name] = info
|
name2Info[name] = info
|
||||||
@@ -1171,7 +1168,7 @@ func (s *snapshotBuilder) AddPrebuiltModule(member android.SdkMember, moduleType
|
|||||||
|
|
||||||
// The licenses are the same for all variants.
|
// The licenses are the same for all variants.
|
||||||
mctx := s.ctx
|
mctx := s.ctx
|
||||||
licenseInfo := mctx.OtherModuleProvider(variant, android.LicenseInfoProvider).(android.LicenseInfo)
|
licenseInfo, _ := android.OtherModuleProvider(mctx, variant, android.LicenseInfoProvider)
|
||||||
if len(licenseInfo.Licenses) > 0 {
|
if len(licenseInfo.Licenses) > 0 {
|
||||||
m.AddPropertyWithTag("licenses", licenseInfo.Licenses, s.OptionalSdkMemberReferencePropertyTag())
|
m.AddPropertyWithTag("licenses", licenseInfo.Licenses, s.OptionalSdkMemberReferencePropertyTag())
|
||||||
}
|
}
|
||||||
@@ -1417,7 +1414,7 @@ func selectApexVariantsWhereAvailable(ctx *memberContext, variants []android.Mod
|
|||||||
variantsByApex := make(map[string]android.Module)
|
variantsByApex := make(map[string]android.Module)
|
||||||
conflictDetected := false
|
conflictDetected := false
|
||||||
for _, variant := range list {
|
for _, variant := range list {
|
||||||
apexInfo := moduleCtx.OtherModuleProvider(variant, android.ApexInfoProvider).(android.ApexInfo)
|
apexInfo, _ := android.OtherModuleProvider(moduleCtx, variant, android.ApexInfoProvider)
|
||||||
apexVariationName := apexInfo.ApexVariationName
|
apexVariationName := apexInfo.ApexVariationName
|
||||||
// If there are two variants for a specific APEX variation then there is conflict.
|
// If there are two variants for a specific APEX variation then there is conflict.
|
||||||
if _, ok := variantsByApex[apexVariationName]; ok {
|
if _, ok := variantsByApex[apexVariationName]; ok {
|
||||||
|
@@ -270,7 +270,7 @@ func (s *ShBinary) generateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
Output: s.outputFilePath,
|
Output: s.outputFilePath,
|
||||||
Input: s.sourceFilePath,
|
Input: s.sourceFilePath,
|
||||||
})
|
})
|
||||||
ctx.SetProvider(blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: []string{s.sourceFilePath.String()}})
|
android.SetProvider(ctx, blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: []string{s.sourceFilePath.String()}})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ShBinary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
func (s *ShBinary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
@@ -457,7 +457,7 @@ func (s *ShTest) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
installedData := ctx.InstallTestData(s.installDir, s.data)
|
installedData := ctx.InstallTestData(s.installDir, s.data)
|
||||||
s.installedFile = ctx.InstallExecutable(s.installDir, s.outputFilePath.Base(), s.outputFilePath, installedData...)
|
s.installedFile = ctx.InstallExecutable(s.installDir, s.outputFilePath.Base(), s.outputFilePath, installedData...)
|
||||||
|
|
||||||
ctx.SetProvider(testing.TestModuleProviderKey, testing.TestModuleProviderData{})
|
android.SetProvider(ctx, testing.TestModuleProviderKey, testing.TestModuleProviderData{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ShTest) InstallInData() bool {
|
func (s *ShTest) InstallInData() bool {
|
||||||
|
@@ -119,7 +119,7 @@ func (c *hostFakeSingleton) GenerateBuildActions(ctx android.SingletonContext) {
|
|||||||
if !module.Enabled() || module.IsHideFromMake() {
|
if !module.Enabled() || module.IsHideFromMake() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
apexInfo := ctx.ModuleProvider(module, android.ApexInfoProvider).(android.ApexInfo)
|
apexInfo, _ := android.SingletonModuleProvider(ctx, module, android.ApexInfoProvider)
|
||||||
if !apexInfo.IsForPlatform() {
|
if !apexInfo.IsForPlatform() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@@ -251,7 +251,7 @@ func (m *syspropLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext)
|
|||||||
ctx.PropertyErrorf("srcs", "srcs contains non-sysprop file %q", syspropFile.String())
|
ctx.PropertyErrorf("srcs", "srcs contains non-sysprop file %q", syspropFile.String())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ctx.SetProvider(blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: srcs.Strings()})
|
android.SetProvider(ctx, blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: srcs.Strings()})
|
||||||
|
|
||||||
if ctx.Failed() {
|
if ctx.Failed() {
|
||||||
return
|
return
|
||||||
|
@@ -21,14 +21,9 @@ func (this *allCodeMetadataSingleton) GenerateBuildActions(ctx android.Singleton
|
|||||||
|
|
||||||
ctx.VisitAllModules(
|
ctx.VisitAllModules(
|
||||||
func(module android.Module) {
|
func(module android.Module) {
|
||||||
if !ctx.ModuleHasProvider(module, CodeMetadataProviderKey) {
|
if metadata, ok := android.SingletonModuleProvider(ctx, module, CodeMetadataProviderKey); ok {
|
||||||
return
|
intermediateMetadataPaths = append(intermediateMetadataPaths, metadata.IntermediatePath)
|
||||||
}
|
}
|
||||||
intermediateMetadataPaths = append(
|
|
||||||
intermediateMetadataPaths, ctx.ModuleProvider(
|
|
||||||
module, CodeMetadataProviderKey,
|
|
||||||
).(CodeMetadataProviderData).IntermediatePath,
|
|
||||||
)
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -21,10 +21,9 @@ func (this *allTestSpecsSingleton) GenerateBuildActions(ctx android.SingletonCon
|
|||||||
var intermediateMetadataPaths android.Paths
|
var intermediateMetadataPaths android.Paths
|
||||||
|
|
||||||
ctx.VisitAllModules(func(module android.Module) {
|
ctx.VisitAllModules(func(module android.Module) {
|
||||||
if !ctx.ModuleHasProvider(module, TestSpecProviderKey) {
|
if metadata, ok := android.SingletonModuleProvider(ctx, module, TestSpecProviderKey); ok {
|
||||||
return
|
intermediateMetadataPaths = append(intermediateMetadataPaths, metadata.IntermediatePath)
|
||||||
}
|
}
|
||||||
intermediateMetadataPaths = append(intermediateMetadataPaths, ctx.ModuleProvider(module, TestSpecProviderKey).(TestSpecProviderData).IntermediatePath)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
rspFile := android.PathForOutput(ctx, fileContainingFilePaths)
|
rspFile := android.PathForOutput(ctx, fileContainingFilePaths)
|
||||||
|
@@ -96,10 +96,8 @@ func (module *CodeMetadataModule) GenerateAndroidBuildActions(ctx android.Module
|
|||||||
for _, m := range ctx.GetDirectDepsWithTag(codeDepTag) {
|
for _, m := range ctx.GetDirectDepsWithTag(codeDepTag) {
|
||||||
targetName := m.Name()
|
targetName := m.Name()
|
||||||
var moduleSrcs []string
|
var moduleSrcs []string
|
||||||
if ctx.OtherModuleHasProvider(m, blueprint.SrcsFileProviderKey) {
|
if srcsFileInfo, ok := android.OtherModuleProvider(ctx, m, blueprint.SrcsFileProviderKey); ok {
|
||||||
moduleSrcs = ctx.OtherModuleProvider(
|
moduleSrcs = srcsFileInfo.SrcPaths
|
||||||
m, blueprint.SrcsFileProviderKey,
|
|
||||||
).(blueprint.SrcsFileProviderData).SrcPaths
|
|
||||||
}
|
}
|
||||||
if module.properties.MultiOwnership {
|
if module.properties.MultiOwnership {
|
||||||
metadata := &code_metadata_internal_proto.CodeMetadataInternal_TargetOwnership{
|
metadata := &code_metadata_internal_proto.CodeMetadataInternal_TargetOwnership{
|
||||||
@@ -132,7 +130,7 @@ func (module *CodeMetadataModule) GenerateAndroidBuildActions(ctx android.Module
|
|||||||
)
|
)
|
||||||
android.WriteFileRule(ctx, intermediatePath, string(protoData))
|
android.WriteFileRule(ctx, intermediatePath, string(protoData))
|
||||||
|
|
||||||
ctx.SetProvider(
|
android.SetProvider(ctx,
|
||||||
CodeMetadataProviderKey,
|
CodeMetadataProviderKey,
|
||||||
CodeMetadataProviderData{IntermediatePath: intermediatePath},
|
CodeMetadataProviderData{IntermediatePath: intermediatePath},
|
||||||
)
|
)
|
||||||
|
@@ -91,7 +91,7 @@ var TestModuleProviderKey = blueprint.NewProvider[TestModuleProviderData]()
|
|||||||
|
|
||||||
func (module *TestSpecModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
func (module *TestSpecModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
for _, m := range ctx.GetDirectDepsWithTag(testsDepTag) {
|
for _, m := range ctx.GetDirectDepsWithTag(testsDepTag) {
|
||||||
if !ctx.OtherModuleHasProvider(m, TestModuleProviderKey) {
|
if _, ok := android.OtherModuleProvider(ctx, m, TestModuleProviderKey); !ok {
|
||||||
ctx.ModuleErrorf(ErrTestModuleDataNotFound, m.Name())
|
ctx.ModuleErrorf(ErrTestModuleDataNotFound, m.Name())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -119,7 +119,7 @@ func (module *TestSpecModule) GenerateAndroidBuildActions(ctx android.ModuleCont
|
|||||||
}
|
}
|
||||||
android.WriteFileRule(ctx, intermediatePath, string(protoData))
|
android.WriteFileRule(ctx, intermediatePath, string(protoData))
|
||||||
|
|
||||||
ctx.SetProvider(
|
android.SetProvider(ctx,
|
||||||
TestSpecProviderKey, TestSpecProviderData{
|
TestSpecProviderKey, TestSpecProviderData{
|
||||||
IntermediatePath: intermediatePath,
|
IntermediatePath: intermediatePath,
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user