diff options
Diffstat (limited to 'android')
-rw-r--r-- | android/allowlists/allowlists.go | 296 | ||||
-rw-r--r-- | android/config.go | 9 | ||||
-rw-r--r-- | android/deptag.go | 4 | ||||
-rw-r--r-- | android/license_metadata.go | 2 | ||||
-rw-r--r-- | android/module.go | 30 | ||||
-rw-r--r-- | android/packaging_test.go | 4 | ||||
-rw-r--r-- | android/variable.go | 4 |
7 files changed, 71 insertions, 278 deletions
diff --git a/android/allowlists/allowlists.go b/android/allowlists/allowlists.go index 433c06357..df47a5c91 100644 --- a/android/allowlists/allowlists.go +++ b/android/allowlists/allowlists.go @@ -38,7 +38,13 @@ const ( // allows modules to opt-in. Bp2BuildDefaultFalseRecursively - DEFAULT_NINJA_WEIGHT = 1000 + // Modules with build time of more than half a minute should have high priority. + DEFAULT_PRIORITIZED_WEIGHT = 1000 + // Modules with build time of more than a few minute should have higher priority. + HIGH_PRIORITIZED_WEIGHT = 10 * DEFAULT_PRIORITIZED_WEIGHT + // Modules with inputs greater than the threshold should have high priority. + // Adjust this threshold if there are lots of wrong predictions. + INPUT_SIZE_THRESHOLD = 50 ) var ( @@ -59,7 +65,9 @@ var ( "build/bazel": Bp2BuildDefaultTrueRecursively, "build/make/target/product/security": Bp2BuildDefaultTrue, + "build/make/tools/protos": Bp2BuildDefaultTrue, "build/make/tools/releasetools": Bp2BuildDefaultTrue, + "build/make/tools/sbom": Bp2BuildDefaultTrue, "build/make/tools/signapk": Bp2BuildDefaultTrue, "build/make/tools/zipalign": Bp2BuildDefaultTrueRecursively, "build/soong": Bp2BuildDefaultTrue, @@ -449,9 +457,8 @@ var ( "libidmap2_policies", "libSurfaceFlingerProp", // cc mainline modules - "code_coverage.policy", - "code_coverage.policy.other", - "codec2_soft_exports", + + // com.android.media.swcodec "com.android.media.swcodec", "com.android.media.swcodec-androidManifest", "com.android.media.swcodec-ld.config.txt", @@ -459,6 +466,12 @@ var ( "com.android.media.swcodec-mediaswcodec.rc", "com.android.media.swcodec.certificate", "com.android.media.swcodec.key", + "test_com.android.media.swcodec", + + // deps + "code_coverage.policy", + "code_coverage.policy.other", + "codec2_soft_exports", "flatbuffer_headers", "framework-connectivity-protos", "gemmlowp_headers", @@ -1435,6 +1448,9 @@ var ( "MetaDataBaseUnitTest", // depends on libstagefright "AVCUtilsUnitTest", // depends on libstagefright "ColorUtilsTest", // depends on libmediandk + + // python_test_host with test data + "sbom_writers_test", } MixedBuildsDisabledList = []string{ @@ -1541,9 +1557,6 @@ var ( "com.android.media.swcodec", "test_com.android.media.swcodec", "libstagefright_foundation", - "libcodec2_hidl@1.0", - "libcodec2_hidl@1.1", - "libcodec2_hidl@1.2", } // These should be the libs that are included by the apexes in the ProdMixedBuildsEnabledList @@ -1562,267 +1575,12 @@ var ( // "libstagefright_flacdec", // "libutils", - // TODO(b/273282046): Make this list customizable to support various targets. - // The list of modules which are expected to spend lots of build time. - // With `--ninja_weight_source=soong`, ninja builds these modules and deps first. - HugeModulesMap = map[string]int{ - "AccountManagementApp": DEFAULT_NINJA_WEIGHT, - "ActivityManagerPerfTestsStubApp1": DEFAULT_NINJA_WEIGHT, - "ActivityManagerPerfTestsStubApp2": DEFAULT_NINJA_WEIGHT, - "ActivityManagerPerfTestsStubApp3": DEFAULT_NINJA_WEIGHT, - "api-stubs-docs-non-updatable": DEFAULT_NINJA_WEIGHT, - "AppCompatibilityTest": DEFAULT_NINJA_WEIGHT, - "AppTransitionTests": DEFAULT_NINJA_WEIGHT, - "art_compiler_tests": DEFAULT_NINJA_WEIGHT, - "art.module.intra.core.api.stubs.source": DEFAULT_NINJA_WEIGHT, - "art.module.public.api.stubs.source": DEFAULT_NINJA_WEIGHT, - "AttestationVerificationTest": DEFAULT_NINJA_WEIGHT, - "BatteryUsageStatsProtoTests": DEFAULT_NINJA_WEIGHT, - "bluetooth_test_gd_unit": DEFAULT_NINJA_WEIGHT, - "Bluetooth": DEFAULT_NINJA_WEIGHT, - "BluetoothInstrumentationTests": DEFAULT_NINJA_WEIGHT, - "Calendar": DEFAULT_NINJA_WEIGHT, - "CalendarProvider": DEFAULT_NINJA_WEIGHT, - "Camera2": DEFAULT_NINJA_WEIGHT, - "CarRotaryControllerUnitTests": DEFAULT_NINJA_WEIGHT, - "CarSettingsForUnitTesting": DEFAULT_NINJA_WEIGHT, - "CarSettingsUnitTests": DEFAULT_NINJA_WEIGHT, - "CarSystemUI-tests": DEFAULT_NINJA_WEIGHT, - "CellBroadcastApp": DEFAULT_NINJA_WEIGHT, - "CellBroadcastLegacyApp": DEFAULT_NINJA_WEIGHT, - "CellBroadcastReceiverOemUnitTests": DEFAULT_NINJA_WEIGHT, - "CellBroadcastServiceModule": DEFAULT_NINJA_WEIGHT, - "CompanionDeviceManager": DEFAULT_NINJA_WEIGHT, - "ConnectivityChecker": DEFAULT_NINJA_WEIGHT, - "Contacts": DEFAULT_NINJA_WEIGHT, - "ContactsProvider": DEFAULT_NINJA_WEIGHT, - "ContentCapturePerfTests": DEFAULT_NINJA_WEIGHT, - "CorePerfTests": DEFAULT_NINJA_WEIGHT, - "crosvm": DEFAULT_NINJA_WEIGHT, - "CtsDomainVerificationDeviceMultiUserTestCases": DEFAULT_NINJA_WEIGHT, - "CtsLogdTestCases": DEFAULT_NINJA_WEIGHT, - "CtsMediaProviderTranscodeTests": DEFAULT_NINJA_WEIGHT, - "CtsRollbackManagerHostTestHelperApp": DEFAULT_NINJA_WEIGHT, - "CtsRollbackManagerHostTestHelperApp2": DEFAULT_NINJA_WEIGHT, - "CtsRootPackageInstallerTestCases": DEFAULT_NINJA_WEIGHT, - "CtsRootRollbackManagerHostTestHelperApp": DEFAULT_NINJA_WEIGHT, - "CtsTranscodeTestAppSupportsHevc": DEFAULT_NINJA_WEIGHT, - "CtsTranscodeTestAppSupportsSlowMotion": DEFAULT_NINJA_WEIGHT, - "CuttlefishDisplayHotplugHelperApp": DEFAULT_NINJA_WEIGHT, - "cvd-host_package": DEFAULT_NINJA_WEIGHT, - "DelegateTestApp": DEFAULT_NINJA_WEIGHT, - "DeskClock": DEFAULT_NINJA_WEIGHT, - "Development": DEFAULT_NINJA_WEIGHT, - "DeviceAdminTestApp": DEFAULT_NINJA_WEIGHT, - "DevicePolicyManagementRoleHolderTestApp": DEFAULT_NINJA_WEIGHT, - "dex2oatd": DEFAULT_NINJA_WEIGHT, - "DocumentsUI": DEFAULT_NINJA_WEIGHT, - "EasterEgg": DEFAULT_NINJA_WEIGHT, - "EffectProxyTest": DEFAULT_NINJA_WEIGHT, - "EmergencyInfo": DEFAULT_NINJA_WEIGHT, - "EmptyTestApp": DEFAULT_NINJA_WEIGHT, - "ExtServices": DEFAULT_NINJA_WEIGHT, - "FacebookAppsScenarioTests": DEFAULT_NINJA_WEIGHT, - "flickerlib-core": DEFAULT_NINJA_WEIGHT, - "flickerlib": DEFAULT_NINJA_WEIGHT, - "FlickerLibTest": DEFAULT_NINJA_WEIGHT, - "FlickerTests": DEFAULT_NINJA_WEIGHT, - "framework-minus-apex": DEFAULT_NINJA_WEIGHT, - "framework-res": DEFAULT_NINJA_WEIGHT, - "FrameworksCoreTests": DEFAULT_NINJA_WEIGHT, - "FrameworksMockingCoreTests": DEFAULT_NINJA_WEIGHT, - "FrameworksMockingServicesTests": DEFAULT_NINJA_WEIGHT, - "FrameworksNetSmokeTests": DEFAULT_NINJA_WEIGHT, - "FrameworksNetTests": DEFAULT_NINJA_WEIGHT, - "FrameworksServicesTests": DEFAULT_NINJA_WEIGHT, - "FrameworksTelephonyTests": DEFAULT_NINJA_WEIGHT, - "FrameworksUiServicesTests": DEFAULT_NINJA_WEIGHT, - "FrameworksVcnTests": DEFAULT_NINJA_WEIGHT, - "Gallery2": DEFAULT_NINJA_WEIGHT, - "GameCoreDevice": DEFAULT_NINJA_WEIGHT, - "GoogleBluetoothInstrumentationTests": DEFAULT_NINJA_WEIGHT, - "guice_munged_srcs": DEFAULT_NINJA_WEIGHT, - "HalfSheetUX": DEFAULT_NINJA_WEIGHT, - "ImePerfTests": DEFAULT_NINJA_WEIGHT, - "imgdiag": DEFAULT_NINJA_WEIGHT, - "ImsServiceEntitlement": DEFAULT_NINJA_WEIGHT, - "ImsServiceEntitlementUnitTests": DEFAULT_NINJA_WEIGHT, - "InputTests": DEFAULT_NINJA_WEIGHT, - "InstallTest": DEFAULT_NINJA_WEIGHT, - "IntentResolver": DEFAULT_NINJA_WEIGHT, - "JankBench": DEFAULT_NINJA_WEIGHT, - "jsilver": DEFAULT_NINJA_WEIGHT, - "KeyChain": DEFAULT_NINJA_WEIGHT, - "KeyChainTests": DEFAULT_NINJA_WEIGHT, - "keystore2": DEFAULT_NINJA_WEIGHT, - "LargeResourcesCompressed": DEFAULT_NINJA_WEIGHT, - "LatinIME": DEFAULT_NINJA_WEIGHT, - "Launcher3QuickStepLib": DEFAULT_NINJA_WEIGHT, - "libaom": DEFAULT_NINJA_WEIGHT, - "libart-broken": DEFAULT_NINJA_WEIGHT, - "libart-compiler": DEFAULT_NINJA_WEIGHT, - "libart-disassembler": DEFAULT_NINJA_WEIGHT, - "libart": DEFAULT_NINJA_WEIGHT, - "libartd": DEFAULT_NINJA_WEIGHT, - "libaudiohal@7.1": DEFAULT_NINJA_WEIGHT, - "libbluetooth_core_rs": DEFAULT_NINJA_WEIGHT, - "libbluetooth_gd_unit_tests": DEFAULT_NINJA_WEIGHT, - "libbluetooth_gd": DEFAULT_NINJA_WEIGHT, - "libbluetooth_rs": DEFAULT_NINJA_WEIGHT, - "libbluetooth-for-tests": DEFAULT_NINJA_WEIGHT, - "libbt_common": DEFAULT_NINJA_WEIGHT, - "libbt_packets_nonapex": DEFAULT_NINJA_WEIGHT, - "libbt_packets": DEFAULT_NINJA_WEIGHT, - "libbt_shim_ffi": DEFAULT_NINJA_WEIGHT, - "libbt_shim": DEFAULT_NINJA_WEIGHT, - "libbt-audio-hal-interface": DEFAULT_NINJA_WEIGHT, - "libbt-bta-core": DEFAULT_NINJA_WEIGHT, - "libbt-bta": DEFAULT_NINJA_WEIGHT, - "libbt-common": DEFAULT_NINJA_WEIGHT, - "libbt-hci": DEFAULT_NINJA_WEIGHT, - "libbt-platform-protos-lite": DEFAULT_NINJA_WEIGHT, - "libbt-protos-lite": DEFAULT_NINJA_WEIGHT, - "libbt-sbc-decoder": DEFAULT_NINJA_WEIGHT, - "libc": DEFAULT_NINJA_WEIGHT, - "libclap": DEFAULT_NINJA_WEIGHT, - "libcodec2_soft_av1dec_gav1": DEFAULT_NINJA_WEIGHT, - "libcompositionengine_test": DEFAULT_NINJA_WEIGHT, - "libdevices": DEFAULT_NINJA_WEIGHT, - "libfrontend_proto": DEFAULT_NINJA_WEIGHT, - "libhwtrust": DEFAULT_NINJA_WEIGHT, - "libjni": DEFAULT_NINJA_WEIGHT, - "libkeystore2": DEFAULT_NINJA_WEIGHT, - "libkmr_ta": DEFAULT_NINJA_WEIGHT, - "liblmp": DEFAULT_NINJA_WEIGHT, - "libopenjdkjvmtid": DEFAULT_NINJA_WEIGHT, - "libprotobuf_deprecated": DEFAULT_NINJA_WEIGHT, - "libprotobuf": DEFAULT_NINJA_WEIGHT, - "libregex": DEFAULT_NINJA_WEIGHT, - "LibStatsPullTests": DEFAULT_NINJA_WEIGHT, - "libstd": DEFAULT_NINJA_WEIGHT, - "libsurfaceflinger_unittest": DEFAULT_NINJA_WEIGHT, - "libsyn": DEFAULT_NINJA_WEIGHT, - "libtokio": DEFAULT_NINJA_WEIGHT, - "libuwb_core": DEFAULT_NINJA_WEIGHT, - "libuwb_uci_jni_rust": DEFAULT_NINJA_WEIGHT, - "libuwb_uci_packets": DEFAULT_NINJA_WEIGHT, - "libvpx": DEFAULT_NINJA_WEIGHT, - "libvulkan_enc": DEFAULT_NINJA_WEIGHT, - "libwebrtc": DEFAULT_NINJA_WEIGHT, - "LiveWallpapersPicker": DEFAULT_NINJA_WEIGHT, - "LockTaskApp": DEFAULT_NINJA_WEIGHT, - "LongevityPlatformLibTests": DEFAULT_NINJA_WEIGHT, - "ManagedProvisioning": DEFAULT_NINJA_WEIGHT, - "ManagedProvisioningTests": DEFAULT_NINJA_WEIGHT, - "MediaProvider": DEFAULT_NINJA_WEIGHT, - "MediaProviderClientTests": DEFAULT_NINJA_WEIGHT, - "MediaProviderLegacy": DEFAULT_NINJA_WEIGHT, - "messaging": DEFAULT_NINJA_WEIGHT, - "metalava": DEFAULT_NINJA_WEIGHT, - "MicrobenchmarkRunnerTests": DEFAULT_NINJA_WEIGHT, - "microdroid_manager": DEFAULT_NINJA_WEIGHT, - "minikin_tests": DEFAULT_NINJA_WEIGHT, - "MLCTestApp": DEFAULT_NINJA_WEIGHT, - "MmsService": DEFAULT_NINJA_WEIGHT, - "MmsServiceTests": DEFAULT_NINJA_WEIGHT, - "module-lib-api-stubs-docs-non-updatable": DEFAULT_NINJA_WEIGHT, - "motion_tool_lib_tests": DEFAULT_NINJA_WEIGHT, - "MtpService": DEFAULT_NINJA_WEIGHT, - "MultiUserTests": DEFAULT_NINJA_WEIGHT, - "NearbyIntegrationUiTests": DEFAULT_NINJA_WEIGHT, - "net_test_bluetooth": DEFAULT_NINJA_WEIGHT, - "net_test_btif": DEFAULT_NINJA_WEIGHT, - "net_test_main_shim": DEFAULT_NINJA_WEIGHT, - "net_test_stack": DEFAULT_NINJA_WEIGHT, - "net-tests-utils": DEFAULT_NINJA_WEIGHT, - "NetworkStackCoverageTests": DEFAULT_NINJA_WEIGHT, - "NetworkStackIntegrationTests": DEFAULT_NINJA_WEIGHT, - "NetworkStackNext": DEFAULT_NINJA_WEIGHT, - "NfcNci": DEFAULT_NINJA_WEIGHT, - "NfcNciUnitTests": DEFAULT_NINJA_WEIGHT, - "NotEmptyTestApp": DEFAULT_NINJA_WEIGHT, - "NotificationFunctionalTests": DEFAULT_NINJA_WEIGHT, - "oatdumpd": DEFAULT_NINJA_WEIGHT, - "OsuLogin": DEFAULT_NINJA_WEIGHT, - "PackageInstaller": DEFAULT_NINJA_WEIGHT, - "PackageManagerComponentOverrideTests": DEFAULT_NINJA_WEIGHT, - "PackageManagerPerfTests": DEFAULT_NINJA_WEIGHT, - "PackageManagerServiceServerTests": DEFAULT_NINJA_WEIGHT, - "PackageManagerServiceUnitTests": DEFAULT_NINJA_WEIGHT, - "PackageWatchdogTest": DEFAULT_NINJA_WEIGHT, - "PandoraServerLib": DEFAULT_NINJA_WEIGHT, - "pdl": DEFAULT_NINJA_WEIGHT, - "perfetto_trace_java_protos": DEFAULT_NINJA_WEIGHT, - "perfetto_trace-full": DEFAULT_NINJA_WEIGHT, - "PermissionController": DEFAULT_NINJA_WEIGHT, - "PermissionControllerMockingTests": DEFAULT_NINJA_WEIGHT, - "PixelAppCompTests": DEFAULT_NINJA_WEIGHT, - "platform-bootclasspath": DEFAULT_NINJA_WEIGHT, - "PlatformCommonScenarioTests": DEFAULT_NINJA_WEIGHT, - "PlatformComposeCoreTests": DEFAULT_NINJA_WEIGHT, - "platformprotoslite": DEFAULT_NINJA_WEIGHT, - "PlatformRuleTests": DEFAULT_NINJA_WEIGHT, - "precompiled_sepolicy-without_apex": DEFAULT_NINJA_WEIGHT, - "PresencePolling": DEFAULT_NINJA_WEIGHT, - "PrintSpooler": DEFAULT_NINJA_WEIGHT, - "QuickSearchBox": DEFAULT_NINJA_WEIGHT, - "RemoteDPCTestApp": DEFAULT_NINJA_WEIGHT, - "RemoteProvisioningServiceTests": DEFAULT_NINJA_WEIGHT, - "RkpdAppUnitTests": DEFAULT_NINJA_WEIGHT, - "Robolectric_shadows_framework": DEFAULT_NINJA_WEIGHT, - "RoleHolderApp": DEFAULT_NINJA_WEIGHT, - "SdkSandbox": DEFAULT_NINJA_WEIGHT, - "service-appsearch": DEFAULT_NINJA_WEIGHT, - "service-connectivity": DEFAULT_NINJA_WEIGHT, - "service-uwb": DEFAULT_NINJA_WEIGHT, - "service-wifi": DEFAULT_NINJA_WEIGHT, - "services-non-updatable-stubs": DEFAULT_NINJA_WEIGHT, - "services": DEFAULT_NINJA_WEIGHT, - "Settings-core": DEFAULT_NINJA_WEIGHT, - "Settings": DEFAULT_NINJA_WEIGHT, - "SettingsIntelligence": DEFAULT_NINJA_WEIGHT, - "SettingsLibTests": DEFAULT_NINJA_WEIGHT, - "SettingsProvider": DEFAULT_NINJA_WEIGHT, - "Shell": DEFAULT_NINJA_WEIGHT, - "SimAppDialog": DEFAULT_NINJA_WEIGHT, - "sl4a": DEFAULT_NINJA_WEIGHT, - "SmsApp": DEFAULT_NINJA_WEIGHT, - "SoundPicker": DEFAULT_NINJA_WEIGHT, - "StagedInstallTest": DEFAULT_NINJA_WEIGHT, - "StatementService": DEFAULT_NINJA_WEIGHT, - "StatsdFrameworkTestApp": DEFAULT_NINJA_WEIGHT, - "StatsdFrameworkTestAppNoPermission": DEFAULT_NINJA_WEIGHT, - "statsdprotolite": DEFAULT_NINJA_WEIGHT, - "Stk": DEFAULT_NINJA_WEIGHT, - "StorageManager": DEFAULT_NINJA_WEIGHT, - "system-api-stubs-docs-non-updatable": DEFAULT_NINJA_WEIGHT, - "SystemUI-core": DEFAULT_NINJA_WEIGHT, - "SystemUI-tests-base": DEFAULT_NINJA_WEIGHT, - "SystemUI-tests": DEFAULT_NINJA_WEIGHT, - "SystemUI": DEFAULT_NINJA_WEIGHT, - "SystemUIComposeFeatures": DEFAULT_NINJA_WEIGHT, - "SystemUIComposeFeaturesTests": DEFAULT_NINJA_WEIGHT, - "SystemUITests": DEFAULT_NINJA_WEIGHT, - "Tag": DEFAULT_NINJA_WEIGHT, - "Telecom": DEFAULT_NINJA_WEIGHT, - "TelecomUnitTests": DEFAULT_NINJA_WEIGHT, - "telephony-common": DEFAULT_NINJA_WEIGHT, - "TelephonyProvider": DEFAULT_NINJA_WEIGHT, - "TeleService": DEFAULT_NINJA_WEIGHT, - "test-api-stubs-docs-non-updatable": DEFAULT_NINJA_WEIGHT, - "TetheringIntegrationTests": DEFAULT_NINJA_WEIGHT, - "TetheringNext": DEFAULT_NINJA_WEIGHT, - "ThemePickerTests": DEFAULT_NINJA_WEIGHT, - "Traceur": DEFAULT_NINJA_WEIGHT, - "UsbManagerTests": DEFAULT_NINJA_WEIGHT, - "UsbTests": DEFAULT_NINJA_WEIGHT, - "virtmgr": DEFAULT_NINJA_WEIGHT, - "WallpaperPicker2TestLib": DEFAULT_NINJA_WEIGHT, - "WallpaperPicker2Tests": DEFAULT_NINJA_WEIGHT, - "WifiDialog": DEFAULT_NINJA_WEIGHT, - "wm-proto-parsers": DEFAULT_NINJA_WEIGHT, - "WMShellFlickerTests": DEFAULT_NINJA_WEIGHT, - "WmTests": DEFAULT_NINJA_WEIGHT, - "wpa_supplicant": DEFAULT_NINJA_WEIGHT, + // The list of module types which are expected to spend lots of build time. + // With `--ninja_weight_source=soong`, ninja builds these module types and deps first. + HugeModuleTypePrefixMap = map[string]int{ + "rust_": HIGH_PRIORITIZED_WEIGHT, + "droidstubs": DEFAULT_PRIORITIZED_WEIGHT, + "art_": DEFAULT_PRIORITIZED_WEIGHT, + "ndk_library": DEFAULT_PRIORITIZED_WEIGHT, } ) diff --git a/android/config.go b/android/config.go index 526537406..9e94e0517 100644 --- a/android/config.go +++ b/android/config.go @@ -606,7 +606,7 @@ func NewConfig(cmdArgs CmdArgs, availableEnv map[string]string) (Config, error) setBazelMode(cmdArgs.BazelMode, "--bazel-mode", BazelProdMode) setBazelMode(cmdArgs.BazelModeStaging, "--bazel-mode-staging", BazelStagingMode) - for _, module := range strings.Split(cmdArgs.BazelForceEnabledModules, ",") { + for _, module := range getForceEnabledModulesFromFlag(cmdArgs.BazelForceEnabledModules) { config.bazelForceEnabledModules[module] = struct{}{} } config.BazelContext, err = NewBazelContext(config) @@ -615,6 +615,13 @@ func NewConfig(cmdArgs CmdArgs, availableEnv map[string]string) (Config, error) return Config{config}, err } +func getForceEnabledModulesFromFlag(forceEnabledFlag string) []string { + if forceEnabledFlag == "" { + return []string{} + } + return strings.Split(forceEnabledFlag, ",") +} + // mockFileSystem replaces all reads with accesses to the provided map of // filenames to contents stored as a byte slice. func (c *config) mockFileSystem(bp string, fs map[string][]byte) { diff --git a/android/deptag.go b/android/deptag.go index be5c35c8d..a15443b4a 100644 --- a/android/deptag.go +++ b/android/deptag.go @@ -34,10 +34,10 @@ func (i InstallAlwaysNeededDependencyTag) InstallDepNeeded() bool { var _ InstallNeededDependencyTag = InstallAlwaysNeededDependencyTag{} -// IsInstallDepNeeded returns true if the dependency tag implements the InstallNeededDependencyTag +// IsInstallDepNeededTag returns true if the dependency tag implements the InstallNeededDependencyTag // interface and the InstallDepNeeded returns true, meaning that the installed files of the parent // should depend on the installed files of the child. -func IsInstallDepNeeded(tag blueprint.DependencyTag) bool { +func IsInstallDepNeededTag(tag blueprint.DependencyTag) bool { if i, ok := tag.(InstallNeededDependencyTag); ok { return i.InstallDepNeeded() } diff --git a/android/license_metadata.go b/android/license_metadata.go index 18b63d310..73000a9fa 100644 --- a/android/license_metadata.go +++ b/android/license_metadata.go @@ -74,7 +74,7 @@ func buildLicenseMetadata(ctx ModuleContext, licenseMetadataFile WritablePath) { if ctx.OtherModuleHasProvider(dep, LicenseMetadataProvider) { info := ctx.OtherModuleProvider(dep, LicenseMetadataProvider).(*LicenseMetadataInfo) allDepMetadataFiles = append(allDepMetadataFiles, info.LicenseMetadataPath) - if isContainer || IsInstallDepNeeded(ctx.OtherModuleDependencyTag(dep)) { + if isContainer || isInstallDepNeeded(dep, ctx.OtherModuleDependencyTag(dep)) { allDepMetadataDepSets = append(allDepMetadataDepSets, info.LicenseMetadataDepSet) } diff --git a/android/module.go b/android/module.go index c8670c31a..db602a0aa 100644 --- a/android/module.go +++ b/android/module.go @@ -925,6 +925,12 @@ type commonProperties struct { // and don't create a rule to install the file. SkipInstall bool `blueprint:"mutated"` + // UninstallableApexPlatformVariant is set by MakeUninstallable called by the apex + // mutator. MakeUninstallable also sets HideFromMake. UninstallableApexPlatformVariant + // is used to avoid adding install or packaging dependencies into libraries provided + // by apexes. + UninstallableApexPlatformVariant bool `blueprint:"mutated"` + // Whether the module has been replaced by a prebuilt ReplacedByPrebuilt bool `blueprint:"mutated"` @@ -2009,6 +2015,7 @@ func (m *ModuleBase) IsSkipInstall() bool { // have other side effects, in particular when it adds a NOTICE file target, // which other install targets might depend on. func (m *ModuleBase) MakeUninstallable() { + m.commonProperties.UninstallableApexPlatformVariant = true m.HideFromMake() } @@ -2038,13 +2045,19 @@ func (m *ModuleBase) EffectiveLicenseFiles() Paths { } // computeInstallDeps finds the installed paths of all dependencies that have a dependency -// tag that is annotated as needing installation via the IsInstallDepNeeded method. +// tag that is annotated as needing installation via the isInstallDepNeeded method. func (m *ModuleBase) computeInstallDeps(ctx ModuleContext) ([]*installPathsDepSet, []*packagingSpecsDepSet) { var installDeps []*installPathsDepSet var packagingSpecs []*packagingSpecsDepSet ctx.VisitDirectDeps(func(dep Module) { - if IsInstallDepNeeded(ctx.OtherModuleDependencyTag(dep)) && !dep.IsHideFromMake() && !dep.IsSkipInstall() { - installDeps = append(installDeps, dep.base().installFilesDepSet) + if isInstallDepNeeded(dep, ctx.OtherModuleDependencyTag(dep)) { + // Installation is still handled by Make, so anything hidden from Make is not + // installable. + if !dep.IsHideFromMake() && !dep.IsSkipInstall() { + installDeps = append(installDeps, dep.base().installFilesDepSet) + } + // Add packaging deps even when the dependency is not installed so that uninstallable + // modules can still be packaged. Often the package will be installed instead. packagingSpecs = append(packagingSpecs, dep.base().packagingSpecsDepSet) } }) @@ -2052,6 +2065,17 @@ func (m *ModuleBase) computeInstallDeps(ctx ModuleContext) ([]*installPathsDepSe return installDeps, packagingSpecs } +// isInstallDepNeeded returns true if installing the output files of the current module +// should also install the output files of the given dependency and dependency tag. +func isInstallDepNeeded(dep Module, tag blueprint.DependencyTag) bool { + // Don't add a dependency from the platform to a library provided by an apex. + if dep.base().commonProperties.UninstallableApexPlatformVariant { + return false + } + // Only install modules if the dependency tag is an InstallDepNeeded tag. + return IsInstallDepNeededTag(tag) +} + func (m *ModuleBase) FilesToInstall() InstallPaths { return m.installFiles } diff --git a/android/packaging_test.go b/android/packaging_test.go index 91ac1f386..383343723 100644 --- a/android/packaging_test.go +++ b/android/packaging_test.go @@ -373,7 +373,7 @@ func TestPackagingBaseSingleTarget(t *testing.T) { func TestPackagingWithSkipInstallDeps(t *testing.T) { // package -[dep]-> foo -[dep]-> bar -[dep]-> baz - // OK SKIPPED + // Packaging should continue transitively through modules that are not installed. multiTarget := false runPackagingTest(t, multiTarget, ` @@ -396,5 +396,5 @@ func TestPackagingWithSkipInstallDeps(t *testing.T) { name: "package", deps: ["foo"], } - `, []string{"lib64/foo"}) + `, []string{"lib64/foo", "lib64/bar", "lib64/baz"}) } diff --git a/android/variable.go b/android/variable.go index 496f523b2..aaf0606e1 100644 --- a/android/variable.go +++ b/android/variable.go @@ -469,6 +469,10 @@ type productVariables struct { SourceRootDirs []string `json:",omitempty"` AfdoProfiles []string `json:",omitempty"` + + ProductManufacturer string `json:",omitempty"` + ProductBrand string `json:",omitempty"` + BuildVersionTags []string `json:",omitempty"` } func boolPtr(v bool) *bool { |