summaryrefslogtreecommitdiff
path: root/java/java_test.go
diff options
context:
space:
mode:
author Jihoon Kang <jihoonkang@google.com> 2023-09-20 23:03:01 +0000
committer Jihoon Kang <jihoonkang@google.com> 2023-09-21 21:02:39 +0000
commit6be0f00671e39a8b744a10bd1d0c91dc8724d4b2 (patch)
treefcef0b35e94f8d297e9d9da278b24ce60d751c08 /java/java_test.go
parentc0f7bd1a152a5f1c431adefc2a2d853716b4bf24 (diff)
Remove api_files property from java_api_library
java_api_contribution provides api_surface information, but files directly passed to java_api_library do not possess such information. Currently, the api surface is assumed via naming convention for api files passed via api_files property, but this is fragile. This change removes the api_files property from java_api_library and enforce all api files to be passed via java_api_contribution Test: m nothing --build-from-text-stub Bug: 300964421 Change-Id: If01d9ed978fe469d4ee0d685582a51629ebecc56
Diffstat (limited to 'java/java_test.go')
-rw-r--r--java/java_test.go29
1 files changed, 2 insertions, 27 deletions
diff --git a/java/java_test.go b/java/java_test.go
index 2ee05ec73..ec6be5c48 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -1885,7 +1885,6 @@ func TestJavaApiLibraryAndProviderLink(t *testing.T) {
name: "bar2",
api_surface: "system",
api_contributions: ["foo1", "foo2"],
- api_files: ["api1/current.txt", "api2/current.txt"]
}
`,
map[string][]byte{
@@ -1903,7 +1902,7 @@ func TestJavaApiLibraryAndProviderLink(t *testing.T) {
},
{
moduleName: "bar2",
- sourceTextFileDirs: []string{"a/current.txt", "b/current.txt", "api1/current.txt", "api2/current.txt"},
+ sourceTextFileDirs: []string{"a/current.txt", "b/current.txt"},
},
}
for _, c := range testcases {
@@ -1975,7 +1974,6 @@ func TestJavaApiLibraryAndDefaultsLink(t *testing.T) {
api_surface: "system",
defaults:["baz1", "baz2"],
api_contributions: ["foo4"],
- api_files: ["api1/current.txt", "api2/current.txt"]
}
`,
map[string][]byte{
@@ -2000,7 +1998,7 @@ func TestJavaApiLibraryAndDefaultsLink(t *testing.T) {
{
moduleName: "bar3",
// API text files need to be sorted from the narrower api scope to the wider api scope
- sourceTextFileDirs: []string{"a/current.txt", "b/current.txt", "api1/current.txt", "api2/current.txt", "c/system-current.txt", "d/system-current.txt"},
+ sourceTextFileDirs: []string{"a/current.txt", "b/current.txt", "c/system-current.txt", "d/system-current.txt"},
},
}
for _, c := range testcases {
@@ -2265,29 +2263,6 @@ func TestJavaApiLibraryFullApiSurfaceStub(t *testing.T) {
android.AssertStringDoesContain(t, "Command expected to contain full_api_surface_stub output jar", manifestCommand, "lib1.jar")
}
-func TestJavaApiLibraryFilegroupInput(t *testing.T) {
- ctx, _ := testJavaWithFS(t, `
- filegroup {
- name: "default_current.txt",
- srcs: ["current.txt"],
- }
-
- java_api_library {
- name: "foo",
- api_files: [":default_current.txt"],
- }
- `,
- map[string][]byte{
- "current.txt": nil,
- })
-
- m := ctx.ModuleForTests("foo", "android_common")
- outputs := fmt.Sprint(m.AllOutputs())
- if !strings.Contains(outputs, "foo/foo.jar") {
- t.Errorf("Module output does not contain expected jar %s", "foo/foo.jar")
- }
-}
-
func TestTradefedOptions(t *testing.T) {
result := PrepareForTestWithJavaBuildComponents.RunTestWithBp(t, `
java_test_host {