java_sdk_library: Propagate shared_library to snapshot
Passes the shared_library property through to the snapshot. It does not optimize away the default value in order to make it easier to invert the default value in future. The current default value was only chosen for convenience because most existing usages were already treated as shared libraries. It would be safer if modules had to opt in to be used as shared libraries. Bug: 155164730 Test: m nothing Change-Id: I33c7323f2389b44ed49cebe517ae2cce349117f1
This commit is contained in:
parent
9a37d4a602
commit
d7eb1c2a76
|
@ -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 {
|
||||
|
|
|
@ -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"],
|
||||
|
|
Loading…
Reference in New Issue