Loading apex/apex.go +33 −14 Original line number Original line Diff line number Diff line Loading @@ -214,8 +214,11 @@ func makeApexAvailableWhitelist() map[string][]string { "bluetooth-protos-lite", "bluetooth-protos-lite", "bluetooth.mapsapi", "bluetooth.mapsapi", "com.android.vcard", "com.android.vcard", "dnsresolver_aidl_interface-V2-java", "fmtlib", "fmtlib", "guava", "guava", "ipmemorystore-aidl-interfaces-V5-java", "ipmemorystore-aidl-interfaces-java", "internal_include_headers", "internal_include_headers", "lib-bt-packets", "lib-bt-packets", "lib-bt-packets-avrcp", "lib-bt-packets-avrcp", Loading Loading @@ -281,6 +284,12 @@ func makeApexAvailableWhitelist() map[string][]string { "libutils_headers", "libutils_headers", "libz", "libz", "media_plugin_headers", "media_plugin_headers", "net-utils-services-common", "netd_aidl_interface-unstable-java", "netd_event_listener_interface-java", "netlink-client", "networkstack-aidl-interfaces-unstable-java", "networkstack-client", "sap-api-java-static", "sap-api-java-static", "services.net", "services.net", } } Loading @@ -298,6 +307,7 @@ func makeApexAvailableWhitelist() map[string][]string { "libcrypto", "libcrypto", "libnativehelper_header_only", "libnativehelper_header_only", "libssl", "libssl", "unsupportedappusage", } } // // // Module separator // Module separator Loading @@ -321,6 +331,7 @@ func makeApexAvailableWhitelist() map[string][]string { "cronet_impl_platform_java", "cronet_impl_platform_java", "libcronet.80.0.3986.0", "libcronet.80.0.3986.0", "org.chromium.net.cronet", "org.chromium.net.cronet", "org.chromium.net.cronet.xml", "prebuilt_libcronet.80.0.3986.0", "prebuilt_libcronet.80.0.3986.0", } } // // Loading Loading @@ -559,6 +570,7 @@ func makeApexAvailableWhitelist() map[string][]string { "libFLAC-config", "libFLAC-config", "libFLAC-headers", "libFLAC-headers", "libFraunhoferAAC", "libFraunhoferAAC", "libLibGuiProperties", "libarect", "libarect", "libasync_safe", "libasync_safe", "libaudio_system_headers", "libaudio_system_headers", Loading @@ -574,6 +586,7 @@ func makeApexAvailableWhitelist() map[string][]string { "libbase", "libbase", "libbase_headers", "libbase_headers", "libbinder_headers", "libbinder_headers", "libbinderthreadstateutils", "libbluetooth-types-header", "libbluetooth-types-header", "libbufferhub_headers", "libbufferhub_headers", "libc++", "libc++", Loading Loading @@ -776,6 +789,7 @@ func makeApexAvailableWhitelist() map[string][]string { "libdexfile_external_headers", "libdexfile_external_headers", "libdexfile_support", "libdexfile_support", "libdexfile_support_static", "libdexfile_support_static", "libdl_static", "libgtest_prod", "libgtest_prod", "libjemalloc5", "libjemalloc5", "liblinker_main", "liblinker_main", Loading Loading @@ -867,6 +881,7 @@ func makeApexAvailableWhitelist() map[string][]string { m["com.android.wifi"] = []string{ m["com.android.wifi"] = []string{ "PlatformProperties", "PlatformProperties", "android.hardware.wifi-V1.0-java", "android.hardware.wifi-V1.0-java", "android.hardware.wifi-V1.0-java-constants", "android.hardware.wifi-V1.1-java", "android.hardware.wifi-V1.1-java", "android.hardware.wifi-V1.2-java", "android.hardware.wifi-V1.2-java", "android.hardware.wifi-V1.3-java", "android.hardware.wifi-V1.3-java", Loading @@ -887,6 +902,8 @@ func makeApexAvailableWhitelist() map[string][]string { "bouncycastle-unbundled", "bouncycastle-unbundled", "dnsresolver_aidl_interface-V2-java", "dnsresolver_aidl_interface-V2-java", "error_prone_annotations", "error_prone_annotations", "framework-wifi-pre-jarjar", "framework-wifi-util-lib", "ipmemorystore-aidl-interfaces-V3-java", "ipmemorystore-aidl-interfaces-V3-java", "ipmemorystore-aidl-interfaces-java", "ipmemorystore-aidl-interfaces-java", "ksoap2", "ksoap2", Loading Loading @@ -1023,14 +1040,11 @@ func apexDepsMutator(mctx android.TopDownMutatorContext) { var directDep bool var directDep bool if a, ok := mctx.Module().(*apexBundle); ok && !a.vndkApex { if a, ok := mctx.Module().(*apexBundle); ok && !a.vndkApex { minSdkVersion := a.minSdkVersion(mctx) minSdkVersion := a.minSdkVersion(mctx) apexBundles = []android.ApexInfo{android.ApexInfo{ apexBundles = []android.ApexInfo{ android.ApexInfo{ ApexName: mctx.ModuleName(), ApexName: mctx.ModuleName(), LegacyAndroid10Support: proptools.Bool(a.properties.Legacy_android10_support), LegacyAndroid10Support: proptools.Bool(a.properties.Legacy_android10_support), MinSdkVersion: minSdkVersion, MinSdkVersion: minSdkVersion, }, }} } directDep = true directDep = true } else if am, ok := mctx.Module().(android.ApexModule); ok { } else if am, ok := mctx.Module().(android.ApexModule); ok { apexBundles = am.ApexVariations() apexBundles = am.ApexVariations() Loading @@ -1041,10 +1055,14 @@ func apexDepsMutator(mctx android.TopDownMutatorContext) { return return } } cur := mctx.Module().(interface { DepIsInSameApex(android.BaseModuleContext, android.Module) bool }) mctx.VisitDirectDeps(func(child android.Module) { mctx.VisitDirectDeps(func(child android.Module) { depName := mctx.OtherModuleName(child) depName := mctx.OtherModuleName(child) if am, ok := child.(android.ApexModule); ok && am.CanHaveApexVariants() && if am, ok := child.(android.ApexModule); ok && am.CanHaveApexVariants() && (directDep || am.DepIsInSameApex(mctx, child)) { cur.DepIsInSameApex(mctx, child) { android.UpdateApexDependency(apexBundles, depName, directDep) android.UpdateApexDependency(apexBundles, depName, directDep) am.BuildForApexes(apexBundles) am.BuildForApexes(apexBundles) } } Loading Loading @@ -1957,7 +1975,7 @@ func (a *apexBundle) walkPayloadDeps(ctx android.ModuleContext, } } // Check for the indirect dependencies if it is considered as part of the APEX // Check for the indirect dependencies if it is considered as part of the APEX if am.DepIsInSameApex(ctx, am) { if am.ApexName() != "" { do(ctx, parent, am, false /* externalDep */) do(ctx, parent, am, false /* externalDep */) return true return true } } Loading Loading @@ -1990,10 +2008,12 @@ func (a *apexBundle) checkApexAvailability(ctx android.ModuleContext) { a.walkPayloadDeps(ctx, func(ctx android.ModuleContext, from blueprint.Module, to android.ApexModule, externalDep bool) { a.walkPayloadDeps(ctx, func(ctx android.ModuleContext, from blueprint.Module, to android.ApexModule, externalDep bool) { apexName := ctx.ModuleName() apexName := ctx.ModuleName() if externalDep || to.AvailableFor(apexName) || whitelistedApexAvailable(apexName, to) { fromName := ctx.OtherModuleName(from) toName := ctx.OtherModuleName(to) if externalDep || to.AvailableFor(apexName) || whitelistedApexAvailable(apexName, toName) { return return } } ctx.ModuleErrorf("%q requires %q that is not available for the APEX.", from.Name(), to.Name()) ctx.ModuleErrorf("%q requires %q that is not available for the APEX.", fromName, toName) }) }) } } Loading Loading @@ -2370,13 +2390,12 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) { a.buildApexDependencyInfo(ctx) a.buildApexDependencyInfo(ctx) } } func whitelistedApexAvailable(apex string, module android.Module) bool { func whitelistedApexAvailable(apex, moduleName string) bool { key := apex key := apex key = strings.Replace(key, "test_", "", 1) key = strings.Replace(key, "test_", "", 1) key = strings.Replace(key, "com.android.art.debug", "com.android.art", 1) key = strings.Replace(key, "com.android.art.debug", "com.android.art", 1) key = strings.Replace(key, "com.android.art.release", "com.android.art", 1) key = strings.Replace(key, "com.android.art.release", "com.android.art", 1) moduleName := module.Name() // Prebuilt modules (e.g. java_import, etc.) have "prebuilt_" prefix added by the build // Prebuilt modules (e.g. java_import, etc.) have "prebuilt_" prefix added by the build // system. Trim the prefix for the check since they are confusing // system. Trim the prefix for the check since they are confusing moduleName = strings.TrimPrefix(moduleName, "prebuilt_") moduleName = strings.TrimPrefix(moduleName, "prebuilt_") Loading apex/apex_test.go +15 −17 Original line number Original line Diff line number Diff line Loading @@ -3164,6 +3164,7 @@ func TestErrorsIfDepsAreNotEnabled(t *testing.T) { stl: "none", stl: "none", system_shared_libs: [], system_shared_libs: [], enabled: false, enabled: false, apex_available: ["myapex"], } } `) `) testApexError(t, `module "myapex" .* depends on disabled module "myjar"`, ` testApexError(t, `module "myapex" .* depends on disabled module "myjar"`, ` Loading @@ -3185,6 +3186,7 @@ func TestErrorsIfDepsAreNotEnabled(t *testing.T) { sdk_version: "none", sdk_version: "none", system_modules: "none", system_modules: "none", enabled: false, enabled: false, apex_available: ["myapex"], } } `) `) } } Loading Loading @@ -3345,7 +3347,7 @@ func TestApexWithTestHelperApp(t *testing.T) { func TestApexPropertiesShouldBeDefaultable(t *testing.T) { func TestApexPropertiesShouldBeDefaultable(t *testing.T) { // libfoo's apex_available comes from cc_defaults // libfoo's apex_available comes from cc_defaults testApexError(t, `"myapex" .*: "myapex" requires "libfoo" that is not available for the APEX`, ` testApexError(t, `requires "libfoo" that is not available for the APEX`, ` apex { apex { name: "myapex", name: "myapex", key: "myapex.key", key: "myapex.key", Loading Loading @@ -3411,8 +3413,8 @@ func TestApexAvailable(t *testing.T) { apex_available: ["otherapex"], apex_available: ["otherapex"], }`) }`) // libbar is an indirect dep // libbbaz is an indirect dep testApexError(t, "requires \"libbar\" that is not available for the APEX", ` testApexError(t, "requires \"libbaz\" that is not available for the APEX", ` apex { apex { name: "myapex", name: "myapex", key: "myapex.key", key: "myapex.key", Loading @@ -3425,31 +3427,26 @@ func TestApexAvailable(t *testing.T) { private_key: "testkey.pem", private_key: "testkey.pem", } } apex { name: "otherapex", key: "otherapex.key", native_shared_libs: ["libfoo"], } apex_key { name: "otherapex.key", public_key: "testkey.avbpubkey", private_key: "testkey.pem", } cc_library { cc_library { name: "libfoo", name: "libfoo", stl: "none", stl: "none", shared_libs: ["libbar"], shared_libs: ["libbar"], system_shared_libs: [], system_shared_libs: [], apex_available: ["myapex", "otherapex"], apex_available: ["myapex"], } } cc_library { cc_library { name: "libbar", name: "libbar", stl: "none", stl: "none", shared_libs: ["libbaz"], system_shared_libs: [], apex_available: ["myapex"], } cc_library { name: "libbaz", stl: "none", system_shared_libs: [], system_shared_libs: [], apex_available: ["otherapex"], }`) }`) testApexError(t, "\"otherapex\" is not a valid module name", ` testApexError(t, "\"otherapex\" is not a valid module name", ` Loading Loading @@ -3796,6 +3793,7 @@ func TestRejectNonInstallableJavaLibrary(t *testing.T) { sdk_version: "none", sdk_version: "none", system_modules: "none", system_modules: "none", compile_dex: false, compile_dex: false, apex_available: ["myapex"], } } `) `) } } Loading java/java.go +14 −4 Original line number Original line Diff line number Diff line Loading @@ -1796,11 +1796,16 @@ func (j *Module) hasCode(ctx android.ModuleContext) bool { } } func (j *Module) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool { func (j *Module) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool { depTag := ctx.OtherModuleDependencyTag(dep) // Dependencies other than the static linkage are all considered crossing APEX boundary // Dependencies other than the static linkage are all considered crossing APEX boundary if staticLibTag == ctx.OtherModuleDependencyTag(dep) { return true } // Also, a dependency to an sdk member is also considered as such. This is required because // Also, a dependency to an sdk member is also considered as such. This is required because // sdk members should be mutated into APEXes. Refer to sdk.sdkDepsReplaceMutator. // sdk members should be mutated into APEXes. Refer to sdk.sdkDepsReplaceMutator. return depTag == staticLibTag || j.IsInAnySdk() if sa, ok := dep.(android.SdkAware); ok && sa.IsInAnySdk() { return true } return false } } func (j *Module) Stem() string { func (j *Module) Stem() string { Loading Loading @@ -2504,11 +2509,16 @@ func (j *Import) SrcJarArgs() ([]string, android.Paths) { } } func (j *Import) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool { func (j *Import) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool { depTag := ctx.OtherModuleDependencyTag(dep) // dependencies other than the static linkage are all considered crossing APEX boundary // dependencies other than the static linkage are all considered crossing APEX boundary if staticLibTag == ctx.OtherModuleDependencyTag(dep) { return true } // Also, a dependency to an sdk member is also considered as such. This is required because // Also, a dependency to an sdk member is also considered as such. This is required because // sdk members should be mutated into APEXes. Refer to sdk.sdkDepsReplaceMutator. // sdk members should be mutated into APEXes. Refer to sdk.sdkDepsReplaceMutator. return depTag == staticLibTag || j.IsInAnySdk() if sa, ok := dep.(android.SdkAware); ok && sa.IsInAnySdk() { return true } return false } } // Add compile time check for interface implementation // Add compile time check for interface implementation Loading java/sdk_library.go +12 −2 Original line number Original line Diff line number Diff line Loading @@ -581,6 +581,14 @@ func (module *SdkLibrary) createStubsSources(mctx android.LoadHookContext, apiSc mctx.CreateModule(DroidstubsFactory, &props) mctx.CreateModule(DroidstubsFactory, &props) } } func (module *SdkLibrary) DepIsInSameApex(mctx android.BaseModuleContext, dep android.Module) bool { depTag := mctx.OtherModuleDependencyTag(dep) if depTag == xmlPermissionsFileTag { return true } return module.Library.DepIsInSameApex(mctx, dep) } // Creates the xml file that publicizes the runtime library // Creates the xml file that publicizes the runtime library func (module *SdkLibrary) createXmlFile(mctx android.LoadHookContext) { func (module *SdkLibrary) createXmlFile(mctx android.LoadHookContext) { props := struct { props := struct { Loading @@ -590,9 +598,11 @@ func (module *SdkLibrary) createXmlFile(mctx android.LoadHookContext) { Device_specific *bool Device_specific *bool Product_specific *bool Product_specific *bool System_ext_specific *bool System_ext_specific *bool Apex_available []string }{ }{ Name: proptools.StringPtr(module.xmlFileName()), Name: proptools.StringPtr(module.xmlFileName()), Lib_name: proptools.StringPtr(module.BaseModuleName()), Lib_name: proptools.StringPtr(module.BaseModuleName()), Apex_available: module.ApexProperties.Apex_available, } } if module.SocSpecific() { if module.SocSpecific() { Loading sdk/sdk_test.go +2 −1 Original line number Original line Diff line number Diff line Loading @@ -58,6 +58,7 @@ func TestDepNotInRequiredSdks(t *testing.T) { sdk_version: "none", sdk_version: "none", compile_dex: true, compile_dex: true, host_supported: true, host_supported: true, apex_available: ["myapex"], } } // this lib is no in mysdk // this lib is no in mysdk Loading Loading
apex/apex.go +33 −14 Original line number Original line Diff line number Diff line Loading @@ -214,8 +214,11 @@ func makeApexAvailableWhitelist() map[string][]string { "bluetooth-protos-lite", "bluetooth-protos-lite", "bluetooth.mapsapi", "bluetooth.mapsapi", "com.android.vcard", "com.android.vcard", "dnsresolver_aidl_interface-V2-java", "fmtlib", "fmtlib", "guava", "guava", "ipmemorystore-aidl-interfaces-V5-java", "ipmemorystore-aidl-interfaces-java", "internal_include_headers", "internal_include_headers", "lib-bt-packets", "lib-bt-packets", "lib-bt-packets-avrcp", "lib-bt-packets-avrcp", Loading Loading @@ -281,6 +284,12 @@ func makeApexAvailableWhitelist() map[string][]string { "libutils_headers", "libutils_headers", "libz", "libz", "media_plugin_headers", "media_plugin_headers", "net-utils-services-common", "netd_aidl_interface-unstable-java", "netd_event_listener_interface-java", "netlink-client", "networkstack-aidl-interfaces-unstable-java", "networkstack-client", "sap-api-java-static", "sap-api-java-static", "services.net", "services.net", } } Loading @@ -298,6 +307,7 @@ func makeApexAvailableWhitelist() map[string][]string { "libcrypto", "libcrypto", "libnativehelper_header_only", "libnativehelper_header_only", "libssl", "libssl", "unsupportedappusage", } } // // // Module separator // Module separator Loading @@ -321,6 +331,7 @@ func makeApexAvailableWhitelist() map[string][]string { "cronet_impl_platform_java", "cronet_impl_platform_java", "libcronet.80.0.3986.0", "libcronet.80.0.3986.0", "org.chromium.net.cronet", "org.chromium.net.cronet", "org.chromium.net.cronet.xml", "prebuilt_libcronet.80.0.3986.0", "prebuilt_libcronet.80.0.3986.0", } } // // Loading Loading @@ -559,6 +570,7 @@ func makeApexAvailableWhitelist() map[string][]string { "libFLAC-config", "libFLAC-config", "libFLAC-headers", "libFLAC-headers", "libFraunhoferAAC", "libFraunhoferAAC", "libLibGuiProperties", "libarect", "libarect", "libasync_safe", "libasync_safe", "libaudio_system_headers", "libaudio_system_headers", Loading @@ -574,6 +586,7 @@ func makeApexAvailableWhitelist() map[string][]string { "libbase", "libbase", "libbase_headers", "libbase_headers", "libbinder_headers", "libbinder_headers", "libbinderthreadstateutils", "libbluetooth-types-header", "libbluetooth-types-header", "libbufferhub_headers", "libbufferhub_headers", "libc++", "libc++", Loading Loading @@ -776,6 +789,7 @@ func makeApexAvailableWhitelist() map[string][]string { "libdexfile_external_headers", "libdexfile_external_headers", "libdexfile_support", "libdexfile_support", "libdexfile_support_static", "libdexfile_support_static", "libdl_static", "libgtest_prod", "libgtest_prod", "libjemalloc5", "libjemalloc5", "liblinker_main", "liblinker_main", Loading Loading @@ -867,6 +881,7 @@ func makeApexAvailableWhitelist() map[string][]string { m["com.android.wifi"] = []string{ m["com.android.wifi"] = []string{ "PlatformProperties", "PlatformProperties", "android.hardware.wifi-V1.0-java", "android.hardware.wifi-V1.0-java", "android.hardware.wifi-V1.0-java-constants", "android.hardware.wifi-V1.1-java", "android.hardware.wifi-V1.1-java", "android.hardware.wifi-V1.2-java", "android.hardware.wifi-V1.2-java", "android.hardware.wifi-V1.3-java", "android.hardware.wifi-V1.3-java", Loading @@ -887,6 +902,8 @@ func makeApexAvailableWhitelist() map[string][]string { "bouncycastle-unbundled", "bouncycastle-unbundled", "dnsresolver_aidl_interface-V2-java", "dnsresolver_aidl_interface-V2-java", "error_prone_annotations", "error_prone_annotations", "framework-wifi-pre-jarjar", "framework-wifi-util-lib", "ipmemorystore-aidl-interfaces-V3-java", "ipmemorystore-aidl-interfaces-V3-java", "ipmemorystore-aidl-interfaces-java", "ipmemorystore-aidl-interfaces-java", "ksoap2", "ksoap2", Loading Loading @@ -1023,14 +1040,11 @@ func apexDepsMutator(mctx android.TopDownMutatorContext) { var directDep bool var directDep bool if a, ok := mctx.Module().(*apexBundle); ok && !a.vndkApex { if a, ok := mctx.Module().(*apexBundle); ok && !a.vndkApex { minSdkVersion := a.minSdkVersion(mctx) minSdkVersion := a.minSdkVersion(mctx) apexBundles = []android.ApexInfo{android.ApexInfo{ apexBundles = []android.ApexInfo{ android.ApexInfo{ ApexName: mctx.ModuleName(), ApexName: mctx.ModuleName(), LegacyAndroid10Support: proptools.Bool(a.properties.Legacy_android10_support), LegacyAndroid10Support: proptools.Bool(a.properties.Legacy_android10_support), MinSdkVersion: minSdkVersion, MinSdkVersion: minSdkVersion, }, }} } directDep = true directDep = true } else if am, ok := mctx.Module().(android.ApexModule); ok { } else if am, ok := mctx.Module().(android.ApexModule); ok { apexBundles = am.ApexVariations() apexBundles = am.ApexVariations() Loading @@ -1041,10 +1055,14 @@ func apexDepsMutator(mctx android.TopDownMutatorContext) { return return } } cur := mctx.Module().(interface { DepIsInSameApex(android.BaseModuleContext, android.Module) bool }) mctx.VisitDirectDeps(func(child android.Module) { mctx.VisitDirectDeps(func(child android.Module) { depName := mctx.OtherModuleName(child) depName := mctx.OtherModuleName(child) if am, ok := child.(android.ApexModule); ok && am.CanHaveApexVariants() && if am, ok := child.(android.ApexModule); ok && am.CanHaveApexVariants() && (directDep || am.DepIsInSameApex(mctx, child)) { cur.DepIsInSameApex(mctx, child) { android.UpdateApexDependency(apexBundles, depName, directDep) android.UpdateApexDependency(apexBundles, depName, directDep) am.BuildForApexes(apexBundles) am.BuildForApexes(apexBundles) } } Loading Loading @@ -1957,7 +1975,7 @@ func (a *apexBundle) walkPayloadDeps(ctx android.ModuleContext, } } // Check for the indirect dependencies if it is considered as part of the APEX // Check for the indirect dependencies if it is considered as part of the APEX if am.DepIsInSameApex(ctx, am) { if am.ApexName() != "" { do(ctx, parent, am, false /* externalDep */) do(ctx, parent, am, false /* externalDep */) return true return true } } Loading Loading @@ -1990,10 +2008,12 @@ func (a *apexBundle) checkApexAvailability(ctx android.ModuleContext) { a.walkPayloadDeps(ctx, func(ctx android.ModuleContext, from blueprint.Module, to android.ApexModule, externalDep bool) { a.walkPayloadDeps(ctx, func(ctx android.ModuleContext, from blueprint.Module, to android.ApexModule, externalDep bool) { apexName := ctx.ModuleName() apexName := ctx.ModuleName() if externalDep || to.AvailableFor(apexName) || whitelistedApexAvailable(apexName, to) { fromName := ctx.OtherModuleName(from) toName := ctx.OtherModuleName(to) if externalDep || to.AvailableFor(apexName) || whitelistedApexAvailable(apexName, toName) { return return } } ctx.ModuleErrorf("%q requires %q that is not available for the APEX.", from.Name(), to.Name()) ctx.ModuleErrorf("%q requires %q that is not available for the APEX.", fromName, toName) }) }) } } Loading Loading @@ -2370,13 +2390,12 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) { a.buildApexDependencyInfo(ctx) a.buildApexDependencyInfo(ctx) } } func whitelistedApexAvailable(apex string, module android.Module) bool { func whitelistedApexAvailable(apex, moduleName string) bool { key := apex key := apex key = strings.Replace(key, "test_", "", 1) key = strings.Replace(key, "test_", "", 1) key = strings.Replace(key, "com.android.art.debug", "com.android.art", 1) key = strings.Replace(key, "com.android.art.debug", "com.android.art", 1) key = strings.Replace(key, "com.android.art.release", "com.android.art", 1) key = strings.Replace(key, "com.android.art.release", "com.android.art", 1) moduleName := module.Name() // Prebuilt modules (e.g. java_import, etc.) have "prebuilt_" prefix added by the build // Prebuilt modules (e.g. java_import, etc.) have "prebuilt_" prefix added by the build // system. Trim the prefix for the check since they are confusing // system. Trim the prefix for the check since they are confusing moduleName = strings.TrimPrefix(moduleName, "prebuilt_") moduleName = strings.TrimPrefix(moduleName, "prebuilt_") Loading
apex/apex_test.go +15 −17 Original line number Original line Diff line number Diff line Loading @@ -3164,6 +3164,7 @@ func TestErrorsIfDepsAreNotEnabled(t *testing.T) { stl: "none", stl: "none", system_shared_libs: [], system_shared_libs: [], enabled: false, enabled: false, apex_available: ["myapex"], } } `) `) testApexError(t, `module "myapex" .* depends on disabled module "myjar"`, ` testApexError(t, `module "myapex" .* depends on disabled module "myjar"`, ` Loading @@ -3185,6 +3186,7 @@ func TestErrorsIfDepsAreNotEnabled(t *testing.T) { sdk_version: "none", sdk_version: "none", system_modules: "none", system_modules: "none", enabled: false, enabled: false, apex_available: ["myapex"], } } `) `) } } Loading Loading @@ -3345,7 +3347,7 @@ func TestApexWithTestHelperApp(t *testing.T) { func TestApexPropertiesShouldBeDefaultable(t *testing.T) { func TestApexPropertiesShouldBeDefaultable(t *testing.T) { // libfoo's apex_available comes from cc_defaults // libfoo's apex_available comes from cc_defaults testApexError(t, `"myapex" .*: "myapex" requires "libfoo" that is not available for the APEX`, ` testApexError(t, `requires "libfoo" that is not available for the APEX`, ` apex { apex { name: "myapex", name: "myapex", key: "myapex.key", key: "myapex.key", Loading Loading @@ -3411,8 +3413,8 @@ func TestApexAvailable(t *testing.T) { apex_available: ["otherapex"], apex_available: ["otherapex"], }`) }`) // libbar is an indirect dep // libbbaz is an indirect dep testApexError(t, "requires \"libbar\" that is not available for the APEX", ` testApexError(t, "requires \"libbaz\" that is not available for the APEX", ` apex { apex { name: "myapex", name: "myapex", key: "myapex.key", key: "myapex.key", Loading @@ -3425,31 +3427,26 @@ func TestApexAvailable(t *testing.T) { private_key: "testkey.pem", private_key: "testkey.pem", } } apex { name: "otherapex", key: "otherapex.key", native_shared_libs: ["libfoo"], } apex_key { name: "otherapex.key", public_key: "testkey.avbpubkey", private_key: "testkey.pem", } cc_library { cc_library { name: "libfoo", name: "libfoo", stl: "none", stl: "none", shared_libs: ["libbar"], shared_libs: ["libbar"], system_shared_libs: [], system_shared_libs: [], apex_available: ["myapex", "otherapex"], apex_available: ["myapex"], } } cc_library { cc_library { name: "libbar", name: "libbar", stl: "none", stl: "none", shared_libs: ["libbaz"], system_shared_libs: [], apex_available: ["myapex"], } cc_library { name: "libbaz", stl: "none", system_shared_libs: [], system_shared_libs: [], apex_available: ["otherapex"], }`) }`) testApexError(t, "\"otherapex\" is not a valid module name", ` testApexError(t, "\"otherapex\" is not a valid module name", ` Loading Loading @@ -3796,6 +3793,7 @@ func TestRejectNonInstallableJavaLibrary(t *testing.T) { sdk_version: "none", sdk_version: "none", system_modules: "none", system_modules: "none", compile_dex: false, compile_dex: false, apex_available: ["myapex"], } } `) `) } } Loading
java/java.go +14 −4 Original line number Original line Diff line number Diff line Loading @@ -1796,11 +1796,16 @@ func (j *Module) hasCode(ctx android.ModuleContext) bool { } } func (j *Module) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool { func (j *Module) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool { depTag := ctx.OtherModuleDependencyTag(dep) // Dependencies other than the static linkage are all considered crossing APEX boundary // Dependencies other than the static linkage are all considered crossing APEX boundary if staticLibTag == ctx.OtherModuleDependencyTag(dep) { return true } // Also, a dependency to an sdk member is also considered as such. This is required because // Also, a dependency to an sdk member is also considered as such. This is required because // sdk members should be mutated into APEXes. Refer to sdk.sdkDepsReplaceMutator. // sdk members should be mutated into APEXes. Refer to sdk.sdkDepsReplaceMutator. return depTag == staticLibTag || j.IsInAnySdk() if sa, ok := dep.(android.SdkAware); ok && sa.IsInAnySdk() { return true } return false } } func (j *Module) Stem() string { func (j *Module) Stem() string { Loading Loading @@ -2504,11 +2509,16 @@ func (j *Import) SrcJarArgs() ([]string, android.Paths) { } } func (j *Import) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool { func (j *Import) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool { depTag := ctx.OtherModuleDependencyTag(dep) // dependencies other than the static linkage are all considered crossing APEX boundary // dependencies other than the static linkage are all considered crossing APEX boundary if staticLibTag == ctx.OtherModuleDependencyTag(dep) { return true } // Also, a dependency to an sdk member is also considered as such. This is required because // Also, a dependency to an sdk member is also considered as such. This is required because // sdk members should be mutated into APEXes. Refer to sdk.sdkDepsReplaceMutator. // sdk members should be mutated into APEXes. Refer to sdk.sdkDepsReplaceMutator. return depTag == staticLibTag || j.IsInAnySdk() if sa, ok := dep.(android.SdkAware); ok && sa.IsInAnySdk() { return true } return false } } // Add compile time check for interface implementation // Add compile time check for interface implementation Loading
java/sdk_library.go +12 −2 Original line number Original line Diff line number Diff line Loading @@ -581,6 +581,14 @@ func (module *SdkLibrary) createStubsSources(mctx android.LoadHookContext, apiSc mctx.CreateModule(DroidstubsFactory, &props) mctx.CreateModule(DroidstubsFactory, &props) } } func (module *SdkLibrary) DepIsInSameApex(mctx android.BaseModuleContext, dep android.Module) bool { depTag := mctx.OtherModuleDependencyTag(dep) if depTag == xmlPermissionsFileTag { return true } return module.Library.DepIsInSameApex(mctx, dep) } // Creates the xml file that publicizes the runtime library // Creates the xml file that publicizes the runtime library func (module *SdkLibrary) createXmlFile(mctx android.LoadHookContext) { func (module *SdkLibrary) createXmlFile(mctx android.LoadHookContext) { props := struct { props := struct { Loading @@ -590,9 +598,11 @@ func (module *SdkLibrary) createXmlFile(mctx android.LoadHookContext) { Device_specific *bool Device_specific *bool Product_specific *bool Product_specific *bool System_ext_specific *bool System_ext_specific *bool Apex_available []string }{ }{ Name: proptools.StringPtr(module.xmlFileName()), Name: proptools.StringPtr(module.xmlFileName()), Lib_name: proptools.StringPtr(module.BaseModuleName()), Lib_name: proptools.StringPtr(module.BaseModuleName()), Apex_available: module.ApexProperties.Apex_available, } } if module.SocSpecific() { if module.SocSpecific() { Loading
sdk/sdk_test.go +2 −1 Original line number Original line Diff line number Diff line Loading @@ -58,6 +58,7 @@ func TestDepNotInRequiredSdks(t *testing.T) { sdk_version: "none", sdk_version: "none", compile_dex: true, compile_dex: true, host_supported: true, host_supported: true, apex_available: ["myapex"], } } // this lib is no in mysdk // this lib is no in mysdk Loading