Merge "Map flag declarations to the packages" into main
diff --git a/android/android_info.go b/android/android_info.go
index 561fa4c..9a68d10 100644
--- a/android/android_info.go
+++ b/android/android_info.go
@@ -58,19 +58,17 @@
androidInfoTxtName := proptools.StringDefault(p.properties.Stem, ctx.ModuleName()+".txt")
androidInfoTxt := PathForModuleOut(ctx, androidInfoTxtName)
androidInfoProp := androidInfoTxt.ReplaceExtension(ctx, "prop")
- timestamp := PathForModuleOut(ctx, "timestamp")
if boardInfoFiles := PathsForModuleSrc(ctx, p.properties.Board_info_files); len(boardInfoFiles) > 0 {
ctx.Build(pctx, BuildParams{
- Rule: mergeAndRemoveComments,
- Inputs: boardInfoFiles,
- Output: androidInfoTxt,
- Validation: timestamp,
+ Rule: mergeAndRemoveComments,
+ Inputs: boardInfoFiles,
+ Output: androidInfoTxt,
})
} else if bootloaderBoardName := proptools.String(p.properties.Bootloader_board_name); bootloaderBoardName != "" {
- WriteFileRule(ctx, androidInfoTxt, "board="+bootloaderBoardName, timestamp)
+ WriteFileRule(ctx, androidInfoTxt, "board="+bootloaderBoardName)
} else {
- WriteFileRule(ctx, androidInfoTxt, "", timestamp)
+ WriteFileRule(ctx, androidInfoTxt, "")
}
// Create android_info.prop
diff --git a/android/compliance_metadata.go b/android/compliance_metadata.go
index 2f11df6..dcf393d 100644
--- a/android/compliance_metadata.go
+++ b/android/compliance_metadata.go
@@ -43,6 +43,7 @@
STATIC_DEP_FILES string
WHOLE_STATIC_DEPS string
WHOLE_STATIC_DEP_FILES string
+ HEADER_LIBS string
LICENSES string
// module_type=package
@@ -71,6 +72,7 @@
"static_dep_files",
"whole_static_deps",
"whole_static_dep_files",
+ "header_libs",
"licenses",
"pkg_default_applicable_licenses",
@@ -106,6 +108,8 @@
ComplianceMetadataProp.WHOLE_STATIC_DEPS,
// Space separated file paths of whole static dependencies
ComplianceMetadataProp.WHOLE_STATIC_DEP_FILES,
+ // Space separated modules name of header libs
+ ComplianceMetadataProp.HEADER_LIBS,
ComplianceMetadataProp.LICENSES,
// module_type=package
ComplianceMetadataProp.PKG_DEFAULT_APPLICABLE_LICENSES,
diff --git a/cc/cc.go b/cc/cc.go
index b525ccb..b51d74d 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -2409,7 +2409,7 @@
func buildComplianceMetadataInfo(ctx ModuleContext, c *Module, deps PathDeps) {
// Dump metadata that can not be done in android/compliance-metadata.go
complianceMetadataInfo := ctx.ComplianceMetadataInfo()
- complianceMetadataInfo.SetStringValue(android.ComplianceMetadataProp.IS_STATIC_LIB, strconv.FormatBool(ctx.static()))
+ complianceMetadataInfo.SetStringValue(android.ComplianceMetadataProp.IS_STATIC_LIB, strconv.FormatBool(ctx.static() || ctx.ModuleType() == "cc_object"))
complianceMetadataInfo.SetStringValue(android.ComplianceMetadataProp.BUILT_FILES, c.outputFile.String())
// Static deps
@@ -2418,11 +2418,28 @@
for _, dep := range staticDeps {
staticDepNames = append(staticDepNames, dep.Name())
}
+ // Process CrtBegin and CrtEnd as static libs
+ ctx.VisitDirectDeps(func(dep android.Module) {
+ depName := ctx.OtherModuleName(dep)
+ depTag := ctx.OtherModuleDependencyTag(dep)
+ switch depTag {
+ case CrtBeginDepTag:
+ staticDepNames = append(staticDepNames, depName)
+ case CrtEndDepTag:
+ staticDepNames = append(staticDepNames, depName)
+ }
+ })
- staticDepPaths := make([]string, 0, len(deps.StaticLibs))
+ staticDepPaths := make([]string, 0, len(deps.StaticLibs)+len(deps.CrtBegin)+len(deps.CrtEnd))
for _, dep := range deps.StaticLibs {
staticDepPaths = append(staticDepPaths, dep.String())
}
+ for _, dep := range deps.CrtBegin {
+ staticDepPaths = append(staticDepPaths, dep.String())
+ }
+ for _, dep := range deps.CrtEnd {
+ staticDepPaths = append(staticDepPaths, dep.String())
+ }
complianceMetadataInfo.SetListValue(android.ComplianceMetadataProp.STATIC_DEPS, android.FirstUniqueStrings(staticDepNames))
complianceMetadataInfo.SetListValue(android.ComplianceMetadataProp.STATIC_DEP_FILES, android.FirstUniqueStrings(staticDepPaths))
@@ -2439,6 +2456,14 @@
}
complianceMetadataInfo.SetListValue(android.ComplianceMetadataProp.WHOLE_STATIC_DEPS, android.FirstUniqueStrings(wholeStaticDepNames))
complianceMetadataInfo.SetListValue(android.ComplianceMetadataProp.WHOLE_STATIC_DEP_FILES, android.FirstUniqueStrings(wholeStaticDepPaths))
+
+ // Header libs
+ headerLibDeps := ctx.GetDirectDepsProxyWithTag(HeaderDepTag())
+ headerLibDepNames := make([]string, 0, len(headerLibDeps))
+ for _, dep := range headerLibDeps {
+ headerLibDepNames = append(headerLibDepNames, dep.Name())
+ }
+ complianceMetadataInfo.SetListValue(android.ComplianceMetadataProp.HEADER_LIBS, android.FirstUniqueStrings(headerLibDepNames))
}
func (c *Module) maybeUnhideFromMake() {
diff --git a/filesystem/android_device.go b/filesystem/android_device.go
index e340602..eb2e036 100644
--- a/filesystem/android_device.go
+++ b/filesystem/android_device.go
@@ -68,6 +68,8 @@
// one will be determined based on the lunch product. TODO: Figure out how to make this
// blueprint:"mutated" and still set it from filesystem_creator
Main_device *bool
+
+ Ab_ota_updater *bool
}
type androidDevice struct {
@@ -94,9 +96,13 @@
type superPartitionDepTagType struct {
blueprint.BaseDependencyTag
}
+type targetFilesMetadataDepTagType struct {
+ blueprint.BaseDependencyTag
+}
var superPartitionDepTag superPartitionDepTagType
var filesystemDepTag partitionDepTagType
+var targetFilesMetadataDepTag targetFilesMetadataDepTagType
func (a *androidDevice) DepsMutator(ctx android.BottomUpMutatorContext) {
addDependencyIfDefined := func(dep *string) {
@@ -124,6 +130,11 @@
for _, vbmetaPartition := range a.partitionProps.Vbmeta_partitions {
ctx.AddDependency(ctx.Module(), filesystemDepTag, vbmetaPartition)
}
+ a.addDepsForTargetFilesMetadata(ctx)
+}
+
+func (a *androidDevice) addDepsForTargetFilesMetadata(ctx android.BottomUpMutatorContext) {
+ ctx.AddFarVariationDependencies(ctx.Config().BuildOSTarget.Variations(), targetFilesMetadataDepTag, "liblz4") // host variant
}
func (a *androidDevice) GenerateAndroidBuildActions(ctx android.ModuleContext) {
@@ -326,6 +337,7 @@
}
a.copyImagesToTargetZip(ctx, builder, targetFilesDir)
+ a.copyMetadataToTargetZip(ctx, builder, targetFilesDir)
builder.Command().
BuiltTool("soong_zip").
@@ -373,6 +385,19 @@
}
}
+func (a *androidDevice) copyMetadataToTargetZip(ctx android.ModuleContext, builder *android.RuleBuilder, targetFilesDir android.WritablePath) {
+ // Create a META/ subdirectory
+ builder.Command().Textf("mkdir -p %s/META", targetFilesDir.String())
+ if proptools.Bool(a.deviceProps.Ab_ota_updater) {
+ ctx.VisitDirectDepsProxyWithTag(targetFilesMetadataDepTag, func(child android.ModuleProxy) {
+ info, _ := android.OtherModuleProvider(ctx, child, android.OutputFilesProvider)
+ builder.Command().Textf("cp").Inputs(info.DefaultOutputFiles).Textf(" %s/META/", targetFilesDir.String())
+ })
+ }
+ builder.Command().Textf("cp").Input(android.PathForSource(ctx, "external/zucchini/version_info.h")).Textf(" %s/META/zucchini_config.txt", targetFilesDir.String())
+ builder.Command().Textf("cp").Input(android.PathForSource(ctx, "system/update_engine/update_engine.conf")).Textf(" %s/META/update_engine_config.txt", targetFilesDir.String())
+}
+
func (a *androidDevice) getFilesystemInfo(ctx android.ModuleContext, depName string) FilesystemInfo {
fsMod := ctx.GetDirectDepProxyWithTag(depName, filesystemDepTag)
fsInfo, ok := android.OtherModuleProvider(ctx, fsMod, FilesystemProvider)
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go
index 306710c..ad19cc6 100644
--- a/filesystem/filesystem.go
+++ b/filesystem/filesystem.go
@@ -173,12 +173,6 @@
// Mount point for this image. Default is "/"
Mount_point *string
- // If set to the name of a partition ("system", "vendor", etc), this filesystem module
- // will also include the contents of the make-built staging directories. If any soong
- // modules would be installed to the same location as a make module, they will overwrite
- // the make version.
- Include_make_built_files string
-
// When set, builds etc/event-log-tags file by merging logtags from all dependencies.
// Default is false
Build_logtags *bool
@@ -470,18 +464,34 @@
ctx.PropertyErrorf("include_files_of", "include_files_of is only supported for cpio and compressed cpio filesystem types.")
}
- var rootDir android.OutputPath
- var rebasedDir android.OutputPath
+ rootDir := android.PathForModuleOut(ctx, f.rootDirString()).OutputPath
+ rebasedDir := rootDir
+ if f.properties.Base_dir != nil {
+ rebasedDir = rootDir.Join(ctx, *f.properties.Base_dir)
+ }
+ builder := android.NewRuleBuilder(pctx, ctx)
+
+ // Wipe the root dir to get rid of leftover files from prior builds
+ builder.Command().Textf("rm -rf %s && mkdir -p %s", rootDir, rootDir)
+ specs := f.gatherFilteredPackagingSpecs(ctx)
+ f.entries = f.copyPackagingSpecs(ctx, builder, specs, rootDir, rebasedDir)
+
+ f.buildNonDepsFiles(ctx, builder, rootDir)
+ f.buildFsverityMetadataFiles(ctx, builder, specs, rootDir, rebasedDir)
+ f.buildEventLogtagsFile(ctx, builder, rebasedDir)
+ f.buildAconfigFlagsFiles(ctx, builder, specs, rebasedDir)
+ f.filesystemBuilder.BuildLinkerConfigFile(ctx, builder, rebasedDir)
+
var mapFile android.Path
var outputHermetic android.Path
switch f.fsType(ctx) {
case ext4Type, erofsType, f2fsType:
- f.output, outputHermetic, rootDir, rebasedDir = f.buildImageUsingBuildImage(ctx)
+ f.output, outputHermetic = f.buildImageUsingBuildImage(ctx, builder, rootDir, rebasedDir)
mapFile = f.getMapFile(ctx)
case compressedCpioType:
- f.output, rootDir, rebasedDir = f.buildCpioImage(ctx, true)
+ f.output = f.buildCpioImage(ctx, builder, rootDir, true)
case cpioType:
- f.output, rootDir, rebasedDir = f.buildCpioImage(ctx, false)
+ f.output = f.buildCpioImage(ctx, builder, rootDir, false)
default:
return
}
@@ -655,25 +665,12 @@
return f.partitionName()
}
-func (f *filesystem) buildImageUsingBuildImage(ctx android.ModuleContext) (android.Path, android.Path, android.OutputPath, android.OutputPath) {
- rootDir := android.PathForModuleOut(ctx, f.rootDirString()).OutputPath
- rebasedDir := rootDir
- if f.properties.Base_dir != nil {
- rebasedDir = rootDir.Join(ctx, *f.properties.Base_dir)
- }
- builder := android.NewRuleBuilder(pctx, ctx)
- // Wipe the root dir to get rid of leftover files from prior builds
- builder.Command().Textf("rm -rf %s && mkdir -p %s", rootDir, rootDir)
- specs := f.gatherFilteredPackagingSpecs(ctx)
- f.entries = f.copyPackagingSpecs(ctx, builder, specs, rootDir, rebasedDir)
-
- f.buildNonDepsFiles(ctx, builder, rootDir)
- f.addMakeBuiltFiles(ctx, builder, rootDir)
- f.buildFsverityMetadataFiles(ctx, builder, specs, rootDir, rebasedDir)
- f.buildEventLogtagsFile(ctx, builder, rebasedDir)
- f.buildAconfigFlagsFiles(ctx, builder, specs, rebasedDir)
- f.filesystemBuilder.BuildLinkerConfigFile(ctx, builder, rebasedDir)
-
+func (f *filesystem) buildImageUsingBuildImage(
+ ctx android.ModuleContext,
+ builder *android.RuleBuilder,
+ rootDir android.OutputPath,
+ rebasedDir android.OutputPath,
+) (android.Path, android.Path) {
// run host_init_verifier
// Ideally we should have a concept of pluggable linters that verify the generated image.
// While such concept is not implement this will do.
@@ -724,7 +721,7 @@
// rootDir is not deleted. Might be useful for quick inspection.
builder.Build("build_filesystem_image", fmt.Sprintf("Creating filesystem %s", f.BaseModuleName()))
- return output, outputHermetic, rootDir, rebasedDir
+ return output, outputHermetic
}
func (f *filesystem) buildFileContexts(ctx android.ModuleContext) android.Path {
@@ -918,7 +915,12 @@
return rootDirs, partitions
}
-func (f *filesystem) buildCpioImage(ctx android.ModuleContext, compressed bool) (android.Path, android.OutputPath, android.OutputPath) {
+func (f *filesystem) buildCpioImage(
+ ctx android.ModuleContext,
+ builder *android.RuleBuilder,
+ rootDir android.OutputPath,
+ compressed bool,
+) android.Path {
if proptools.Bool(f.properties.Use_avb) {
ctx.PropertyErrorf("use_avb", "signing compresed cpio image using avbtool is not supported."+
"Consider adding this to bootimg module and signing the entire boot image.")
@@ -928,27 +930,6 @@
ctx.PropertyErrorf("file_contexts", "file_contexts is not supported for compressed cpio image.")
}
- if f.properties.Include_make_built_files != "" {
- ctx.PropertyErrorf("include_make_built_files", "include_make_built_files is not supported for compressed cpio image.")
- }
-
- rootDir := android.PathForModuleOut(ctx, f.rootDirString()).OutputPath
- rebasedDir := rootDir
- if f.properties.Base_dir != nil {
- rebasedDir = rootDir.Join(ctx, *f.properties.Base_dir)
- }
- builder := android.NewRuleBuilder(pctx, ctx)
- // Wipe the root dir to get rid of leftover files from prior builds
- builder.Command().Textf("rm -rf %s && mkdir -p %s", rootDir, rootDir)
- specs := f.gatherFilteredPackagingSpecs(ctx)
- f.entries = f.copyPackagingSpecs(ctx, builder, specs, rootDir, rebasedDir)
-
- f.buildNonDepsFiles(ctx, builder, rootDir)
- f.buildFsverityMetadataFiles(ctx, builder, specs, rootDir, rebasedDir)
- f.buildEventLogtagsFile(ctx, builder, rebasedDir)
- f.buildAconfigFlagsFiles(ctx, builder, specs, rebasedDir)
- f.filesystemBuilder.BuildLinkerConfigFile(ctx, builder, rebasedDir)
-
rootDirs, partitions := includeFilesRootDir(ctx)
output := android.PathForModuleOut(ctx, f.installFileName())
@@ -978,7 +959,7 @@
// rootDir is not deleted. Might be useful for quick inspection.
builder.Build("build_cpio_image", fmt.Sprintf("Creating filesystem %s", f.BaseModuleName()))
- return output, rootDir, rebasedDir
+ return output
}
var validPartitions = []string{
@@ -998,27 +979,6 @@
"recovery",
}
-func (f *filesystem) addMakeBuiltFiles(ctx android.ModuleContext, builder *android.RuleBuilder, rootDir android.Path) {
- partition := f.properties.Include_make_built_files
- if partition == "" {
- return
- }
- if !slices.Contains(validPartitions, partition) {
- ctx.PropertyErrorf("include_make_built_files", "Expected one of %#v, found %q", validPartitions, partition)
- return
- }
- stampFile := fmt.Sprintf("target/product/%s/obj/PACKAGING/%s_intermediates/staging_dir.stamp", ctx.Config().DeviceName(), partition)
- fileListFile := fmt.Sprintf("target/product/%s/obj/PACKAGING/%s_intermediates/file_list.txt", ctx.Config().DeviceName(), partition)
- stagingDir := fmt.Sprintf("target/product/%s/%s", ctx.Config().DeviceName(), partition)
-
- builder.Command().BuiltTool("merge_directories").
- Implicit(android.PathForArbitraryOutput(ctx, stampFile)).
- Text("--ignore-duplicates").
- FlagWithInput("--file-list", android.PathForArbitraryOutput(ctx, fileListFile)).
- Text(rootDir.String()).
- Text(android.PathForArbitraryOutput(ctx, stagingDir).String())
-}
-
func (f *filesystem) buildEventLogtagsFile(ctx android.ModuleContext, builder *android.RuleBuilder, rebasedDir android.OutputPath) {
if !proptools.Bool(f.properties.Build_logtags) {
return
diff --git a/filesystem/filesystem_test.go b/filesystem/filesystem_test.go
index 47d06f6..d9bf242 100644
--- a/filesystem/filesystem_test.go
+++ b/filesystem/filesystem_test.go
@@ -136,22 +136,6 @@
}
}
-func TestIncludeMakeBuiltFiles(t *testing.T) {
- result := fixture.RunTestWithBp(t, `
- android_filesystem {
- name: "myfilesystem",
- include_make_built_files: "system",
- }
- `)
-
- output := result.ModuleForTests("myfilesystem", "android_common").Output("myfilesystem.img")
-
- stampFile := "out/target/product/test_device/obj/PACKAGING/system_intermediates/staging_dir.stamp"
- fileListFile := "out/target/product/test_device/obj/PACKAGING/system_intermediates/file_list.txt"
- android.AssertStringListContains(t, "deps of filesystem must include the staging dir stamp file", output.Implicits.Strings(), stampFile)
- android.AssertStringListContains(t, "deps of filesystem must include the staging dir file list", output.Implicits.Strings(), fileListFile)
-}
-
func TestFileSystemFillsLinkerConfigWithStubLibs(t *testing.T) {
result := fixture.RunTestWithBp(t, `
android_system_image {
diff --git a/filesystem/super_image.go b/filesystem/super_image.go
index f73f0dc..4419a2f 100644
--- a/filesystem/super_image.go
+++ b/filesystem/super_image.go
@@ -232,7 +232,7 @@
} else {
if s.properties.Virtual_ab.Retrofit != nil {
- ctx.PropertyErrorf("virtual_ab.retrofix", "This property cannot be set when virtual_ab is disabled")
+ ctx.PropertyErrorf("virtual_ab.retrofit", "This property cannot be set when virtual_ab is disabled")
}
if s.properties.Virtual_ab.Compression != nil {
ctx.PropertyErrorf("virtual_ab.compression", "This property cannot be set when virtual_ab is disabled")
diff --git a/fsgen/filesystem_creator.go b/fsgen/filesystem_creator.go
index d00ebb2..7f5a068 100644
--- a/fsgen/filesystem_creator.go
+++ b/fsgen/filesystem_creator.go
@@ -264,7 +264,8 @@
partitionProps.Vbmeta_partitions = vbmetaPartitions
deviceProps := &filesystem.DeviceProperties{
- Main_device: proptools.BoolPtr(true),
+ Main_device: proptools.BoolPtr(true),
+ Ab_ota_updater: proptools.BoolPtr(ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse.AbOtaUpdater),
}
if bootloader, ok := f.createBootloaderFilegroup(ctx); ok {
deviceProps.Bootloader = proptools.StringPtr(":" + bootloader)
diff --git a/fsgen/super_img.go b/fsgen/super_img.go
index 23d331d..5c23868 100644
--- a/fsgen/super_img.go
+++ b/fsgen/super_img.go
@@ -58,7 +58,7 @@
if partitionVars.ProductVirtualAbCowVersion != "" {
version, err := strconv.ParseInt(partitionVars.ProductVirtualAbCowVersion, 10, 32)
if err != nil {
- ctx.ModuleErrorf("Compression factor must be an int, got %q", partitionVars.ProductVirtualAbCowVersion)
+ ctx.ModuleErrorf("COW version must be an int, got %q", partitionVars.ProductVirtualAbCowVersion)
}
superImageProps.Virtual_ab.Cow_version = proptools.Int64Ptr(version)
}
diff --git a/java/aar.go b/java/aar.go
index b982b95..3479f93 100644
--- a/java/aar.go
+++ b/java/aar.go
@@ -1040,7 +1040,7 @@
}
prebuiltJniPackages := android.Paths{}
- ctx.VisitDirectDeps(func(module android.Module) {
+ ctx.VisitDirectDepsProxy(func(module android.ModuleProxy) {
if info, ok := android.OtherModuleProvider(ctx, module, JniPackageProvider); ok {
prebuiltJniPackages = append(prebuiltJniPackages, info.JniPackages...)
}
diff --git a/java/base.go b/java/base.go
index 8e013b9..0b896d8 100644
--- a/java/base.go
+++ b/java/base.go
@@ -1978,7 +1978,7 @@
}
func collectDepProguardSpecInfo(ctx android.ModuleContext) (transitiveProguardFlags, transitiveUnconditionalExportedFlags []depset.DepSet[android.Path]) {
- ctx.VisitDirectDeps(func(m android.Module) {
+ ctx.VisitDirectDepsProxy(func(m android.ModuleProxy) {
depProguardInfo, _ := android.OtherModuleProvider(ctx, m, ProguardSpecInfoProvider)
depTag := ctx.OtherModuleDependencyTag(m)
diff --git a/java/droiddoc.go b/java/droiddoc.go
index 49674b9..225f201 100644
--- a/java/droiddoc.go
+++ b/java/droiddoc.go
@@ -19,6 +19,7 @@
"path/filepath"
"strings"
+ "github.com/google/blueprint"
"github.com/google/blueprint/proptools"
"android/soong/android"
@@ -874,6 +875,13 @@
Path *string
}
+type ExportedDroiddocDirInfo struct {
+ Deps android.Paths
+ Dir android.Path
+}
+
+var ExportedDroiddocDirInfoProvider = blueprint.NewProvider[ExportedDroiddocDirInfo]()
+
type ExportedDroiddocDir struct {
android.ModuleBase
@@ -897,6 +905,11 @@
path := String(d.properties.Path)
d.dir = android.PathForModuleSrc(ctx, path)
d.deps = android.PathsForModuleSrc(ctx, []string{filepath.Join(path, "**/*")})
+
+ android.SetProvider(ctx, ExportedDroiddocDirInfoProvider, ExportedDroiddocDirInfo{
+ Dir: d.dir,
+ Deps: d.deps,
+ })
}
// Defaults
diff --git a/java/droidstubs.go b/java/droidstubs.go
index fa1fb86..ac1a007 100644
--- a/java/droidstubs.go
+++ b/java/droidstubs.go
@@ -20,6 +20,7 @@
"regexp"
"strings"
+ "github.com/google/blueprint"
"github.com/google/blueprint/proptools"
"android/soong/android"
@@ -27,6 +28,18 @@
"android/soong/remoteexec"
)
+type StubsArtifactsInfo struct {
+ ApiVersionsXml android.WritablePath
+}
+
+type DroidStubsInfo struct {
+ CurrentApiTimestamp android.Path
+ EverythingArtifacts StubsArtifactsInfo
+ ExportableArtifacts StubsArtifactsInfo
+}
+
+var DroidStubsInfoProvider = blueprint.NewProvider[DroidStubsInfo]()
+
// The values allowed for Droidstubs' Api_levels_sdk_type
var allowedApiLevelSdkTypes = []string{"public", "system", "module-lib", "system-server"}
@@ -498,9 +511,9 @@
}
func (d *Droidstubs) mergeAnnoDirFlags(ctx android.ModuleContext, cmd *android.RuleBuilderCommand) {
- ctx.VisitDirectDepsWithTag(metalavaMergeAnnotationsDirTag, func(m android.Module) {
- if t, ok := m.(*ExportedDroiddocDir); ok {
- cmd.FlagWithArg("--merge-qualifier-annotations ", t.dir.String()).Implicits(t.deps)
+ ctx.VisitDirectDepsProxyWithTag(metalavaMergeAnnotationsDirTag, func(m android.ModuleProxy) {
+ if t, ok := android.OtherModuleProvider(ctx, m, ExportedDroiddocDirInfoProvider); ok {
+ cmd.FlagWithArg("--merge-qualifier-annotations ", t.Dir.String()).Implicits(t.Deps)
} else {
ctx.PropertyErrorf("merge_annotations_dirs",
"module %q is not a metalava merge-annotations dir", ctx.OtherModuleName(m))
@@ -509,9 +522,9 @@
}
func (d *Droidstubs) inclusionAnnotationsFlags(ctx android.ModuleContext, cmd *android.RuleBuilderCommand) {
- ctx.VisitDirectDepsWithTag(metalavaMergeInclusionAnnotationsDirTag, func(m android.Module) {
- if t, ok := m.(*ExportedDroiddocDir); ok {
- cmd.FlagWithArg("--merge-inclusion-annotations ", t.dir.String()).Implicits(t.deps)
+ ctx.VisitDirectDepsProxyWithTag(metalavaMergeInclusionAnnotationsDirTag, func(m android.ModuleProxy) {
+ if t, ok := android.OtherModuleProvider(ctx, m, ExportedDroiddocDirInfoProvider); ok {
+ cmd.FlagWithArg("--merge-inclusion-annotations ", t.Dir.String()).Implicits(t.Deps)
} else {
ctx.PropertyErrorf("merge_inclusion_annotations_dirs",
"module %q is not a metalava merge-annotations dir", ctx.OtherModuleName(m))
@@ -525,12 +538,12 @@
d.apiLevelsGenerationFlags(ctx, cmd, stubsType, apiVersionsXml)
apiVersions = apiVersionsXml
} else {
- ctx.VisitDirectDepsWithTag(metalavaAPILevelsModuleTag, func(m android.Module) {
- if s, ok := m.(*Droidstubs); ok {
+ ctx.VisitDirectDepsProxyWithTag(metalavaAPILevelsModuleTag, func(m android.ModuleProxy) {
+ if s, ok := android.OtherModuleProvider(ctx, m, DroidStubsInfoProvider); ok {
if stubsType == Everything {
- apiVersions = s.everythingArtifacts.apiVersionsXml
+ apiVersions = s.EverythingArtifacts.ApiVersionsXml
} else if stubsType == Exportable {
- apiVersions = s.exportableArtifacts.apiVersionsXml
+ apiVersions = s.ExportableArtifacts.ApiVersionsXml
} else {
ctx.ModuleErrorf("%s stubs type does not generate api-versions.xml file", stubsType.String())
}
@@ -603,18 +616,18 @@
var dirs []string
var extensions_dir string
- ctx.VisitDirectDepsWithTag(metalavaAPILevelsAnnotationsDirTag, func(m android.Module) {
- if t, ok := m.(*ExportedDroiddocDir); ok {
- extRegex := regexp.MustCompile(t.dir.String() + extensionsPattern)
+ ctx.VisitDirectDepsProxyWithTag(metalavaAPILevelsAnnotationsDirTag, func(m android.ModuleProxy) {
+ if t, ok := android.OtherModuleProvider(ctx, m, ExportedDroiddocDirInfoProvider); ok {
+ extRegex := regexp.MustCompile(t.Dir.String() + extensionsPattern)
// Grab the first extensions_dir and we find while scanning ExportedDroiddocDir.deps;
// ideally this should be read from prebuiltApis.properties.Extensions_*
- for _, dep := range t.deps {
+ for _, dep := range t.Deps {
// Check to see if it matches an extension first.
depBase := dep.Base()
if extRegex.MatchString(dep.String()) && d.properties.Extensions_info_file != nil {
if extensions_dir == "" {
- extensions_dir = t.dir.String() + "/extensions"
+ extensions_dir = t.Dir.String() + "/extensions"
}
cmd.Implicit(dep)
} else if depBase == filename {
@@ -638,7 +651,7 @@
}
}
- dirs = append(dirs, t.dir.String())
+ dirs = append(dirs, t.Dir.String())
} else {
ctx.PropertyErrorf("api_levels_annotations_dirs",
"module %q is not a metalava api-levels-annotations dir", ctx.OtherModuleName(m))
@@ -1340,6 +1353,16 @@
rule.Build("nullabilityWarningsCheck", "nullability warnings check")
}
+ android.SetProvider(ctx, DroidStubsInfoProvider, DroidStubsInfo{
+ CurrentApiTimestamp: d.CurrentApiTimestamp(),
+ EverythingArtifacts: StubsArtifactsInfo{
+ ApiVersionsXml: d.everythingArtifacts.apiVersionsXml,
+ },
+ ExportableArtifacts: StubsArtifactsInfo{
+ ApiVersionsXml: d.exportableArtifacts.apiVersionsXml,
+ },
+ })
+
d.setOutputFiles(ctx)
}
diff --git a/java/java.go b/java/java.go
index 0a9381d..b2d8b72 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1958,13 +1958,13 @@
// Set the jniLibs of this binary.
// These will be added to `LOCAL_REQUIRED_MODULES`, and the kati packaging system will
// install these alongside the java binary.
- ctx.VisitDirectDepsWithTag(jniInstallTag, func(jni android.Module) {
+ ctx.VisitDirectDepsProxyWithTag(jniInstallTag, func(jni android.ModuleProxy) {
// Use the BaseModuleName of the dependency (without any prebuilt_ prefix)
- bmn, _ := jni.(interface{ BaseModuleName() string })
- j.androidMkNamesOfJniLibs = append(j.androidMkNamesOfJniLibs, bmn.BaseModuleName()+":"+jni.Target().Arch.ArchType.Bitness())
+ commonInfo, _ := android.OtherModuleProvider(ctx, jni, android.CommonModuleInfoKey)
+ j.androidMkNamesOfJniLibs = append(j.androidMkNamesOfJniLibs, commonInfo.BaseModuleName+":"+commonInfo.Target.Arch.ArchType.Bitness())
})
// Check that native libraries are not listed in `required`. Prompt users to use `jni_libs` instead.
- ctx.VisitDirectDepsWithTag(android.RequiredDepTag, func(dep android.Module) {
+ ctx.VisitDirectDepsProxyWithTag(android.RequiredDepTag, func(dep android.ModuleProxy) {
if _, hasSharedLibraryInfo := android.OtherModuleProvider(ctx, dep, cc.SharedLibraryInfoProvider); hasSharedLibraryInfo {
ctx.ModuleErrorf("cc_library %s is no longer supported in `required` of java_binary modules. Please use jni_libs instead.", dep.Name())
}
@@ -2355,7 +2355,7 @@
var bootclassPaths android.Paths
var staticLibs android.Paths
var systemModulesPaths android.Paths
- ctx.VisitDirectDeps(func(dep android.Module) {
+ ctx.VisitDirectDepsProxy(func(dep android.ModuleProxy) {
tag := ctx.OtherModuleDependencyTag(dep)
switch tag {
case javaApiContributionTag:
@@ -2384,8 +2384,8 @@
systemModulesPaths = append(systemModulesPaths, sm.HeaderJars...)
}
case metalavaCurrentApiTimestampTag:
- if currentApiTimestampProvider, ok := dep.(currentApiTimestampProvider); ok {
- al.validationPaths = append(al.validationPaths, currentApiTimestampProvider.CurrentApiTimestamp())
+ if currentApiTimestampProvider, ok := android.OtherModuleProvider(ctx, dep, DroidStubsInfoProvider); ok {
+ al.validationPaths = append(al.validationPaths, currentApiTimestampProvider.CurrentApiTimestamp)
}
case aconfigDeclarationTag:
if provider, ok := android.OtherModuleProvider(ctx, dep, android.AconfigDeclarationsProviderKey); ok {
diff --git a/scripts/Android.bp b/scripts/Android.bp
index d39c84a..94163a5 100644
--- a/scripts/Android.bp
+++ b/scripts/Android.bp
@@ -293,14 +293,6 @@
}
python_binary_host {
- name: "merge_directories",
- main: "merge_directories.py",
- srcs: [
- "merge_directories.py",
- ],
-}
-
-python_binary_host {
name: "merge_json",
main: "merge_json.py",
srcs: [
diff --git a/scripts/merge_directories.py b/scripts/merge_directories.py
deleted file mode 100755
index 3f8631b..0000000
--- a/scripts/merge_directories.py
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/env python3
-import argparse
-import os
-import shutil
-import sys
-
-def main():
- parser = argparse.ArgumentParser(
- description="Given a list of directories, this script will copy the contents of all of "
- "them into the first directory, erroring out if any duplicate files are found."
- )
- parser.add_argument(
- "--ignore-duplicates",
- action="store_true",
- help="Don't error out on duplicate files, just skip them. The file from the earliest "
- "directory listed on the command line will be the winner."
- )
- parser.add_argument(
- "--file-list",
- help="Path to a text file containing paths relative to in_dir. Only these paths will be "
- "copied out of in_dir."
- )
- parser.add_argument("out_dir")
- parser.add_argument("in_dir")
- args = parser.parse_args()
-
- if not os.path.isdir(args.out_dir):
- sys.exit(f"error: {args.out_dir} must be a directory")
- if not os.path.isdir(args.in_dir):
- sys.exit(f"error: {args.in_dir} must be a directory")
-
- file_list = None
- if args.file_list:
- with open(file_list_file, "r") as f:
- file_list = f.read().strip().splitlines()
-
- in_dir = args.in_dir
- for root, dirs, files in os.walk(in_dir):
- rel_root = os.path.relpath(root, in_dir)
- dst_root = os.path.join(args.out_dir, rel_root)
- made_parent_dirs = False
- for f in files:
- src = os.path.join(root, f)
- dst = os.path.join(dst_root, f)
- p = os.path.normpath(os.path.join(rel_root, f))
- if file_list is not None and p not in file_list:
- continue
- if os.path.lexists(dst):
- if args.ignore_duplicates:
- continue
- sys.exit(f"error: {p} exists in both {args.out_dir} and {in_dir}")
-
- if not made_parent_dirs:
- os.makedirs(dst_root, exist_ok=True)
- made_parent_dirs = True
-
- shutil.copy2(src, dst, follow_symlinks=False)
-
-if __name__ == "__main__":
- main()