diff options
-rw-r--r-- | android/api_levels.go | 30 | ||||
-rw-r--r-- | android/init.go | 1 | ||||
-rw-r--r-- | android/licenses.go | 26 | ||||
-rw-r--r-- | android/packaging.go | 6 | ||||
-rw-r--r-- | ci_tests/ci_test_package_zip.go | 3 | ||||
-rw-r--r-- | filesystem/super_image.go | 36 | ||||
-rw-r--r-- | java/rro.go | 17 | ||||
-rw-r--r-- | java/rro_test.go | 18 |
8 files changed, 107 insertions, 30 deletions
diff --git a/android/api_levels.go b/android/api_levels.go index c042eebee..c83fae878 100644 --- a/android/api_levels.go +++ b/android/api_levels.go @@ -19,6 +19,8 @@ import ( "fmt" "strconv" "strings" + + "github.com/google/blueprint/gobtools" ) func init() { @@ -52,6 +54,34 @@ type ApiLevel struct { isPreview bool } +type apiLevelGob struct { + Value string + Number int + IsPreview bool +} + +func (a *ApiLevel) ToGob() *apiLevelGob { + return &apiLevelGob{ + Value: a.value, + Number: a.number, + IsPreview: a.isPreview, + } +} + +func (a *ApiLevel) FromGob(data *apiLevelGob) { + a.value = data.Value + a.number = data.Number + a.isPreview = data.IsPreview +} + +func (a ApiLevel) GobEncode() ([]byte, error) { + return gobtools.CustomGobEncode[apiLevelGob](&a) +} + +func (a *ApiLevel) GobDecode(data []byte) error { + return gobtools.CustomGobDecode[apiLevelGob](data, a) +} + func (this ApiLevel) FinalInt() int { if this.IsInvalid() { panic(fmt.Errorf("%v is not a recognized api_level\n", this)) diff --git a/android/init.go b/android/init.go index d3a13d0ed..af50323d3 100644 --- a/android/init.go +++ b/android/init.go @@ -17,6 +17,7 @@ package android import "encoding/gob" func init() { + gob.Register(applicableLicensesPropertyImpl{}) gob.Register(extraFilesZip{}) gob.Register(InstallPath{}) gob.Register(ModuleGenPath{}) diff --git a/android/licenses.go b/android/licenses.go index 55f46ae23..387792144 100644 --- a/android/licenses.go +++ b/android/licenses.go @@ -22,6 +22,7 @@ import ( "sync" "github.com/google/blueprint" + "github.com/google/blueprint/gobtools" ) // Adds cross-cutting licenses dependency to propagate license metadata through the build system. @@ -67,6 +68,31 @@ type applicableLicensesPropertyImpl struct { licensesProperty *[]string } +type applicableLicensesPropertyImplGob struct { + Name string + LicensesProperty []string +} + +func (a *applicableLicensesPropertyImpl) ToGob() *applicableLicensesPropertyImplGob { + return &applicableLicensesPropertyImplGob{ + Name: a.name, + LicensesProperty: *a.licensesProperty, + } +} + +func (a *applicableLicensesPropertyImpl) FromGob(data *applicableLicensesPropertyImplGob) { + a.name = data.Name + a.licensesProperty = &data.LicensesProperty +} + +func (a applicableLicensesPropertyImpl) GobEncode() ([]byte, error) { + return gobtools.CustomGobEncode[applicableLicensesPropertyImplGob](&a) +} + +func (a *applicableLicensesPropertyImpl) GobDecode(data []byte) error { + return gobtools.CustomGobDecode[applicableLicensesPropertyImplGob](data, a) +} + func newApplicableLicensesProperty(name string, licensesProperty *[]string) applicableLicensesProperty { return applicableLicensesPropertyImpl{ name: name, diff --git a/android/packaging.go b/android/packaging.go index 6146f02c9..bb1fe4e45 100644 --- a/android/packaging.go +++ b/android/packaging.go @@ -89,6 +89,8 @@ type packagingSpecGob struct { ArchType ArchType Overrides []string Owner string + RequiresFullInstall bool + FullInstallPath InstallPath Variation string } @@ -113,6 +115,8 @@ func (p *PackagingSpec) ToGob() *packagingSpecGob { ArchType: p.archType, Overrides: p.overrides.ToSlice(), Owner: p.owner, + RequiresFullInstall: p.requiresFullInstall, + FullInstallPath: p.fullInstallPath, Variation: p.variation, } } @@ -129,6 +133,8 @@ func (p *PackagingSpec) FromGob(data *packagingSpecGob) { p.archType = data.ArchType p.overrides = uniquelist.Make(data.Overrides) p.owner = data.Owner + p.requiresFullInstall = data.RequiresFullInstall + p.fullInstallPath = data.FullInstallPath p.variation = data.Variation } diff --git a/ci_tests/ci_test_package_zip.go b/ci_tests/ci_test_package_zip.go index 37eb625a0..95249aa10 100644 --- a/ci_tests/ci_test_package_zip.go +++ b/ci_tests/ci_test_package_zip.go @@ -170,6 +170,9 @@ func createOutput(ctx android.ModuleContext, pctx android.PackageContext) androi builder.Command().Text("mkdir").Flag("-p").Output(stagingDir) builder.Temporary(stagingDir) ctx.WalkDeps(func(child, parent android.Module) bool { + if !child.Enabled(ctx) { + return false + } if android.EqualModules(parent, ctx.Module()) && ctx.OtherModuleDependencyTag(child) == testPackageZipDepTag { // handle direct deps extendBuilderCommand(ctx, child, builder, stagingDir, productOut, arch, secondArch) diff --git a/filesystem/super_image.go b/filesystem/super_image.go index 8e2b532a6..cd7df027a 100644 --- a/filesystem/super_image.go +++ b/filesystem/super_image.go @@ -325,39 +325,43 @@ func (s *superImage) dumpDynamicPartitionInfo(ctx android.ModuleContext, sb *str sb.WriteRune('\n') } - addStr("build_super_partition", "true") - if proptools.Bool(s.properties.Create_super_empty) { - addStr("build_super_empty_partition", "true") - } addStr("use_dynamic_partitions", strconv.FormatBool(proptools.Bool(s.properties.Use_dynamic_partitions))) if proptools.Bool(s.properties.Retrofit) { addStr("dynamic_partition_retrofit", "true") } addStr("lpmake", "lpmake") + addStr("build_super_partition", "true") + if proptools.Bool(s.properties.Create_super_empty) { + addStr("build_super_empty_partition", "true") + } addStr("super_metadata_device", proptools.String(s.properties.Metadata_device)) if len(s.properties.Block_devices) > 0 { addStr("super_block_devices", strings.Join(s.properties.Block_devices, " ")) } - if proptools.Bool(s.properties.Super_image_in_update_package) { - addStr("super_image_in_update_package", "true") - } - addStr("super_partition_size", strconv.Itoa(proptools.Int(s.properties.Size))) // TODO: In make, there's more complicated logic than just this surrounding super_*_device_size addStr("super_super_device_size", strconv.Itoa(proptools.Int(s.properties.Size))) var groups, partitionList []string for _, groupInfo := range s.properties.Partition_groups { groups = append(groups, groupInfo.Name) partitionList = append(partitionList, groupInfo.PartitionList...) - addStr("super_"+groupInfo.Name+"_group_size", groupInfo.GroupSize) - addStr("super_"+groupInfo.Name+"_partition_list", strings.Join(groupInfo.PartitionList, " ")) } + addStr("dynamic_partition_list", strings.Join(android.SortedUniqueStrings(partitionList), " ")) + addStr("super_partition_groups", strings.Join(groups, " ")) initialPartitionListLen := len(partitionList) partitionList = android.SortedUniqueStrings(partitionList) if len(partitionList) != initialPartitionListLen { ctx.ModuleErrorf("Duplicate partitions found in the partition_groups property") } - addStr("super_partition_groups", strings.Join(groups, " ")) - addStr("dynamic_partition_list", strings.Join(partitionList, " ")) + // Add Partition group info after adding `super_partition_groups` and `dynamic_partition_list` + for _, groupInfo := range s.properties.Partition_groups { + addStr("super_"+groupInfo.Name+"_group_size", groupInfo.GroupSize) + addStr("super_"+groupInfo.Name+"_partition_list", strings.Join(groupInfo.PartitionList, " ")) + } + + if proptools.Bool(s.properties.Super_image_in_update_package) { + addStr("super_image_in_update_package", "true") + } + addStr("super_partition_size", strconv.Itoa(proptools.Int(s.properties.Size))) if proptools.Bool(s.properties.Virtual_ab.Enable) { addStr("virtual_ab", "true") @@ -372,12 +376,12 @@ func (s *superImage) dumpDynamicPartitionInfo(ctx android.ModuleContext, sb *str } addStr("virtual_ab_compression_method", *s.properties.Virtual_ab.Compression_method) } - if s.properties.Virtual_ab.Compression_factor != nil { - addStr("virtual_ab_compression_factor", strconv.FormatInt(*s.properties.Virtual_ab.Compression_factor, 10)) - } if s.properties.Virtual_ab.Cow_version != nil { addStr("virtual_ab_cow_version", strconv.FormatInt(*s.properties.Virtual_ab.Cow_version, 10)) } + if s.properties.Virtual_ab.Compression_factor != nil { + addStr("virtual_ab_compression_factor", strconv.FormatInt(*s.properties.Virtual_ab.Compression_factor, 10)) + } } else { if s.properties.Virtual_ab.Retrofit != nil { @@ -401,6 +405,6 @@ func (s *superImage) generateDynamicPartitionsInfo(ctx android.ModuleContext) an var contents strings.Builder s.dumpDynamicPartitionInfo(ctx, &contents) dynamicPartitionsInfo := android.PathForModuleOut(ctx, "dynamic_partitions_info.txt") - android.WriteFileRule(ctx, dynamicPartitionsInfo, contents.String()) + android.WriteFileRuleVerbatim(ctx, dynamicPartitionsInfo, contents.String()) return dynamicPartitionsInfo } diff --git a/java/rro.go b/java/rro.go index 42d42b86a..4ae8d7fc7 100644 --- a/java/rro.go +++ b/java/rro.go @@ -99,15 +99,6 @@ type RuntimeResourceOverlayProperties struct { Overrides []string } -// RuntimeResourceOverlayModule interface is used by the apex package to gather information from -// a RuntimeResourceOverlay module. -type RuntimeResourceOverlayModule interface { - android.Module - OutputFile() android.Path - Certificate() Certificate - Theme() string -} - // RRO's partition logic is different from the partition logic of other modules defined in soong/android/paths.go // The default partition for RRO is "/product" and not "/system" func rroPartition(ctx android.ModuleContext) string { @@ -217,11 +208,13 @@ func (r *RuntimeResourceOverlay) GenerateAndroidBuildActions(ctx android.ModuleC }) android.SetProvider(ctx, RuntimeResourceOverlayInfoProvider, RuntimeResourceOverlayInfo{ - OutputFile: r.OutputFile(), + OutputFile: r.outputFile, Certificate: r.Certificate(), Theme: r.Theme(), }) + ctx.SetOutputFiles([]android.Path{r.outputFile}, "") + buildComplianceMetadata(ctx) } @@ -252,10 +245,6 @@ func (r *RuntimeResourceOverlay) Certificate() Certificate { return r.certificate } -func (r *RuntimeResourceOverlay) OutputFile() android.Path { - return r.outputFile -} - func (r *RuntimeResourceOverlay) Theme() string { return String(r.properties.Theme) } diff --git a/java/rro_test.go b/java/rro_test.go index 0ccc8e707..3e4fed51e 100644 --- a/java/rro_test.go +++ b/java/rro_test.go @@ -358,3 +358,21 @@ func TestRuntimeResourceOverlayFlagsPackages(t *testing.T) { "--feature-flags @out/soong/.intermediates/bar/intermediate.txt --feature-flags @out/soong/.intermediates/baz/intermediate.txt", ) } + +func TestCanBeDataOfTest(t *testing.T) { + android.GroupFixturePreparers( + prepareForJavaTest, + ).RunTestWithBp(t, ` + runtime_resource_overlay { + name: "foo", + sdk_version: "current", + } + android_test { + name: "bar", + data: [ + ":foo", + ], + } + `) + // Just test that this doesn't get errors +} |