Rename Blueprints to Android.bp .

This was the only one in the source tree.

Side cleanup: remove some dead code that I assume comes from the time
where Blueprint files had to specify what subdirectories other Blueprint
files are in.

Test: Presubmits.
Change-Id: If84c4e85bc5516f30da97c1be29b56e50dddb3c4
This commit is contained in:
Lukacs T. Berki 2021-09-02 11:34:06 +02:00
parent ceb3c43f65
commit eef5685c65
7 changed files with 43 additions and 48 deletions

View file

@ -47,7 +47,7 @@ bootstrap_go_package {
"parser/modify_test.go",
"parser/parser_test.go",
"parser/printer_test.go",
"parser/sort_test.go",
"parser/sort_test.go",
],
}

View file

@ -1008,7 +1008,7 @@ func (c *Context) MockFileSystem(files map[string][]byte) {
// no module list file specified; find every file named Blueprints
pathsToParse := []string{}
for candidate := range files {
if filepath.Base(candidate) == "Blueprints" {
if filepath.Base(candidate) == "Android.bp" {
pathsToParse = append(pathsToParse, candidate)
}
}
@ -1129,15 +1129,10 @@ func (c *Context) parseOne(rootDir, filename string, reader io.Reader,
}
}
subBlueprintsName, _, err := getStringFromScope(scope, "subname")
if err != nil {
errs = append(errs, err)
}
if subBlueprintsName == "" {
subBlueprintsName = "Blueprints"
}
var blueprints []string
newBlueprints, newErrs := c.findBuildBlueprints(filepath.Dir(filename), build, buildPos)
@ -1818,9 +1813,9 @@ func (c *Context) addInterVariantDependency(origModule *moduleInfo, tag Dependen
return toInfo
}
// findBlueprintDescendants returns a map linking parent Blueprints files to child Blueprints files
// For example, if paths = []string{"a/b/c/Android.bp", "a/Blueprints"},
// then descendants = {"":[]string{"a/Blueprints"}, "a/Blueprints":[]string{"a/b/c/Android.bp"}}
// findBlueprintDescendants returns a map linking parent Blueprint files to child Blueprints files
// For example, if paths = []string{"a/b/c/Android.bp", "a/Android.bp"},
// then descendants = {"":[]string{"a/Android.bp"}, "a/Android.bp":[]string{"a/b/c/Android.bp"}}
func findBlueprintDescendants(paths []string) (descendants map[string][]string, err error) {
// make mapping from dir path to file path
filesByDir := make(map[string]string, len(paths))

View file

@ -181,7 +181,7 @@ func TestContextParse(t *testing.T) {
func TestWalkDeps(t *testing.T) {
ctx := NewContext()
ctx.MockFileSystem(map[string][]byte{
"Blueprints": []byte(`
"Android.bp": []byte(`
foo_module {
name: "A",
deps: ["B", "C"],
@ -220,7 +220,7 @@ func TestWalkDeps(t *testing.T) {
ctx.RegisterModuleType("foo_module", newFooModule)
ctx.RegisterModuleType("bar_module", newBarModule)
ctx.RegisterBottomUpMutator("deps", depsMutator)
_, errs := ctx.ParseBlueprintsFiles("Blueprints", nil)
_, errs := ctx.ParseBlueprintsFiles("Android.bp", nil)
if len(errs) > 0 {
t.Errorf("unexpected parse errors:")
for _, err := range errs {
@ -257,7 +257,7 @@ func TestWalkDeps(t *testing.T) {
func TestWalkDepsDuplicates(t *testing.T) {
ctx := NewContext()
ctx.MockFileSystem(map[string][]byte{
"Blueprints": []byte(`
"Android.bp": []byte(`
foo_module {
name: "A",
deps: ["B", "C"],
@ -301,7 +301,7 @@ func TestWalkDepsDuplicates(t *testing.T) {
ctx.RegisterModuleType("foo_module", newFooModule)
ctx.RegisterModuleType("bar_module", newBarModule)
ctx.RegisterBottomUpMutator("deps", depsMutator)
_, errs := ctx.ParseBlueprintsFiles("Blueprints", nil)
_, errs := ctx.ParseBlueprintsFiles("Android.bp", nil)
if len(errs) > 0 {
t.Errorf("unexpected parse errors:")
for _, err := range errs {
@ -337,7 +337,7 @@ func TestWalkDepsDuplicates(t *testing.T) {
func TestWalkDepsDuplicates_IgnoreFirstPath(t *testing.T) {
ctx := NewContext()
ctx.MockFileSystem(map[string][]byte{
"Blueprints": []byte(`
"Android.bp": []byte(`
foo_module {
name: "A",
deps: ["B"],
@ -368,7 +368,7 @@ func TestWalkDepsDuplicates_IgnoreFirstPath(t *testing.T) {
ctx.RegisterModuleType("foo_module", newFooModule)
ctx.RegisterModuleType("bar_module", newBarModule)
ctx.RegisterBottomUpMutator("deps", depsMutator)
_, errs := ctx.ParseBlueprintsFiles("Blueprints", nil)
_, errs := ctx.ParseBlueprintsFiles("Android.bp", nil)
if len(errs) > 0 {
t.Errorf("unexpected parse errors:")
for _, err := range errs {
@ -401,7 +401,7 @@ func TestWalkDepsDuplicates_IgnoreFirstPath(t *testing.T) {
func TestCreateModule(t *testing.T) {
ctx := newContext()
ctx.MockFileSystem(map[string][]byte{
"Blueprints": []byte(`
"Android.bp": []byte(`
foo_module {
name: "A",
deps: ["B", "C"],
@ -414,7 +414,7 @@ func TestCreateModule(t *testing.T) {
ctx.RegisterModuleType("foo_module", newFooModule)
ctx.RegisterModuleType("bar_module", newBarModule)
_, errs := ctx.ParseBlueprintsFiles("Blueprints", nil)
_, errs := ctx.ParseBlueprintsFiles("Android.bp", nil)
if len(errs) > 0 {
t.Errorf("unexpected parse errors:")
for _, err := range errs {
@ -492,17 +492,17 @@ func doTestWalkFileOrder(t *testing.T, sleepDuration time.Duration) {
// setup mock context
ctx := newContext()
mockFiles := map[string][]byte{
"Blueprints": []byte(`
"Android.bp": []byte(`
sample_module {
name: "a",
}
`),
"dir1/Blueprints": []byte(`
"dir1/Android.bp": []byte(`
sample_module {
name: "b",
}
`),
"dir1/dir2/Blueprints": []byte(`
"dir1/dir2/Android.bp": []byte(`
sample_module {
name: "c",
}
@ -513,7 +513,7 @@ func doTestWalkFileOrder(t *testing.T, sleepDuration time.Duration) {
// prepare to monitor the visit order
visitOrder := []string{}
visitLock := sync.Mutex{}
correctVisitOrder := []string{"Blueprints", "dir1/Blueprints", "dir1/dir2/Blueprints"}
correctVisitOrder := []string{"Android.bp", "dir1/Android.bp", "dir1/dir2/Android.bp"}
// sleep longer when processing the earlier files
chooseSleepDuration := func(fileName string) (duration time.Duration) {
@ -533,7 +533,7 @@ func doTestWalkFileOrder(t *testing.T, sleepDuration time.Duration) {
defer visitLock.Unlock()
visitOrder = append(visitOrder, file.Name)
}
keys := []string{"Blueprints", "dir1/Blueprints", "dir1/dir2/Blueprints"}
keys := []string{"Android.bp", "dir1/Android.bp", "dir1/dir2/Android.bp"}
// visit the blueprints files
ctx.WalkBlueprintsFiles(".", keys, visitor)
@ -549,16 +549,16 @@ func TestWalkingWithSyntaxError(t *testing.T) {
// setup mock context
ctx := newContext()
mockFiles := map[string][]byte{
"Blueprints": []byte(`
"Android.bp": []byte(`
sample_module {
name: "a" "b",
}
`),
"dir1/Blueprints": []byte(`
"dir1/Android.bp": []byte(`
sample_module {
name: "b",
`),
"dir1/dir2/Blueprints": []byte(`
"dir1/dir2/Android.bp": []byte(`
sample_module {
name: "c",
}
@ -566,14 +566,14 @@ func TestWalkingWithSyntaxError(t *testing.T) {
}
ctx.MockFileSystem(mockFiles)
keys := []string{"Blueprints", "dir1/Blueprints", "dir1/dir2/Blueprints"}
keys := []string{"Android.bp", "dir1/Android.bp", "dir1/dir2/Android.bp"}
// visit the blueprints files
_, errs := ctx.WalkBlueprintsFiles(".", keys, func(file *parser.File) {})
expectedErrs := []error{
errors.New(`Blueprints:3:18: expected "}", found String`),
errors.New(`dir1/Blueprints:4:3: expected "}", found EOF`),
errors.New(`Android.bp:3:18: expected "}", found String`),
errors.New(`dir1/Android.bp:4:3: expected "}", found EOF`),
}
if fmt.Sprintf("%s", expectedErrs) != fmt.Sprintf("%s", errs) {
t.Errorf("Incorrect errors; expected:\n%s\ngot:\n%s", expectedErrs, errs)
@ -584,7 +584,7 @@ func TestWalkingWithSyntaxError(t *testing.T) {
func TestParseFailsForModuleWithoutName(t *testing.T) {
ctx := NewContext()
ctx.MockFileSystem(map[string][]byte{
"Blueprints": []byte(`
"Android.bp": []byte(`
foo_module {
name: "A",
}
@ -597,10 +597,10 @@ func TestParseFailsForModuleWithoutName(t *testing.T) {
ctx.RegisterModuleType("foo_module", newFooModule)
ctx.RegisterModuleType("bar_module", newBarModule)
_, errs := ctx.ParseBlueprintsFiles("Blueprints", nil)
_, errs := ctx.ParseBlueprintsFiles("Android.bp", nil)
expectedErrs := []error{
errors.New(`Blueprints:6:4: property 'name' is missing from a module`),
errors.New(`Android.bp:6:4: property 'name' is missing from a module`),
}
if fmt.Sprintf("%s", expectedErrs) != fmt.Sprintf("%s", errs) {
t.Errorf("Incorrect errors; expected:\n%s\ngot:\n%s", expectedErrs, errs)

View file

@ -19,7 +19,7 @@ import "testing"
func TestGlobCache(t *testing.T) {
ctx := NewContext()
ctx.MockFileSystem(map[string][]byte{
"Blueprints": nil,
"Android.bp": nil,
"a/a": nil,
"a/b": nil,
})

View file

@ -91,12 +91,12 @@ func TestAliasVariation(t *testing.T) {
`
mockFS := map[string][]byte{
"Blueprints": []byte(bp),
"Android.bp": []byte(bp),
}
ctx.MockFileSystem(mockFS)
_, errs := ctx.ParseFileList(".", []string{"Blueprints"}, nil)
_, errs := ctx.ParseFileList(".", []string{"Android.bp"}, nil)
if len(errs) > 0 {
t.Errorf("unexpected parse errors:")
for _, err := range errs {
@ -218,12 +218,12 @@ func TestCreateAliasVariations(t *testing.T) {
`
mockFS := map[string][]byte{
"Blueprints": []byte(bp),
"Android.bp": []byte(bp),
}
ctx.MockFileSystem(mockFS)
_, errs := ctx.ParseFileList(".", []string{"Blueprints"}, nil)
_, errs := ctx.ParseFileList(".", []string{"Android.bp"}, nil)
if len(errs) > 0 {
t.Errorf("unexpected parse errors:")
for _, err := range errs {
@ -339,12 +339,12 @@ func TestAddVariationDependencies(t *testing.T) {
`
mockFS := map[string][]byte{
"Blueprints": []byte(bp),
"Android.bp": []byte(bp),
}
ctx.MockFileSystem(mockFS)
_, errs := ctx.ParseFileList(".", []string{"Blueprints"}, nil)
_, errs := ctx.ParseFileList(".", []string{"Android.bp"}, nil)
if len(errs) > 0 {
t.Errorf("unexpected parse errors:")
for _, err := range errs {
@ -579,7 +579,7 @@ func (s *addNinjaDepsTestSingleton) GenerateBuildActions(ctx SingletonContext) {
func TestAddNinjaFileDeps(t *testing.T) {
ctx := NewContext()
ctx.MockFileSystem(map[string][]byte{
"Blueprints": []byte(`
"Android.bp": []byte(`
test {
name: "test",
}
@ -591,7 +591,7 @@ func TestAddNinjaFileDeps(t *testing.T) {
ctx.RegisterTopDownMutator("testTopDownMutator", addNinjaDepsTestTopDownMutator)
ctx.RegisterPreSingletonType("testPreSingleton", addNinjaDepsTestPreSingletonFactory)
ctx.RegisterSingletonType("testSingleton", addNinjaDepsTestSingletonFactory)
parseDeps, errs := ctx.ParseBlueprintsFiles("Blueprints", nil)
parseDeps, errs := ctx.ParseBlueprintsFiles("Android.bp", nil)
if len(errs) > 0 {
t.Errorf("unexpected parse errors:")
for _, err := range errs {
@ -618,7 +618,7 @@ func TestAddNinjaFileDeps(t *testing.T) {
t.FailNow()
}
if g, w := parseDeps, []string{"Blueprints", "LoadHookContext"}; !reflect.DeepEqual(g, w) {
if g, w := parseDeps, []string{"Android.bp", "LoadHookContext"}; !reflect.DeepEqual(g, w) {
t.Errorf("ParseBlueprintsFiles: wanted deps %q, got %q", w, g)
}

View file

@ -110,7 +110,7 @@ func TestProviders(t *testing.T) {
ctx.RegisterBottomUpMutator("provider_after_mutator", providerTestAfterMutator)
ctx.MockFileSystem(map[string][]byte{
"Blueprints": []byte(`
"Android.bp": []byte(`
provider_module {
name: "A",
deps: ["B"],
@ -132,7 +132,7 @@ func TestProviders(t *testing.T) {
`),
})
_, errs := ctx.ParseBlueprintsFiles("Blueprints", nil)
_, errs := ctx.ParseBlueprintsFiles("Android.bp", nil)
if len(errs) == 0 {
_, errs = ctx.ResolveDependencies(nil)
}
@ -322,10 +322,10 @@ func TestInvalidProvidersUsage(t *testing.T) {
childBP)
ctx.MockFileSystem(map[string][]byte{
"Blueprints": []byte(bp),
"Android.bp": []byte(bp),
})
_, errs := ctx.ParseBlueprintsFiles("Blueprints", nil)
_, errs := ctx.ParseBlueprintsFiles("Android.bp", nil)
if len(errs) == 0 {
_, errs = ctx.ResolveDependencies(nil)

View file

@ -93,7 +93,7 @@ func setupVisitTest(t *testing.T) *Context {
ctx.RegisterTopDownMutator("visit", visitMutator)
ctx.MockFileSystem(map[string][]byte{
"Blueprints": []byte(`
"Android.bp": []byte(`
visit_module {
name: "A",
visit: ["B"],
@ -125,7 +125,7 @@ func setupVisitTest(t *testing.T) *Context {
`),
})
_, errs := ctx.ParseBlueprintsFiles("Blueprints", nil)
_, errs := ctx.ParseBlueprintsFiles("Android.bp", nil)
if len(errs) > 0 {
t.Errorf("unexpected parse errors:")
for _, err := range errs {