Merge "Revert "Ensure sscp jars get copied to $OUT/soong/system_server_dexjars"" into main
diff --git a/aconfig/codegen/cc_aconfig_library_test.go b/aconfig/codegen/cc_aconfig_library_test.go
index ef92cc8..05449bc 100644
--- a/aconfig/codegen/cc_aconfig_library_test.go
+++ b/aconfig/codegen/cc_aconfig_library_test.go
@@ -163,7 +163,6 @@
entry := android.AndroidMkEntriesForTest(t, result.TestContext, module)[0]
makeVar := entry.EntryMap["LOCAL_ACONFIG_FILES"]
- android.AssertIntEquals(t, "len(LOCAL_ACONFIG_FILES)", 1, len(makeVar))
android.EnsureListContainsSuffix(t, makeVar, "my_aconfig_declarations_foo/intermediate.pb")
}
diff --git a/aconfig/codegen/java_aconfig_library_test.go b/aconfig/codegen/java_aconfig_library_test.go
index 7361d44..85d2675 100644
--- a/aconfig/codegen/java_aconfig_library_test.go
+++ b/aconfig/codegen/java_aconfig_library_test.go
@@ -60,7 +60,6 @@
entry := android.AndroidMkEntriesForTest(t, result.TestContext, module)[0]
makeVar := entry.EntryMap["LOCAL_ACONFIG_FILES"]
- android.AssertIntEquals(t, "len(LOCAL_ACONFIG_FILES)", 1, len(makeVar))
android.EnsureListContainsSuffix(t, makeVar, "android_common/aconfig_merged.pb")
}
diff --git a/android/Android.bp b/android/Android.bp
index 8de0c76..e73f355 100644
--- a/android/Android.bp
+++ b/android/Android.bp
@@ -11,6 +11,7 @@
"blueprint-metrics",
"sbox_proto",
"soong",
+ "soong-android_team_proto",
"soong-android-soongconfig",
"soong-remoteexec",
"soong-response",
@@ -28,6 +29,7 @@
],
srcs: [
"aconfig_providers.go",
+ "all_teams.go",
"androidmk.go",
"apex.go",
"apex_contributions.go",
@@ -35,6 +37,7 @@
"api_levels.go",
"arch.go",
"arch_list.go",
+ "arch_module_context.go",
"base_module_context.go",
"buildinfo_prop.go",
"config.go",
@@ -91,6 +94,7 @@
"singleton.go",
"singleton_module.go",
"soong_config_modules.go",
+ "team.go",
"test_asserts.go",
"test_suites.go",
"testing.go",
diff --git a/android/aconfig_providers.go b/android/aconfig_providers.go
index 68fff58..be9beb1 100644
--- a/android/aconfig_providers.go
+++ b/android/aconfig_providers.go
@@ -15,6 +15,10 @@
package android
import (
+ "fmt"
+ "io"
+ "reflect"
+
"github.com/google/blueprint"
)
@@ -45,6 +49,8 @@
var AconfigTransitiveDeclarationsInfoProvider = blueprint.NewProvider[AconfigTransitiveDeclarationsInfo]()
+// CollectDependencyAconfigFiles is used by some module types to provide finer dependency graphing than
+// we can do in ModuleBase.
func CollectDependencyAconfigFiles(ctx ModuleContext, mergedAconfigFiles *map[string]Paths) {
if *mergedAconfigFiles == nil {
*mergedAconfigFiles = make(map[string]Paths)
@@ -54,7 +60,14 @@
(*mergedAconfigFiles)[dep.Container] = append((*mergedAconfigFiles)[dep.Container], dep.IntermediateCacheOutputPath)
return
}
- if dep, _ := OtherModuleProvider(ctx, module, AconfigTransitiveDeclarationsInfoProvider); len(dep.AconfigFiles) > 0 {
+ if dep, ok := OtherModuleProvider(ctx, module, aconfigPropagatingProviderKey); ok {
+ for container, v := range dep.AconfigFiles {
+ (*mergedAconfigFiles)[container] = append((*mergedAconfigFiles)[container], v...)
+ }
+ }
+ // We process these last, so that they determine the final value, eliminating any duplicates that we picked up
+ // from UpdateAndroidBuildActions.
+ if dep, ok := OtherModuleProvider(ctx, module, AconfigTransitiveDeclarationsInfoProvider); ok {
for container, v := range dep.AconfigFiles {
(*mergedAconfigFiles)[container] = append((*mergedAconfigFiles)[container], v...)
}
@@ -62,7 +75,7 @@
})
for container, aconfigFiles := range *mergedAconfigFiles {
- (*mergedAconfigFiles)[container] = mergeAconfigFiles(ctx, container, aconfigFiles)
+ (*mergedAconfigFiles)[container] = mergeAconfigFiles(ctx, container, aconfigFiles, false)
}
SetProvider(ctx, AconfigTransitiveDeclarationsInfoProvider, AconfigTransitiveDeclarationsInfo{
@@ -70,7 +83,94 @@
})
}
-func mergeAconfigFiles(ctx ModuleContext, container string, inputs Paths) Paths {
+func SetAconfigFileMkEntries(m *ModuleBase, entries *AndroidMkEntries, aconfigFiles map[string]Paths) {
+ setAconfigFileMkEntries(m, entries, aconfigFiles)
+}
+
+type aconfigPropagatingDeclarationsInfo struct {
+ AconfigFiles map[string]Paths
+}
+
+var aconfigPropagatingProviderKey = blueprint.NewProvider[aconfigPropagatingDeclarationsInfo]()
+
+func aconfigUpdateAndroidBuildActions(ctx ModuleContext) {
+ mergedAconfigFiles := make(map[string]Paths)
+ ctx.VisitDirectDepsIgnoreBlueprint(func(module Module) {
+ // If any of our dependencies have aconfig declarations (directly or propagated), then merge those and provide them.
+ if dep, ok := OtherModuleProvider(ctx, module, AconfigDeclarationsProviderKey); ok {
+ mergedAconfigFiles[dep.Container] = append(mergedAconfigFiles[dep.Container], dep.IntermediateCacheOutputPath)
+ }
+ if dep, ok := OtherModuleProvider(ctx, module, aconfigPropagatingProviderKey); ok {
+ for container, v := range dep.AconfigFiles {
+ mergedAconfigFiles[container] = append(mergedAconfigFiles[container], v...)
+ }
+ }
+ if dep, ok := OtherModuleProvider(ctx, module, AconfigTransitiveDeclarationsInfoProvider); ok {
+ for container, v := range dep.AconfigFiles {
+ mergedAconfigFiles[container] = append(mergedAconfigFiles[container], v...)
+ }
+ }
+ })
+ // We only need to set the provider if we have aconfig files.
+ if len(mergedAconfigFiles) > 0 {
+ for container, aconfigFiles := range mergedAconfigFiles {
+ mergedAconfigFiles[container] = mergeAconfigFiles(ctx, container, aconfigFiles, true)
+ }
+
+ SetProvider(ctx, aconfigPropagatingProviderKey, aconfigPropagatingDeclarationsInfo{
+ AconfigFiles: mergedAconfigFiles,
+ })
+ }
+}
+
+func aconfigUpdateAndroidMkData(ctx fillInEntriesContext, mod Module, data *AndroidMkData) {
+ info, ok := SingletonModuleProvider(ctx, mod, aconfigPropagatingProviderKey)
+ // If there is no aconfigPropagatingProvider, or there are no AconfigFiles, then we are done.
+ if !ok || len(info.AconfigFiles) == 0 {
+ return
+ }
+ data.Extra = append(data.Extra, func(w io.Writer, outputFile Path) {
+ AndroidMkEmitAssignList(w, "LOCAL_ACONFIG_FILES", getAconfigFilePaths(mod.base(), info.AconfigFiles).Strings())
+ })
+ // If there is a Custom writer, it needs to support this provider.
+ if data.Custom != nil {
+ switch reflect.TypeOf(mod).String() {
+ case "*aidl.aidlApi": // writes non-custom before adding .phony
+ case "*android_sdk.sdkRepoHost": // doesn't go through base_rules
+ case "*apex.apexBundle": // aconfig_file properties written
+ case "*bpf.bpf": // properties written (both for module and objs)
+ case "*genrule.Module": // writes non-custom before adding .phony
+ case "*java.SystemModules": // doesn't go through base_rules
+ case "*phony.phony": // properties written
+ case "*phony.PhonyRule": // writes phony deps and acts like `.PHONY`
+ case "*sysprop.syspropLibrary": // properties written
+ default:
+ panic(fmt.Errorf("custom make rules do not handle aconfig files for %q (%q) module %q", ctx.ModuleType(mod), reflect.TypeOf(mod), mod))
+ }
+ }
+}
+
+func aconfigUpdateAndroidMkEntries(ctx fillInEntriesContext, mod Module, entries *[]AndroidMkEntries) {
+ // If there are no entries, then we can ignore this module, even if it has aconfig files.
+ if len(*entries) == 0 {
+ return
+ }
+ info, ok := SingletonModuleProvider(ctx, mod, aconfigPropagatingProviderKey)
+ if !ok || len(info.AconfigFiles) == 0 {
+ return
+ }
+ // All of the files in the module potentially depend on the aconfig flag values.
+ for idx, _ := range *entries {
+ (*entries)[idx].ExtraEntries = append((*entries)[idx].ExtraEntries,
+ func(ctx AndroidMkExtraEntriesContext, entries *AndroidMkEntries) {
+ setAconfigFileMkEntries(mod.base(), entries, info.AconfigFiles)
+ },
+ )
+
+ }
+}
+
+func mergeAconfigFiles(ctx ModuleContext, container string, inputs Paths, generateRule bool) Paths {
inputs = LastUniquePaths(inputs)
if len(inputs) == 1 {
return Paths{inputs[0]}
@@ -78,22 +178,28 @@
output := PathForModuleOut(ctx, container, "aconfig_merged.pb")
- ctx.Build(pctx, BuildParams{
- Rule: mergeAconfigFilesRule,
- Description: "merge aconfig files",
- Inputs: inputs,
- Output: output,
- Args: map[string]string{
- "flags": JoinWithPrefix(inputs.Strings(), "--cache "),
- },
- })
+ if generateRule {
+ ctx.Build(pctx, BuildParams{
+ Rule: mergeAconfigFilesRule,
+ Description: "merge aconfig files",
+ Inputs: inputs,
+ Output: output,
+ Args: map[string]string{
+ "flags": JoinWithPrefix(inputs.Strings(), "--cache "),
+ },
+ })
+ }
return Paths{output}
}
-func SetAconfigFileMkEntries(m *ModuleBase, entries *AndroidMkEntries, aconfigFiles map[string]Paths) {
+func setAconfigFileMkEntries(m *ModuleBase, entries *AndroidMkEntries, aconfigFiles map[string]Paths) {
+ entries.AddPaths("LOCAL_ACONFIG_FILES", getAconfigFilePaths(m, aconfigFiles))
+}
+
+func getAconfigFilePaths(m *ModuleBase, aconfigFiles map[string]Paths) (paths Paths) {
// TODO(b/311155208): The default container here should be system.
- container := ""
+ container := "system"
if m.SocSpecific() {
container = "vendor"
@@ -103,5 +209,18 @@
container = "system_ext"
}
- entries.SetPaths("LOCAL_ACONFIG_FILES", aconfigFiles[container])
+ paths = append(paths, aconfigFiles[container]...)
+ if container == "system" {
+ // TODO(b/311155208): Once the default container is system, we can drop this.
+ paths = append(paths, aconfigFiles[""]...)
+ }
+ if container != "system" {
+ if len(aconfigFiles[container]) == 0 && len(aconfigFiles[""]) > 0 {
+ // TODO(b/308625757): Either we guessed the container wrong, or the flag is misdeclared.
+ // For now, just include the system (aka "") container if we get here.
+ //fmt.Printf("container_mismatch: module=%v container=%v files=%v\n", m, container, aconfigFiles)
+ }
+ paths = append(paths, aconfigFiles[""]...)
+ }
+ return
}
diff --git a/android/all_teams.go b/android/all_teams.go
new file mode 100644
index 0000000..6c3a219
--- /dev/null
+++ b/android/all_teams.go
@@ -0,0 +1,158 @@
+package android
+
+import (
+ "android/soong/android/team_proto"
+ "path/filepath"
+
+ "google.golang.org/protobuf/proto"
+)
+
+const ownershipDirectory = "ownership"
+const allTeamsFile = "all_teams.pb"
+
+func AllTeamsFactory() Singleton {
+ return &allTeamsSingleton{}
+}
+
+func init() {
+ registerAllTeamBuildComponents(InitRegistrationContext)
+}
+
+func registerAllTeamBuildComponents(ctx RegistrationContext) {
+ ctx.RegisterParallelSingletonType("all_teams", AllTeamsFactory)
+}
+
+// For each module, list the team or the bpFile the module is defined in.
+type moduleTeamInfo struct {
+ teamName string
+ bpFile string
+}
+
+type allTeamsSingleton struct {
+ // Path where the collected metadata is stored after successful validation.
+ outputPath OutputPath
+
+ // Map of all package modules we visit during GenerateBuildActions
+ packages map[string]packageProperties
+ // Map of all team modules we visit during GenerateBuildActions
+ teams map[string]teamProperties
+ // Keeps track of team information or bp file for each module we visit.
+ teams_for_mods map[string]moduleTeamInfo
+}
+
+// See if there is a package module for the given bpFilePath with a team defined, if so return the team.
+// If not ascend up to the parent directory and do the same.
+func (this *allTeamsSingleton) lookupDefaultTeam(bpFilePath string) (teamProperties, bool) {
+ // return the Default_team listed in the package if is there.
+ if p, ok := this.packages[bpFilePath]; ok {
+ if t := p.Default_team; t != nil {
+ return this.teams[*p.Default_team], true
+ }
+ }
+ // Strip a directory and go up.
+ // Does android/paths.go basePath,SourcePath help?
+ current, base := filepath.Split(bpFilePath)
+ current = filepath.Clean(current) // removes trailing slash, convert "" -> "."
+ parent, _ := filepath.Split(current)
+ if current == "." {
+ return teamProperties{}, false
+ }
+ return this.lookupDefaultTeam(filepath.Join(parent, base))
+}
+
+// Create a rule to run a tool to collect all the intermediate files
+// which list the team per module into one proto file.
+func (this *allTeamsSingleton) GenerateBuildActions(ctx SingletonContext) {
+ this.packages = make(map[string]packageProperties)
+ this.teams = make(map[string]teamProperties)
+ this.teams_for_mods = make(map[string]moduleTeamInfo)
+
+ ctx.VisitAllModules(func(module Module) {
+ if !module.Enabled() {
+ return
+ }
+
+ bpFile := ctx.BlueprintFile(module)
+
+ // Package Modules and Team Modules are stored in a map so we can look them up by name for
+ // modules without a team.
+ if pack, ok := module.(*packageModule); ok {
+ // Packages don't have names, use the blueprint file as the key. we can't get qualifiedModuleId in this context.
+ pkgKey := bpFile
+ this.packages[pkgKey] = pack.properties
+ return
+ }
+ if team, ok := module.(*teamModule); ok {
+ this.teams[team.Name()] = team.properties
+ return
+ }
+
+ // If a team name is given for a module, store it.
+ // Otherwise store the bpFile so we can do a package walk later.
+ if module.base().Team() != "" {
+ this.teams_for_mods[module.Name()] = moduleTeamInfo{teamName: module.base().Team(), bpFile: bpFile}
+ } else {
+ this.teams_for_mods[module.Name()] = moduleTeamInfo{bpFile: bpFile}
+ }
+ })
+
+ // Visit all modules again and lookup the team name in the package or parent package if the team
+ // isn't assignged at the module level.
+ allTeams := this.lookupTeamForAllModules()
+
+ this.outputPath = PathForOutput(ctx, ownershipDirectory, allTeamsFile)
+ data, err := proto.Marshal(allTeams)
+ if err != nil {
+ ctx.Errorf("Unable to marshal team data. %s", err)
+ }
+
+ WriteFileRuleVerbatim(ctx, this.outputPath, string(data))
+ ctx.Phony("all_teams", this.outputPath)
+}
+
+func (this *allTeamsSingleton) MakeVars(ctx MakeVarsContext) {
+ ctx.DistForGoal("all_teams", this.outputPath)
+}
+
+// Visit every (non-package, non-team) module and write out a proto containing
+// either the declared team data for that module or the package default team data for that module.
+func (this *allTeamsSingleton) lookupTeamForAllModules() *team_proto.AllTeams {
+ teamsProto := make([]*team_proto.Team, len(this.teams_for_mods))
+ i := 0
+ for moduleName, m := range this.teams_for_mods {
+ teamName := m.teamName
+ var teamProperties teamProperties
+ found := false
+ if teamName != "" {
+ teamProperties, found = this.teams[teamName]
+ } else {
+ teamProperties, found = this.lookupDefaultTeam(m.bpFile)
+ }
+
+ trendy_team_id := ""
+ if found {
+ trendy_team_id = *teamProperties.Trendy_team_id
+ }
+
+ var files []string
+ teamData := new(team_proto.Team)
+ if trendy_team_id != "" {
+ *teamData = team_proto.Team{
+ TrendyTeamId: proto.String(trendy_team_id),
+ TargetName: proto.String(moduleName),
+ Path: proto.String(m.bpFile),
+ File: files,
+ }
+ } else {
+ // Clients rely on the TrendyTeamId optional field not being set.
+ *teamData = team_proto.Team{
+ TargetName: proto.String(moduleName),
+ Path: proto.String(m.bpFile),
+ File: files,
+ }
+ }
+ teamsProto[i] = teamData
+ i++
+ }
+ return &team_proto.AllTeams{Teams: teamsProto}
+}
diff --git a/android/all_teams_test.go b/android/all_teams_test.go
new file mode 100644
index 0000000..a02b86e
--- /dev/null
+++ b/android/all_teams_test.go
@@ -0,0 +1,208 @@
+// Copyright 2024 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package android
+
+import (
+ "android/soong/android/team_proto"
+ "log"
+ "testing"
+
+ "google.golang.org/protobuf/proto"
+)
+
+func TestAllTeams(t *testing.T) {
+ t.Parallel()
+ ctx := GroupFixturePreparers(
+ PrepareForTestWithTeamBuildComponents,
+ FixtureRegisterWithContext(func(ctx RegistrationContext) {
+ ctx.RegisterModuleType("fake", fakeModuleFactory)
+ ctx.RegisterParallelSingletonType("all_teams", AllTeamsFactory)
+ }),
+ ).RunTestWithBp(t, `
+ fake {
+ name: "main_test",
+ team: "someteam",
+ }
+ team {
+ name: "someteam",
+ trendy_team_id: "cool_team",
+ }
+
+ team {
+ name: "team2",
+ trendy_team_id: "22222",
+ }
+
+ fake {
+ name: "tool",
+ team: "team2",
+ }
+
+ fake {
+ name: "noteam",
+ }
+ `)
+
+ var teams *team_proto.AllTeams
+ teams = getTeamProtoOutput(t, ctx)
+
+ // map of module name -> trendy team name.
+ actualTeams := make(map[string]*string)
+ for _, teamProto := range teams.Teams {
+ actualTeams[teamProto.GetTargetName()] = teamProto.TrendyTeamId
+ }
+ expectedTeams := map[string]*string{
+ "main_test": proto.String("cool_team"),
+ "tool": proto.String("22222"),
+ "noteam": nil,
+ }
+
+ AssertDeepEquals(t, "compare maps", expectedTeams, actualTeams)
+}
+
+func getTeamProtoOutput(t *testing.T, ctx *TestResult) *team_proto.AllTeams {
+ teams := new(team_proto.AllTeams)
+ config := ctx.SingletonForTests("all_teams")
+ allOutputs := config.AllOutputs()
+
+ protoPath := allOutputs[0]
+
+ out := config.MaybeOutput(protoPath)
+ outProto := []byte(ContentFromFileRuleForTests(t, ctx.TestContext, out))
+ if err := proto.Unmarshal(outProto, teams); err != nil {
+ log.Fatalln("Failed to parse teams proto:", err)
+ }
+ return teams
+}
+
+// Android.bp
+//
+// team: team_top
+//
+// # dir1 has no modules with teams,
+// # but has a dir with no Android.bp
+// dir1/Android.bp
+//
+// module_dir1
+//
+// # dirs without and Android.bp should be fine.
+// dir1/dir2/dir3/Android.bp
+//
+// package {}
+// module_dir123
+//
+// teams_dir/Android.bp
+//
+// module_with_team1: team1
+// team1: 111
+//
+// # team comes from upper package default
+// teams_dir/deeper/Android.bp
+//
+// module2_with_team1: team1
+//
+// package_defaults/Android.bp
+// package_defaults/pd2/Android.bp
+//
+// package{ default_team: team_top}
+// module_pd2 ## should get team_top
+//
+// package_defaults/pd2/pd3/Android.bp
+//
+// module_pd3 ## should get team_top
+func TestPackageLookup(t *testing.T) {
+ t.Parallel()
+ rootBp := `
+ team {
+ name: "team_top",
+ trendy_team_id: "trendy://team_top",
+ } `
+
+ dir1Bp := `
+ fake {
+ name: "module_dir1",
+ } `
+ dir3Bp := `
+ package {}
+ fake {
+ name: "module_dir123",
+ } `
+ teamsDirBp := `
+ fake {
+ name: "module_with_team1",
+ team: "team1"
+
+ }
+ team {
+ name: "team1",
+ trendy_team_id: "111",
+ } `
+ teamsDirDeeper := `
+ fake {
+ name: "module2_with_team1",
+ team: "team1"
+ } `
+ // create an empty one.
+ packageDefaultsBp := ""
+ packageDefaultspd2 := `
+ package { default_team: "team_top"}
+ fake {
+ name: "modulepd2",
+ } `
+
+ packageDefaultspd3 := `
+ fake {
+ name: "modulepd3",
+ }
+ fake {
+ name: "modulepd3b",
+ team: "team1"
+ } `
+
+ ctx := GroupFixturePreparers(
+ PrepareForTestWithTeamBuildComponents,
+ PrepareForTestWithPackageModule,
+ FixtureRegisterWithContext(func(ctx RegistrationContext) {
+ ctx.RegisterModuleType("fake", fakeModuleFactory)
+ ctx.RegisterParallelSingletonType("all_teams", AllTeamsFactory)
+ }),
+ FixtureAddTextFile("Android.bp", rootBp),
+ FixtureAddTextFile("dir1/Android.bp", dir1Bp),
+ FixtureAddTextFile("dir1/dir2/dir3/Android.bp", dir3Bp),
+ FixtureAddTextFile("teams_dir/Android.bp", teamsDirBp),
+ FixtureAddTextFile("teams_dir/deeper/Android.bp", teamsDirDeeper),
+ FixtureAddTextFile("package_defaults/Android.bp", packageDefaultsBp),
+ FixtureAddTextFile("package_defaults/pd2/Android.bp", packageDefaultspd2),
+ FixtureAddTextFile("package_defaults/pd2/pd3/Android.bp", packageDefaultspd3),
+ ).RunTest(t)
+
+ var teams *team_proto.AllTeams
+ teams = getTeamProtoOutput(t, ctx)
+
+ // map of module name -> trendy team name.
+ actualTeams := make(map[string]*string)
+ for _, teamProto := range teams.Teams {
+ actualTeams[teamProto.GetTargetName()] = teamProto.TrendyTeamId
+ }
+ expectedTeams := map[string]*string{
+ "module_with_team1": proto.String("111"),
+ "module2_with_team1": proto.String("111"),
+ "modulepd2": proto.String("trendy://team_top"),
+ "modulepd3": proto.String("trendy://team_top"),
+ "modulepd3b": proto.String("111"),
+ "module_dir1": nil,
+ "module_dir123": nil,
+ }
+ AssertDeepEquals(t, "compare maps", expectedTeams, actualTeams)
+}
diff --git a/android/androidmk.go b/android/androidmk.go
index 235d7c0..07f7c58 100644
--- a/android/androidmk.go
+++ b/android/androidmk.go
@@ -859,6 +859,7 @@
}
data.fillInData(ctx, mod)
+ aconfigUpdateAndroidMkData(ctx, mod.(Module), &data)
prefix := ""
if amod.ArchSpecific() {
@@ -943,6 +944,7 @@
}
entriesList := provider.AndroidMkEntries()
+ aconfigUpdateAndroidMkEntries(ctx, mod.(Module), &entriesList)
// Any new or special cases here need review to verify correct propagation of license information.
for _, entries := range entriesList {
diff --git a/android/arch_list.go b/android/arch_list.go
index 801ac49..f4409a9 100644
--- a/android/arch_list.go
+++ b/android/arch_list.go
@@ -34,11 +34,11 @@
"broadwell",
"goldmont",
"goldmont-plus",
- // Target arch is goldmont, but without xsaves support.
+ // Target arch is goldmont, but without supporting SHA and XSAVES.
// This ensures efficient execution on a broad range of Intel/AMD CPUs used
- // in Chromebooks, including those lacking xsaves support.
+ // in Chromebooks, including those lacking SHA or XSAVES support.
// (e.g. Kaby Lake, Gemini Lake, Alder Lake and AMD Zen series)
- "goldmont-without-xsaves",
+ "goldmont-without-sha-xsaves",
"haswell",
"icelake",
"ivybridge",
@@ -57,7 +57,7 @@
"broadwell",
"goldmont",
"goldmont-plus",
- "goldmont-without-xsaves",
+ "goldmont-without-sha-xsaves",
"haswell",
"icelake",
"ivybridge",
@@ -203,7 +203,7 @@
"popcnt",
"movbe",
},
- "goldmont-without-xsaves": {
+ "goldmont-without-sha-xsaves": {
"ssse3",
"sse4",
"sse4_1",
@@ -373,7 +373,7 @@
"aes_ni",
"popcnt",
},
- "goldmont-without-xsaves": {
+ "goldmont-without-sha-xsaves": {
"ssse3",
"sse4",
"sse4_1",
diff --git a/android/arch_module_context.go b/android/arch_module_context.go
new file mode 100644
index 0000000..3cf4b41
--- /dev/null
+++ b/android/arch_module_context.go
@@ -0,0 +1,83 @@
+// Copyright 2024 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package android
+
+// ArchModuleContext can be embedded in other contexts to provide information about the module set by
+// the archMutator.
+type ArchModuleContext interface {
+ Target() Target
+ TargetPrimary() bool
+
+ // The additional arch specific targets (e.g. 32/64 bit) that this module variant is
+ // responsible for creating.
+ MultiTargets() []Target
+ Arch() Arch
+ Os() OsType
+ Host() bool
+ Device() bool
+ Darwin() bool
+ Windows() bool
+ PrimaryArch() bool
+}
+
+type archModuleContext struct {
+ // TODO: these should eventually go through a (possibly cached) provider like any other configuration instead
+ // of being special cased.
+ os OsType
+ target Target
+ targetPrimary bool
+ multiTargets []Target
+ primaryArch bool
+}
+
+func (a *archModuleContext) Target() Target {
+ return a.target
+}
+
+func (a *archModuleContext) TargetPrimary() bool {
+ return a.targetPrimary
+}
+
+func (a *archModuleContext) MultiTargets() []Target {
+ return a.multiTargets
+}
+
+func (a *archModuleContext) Arch() Arch {
+ return a.target.Arch
+}
+
+func (a *archModuleContext) Os() OsType {
+ return a.os
+}
+
+func (a *archModuleContext) Host() bool {
+ return a.os.Class == Host
+}
+
+func (a *archModuleContext) Device() bool {
+ return a.os.Class == Device
+}
+
+func (a *archModuleContext) Darwin() bool {
+ return a.os == Darwin
+}
+
+func (a *archModuleContext) Windows() bool {
+ return a.os == Windows
+}
+
+func (b *archModuleContext) PrimaryArch() bool {
+ return b.primaryArch
+}
diff --git a/android/base_module_context.go b/android/base_module_context.go
index 0cf5d77..b9c1153 100644
--- a/android/base_module_context.go
+++ b/android/base_module_context.go
@@ -26,6 +26,7 @@
// instead of a blueprint.Module, plus some extra methods that return Android-specific information
// about the current module.
type BaseModuleContext interface {
+ ArchModuleContext
EarlyModuleContext
blueprintBaseModuleContext() blueprint.BaseModuleContext
@@ -213,29 +214,12 @@
// getMissingDependencies returns the list of missing dependencies.
// Calling this function prevents adding new dependencies.
getMissingDependencies() []string
-
- Target() Target
- TargetPrimary() bool
-
- // The additional arch specific targets (e.g. 32/64 bit) that this module variant is
- // responsible for creating.
- MultiTargets() []Target
- Arch() Arch
- Os() OsType
- Host() bool
- Device() bool
- Darwin() bool
- Windows() bool
- PrimaryArch() bool
}
type baseModuleContext struct {
bp blueprint.BaseModuleContext
earlyModuleContext
- os OsType
- target Target
- multiTargets []Target
- targetPrimary bool
+ archModuleContext
walkPath []Module
tagPath []blueprint.DependencyTag
@@ -580,46 +564,3 @@
}
return sb.String()
}
-
-func (b *baseModuleContext) Target() Target {
- return b.target
-}
-
-func (b *baseModuleContext) TargetPrimary() bool {
- return b.targetPrimary
-}
-
-func (b *baseModuleContext) MultiTargets() []Target {
- return b.multiTargets
-}
-
-func (b *baseModuleContext) Arch() Arch {
- return b.target.Arch
-}
-
-func (b *baseModuleContext) Os() OsType {
- return b.os
-}
-
-func (b *baseModuleContext) Host() bool {
- return b.os.Class == Host
-}
-
-func (b *baseModuleContext) Device() bool {
- return b.os.Class == Device
-}
-
-func (b *baseModuleContext) Darwin() bool {
- return b.os == Darwin
-}
-
-func (b *baseModuleContext) Windows() bool {
- return b.os == Windows
-}
-
-func (b *baseModuleContext) PrimaryArch() bool {
- if len(b.config.Targets[b.target.Os]) <= 1 {
- return true
- }
- return b.target.Arch.ArchType == b.config.Targets[b.target.Os][0].Arch.ArchType
-}
diff --git a/android/module.go b/android/module.go
index 3256aac..5c7bbbf 100644
--- a/android/module.go
+++ b/android/module.go
@@ -519,6 +519,9 @@
// trace, but influence modules among products.
SoongConfigTrace soongConfigTrace `blueprint:"mutated"`
SoongConfigTraceHash string `blueprint:"mutated"`
+
+ // The team (defined by the owner/vendor) who owns the property.
+ Team *string `android:"path"`
}
type distProperties struct {
@@ -531,6 +534,12 @@
Dists []Dist `android:"arch_variant"`
}
+type TeamDepTagType struct {
+ blueprint.BaseDependencyTag
+}
+
+var teamDepTag = TeamDepTagType{}
+
// CommonTestOptions represents the common `test_options` properties in
// Android.bp.
type CommonTestOptions struct {
@@ -992,6 +1001,12 @@
func (m *ModuleBase) DepsMutator(BottomUpMutatorContext) {}
+func (m *ModuleBase) baseDepsMutator(ctx BottomUpMutatorContext) {
+ if m.Team() != "" {
+ ctx.AddDependency(ctx.Module(), teamDepTag, m.Team())
+ }
+}
+
// AddProperties "registers" the provided props
// each value in props MUST be a pointer to a struct
func (m *ModuleBase) AddProperties(props ...interface{}) {
@@ -1437,6 +1452,10 @@
return String(m.commonProperties.Owner)
}
+func (m *ModuleBase) Team() string {
+ return String(m.commonProperties.Team)
+}
+
func (m *ModuleBase) setImageVariation(variant string) {
m.commonProperties.ImageVariation = variant
}
@@ -1622,14 +1641,31 @@
func (m *ModuleBase) baseModuleContextFactory(ctx blueprint.BaseModuleContext) baseModuleContext {
return baseModuleContext{
bp: ctx,
+ archModuleContext: m.archModuleContextFactory(ctx),
earlyModuleContext: m.earlyModuleContextFactory(ctx),
- os: m.commonProperties.CompileOS,
- target: m.commonProperties.CompileTarget,
- targetPrimary: m.commonProperties.CompilePrimary,
- multiTargets: m.commonProperties.CompileMultiTargets,
}
}
+func (m *ModuleBase) archModuleContextFactory(ctx blueprint.IncomingTransitionContext) archModuleContext {
+ config := ctx.Config().(Config)
+ target := m.Target()
+ primaryArch := false
+ if len(config.Targets[target.Os]) <= 1 {
+ primaryArch = true
+ } else {
+ primaryArch = target.Arch.ArchType == config.Targets[target.Os][0].Arch.ArchType
+ }
+
+ return archModuleContext{
+ os: m.commonProperties.CompileOS,
+ target: m.commonProperties.CompileTarget,
+ targetPrimary: m.commonProperties.CompilePrimary,
+ multiTargets: m.commonProperties.CompileMultiTargets,
+ primaryArch: primaryArch,
+ }
+
+}
+
func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext) {
ctx := &moduleContext{
module: m.module,
@@ -1741,6 +1777,11 @@
return
}
+ aconfigUpdateAndroidBuildActions(ctx)
+ if ctx.Failed() {
+ return
+ }
+
// Create the set of tagged dist files after calling GenerateAndroidBuildActions
// as GenerateTaggedDistFiles() calls OutputFiles(tag) and so relies on the
// output paths being set which must be done before or during
diff --git a/android/mutator.go b/android/mutator.go
index 93c519d..22e9160 100644
--- a/android/mutator.go
+++ b/android/mutator.go
@@ -365,15 +365,21 @@
}
type IncomingTransitionContext interface {
+ ArchModuleContext
+
// Module returns the target of the dependency edge for which the transition
// is being computed
Module() Module
// Config returns the configuration for the build.
Config() Config
+
+ DeviceConfig() DeviceConfig
}
type OutgoingTransitionContext interface {
+ ArchModuleContext
+
// Module returns the target of the dependency edge for which the transition
// is being computed
Module() Module
@@ -381,9 +387,14 @@
// DepTag() Returns the dependency tag through which this dependency is
// reached
DepTag() blueprint.DependencyTag
+
+ // Config returns the configuration for the build.
+ Config() Config
+
+ DeviceConfig() DeviceConfig
}
-// Transition mutators implement a top-down mechanism where a module tells its
+// TransitionMutator implements a top-down mechanism where a module tells its
// direct dependencies what variation they should be built in but the dependency
// has the final say.
//
@@ -448,18 +459,18 @@
// called on.
Split(ctx BaseModuleContext) []string
- // Called on a module to determine which variation it wants from its direct
- // dependencies. The dependency itself can override this decision. This method
- // should not mutate the module itself.
+ // OutgoingTransition is called on a module to determine which variation it wants
+ // from its direct dependencies. The dependency itself can override this decision.
+ // This method should not mutate the module itself.
OutgoingTransition(ctx OutgoingTransitionContext, sourceVariation string) string
- // Called on a module to determine which variation it should be in based on
- // the variation modules that depend on it want. This gives the module a final
- // say about its own variations. This method should not mutate the module
+ // IncomingTransition is called on a module to determine which variation it should
+ // be in based on the variation modules that depend on it want. This gives the module
+ // a final say about its own variations. This method should not mutate the module
// itself.
IncomingTransition(ctx IncomingTransitionContext, incomingVariation string) string
- // Called after a module was split into multiple variations on each variation.
+ // Mutate is called after a module was split into multiple variations on each variation.
// It should not split the module any further but adding new dependencies is
// fine. Unlike all the other methods on TransitionMutator, this method is
// allowed to mutate the module.
@@ -481,6 +492,7 @@
}
type outgoingTransitionContextImpl struct {
+ archModuleContext
bp blueprint.OutgoingTransitionContext
}
@@ -492,15 +504,28 @@
return c.bp.DepTag()
}
-func (a *androidTransitionMutator) OutgoingTransition(ctx blueprint.OutgoingTransitionContext, sourceVariation string) string {
- if _, ok := ctx.Module().(Module); ok {
- return a.mutator.OutgoingTransition(&outgoingTransitionContextImpl{bp: ctx}, sourceVariation)
+func (c *outgoingTransitionContextImpl) Config() Config {
+ return c.bp.Config().(Config)
+}
+
+func (c *outgoingTransitionContextImpl) DeviceConfig() DeviceConfig {
+ return DeviceConfig{c.bp.Config().(Config).deviceConfig}
+}
+
+func (a *androidTransitionMutator) OutgoingTransition(bpctx blueprint.OutgoingTransitionContext, sourceVariation string) string {
+ if m, ok := bpctx.Module().(Module); ok {
+ ctx := &outgoingTransitionContextImpl{
+ archModuleContext: m.base().archModuleContextFactory(bpctx),
+ bp: bpctx,
+ }
+ return a.mutator.OutgoingTransition(ctx, sourceVariation)
} else {
return ""
}
}
type incomingTransitionContextImpl struct {
+ archModuleContext
bp blueprint.IncomingTransitionContext
}
@@ -512,9 +537,17 @@
return c.bp.Config().(Config)
}
-func (a *androidTransitionMutator) IncomingTransition(ctx blueprint.IncomingTransitionContext, incomingVariation string) string {
- if _, ok := ctx.Module().(Module); ok {
- return a.mutator.IncomingTransition(&incomingTransitionContextImpl{bp: ctx}, incomingVariation)
+func (c *incomingTransitionContextImpl) DeviceConfig() DeviceConfig {
+ return DeviceConfig{c.bp.Config().(Config).deviceConfig}
+}
+
+func (a *androidTransitionMutator) IncomingTransition(bpctx blueprint.IncomingTransitionContext, incomingVariation string) string {
+ if m, ok := bpctx.Module().(Module); ok {
+ ctx := &incomingTransitionContextImpl{
+ archModuleContext: m.base().archModuleContextFactory(bpctx),
+ bp: bpctx,
+ }
+ return a.mutator.IncomingTransition(ctx, incomingVariation)
} else {
return ""
}
@@ -600,6 +633,7 @@
func depsMutator(ctx BottomUpMutatorContext) {
if m := ctx.Module(); m.Enabled() {
+ m.base().baseDepsMutator(ctx)
m.DepsMutator(ctx)
}
}
diff --git a/android/package.go b/android/package.go
index 878e4c4..eb76751 100644
--- a/android/package.go
+++ b/android/package.go
@@ -35,6 +35,7 @@
Default_visibility []string
// Specifies the default license terms for all modules defined in this package.
Default_applicable_licenses []string
+ Default_team *string `android:"path"`
}
type packageModule struct {
@@ -47,6 +48,13 @@
// Nothing to do.
}
+func (p *packageModule) DepsMutator(ctx BottomUpMutatorContext) {
+ // Add the dependency to do a validity check
+ if p.properties.Default_team != nil {
+ ctx.AddDependency(ctx.Module(), nil, *p.properties.Default_team)
+ }
+}
+
func (p *packageModule) GenerateBuildActions(ctx blueprint.ModuleContext) {
// Nothing to do.
}
diff --git a/android/paths_test.go b/android/paths_test.go
index bf46c34..93b9b9a 100644
--- a/android/paths_test.go
+++ b/android/paths_test.go
@@ -268,8 +268,10 @@
name: "host binary",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: hostTarget.Os,
- target: hostTarget,
+ archModuleContext: archModuleContext{
+ os: hostTarget.Os,
+ target: hostTarget,
+ },
},
},
in: []string{"bin", "my_test"},
@@ -281,8 +283,10 @@
name: "system binary",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
},
},
in: []string{"bin", "my_test"},
@@ -293,8 +297,10 @@
name: "vendor binary",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
earlyModuleContext: earlyModuleContext{
kind: socSpecificModule,
},
@@ -308,8 +314,10 @@
name: "odm binary",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
earlyModuleContext: earlyModuleContext{
kind: deviceSpecificModule,
},
@@ -323,8 +331,10 @@
name: "product binary",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
earlyModuleContext: earlyModuleContext{
kind: productSpecificModule,
},
@@ -338,8 +348,10 @@
name: "system_ext binary",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
earlyModuleContext: earlyModuleContext{
kind: systemExtSpecificModule,
},
@@ -353,8 +365,10 @@
name: "root binary",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
},
inRoot: true,
},
@@ -366,8 +380,10 @@
name: "recovery binary",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
},
inRecovery: true,
},
@@ -379,8 +395,10 @@
name: "recovery root binary",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
},
inRecovery: true,
inRoot: true,
@@ -394,8 +412,10 @@
name: "ramdisk binary",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
},
inRamdisk: true,
},
@@ -407,8 +427,10 @@
name: "ramdisk root binary",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
},
inRamdisk: true,
inRoot: true,
@@ -421,8 +443,10 @@
name: "vendor_ramdisk binary",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
},
inVendorRamdisk: true,
},
@@ -434,8 +458,10 @@
name: "vendor_ramdisk root binary",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
},
inVendorRamdisk: true,
inRoot: true,
@@ -448,8 +474,10 @@
name: "debug_ramdisk binary",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
},
inDebugRamdisk: true,
},
@@ -461,8 +489,10 @@
name: "system native test binary",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
},
inData: true,
},
@@ -474,8 +504,10 @@
name: "vendor native test binary",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
earlyModuleContext: earlyModuleContext{
kind: socSpecificModule,
},
@@ -490,8 +522,10 @@
name: "odm native test binary",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
earlyModuleContext: earlyModuleContext{
kind: deviceSpecificModule,
},
@@ -506,8 +540,10 @@
name: "product native test binary",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
earlyModuleContext: earlyModuleContext{
kind: productSpecificModule,
},
@@ -523,8 +559,10 @@
name: "system_ext native test binary",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
earlyModuleContext: earlyModuleContext{
kind: systemExtSpecificModule,
},
@@ -540,8 +578,10 @@
name: "sanitized system binary",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
},
inSanitizerDir: true,
},
@@ -553,8 +593,10 @@
name: "sanitized vendor binary",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
earlyModuleContext: earlyModuleContext{
kind: socSpecificModule,
},
@@ -569,8 +611,10 @@
name: "sanitized odm binary",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
earlyModuleContext: earlyModuleContext{
kind: deviceSpecificModule,
},
@@ -585,8 +629,10 @@
name: "sanitized product binary",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
earlyModuleContext: earlyModuleContext{
kind: productSpecificModule,
},
@@ -602,8 +648,10 @@
name: "sanitized system_ext binary",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
earlyModuleContext: earlyModuleContext{
kind: systemExtSpecificModule,
},
@@ -619,8 +667,10 @@
name: "sanitized system native test binary",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
},
inData: true,
inSanitizerDir: true,
@@ -633,8 +683,10 @@
name: "sanitized vendor native test binary",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
earlyModuleContext: earlyModuleContext{
kind: socSpecificModule,
},
@@ -650,8 +702,10 @@
name: "sanitized odm native test binary",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
earlyModuleContext: earlyModuleContext{
kind: deviceSpecificModule,
},
@@ -667,8 +721,10 @@
name: "sanitized product native test binary",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
earlyModuleContext: earlyModuleContext{
kind: productSpecificModule,
},
@@ -684,8 +740,10 @@
name: "sanitized system_ext native test binary",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
earlyModuleContext: earlyModuleContext{
kind: systemExtSpecificModule,
},
@@ -700,8 +758,10 @@
name: "device testcases",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
},
inTestcases: true,
},
@@ -712,8 +772,10 @@
name: "host testcases",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: hostTarget.Os,
- target: hostTarget,
+ archModuleContext: archModuleContext{
+ os: hostTarget.Os,
+ target: hostTarget,
+ },
},
inTestcases: true,
},
@@ -724,8 +786,10 @@
name: "forced host testcases",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
},
inTestcases: true,
forceOS: &Linux,
@@ -771,8 +835,10 @@
name: "ramdisk binary",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
},
inRamdisk: true,
inRoot: true,
@@ -786,8 +852,10 @@
name: "vendor_ramdisk binary",
ctx: &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
},
inVendorRamdisk: true,
inRoot: true,
@@ -821,8 +889,10 @@
ctx := &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
},
}
ctx.baseModuleContext.config = testConfig
@@ -1491,8 +1561,10 @@
ctx := &testModuleInstallPathContext{
baseModuleContext: baseModuleContext{
- os: deviceTarget.Os,
- target: deviceTarget,
+ archModuleContext: archModuleContext{
+ os: deviceTarget.Os,
+ target: deviceTarget,
+ },
},
}
ctx.baseModuleContext.config = testConfig
diff --git a/android/team.go b/android/team.go
new file mode 100644
index 0000000..df61f40
--- /dev/null
+++ b/android/team.go
@@ -0,0 +1,58 @@
+// Copyright 2020 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package android
+
+func init() {
+ RegisterTeamBuildComponents(InitRegistrationContext)
+}
+
+func RegisterTeamBuildComponents(ctx RegistrationContext) {
+ ctx.RegisterModuleType("team", TeamFactory)
+}
+
+var PrepareForTestWithTeamBuildComponents = GroupFixturePreparers(
+ FixtureRegisterWithContext(RegisterTeamBuildComponents),
+)
+
+type teamProperties struct {
+ Trendy_team_id *string `json:"trendy_team_id"`
+}
+
+type teamModule struct {
+ ModuleBase
+ DefaultableModuleBase
+
+ properties teamProperties
+}
+
+// Real work is done for the module that depends on us.
+// If needed, the team can serialize the config to json/proto file as well.
+func (t *teamModule) GenerateAndroidBuildActions(ctx ModuleContext) {}
+
+func (t *teamModule) TrendyTeamId(ctx ModuleContext) string {
+ return *t.properties.Trendy_team_id
+}
+
+func TeamFactory() Module {
+ module := &teamModule{}
+
+ base := module.base()
+ module.AddProperties(&base.nameProperties, &module.properties)
+
+ InitAndroidModule(module)
+ InitDefaultableModule(module)
+
+ return module
+}
diff --git a/android/team_proto/Android.bp b/android/team_proto/Android.bp
new file mode 100644
index 0000000..061e77e
--- /dev/null
+++ b/android/team_proto/Android.bp
@@ -0,0 +1,29 @@
+// Copyright 2022 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+bootstrap_go_package {
+ name: "soong-android_team_proto",
+ pkgPath: "android/soong/android/team_proto",
+ deps: [
+ "golang-protobuf-reflect-protoreflect",
+ "golang-protobuf-runtime-protoimpl",
+ ],
+ srcs: [
+ "team.pb.go",
+ ],
+}
diff --git a/android/team_proto/OWNERS b/android/team_proto/OWNERS
new file mode 100644
index 0000000..2beb4f4
--- /dev/null
+++ b/android/team_proto/OWNERS
@@ -0,0 +1,5 @@
+dariofreni@google.com
+joeo@google.com
+ronish@google.com
+caditya@google.com
+rbraunstein@google.com
diff --git a/android/team_proto/regen.sh b/android/team_proto/regen.sh
new file mode 100755
index 0000000..63b2016
--- /dev/null
+++ b/android/team_proto/regen.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+aprotoc --go_out=paths=source_relative:. team.proto
diff --git a/android/team_proto/team.pb.go b/android/team_proto/team.pb.go
new file mode 100644
index 0000000..61260cf
--- /dev/null
+++ b/android/team_proto/team.pb.go
@@ -0,0 +1,253 @@
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.30.0
+// protoc v3.21.12
+// source: team.proto
+
+package team_proto
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type Team struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // REQUIRED: Name of the build target
+ TargetName *string `protobuf:"bytes,1,opt,name=target_name,json=targetName" json:"target_name,omitempty"`
+ // REQUIRED: Code location of the target.
+ // To be used to support legacy/backup systems that use OWNERS file and is
+ // also required for our dashboard to support per code location basis UI
+ Path *string `protobuf:"bytes,2,opt,name=path" json:"path,omitempty"`
+ // REQUIRED: Team ID of the team that owns this target.
+ TrendyTeamId *string `protobuf:"bytes,3,opt,name=trendy_team_id,json=trendyTeamId" json:"trendy_team_id,omitempty"`
+ // OPTIONAL: Files directly owned by this module.
+ File []string `protobuf:"bytes,4,rep,name=file" json:"file,omitempty"`
+}
+
+func (x *Team) Reset() {
+ *x = Team{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_team_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Team) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Team) ProtoMessage() {}
+
+func (x *Team) ProtoReflect() protoreflect.Message {
+ mi := &file_team_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Team.ProtoReflect.Descriptor instead.
+func (*Team) Descriptor() ([]byte, []int) {
+ return file_team_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *Team) GetTargetName() string {
+ if x != nil && x.TargetName != nil {
+ return *x.TargetName
+ }
+ return ""
+}
+
+func (x *Team) GetPath() string {
+ if x != nil && x.Path != nil {
+ return *x.Path
+ }
+ return ""
+}
+
+func (x *Team) GetTrendyTeamId() string {
+ if x != nil && x.TrendyTeamId != nil {
+ return *x.TrendyTeamId
+ }
+ return ""
+}
+
+func (x *Team) GetFile() []string {
+ if x != nil {
+ return x.File
+ }
+ return nil
+}
+
+type AllTeams struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Teams []*Team `protobuf:"bytes,1,rep,name=teams" json:"teams,omitempty"`
+}
+
+func (x *AllTeams) Reset() {
+ *x = AllTeams{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_team_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *AllTeams) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*AllTeams) ProtoMessage() {}
+
+func (x *AllTeams) ProtoReflect() protoreflect.Message {
+ mi := &file_team_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use AllTeams.ProtoReflect.Descriptor instead.
+func (*AllTeams) Descriptor() ([]byte, []int) {
+ return file_team_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *AllTeams) GetTeams() []*Team {
+ if x != nil {
+ return x.Teams
+ }
+ return nil
+}
+
+var File_team_proto protoreflect.FileDescriptor
+
+var file_team_proto_rawDesc = []byte{
+ 0x0a, 0x0a, 0x74, 0x65, 0x61, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x74, 0x65,
+ 0x61, 0x6d, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x75, 0x0a, 0x04, 0x54, 0x65, 0x61, 0x6d,
+ 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x4e, 0x61, 0x6d,
+ 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x24, 0x0a, 0x0e, 0x74, 0x72, 0x65, 0x6e, 0x64, 0x79, 0x5f,
+ 0x74, 0x65, 0x61, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x74,
+ 0x72, 0x65, 0x6e, 0x64, 0x79, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x66,
+ 0x69, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x22,
+ 0x32, 0x0a, 0x08, 0x41, 0x6c, 0x6c, 0x54, 0x65, 0x61, 0x6d, 0x73, 0x12, 0x26, 0x0a, 0x05, 0x74,
+ 0x65, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x74, 0x65, 0x61,
+ 0x6d, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x65, 0x61, 0x6d, 0x52, 0x05, 0x74, 0x65,
+ 0x61, 0x6d, 0x73, 0x42, 0x22, 0x5a, 0x20, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2f, 0x73,
+ 0x6f, 0x6f, 0x6e, 0x67, 0x2f, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2f, 0x74, 0x65, 0x61,
+ 0x6d, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
+}
+
+var (
+ file_team_proto_rawDescOnce sync.Once
+ file_team_proto_rawDescData = file_team_proto_rawDesc
+)
+
+func file_team_proto_rawDescGZIP() []byte {
+ file_team_proto_rawDescOnce.Do(func() {
+ file_team_proto_rawDescData = protoimpl.X.CompressGZIP(file_team_proto_rawDescData)
+ })
+ return file_team_proto_rawDescData
+}
+
+var file_team_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
+var file_team_proto_goTypes = []interface{}{
+ (*Team)(nil), // 0: team_proto.Team
+ (*AllTeams)(nil), // 1: team_proto.AllTeams
+}
+var file_team_proto_depIdxs = []int32{
+ 0, // 0: team_proto.AllTeams.teams:type_name -> team_proto.Team
+ 1, // [1:1] is the sub-list for method output_type
+ 1, // [1:1] is the sub-list for method input_type
+ 1, // [1:1] is the sub-list for extension type_name
+ 1, // [1:1] is the sub-list for extension extendee
+ 0, // [0:1] is the sub-list for field type_name
+}
+
+func init() { file_team_proto_init() }
+func file_team_proto_init() {
+ if File_team_proto != nil {
+ return
+ }
+ if !protoimpl.UnsafeEnabled {
+ file_team_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Team); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_team_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*AllTeams); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_team_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 2,
+ NumExtensions: 0,
+ NumServices: 0,
+ },
+ GoTypes: file_team_proto_goTypes,
+ DependencyIndexes: file_team_proto_depIdxs,
+ MessageInfos: file_team_proto_msgTypes,
+ }.Build()
+ File_team_proto = out.File
+ file_team_proto_rawDesc = nil
+ file_team_proto_goTypes = nil
+ file_team_proto_depIdxs = nil
+}
diff --git a/android/team_proto/team.proto b/android/team_proto/team.proto
new file mode 100644
index 0000000..401eccc
--- /dev/null
+++ b/android/team_proto/team.proto
@@ -0,0 +1,34 @@
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+syntax = "proto2";
+package team_proto;
+option go_package = "android/soong/android/team_proto";
+
+message Team {
+ // REQUIRED: Name of the build target
+ optional string target_name = 1;
+
+ // REQUIRED: Code location of the target.
+ // To be used to support legacy/backup systems that use OWNERS file and is
+ // also required for our dashboard to support per code location basis UI
+ optional string path = 2;
+
+ // REQUIRED: Team ID of the team that owns this target.
+ optional string trendy_team_id = 3;
+
+ // OPTIONAL: Files directly owned by this module.
+ repeated string file = 4;
+}
+
+message AllTeams {
+ repeated Team teams = 1;
+}
diff --git a/android/team_test.go b/android/team_test.go
new file mode 100644
index 0000000..75b3e9f
--- /dev/null
+++ b/android/team_test.go
@@ -0,0 +1,99 @@
+// Copyright 2024 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package android
+
+import (
+ "testing"
+)
+
+type fakeModuleForTests struct {
+ ModuleBase
+}
+
+func fakeModuleFactory() Module {
+ module := &fakeModuleForTests{}
+ InitAndroidModule(module)
+ return module
+}
+
+func (*fakeModuleForTests) GenerateAndroidBuildActions(ModuleContext) {}
+
+func TestTeam(t *testing.T) {
+ t.Parallel()
+ ctx := GroupFixturePreparers(
+ PrepareForTestWithTeamBuildComponents,
+ FixtureRegisterWithContext(func(ctx RegistrationContext) {
+ ctx.RegisterModuleType("fake", fakeModuleFactory)
+ }),
+ ).RunTestWithBp(t, `
+ fake {
+ name: "main_test",
+ team: "someteam",
+ }
+ team {
+ name: "someteam",
+ trendy_team_id: "cool_team",
+ }
+
+ team {
+ name: "team2",
+ trendy_team_id: "22222",
+ }
+
+ fake {
+ name: "tool",
+ team: "team2",
+ }
+ `)
+
+ // Assert the rule from GenerateAndroidBuildActions exists.
+ m := ctx.ModuleForTests("main_test", "")
+ AssertStringEquals(t, "msg", m.Module().base().Team(), "someteam")
+ m = ctx.ModuleForTests("tool", "")
+ AssertStringEquals(t, "msg", m.Module().base().Team(), "team2")
+}
+
+func TestMissingTeamFails(t *testing.T) {
+ t.Parallel()
+ GroupFixturePreparers(
+ PrepareForTestWithTeamBuildComponents,
+ FixtureRegisterWithContext(func(ctx RegistrationContext) {
+ ctx.RegisterModuleType("fake", fakeModuleFactory)
+ }),
+ ).
+ ExtendWithErrorHandler(FixtureExpectsAtLeastOneErrorMatchingPattern("depends on undefined module \"ring-bearer")).
+ RunTestWithBp(t, `
+ fake {
+ name: "you_cannot_pass",
+ team: "ring-bearer",
+ }
+ `)
+}
+
+func TestPackageBadTeamNameFails(t *testing.T) {
+ t.Parallel()
+ GroupFixturePreparers(
+ PrepareForTestWithTeamBuildComponents,
+ PrepareForTestWithPackageModule,
+ FixtureRegisterWithContext(func(ctx RegistrationContext) {
+ ctx.RegisterModuleType("fake", fakeModuleFactory)
+ }),
+ ).
+ ExtendWithErrorHandler(FixtureExpectsAtLeastOneErrorMatchingPattern("depends on undefined module \"ring-bearer")).
+ RunTestWithBp(t, `
+ package {
+ default_team: "ring-bearer",
+ }
+ `)
+}
diff --git a/android/testing.go b/android/testing.go
index f88049c..7b4411e 100644
--- a/android/testing.go
+++ b/android/testing.go
@@ -1121,6 +1121,7 @@
}
entriesList := p.AndroidMkEntries()
+ aconfigUpdateAndroidMkEntries(ctx, mod.(Module), &entriesList)
for i, _ := range entriesList {
entriesList[i].fillInEntries(ctx, mod)
}
@@ -1136,6 +1137,7 @@
}
data := p.AndroidMk()
data.fillInData(ctx, mod)
+ aconfigUpdateAndroidMkData(ctx, mod.(Module), &data)
return data
}
diff --git a/apex/androidmk.go b/apex/androidmk.go
index bc68ad3..619be8d 100644
--- a/apex/androidmk.go
+++ b/apex/androidmk.go
@@ -124,6 +124,10 @@
pathForSymbol := filepath.Join("$(PRODUCT_OUT)", "apex", apexBundleName, fi.installDir)
modulePath := pathForSymbol
fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", modulePath)
+ // AconfigUpdateAndroidMkData may have added elements to Extra. Process them here.
+ for _, extra := range apexAndroidMkData.Extra {
+ extra(w, fi.builtFile)
+ }
// For non-flattend APEXes, the merged notice file is attached to the APEX itself.
// We don't need to have notice file for the individual modules in it. Otherwise,
@@ -229,6 +233,7 @@
func (a *apexBundle) androidMkForType() android.AndroidMkData {
return android.AndroidMkData{
+ // While we do not provide a value for `Extra`, AconfigUpdateAndroidMkData may add some, which we must honor.
Custom: func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) {
moduleNames := []string{}
if a.installable() {
@@ -269,6 +274,10 @@
android.AndroidMkEmitAssignList(w, "LOCAL_OVERRIDES_MODULES", a.overridableProperties.Overrides)
a.writeRequiredModules(w, moduleNames)
+ // AconfigUpdateAndroidMkData may have added elements to Extra. Process them here.
+ for _, extra := range data.Extra {
+ extra(w, a.outputFile)
+ }
fmt.Fprintln(w, "include $(BUILD_PREBUILT)")
fmt.Fprintln(w, "ALL_MODULES.$(my_register_name).BUNDLE :=", a.bundleModuleFile.String())
diff --git a/bpf/bpf.go b/bpf/bpf.go
index 32d62b5..e1b512f 100644
--- a/bpf/bpf.go
+++ b/bpf/bpf.go
@@ -231,6 +231,10 @@
fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", obj.Base())
fmt.Fprintln(w, "LOCAL_MODULE_CLASS := ETC")
fmt.Fprintln(w, localModulePath)
+ // AconfigUpdateAndroidMkData may have added elements to Extra. Process them here.
+ for _, extra := range data.Extra {
+ extra(w, nil)
+ }
fmt.Fprintln(w, "include $(BUILD_PREBUILT)")
fmt.Fprintln(w)
}
diff --git a/cc/config/global.go b/cc/config/global.go
index ec6dbce..5fed7f1 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -272,7 +272,8 @@
"-Wno-range-loop-construct", // http://b/153747076
"-Wno-zero-as-null-pointer-constant", // http://b/68236239
"-Wno-deprecated-anon-enum-enum-conversion", // http://b/153746485
- "-Wno-pessimizing-move", // http://b/154270751
+ "-Wno-deprecated-enum-enum-conversion",
+ "-Wno-pessimizing-move", // http://b/154270751
// New warnings to be fixed after clang-r399163
"-Wno-non-c-typedef-for-linkage", // http://b/161304145
// New warnings to be fixed after clang-r428724
@@ -286,6 +287,13 @@
// New warnings to be fixed after clang-r475365
"-Wno-error=single-bit-bitfield-constant-conversion", // http://b/243965903
"-Wno-error=enum-constexpr-conversion", // http://b/243964282
+
+ // Irrelevant on Android because _we_ don't use exceptions, but causes
+ // lots of build noise because libcxx/libcxxabi do. This can probably
+ // go away when we're on a new enough libc++, but has to be global
+ // until then because it causes warnings in the _callers_, not the
+ // project itself.
+ "-Wno-deprecated-dynamic-exception-spec",
}
noOverride64GlobalCflags = []string{}
@@ -320,6 +328,9 @@
// http://b/239661264
"-Wno-deprecated-non-prototype",
+
+ "-Wno-unused",
+ "-Wno-deprecated",
}
// Similar to noOverrideGlobalCflags, but applies only to third-party code
diff --git a/cc/config/riscv64_device.go b/cc/config/riscv64_device.go
index f76e8c9..deb922b 100644
--- a/cc/config/riscv64_device.go
+++ b/cc/config/riscv64_device.go
@@ -30,7 +30,7 @@
"-Xclang -target-feature -Xclang +unaligned-scalar-mem",
"-Xclang -target-feature -Xclang +unaligned-vector-mem",
// Until https://gitlab.com/qemu-project/qemu/-/issues/1976 is fixed...
- "-fno-vectorize",
+ "-mno-implicit-float",
// (https://github.com/google/android-riscv64/issues/124)
"-mllvm -jump-is-expensive=false",
}
@@ -43,8 +43,6 @@
// Equivalent to "-munaligned-access", but our clang doesn't have that yet.
"-Xclang -target-feature -Xclang +unaligned-scalar-mem",
"-Xclang -target-feature -Xclang +unaligned-vector-mem",
- // Until https://gitlab.com/qemu-project/qemu/-/issues/1976 is fixed...
- "-Wl,-mllvm,-vectorize-loops=false",
// We should change the default for this in clang, but for now...
// (https://github.com/google/android-riscv64/issues/124)
"-Wl,-mllvm -Wl,-jump-is-expensive=false",
diff --git a/cc/config/x86_64_device.go b/cc/config/x86_64_device.go
index ff0a3b7..b97d511 100644
--- a/cc/config/x86_64_device.go
+++ b/cc/config/x86_64_device.go
@@ -49,8 +49,9 @@
"goldmont-plus": []string{
"-march=goldmont-plus",
},
- "goldmont-without-xsaves": []string{
+ "goldmont-without-sha-xsaves": []string{
"-march=goldmont",
+ "-mno-sha",
"-mno-xsaves",
},
"haswell": []string{
diff --git a/cc/config/x86_device.go b/cc/config/x86_device.go
index 08be869..2faa670 100644
--- a/cc/config/x86_device.go
+++ b/cc/config/x86_device.go
@@ -56,8 +56,9 @@
"goldmont-plus": []string{
"-march=goldmont-plus",
},
- "goldmont-without-xsaves": []string{
+ "goldmont-without-sha-xsaves": []string{
"-march=goldmont",
+ "-mno-sha",
"-mno-xsaves",
},
"haswell": []string{
diff --git a/cc/coverage.go b/cc/coverage.go
index cbd8a6f..393a8a6 100644
--- a/cc/coverage.go
+++ b/cc/coverage.go
@@ -22,6 +22,29 @@
"android/soong/android"
)
+var (
+ clangCoverageHostLdFlags = []string{
+ "-Wl,--no-as-needed",
+ "-Wl,--wrap,open",
+ }
+ clangContinuousCoverageFlags = []string{
+ "-mllvm",
+ "-runtime-counter-relocation",
+ }
+ clangCoverageCFlags = []string{
+ "-Wno-frame-larger-than=",
+ }
+ clangCoverageCommonFlags = []string{
+ "-fcoverage-mapping",
+ "-Wno-pass-failed",
+ "-D__ANDROID_CLANG_COVERAGE__",
+ }
+ clangCoverageHWASanFlags = []string{
+ "-mllvm",
+ "-hwasan-globals=0",
+ }
+)
+
const profileInstrFlag = "-fprofile-instr-generate=/data/misc/trace/clang-%p-%m.profraw"
type CoverageProperties struct {
@@ -102,19 +125,19 @@
// flags that the module may use.
flags.Local.CFlags = append(flags.Local.CFlags, "-Wno-frame-larger-than=", "-O0")
} else if clangCoverage {
- flags.Local.CommonFlags = append(flags.Local.CommonFlags, profileInstrFlag,
- "-fcoverage-mapping", "-Wno-pass-failed", "-D__ANDROID_CLANG_COVERAGE__")
+ flags.Local.CommonFlags = append(flags.Local.CommonFlags, profileInstrFlag)
+ flags.Local.CommonFlags = append(flags.Local.CommonFlags, clangCoverageCommonFlags...)
// Override -Wframe-larger-than. We can expect frame size increase after
// coverage instrumentation.
- flags.Local.CFlags = append(flags.Local.CFlags, "-Wno-frame-larger-than=")
+ flags.Local.CFlags = append(flags.Local.CFlags, clangCoverageCFlags...)
if EnableContinuousCoverage(ctx) {
- flags.Local.CommonFlags = append(flags.Local.CommonFlags, "-mllvm", "-runtime-counter-relocation")
+ flags.Local.CommonFlags = append(flags.Local.CommonFlags, clangContinuousCoverageFlags...)
}
// http://b/248022906, http://b/247941801 enabling coverage and hwasan-globals
// instrumentation together causes duplicate-symbol errors for __llvm_profile_filename.
if c, ok := ctx.Module().(*Module); ok && c.sanitize.isSanitizerEnabled(Hwasan) {
- flags.Local.CommonFlags = append(flags.Local.CommonFlags, "-mllvm", "-hwasan-globals=0")
+ flags.Local.CommonFlags = append(flags.Local.CommonFlags, clangCoverageHWASanFlags...)
}
}
}
diff --git a/cc/makevars.go b/cc/makevars.go
index 6c3f551..70fdd57 100644
--- a/cc/makevars.go
+++ b/cc/makevars.go
@@ -123,6 +123,13 @@
ctx.Strict("SOONG_MODULES_USING_WNO_ERROR", makeStringOfKeys(ctx, modulesUsingWnoErrorKey))
ctx.Strict("SOONG_MODULES_MISSING_PGO_PROFILE_FILE", makeStringOfKeys(ctx, modulesMissingProfileFileKey))
+ ctx.Strict("CLANG_COVERAGE_CONFIG_CFLAGS", strings.Join(clangCoverageCFlags, " "))
+ ctx.Strict("CLANG_COVERAGE_CONFIG_COMMFLAGS", strings.Join(clangCoverageCommonFlags, " "))
+ ctx.Strict("CLANG_COVERAGE_HOST_LDFLAGS", strings.Join(clangCoverageHostLdFlags, " "))
+ ctx.Strict("CLANG_COVERAGE_INSTR_PROFILE", profileInstrFlag)
+ ctx.Strict("CLANG_COVERAGE_CONTINUOUS_FLAGS", strings.Join(clangContinuousCoverageFlags, " "))
+ ctx.Strict("CLANG_COVERAGE_HWASAN_FLAGS", strings.Join(clangCoverageHWASanFlags, " "))
+
ctx.Strict("ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS", strings.Join(asanCflags, " "))
ctx.Strict("ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS", strings.Join(asanLdflags, " "))
diff --git a/java/androidmk.go b/java/androidmk.go
index cc0efe9..c86dcf4 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -587,7 +587,7 @@
outputFile = android.OptionalPathForPath(dstubs.apiFile)
}
if !outputFile.Valid() {
- outputFile = android.OptionalPathForPath(dstubs.apiVersionsXml)
+ outputFile = android.OptionalPathForPath(dstubs.everythingArtifacts.apiVersionsXml)
}
return []android.AndroidMkEntries{android.AndroidMkEntries{
Class: "JAVA_LIBRARIES",
@@ -598,14 +598,14 @@
if dstubs.Javadoc.stubsSrcJar != nil {
entries.SetPath("LOCAL_DROIDDOC_STUBS_SRCJAR", dstubs.Javadoc.stubsSrcJar)
}
- if dstubs.apiVersionsXml != nil {
- entries.SetPath("LOCAL_DROIDDOC_API_VERSIONS_XML", dstubs.apiVersionsXml)
+ if dstubs.everythingArtifacts.apiVersionsXml != nil {
+ entries.SetPath("LOCAL_DROIDDOC_API_VERSIONS_XML", dstubs.everythingArtifacts.apiVersionsXml)
}
- if dstubs.annotationsZip != nil {
- entries.SetPath("LOCAL_DROIDDOC_ANNOTATIONS_ZIP", dstubs.annotationsZip)
+ if dstubs.everythingArtifacts.annotationsZip != nil {
+ entries.SetPath("LOCAL_DROIDDOC_ANNOTATIONS_ZIP", dstubs.everythingArtifacts.annotationsZip)
}
- if dstubs.metadataZip != nil {
- entries.SetPath("LOCAL_DROIDDOC_METADATA_ZIP", dstubs.metadataZip)
+ if dstubs.everythingArtifacts.metadataZip != nil {
+ entries.SetPath("LOCAL_DROIDDOC_METADATA_ZIP", dstubs.everythingArtifacts.metadataZip)
}
},
},
diff --git a/java/droiddoc.go b/java/droiddoc.go
index 7a61034..cfbf2b4 100644
--- a/java/droiddoc.go
+++ b/java/droiddoc.go
@@ -182,6 +182,17 @@
func apiCheckEnabled(ctx android.ModuleContext, apiToCheck ApiToCheck, apiVersionTag string) bool {
if ctx.Config().IsEnvTrue("WITHOUT_CHECK_API") {
+ if ctx.Config().BuildFromTextStub() {
+ ctx.ModuleErrorf("Generating stubs from api signature files is not available " +
+ "with WITHOUT_CHECK_API=true, as sync between the source Java files and the " +
+ "api signature files is not guaranteed.\n" +
+ "In order to utilize WITHOUT_CHECK_API, generate stubs from the source Java " +
+ "files with BUILD_FROM_SOURCE_STUB=true.\n" +
+ "However, the usage of WITHOUT_CHECK_API is not preferred as the incremental " +
+ "build is slower when generating stubs from the source Java files.\n" +
+ "Consider updating the api signature files and generating the stubs from " +
+ "them instead.")
+ }
return false
} else if String(apiToCheck.Api_file) != "" && String(apiToCheck.Removed_api_file) != "" {
return true
diff --git a/java/droidstubs.go b/java/droidstubs.go
index 0626313..6ef2afe 100644
--- a/java/droidstubs.go
+++ b/java/droidstubs.go
@@ -65,15 +65,22 @@
ctx.RegisterModuleType("prebuilt_stubs_sources", PrebuiltStubsSourcesFactory)
}
+type stubsArtifacts struct {
+ nullabilityWarningsFile android.WritablePath
+ annotationsZip android.WritablePath
+ apiVersionsXml android.WritablePath
+ metadataZip android.WritablePath
+ metadataDir android.WritablePath
+}
+
// Droidstubs
type Droidstubs struct {
Javadoc
embeddableInModuleAndImport
- properties DroidstubsProperties
- apiFile android.Path
- removedApiFile android.Path
- nullabilityWarningsFile android.WritablePath
+ properties DroidstubsProperties
+ apiFile android.Path
+ removedApiFile android.Path
checkCurrentApiTimestamp android.WritablePath
updateCurrentApiTimestamp android.WritablePath
@@ -83,22 +90,14 @@
checkNullabilityWarningsTimestamp android.WritablePath
- annotationsZip android.WritablePath
- apiVersionsXml android.WritablePath
-
- metadataZip android.WritablePath
- metadataDir android.WritablePath
+ everythingArtifacts stubsArtifacts
+ exportableArtifacts stubsArtifacts
// Single aconfig "cache file" merged from this module and all dependencies.
mergedAconfigFiles map[string]android.Paths
- exportableApiFile android.WritablePath
- exportableRemovedApiFile android.WritablePath
- exportableNullabilityWarningsFile android.WritablePath
- exportableAnnotationsZip android.WritablePath
- exportableApiVersionsXml android.WritablePath
- exportableMetadataZip android.WritablePath
- exportableMetadataDir android.WritablePath
+ exportableApiFile android.WritablePath
+ exportableRemovedApiFile android.WritablePath
}
type DroidstubsProperties struct {
@@ -192,34 +191,22 @@
// Used by xsd_config
type ApiFilePath interface {
- ApiFilePath() android.Path
+ ApiFilePath(StubsType) (android.Path, error)
}
type ApiStubsSrcProvider interface {
- StubsSrcJar() android.Path
-}
-
-type ExportableApiStubsSrcProvider interface {
- ExportableStubsSrcJar() android.Path
+ StubsSrcJar(StubsType) (android.Path, error)
}
// Provider of information about API stubs, used by java_sdk_library.
type ApiStubsProvider interface {
- AnnotationsZip() android.Path
+ AnnotationsZip(StubsType) (android.Path, error)
ApiFilePath
- RemovedApiFilePath() android.Path
+ RemovedApiFilePath(StubsType) (android.Path, error)
ApiStubsSrcProvider
}
-type ExportableApiStubsProvider interface {
- ExportableAnnotationsZip() android.Path
- ExportableApiFilePath() android.Path
- ExportableRemovedApiFilePath() android.Path
-
- ExportableApiStubsSrcProvider
-}
-
type currentApiTimestampProvider interface {
CurrentApiTimestamp() android.Path
}
@@ -323,112 +310,86 @@
}
switch prefixRemovedTag {
case "":
- return d.StubsSrcJarWithStubsType(stubsType)
+ stubsSrcJar, err := d.StubsSrcJar(stubsType)
+ return android.Paths{stubsSrcJar}, err
case ".docs.zip":
- return d.DocZipWithStubsType(stubsType)
+ docZip, err := d.DocZip(stubsType)
+ return android.Paths{docZip}, err
case ".api.txt", android.DefaultDistTag:
// This is the default dist path for dist properties that have no tag property.
- return d.ApiFilePathWithStubsType(stubsType)
+ apiFilePath, err := d.ApiFilePath(stubsType)
+ return android.Paths{apiFilePath}, err
case ".removed-api.txt":
- return d.RemovedApiFilePathWithStubsType(stubsType)
+ removedApiFilePath, err := d.RemovedApiFilePath(stubsType)
+ return android.Paths{removedApiFilePath}, err
case ".annotations.zip":
- return d.AnnotationsZipWithStubsType(stubsType)
+ annotationsZip, err := d.AnnotationsZip(stubsType)
+ return android.Paths{annotationsZip}, err
case ".api_versions.xml":
- return d.ApiVersionsXmlFilePathWithStubsType(stubsType)
+ apiVersionsXmlFilePath, err := d.ApiVersionsXmlFilePath(stubsType)
+ return android.Paths{apiVersionsXmlFilePath}, err
default:
return nil, fmt.Errorf("unsupported module reference tag %q", tag)
}
}
-func (d *Droidstubs) AnnotationsZip() android.Path {
- return d.annotationsZip
-}
-
-func (d *Droidstubs) ExportableAnnotationsZip() android.Path {
- return d.exportableAnnotationsZip
-}
-
-func (d *Droidstubs) AnnotationsZipWithStubsType(stubsType StubsType) (android.Paths, error) {
+func (d *Droidstubs) AnnotationsZip(stubsType StubsType) (android.Path, error) {
switch stubsType {
case Everything:
- return android.Paths{d.AnnotationsZip()}, nil
+ return d.everythingArtifacts.annotationsZip, nil
case Exportable:
- return android.Paths{d.ExportableAnnotationsZip()}, nil
+ return d.exportableArtifacts.annotationsZip, nil
default:
return nil, fmt.Errorf("annotations zip not supported for the stub type %s", stubsType.String())
}
}
-func (d *Droidstubs) ApiFilePath() android.Path {
- return d.apiFile
-}
-
-func (d *Droidstubs) ExportableApiFilePath() android.Path {
- return d.exportableApiFile
-}
-
-func (d *Droidstubs) ApiFilePathWithStubsType(stubsType StubsType) (android.Paths, error) {
+func (d *Droidstubs) ApiFilePath(stubsType StubsType) (android.Path, error) {
switch stubsType {
case Everything:
- return android.Paths{d.ApiFilePath()}, nil
+ return d.apiFile, nil
case Exportable:
- return android.Paths{d.ExportableApiFilePath()}, nil
+ return d.exportableApiFile, nil
default:
return nil, fmt.Errorf("api file path not supported for the stub type %s", stubsType.String())
}
}
-func (d *Droidstubs) ApiVersionsXmlFilePathWithStubsType(stubsType StubsType) (android.Paths, error) {
+func (d *Droidstubs) ApiVersionsXmlFilePath(stubsType StubsType) (android.Path, error) {
switch stubsType {
case Everything:
- return android.Paths{d.apiVersionsXml}, nil
+ return d.everythingArtifacts.apiVersionsXml, nil
default:
return nil, fmt.Errorf("api versions xml file path not supported for the stub type %s", stubsType.String())
}
}
-func (d *Droidstubs) DocZipWithStubsType(stubsType StubsType) (android.Paths, error) {
+func (d *Droidstubs) DocZip(stubsType StubsType) (android.Path, error) {
switch stubsType {
case Everything:
- return android.Paths{d.docZip}, nil
+ return d.docZip, nil
default:
return nil, fmt.Errorf("docs zip not supported for the stub type %s", stubsType.String())
}
}
-func (d *Droidstubs) RemovedApiFilePath() android.Path {
- return d.removedApiFile
-}
-
-func (d *Droidstubs) ExportableRemovedApiFilePath() android.Path {
- return d.exportableRemovedApiFile
-}
-
-func (d *Droidstubs) RemovedApiFilePathWithStubsType(stubsType StubsType) (android.Paths, error) {
+func (d *Droidstubs) RemovedApiFilePath(stubsType StubsType) (android.Path, error) {
switch stubsType {
case Everything:
- return android.Paths{d.RemovedApiFilePath()}, nil
+ return d.removedApiFile, nil
case Exportable:
- return android.Paths{d.ExportableRemovedApiFilePath()}, nil
+ return d.exportableRemovedApiFile, nil
default:
return nil, fmt.Errorf("removed api file path not supported for the stub type %s", stubsType.String())
}
}
-func (d *Droidstubs) StubsSrcJar() android.Path {
- return d.stubsSrcJar
-}
-
-func (d *Droidstubs) ExportableStubsSrcJar() android.Path {
- return d.exportableStubsSrcJar
-}
-
-func (d *Droidstubs) StubsSrcJarWithStubsType(stubsType StubsType) (android.Paths, error) {
+func (d *Droidstubs) StubsSrcJar(stubsType StubsType) (android.Path, error) {
switch stubsType {
case Everything:
- return android.Paths{d.StubsSrcJar()}, nil
+ return d.stubsSrcJar, nil
case Exportable:
- return android.Paths{d.ExportableStubsSrcJar()}, nil
+ return d.exportableStubsSrcJar, nil
default:
return nil, fmt.Errorf("stubs srcjar not supported for the stub type %s", stubsType.String())
}
@@ -576,11 +537,11 @@
var apiVersions android.Path
if proptools.Bool(d.properties.Api_levels_annotations_enabled) {
d.apiLevelsGenerationFlags(ctx, cmd, stubsType, apiVersionsXml)
- apiVersions = d.apiVersionsXml
+ apiVersions = d.everythingArtifacts.apiVersionsXml
} else {
ctx.VisitDirectDepsWithTag(metalavaAPILevelsModuleTag, func(m android.Module) {
if s, ok := m.(*Droidstubs); ok {
- apiVersions = s.apiVersionsXml
+ apiVersions = s.everythingArtifacts.apiVersionsXml
} else {
ctx.PropertyErrorf("api_levels_module",
"module %q is not a droidstubs module", ctx.OtherModuleName(m))
@@ -839,28 +800,28 @@
}
if params.writeSdkValues {
- d.metadataDir = android.PathForModuleOut(ctx, Everything.String(), "metadata")
- d.metadataZip = android.PathForModuleOut(ctx, Everything.String(), ctx.ModuleName()+"-metadata.zip")
+ d.everythingArtifacts.metadataDir = android.PathForModuleOut(ctx, Everything.String(), "metadata")
+ d.everythingArtifacts.metadataZip = android.PathForModuleOut(ctx, Everything.String(), ctx.ModuleName()+"-metadata.zip")
}
if Bool(d.properties.Annotations_enabled) {
if params.validatingNullability {
- d.nullabilityWarningsFile = android.PathForModuleOut(ctx, Everything.String(), ctx.ModuleName()+"_nullability_warnings.txt")
+ d.everythingArtifacts.nullabilityWarningsFile = android.PathForModuleOut(ctx, Everything.String(), ctx.ModuleName()+"_nullability_warnings.txt")
}
- d.annotationsZip = android.PathForModuleOut(ctx, Everything.String(), ctx.ModuleName()+"_annotations.zip")
+ d.everythingArtifacts.annotationsZip = android.PathForModuleOut(ctx, Everything.String(), ctx.ModuleName()+"_annotations.zip")
}
if Bool(d.properties.Api_levels_annotations_enabled) {
- d.apiVersionsXml = android.PathForModuleOut(ctx, Everything.String(), "api-versions.xml")
+ d.everythingArtifacts.apiVersionsXml = android.PathForModuleOut(ctx, Everything.String(), "api-versions.xml")
}
commonCmdParams := stubsCommandParams{
srcJarDir: srcJarDir,
stubsDir: stubsDir,
stubsSrcJar: d.Javadoc.stubsSrcJar,
- metadataDir: d.metadataDir,
- apiVersionsXml: d.apiVersionsXml,
- nullabilityWarningsFile: d.nullabilityWarningsFile,
- annotationsZip: d.annotationsZip,
+ metadataDir: d.everythingArtifacts.metadataDir,
+ apiVersionsXml: d.everythingArtifacts.apiVersionsXml,
+ nullabilityWarningsFile: d.everythingArtifacts.nullabilityWarningsFile,
+ annotationsZip: d.everythingArtifacts.annotationsZip,
stubConfig: params,
}
@@ -883,9 +844,9 @@
BuiltTool("soong_zip").
Flag("-write_if_changed").
Flag("-d").
- FlagWithOutput("-o ", d.metadataZip).
- FlagWithArg("-C ", d.metadataDir.String()).
- FlagWithArg("-D ", d.metadataDir.String())
+ FlagWithOutput("-o ", d.everythingArtifacts.metadataZip).
+ FlagWithArg("-C ", d.everythingArtifacts.metadataDir.String()).
+ FlagWithArg("-D ", d.everythingArtifacts.metadataDir.String())
}
// TODO: We don't really need two separate API files, but this is a reminiscence of how
@@ -1018,23 +979,23 @@
d.Javadoc.exportableStubsSrcJar = android.PathForModuleOut(ctx, params.stubsType.String(), ctx.ModuleName()+"-"+"stubs.srcjar")
optionalCmdParams.stubsSrcJar = d.Javadoc.exportableStubsSrcJar
if params.writeSdkValues {
- d.exportableMetadataZip = android.PathForModuleOut(ctx, params.stubsType.String(), ctx.ModuleName()+"-metadata.zip")
- d.exportableMetadataDir = android.PathForModuleOut(ctx, params.stubsType.String(), "metadata")
- optionalCmdParams.metadataZip = d.exportableMetadataZip
- optionalCmdParams.metadataDir = d.exportableMetadataDir
+ d.exportableArtifacts.metadataZip = android.PathForModuleOut(ctx, params.stubsType.String(), ctx.ModuleName()+"-metadata.zip")
+ d.exportableArtifacts.metadataDir = android.PathForModuleOut(ctx, params.stubsType.String(), "metadata")
+ optionalCmdParams.metadataZip = d.exportableArtifacts.metadataZip
+ optionalCmdParams.metadataDir = d.exportableArtifacts.metadataDir
}
if Bool(d.properties.Annotations_enabled) {
if params.validatingNullability {
- d.exportableNullabilityWarningsFile = android.PathForModuleOut(ctx, params.stubsType.String(), ctx.ModuleName()+"_nullability_warnings.txt")
- optionalCmdParams.nullabilityWarningsFile = d.exportableNullabilityWarningsFile
+ d.exportableArtifacts.nullabilityWarningsFile = android.PathForModuleOut(ctx, params.stubsType.String(), ctx.ModuleName()+"_nullability_warnings.txt")
+ optionalCmdParams.nullabilityWarningsFile = d.exportableArtifacts.nullabilityWarningsFile
}
- d.exportableAnnotationsZip = android.PathForModuleOut(ctx, params.stubsType.String(), ctx.ModuleName()+"_annotations.zip")
- optionalCmdParams.annotationsZip = d.exportableAnnotationsZip
+ d.exportableArtifacts.annotationsZip = android.PathForModuleOut(ctx, params.stubsType.String(), ctx.ModuleName()+"_annotations.zip")
+ optionalCmdParams.annotationsZip = d.exportableArtifacts.annotationsZip
}
if Bool(d.properties.Api_levels_annotations_enabled) {
- d.exportableApiVersionsXml = android.PathForModuleOut(ctx, params.stubsType.String(), "api-versions.xml")
- optionalCmdParams.apiVersionsXml = d.exportableApiVersionsXml
+ d.exportableArtifacts.apiVersionsXml = android.PathForModuleOut(ctx, params.stubsType.String(), "api-versions.xml")
+ optionalCmdParams.apiVersionsXml = d.exportableArtifacts.apiVersionsXml
}
if params.checkApi || String(d.properties.Api_filename) != "" {
@@ -1194,7 +1155,8 @@
`either of the two choices above and try re-building the target.\n`+
`If the mismatch between the stubs and the current.txt is intended,\n`+
`you can try re-building the target by executing the following command:\n`+
- `m DISABLE_STUB_VALIDATION=true <your build target>\n`+
+ `m DISABLE_STUB_VALIDATION=true <your build target>.\n`+
+ `Note that DISABLE_STUB_VALIDATION=true does not bypass checkapi.\n`+
`******************************\n`, ctx.ModuleName())
rule.Command().
@@ -1234,7 +1196,7 @@
}
if String(d.properties.Check_nullability_warnings) != "" {
- if d.nullabilityWarningsFile == nil {
+ if d.everythingArtifacts.nullabilityWarningsFile == nil {
ctx.PropertyErrorf("check_nullability_warnings",
"Cannot specify check_nullability_warnings unless validating nullability")
}
@@ -1251,13 +1213,13 @@
` 2. Update the file of expected warnings by running:\n`+
` cp %s %s\n`+
` and submitting the updated file as part of your change.`,
- d.nullabilityWarningsFile, checkNullabilityWarnings)
+ d.everythingArtifacts.nullabilityWarningsFile, checkNullabilityWarnings)
rule := android.NewRuleBuilder(pctx, ctx)
rule.Command().
Text("(").
- Text("diff").Input(checkNullabilityWarnings).Input(d.nullabilityWarningsFile).
+ Text("diff").Input(checkNullabilityWarnings).Input(d.everythingArtifacts.nullabilityWarningsFile).
Text("&&").
Text("touch").Output(d.checkNullabilityWarningsTimestamp).
Text(") || (").
@@ -1351,8 +1313,8 @@
}
}
-func (d *PrebuiltStubsSources) StubsSrcJar() android.Path {
- return d.stubsSrcJar
+func (d *PrebuiltStubsSources) StubsSrcJar(_ StubsType) (android.Path, error) {
+ return d.stubsSrcJar, nil
}
func (p *PrebuiltStubsSources) GenerateAndroidBuildActions(ctx android.ModuleContext) {
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 29da28d..5ee713c 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -15,6 +15,7 @@
package java
import (
+ "errors"
"fmt"
"path"
"path/filepath"
@@ -752,75 +753,78 @@
}
}
-func (paths *scopePaths) treatDepAsApiStubsProvider(dep android.Module, action func(provider ApiStubsProvider)) error {
+func (paths *scopePaths) treatDepAsApiStubsProvider(dep android.Module, action func(provider ApiStubsProvider) error) error {
if apiStubsProvider, ok := dep.(ApiStubsProvider); ok {
- action(apiStubsProvider)
- return nil
- } else {
- return fmt.Errorf("expected module that implements ApiStubsProvider, e.g. droidstubs")
- }
-}
-
-func (paths *scopePaths) treatDepAsExportableApiStubsProvider(dep android.Module, action func(provider ExportableApiStubsProvider)) error {
- if exportableApiStubsProvider, ok := dep.(ExportableApiStubsProvider); ok {
- action(exportableApiStubsProvider)
+ err := action(apiStubsProvider)
+ if err != nil {
+ return err
+ }
return nil
} else {
return fmt.Errorf("expected module that implements ExportableApiStubsSrcProvider, e.g. droidstubs")
}
}
-func (paths *scopePaths) treatDepAsApiStubsSrcProvider(dep android.Module, action func(provider ApiStubsSrcProvider)) error {
+func (paths *scopePaths) treatDepAsApiStubsSrcProvider(dep android.Module, action func(provider ApiStubsSrcProvider) error) error {
if apiStubsProvider, ok := dep.(ApiStubsSrcProvider); ok {
- action(apiStubsProvider)
+ err := action(apiStubsProvider)
+ if err != nil {
+ return err
+ }
return nil
} else {
return fmt.Errorf("expected module that implements ApiStubsSrcProvider, e.g. droidstubs")
}
}
-func (paths *scopePaths) extractApiInfoFromApiStubsProvider(provider ApiStubsProvider) {
- paths.annotationsZip = android.OptionalPathForPath(provider.AnnotationsZip())
- paths.currentApiFilePath = android.OptionalPathForPath(provider.ApiFilePath())
- paths.removedApiFilePath = android.OptionalPathForPath(provider.RemovedApiFilePath())
-}
+func (paths *scopePaths) extractApiInfoFromApiStubsProvider(provider ApiStubsProvider, stubsType StubsType) error {
+ var annotationsZip, currentApiFilePath, removedApiFilePath android.Path
+ annotationsZip, annotationsZipErr := provider.AnnotationsZip(stubsType)
+ currentApiFilePath, currentApiFilePathErr := provider.ApiFilePath(stubsType)
+ removedApiFilePath, removedApiFilePathErr := provider.RemovedApiFilePath(stubsType)
-func (paths *scopePaths) extractApiInfoFromExportableApiStubsProvider(provider ExportableApiStubsProvider) {
- paths.annotationsZip = android.OptionalPathForPath(provider.ExportableAnnotationsZip())
- paths.currentApiFilePath = android.OptionalPathForPath(provider.ExportableApiFilePath())
- paths.removedApiFilePath = android.OptionalPathForPath(provider.ExportableRemovedApiFilePath())
+ combinedError := errors.Join(annotationsZipErr, currentApiFilePathErr, removedApiFilePathErr)
+
+ if combinedError == nil {
+ paths.annotationsZip = android.OptionalPathForPath(annotationsZip)
+ paths.currentApiFilePath = android.OptionalPathForPath(currentApiFilePath)
+ paths.removedApiFilePath = android.OptionalPathForPath(removedApiFilePath)
+ }
+ return combinedError
}
func (paths *scopePaths) extractApiInfoFromDep(ctx android.ModuleContext, dep android.Module) error {
- return paths.treatDepAsApiStubsProvider(dep, func(provider ApiStubsProvider) {
- paths.extractApiInfoFromApiStubsProvider(provider)
+ return paths.treatDepAsApiStubsProvider(dep, func(provider ApiStubsProvider) error {
+ return paths.extractApiInfoFromApiStubsProvider(provider, Everything)
})
}
-func (paths *scopePaths) extractStubsSourceInfoFromApiStubsProviders(provider ApiStubsSrcProvider) {
- paths.stubsSrcJar = android.OptionalPathForPath(provider.StubsSrcJar())
-}
-
-func (paths *scopePaths) extractStubsSourceInfoFromExportableApiStubsProviders(provider ExportableApiStubsSrcProvider) {
- paths.stubsSrcJar = android.OptionalPathForPath(provider.ExportableStubsSrcJar())
+func (paths *scopePaths) extractStubsSourceInfoFromApiStubsProviders(provider ApiStubsSrcProvider, stubsType StubsType) error {
+ stubsSrcJar, err := provider.StubsSrcJar(stubsType)
+ if err == nil {
+ paths.stubsSrcJar = android.OptionalPathForPath(stubsSrcJar)
+ }
+ return err
}
func (paths *scopePaths) extractStubsSourceInfoFromDep(ctx android.ModuleContext, dep android.Module) error {
- return paths.treatDepAsApiStubsSrcProvider(dep, func(provider ApiStubsSrcProvider) {
- paths.extractStubsSourceInfoFromApiStubsProviders(provider)
+ return paths.treatDepAsApiStubsSrcProvider(dep, func(provider ApiStubsSrcProvider) error {
+ return paths.extractStubsSourceInfoFromApiStubsProviders(provider, Everything)
})
}
func (paths *scopePaths) extractStubsSourceAndApiInfoFromApiStubsProvider(ctx android.ModuleContext, dep android.Module) error {
if ctx.Config().ReleaseHiddenApiExportableStubs() {
- return paths.treatDepAsExportableApiStubsProvider(dep, func(provider ExportableApiStubsProvider) {
- paths.extractApiInfoFromExportableApiStubsProvider(provider)
- paths.extractStubsSourceInfoFromExportableApiStubsProviders(provider)
+ return paths.treatDepAsApiStubsProvider(dep, func(provider ApiStubsProvider) error {
+ extractApiInfoErr := paths.extractApiInfoFromApiStubsProvider(provider, Exportable)
+ extractStubsSourceInfoErr := paths.extractStubsSourceInfoFromApiStubsProviders(provider, Exportable)
+ return errors.Join(extractApiInfoErr, extractStubsSourceInfoErr)
})
}
- return paths.treatDepAsApiStubsProvider(dep, func(provider ApiStubsProvider) {
- paths.extractApiInfoFromApiStubsProvider(provider)
- paths.extractStubsSourceInfoFromApiStubsProviders(provider)
+ return paths.treatDepAsApiStubsProvider(dep, func(provider ApiStubsProvider) error {
+ extractApiInfoErr := paths.extractApiInfoFromApiStubsProvider(provider, Everything)
+ extractStubsSourceInfoErr := paths.extractStubsSourceInfoFromApiStubsProviders(provider, Everything)
+ return errors.Join(extractApiInfoErr, extractStubsSourceInfoErr)
})
}
diff --git a/phony/phony.go b/phony/phony.go
index bb48788..b8dbd00 100644
--- a/phony/phony.go
+++ b/phony/phony.go
@@ -68,6 +68,10 @@
fmt.Fprintln(w, "LOCAL_TARGET_REQUIRED_MODULES :=",
strings.Join(p.targetRequiredModuleNames, " "))
}
+ // AconfigUpdateAndroidMkData may have added elements to Extra. Process them here.
+ for _, extra := range data.Extra {
+ extra(w, nil)
+ }
fmt.Fprintln(w, "include $(BUILD_PHONY_PACKAGE)")
},
}
diff --git a/rust/config/x86_64_device.go b/rust/config/x86_64_device.go
index cc16704..49f7c77 100644
--- a/rust/config/x86_64_device.go
+++ b/rust/config/x86_64_device.go
@@ -28,16 +28,16 @@
x86_64LinkFlags = []string{}
x86_64ArchVariantRustFlags = map[string][]string{
- "": []string{},
- "broadwell": []string{"-C target-cpu=broadwell"},
- "goldmont": []string{"-C target-cpu=goldmont"},
- "goldmont-plus": []string{"-C target-cpu=goldmont-plus"},
- "goldmont-without-xsaves": []string{"-C target-cpu=goldmont", "-C target-feature=-xsaves"},
- "haswell": []string{"-C target-cpu=haswell"},
- "ivybridge": []string{"-C target-cpu=ivybridge"},
- "sandybridge": []string{"-C target-cpu=sandybridge"},
- "silvermont": []string{"-C target-cpu=silvermont"},
- "skylake": []string{"-C target-cpu=skylake"},
+ "": []string{},
+ "broadwell": []string{"-C target-cpu=broadwell"},
+ "goldmont": []string{"-C target-cpu=goldmont"},
+ "goldmont-plus": []string{"-C target-cpu=goldmont-plus"},
+ "goldmont-without-sha-xsaves": []string{"-C target-cpu=goldmont", "-C target-feature=-sha,-xsaves"},
+ "haswell": []string{"-C target-cpu=haswell"},
+ "ivybridge": []string{"-C target-cpu=ivybridge"},
+ "sandybridge": []string{"-C target-cpu=sandybridge"},
+ "silvermont": []string{"-C target-cpu=silvermont"},
+ "skylake": []string{"-C target-cpu=skylake"},
//TODO: Add target-cpu=stoneyridge when rustc supports it.
"stoneyridge": []string{""},
"tremont": []string{"-C target-cpu=tremont"},
diff --git a/rust/config/x86_device.go b/rust/config/x86_device.go
index e7b575c..2a57e73 100644
--- a/rust/config/x86_device.go
+++ b/rust/config/x86_device.go
@@ -26,17 +26,17 @@
x86LinkFlags = []string{}
x86ArchVariantRustFlags = map[string][]string{
- "": []string{},
- "atom": []string{"-C target-cpu=atom"},
- "broadwell": []string{"-C target-cpu=broadwell"},
- "goldmont": []string{"-C target-cpu=goldmont"},
- "goldmont-plus": []string{"-C target-cpu=goldmont-plus"},
- "goldmont-without-xsaves": []string{"-C target-cpu=goldmont", "-C target-feature=-xsaves"},
- "haswell": []string{"-C target-cpu=haswell"},
- "ivybridge": []string{"-C target-cpu=ivybridge"},
- "sandybridge": []string{"-C target-cpu=sandybridge"},
- "silvermont": []string{"-C target-cpu=silvermont"},
- "skylake": []string{"-C target-cpu=skylake"},
+ "": []string{},
+ "atom": []string{"-C target-cpu=atom"},
+ "broadwell": []string{"-C target-cpu=broadwell"},
+ "goldmont": []string{"-C target-cpu=goldmont"},
+ "goldmont-plus": []string{"-C target-cpu=goldmont-plus"},
+ "goldmont-without-sha-xsaves": []string{"-C target-cpu=goldmont", "-C target-feature=-sha,-xsaves"},
+ "haswell": []string{"-C target-cpu=haswell"},
+ "ivybridge": []string{"-C target-cpu=ivybridge"},
+ "sandybridge": []string{"-C target-cpu=sandybridge"},
+ "silvermont": []string{"-C target-cpu=silvermont"},
+ "skylake": []string{"-C target-cpu=skylake"},
//TODO: Add target-cpu=stoneyridge when rustc supports it.
"stoneyridge": []string{""},
"tremont": []string{"-C target-cpu=tremont"},
diff --git a/sysprop/sysprop_library.go b/sysprop/sysprop_library.go
index 4a0796b..766f3e7 100644
--- a/sysprop/sysprop_library.go
+++ b/sysprop/sysprop_library.go
@@ -345,6 +345,10 @@
fmt.Fprintln(w, "LOCAL_MODULE :=", m.Name())
fmt.Fprintf(w, "LOCAL_MODULE_CLASS := FAKE\n")
fmt.Fprintf(w, "LOCAL_MODULE_TAGS := optional\n")
+ // AconfigUpdateAndroidMkData may have added elements to Extra. Process them here.
+ for _, extra := range data.Extra {
+ extra(w, nil)
+ }
fmt.Fprintf(w, "include $(BUILD_SYSTEM)/base_rules.mk\n\n")
fmt.Fprintf(w, "$(LOCAL_BUILT_MODULE): %s\n", m.checkApiFileTimeStamp.String())
fmt.Fprintf(w, "\ttouch $@\n\n")