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

Commit 49a9bfd8 authored by Cole Faust's avatar Cole Faust Committed by Gerrit Code Review
Browse files

Merge "Add system-server sdk type to droidstubs"

parents bf5697e2 051fa915
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ import (
)

// The values allowed for Droidstubs' Api_levels_sdk_type
var allowedApiLevelSdkTypes = []string{"public", "system", "module-lib"}
var allowedApiLevelSdkTypes = []string{"public", "system", "module-lib", "system-server"}

func init() {
	RegisterStubsBuildComponents(android.InitRegistrationContext)
@@ -134,7 +134,7 @@ type DroidstubsProperties struct {
	// the dirs which Metalava extracts API levels annotations from.
	Api_levels_annotations_dirs []string

	// the sdk kind which Metalava extracts API levels annotations from. Supports 'public', 'system' and 'module-lib' for now; defaults to public.
	// the sdk kind which Metalava extracts API levels annotations from. Supports 'public', 'system', 'module-lib' and 'system-server'; defaults to public.
	Api_levels_sdk_type *string

	// the filename which Metalava extracts API levels annotations from. Defaults to android.jar.
@@ -445,6 +445,8 @@ func (d *Droidstubs) apiLevelsGenerationFlags(ctx android.ModuleContext, cmd *an
	// for older releases. Similarly, module-lib falls back to system API.
	var sdkDirs []string
	switch proptools.StringDefault(d.properties.Api_levels_sdk_type, "public") {
	case "system-server":
		sdkDirs = []string{"system-server", "module-lib", "system", "public"}
	case "module-lib":
		sdkDirs = []string{"module-lib", "system", "public"}
	case "system":
+16 −1
Original line number Diff line number Diff line
@@ -169,6 +169,21 @@ func TestModuleLibDroidstubs(t *testing.T) {
	}, patterns)
}

func TestSystemServerDroidstubs(t *testing.T) {
	patterns := getAndroidJarPatternsForDroidstubs(t, "system-server")

	android.AssertArrayString(t, "order of patterns", []string{
		"--android-jar-pattern somedir/%/system-server/android.jar",
		"--android-jar-pattern someotherdir/%/system-server/android.jar",
		"--android-jar-pattern somedir/%/module-lib/android.jar",
		"--android-jar-pattern someotherdir/%/module-lib/android.jar",
		"--android-jar-pattern somedir/%/system/android.jar",
		"--android-jar-pattern someotherdir/%/system/android.jar",
		"--android-jar-pattern somedir/%/public/android.jar",
		"--android-jar-pattern someotherdir/%/public/android.jar",
	}, patterns)
}

func TestDroidstubsSandbox(t *testing.T) {
	ctx, _ := testJavaWithFS(t, `
		genrule {