aboutsummaryrefslogtreecommitdiffstats
path: root/cc/cc.go
diff options
context:
space:
mode:
authorJustin Yun <justinyun@google.com>2017-07-19 03:05:31 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-07-19 03:05:31 +0000
commitb47ac2a47386703274f0e4184ebab140951cdd77 (patch)
tree9835e9e740806f3c9e421f1975e4af8dae88b43c /cc/cc.go
parentcc5c93439b923ec42a97053a0a555485691288ae (diff)
parent1e4182c5371705e6be6203f86953decf2e36f892 (diff)
downloadbuild_soong-b47ac2a47386703274f0e4184ebab140951cdd77.tar.gz
build_soong-b47ac2a47386703274f0e4184ebab140951cdd77.tar.bz2
build_soong-b47ac2a47386703274f0e4184ebab140951cdd77.zip
Merge "Install VNDK libs in /system instead of /vendor" am: 57b314daba am: d16117330c am: aea659dcf1
am: 1e4182c537 Change-Id: I74ac3d1cce2674b08b76d2d5e43d42b523eac5da
Diffstat (limited to 'cc/cc.go')
-rw-r--r--cc/cc.go59
1 files changed, 54 insertions, 5 deletions
diff --git a/cc/cc.go b/cc/cc.go
index c17b95e5..8fc0ebdf 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -183,6 +183,8 @@ type ModuleContextIntf interface {
sdk() bool
sdkVersion() string
vndk() bool
+ isVndk() bool
+ isVndkSp() bool
createVndkSourceAbiDump() bool
selectedStl() string
baseModuleName() string
@@ -291,6 +293,7 @@ type Module struct {
sanitize *sanitize
coverage *coverage
sabi *sabi
+ vndkdep *vndkdep
androidMkSharedLibDeps []string
@@ -327,6 +330,9 @@ func (c *Module) Init() android.Module {
if c.sabi != nil {
c.AddProperties(c.sabi.props()...)
}
+ if c.vndkdep != nil {
+ c.AddProperties(c.vndkdep.props()...)
+ }
for _, feature := range c.features {
c.AddProperties(feature.props()...)
}
@@ -353,6 +359,13 @@ func (c *Module) vndk() bool {
return c.Properties.UseVndk
}
+func (c *Module) isVndk() bool {
+ if c.vndkdep != nil {
+ return c.vndkdep.isVndk()
+ }
+ return false
+}
+
type baseModuleContext struct {
android.BaseContext
moduleContextImpl
@@ -368,10 +381,10 @@ type moduleContext struct {
moduleContextImpl
}
-// Vendor returns true for vendor modules so that they get installed onto the
-// correct partition
+// Vendor returns true for vendor modules excluding VNDK libraries so that
+// they get installed onto the correct partition
func (ctx *moduleContext) Vendor() bool {
- return ctx.ModuleContext.Vendor() || ctx.moduleContextImpl.mod.Properties.UseVndk
+ return ctx.ModuleContext.Vendor() || (ctx.mod.vndk() && !ctx.mod.isVndk())
}
type moduleContextImpl struct {
@@ -431,9 +444,20 @@ func (ctx *moduleContextImpl) vndk() bool {
return ctx.mod.vndk()
}
+func (ctx *moduleContextImpl) isVndk() bool {
+ return ctx.mod.isVndk()
+}
+
+func (ctx *moduleContextImpl) isVndkSp() bool {
+ if vndk := ctx.mod.vndkdep; vndk != nil {
+ return vndk.isVndkSp()
+ }
+ return false
+}
+
// Create source abi dumps if the module belongs to the list of VndkLibraries.
func (ctx *moduleContextImpl) createVndkSourceAbiDump() bool {
- return ctx.ctx.Device() && ((Bool(ctx.mod.Properties.Vendor_available)) || (inList(ctx.baseModuleName(), config.LLndkLibraries())))
+ return ctx.ctx.Device() && (ctx.mod.isVndk() || inList(ctx.baseModuleName(), config.LLndkLibraries()))
}
func (ctx *moduleContextImpl) selectedStl() string {
@@ -463,6 +487,7 @@ func newModule(hod android.HostOrDeviceSupported, multilib android.Multilib) *Mo
module.sanitize = &sanitize{}
module.coverage = &coverage{}
module.sabi = &sabi{}
+ module.vndkdep = &vndkdep{}
return module
}
@@ -591,6 +616,9 @@ func (c *Module) begin(ctx BaseModuleContext) {
if c.sabi != nil {
c.sabi.begin(ctx)
}
+ if c.vndkdep != nil {
+ c.vndkdep.begin(ctx)
+ }
for _, feature := range c.features {
feature.begin(ctx)
}
@@ -624,6 +652,9 @@ func (c *Module) deps(ctx DepsContext) Deps {
if c.sabi != nil {
deps = c.sabi.deps(ctx, deps)
}
+ if c.vndkdep != nil {
+ deps = c.vndkdep.deps(ctx, deps)
+ }
for _, feature := range c.features {
deps = feature.deps(ctx, deps)
}
@@ -828,7 +859,12 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
return
}
if from.Properties.UseVndk {
- // Vendor code is already limited by the vendor mutator
+ // Though vendor code is limited by the vendor mutator,
+ // each vendor-available module needs to check
+ // link-type for VNDK.
+ if from.vndkdep != nil {
+ from.vndkdep.vndkCheckLinkType(ctx, to)
+ }
return
}
if from.Properties.Sdk_version == "" {
@@ -1169,6 +1205,18 @@ func vendorMutator(mctx android.BottomUpMutatorContext) {
"doesn't make sense at the same time as `vendor: true` or `proprietary: true`")
return
}
+ if vndk := m.vndkdep; vndk != nil {
+ if vndk.isVndk() && !Bool(m.Properties.Vendor_available) {
+ mctx.PropertyErrorf("vndk",
+ "has to define `vendor_available: true` to enable vndk")
+ return
+ }
+ if !vndk.isVndk() && vndk.isVndkSp() {
+ mctx.PropertyErrorf("vndk",
+ "must set `enabled: true` to set `support_system_process: true`")
+ return
+ }
+ }
if !mctx.DeviceConfig().CompileVndk() {
// If the device isn't compiling against the VNDK, we always
@@ -1180,6 +1228,7 @@ func vendorMutator(mctx android.BottomUpMutatorContext) {
mctx.CreateVariations(vendorMode)
} else if Bool(m.Properties.Vendor_available) {
// This will be available in both /system and /vendor
+ // or a /system directory that is available to vendor.
mod := mctx.CreateVariations(coreMode, vendorMode)
mod[1].(*Module).Properties.UseVndk = true
} else if mctx.Vendor() && m.Properties.Sdk_version == "" {