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

Commit 113bd150 authored by Jooyung Han's avatar Jooyung Han Committed by Gerrit Code Review
Browse files

Merge "Allow libwifi-hal to use makefile_goal"

parents 7071a05c 39cadf9f
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -212,11 +212,16 @@ func createUncompressDexRules() []Rule {
}

func createMakefileGoalRules() []Rule {
	allowlist := []string{
		// libwifi_hal uses makefile_goal for its dependencies
		"frameworks/opt/net/wifi/libwifi_hal",
	}
	return []Rule{
		NeverAllow().
			ModuleType("makefile_goal").
			WithoutMatcher("product_out_path", Regexp("^boot[0-9a-zA-Z.-]*[.]img$")).
			Because("Only boot images may be imported as a makefile goal."),
			NotIn(allowlist...).
			Because("Only boot images may be imported as a makefile goal if not in allowed projects"),
	}
}

+26 −1
Original line number Diff line number Diff line
@@ -324,7 +324,32 @@ var neverallowTests = []struct {
			`),
		},
		expectedErrors: []string{
			"Only boot images may be imported as a makefile goal.",
			"Only boot images.* may be imported as a makefile goal",
		},
	},
	{
		name: "disallowed makefile_goal outside external",
		fs: map[string][]byte{
			"project/Android.bp": []byte(`
				makefile_goal {
					name: "foo",
					product_out_path: "obj/EXE/foo",
				}
			`),
		},
		expectedErrors: []string{
			"not in allowed projects",
		},
	},
	{
		name: "allow makefile_goal within external",
		fs: map[string][]byte{
			"frameworks/opt/net/wifi/libwifi_hal/Android.bp": []byte(`
				makefile_goal {
					name: "foo",
					product_out_path: "obj/EXE/foo",
				}
			`),
		},
	},
	// Tests for the rule prohibiting the use of framework