Merge "java_sdk_library: construct droidstubs args as []string"
diff --git a/android/sdk.go b/android/sdk.go
index 7956434..9e6ad16 100644
--- a/android/sdk.go
+++ b/android/sdk.go
@@ -237,6 +237,9 @@
// The name of the member type property on an sdk module.
SdkPropertyName() string
+ // True if the member type supports the sdk/sdk_snapshot, false otherwise.
+ UsableWithSdkAndSdkSnapshot() bool
+
// Add dependencies from the SDK module to all the variants the member
// contributes to the SDK. The exact set of variants required is determined
// by the SDK and its properties. The dependencies must be added with the
@@ -262,14 +265,20 @@
BuildSnapshot(sdkModuleContext ModuleContext, builder SnapshotBuilder, member SdkMember)
}
+// Base type for SdkMemberType implementations.
type SdkMemberTypeBase struct {
PropertyName string
+ SupportsSdk bool
}
func (b *SdkMemberTypeBase) SdkPropertyName() string {
return b.PropertyName
}
+func (b *SdkMemberTypeBase) UsableWithSdkAndSdkSnapshot() bool {
+ return b.SupportsSdk
+}
+
// Encapsulates the information about registered SdkMemberTypes.
type SdkMemberTypesRegistry struct {
// The list of types sorted by property name.
@@ -279,22 +288,8 @@
key OnceKey
}
-func (r *SdkMemberTypesRegistry) RegisteredTypes() []SdkMemberType {
- return r.list
-}
-
-func (r *SdkMemberTypesRegistry) UniqueOnceKey() OnceKey {
- // Use the pointer to the registry as the unique key.
- return NewCustomOnceKey(r)
-}
-
-// The set of registered SdkMemberTypes.
-var SdkMemberTypes = &SdkMemberTypesRegistry{}
-
-// Register an SdkMemberType object to allow them to be used in the sdk and sdk_snapshot module
-// types.
-func RegisterSdkMemberType(memberType SdkMemberType) {
- oldList := SdkMemberTypes.list
+func (r *SdkMemberTypesRegistry) copyAndAppend(memberType SdkMemberType) *SdkMemberTypesRegistry {
+ oldList := r.list
// Copy the slice just in case this is being read while being modified, e.g. when testing.
list := make([]SdkMemberType, 0, len(oldList)+1)
@@ -319,8 +314,33 @@
key := NewOnceKey(strings.Join(properties, "|"))
// Create a new registry so the pointer uniquely identifies the set of registered types.
- SdkMemberTypes = &SdkMemberTypesRegistry{
+ return &SdkMemberTypesRegistry{
list: list,
key: key,
}
}
+
+func (r *SdkMemberTypesRegistry) RegisteredTypes() []SdkMemberType {
+ return r.list
+}
+
+func (r *SdkMemberTypesRegistry) UniqueOnceKey() OnceKey {
+ // Use the pointer to the registry as the unique key.
+ return NewCustomOnceKey(r)
+}
+
+// The set of registered SdkMemberTypes, one for sdk module and one for module_exports.
+var ModuleExportsMemberTypes = &SdkMemberTypesRegistry{}
+var SdkMemberTypes = &SdkMemberTypesRegistry{}
+
+// Register an SdkMemberType object to allow them to be used in the sdk and sdk_snapshot module
+// types.
+func RegisterSdkMemberType(memberType SdkMemberType) {
+ // All member types are usable with module_exports.
+ ModuleExportsMemberTypes = ModuleExportsMemberTypes.copyAndAppend(memberType)
+
+ // Only those that explicitly indicate it are usable with sdk.
+ if memberType.UsableWithSdkAndSdkSnapshot() {
+ SdkMemberTypes = SdkMemberTypes.copyAndAppend(memberType)
+ }
+}
diff --git a/cc/library_sdk_member.go b/cc/library_sdk_member.go
index 2c18e68..fd5a4da 100644
--- a/cc/library_sdk_member.go
+++ b/cc/library_sdk_member.go
@@ -27,6 +27,7 @@
var sharedLibrarySdkMemberType = &librarySdkMemberType{
SdkMemberTypeBase: android.SdkMemberTypeBase{
PropertyName: "native_shared_libs",
+ SupportsSdk: true,
},
prebuiltModuleType: "cc_prebuilt_library_shared",
linkTypes: []string{"shared"},
@@ -35,6 +36,7 @@
var staticLibrarySdkMemberType = &librarySdkMemberType{
SdkMemberTypeBase: android.SdkMemberTypeBase{
PropertyName: "native_static_libs",
+ SupportsSdk: true,
},
prebuiltModuleType: "cc_prebuilt_library_static",
linkTypes: []string{"static"},
diff --git a/java/droiddoc.go b/java/droiddoc.go
index ff3f10a..f62f5f9 100644
--- a/java/droiddoc.go
+++ b/java/droiddoc.go
@@ -34,6 +34,9 @@
android.RegisterSdkMemberType(&droidStubsSdkMemberType{
SdkMemberTypeBase: android.SdkMemberTypeBase{
PropertyName: "stubs_sources",
+ // stubs_sources can be used with sdk to provide the source stubs for APIs provided by
+ // the APEX.
+ SupportsSdk: true,
},
})
}
diff --git a/java/java.go b/java/java.go
index d0bf9d7..a48b5a3 100644
--- a/java/java.go
+++ b/java/java.go
@@ -41,6 +41,7 @@
librarySdkMemberType{
android.SdkMemberTypeBase{
PropertyName: "java_header_libs",
+ SupportsSdk: true,
},
},
})
@@ -52,6 +53,12 @@
},
},
})
+
+ android.RegisterSdkMemberType(&testSdkMemberType{
+ SdkMemberTypeBase: android.SdkMemberTypeBase{
+ PropertyName: "java_tests",
+ },
+ })
}
func RegisterJavaBuildComponents(ctx android.RegistrationContext) {
@@ -65,6 +72,7 @@
ctx.RegisterModuleType("java_test", TestFactory)
ctx.RegisterModuleType("java_test_helper_library", TestHelperLibraryFactory)
ctx.RegisterModuleType("java_test_host", TestHostFactory)
+ ctx.RegisterModuleType("java_test_import", JavaTestImportFactory)
ctx.RegisterModuleType("java_import", ImportFactory)
ctx.RegisterModuleType("java_import_host", ImportFactoryHost)
ctx.RegisterModuleType("java_device_for_host", DeviceForHostFactory)
@@ -1764,14 +1772,19 @@
}
const (
- aidlIncludeDir = "aidl"
- javaDir = "java"
- jarFileSuffix = ".jar"
+ aidlIncludeDir = "aidl"
+ javaDir = "java"
+ jarFileSuffix = ".jar"
+ testConfigSuffix = "-AndroidTest.xml"
)
// path to the jar file of a java library. Relative to <sdk_root>/<api_dir>
-func (j *Library) sdkSnapshotFilePathForJar() string {
- return filepath.Join(javaDir, j.Name()+jarFileSuffix)
+func sdkSnapshotFilePathForJar(member android.SdkMember) string {
+ return sdkSnapshotFilePathForMember(member, jarFileSuffix)
+}
+
+func sdkSnapshotFilePathForMember(member android.SdkMember, suffix string) string {
+ return filepath.Join(javaDir, member.Name()+suffix)
}
type librarySdkMemberType struct {
@@ -1804,7 +1817,7 @@
j := variant.(*Library)
exportedJar := jarToExportGetter(j)
- snapshotRelativeJavaLibPath := j.sdkSnapshotFilePathForJar()
+ snapshotRelativeJavaLibPath := sdkSnapshotFilePathForJar(member)
builder.CopyToSnapshot(exportedJar, snapshotRelativeJavaLibPath)
for _, dir := range j.AidlIncludeDirs() {
@@ -1931,6 +1944,16 @@
Test_suites []string `android:"arch_variant"`
}
+type prebuiltTestProperties struct {
+ // list of compatibility suites (for example "cts", "vts") that the module should be
+ // installed into.
+ Test_suites []string `android:"arch_variant"`
+
+ // the name of the test configuration (for example "AndroidTest.xml") that should be
+ // installed with the module.
+ Test_config *string `android:"path,arch_variant"`
+}
+
type Test struct {
Library
@@ -1946,6 +1969,14 @@
testHelperLibraryProperties testHelperLibraryProperties
}
+type JavaTestImport struct {
+ Import
+
+ prebuiltTestProperties prebuiltTestProperties
+
+ testConfig android.Path
+}
+
func (j *Test) GenerateAndroidBuildActions(ctx android.ModuleContext) {
j.testConfig = tradefed.AutoGenJavaTestConfig(ctx, j.testProperties.Test_config, j.testProperties.Test_config_template,
j.testProperties.Test_suites, j.testProperties.Auto_gen_config)
@@ -1958,6 +1989,53 @@
j.Library.GenerateAndroidBuildActions(ctx)
}
+func (j *JavaTestImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
+ j.testConfig = tradefed.AutoGenJavaTestConfig(ctx, j.prebuiltTestProperties.Test_config, nil,
+ j.prebuiltTestProperties.Test_suites, nil)
+
+ j.Import.GenerateAndroidBuildActions(ctx)
+}
+
+type testSdkMemberType struct {
+ android.SdkMemberTypeBase
+}
+
+func (mt *testSdkMemberType) AddDependencies(mctx android.BottomUpMutatorContext, dependencyTag blueprint.DependencyTag, names []string) {
+ mctx.AddVariationDependencies(nil, dependencyTag, names...)
+}
+
+func (mt *testSdkMemberType) IsInstance(module android.Module) bool {
+ _, ok := module.(*Test)
+ return ok
+}
+
+func (mt *testSdkMemberType) BuildSnapshot(sdkModuleContext android.ModuleContext, builder android.SnapshotBuilder, member android.SdkMember) {
+ variants := member.Variants()
+ if len(variants) != 1 {
+ sdkModuleContext.ModuleErrorf("sdk contains %d variants of member %q but only one is allowed", len(variants), member.Name())
+ for _, variant := range variants {
+ sdkModuleContext.ModuleErrorf(" %q", variant)
+ }
+ }
+ variant := variants[0]
+ j := variant.(*Test)
+
+ implementationJars := j.ImplementationJars()
+ if len(implementationJars) != 1 {
+ panic(fmt.Errorf("there must be only one implementation jar from %q", j.Name()))
+ }
+
+ snapshotRelativeJavaLibPath := sdkSnapshotFilePathForJar(member)
+ builder.CopyToSnapshot(implementationJars[0], snapshotRelativeJavaLibPath)
+
+ snapshotRelativeTestConfigPath := sdkSnapshotFilePathForMember(member, testConfigSuffix)
+ builder.CopyToSnapshot(j.testConfig, snapshotRelativeTestConfigPath)
+
+ module := builder.AddPrebuiltModule(member, "java_test_import")
+ module.AddProperty("jars", []string{snapshotRelativeJavaLibPath})
+ module.AddProperty("test_config", snapshotRelativeTestConfigPath)
+}
+
// java_test builds a and links sources into a `.jar` file for the device, and possibly for the host as well, and
// creates an `AndroidTest.xml` file to allow running the test with `atest` or a `TEST_MAPPING` file.
//
@@ -2001,6 +2079,30 @@
return module
}
+// java_test_import imports one or more `.jar` files into the build graph as if they were built by a java_test module
+// and makes sure that it is added to the appropriate test suite.
+//
+// By default, a java_test_import has a single variant that expects a `.jar` file containing `.class` files that were
+// compiled against an Android classpath.
+//
+// Specifying `host_supported: true` will produce two variants, one for use as a dependency of device modules and one
+// for host modules.
+func JavaTestImportFactory() android.Module {
+ module := &JavaTestImport{}
+
+ module.AddProperties(
+ &module.Import.properties,
+ &module.prebuiltTestProperties)
+
+ module.Import.properties.Installable = proptools.BoolPtr(true)
+
+ android.InitPrebuiltModule(module, &module.properties.Jars)
+ android.InitApexModule(module)
+ android.InitSdkAwareModule(module)
+ InitJavaModule(module, android.HostAndDeviceSupported)
+ return module
+}
+
// java_test_host builds a and links sources into a `.jar` file for the host, and creates an `AndroidTest.xml` file to
// allow running the test with `atest` or a `TEST_MAPPING` file.
//
diff --git a/java/java_test.go b/java/java_test.go
index 2f67cda..30a8ca6 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -486,6 +486,13 @@
name: "stubs-source",
srcs: ["stubs/sources"],
}
+
+ java_test_import {
+ name: "test",
+ jars: ["a.jar"],
+ test_suites: ["cts"],
+ test_config: "AndroidTest.xml",
+ }
`)
fooModule := ctx.ModuleForTests("foo", "android_common")
diff --git a/java/testing.go b/java/testing.go
index e157dd0..ab3af65 100644
--- a/java/testing.go
+++ b/java/testing.go
@@ -34,6 +34,7 @@
"GENRULE_NOTICE": nil,
"LIB_NOTICE": nil,
"TOOL_NOTICE": nil,
+ "AndroidTest.xml": nil,
"java-res/a/a": nil,
"java-res/b/b": nil,
"java-res2/a": nil,
diff --git a/sdk/cc_sdk_test.go b/sdk/cc_sdk_test.go
index f477445..255ac08 100644
--- a/sdk/cc_sdk_test.go
+++ b/sdk/cc_sdk_test.go
@@ -500,8 +500,8 @@
func TestSnapshotWithCcStaticLibrary(t *testing.T) {
result := testSdkWithCc(t, `
- sdk {
- name: "mysdk",
+ module_exports {
+ name: "myexports",
native_static_libs: ["mynativelib"],
}
@@ -520,12 +520,12 @@
}
`)
- result.CheckSnapshot("mysdk", "android_common", "",
+ result.CheckSnapshot("myexports", "android_common", "",
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_library_static {
- name: "mysdk_mynativelib@current",
+ name: "myexports_mynativelib@current",
sdk_member_name: "mynativelib",
export_include_dirs: ["include/include"],
arch: {
@@ -560,9 +560,9 @@
system_shared_libs: [],
}
-sdk_snapshot {
- name: "mysdk@current",
- native_static_libs: ["mysdk_mynativelib@current"],
+module_exports_snapshot {
+ name: "myexports@current",
+ native_static_libs: ["myexports_mynativelib@current"],
}
`),
checkAllCopyRules(`
@@ -584,8 +584,8 @@
SkipIfNotLinux(t)
result := testSdkWithCc(t, `
- sdk {
- name: "mysdk",
+ module_exports {
+ name: "myexports",
device_supported: false,
host_supported: true,
native_static_libs: ["mynativelib"],
@@ -608,12 +608,12 @@
}
`)
- result.CheckSnapshot("mysdk", "linux_glibc_common", "",
+ result.CheckSnapshot("myexports", "linux_glibc_common", "",
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_library_static {
- name: "mysdk_mynativelib@current",
+ name: "myexports_mynativelib@current",
sdk_member_name: "mynativelib",
device_supported: false,
host_supported: true,
@@ -652,11 +652,11 @@
system_shared_libs: [],
}
-sdk_snapshot {
- name: "mysdk@current",
+module_exports_snapshot {
+ name: "myexports@current",
device_supported: false,
host_supported: true,
- native_static_libs: ["mysdk_mynativelib@current"],
+ native_static_libs: ["myexports_mynativelib@current"],
}
`),
checkAllCopyRules(`
diff --git a/sdk/exports.go b/sdk/exports.go
index c882462..d313057 100644
--- a/sdk/exports.go
+++ b/sdk/exports.go
@@ -24,16 +24,13 @@
// module_exports defines the exports of a mainline module. The exports are Soong modules
// which are required by Soong modules that are not part of the mainline module.
func ModuleExportsFactory() android.Module {
- s := newSdkModule()
- s.properties.Module_exports = true
- return s
+ return newSdkModule(true)
}
// module_exports_snapshot is a versioned snapshot of prebuilt versions of all the exports
// of a mainline module.
func ModuleExportsSnapshotsFactory() android.Module {
- s := newSdkModule()
+ s := newSdkModule(true)
s.properties.Snapshot = true
- s.properties.Module_exports = true
return s
}
diff --git a/sdk/java_sdk_test.go b/sdk/java_sdk_test.go
index 1aa9184..218a16a 100644
--- a/sdk/java_sdk_test.go
+++ b/sdk/java_sdk_test.go
@@ -214,8 +214,8 @@
func TestSnapshotWithJavaImplLibrary(t *testing.T) {
result := testSdkWithJava(t, `
- sdk {
- name: "mysdk",
+ module_exports {
+ name: "myexports",
java_libs: ["myjavalib"],
}
@@ -232,12 +232,12 @@
}
`)
- result.CheckSnapshot("mysdk", "android_common", "",
+ result.CheckSnapshot("myexports", "android_common", "",
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
java_import {
- name: "mysdk_myjavalib@current",
+ name: "myexports_myjavalib@current",
sdk_member_name: "myjavalib",
jars: ["java/myjavalib.jar"],
}
@@ -248,9 +248,9 @@
jars: ["java/myjavalib.jar"],
}
-sdk_snapshot {
- name: "mysdk@current",
- java_libs: ["mysdk_myjavalib@current"],
+module_exports_snapshot {
+ name: "myexports@current",
+ java_libs: ["myexports_myjavalib@current"],
}
`),
@@ -266,8 +266,8 @@
SkipIfNotLinux(t)
result := testSdkWithJava(t, `
- sdk {
- name: "mysdk",
+ module_exports {
+ name: "myexports",
device_supported: false,
host_supported: true,
java_libs: ["myjavalib"],
@@ -287,12 +287,12 @@
}
`)
- result.CheckSnapshot("mysdk", "linux_glibc_common", "",
+ result.CheckSnapshot("myexports", "linux_glibc_common", "",
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
java_import {
- name: "mysdk_myjavalib@current",
+ name: "myexports_myjavalib@current",
sdk_member_name: "myjavalib",
device_supported: false,
host_supported: true,
@@ -307,11 +307,11 @@
jars: ["java/myjavalib.jar"],
}
-sdk_snapshot {
- name: "mysdk@current",
+module_exports_snapshot {
+ name: "myexports@current",
device_supported: false,
host_supported: true,
- java_libs: ["mysdk_myjavalib@current"],
+ java_libs: ["myexports_myjavalib@current"],
}
`),
checkAllCopyRules(`
@@ -321,6 +321,112 @@
)
}
+func TestSnapshotWithJavaTest(t *testing.T) {
+ result := testSdkWithJava(t, `
+ module_exports {
+ name: "myexports",
+ java_tests: ["myjavatests"],
+ }
+
+ java_test {
+ name: "myjavatests",
+ srcs: ["Test.java"],
+ system_modules: "none",
+ sdk_version: "none",
+ compile_dex: true,
+ host_supported: true,
+ }
+ `)
+
+ result.CheckSnapshot("myexports", "android_common", "",
+ checkAndroidBpContents(`
+// This is auto-generated. DO NOT EDIT.
+
+java_test_import {
+ name: "myexports_myjavatests@current",
+ sdk_member_name: "myjavatests",
+ jars: ["java/myjavatests.jar"],
+ test_config: "java/myjavatests-AndroidTest.xml",
+}
+
+java_test_import {
+ name: "myjavatests",
+ prefer: false,
+ jars: ["java/myjavatests.jar"],
+ test_config: "java/myjavatests-AndroidTest.xml",
+}
+
+module_exports_snapshot {
+ name: "myexports@current",
+ java_tests: ["myexports_myjavatests@current"],
+}
+`),
+ checkAllCopyRules(`
+.intermediates/myjavatests/android_common/javac/myjavatests.jar -> java/myjavatests.jar
+.intermediates/myjavatests/android_common/myjavatests.config -> java/myjavatests-AndroidTest.xml
+`),
+ )
+}
+
+func TestHostSnapshotWithJavaTest(t *testing.T) {
+ // b/145598135 - Generating host snapshots for anything other than linux is not supported.
+ SkipIfNotLinux(t)
+
+ result := testSdkWithJava(t, `
+ module_exports {
+ name: "myexports",
+ device_supported: false,
+ host_supported: true,
+ java_tests: ["myjavatests"],
+ }
+
+ java_test {
+ name: "myjavatests",
+ device_supported: false,
+ host_supported: true,
+ srcs: ["Test.java"],
+ system_modules: "none",
+ sdk_version: "none",
+ compile_dex: true,
+ }
+ `)
+
+ result.CheckSnapshot("myexports", "linux_glibc_common", "",
+ checkAndroidBpContents(`
+// This is auto-generated. DO NOT EDIT.
+
+java_test_import {
+ name: "myexports_myjavatests@current",
+ sdk_member_name: "myjavatests",
+ device_supported: false,
+ host_supported: true,
+ jars: ["java/myjavatests.jar"],
+ test_config: "java/myjavatests-AndroidTest.xml",
+}
+
+java_test_import {
+ name: "myjavatests",
+ prefer: false,
+ device_supported: false,
+ host_supported: true,
+ jars: ["java/myjavatests.jar"],
+ test_config: "java/myjavatests-AndroidTest.xml",
+}
+
+module_exports_snapshot {
+ name: "myexports@current",
+ device_supported: false,
+ host_supported: true,
+ java_tests: ["myexports_myjavatests@current"],
+}
+`),
+ checkAllCopyRules(`
+.intermediates/myjavatests/linux_glibc_common/javac/myjavatests.jar -> java/myjavatests.jar
+.intermediates/myjavatests/linux_glibc_common/myjavatests.config -> java/myjavatests-AndroidTest.xml
+`),
+ )
+}
+
func testSdkWithDroidstubs(t *testing.T, bp string) *testSdkResult {
t.Helper()
@@ -366,8 +472,8 @@
func TestSnapshotWithDroidstubs(t *testing.T) {
result := testSdkWithDroidstubs(t, `
- sdk {
- name: "mysdk",
+ module_exports {
+ name: "myexports",
stubs_sources: ["myjavaapistubs"],
}
@@ -379,12 +485,12 @@
}
`)
- result.CheckSnapshot("mysdk", "android_common", "",
+ result.CheckSnapshot("myexports", "android_common", "",
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
prebuilt_stubs_sources {
- name: "mysdk_myjavaapistubs@current",
+ name: "myexports_myjavaapistubs@current",
sdk_member_name: "myjavaapistubs",
srcs: ["java/myjavaapistubs_stubs_sources"],
}
@@ -395,14 +501,14 @@
srcs: ["java/myjavaapistubs_stubs_sources"],
}
-sdk_snapshot {
- name: "mysdk@current",
- stubs_sources: ["mysdk_myjavaapistubs@current"],
+module_exports_snapshot {
+ name: "myexports@current",
+ stubs_sources: ["myexports_myjavaapistubs@current"],
}
`),
checkAllCopyRules(""),
- checkMergeZip(".intermediates/mysdk/android_common/tmp/java/myjavaapistubs_stubs_sources.zip"),
+ checkMergeZip(".intermediates/myexports/android_common/tmp/java/myjavaapistubs_stubs_sources.zip"),
)
}
@@ -411,8 +517,8 @@
SkipIfNotLinux(t)
result := testSdkWithDroidstubs(t, `
- sdk {
- name: "mysdk",
+ module_exports {
+ name: "myexports",
device_supported: false,
host_supported: true,
stubs_sources: ["myjavaapistubs"],
@@ -428,12 +534,12 @@
}
`)
- result.CheckSnapshot("mysdk", "linux_glibc_common", "",
+ result.CheckSnapshot("myexports", "linux_glibc_common", "",
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
prebuilt_stubs_sources {
- name: "mysdk_myjavaapistubs@current",
+ name: "myexports_myjavaapistubs@current",
sdk_member_name: "myjavaapistubs",
device_supported: false,
host_supported: true,
@@ -448,14 +554,14 @@
srcs: ["java/myjavaapistubs_stubs_sources"],
}
-sdk_snapshot {
- name: "mysdk@current",
+module_exports_snapshot {
+ name: "myexports@current",
device_supported: false,
host_supported: true,
- stubs_sources: ["mysdk_myjavaapistubs@current"],
+ stubs_sources: ["myexports_myjavaapistubs@current"],
}
`),
checkAllCopyRules(""),
- checkMergeZip(".intermediates/mysdk/linux_glibc_common/tmp/java/myjavaapistubs_stubs_sources.zip"),
+ checkMergeZip(".intermediates/myexports/linux_glibc_common/tmp/java/myjavaapistubs_stubs_sources.zip"),
)
}
diff --git a/sdk/sdk.go b/sdk/sdk.go
index 42f5503..44e5cbb 100644
--- a/sdk/sdk.go
+++ b/sdk/sdk.go
@@ -133,6 +133,7 @@
// * a dependency tag that identifies the member type of a resolved dependency.
//
func createDynamicSdkMemberTypes(sdkMemberTypes []android.SdkMemberType) *dynamicSdkMemberTypes {
+
var listProperties []*sdkMemberListProperty
var fields []reflect.StructField
@@ -186,13 +187,20 @@
// sdk defines an SDK which is a logical group of modules (e.g. native libs, headers, java libs, etc.)
// which Mainline modules like APEX can choose to build with.
func SdkModuleFactory() android.Module {
- return newSdkModule()
+ return newSdkModule(false)
}
-func newSdkModule() *sdk {
+func newSdkModule(moduleExports bool) *sdk {
s := &sdk{}
+ s.properties.Module_exports = moduleExports
// Get the dynamic sdk member type data for the currently registered sdk member types.
- s.dynamicSdkMemberTypes = getDynamicSdkMemberTypes(android.SdkMemberTypes)
+ var registry *android.SdkMemberTypesRegistry
+ if moduleExports {
+ registry = android.ModuleExportsMemberTypes
+ } else {
+ registry = android.SdkMemberTypes
+ }
+ s.dynamicSdkMemberTypes = getDynamicSdkMemberTypes(registry)
// Create an instance of the dynamically created struct that contains all the
// properties for the member type specific list properties.
s.dynamicMemberTypeListProperties = s.dynamicSdkMemberTypes.createMemberListProperties()
@@ -211,7 +219,7 @@
// sdk_snapshot is a versioned snapshot of an SDK. This is an auto-generated module.
func SnapshotModuleFactory() android.Module {
- s := newSdkModule()
+ s := newSdkModule(false)
s.properties.Snapshot = true
return s
}