enforce updatable apexes to set min_sdk_version
updatable APEXes should set min_sdk_version as well.
Bug: 152655956
Test: m
Merged-In: I8192086eb89fa958dd8ff1b731e43e24bf217ce2
Change-Id: I8192086eb89fa958dd8ff1b731e43e24bf217ce2
(cherry picked from commit 548640b55f732aa7e42ae9112d38e13e54988df2)
diff --git a/apex/apex.go b/apex/apex.go
index 82e2442..74ae285 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -1111,8 +1111,10 @@
IsCoverageVariant bool `blueprint:"mutated"`
// Whether this APEX is considered updatable or not. When set to true, this will enforce additional
- // rules for making sure that the APEX is truely updatable. This will also disable the size optimizations
- // like symlinking to the system libs. Default is false.
+ // rules for making sure that the APEX is truly updatable.
+ // - To be updatable, min_sdk_version should be set as well
+ // This will also disable the size optimizations like symlinking to the system libs.
+ // Default is false.
Updatable *bool
// The minimum SDK version that this apex must be compatible with.
@@ -1885,6 +1887,14 @@
})
}
+func (a *apexBundle) checkUpdatable(ctx android.ModuleContext) {
+ if proptools.Bool(a.properties.Updatable) {
+ if String(a.properties.Min_sdk_version) == "" {
+ ctx.PropertyErrorf("updatable", "updatable APEXes should set min_sdk_version as well")
+ }
+ }
+}
+
// Collects the list of module names that directly or indirectly contributes to the payload of this APEX
func (a *apexBundle) collectDepsInfo(ctx android.ModuleContext) {
a.depInfos = make(map[string]depInfo)
@@ -1950,6 +1960,7 @@
}
a.checkApexAvailability(ctx)
+ a.checkUpdatable(ctx)
a.collectDepsInfo(ctx)