aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukács T. Berki <lberki@google.com>2021-09-03 18:20:39 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2021-09-03 18:20:39 +0000
commit5e56efb7c80c7e6b0439297cbeb08916bfcf886a (patch)
tree576c4f4eaff4ebf1cc0d7811a152788f04030956
parent9b435b8089d699e9490de0b846e674e97a11a0ad (diff)
parenteef5685c65df24d1f212a122c747da355a4cecff (diff)
downloadplatform_build_blueprint-5e56efb7c80c7e6b0439297cbeb08916bfcf886a.tar.gz
platform_build_blueprint-5e56efb7c80c7e6b0439297cbeb08916bfcf886a.tar.bz2
platform_build_blueprint-5e56efb7c80c7e6b0439297cbeb08916bfcf886a.zip
Merge "Rename Blueprints to Android.bp ."
-rw-r--r--Android.bp (renamed from Blueprints)2
-rw-r--r--context.go13
-rw-r--r--context_test.go44
-rw-r--r--glob_test.go2
-rw-r--r--module_ctx_test.go18
-rw-r--r--provider_test.go8
-rw-r--r--visit_test.go4
7 files changed, 43 insertions, 48 deletions
diff --git a/Blueprints b/Android.bp
index 0e2bc73..ef46002 100644
--- a/Blueprints
+++ b/Android.bp
@@ -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",
],
}
diff --git a/context.go b/context.go
index 0685148..bd61f07 100644
--- a/context.go
+++ b/context.go
@@ -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))
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 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)
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 @@ 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,
})
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 @@ 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)
}
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 @@ 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)
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 @@ 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 {