aboutsummaryrefslogtreecommitdiffstats
path: root/cc/library.go
diff options
context:
space:
mode:
authorInseob Kim <inseob@google.com>2019-02-08 21:00:45 +0900
committerInseob Kim <inseob@google.com>2019-02-13 23:32:51 +0000
commitc0907f191a6c466d077030500f855cdd87ec954a (patch)
tree18b82c6ebe4f81d49eb8f34a548d8ecddef7ac47 /cc/library.go
parent58b31ad33a8df9f8ea27b9d6c928560d7a6a2452 (diff)
downloadbuild_soong-c0907f191a6c466d077030500f855cdd87ec954a.tar.gz
build_soong-c0907f191a6c466d077030500f855cdd87ec954a.tar.bz2
build_soong-c0907f191a6c466d077030500f855cdd87ec954a.zip
Create sysprop_library soong module
A newly introduced sysprop_library soong module will generate a java_sdk_library and a cc_library from .sysprop description files. Both Java modules and C++ modules can link against sysprop_library module, thus giving consistency for using generated sysprop API. As Java controls accessibility of Internal / System properties with @hide and @SystemApi, 2 different header files will be created. And build system will selectively expose depending on the property owner and the place where the client libraries go into. Bug: 80125326 Bug: 122170616 Test: 1) Create sysprop_library module. Test: 2) Create empty txt files under prebuilts/sdk. Test: 3) Create api directory, make update-api, and see changes. Test: 4) Try to link against sysprop_library with various clients. Test: 5) Soc_specific, Device_specific, Product_specific, recovery flags work as intended. Change-Id: I78dc5780ccfbb4b69e5c61dec26b94e92d43c333
Diffstat (limited to 'cc/library.go')
-rw-r--r--cc/library.go25
1 files changed, 24 insertions, 1 deletions
diff --git a/cc/library.go b/cc/library.go
index a6c7bc87..a48b45db 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -67,6 +67,11 @@ type LibraryProperties struct {
Export_proto_headers *bool
}
+ Sysprop struct {
+ // Whether platform owns this sysprop library.
+ Platform *bool
+ }
+
Static_ndk_lib *bool
Stubs struct {
@@ -836,9 +841,27 @@ func (library *libraryDecorator) link(ctx ModuleContext,
}
if library.baseCompiler.hasSrcExt(".sysprop") {
- flags := []string{
+ internalFlags := []string{
"-I" + android.PathForModuleGen(ctx, "sysprop", "include").String(),
}
+ systemFlags := []string{
+ "-I" + android.PathForModuleGen(ctx, "sysprop/system", "include").String(),
+ }
+
+ flags := internalFlags
+
+ if library.Properties.Sysprop.Platform != nil {
+ isProduct := ctx.ProductSpecific() && !ctx.useVndk()
+ isVendor := ctx.useVndk()
+ isOwnerPlatform := Bool(library.Properties.Sysprop.Platform)
+
+ useSystem := isProduct || (isOwnerPlatform == isVendor)
+
+ if useSystem {
+ flags = systemFlags
+ }
+ }
+
library.reexportFlags(flags)
library.reexportDeps(library.baseCompiler.pathDeps)
library.reuseExportedFlags = append(library.reuseExportedFlags, flags...)