diff options
Diffstat (limited to 'filesystem')
-rw-r--r-- | filesystem/android_device.go | 26 | ||||
-rw-r--r-- | filesystem/bootimg.go | 5 | ||||
-rw-r--r-- | filesystem/filesystem.go | 27 | ||||
-rw-r--r-- | filesystem/super_image.go | 2 |
4 files changed, 56 insertions, 4 deletions
diff --git a/filesystem/android_device.go b/filesystem/android_device.go index 17209ed4a..04eaf840e 100644 --- a/filesystem/android_device.go +++ b/filesystem/android_device.go @@ -19,6 +19,7 @@ import ( "fmt" "path/filepath" "slices" + "sort" "strings" "sync/atomic" @@ -280,6 +281,31 @@ func (a *androidDevice) GenerateAndroidBuildActions(ctx android.ModuleContext) { a.setVbmetaPhonyTargets(ctx) a.distFiles(ctx) + + android.SetProvider(ctx, android.AndroidDeviceInfoProvider, android.AndroidDeviceInfo{ + Main_device: android.Bool(a.deviceProps.Main_device), + }) + + if proptools.String(a.partitionProps.Super_partition_name) != "" { + buildComplianceMetadata(ctx, superPartitionDepTag, filesystemDepTag) + } else { + buildComplianceMetadata(ctx, filesystemDepTag) + } +} + +func buildComplianceMetadata(ctx android.ModuleContext, tags ...blueprint.DependencyTag) { + filesContained := make([]string, 0) + for _, tag := range tags { + ctx.VisitDirectDepsProxyWithTag(tag, func(m android.ModuleProxy) { + if complianceMetadataInfo, ok := android.OtherModuleProvider(ctx, m, android.ComplianceMetadataProvider); ok { + filesContained = append(filesContained, complianceMetadataInfo.GetFilesContained()...) + } + }) + } + sort.Strings(filesContained) + + complianceMetadataInfo := ctx.ComplianceMetadataInfo() + complianceMetadataInfo.SetFilesContained(filesContained) } // Returns a list of modules that are installed, which are collected from the dependency diff --git a/filesystem/bootimg.go b/filesystem/bootimg.go index effbd6542..2bf0d5905 100644 --- a/filesystem/bootimg.go +++ b/filesystem/bootimg.go @@ -263,6 +263,11 @@ func (b *bootimg) GenerateAndroidBuildActions(ctx android.ModuleContext) { PublicKey: extractedPublicKey, Output: output, }) + + // Dump compliance metadata + if ramdisk := proptools.String(b.properties.Ramdisk_module); ramdisk != "" { + buildComplianceMetadata(ctx, bootimgRamdiskDep) + } } var BootimgInfoProvider = blueprint.NewProvider[BootimgInfo]() diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go index 8b3b51e89..79db988a0 100644 --- a/filesystem/filesystem.go +++ b/filesystem/filesystem.go @@ -701,6 +701,14 @@ func (f *filesystem) GenerateAndroidBuildActions(ctx android.ModuleContext) { } f.setVbmetaPartitionProvider(ctx) + + // Dump metadata that can not be done in android/compliance-metadata.go + complianceMetadataInfo := ctx.ComplianceMetadataInfo() + filesContained := make([]string, 0, len(fullInstallPaths)) + for _, file := range fullInstallPaths { + filesContained = append(filesContained, file.FullInstallPath.String()) + } + complianceMetadataInfo.SetFilesContained(filesContained) } func (f *filesystem) fileystemStagingDirTimestamp(ctx android.ModuleContext) android.WritablePath { @@ -885,13 +893,24 @@ func (f *filesystem) buildNonDepsFiles( builder.Command().Text("mkdir -p").Text(filepath.Dir(dst.String())) builder.Command().Text("ln -sf").Text(proptools.ShellEscape(target)).Text(dst.String()) f.appendToEntry(ctx, dst) - // Only add the fullInstallPath logic for files in the rebased dir. The root dir - // is harder to install to. - if strings.HasPrefix(name, rebasedPrefix) { + // Add the fullInstallPath logic for files in the rebased dir, and for non-rebased files in "system" partition + // the fullInstallPath is changed to "root" which aligns to the behavior in Make. + if f.PartitionType() == "system" { + installPath := android.PathForModuleInPartitionInstall(ctx, f.PartitionType(), strings.TrimPrefix(name, rebasedPrefix)) + if !strings.HasPrefix(name, rebasedPrefix) { + installPath = android.PathForModuleInPartitionInstall(ctx, "root", name) + } *fullInstallPaths = append(*fullInstallPaths, FullInstallPathInfo{ - FullInstallPath: android.PathForModuleInPartitionInstall(ctx, f.PartitionType(), strings.TrimPrefix(name, rebasedPrefix)), + FullInstallPath: installPath, SymlinkTarget: target, }) + } else { + if strings.HasPrefix(name, rebasedPrefix) { + *fullInstallPaths = append(*fullInstallPaths, FullInstallPathInfo{ + FullInstallPath: android.PathForModuleInPartitionInstall(ctx, f.PartitionType(), strings.TrimPrefix(name, rebasedPrefix)), + SymlinkTarget: target, + }) + } } } diff --git a/filesystem/super_image.go b/filesystem/super_image.go index 5e62fa702..9e4412c13 100644 --- a/filesystem/super_image.go +++ b/filesystem/super_image.go @@ -183,6 +183,8 @@ func (s *superImage) GenerateAndroidBuildActions(ctx android.ModuleContext) { }) ctx.SetOutputFiles([]android.Path{output}, "") ctx.CheckbuildFile(output) + + buildComplianceMetadata(ctx, subImageDepTag) } func (s *superImage) installFileName() string { |