aboutsummaryrefslogtreecommitdiffstats
path: root/cc/cc.go
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2017-09-13 18:37:08 -0700
committerDan Willemsen <dwillemsen@google.com>2017-09-18 23:33:25 -0700
commit3e5bdf29ba6af25e7b82cf877db8e13b70d81512 (patch)
tree083bda03f48509955ea10ed1a1ad07a2ecd14946 /cc/cc.go
parent0c16293821e71d20c6e2a8dec394d169c2dc2372 (diff)
downloadbuild_soong-3e5bdf29ba6af25e7b82cf877db8e13b70d81512.tar.gz
build_soong-3e5bdf29ba6af25e7b82cf877db8e13b70d81512.tar.bz2
build_soong-3e5bdf29ba6af25e7b82cf877db8e13b70d81512.zip
Add cc_genrule
cc_genrule is the same as a normal genrule, but can depend on other cc modules (like cc_object). Test: mmma external/minijail Change-Id: I8df87665c7bdc76ce89c92755c054f967a818e57
Diffstat (limited to 'cc/cc.go')
-rw-r--r--cc/cc.go51
1 files changed, 38 insertions, 13 deletions
diff --git a/cc/cc.go b/cc/cc.go
index f0ba1c60..ea523ca6 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -154,6 +154,14 @@ type BaseProperties struct {
// cppflags, conlyflags, ldflags, or include_dirs
No_default_compiler_flags *bool
+ AndroidMkSharedLibs []string `blueprint:"mutated"`
+ HideFromMake bool `blueprint:"mutated"`
+ PreventInstall bool `blueprint:"mutated"`
+
+ UseVndk bool `blueprint:"mutated"`
+}
+
+type VendorProperties struct {
// whether this module should be allowed to install onto /vendor as
// well as /system. The two variants will be built separately, one
// like normal, and the other limited to the set of libraries and
@@ -166,12 +174,6 @@ type BaseProperties struct {
//
// Nothing happens if BOARD_VNDK_VERSION isn't set in the BoardConfig.mk
Vendor_available *bool
-
- AndroidMkSharedLibs []string `blueprint:"mutated"`
- HideFromMake bool `blueprint:"mutated"`
- PreventInstall bool `blueprint:"mutated"`
-
- UseVndk bool `blueprint:"mutated"`
}
type UnusedProperties struct {
@@ -281,8 +283,9 @@ type Module struct {
android.ModuleBase
android.DefaultableModuleBase
- Properties BaseProperties
- unused UnusedProperties
+ Properties BaseProperties
+ VendorProperties VendorProperties
+ unused UnusedProperties
// initialize before calling Init
hod android.HostOrDeviceSupported
@@ -313,7 +316,7 @@ type Module struct {
}
func (c *Module) Init() android.Module {
- c.AddProperties(&c.Properties, &c.unused)
+ c.AddProperties(&c.Properties, &c.VendorProperties, &c.unused)
if c.compiler != nil {
c.AddProperties(c.compiler.compilerProps()...)
}
@@ -1127,7 +1130,7 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
libName := strings.TrimSuffix(name, llndkLibrarySuffix)
libName = strings.TrimPrefix(libName, "prebuilt_")
isLLndk := inList(libName, llndkLibraries)
- if c.vndk() && (Bool(cc.Properties.Vendor_available) || isLLndk) {
+ if c.vndk() && (Bool(cc.VendorProperties.Vendor_available) || isLLndk) {
libName += vendorSuffix
}
// Note: the order of libs in this list is not important because
@@ -1178,6 +1181,13 @@ func (c *Module) IntermPathForModuleOut() android.OptionalPath {
return c.outputFile
}
+func (c *Module) Srcs() android.Paths {
+ if c.outputFile.Valid() {
+ return android.Paths{c.outputFile.Path()}
+ }
+ return android.Paths{}
+}
+
//
// Defaults
//
@@ -1202,6 +1212,7 @@ func DefaultsFactory(props ...interface{}) android.Module {
module.AddProperties(props...)
module.AddProperties(
&BaseProperties{},
+ &VendorProperties{},
&BaseCompilerProperties{},
&BaseLinkerProperties{},
&LibraryProperties{},
@@ -1241,19 +1252,33 @@ func vendorMutator(mctx android.BottomUpMutatorContext) {
return
}
+ if genrule, ok := mctx.Module().(*genrule.Module); ok {
+ if props, ok := genrule.Extra.(*VendorProperties); ok {
+ if !mctx.DeviceConfig().CompileVndk() {
+ mctx.CreateVariations(coreMode)
+ } else if Bool(props.Vendor_available) {
+ mctx.CreateVariations(coreMode, vendorMode)
+ } else if mctx.Vendor() {
+ mctx.CreateVariations(vendorMode)
+ } else {
+ mctx.CreateVariations(coreMode)
+ }
+ }
+ }
+
m, ok := mctx.Module().(*Module)
if !ok {
return
}
// Sanity check
- if Bool(m.Properties.Vendor_available) && mctx.Vendor() {
+ if Bool(m.VendorProperties.Vendor_available) && mctx.Vendor() {
mctx.PropertyErrorf("vendor_available",
"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) {
+ if vndk.isVndk() && !Bool(m.VendorProperties.Vendor_available) {
mctx.PropertyErrorf("vndk",
"has to define `vendor_available: true` to enable vndk")
return
@@ -1273,7 +1298,7 @@ func vendorMutator(mctx android.BottomUpMutatorContext) {
// LL-NDK stubs only exist in the vendor variant, since the
// real libraries will be used in the core variant.
mctx.CreateVariations(vendorMode)
- } else if Bool(m.Properties.Vendor_available) {
+ } else if Bool(m.VendorProperties.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)