summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/app_set_test.go2
-rw-r--r--java/bootclasspath.go8
-rw-r--r--java/bootclasspath_fragment.go6
-rw-r--r--java/ravenwood.go8
-rw-r--r--java/sdk_library.go4
-rw-r--r--java/sdk_test.go3
6 files changed, 23 insertions, 8 deletions
diff --git a/java/app_set_test.go b/java/app_set_test.go
index 10bc5de92..c02b3593b 100644
--- a/java/app_set_test.go
+++ b/java/app_set_test.go
@@ -56,7 +56,7 @@ func TestAndroidAppSet(t *testing.T) {
mkEntries := android.AndroidMkEntriesForTest(t, result.TestContext, module.Module())[0]
actualInstallFile := mkEntries.EntryMap["LOCAL_APK_SET_INSTALL_FILE"]
expectedInstallFile := []string{
- strings.Replace(params.ImplicitOutputs[0].String(), android.OutSoongDir, result.Config.SoongOutDir(), 1),
+ strings.Replace(params.ImplicitOutputs[0].String(), android.TestOutSoongDir, result.Config.SoongOutDir(), 1),
}
if !reflect.DeepEqual(actualInstallFile, expectedInstallFile) {
t.Errorf("Unexpected LOCAL_APK_SET_INSTALL_FILE value: '%s', expected: '%s',",
diff --git a/java/bootclasspath.go b/java/bootclasspath.go
index 77ddf5c05..029f6f623 100644
--- a/java/bootclasspath.go
+++ b/java/bootclasspath.go
@@ -196,7 +196,7 @@ var platformBootclasspathDepTag = bootclasspathDependencyTag{name: "platform"}
type BootclasspathNestedAPIProperties struct {
// java_library or preferably, java_sdk_library modules providing stub classes that define the
// APIs provided by this bootclasspath_fragment.
- Stub_libs []string
+ Stub_libs proptools.Configurable[[]string]
}
// BootclasspathAPIProperties defines properties for defining the API provided by parts of the
@@ -229,11 +229,11 @@ type BootclasspathAPIProperties struct {
// apiScopeToStubLibs calculates the stub library modules for each relevant *HiddenAPIScope from the
// Stub_libs properties.
-func (p BootclasspathAPIProperties) apiScopeToStubLibs() map[*HiddenAPIScope][]string {
+func (p BootclasspathAPIProperties) apiScopeToStubLibs(ctx android.BaseModuleContext) map[*HiddenAPIScope][]string {
m := map[*HiddenAPIScope][]string{}
for _, apiScope := range hiddenAPISdkLibrarySupportedScopes {
- m[apiScope] = p.Api.Stub_libs
+ m[apiScope] = p.Api.Stub_libs.GetOrDefault(ctx, nil)
}
- m[CorePlatformHiddenAPIScope] = p.Core_platform_api.Stub_libs
+ m[CorePlatformHiddenAPIScope] = p.Core_platform_api.Stub_libs.GetOrDefault(ctx, nil)
return m
}
diff --git a/java/bootclasspath_fragment.go b/java/bootclasspath_fragment.go
index 16209b72e..bce507a7d 100644
--- a/java/bootclasspath_fragment.go
+++ b/java/bootclasspath_fragment.go
@@ -445,7 +445,7 @@ func (b *BootclasspathFragmentModule) ComponentDepsMutator(ctx android.BottomUpM
func (b *BootclasspathFragmentModule) DepsMutator(ctx android.BottomUpMutatorContext) {
// Add dependencies onto all the modules that provide the API stubs for classes on this
// bootclasspath fragment.
- hiddenAPIAddStubLibDependencies(ctx, b.properties.apiScopeToStubLibs())
+ hiddenAPIAddStubLibDependencies(ctx, b.properties.apiScopeToStubLibs(ctx))
for _, additionalStubModule := range b.properties.Additional_stubs {
for _, apiScope := range hiddenAPISdkLibrarySupportedScopes {
@@ -933,8 +933,8 @@ func (b *bootclasspathFragmentSdkMemberProperties) PopulateFromVariant(ctx andro
b.Filtered_flags_path = android.OptionalPathForPath(hiddenAPIInfo.FilteredFlagsPath)
// Copy stub_libs properties.
- b.Stub_libs = module.properties.Api.Stub_libs
- b.Core_platform_stub_libs = module.properties.Core_platform_api.Stub_libs
+ b.Stub_libs = module.properties.Api.Stub_libs.GetOrDefault(mctx, nil)
+ b.Core_platform_stub_libs = module.properties.Core_platform_api.Stub_libs.GetOrDefault(mctx, nil)
// Copy fragment properties.
b.Fragments = module.properties.Fragments
diff --git a/java/ravenwood.go b/java/ravenwood.go
index 84c285cc7..a52f4053f 100644
--- a/java/ravenwood.go
+++ b/java/ravenwood.go
@@ -285,6 +285,14 @@ func (r *ravenwoodLibgroup) GenerateAndroidBuildActions(ctx android.ModuleContex
installPath := android.PathForModuleInstall(ctx, r.BaseModuleName())
for _, lib := range r.ravenwoodLibgroupProperties.Libs {
libModule := ctx.GetDirectDepWithTag(lib, ravenwoodLibContentTag)
+ if libModule == nil {
+ if ctx.Config().AllowMissingDependencies() {
+ ctx.AddMissingDependencies([]string{lib})
+ } else {
+ ctx.PropertyErrorf("lib", "missing dependency %q", lib)
+ }
+ continue
+ }
libJar := android.OutputFileForModule(ctx, libModule, "")
ctx.InstallFile(installPath, lib+".jar", libJar)
}
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 3931456e4..c5f7a1ce0 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -661,6 +661,10 @@ type sdkLibraryProperties struct {
// depend on.
Aconfig_declarations []string
+ // Determines if the module generates the stubs from the api signature files
+ // instead of the source Java files. Defaults to true.
+ Build_from_text_stub *bool
+
// TODO: determines whether to create HTML doc or not
// Html_doc *bool
}
diff --git a/java/sdk_test.go b/java/sdk_test.go
index 9e8ba6ed0..2dac27af1 100644
--- a/java/sdk_test.go
+++ b/java/sdk_test.go
@@ -388,7 +388,9 @@ func TestClasspath(t *testing.T) {
},
}
+ t.Parallel()
t.Run("basic", func(t *testing.T) {
+ t.Parallel()
testClasspathTestCases(t, classpathTestcases, false)
})
@@ -404,6 +406,7 @@ func testClasspathTestCases(t *testing.T, classpathTestcases []classpathTestCase
}
t.Run(testcase.name, func(t *testing.T) {
+ t.Parallel()
moduleType := "java_library"
if testcase.moduleType != "" {
moduleType = testcase.moduleType