Merge "Ensure consistent APEX variation for java_sdk_library and java_sdk_library_import"
This commit is contained in:
@@ -684,6 +684,15 @@ func (c *commonToSdkLibraryAndImport) initCommonAfterDefaultsApplied(ctx android
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// uniqueApexVariations provides common implementation of the ApexModule.UniqueApexVariations
|
||||||
|
// method.
|
||||||
|
func (c *commonToSdkLibraryAndImport) uniqueApexVariations() bool {
|
||||||
|
// A java_sdk_library that is a shared library produces an XML file that makes the shared library
|
||||||
|
// usable from an AndroidManifest.xml's <uses-library> entry. That XML file contains the name of
|
||||||
|
// the APEX and so it needs a unique variation per APEX.
|
||||||
|
return c.sharedLibrary()
|
||||||
|
}
|
||||||
|
|
||||||
func (c *commonToSdkLibraryAndImport) generateCommonBuildActions(ctx android.ModuleContext) {
|
func (c *commonToSdkLibraryAndImport) generateCommonBuildActions(ctx android.ModuleContext) {
|
||||||
c.doctagPaths = android.PathsForModuleSrc(ctx, c.commonSdkLibraryProperties.Doctag_files)
|
c.doctagPaths = android.PathsForModuleSrc(ctx, c.commonSdkLibraryProperties.Doctag_files)
|
||||||
}
|
}
|
||||||
@@ -1528,6 +1537,7 @@ func (module *SdkLibrary) createStubsSourcesAndApi(mctx android.DefaultableHookC
|
|||||||
mctx.CreateModule(DroidstubsFactory, &props)
|
mctx.CreateModule(DroidstubsFactory, &props)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Implements android.ApexModule
|
||||||
func (module *SdkLibrary) DepIsInSameApex(mctx android.BaseModuleContext, dep android.Module) bool {
|
func (module *SdkLibrary) DepIsInSameApex(mctx android.BaseModuleContext, dep android.Module) bool {
|
||||||
depTag := mctx.OtherModuleDependencyTag(dep)
|
depTag := mctx.OtherModuleDependencyTag(dep)
|
||||||
if depTag == xmlPermissionsFileTag {
|
if depTag == xmlPermissionsFileTag {
|
||||||
@@ -1536,6 +1546,11 @@ func (module *SdkLibrary) DepIsInSameApex(mctx android.BaseModuleContext, dep an
|
|||||||
return module.Library.DepIsInSameApex(mctx, dep)
|
return module.Library.DepIsInSameApex(mctx, dep)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Implements android.ApexModule
|
||||||
|
func (module *SdkLibrary) UniqueApexVariations() bool {
|
||||||
|
return module.uniqueApexVariations()
|
||||||
|
}
|
||||||
|
|
||||||
// Creates the xml file that publicizes the runtime library
|
// Creates the xml file that publicizes the runtime library
|
||||||
func (module *SdkLibrary) createXmlFile(mctx android.DefaultableHookContext) {
|
func (module *SdkLibrary) createXmlFile(mctx android.DefaultableHookContext) {
|
||||||
props := struct {
|
props := struct {
|
||||||
@@ -2090,6 +2105,11 @@ func (module *SdkLibraryImport) ShouldSupportSdkVersion(ctx android.BaseModuleCo
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Implements android.ApexModule
|
||||||
|
func (module *SdkLibraryImport) UniqueApexVariations() bool {
|
||||||
|
return module.uniqueApexVariations()
|
||||||
|
}
|
||||||
|
|
||||||
func (module *SdkLibraryImport) OutputFiles(tag string) (android.Paths, error) {
|
func (module *SdkLibraryImport) OutputFiles(tag string) (android.Paths, error) {
|
||||||
return module.commonOutputFiles(tag)
|
return module.commonOutputFiles(tag)
|
||||||
}
|
}
|
||||||
|
@@ -273,7 +273,7 @@ func TestSnapshotWithBootClasspathFragment_Contents(t *testing.T) {
|
|||||||
name: "myothersdklibrary",
|
name: "myothersdklibrary",
|
||||||
apex_available: ["myapex"],
|
apex_available: ["myapex"],
|
||||||
srcs: ["Test.java"],
|
srcs: ["Test.java"],
|
||||||
shared_library: false,
|
compile_dex: true,
|
||||||
public: {enabled: true},
|
public: {enabled: true},
|
||||||
min_sdk_version: "2",
|
min_sdk_version: "2",
|
||||||
permitted_packages: ["myothersdklibrary"],
|
permitted_packages: ["myothersdklibrary"],
|
||||||
@@ -283,7 +283,7 @@ func TestSnapshotWithBootClasspathFragment_Contents(t *testing.T) {
|
|||||||
name: "mycoreplatform",
|
name: "mycoreplatform",
|
||||||
apex_available: ["myapex"],
|
apex_available: ["myapex"],
|
||||||
srcs: ["Test.java"],
|
srcs: ["Test.java"],
|
||||||
shared_library: false,
|
compile_dex: true,
|
||||||
public: {enabled: true},
|
public: {enabled: true},
|
||||||
min_sdk_version: "2",
|
min_sdk_version: "2",
|
||||||
}
|
}
|
||||||
@@ -334,7 +334,8 @@ java_sdk_library_import {
|
|||||||
prefer: false,
|
prefer: false,
|
||||||
visibility: ["//visibility:public"],
|
visibility: ["//visibility:public"],
|
||||||
apex_available: ["myapex"],
|
apex_available: ["myapex"],
|
||||||
shared_library: false,
|
shared_library: true,
|
||||||
|
compile_dex: true,
|
||||||
public: {
|
public: {
|
||||||
jars: ["sdk_library/public/myothersdklibrary-stubs.jar"],
|
jars: ["sdk_library/public/myothersdklibrary-stubs.jar"],
|
||||||
stub_srcs: ["sdk_library/public/myothersdklibrary_stub_sources"],
|
stub_srcs: ["sdk_library/public/myothersdklibrary_stub_sources"],
|
||||||
@@ -364,7 +365,8 @@ java_sdk_library_import {
|
|||||||
prefer: false,
|
prefer: false,
|
||||||
visibility: ["//visibility:public"],
|
visibility: ["//visibility:public"],
|
||||||
apex_available: ["myapex"],
|
apex_available: ["myapex"],
|
||||||
shared_library: false,
|
shared_library: true,
|
||||||
|
compile_dex: true,
|
||||||
public: {
|
public: {
|
||||||
jars: ["sdk_library/public/mycoreplatform-stubs.jar"],
|
jars: ["sdk_library/public/mycoreplatform-stubs.jar"],
|
||||||
stub_srcs: ["sdk_library/public/mycoreplatform_stub_sources"],
|
stub_srcs: ["sdk_library/public/mycoreplatform_stub_sources"],
|
||||||
@@ -414,7 +416,8 @@ java_sdk_library_import {
|
|||||||
sdk_member_name: "myothersdklibrary",
|
sdk_member_name: "myothersdklibrary",
|
||||||
visibility: ["//visibility:public"],
|
visibility: ["//visibility:public"],
|
||||||
apex_available: ["myapex"],
|
apex_available: ["myapex"],
|
||||||
shared_library: false,
|
shared_library: true,
|
||||||
|
compile_dex: true,
|
||||||
public: {
|
public: {
|
||||||
jars: ["sdk_library/public/myothersdklibrary-stubs.jar"],
|
jars: ["sdk_library/public/myothersdklibrary-stubs.jar"],
|
||||||
stub_srcs: ["sdk_library/public/myothersdklibrary_stub_sources"],
|
stub_srcs: ["sdk_library/public/myothersdklibrary_stub_sources"],
|
||||||
@@ -444,7 +447,8 @@ java_sdk_library_import {
|
|||||||
sdk_member_name: "mycoreplatform",
|
sdk_member_name: "mycoreplatform",
|
||||||
visibility: ["//visibility:public"],
|
visibility: ["//visibility:public"],
|
||||||
apex_available: ["myapex"],
|
apex_available: ["myapex"],
|
||||||
shared_library: false,
|
shared_library: true,
|
||||||
|
compile_dex: true,
|
||||||
public: {
|
public: {
|
||||||
jars: ["sdk_library/public/mycoreplatform-stubs.jar"],
|
jars: ["sdk_library/public/mycoreplatform-stubs.jar"],
|
||||||
stub_srcs: ["sdk_library/public/mycoreplatform_stub_sources"],
|
stub_srcs: ["sdk_library/public/mycoreplatform_stub_sources"],
|
||||||
|
Reference in New Issue
Block a user