diff options
Diffstat (limited to 'java')
| -rw-r--r-- | java/base.go | 2 | ||||
| -rw-r--r-- | java/java.go | 13 | ||||
| -rw-r--r-- | java/java_test.go | 3 | ||||
| -rw-r--r-- | java/robolectric.go | 2 |
4 files changed, 17 insertions, 3 deletions
diff --git a/java/base.go b/java/base.go index 5d2498169..55d77dc4a 100644 --- a/java/base.go +++ b/java/base.go @@ -868,7 +868,7 @@ func (j *Module) aidlFlags(ctx android.ModuleContext, aidlPreprocess android.Opt flags = append(flags, genAidlIncludeFlags(ctx, aidlSrcs, includeDirs)) sdkVersion := (j.SdkVersion(ctx)).Kind - defaultTrace := ((sdkVersion == android.SdkSystemServer) || (sdkVersion == android.SdkCore) || (sdkVersion == android.SdkCorePlatform) || (sdkVersion == android.SdkModule)) + defaultTrace := ((sdkVersion == android.SdkSystemServer) || (sdkVersion == android.SdkCore) || (sdkVersion == android.SdkCorePlatform) || (sdkVersion == android.SdkModule) || (sdkVersion == android.SdkSystem)) if proptools.BoolDefault(j.deviceProperties.Aidl.Generate_traces, defaultTrace) { flags = append(flags, "-t") } diff --git a/java/java.go b/java/java.go index e37a77e46..9dd585062 100644 --- a/java/java.go +++ b/java/java.go @@ -1567,8 +1567,14 @@ type JavaApiLibraryProperties struct { Api_surface *string // list of Java API contribution modules that consists this API surface + // This is a list of Soong modules Api_contributions []string + // list of api.txt files relative to this directory that contribute to the + // API surface. + // This is a list of relative paths + Api_files []string + // List of flags to be passed to the javac compiler to generate jar file Javacflags []string } @@ -1665,6 +1671,13 @@ func (al *ApiLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) { srcFiles = append(srcFiles, android.PathForSource(ctx, provider.ApiFile.String())) }) + // Add the api_files inputs + for _, api := range al.properties.Api_files { + // Use MaybeExistentPathForSource since the api file might not exist during analysis. + // This will be provided by the orchestrator in the combined execution. + srcFiles = append(srcFiles, android.MaybeExistentPathForSource(ctx, ctx.ModuleDir(), api)) + } + cmd := metalavaStubCmd(ctx, rule, srcFiles, homeDir) al.stubsFlags(ctx, cmd, stubsDir) diff --git a/java/java_test.go b/java/java_test.go index ff1578397..dff1fd07f 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -1863,6 +1863,7 @@ 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{ @@ -1880,7 +1881,7 @@ func TestJavaApiLibraryAndProviderLink(t *testing.T) { }, { moduleName: "bar2", - sourceTextFileDirs: []string{"a/foo1.txt", "b/foo2.txt"}, + sourceTextFileDirs: []string{"a/foo1.txt", "b/foo2.txt", "api1/current.txt", "api2/current.txt"}, }, } for _, c := range testcases { diff --git a/java/robolectric.go b/java/robolectric.go index 3a6b4acce..938abe138 100644 --- a/java/robolectric.go +++ b/java/robolectric.go @@ -328,7 +328,7 @@ func (r *robolectricTest) AndroidMkEntries() []android.AndroidMkEntries { func (r *robolectricTest) writeTestRunner(w io.Writer, module, name string, tests []string) { fmt.Fprintln(w, "") - fmt.Fprintln(w, "include $(CLEAR_VARS)") + fmt.Fprintln(w, "include $(CLEAR_VARS)", " # java.robolectricTest") fmt.Fprintln(w, "LOCAL_MODULE :=", name) fmt.Fprintln(w, "LOCAL_JAVA_LIBRARIES :=", module) fmt.Fprintln(w, "LOCAL_JAVA_LIBRARIES += ", strings.Join(r.libs, " ")) |