Loading android/all_teams.go +6 −0 Original line number Diff line number Diff line package android import ( "path" "path/filepath" "android/soong/android/team_proto" Loading Loading @@ -153,6 +154,11 @@ func (t *allTeamsSingleton) lookupTeamForAllModules() *team_proto.AllTeams { } else { teamProperties, found = t.lookupDefaultTeam(m.bpFile) } // Deal with one blueprint file including another by looking up the default // in the main Android.bp rather than one listed with "build = [My.bp]" if !found { teamProperties, found = t.lookupDefaultTeam(path.Join(path.Dir(m.bpFile), "Android.bp")) } trendy_team_id := "" if found { Loading android/all_teams_test.go +78 −0 Original line number Diff line number Diff line Loading @@ -264,6 +264,84 @@ func TestPackageLookup(t *testing.T) { AssertDeepEquals(t, "compare maps", expectedTeams, actualTeams) } func TestPackageLookupForIncludedBlueprintFiles(t *testing.T) { t.Parallel() rootBp := ` package { default_team: "team_top"} team { name: "team_top", trendy_team_id: "trendy://team_top", } build = ["include.bp"] ` includeBp := ` fake { name: "IncludedModule", } ` ctx := GroupFixturePreparers( prepareForTestWithTeamAndFakes, PrepareForTestWithPackageModule, FixtureRegisterWithContext(func(ctx RegistrationContext) { ctx.RegisterParallelSingletonType("all_teams", AllTeamsFactory) }), FixtureAddTextFile("Android.bp", rootBp), FixtureAddTextFile("include.bp", includeBp), ).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{ "IncludedModule": proto.String("trendy://team_top"), } AssertDeepEquals(t, "compare maps", expectedTeams, actualTeams) } func TestPackageLookupForIncludedBlueprintFilesWithPackageInChildBlueprint(t *testing.T) { t.Parallel() rootBp := ` team { name: "team_top", trendy_team_id: "trendy://team_top", } build = ["include.bp"] ` includeBp := ` package { default_team: "team_top"} fake { name: "IncludedModule", } ` ctx := GroupFixturePreparers( prepareForTestWithTeamAndFakes, PrepareForTestWithPackageModule, FixtureRegisterWithContext(func(ctx RegistrationContext) { ctx.RegisterParallelSingletonType("all_teams", AllTeamsFactory) }), FixtureAddTextFile("Android.bp", rootBp), FixtureAddTextFile("include.bp", includeBp), ).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{ "IncludedModule": proto.String("trendy://team_top"), } AssertDeepEquals(t, "compare maps", expectedTeams, actualTeams) } type fakeForTests struct { ModuleBase Loading Loading
android/all_teams.go +6 −0 Original line number Diff line number Diff line package android import ( "path" "path/filepath" "android/soong/android/team_proto" Loading Loading @@ -153,6 +154,11 @@ func (t *allTeamsSingleton) lookupTeamForAllModules() *team_proto.AllTeams { } else { teamProperties, found = t.lookupDefaultTeam(m.bpFile) } // Deal with one blueprint file including another by looking up the default // in the main Android.bp rather than one listed with "build = [My.bp]" if !found { teamProperties, found = t.lookupDefaultTeam(path.Join(path.Dir(m.bpFile), "Android.bp")) } trendy_team_id := "" if found { Loading
android/all_teams_test.go +78 −0 Original line number Diff line number Diff line Loading @@ -264,6 +264,84 @@ func TestPackageLookup(t *testing.T) { AssertDeepEquals(t, "compare maps", expectedTeams, actualTeams) } func TestPackageLookupForIncludedBlueprintFiles(t *testing.T) { t.Parallel() rootBp := ` package { default_team: "team_top"} team { name: "team_top", trendy_team_id: "trendy://team_top", } build = ["include.bp"] ` includeBp := ` fake { name: "IncludedModule", } ` ctx := GroupFixturePreparers( prepareForTestWithTeamAndFakes, PrepareForTestWithPackageModule, FixtureRegisterWithContext(func(ctx RegistrationContext) { ctx.RegisterParallelSingletonType("all_teams", AllTeamsFactory) }), FixtureAddTextFile("Android.bp", rootBp), FixtureAddTextFile("include.bp", includeBp), ).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{ "IncludedModule": proto.String("trendy://team_top"), } AssertDeepEquals(t, "compare maps", expectedTeams, actualTeams) } func TestPackageLookupForIncludedBlueprintFilesWithPackageInChildBlueprint(t *testing.T) { t.Parallel() rootBp := ` team { name: "team_top", trendy_team_id: "trendy://team_top", } build = ["include.bp"] ` includeBp := ` package { default_team: "team_top"} fake { name: "IncludedModule", } ` ctx := GroupFixturePreparers( prepareForTestWithTeamAndFakes, PrepareForTestWithPackageModule, FixtureRegisterWithContext(func(ctx RegistrationContext) { ctx.RegisterParallelSingletonType("all_teams", AllTeamsFactory) }), FixtureAddTextFile("Android.bp", rootBp), FixtureAddTextFile("include.bp", includeBp), ).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{ "IncludedModule": proto.String("trendy://team_top"), } AssertDeepEquals(t, "compare maps", expectedTeams, actualTeams) } type fakeForTests struct { ModuleBase Loading