From b838b0a14792b1bf04ca83278dfe865c3b0104dc Mon Sep 17 00:00:00 2001 From: "Lukacs T. Berki" Date: Thu, 2 Sep 2021 11:46:24 +0200 Subject: [PATCH] Do not modules in files called "Blueprints". The only case for this was Blueprint itself at build/blueprint, but with that being a part of Soong, this special case is not necessary anymore. Test: Presubmits. Change-Id: Icc51cd80bd43f936a97018061cfbf76fc385e4c3 --- android/config.go | 2 +- android/license_kind_test.go | 18 +-- android/license_test.go | 34 +++--- android/licenses_test.go | 54 ++++----- android/package_test.go | 16 +-- android/visibility_test.go | 206 +++++++++++++++++------------------ bpfix/cmd_lib/bpfix.go | 2 +- cc/test_data_test.go | 2 +- ui/build/finder.go | 11 +- 9 files changed, 171 insertions(+), 174 deletions(-) diff --git a/android/config.go b/android/config.go index 1482e5d78..c7d9bc1da 100644 --- a/android/config.go +++ b/android/config.go @@ -525,7 +525,7 @@ func (c *config) mockFileSystem(bp string, fs map[string][]byte) { pathsToParse := []string{} for candidate := range mockFS { base := filepath.Base(candidate) - if base == "Blueprints" || base == "Android.bp" { + if base == "Android.bp" { pathsToParse = append(pathsToParse, candidate) } } diff --git a/android/license_kind_test.go b/android/license_kind_test.go index 1f09568db..7a909a6f9 100644 --- a/android/license_kind_test.go +++ b/android/license_kind_test.go @@ -14,38 +14,38 @@ var licenseKindTests = []struct { { name: "license_kind must not accept licenses property", fs: map[string][]byte{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` license_kind { name: "top_license", licenses: ["other_license"], }`), }, expectedErrors: []string{ - `top/Blueprints:4:14: unrecognized property "licenses"`, + `top/Android.bp:4:14: unrecognized property "licenses"`, }, }, { name: "bad license_kind", fs: map[string][]byte{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` license_kind { name: "top_notice", conditions: ["notice"], }`), - "other/Blueprints": []byte(` + "other/Android.bp": []byte(` mock_license { name: "other_notice", license_kinds: ["notice"], }`), }, expectedErrors: []string{ - `other/Blueprints:2:5: "other_notice" depends on undefined module "notice"`, + `other/Android.bp:2:5: "other_notice" depends on undefined module "notice"`, }, }, { name: "good license kind", fs: map[string][]byte{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` license_kind { name: "top_by_exception_only", conditions: ["by_exception_only"], @@ -55,7 +55,7 @@ var licenseKindTests = []struct { name: "top_proprietary", license_kinds: ["top_by_exception_only"], }`), - "other/Blueprints": []byte(` + "other/Android.bp": []byte(` mock_license { name: "other_proprietary", license_kinds: ["top_proprietary"], @@ -65,7 +65,7 @@ var licenseKindTests = []struct { { name: "multiple license kinds", fs: map[string][]byte{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` license_kind { name: "top_notice", conditions: ["notice"], @@ -85,7 +85,7 @@ var licenseKindTests = []struct { name: "top_proprietary", license_kinds: ["top_by_exception_only"], }`), - "other/Blueprints": []byte(` + "other/Android.bp": []byte(` mock_license { name: "other_rule", license_kinds: ["top_by_exception_only"], diff --git a/android/license_test.go b/android/license_test.go index 26b33c367..7222cd741 100644 --- a/android/license_test.go +++ b/android/license_test.go @@ -27,7 +27,7 @@ var licenseTests = []struct { { name: "license must not accept licenses property", fs: map[string][]byte{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` license { name: "top_license", visibility: ["//visibility:private"], @@ -35,13 +35,13 @@ var licenseTests = []struct { }`), }, expectedErrors: []string{ - `top/Blueprints:5:14: unrecognized property "licenses"`, + `top/Android.bp:5:14: unrecognized property "licenses"`, }, }, { name: "private license", fs: map[string][]byte{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` license_kind { name: "top_notice", conditions: ["notice"], @@ -53,27 +53,27 @@ var licenseTests = []struct { license_kinds: ["top_notice"], visibility: ["//visibility:private"], }`), - "other/Blueprints": []byte(` + "other/Android.bp": []byte(` rule { name: "arule", licenses: ["top_allowed_as_notice"], }`), - "yetmore/Blueprints": []byte(` + "yetmore/Android.bp": []byte(` package { default_applicable_licenses: ["top_allowed_as_notice"], }`), }, expectedErrors: []string{ - `other/Blueprints:2:5: module "arule": depends on //top:top_allowed_as_notice ` + + `other/Android.bp:2:5: module "arule": depends on //top:top_allowed_as_notice ` + `which is not visible to this module`, - `yetmore/Blueprints:2:5: module "//yetmore": depends on //top:top_allowed_as_notice ` + + `yetmore/Android.bp:2:5: module "//yetmore": depends on //top:top_allowed_as_notice ` + `which is not visible to this module`, }, }, { name: "must reference license_kind module", fs: map[string][]byte{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` rule { name: "top_by_exception_only", } @@ -85,14 +85,14 @@ var licenseTests = []struct { }`), }, expectedErrors: []string{ - `top/Blueprints:6:5: module "top_proprietary": license_kinds property ` + + `top/Android.bp:6:5: module "top_proprietary": license_kinds property ` + `"top_by_exception_only" is not a license_kind module`, }, }, { name: "license_kind module must exist", fs: map[string][]byte{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` license { name: "top_notice_allowed", license_kinds: ["top_notice"], @@ -100,13 +100,13 @@ var licenseTests = []struct { }`), }, expectedErrors: []string{ - `top/Blueprints:2:5: "top_notice_allowed" depends on undefined module "top_notice"`, + `top/Android.bp:2:5: "top_notice_allowed" depends on undefined module "top_notice"`, }, }, { name: "public license", fs: map[string][]byte{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` license_kind { name: "top_by_exception_only", conditions: ["by_exception_only"], @@ -118,12 +118,12 @@ var licenseTests = []struct { license_kinds: ["top_by_exception_only"], visibility: ["//visibility:public"], }`), - "other/Blueprints": []byte(` + "other/Android.bp": []byte(` rule { name: "arule", licenses: ["top_proprietary"], }`), - "yetmore/Blueprints": []byte(` + "yetmore/Android.bp": []byte(` package { default_applicable_licenses: ["top_proprietary"], }`), @@ -132,7 +132,7 @@ var licenseTests = []struct { { name: "multiple licenses", fs: map[string][]byte{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` package { default_applicable_licenses: ["top_proprietary"], } @@ -162,12 +162,12 @@ var licenseTests = []struct { name: "myrule", licenses: ["top_allowed_as_notice", "top_proprietary"] }`), - "other/Blueprints": []byte(` + "other/Android.bp": []byte(` rule { name: "arule", licenses: ["top_proprietary"], }`), - "yetmore/Blueprints": []byte(` + "yetmore/Android.bp": []byte(` package { default_applicable_licenses: ["top_proprietary"], }`), diff --git a/android/licenses_test.go b/android/licenses_test.go index 85033100f..d05b0a35f 100644 --- a/android/licenses_test.go +++ b/android/licenses_test.go @@ -20,7 +20,7 @@ var licensesTests = []struct { { name: "invalid module type without licenses property", fs: map[string][]byte{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_bad_module { name: "libexample", }`), @@ -30,7 +30,7 @@ var licensesTests = []struct { { name: "license must exist", fs: map[string][]byte{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_library { name: "libexample", licenses: ["notice"], @@ -41,7 +41,7 @@ var licensesTests = []struct { { name: "all good", fs: map[string][]byte{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` license_kind { name: "notice", conditions: ["shownotice"], @@ -58,12 +58,12 @@ var licensesTests = []struct { name: "libexample1", licenses: ["top_Apache2"], }`), - "top/nested/Blueprints": []byte(` + "top/nested/Android.bp": []byte(` mock_library { name: "libnested", licenses: ["top_Apache2"], }`), - "other/Blueprints": []byte(` + "other/Android.bp": []byte(` mock_library { name: "libother", licenses: ["top_Apache2"], @@ -101,7 +101,7 @@ var licensesTests = []struct { // Check that licenses is the union of the defaults modules. name: "defaults union, basic", fs: map[string][]byte{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` license_kind { name: "top_notice", conditions: ["notice"], @@ -125,7 +125,7 @@ var licensesTests = []struct { name: "libsamepackage", deps: ["libexample"], }`), - "top/nested/Blueprints": []byte(` + "top/nested/Android.bp": []byte(` license_kind { name: "nested_notice", conditions: ["notice"], @@ -140,7 +140,7 @@ var licensesTests = []struct { name: "libnested", deps: ["libexample"], }`), - "other/Blueprints": []byte(` + "other/Android.bp": []byte(` mock_library { name: "libother", deps: ["libexample"], @@ -174,7 +174,7 @@ var licensesTests = []struct { { name: "defaults union, multiple defaults", fs: map[string][]byte{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` license { name: "top", } @@ -194,7 +194,7 @@ var licensesTests = []struct { name: "libsamepackage", deps: ["libexample"], }`), - "top/nested/Blueprints": []byte(` + "top/nested/Android.bp": []byte(` license { name: "top_nested", license_text: ["LICENSE.txt"], @@ -203,7 +203,7 @@ var licensesTests = []struct { name: "libnested", deps: ["libexample"], }`), - "other/Blueprints": []byte(` + "other/Android.bp": []byte(` license { name: "other", } @@ -211,7 +211,7 @@ var licensesTests = []struct { name: "libother", deps: ["libexample"], }`), - "outsider/Blueprints": []byte(` + "outsider/Android.bp": []byte(` mock_library { name: "liboutsider", deps: ["libexample"], @@ -251,7 +251,7 @@ var licensesTests = []struct { { name: "defaults_licenses invalid", fs: map[string][]byte{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_defaults { name: "top_defaults", licenses: ["notice"], @@ -262,7 +262,7 @@ var licensesTests = []struct { { name: "defaults_licenses overrides package default", fs: map[string][]byte{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` package { default_applicable_licenses: ["by_exception_only"], } @@ -298,7 +298,7 @@ var licensesTests = []struct { { name: "package default_applicable_licenses must exist", fs: map[string][]byte{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` package { default_applicable_licenses: ["notice"], }`), @@ -309,7 +309,7 @@ var licensesTests = []struct { // This test relies on the default licenses being legacy_public. name: "package default_applicable_licenses property used when no licenses specified", fs: map[string][]byte{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` package { default_applicable_licenses: ["top_notice"], } @@ -320,7 +320,7 @@ var licensesTests = []struct { mock_library { name: "libexample", }`), - "outsider/Blueprints": []byte(` + "outsider/Android.bp": []byte(` mock_library { name: "liboutsider", deps: ["libexample"], @@ -338,7 +338,7 @@ var licensesTests = []struct { { name: "package default_applicable_licenses not inherited to subpackages", fs: map[string][]byte{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` package { default_applicable_licenses: ["top_notice"], } @@ -348,7 +348,7 @@ var licensesTests = []struct { mock_library { name: "libexample", }`), - "top/nested/Blueprints": []byte(` + "top/nested/Android.bp": []byte(` package { default_applicable_licenses: ["outsider"], } @@ -356,11 +356,11 @@ var licensesTests = []struct { mock_library { name: "libnested", }`), - "top/other/Blueprints": []byte(` + "top/other/Android.bp": []byte(` mock_library { name: "libother", }`), - "outsider/Blueprints": []byte(` + "outsider/Android.bp": []byte(` license { name: "outsider", } @@ -385,7 +385,7 @@ var licensesTests = []struct { { name: "verify that prebuilt dependencies are included", fs: map[string][]byte{ - "prebuilts/Blueprints": []byte(` + "prebuilts/Android.bp": []byte(` license { name: "prebuilt" } @@ -394,7 +394,7 @@ var licensesTests = []struct { licenses: ["prebuilt"], }`), "top/sources/source_file": nil, - "top/sources/Blueprints": []byte(` + "top/sources/Android.bp": []byte(` license { name: "top_sources" } @@ -403,7 +403,7 @@ var licensesTests = []struct { licenses: ["top_sources"], }`), "top/other/source_file": nil, - "top/other/Blueprints": []byte(` + "top/other/Android.bp": []byte(` source { name: "other", deps: [":module"], @@ -419,7 +419,7 @@ var licensesTests = []struct { { name: "verify that prebuilt dependencies are ignored for licenses reasons (preferred)", fs: map[string][]byte{ - "prebuilts/Blueprints": []byte(` + "prebuilts/Android.bp": []byte(` license { name: "prebuilt" } @@ -429,7 +429,7 @@ var licensesTests = []struct { prefer: true, }`), "top/sources/source_file": nil, - "top/sources/Blueprints": []byte(` + "top/sources/Android.bp": []byte(` license { name: "top_sources" } @@ -438,7 +438,7 @@ var licensesTests = []struct { licenses: ["top_sources"], }`), "top/other/source_file": nil, - "top/other/Blueprints": []byte(` + "top/other/Android.bp": []byte(` source { name: "other", deps: [":module"], diff --git a/android/package_test.go b/android/package_test.go index 3bd30cc93..7ea10a4da 100644 --- a/android/package_test.go +++ b/android/package_test.go @@ -13,7 +13,7 @@ var packageTests = []struct { { name: "package must not accept visibility and name properties", fs: map[string][]byte{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` package { name: "package", visibility: ["//visibility:private"], @@ -21,21 +21,21 @@ var packageTests = []struct { }`), }, expectedErrors: []string{ - `top/Blueprints:5:14: unrecognized property "licenses"`, - `top/Blueprints:3:10: unrecognized property "name"`, - `top/Blueprints:4:16: unrecognized property "visibility"`, + `top/Android.bp:5:14: unrecognized property "licenses"`, + `top/Android.bp:3:10: unrecognized property "name"`, + `top/Android.bp:4:16: unrecognized property "visibility"`, }, }, { name: "multiple packages in separate directories", fs: map[string][]byte{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` package { }`), - "other/Blueprints": []byte(` + "other/Android.bp": []byte(` package { }`), - "other/nested/Blueprints": []byte(` + "other/nested/Android.bp": []byte(` package { }`), }, @@ -43,7 +43,7 @@ var packageTests = []struct { { name: "package must not be specified more than once per package", fs: map[string][]byte{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` package { default_visibility: ["//visibility:private"], default_applicable_licenses: ["license"], diff --git a/android/visibility_test.go b/android/visibility_test.go index ffd79093e..714c92a71 100644 --- a/android/visibility_test.go +++ b/android/visibility_test.go @@ -16,7 +16,7 @@ var visibilityTests = []struct { { name: "invalid visibility: empty list", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_library { name: "libexample", visibility: [], @@ -27,7 +27,7 @@ var visibilityTests = []struct { { name: "invalid visibility: empty rule", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_library { name: "libexample", visibility: [""], @@ -38,7 +38,7 @@ var visibilityTests = []struct { { name: "invalid visibility: unqualified", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_library { name: "libexample", visibility: ["target"], @@ -49,7 +49,7 @@ var visibilityTests = []struct { { name: "invalid visibility: empty namespace", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_library { name: "libexample", visibility: ["//"], @@ -60,7 +60,7 @@ var visibilityTests = []struct { { name: "invalid visibility: empty module", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_library { name: "libexample", visibility: [":"], @@ -71,7 +71,7 @@ var visibilityTests = []struct { { name: "invalid visibility: empty namespace and module", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_library { name: "libexample", visibility: ["//:"], @@ -82,7 +82,7 @@ var visibilityTests = []struct { { name: "//visibility:unknown", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_library { name: "libexample", visibility: ["//visibility:unknown"], @@ -93,7 +93,7 @@ var visibilityTests = []struct { { name: "//visibility:xxx mixed", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_library { name: "libexample", visibility: ["//visibility:public", "//namespace"], @@ -114,7 +114,7 @@ var visibilityTests = []struct { { name: "//visibility:legacy_public", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_library { name: "libexample", visibility: ["//visibility:legacy_public"], @@ -130,7 +130,7 @@ var visibilityTests = []struct { // the current directory, a nested directory and a directory in a separate tree. name: "//visibility:public", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_library { name: "libexample", visibility: ["//visibility:public"], @@ -140,12 +140,12 @@ var visibilityTests = []struct { name: "libsamepackage", deps: ["libexample"], }`), - "top/nested/Blueprints": []byte(` + "top/nested/Android.bp": []byte(` mock_library { name: "libnested", deps: ["libexample"], }`), - "other/Blueprints": []byte(` + "other/Android.bp": []byte(` mock_library { name: "libother", deps: ["libexample"], @@ -157,7 +157,7 @@ var visibilityTests = []struct { // directory only. name: "//visibility:private", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_library { name: "libexample", visibility: ["//visibility:private"], @@ -167,12 +167,12 @@ var visibilityTests = []struct { name: "libsamepackage", deps: ["libexample"], }`), - "top/nested/Blueprints": []byte(` + "top/nested/Android.bp": []byte(` mock_library { name: "libnested", deps: ["libexample"], }`), - "other/Blueprints": []byte(` + "other/Android.bp": []byte(` mock_library { name: "libother", deps: ["libexample"], @@ -189,7 +189,7 @@ var visibilityTests = []struct { // Verify that :__pkg__ allows the module to be referenced from the current directory only. name: ":__pkg__", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_library { name: "libexample", visibility: [":__pkg__"], @@ -199,12 +199,12 @@ var visibilityTests = []struct { name: "libsamepackage", deps: ["libexample"], }`), - "top/nested/Blueprints": []byte(` + "top/nested/Android.bp": []byte(` mock_library { name: "libnested", deps: ["libexample"], }`), - "other/Blueprints": []byte(` + "other/Android.bp": []byte(` mock_library { name: "libother", deps: ["libexample"], @@ -222,7 +222,7 @@ var visibilityTests = []struct { // the top/nested directory only, not a subdirectory of top/nested and not peak directory. name: "//top/nested", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_library { name: "libexample", visibility: ["//top/nested"], @@ -232,17 +232,17 @@ var visibilityTests = []struct { name: "libsamepackage", deps: ["libexample"], }`), - "top/nested/Blueprints": []byte(` + "top/nested/Android.bp": []byte(` mock_library { name: "libnested", deps: ["libexample"], }`), - "top/nested/again/Blueprints": []byte(` + "top/nested/again/Android.bp": []byte(` mock_library { name: "libnestedagain", deps: ["libexample"], }`), - "peak/Blueprints": []byte(` + "peak/Android.bp": []byte(` mock_library { name: "libother", deps: ["libexample"], @@ -260,7 +260,7 @@ var visibilityTests = []struct { // and sub directories but nowhere else. name: ":__subpackages__", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_library { name: "libexample", visibility: [":__subpackages__"], @@ -270,12 +270,12 @@ var visibilityTests = []struct { name: "libsamepackage", deps: ["libexample"], }`), - "top/nested/Blueprints": []byte(` + "top/nested/Android.bp": []byte(` mock_library { name: "libnested", deps: ["libexample"], }`), - "peak/other/Blueprints": []byte(` + "peak/other/Android.bp": []byte(` mock_library { name: "libother", deps: ["libexample"], @@ -291,7 +291,7 @@ var visibilityTests = []struct { // directory and sub directories but nowhere else. name: "//top/nested:__subpackages__", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_library { name: "libexample", visibility: ["//top/nested:__subpackages__", "//other"], @@ -301,12 +301,12 @@ var visibilityTests = []struct { name: "libsamepackage", deps: ["libexample"], }`), - "top/nested/Blueprints": []byte(` + "top/nested/Android.bp": []byte(` mock_library { name: "libnested", deps: ["libexample"], }`), - "top/other/Blueprints": []byte(` + "top/other/Android.bp": []byte(` mock_library { name: "libother", deps: ["libexample"], @@ -322,7 +322,7 @@ var visibilityTests = []struct { // the current directory, top/nested and peak and all its subpackages. name: `["//top/nested", "//peak:__subpackages__"]`, fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_library { name: "libexample", visibility: ["//top/nested", "//peak:__subpackages__"], @@ -332,12 +332,12 @@ var visibilityTests = []struct { name: "libsamepackage", deps: ["libexample"], }`), - "top/nested/Blueprints": []byte(` + "top/nested/Android.bp": []byte(` mock_library { name: "libnested", deps: ["libexample"], }`), - "peak/other/Blueprints": []byte(` + "peak/other/Android.bp": []byte(` mock_library { name: "libother", deps: ["libexample"], @@ -348,7 +348,7 @@ var visibilityTests = []struct { // Verify that //vendor... cannot be used outside vendor apart from //vendor:__subpackages__ name: `//vendor`, fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_library { name: "libexample", visibility: ["//vendor:__subpackages__"], @@ -358,13 +358,13 @@ var visibilityTests = []struct { name: "libsamepackage", visibility: ["//vendor/apps/AcmeSettings"], }`), - "vendor/Blueprints": []byte(` + "vendor/Android.bp": []byte(` mock_library { name: "libvendorexample", deps: ["libexample"], visibility: ["//vendor/nested"], }`), - "vendor/nested/Blueprints": []byte(` + "vendor/nested/Android.bp": []byte(` mock_library { name: "libvendornested", deps: ["libexample", "libvendorexample"], @@ -382,7 +382,7 @@ var visibilityTests = []struct { // Check that visibility is the union of the defaults modules. name: "defaults union, basic", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_defaults { name: "libexample_defaults", visibility: ["//other"], @@ -396,17 +396,17 @@ var visibilityTests = []struct { name: "libsamepackage", deps: ["libexample"], }`), - "top/nested/Blueprints": []byte(` + "top/nested/Android.bp": []byte(` mock_library { name: "libnested", deps: ["libexample"], }`), - "other/Blueprints": []byte(` + "other/Android.bp": []byte(` mock_library { name: "libother", deps: ["libexample"], }`), - "outsider/Blueprints": []byte(` + "outsider/Android.bp": []byte(` mock_library { name: "liboutsider", deps: ["libexample"], @@ -420,7 +420,7 @@ var visibilityTests = []struct { { name: "defaults union, multiple defaults", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_defaults { name: "libexample_defaults_1", visibility: ["//other"], @@ -437,17 +437,17 @@ var visibilityTests = []struct { name: "libsamepackage", deps: ["libexample"], }`), - "top/nested/Blueprints": []byte(` + "top/nested/Android.bp": []byte(` mock_library { name: "libnested", deps: ["libexample"], }`), - "other/Blueprints": []byte(` + "other/Android.bp": []byte(` mock_library { name: "libother", deps: ["libexample"], }`), - "outsider/Blueprints": []byte(` + "outsider/Android.bp": []byte(` mock_library { name: "liboutsider", deps: ["libexample"], @@ -461,7 +461,7 @@ var visibilityTests = []struct { { name: "//visibility:public mixed with other in defaults", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_defaults { name: "libexample_defaults", visibility: ["//visibility:public", "//namespace"], @@ -479,7 +479,7 @@ var visibilityTests = []struct { { name: "//visibility:public overriding defaults", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_defaults { name: "libexample_defaults", visibility: ["//namespace"], @@ -489,7 +489,7 @@ var visibilityTests = []struct { visibility: ["//visibility:public"], defaults: ["libexample_defaults"], }`), - "outsider/Blueprints": []byte(` + "outsider/Android.bp": []byte(` mock_library { name: "liboutsider", deps: ["libexample"], @@ -502,7 +502,7 @@ var visibilityTests = []struct { { name: "//visibility:public mixed with other from different defaults 1", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_defaults { name: "libexample_defaults_1", visibility: ["//namespace"], @@ -515,7 +515,7 @@ var visibilityTests = []struct { name: "libexample", defaults: ["libexample_defaults_1", "libexample_defaults_2"], }`), - "outsider/Blueprints": []byte(` + "outsider/Android.bp": []byte(` mock_library { name: "liboutsider", deps: ["libexample"], @@ -525,7 +525,7 @@ var visibilityTests = []struct { { name: "//visibility:public mixed with other from different defaults 2", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_defaults { name: "libexample_defaults_1", visibility: ["//visibility:public"], @@ -538,7 +538,7 @@ var visibilityTests = []struct { name: "libexample", defaults: ["libexample_defaults_1", "libexample_defaults_2"], }`), - "outsider/Blueprints": []byte(` + "outsider/Android.bp": []byte(` mock_library { name: "liboutsider", deps: ["libexample"], @@ -548,7 +548,7 @@ var visibilityTests = []struct { { name: "//visibility:private in defaults", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_defaults { name: "libexample_defaults", visibility: ["//visibility:private"], @@ -561,12 +561,12 @@ var visibilityTests = []struct { name: "libsamepackage", deps: ["libexample"], }`), - "top/nested/Blueprints": []byte(` + "top/nested/Android.bp": []byte(` mock_library { name: "libnested", deps: ["libexample"], }`), - "other/Blueprints": []byte(` + "other/Android.bp": []byte(` mock_library { name: "libother", deps: ["libexample"], @@ -582,7 +582,7 @@ var visibilityTests = []struct { { name: "//visibility:private mixed with other in defaults", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_defaults { name: "libexample_defaults", visibility: ["//visibility:private", "//namespace"], @@ -600,7 +600,7 @@ var visibilityTests = []struct { { name: "//visibility:private overriding defaults", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_defaults { name: "libexample_defaults", visibility: ["//namespace"], @@ -619,7 +619,7 @@ var visibilityTests = []struct { { name: "//visibility:private in defaults overridden", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_defaults { name: "libexample_defaults", visibility: ["//visibility:private"], @@ -638,7 +638,7 @@ var visibilityTests = []struct { { name: "//visibility:private override //visibility:public", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_defaults { name: "libexample_defaults", visibility: ["//visibility:public"], @@ -656,7 +656,7 @@ var visibilityTests = []struct { { name: "//visibility:public override //visibility:private", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_defaults { name: "libexample_defaults", visibility: ["//visibility:private"], @@ -674,7 +674,7 @@ var visibilityTests = []struct { { name: "//visibility:override must be first in the list", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_library { name: "libexample", visibility: ["//other", "//visibility:override", "//namespace"], @@ -687,7 +687,7 @@ var visibilityTests = []struct { { name: "//visibility:override discards //visibility:private", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_defaults { name: "libexample_defaults", visibility: ["//visibility:private"], @@ -698,7 +698,7 @@ var visibilityTests = []struct { visibility: ["//visibility:override", "//other"], defaults: ["libexample_defaults"], }`), - "other/Blueprints": []byte(` + "other/Android.bp": []byte(` mock_library { name: "libother", deps: ["libexample"], @@ -708,7 +708,7 @@ var visibilityTests = []struct { { name: "//visibility:override discards //visibility:public", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_defaults { name: "libexample_defaults", visibility: ["//visibility:public"], @@ -719,12 +719,12 @@ var visibilityTests = []struct { visibility: ["//visibility:override", "//other"], defaults: ["libexample_defaults"], }`), - "other/Blueprints": []byte(` + "other/Android.bp": []byte(` mock_library { name: "libother", deps: ["libexample"], }`), - "namespace/Blueprints": []byte(` + "namespace/Android.bp": []byte(` mock_library { name: "libnamespace", deps: ["libexample"], @@ -737,7 +737,7 @@ var visibilityTests = []struct { { name: "//visibility:override discards defaults supplied rules", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_defaults { name: "libexample_defaults", visibility: ["//namespace"], @@ -748,12 +748,12 @@ var visibilityTests = []struct { visibility: ["//visibility:override", "//other"], defaults: ["libexample_defaults"], }`), - "other/Blueprints": []byte(` + "other/Android.bp": []byte(` mock_library { name: "libother", deps: ["libexample"], }`), - "namespace/Blueprints": []byte(` + "namespace/Android.bp": []byte(` mock_library { name: "libnamespace", deps: ["libexample"], @@ -766,7 +766,7 @@ var visibilityTests = []struct { { name: "//visibility:override can override //visibility:public with //visibility:private", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_defaults { name: "libexample_defaults", visibility: ["//visibility:public"], @@ -776,7 +776,7 @@ var visibilityTests = []struct { visibility: ["//visibility:override", "//visibility:private"], defaults: ["libexample_defaults"], }`), - "namespace/Blueprints": []byte(` + "namespace/Android.bp": []byte(` mock_library { name: "libnamespace", deps: ["libexample"], @@ -789,7 +789,7 @@ var visibilityTests = []struct { { name: "//visibility:override can override //visibility:private with //visibility:public", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_defaults { name: "libexample_defaults", visibility: ["//visibility:private"], @@ -799,7 +799,7 @@ var visibilityTests = []struct { visibility: ["//visibility:override", "//visibility:public"], defaults: ["libexample_defaults"], }`), - "namespace/Blueprints": []byte(` + "namespace/Android.bp": []byte(` mock_library { name: "libnamespace", deps: ["libexample"], @@ -809,7 +809,7 @@ var visibilityTests = []struct { { name: "//visibility:private mixed with itself", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_defaults { name: "libexample_defaults_1", visibility: ["//visibility:private"], @@ -823,7 +823,7 @@ var visibilityTests = []struct { visibility: ["//visibility:private"], defaults: ["libexample_defaults_1", "libexample_defaults_2"], }`), - "outsider/Blueprints": []byte(` + "outsider/Android.bp": []byte(` mock_library { name: "liboutsider", deps: ["libexample"], @@ -839,7 +839,7 @@ var visibilityTests = []struct { { name: "defaults_visibility invalid", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_defaults { name: "top_defaults", defaults_visibility: ["//visibility:invalid"], @@ -852,7 +852,7 @@ var visibilityTests = []struct { { name: "defaults_visibility overrides package default", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` package { default_visibility: ["//visibility:private"], } @@ -860,7 +860,7 @@ var visibilityTests = []struct { name: "top_defaults", defaults_visibility: ["//visibility:public"], }`), - "outsider/Blueprints": []byte(` + "outsider/Android.bp": []byte(` mock_library { name: "liboutsider", defaults: ["top_defaults"], @@ -872,7 +872,7 @@ var visibilityTests = []struct { { name: "package default_visibility property is checked", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` package { default_visibility: ["//visibility:invalid"], }`), @@ -883,7 +883,7 @@ var visibilityTests = []struct { // This test relies on the default visibility being legacy_public. name: "package default_visibility property used when no visibility specified", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` package { default_visibility: ["//visibility:private"], } @@ -891,7 +891,7 @@ var visibilityTests = []struct { mock_library { name: "libexample", }`), - "outsider/Blueprints": []byte(` + "outsider/Android.bp": []byte(` mock_library { name: "liboutsider", deps: ["libexample"], @@ -905,7 +905,7 @@ var visibilityTests = []struct { { name: "package default_visibility public does not override visibility private", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` package { default_visibility: ["//visibility:public"], } @@ -914,7 +914,7 @@ var visibilityTests = []struct { name: "libexample", visibility: ["//visibility:private"], }`), - "outsider/Blueprints": []byte(` + "outsider/Android.bp": []byte(` mock_library { name: "liboutsider", deps: ["libexample"], @@ -928,7 +928,7 @@ var visibilityTests = []struct { { name: "package default_visibility private does not override visibility public", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` package { default_visibility: ["//visibility:private"], } @@ -937,7 +937,7 @@ var visibilityTests = []struct { name: "libexample", visibility: ["//visibility:public"], }`), - "outsider/Blueprints": []byte(` + "outsider/Android.bp": []byte(` mock_library { name: "liboutsider", deps: ["libexample"], @@ -947,7 +947,7 @@ var visibilityTests = []struct { { name: "package default_visibility :__subpackages__", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` package { default_visibility: [":__subpackages__"], } @@ -955,12 +955,12 @@ var visibilityTests = []struct { mock_library { name: "libexample", }`), - "top/nested/Blueprints": []byte(` + "top/nested/Android.bp": []byte(` mock_library { name: "libnested", deps: ["libexample"], }`), - "outsider/Blueprints": []byte(` + "outsider/Android.bp": []byte(` mock_library { name: "liboutsider", deps: ["libexample"], @@ -974,7 +974,7 @@ var visibilityTests = []struct { { name: "package default_visibility inherited to subpackages", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` package { default_visibility: ["//outsider"], } @@ -983,12 +983,12 @@ var visibilityTests = []struct { name: "libexample", visibility: [":__subpackages__"], }`), - "top/nested/Blueprints": []byte(` + "top/nested/Android.bp": []byte(` mock_library { name: "libnested", deps: ["libexample"], }`), - "outsider/Blueprints": []byte(` + "outsider/Android.bp": []byte(` mock_library { name: "liboutsider", deps: ["libexample", "libnested"], @@ -1002,11 +1002,11 @@ var visibilityTests = []struct { { name: "package default_visibility inherited to subpackages", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` package { default_visibility: ["//visibility:private"], }`), - "top/nested/Blueprints": []byte(` + "top/nested/Android.bp": []byte(` package { default_visibility: ["//outsider"], } @@ -1014,11 +1014,11 @@ var visibilityTests = []struct { mock_library { name: "libnested", }`), - "top/other/Blueprints": []byte(` + "top/other/Android.bp": []byte(` mock_library { name: "libother", }`), - "outsider/Blueprints": []byte(` + "outsider/Android.bp": []byte(` mock_library { name: "liboutsider", deps: ["libother", "libnested"], @@ -1032,19 +1032,19 @@ var visibilityTests = []struct { { name: "verify that prebuilt dependencies are ignored for visibility reasons (not preferred)", fs: MockFS{ - "prebuilts/Blueprints": []byte(` + "prebuilts/Android.bp": []byte(` prebuilt { name: "module", visibility: ["//top/other"], }`), "top/sources/source_file": nil, - "top/sources/Blueprints": []byte(` + "top/sources/Android.bp": []byte(` source { name: "module", visibility: ["//top/other"], }`), "top/other/source_file": nil, - "top/other/Blueprints": []byte(` + "top/other/Android.bp": []byte(` source { name: "other", deps: [":module"], @@ -1054,20 +1054,20 @@ var visibilityTests = []struct { { name: "verify that prebuilt dependencies are ignored for visibility reasons (preferred)", fs: MockFS{ - "prebuilts/Blueprints": []byte(` + "prebuilts/Android.bp": []byte(` prebuilt { name: "module", visibility: ["//top/other"], prefer: true, }`), "top/sources/source_file": nil, - "top/sources/Blueprints": []byte(` + "top/sources/Android.bp": []byte(` source { name: "module", visibility: ["//top/other"], }`), "top/other/source_file": nil, - "top/other/Blueprints": []byte(` + "top/other/Android.bp": []byte(` source { name: "other", deps: [":module"], @@ -1077,7 +1077,7 @@ var visibilityTests = []struct { { name: "ensure visibility properties are checked for correctness", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_parent { name: "parent", visibility: ["//top/nested"], @@ -1094,7 +1094,7 @@ var visibilityTests = []struct { { name: "invalid visibility added to child detected during gather phase", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_parent { name: "parent", visibility: ["//top/nested"], @@ -1116,7 +1116,7 @@ var visibilityTests = []struct { { name: "automatic visibility inheritance enabled", fs: MockFS{ - "top/Blueprints": []byte(` + "top/Android.bp": []byte(` mock_parent { name: "parent", visibility: ["//top/nested"], @@ -1125,12 +1125,12 @@ var visibilityTests = []struct { visibility: ["//top/other"], }, }`), - "top/nested/Blueprints": []byte(` + "top/nested/Android.bp": []byte(` mock_library { name: "libnested", deps: ["libchild"], }`), - "top/other/Blueprints": []byte(` + "top/other/Android.bp": []byte(` mock_library { name: "libother", deps: ["libchild"], diff --git a/bpfix/cmd_lib/bpfix.go b/bpfix/cmd_lib/bpfix.go index f90f65be6..1106d4af7 100644 --- a/bpfix/cmd_lib/bpfix.go +++ b/bpfix/cmd_lib/bpfix.go @@ -114,7 +114,7 @@ func processFile(filename string, in io.Reader, out io.Writer, fixRequest bpfix. func makeFileVisitor(fixRequest bpfix.FixRequest) func(string, os.FileInfo, error) error { return func(path string, f os.FileInfo, err error) error { - if err == nil && (f.Name() == "Blueprints" || f.Name() == "Android.bp") { + if err == nil && f.Name() == "Android.bp" { err = openAndProcess(path, os.Stdout, fixRequest) } if err != nil { diff --git a/cc/test_data_test.go b/cc/test_data_test.go index 426dfc57c..a62116677 100644 --- a/cc/test_data_test.go +++ b/cc/test_data_test.go @@ -127,7 +127,7 @@ func TestDataTests(t *testing.T) { ctx.RegisterModuleType("test", newTest) ctx.Register() - _, errs := ctx.ParseBlueprintsFiles("Blueprints") + _, errs := ctx.ParseBlueprintsFiles("Android.bp") android.FailIfErrored(t, errs) _, errs = ctx.PrepareBuildActions(config) android.FailIfErrored(t, errs) diff --git a/ui/build/finder.go b/ui/build/finder.go index 09d53cc1e..8f74969fb 100644 --- a/ui/build/finder.go +++ b/ui/build/finder.go @@ -15,15 +15,16 @@ package build import ( - "android/soong/finder" - "android/soong/finder/fs" - "android/soong/ui/logger" "bytes" "io/ioutil" "os" "path/filepath" "strings" + "android/soong/finder" + "android/soong/finder/fs" + "android/soong/ui/logger" + "android/soong/ui/metrics" ) @@ -72,8 +73,6 @@ func NewSourceFinder(ctx Context, config Config) (f *finder.Finder) { "AndroidProducts.mk", // General Soong build definitions, using the Blueprint syntax. "Android.bp", - // build/blueprint build definitions, using the Blueprint syntax. - "Blueprints", // Bazel build definitions. "BUILD.bazel", // Bazel build definitions. @@ -165,8 +164,6 @@ func FindSources(ctx Context, config Config, f *finder.Finder) { // Recursively look for all Android.bp files androidBps := f.FindNamedAt(".", "Android.bp") - // The files are named "Blueprints" only in the build/blueprint directory. - androidBps = append(androidBps, f.FindNamedAt("build/blueprint", "Blueprints")...) if len(androidBps) == 0 { ctx.Fatalf("No Android.bp found") }