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
diff --git a/Blueprints b/Android.bp
similarity index 98%
rename from Blueprints
rename to Android.bp
index 0e2bc73..ef46002 100644
--- a/Blueprints
+++ b/Android.bp
@@ -47,7 +47,7 @@
"parser/modify_test.go",
"parser/parser_test.go",
"parser/printer_test.go",
- "parser/sort_test.go",
+ "parser/sort_test.go",
],
}
diff --git a/context.go b/context.go
index 0685148..bd61f07 100644
--- a/context.go
+++ b/context.go
@@ -1008,7 +1008,7 @@
// 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 @@
}
}
- 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 @@
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))
diff --git a/context_test.go b/context_test.go
index d91b89d..6308ba9 100644
--- a/context_test.go
+++ b/context_test.go
@@ -181,7 +181,7 @@
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 @@
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 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 @@
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_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 @@
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 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 @@
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 @@
// 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 @@
// 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 @@
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 @@
// 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 @@
}
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 TestParseFailsForModuleWithoutName(t *testing.T) {
ctx := NewContext()
ctx.MockFileSystem(map[string][]byte{
- "Blueprints": []byte(`
+ "Android.bp": []byte(`
foo_module {
name: "A",
}
@@ -597,10 +597,10 @@
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)
diff --git a/glob_test.go b/glob_test.go
index 3fff5a8..15fd395 100644
--- a/glob_test.go
+++ b/glob_test.go
@@ -19,7 +19,7 @@
func TestGlobCache(t *testing.T) {
ctx := NewContext()
ctx.MockFileSystem(map[string][]byte{
- "Blueprints": nil,
+ "Android.bp": nil,
"a/a": nil,
"a/b": nil,
})
diff --git a/module_ctx_test.go b/module_ctx_test.go
index bc8c55f..af23be7 100644
--- a/module_ctx_test.go
+++ b/module_ctx_test.go
@@ -91,12 +91,12 @@
`
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 @@
`
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 @@
`
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 TestAddNinjaFileDeps(t *testing.T) {
ctx := NewContext()
ctx.MockFileSystem(map[string][]byte{
- "Blueprints": []byte(`
+ "Android.bp": []byte(`
test {
name: "test",
}
@@ -591,7 +591,7 @@
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 @@
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)
}
diff --git a/provider_test.go b/provider_test.go
index 8f8def4..942dd31 100644
--- a/provider_test.go
+++ b/provider_test.go
@@ -110,7 +110,7 @@
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 @@
`),
})
- _, errs := ctx.ParseBlueprintsFiles("Blueprints", nil)
+ _, errs := ctx.ParseBlueprintsFiles("Android.bp", nil)
if len(errs) == 0 {
_, errs = ctx.ResolveDependencies(nil)
}
@@ -322,10 +322,10 @@
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)
diff --git a/visit_test.go b/visit_test.go
index 1c74b93..798e289 100644
--- a/visit_test.go
+++ b/visit_test.go
@@ -93,7 +93,7 @@
ctx.RegisterTopDownMutator("visit", visitMutator)
ctx.MockFileSystem(map[string][]byte{
- "Blueprints": []byte(`
+ "Android.bp": []byte(`
visit_module {
name: "A",
visit: ["B"],
@@ -125,7 +125,7 @@
`),
})
- _, errs := ctx.ParseBlueprintsFiles("Blueprints", nil)
+ _, errs := ctx.ParseBlueprintsFiles("Android.bp", nil)
if len(errs) > 0 {
t.Errorf("unexpected parse errors:")
for _, err := range errs {