Loading Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -492,6 +492,7 @@ bootstrap_go_package { srcs: [ "apex/androidmk.go", "apex/apex.go", "apex/apex_singleton.go", "apex/builder.go", "apex/key.go", "apex/prebuilt.go", Loading android/apex.go +2 −3 Original line number Diff line number Diff line Loading @@ -425,7 +425,8 @@ type ApexBundleDepsInfo struct { fullListPath OutputPath } type ApexDepsInfoIntf interface { type ApexBundleDepsInfoIntf interface { Updatable() bool FlatListPath() Path FullListPath() Path } Loading @@ -438,8 +439,6 @@ func (d *ApexBundleDepsInfo) FullListPath() Path { return d.fullListPath } var _ ApexDepsInfoIntf = (*ApexBundleDepsInfo)(nil) // Generate two module out files: // 1. FullList with transitive deps and their parents in the dep graph // 2. FlatList with a flat list of transitive deps Loading apex/apex.go +9 −3 Original line number Diff line number Diff line Loading @@ -758,7 +758,7 @@ func apexDepsMutator(mctx android.TopDownMutatorContext) { apexBundles = []android.ApexInfo{{ ApexName: mctx.ModuleName(), MinSdkVersion: a.minSdkVersion(mctx), Updatable: proptools.Bool(a.properties.Updatable), Updatable: a.Updatable(), }} directDep = true } else if am, ok := mctx.Module().(android.ApexModule); ok { Loading Loading @@ -1812,6 +1812,12 @@ func (a *apexBundle) minSdkVersion(ctx android.BaseModuleContext) int { return intVer } func (a *apexBundle) Updatable() bool { return proptools.Bool(a.properties.Updatable) } var _ android.ApexBundleDepsInfoIntf = (*apexBundle)(nil) // Ensures that the dependencies are marked as available for this APEX func (a *apexBundle) checkApexAvailability(ctx android.ModuleContext) { // Let's be practical. Availability for test, host, and the VNDK apex isn't important Loading Loading @@ -1853,7 +1859,7 @@ func (a *apexBundle) checkApexAvailability(ctx android.ModuleContext) { } func (a *apexBundle) checkUpdatable(ctx android.ModuleContext) { if proptools.Bool(a.properties.Updatable) { if a.Updatable() { if String(a.properties.Min_sdk_version) == "" { ctx.PropertyErrorf("updatable", "updatable APEXes should set min_sdk_version as well") } Loading Loading @@ -2239,7 +2245,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) { // We don't need the optimization for updatable APEXes, as it might give false signal // to the system health when the APEXes are still bundled (b/149805758) if proptools.Bool(a.properties.Updatable) && a.properties.ApexType == imageApex { if a.Updatable() && a.properties.ApexType == imageApex { a.linkToSystemLib = false } Loading apex/apex_singleton.go 0 → 100644 +65 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package apex import ( "github.com/google/blueprint" "android/soong/android" ) func init() { android.RegisterSingletonType("apex_depsinfo_singleton", apexDepsInfoSingletonFactory) } type apexDepsInfoSingleton struct { // Output file with all flatlists from updatable modules' deps-info combined updatableFlatListsPath android.OutputPath } func apexDepsInfoSingletonFactory() android.Singleton { return &apexDepsInfoSingleton{} } var combineFilesRule = pctx.AndroidStaticRule("combineFilesRule", blueprint.RuleParams{ Command: "cat $out.rsp | xargs cat > $out", Rspfile: "$out.rsp", RspfileContent: "$in", }, ) func (s *apexDepsInfoSingleton) GenerateBuildActions(ctx android.SingletonContext) { updatableFlatLists := android.Paths{} ctx.VisitAllModules(func(module android.Module) { if binaryInfo, ok := module.(android.ApexBundleDepsInfoIntf); ok { if path := binaryInfo.FlatListPath(); path != nil { if binaryInfo.Updatable() { updatableFlatLists = append(updatableFlatLists, path) } } } }) s.updatableFlatListsPath = android.PathForOutput(ctx, "apex", "depsinfo", "updatable-flatlists.txt") ctx.Build(pctx, android.BuildParams{ Rule: combineFilesRule, Description: "Generate " + s.updatableFlatListsPath.String(), Inputs: updatableFlatLists, Output: s.updatableFlatListsPath, }) } java/app.go +5 −1 Original line number Diff line number Diff line Loading @@ -414,7 +414,7 @@ func (a *AndroidApp) GenerateAndroidBuildActions(ctx android.ModuleContext) { } func (a *AndroidApp) checkAppSdkVersions(ctx android.ModuleContext) { if Bool(a.appProperties.Updatable) || a.ApexModuleBase.Updatable() { if a.Updatable() { if !a.sdkVersion().stable() { ctx.PropertyErrorf("sdk_version", "Updatable apps must use stable SDKs, found %v", a.sdkVersion()) } Loading Loading @@ -897,6 +897,10 @@ func (a *AndroidApp) buildAppDependencyInfo(ctx android.ModuleContext) { a.ApexBundleDepsInfo.BuildDepsInfoLists(ctx, a.MinSdkVersion(), depsInfo) } func (a *AndroidApp) Updatable() bool { return Bool(a.appProperties.Updatable) || a.ApexModuleBase.Updatable() } func (a *AndroidApp) getCertString(ctx android.BaseModuleContext) string { certificate, overridden := ctx.DeviceConfig().OverrideCertificateFor(ctx.ModuleName()) if overridden { Loading Loading
Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -492,6 +492,7 @@ bootstrap_go_package { srcs: [ "apex/androidmk.go", "apex/apex.go", "apex/apex_singleton.go", "apex/builder.go", "apex/key.go", "apex/prebuilt.go", Loading
android/apex.go +2 −3 Original line number Diff line number Diff line Loading @@ -425,7 +425,8 @@ type ApexBundleDepsInfo struct { fullListPath OutputPath } type ApexDepsInfoIntf interface { type ApexBundleDepsInfoIntf interface { Updatable() bool FlatListPath() Path FullListPath() Path } Loading @@ -438,8 +439,6 @@ func (d *ApexBundleDepsInfo) FullListPath() Path { return d.fullListPath } var _ ApexDepsInfoIntf = (*ApexBundleDepsInfo)(nil) // Generate two module out files: // 1. FullList with transitive deps and their parents in the dep graph // 2. FlatList with a flat list of transitive deps Loading
apex/apex.go +9 −3 Original line number Diff line number Diff line Loading @@ -758,7 +758,7 @@ func apexDepsMutator(mctx android.TopDownMutatorContext) { apexBundles = []android.ApexInfo{{ ApexName: mctx.ModuleName(), MinSdkVersion: a.minSdkVersion(mctx), Updatable: proptools.Bool(a.properties.Updatable), Updatable: a.Updatable(), }} directDep = true } else if am, ok := mctx.Module().(android.ApexModule); ok { Loading Loading @@ -1812,6 +1812,12 @@ func (a *apexBundle) minSdkVersion(ctx android.BaseModuleContext) int { return intVer } func (a *apexBundle) Updatable() bool { return proptools.Bool(a.properties.Updatable) } var _ android.ApexBundleDepsInfoIntf = (*apexBundle)(nil) // Ensures that the dependencies are marked as available for this APEX func (a *apexBundle) checkApexAvailability(ctx android.ModuleContext) { // Let's be practical. Availability for test, host, and the VNDK apex isn't important Loading Loading @@ -1853,7 +1859,7 @@ func (a *apexBundle) checkApexAvailability(ctx android.ModuleContext) { } func (a *apexBundle) checkUpdatable(ctx android.ModuleContext) { if proptools.Bool(a.properties.Updatable) { if a.Updatable() { if String(a.properties.Min_sdk_version) == "" { ctx.PropertyErrorf("updatable", "updatable APEXes should set min_sdk_version as well") } Loading Loading @@ -2239,7 +2245,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) { // We don't need the optimization for updatable APEXes, as it might give false signal // to the system health when the APEXes are still bundled (b/149805758) if proptools.Bool(a.properties.Updatable) && a.properties.ApexType == imageApex { if a.Updatable() && a.properties.ApexType == imageApex { a.linkToSystemLib = false } Loading
apex/apex_singleton.go 0 → 100644 +65 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package apex import ( "github.com/google/blueprint" "android/soong/android" ) func init() { android.RegisterSingletonType("apex_depsinfo_singleton", apexDepsInfoSingletonFactory) } type apexDepsInfoSingleton struct { // Output file with all flatlists from updatable modules' deps-info combined updatableFlatListsPath android.OutputPath } func apexDepsInfoSingletonFactory() android.Singleton { return &apexDepsInfoSingleton{} } var combineFilesRule = pctx.AndroidStaticRule("combineFilesRule", blueprint.RuleParams{ Command: "cat $out.rsp | xargs cat > $out", Rspfile: "$out.rsp", RspfileContent: "$in", }, ) func (s *apexDepsInfoSingleton) GenerateBuildActions(ctx android.SingletonContext) { updatableFlatLists := android.Paths{} ctx.VisitAllModules(func(module android.Module) { if binaryInfo, ok := module.(android.ApexBundleDepsInfoIntf); ok { if path := binaryInfo.FlatListPath(); path != nil { if binaryInfo.Updatable() { updatableFlatLists = append(updatableFlatLists, path) } } } }) s.updatableFlatListsPath = android.PathForOutput(ctx, "apex", "depsinfo", "updatable-flatlists.txt") ctx.Build(pctx, android.BuildParams{ Rule: combineFilesRule, Description: "Generate " + s.updatableFlatListsPath.String(), Inputs: updatableFlatLists, Output: s.updatableFlatListsPath, }) }
java/app.go +5 −1 Original line number Diff line number Diff line Loading @@ -414,7 +414,7 @@ func (a *AndroidApp) GenerateAndroidBuildActions(ctx android.ModuleContext) { } func (a *AndroidApp) checkAppSdkVersions(ctx android.ModuleContext) { if Bool(a.appProperties.Updatable) || a.ApexModuleBase.Updatable() { if a.Updatable() { if !a.sdkVersion().stable() { ctx.PropertyErrorf("sdk_version", "Updatable apps must use stable SDKs, found %v", a.sdkVersion()) } Loading Loading @@ -897,6 +897,10 @@ func (a *AndroidApp) buildAppDependencyInfo(ctx android.ModuleContext) { a.ApexBundleDepsInfo.BuildDepsInfoLists(ctx, a.MinSdkVersion(), depsInfo) } func (a *AndroidApp) Updatable() bool { return Bool(a.appProperties.Updatable) || a.ApexModuleBase.Updatable() } func (a *AndroidApp) getCertString(ctx android.BaseModuleContext) string { certificate, overridden := ctx.DeviceConfig().OverrideCertificateFor(ctx.ModuleName()) if overridden { Loading