cc: add min_sdk_version prop
min_sdk_version is the minimum version of the sdk that the compiled
artifacts will run against.
For example, when a module is used by two APEXes and their
min_sdk_versions are set to 29 and 30, then the module should support
both versions even if it is compiled against 30. Therefore,
min_sdk_version of the module needs to be set 29 in that case. In
general, this is set as the minimum value of min_sdk_vesions of APEXes.
For now, there's no build-time checks about this prop even if the prop
is set.
Bug: 145796956
Bug: 152655956
Bug: 153333044
Test: m nothing
Merged-In: I072ad8c317d2615e8b08e4e7ea2db8e7955b4b12
Change-Id: I072ad8c317d2615e8b08e4e7ea2db8e7955b4b12
(cherry picked from commit 379660c9c2d7310a5c6f69a4a63e7ab82aa4fc2d)
diff --git a/cc/cc.go b/cc/cc.go
index 5654ef5..9baeceb 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -211,6 +211,9 @@
// Minimum sdk version supported when compiling against the ndk
Sdk_version *string
+ // Minimum sdk version that the artifact should support when it runs as part of mainline modules(APEX).
+ Min_sdk_version *string
+
AndroidMkSharedLibs []string `blueprint:"mutated"`
AndroidMkStaticLibs []string `blueprint:"mutated"`
AndroidMkRuntimeLibs []string `blueprint:"mutated"`
diff --git a/sysprop/sysprop_library.go b/sysprop/sysprop_library.go
index 9d492fe..14fab68 100644
--- a/sysprop/sysprop_library.go
+++ b/sysprop/sysprop_library.go
@@ -150,6 +150,12 @@
// Whether public stub exists or not.
Public_stub *bool `blueprint:"mutated"`
+
+ Cpp struct {
+ // Minimum sdk version that the artifact should support when it runs as part of mainline modules(APEX).
+ // Forwarded to cc_library.min_sdk_version
+ Min_sdk_version *string
+ }
}
var (
@@ -326,6 +332,7 @@
Vendor_available *bool
Host_supported *bool
Apex_available []string
+ Min_sdk_version *string
}
type javaLibraryProperties struct {
@@ -415,6 +422,7 @@
ccProps.Vendor_available = m.properties.Vendor_available
ccProps.Host_supported = m.properties.Host_supported
ccProps.Apex_available = m.ApexProperties.Apex_available
+ ccProps.Min_sdk_version = m.properties.Cpp.Min_sdk_version
ctx.CreateModule(cc.LibraryFactory, &ccProps)
scope := "internal"