diff options
Diffstat (limited to 'java')
-rw-r--r-- | java/base.go | 5 | ||||
-rw-r--r-- | java/java_test.go | 31 |
2 files changed, 36 insertions, 0 deletions
diff --git a/java/base.go b/java/base.go index dd02ef8af..78c8d6011 100644 --- a/java/base.go +++ b/java/base.go @@ -79,6 +79,9 @@ type CommonProperties struct { // list of java libraries that will be compiled into the resulting jar Static_libs []string `android:"arch_variant"` + // list of java libraries that should not be used to build this module + Exclude_static_libs []string `android:"arch_variant"` + // manifest file to be included in resulting jar Manifest *string `android:"path"` @@ -724,6 +727,8 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) { } libDeps := ctx.AddVariationDependencies(nil, libTag, j.properties.Libs...) + + j.properties.Static_libs = android.RemoveListFromList(j.properties.Static_libs, j.properties.Exclude_static_libs) ctx.AddVariationDependencies(nil, staticLibTag, j.properties.Static_libs...) // Add dependency on libraries that provide additional hidden api annotations. diff --git a/java/java_test.go b/java/java_test.go index cd5c343ce..561b187d0 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -2322,3 +2322,34 @@ java_test_host { t.Errorf("Expected args[\"extraTestRunnerConfigs\"] to equal %q, was %q", expected, args["extraTestRunnerConfigs"]) } } + +func TestJavaExcludeStaticLib(t *testing.T) { + ctx, _ := testJava(t, ` + java_library { + name: "bar", + } + java_library { + name: "foo", + } + java_library { + name: "baz", + static_libs: [ + "foo", + "bar", + ], + exclude_static_libs: [ + "bar", + ], + } + `) + + // "bar" not included as dependency of "baz" + CheckModuleDependencies(t, ctx, "baz", "android_common", []string{ + `core-lambda-stubs`, + `ext`, + `foo`, + `framework`, + `stable-core-platform-api-stubs-system-modules`, + `stable.core.platform.api.stubs`, + }) +} |