aboutsummaryrefslogtreecommitdiffstats
path: root/cc/cc.go
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-07-19 07:24:20 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-07-19 07:24:20 +0000
commit10e92df42b9cafff1f7d14496c05c87ed229ec44 (patch)
tree27b5c7b42ffd828befdeddc7787cf2ce8bddee78 /cc/cc.go
parente0c14759aca99759d46749dec1f31345b39f7218 (diff)
parentf79c18b29f1080ec1792842683f77ff62be46f97 (diff)
downloadbuild_soong-10e92df42b9cafff1f7d14496c05c87ed229ec44.tar.gz
build_soong-10e92df42b9cafff1f7d14496c05c87ed229ec44.tar.bz2
build_soong-10e92df42b9cafff1f7d14496c05c87ed229ec44.zip
release-request-bd6aa7dd-7b02-4794-942c-14599bf61208-for-git_oc-mr1-release-4193791 snap-temp-L98700000083613807
Change-Id: If9e6fc6694d4583ca1e0efa94507a768ca4443c9
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 == "" {