java_sdk_library: Propagate naming_scheme to snapshot
Bug: 155164730
Test: m nothing
Merged-In: Iec7c52d2102b6294540090f3c1e32bd9d8cc7da8
Change-Id: Iec7c52d2102b6294540090f3c1e32bd9d8cc7da8
(cherry picked from commit f7a6433bab
)
This commit is contained in:
parent
57029c07bf
commit
f8e08b20d6
|
@ -1672,6 +1672,9 @@ type sdkLibrarySdkMemberProperties struct {
|
|||
|
||||
// The Java stubs source files.
|
||||
Stub_srcs []string
|
||||
|
||||
// The naming scheme.
|
||||
Naming_scheme *string
|
||||
}
|
||||
|
||||
type scopeProperties struct {
|
||||
|
@ -1701,9 +1704,14 @@ func (s *sdkLibrarySdkMemberProperties) PopulateFromVariant(ctx android.SdkMembe
|
|||
}
|
||||
|
||||
s.Libs = sdk.properties.Libs
|
||||
s.Naming_scheme = sdk.commonProperties.Naming_scheme
|
||||
}
|
||||
|
||||
func (s *sdkLibrarySdkMemberProperties) AddToPropertySet(ctx android.SdkMemberContext, propertySet android.BpPropertySet) {
|
||||
if s.Naming_scheme != nil {
|
||||
propertySet.AddProperty("naming_scheme", proptools.String(s.Naming_scheme))
|
||||
}
|
||||
|
||||
for _, apiScope := range allApiScopes {
|
||||
if properties, ok := s.Scopes[apiScope]; ok {
|
||||
scopeSet := propertySet.AddPropertySet(apiScope.propertyName)
|
||||
|
|
|
@ -1386,3 +1386,70 @@ sdk_snapshot {
|
|||
),
|
||||
)
|
||||
}
|
||||
|
||||
func TestSnapshotWithJavaSdkLibrary_NamingScheme(t *testing.T) {
|
||||
result := testSdkWithJava(t, `
|
||||
sdk {
|
||||
name: "mysdk",
|
||||
java_sdk_libs: ["myjavalib"],
|
||||
}
|
||||
|
||||
java_sdk_library {
|
||||
name: "myjavalib",
|
||||
apex_available: ["//apex_available:anyapex"],
|
||||
srcs: ["Test.java"],
|
||||
sdk_version: "current",
|
||||
naming_scheme: "framework-modules",
|
||||
public: {
|
||||
enabled: true,
|
||||
},
|
||||
}
|
||||
`)
|
||||
|
||||
result.CheckSnapshot("mysdk", "",
|
||||
checkAndroidBpContents(`
|
||||
// This is auto-generated. DO NOT EDIT.
|
||||
|
||||
java_sdk_library_import {
|
||||
name: "mysdk_myjavalib@current",
|
||||
sdk_member_name: "myjavalib",
|
||||
apex_available: ["//apex_available:anyapex"],
|
||||
naming_scheme: "framework-modules",
|
||||
public: {
|
||||
jars: ["sdk_library/public/myjavalib-stubs.jar"],
|
||||
stub_srcs: ["sdk_library/public/myjavalib_stub_sources"],
|
||||
current_api: "sdk_library/public/myjavalib.txt",
|
||||
removed_api: "sdk_library/public/myjavalib-removed.txt",
|
||||
sdk_version: "current",
|
||||
},
|
||||
}
|
||||
|
||||
java_sdk_library_import {
|
||||
name: "myjavalib",
|
||||
prefer: false,
|
||||
apex_available: ["//apex_available:anyapex"],
|
||||
naming_scheme: "framework-modules",
|
||||
public: {
|
||||
jars: ["sdk_library/public/myjavalib-stubs.jar"],
|
||||
stub_srcs: ["sdk_library/public/myjavalib_stub_sources"],
|
||||
current_api: "sdk_library/public/myjavalib.txt",
|
||||
removed_api: "sdk_library/public/myjavalib-removed.txt",
|
||||
sdk_version: "current",
|
||||
},
|
||||
}
|
||||
|
||||
sdk_snapshot {
|
||||
name: "mysdk@current",
|
||||
java_sdk_libs: ["mysdk_myjavalib@current"],
|
||||
}
|
||||
`),
|
||||
checkAllCopyRules(`
|
||||
.intermediates/myjavalib-stubs-publicapi/android_common/javac/myjavalib-stubs-publicapi.jar -> sdk_library/public/myjavalib-stubs.jar
|
||||
.intermediates/myjavalib-stubs-srcs-publicapi/android_common/myjavalib-stubs-srcs-publicapi_api.txt -> sdk_library/public/myjavalib.txt
|
||||
.intermediates/myjavalib-stubs-srcs-publicapi/android_common/myjavalib-stubs-srcs-publicapi_api.txt -> sdk_library/public/myjavalib-removed.txt
|
||||
`),
|
||||
checkMergeZips(
|
||||
".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip",
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue