Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 399dbe06 authored by Lukács T. Berki's avatar Lukács T. Berki Committed by Gerrit Code Review
Browse files

Merge "Do not modules in files called "Blueprints"."

parents e267bc8f b838b0a1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -552,7 +552,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)
		}
	}
+9 −9
Original line number Diff line number Diff line
@@ -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"],
+17 −17
Original line number Diff line number Diff line
@@ -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"],
				}`),
+27 −27
Original line number Diff line number Diff line
@@ -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"],
+8 −8
Original line number Diff line number Diff line
@@ -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"],
Loading