diff --git a/java/sdk_library.go b/java/sdk_library.go index 237be1076..b1d608f81 100644 --- a/java/sdk_library.go +++ b/java/sdk_library.go @@ -1987,6 +1987,10 @@ type sdkLibrarySdkMemberProperties struct { // The naming scheme. Naming_scheme *string + + // True if the java_sdk_library_import is for a shared library, false + // otherwise. + Shared_library *bool } type scopeProperties struct { @@ -2021,12 +2025,16 @@ func (s *sdkLibrarySdkMemberProperties) PopulateFromVariant(ctx android.SdkMembe s.Libs = sdk.properties.Libs s.Naming_scheme = sdk.commonSdkLibraryProperties.Naming_scheme + s.Shared_library = proptools.BoolPtr(sdk.sharedLibrary()) } func (s *sdkLibrarySdkMemberProperties) AddToPropertySet(ctx android.SdkMemberContext, propertySet android.BpPropertySet) { if s.Naming_scheme != nil { propertySet.AddProperty("naming_scheme", proptools.String(s.Naming_scheme)) } + if s.Shared_library != nil { + propertySet.AddProperty("shared_library", *s.Shared_library) + } for _, apiScope := range allApiScopes { if properties, ok := s.Scopes[apiScope]; ok { diff --git a/sdk/java_sdk_test.go b/sdk/java_sdk_test.go index bbd638494..f8e9fc163 100644 --- a/sdk/java_sdk_test.go +++ b/sdk/java_sdk_test.go @@ -989,6 +989,7 @@ func TestSnapshotWithJavaSdkLibrary(t *testing.T) { apex_available: ["//apex_available:anyapex"], srcs: ["Test.java"], sdk_version: "current", + shared_library: false, stubs_library_visibility: ["//other"], stubs_source_visibility: ["//another"], } @@ -1002,6 +1003,7 @@ java_sdk_library_import { name: "mysdk_myjavalib@current", sdk_member_name: "myjavalib", apex_available: ["//apex_available:anyapex"], + shared_library: false, public: { jars: ["sdk_library/public/myjavalib-stubs.jar"], stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], @@ -1029,6 +1031,7 @@ java_sdk_library_import { name: "myjavalib", prefer: false, apex_available: ["//apex_available:anyapex"], + shared_library: false, public: { jars: ["sdk_library/public/myjavalib-stubs.jar"], stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], @@ -1097,6 +1100,7 @@ func TestSnapshotWithJavaSdkLibrary_SdkVersion_None(t *testing.T) { java_sdk_library_import { name: "mysdk_myjavalib@current", sdk_member_name: "myjavalib", + shared_library: true, public: { jars: ["sdk_library/public/myjavalib-stubs.jar"], stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], @@ -1109,6 +1113,7 @@ java_sdk_library_import { java_sdk_library_import { name: "myjavalib", prefer: false, + shared_library: true, public: { jars: ["sdk_library/public/myjavalib-stubs.jar"], stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], @@ -1159,6 +1164,7 @@ func TestSnapshotWithJavaSdkLibrary_SdkVersion_ForScope(t *testing.T) { java_sdk_library_import { name: "mysdk_myjavalib@current", sdk_member_name: "myjavalib", + shared_library: true, public: { jars: ["sdk_library/public/myjavalib-stubs.jar"], stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], @@ -1171,6 +1177,7 @@ java_sdk_library_import { java_sdk_library_import { name: "myjavalib", prefer: false, + shared_library: true, public: { jars: ["sdk_library/public/myjavalib-stubs.jar"], stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], @@ -1225,6 +1232,7 @@ java_sdk_library_import { name: "mysdk_myjavalib@current", sdk_member_name: "myjavalib", apex_available: ["//apex_available:anyapex"], + shared_library: true, public: { jars: ["sdk_library/public/myjavalib-stubs.jar"], stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], @@ -1245,6 +1253,7 @@ java_sdk_library_import { name: "myjavalib", prefer: false, apex_available: ["//apex_available:anyapex"], + shared_library: true, public: { jars: ["sdk_library/public/myjavalib-stubs.jar"], stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], @@ -1313,6 +1322,7 @@ java_sdk_library_import { name: "mysdk_myjavalib@current", sdk_member_name: "myjavalib", apex_available: ["//apex_available:anyapex"], + shared_library: true, public: { jars: ["sdk_library/public/myjavalib-stubs.jar"], stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], @@ -1340,6 +1350,7 @@ java_sdk_library_import { name: "myjavalib", prefer: false, apex_available: ["//apex_available:anyapex"], + shared_library: true, public: { jars: ["sdk_library/public/myjavalib-stubs.jar"], stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], @@ -1415,6 +1426,7 @@ java_sdk_library_import { sdk_member_name: "myjavalib", apex_available: ["//apex_available:anyapex"], naming_scheme: "framework-modules", + shared_library: true, public: { jars: ["sdk_library/public/myjavalib-stubs.jar"], stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], @@ -1429,6 +1441,7 @@ java_sdk_library_import { prefer: false, apex_available: ["//apex_available:anyapex"], naming_scheme: "framework-modules", + shared_library: true, public: { jars: ["sdk_library/public/myjavalib-stubs.jar"], stub_srcs: ["sdk_library/public/myjavalib_stub_sources"],