Change bool, and string properties to *bool, and *string for cc
there's no use case for prepending/appending to bool, and string properties within module struct. Declearing "*bool" and "*string" almost cover everything user need. I did see one case that user specify relative_install_path as path prefix in cc_defaults, and concatenate with the one in real module to get the final relative install path in Android.bp <bionic/tests/libs>. Test: m -j checkbuild Bug: b/68853585 Change-Id: If3a7a2689c3fc307aae136af6bc9c57f27a1e1a0
This commit is contained in:
@@ -25,7 +25,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
"github.com/google/blueprint"
|
||||||
"github.com/google/blueprint/proptools"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@@ -77,7 +76,7 @@ func (c *androidMkSingleton) GenerateBuildActions(ctx blueprint.SingletonContext
|
|||||||
|
|
||||||
sort.Sort(AndroidModulesByName{androidMkModulesList, ctx})
|
sort.Sort(AndroidModulesByName{androidMkModulesList, ctx})
|
||||||
|
|
||||||
transMk := PathForOutput(ctx, "Android"+proptools.String(config.ProductVariables.Make_suffix)+".mk")
|
transMk := PathForOutput(ctx, "Android"+String(config.ProductVariables.Make_suffix)+".mk")
|
||||||
if ctx.Failed() {
|
if ctx.Failed() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@@ -152,7 +152,7 @@ type Module interface {
|
|||||||
|
|
||||||
type nameProperties struct {
|
type nameProperties struct {
|
||||||
// The name of the module. Must be unique across all modules.
|
// The name of the module. Must be unique across all modules.
|
||||||
Name string
|
Name *string
|
||||||
}
|
}
|
||||||
|
|
||||||
type commonProperties struct {
|
type commonProperties struct {
|
||||||
@@ -351,12 +351,12 @@ func (a *ModuleBase) BuildParamsForTests() []BuildParams {
|
|||||||
// Name returns the name of the module. It may be overridden by individual module types, for
|
// Name returns the name of the module. It may be overridden by individual module types, for
|
||||||
// example prebuilts will prepend prebuilt_ to the name.
|
// example prebuilts will prepend prebuilt_ to the name.
|
||||||
func (a *ModuleBase) Name() string {
|
func (a *ModuleBase) Name() string {
|
||||||
return a.nameProperties.Name
|
return String(a.nameProperties.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// BaseModuleName returns the name of the module as specified in the blueprints file.
|
// BaseModuleName returns the name of the module as specified in the blueprints file.
|
||||||
func (a *ModuleBase) BaseModuleName() string {
|
func (a *ModuleBase) BaseModuleName() string {
|
||||||
return a.nameProperties.Name
|
return String(a.nameProperties.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *ModuleBase) base() *ModuleBase {
|
func (a *ModuleBase) base() *ModuleBase {
|
||||||
|
@@ -32,7 +32,7 @@ var prebuiltDepTag prebuiltDependencyTag
|
|||||||
type PrebuiltProperties struct {
|
type PrebuiltProperties struct {
|
||||||
// When prefer is set to true the prebuilt will be used instead of any source module with
|
// When prefer is set to true the prebuilt will be used instead of any source module with
|
||||||
// a matching name.
|
// a matching name.
|
||||||
Prefer bool `android:"arch_variant"`
|
Prefer *bool `android:"arch_variant"`
|
||||||
|
|
||||||
SourceExists bool `blueprint:"mutated"`
|
SourceExists bool `blueprint:"mutated"`
|
||||||
UsePrebuilt bool `blueprint:"mutated"`
|
UsePrebuilt bool `blueprint:"mutated"`
|
||||||
@@ -146,7 +146,7 @@ func (p *Prebuilt) usePrebuilt(ctx TopDownMutatorContext, source Module) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: use p.Properties.Name and ctx.ModuleDir to override preference
|
// TODO: use p.Properties.Name and ctx.ModuleDir to override preference
|
||||||
if p.properties.Prefer {
|
if Bool(p.properties.Prefer) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -64,8 +64,9 @@ func (c *Module) AndroidMk() android.AndroidMkData {
|
|||||||
if len(c.Properties.AndroidMkSharedLibs) > 0 {
|
if len(c.Properties.AndroidMkSharedLibs) > 0 {
|
||||||
fmt.Fprintln(w, "LOCAL_SHARED_LIBRARIES := "+strings.Join(c.Properties.AndroidMkSharedLibs, " "))
|
fmt.Fprintln(w, "LOCAL_SHARED_LIBRARIES := "+strings.Join(c.Properties.AndroidMkSharedLibs, " "))
|
||||||
}
|
}
|
||||||
if c.Target().Os == android.Android && c.Properties.Sdk_version != "" && !c.useVndk() {
|
if c.Target().Os == android.Android &&
|
||||||
fmt.Fprintln(w, "LOCAL_SDK_VERSION := "+c.Properties.Sdk_version)
|
String(c.Properties.Sdk_version) != "" && !c.useVndk() {
|
||||||
|
fmt.Fprintln(w, "LOCAL_SDK_VERSION := "+String(c.Properties.Sdk_version))
|
||||||
fmt.Fprintln(w, "LOCAL_NDK_STL_VARIANT := none")
|
fmt.Fprintln(w, "LOCAL_NDK_STL_VARIANT := none")
|
||||||
} else {
|
} else {
|
||||||
// These are already included in LOCAL_SHARED_LIBRARIES
|
// These are already included in LOCAL_SHARED_LIBRARIES
|
||||||
@@ -244,7 +245,7 @@ func (test *testBinary) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkDa
|
|||||||
ctx.subAndroidMk(ret, test.binaryDecorator)
|
ctx.subAndroidMk(ret, test.binaryDecorator)
|
||||||
ret.Class = "NATIVE_TESTS"
|
ret.Class = "NATIVE_TESTS"
|
||||||
if Bool(test.Properties.Test_per_src) {
|
if Bool(test.Properties.Test_per_src) {
|
||||||
ret.SubName = "_" + test.binaryDecorator.Properties.Stem
|
ret.SubName = "_" + String(test.binaryDecorator.Properties.Stem)
|
||||||
}
|
}
|
||||||
|
|
||||||
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
|
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
|
||||||
@@ -276,9 +277,10 @@ func (stripper *stripper) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMk
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
|
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
|
||||||
if stripper.StripProperties.Strip.None {
|
if Bool(stripper.StripProperties.Strip.None) {
|
||||||
|
|
||||||
fmt.Fprintln(w, "LOCAL_STRIP_MODULE := false")
|
fmt.Fprintln(w, "LOCAL_STRIP_MODULE := false")
|
||||||
} else if stripper.StripProperties.Strip.Keep_symbols {
|
} else if Bool(stripper.StripProperties.Strip.Keep_symbols) {
|
||||||
fmt.Fprintln(w, "LOCAL_STRIP_MODULE := keep_symbols")
|
fmt.Fprintln(w, "LOCAL_STRIP_MODULE := keep_symbols")
|
||||||
} else {
|
} else {
|
||||||
fmt.Fprintln(w, "LOCAL_STRIP_MODULE := mini-debug-info")
|
fmt.Fprintln(w, "LOCAL_STRIP_MODULE := mini-debug-info")
|
||||||
|
28
cc/binary.go
28
cc/binary.go
@@ -15,8 +15,6 @@
|
|||||||
package cc
|
package cc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/google/blueprint/proptools"
|
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -25,19 +23,19 @@ type BinaryLinkerProperties struct {
|
|||||||
Static_executable *bool `android:"arch_variant"`
|
Static_executable *bool `android:"arch_variant"`
|
||||||
|
|
||||||
// set the name of the output
|
// set the name of the output
|
||||||
Stem string `android:"arch_variant"`
|
Stem *string `android:"arch_variant"`
|
||||||
|
|
||||||
// append to the name of the output
|
// append to the name of the output
|
||||||
Suffix string `android:"arch_variant"`
|
Suffix *string `android:"arch_variant"`
|
||||||
|
|
||||||
// if set, add an extra objcopy --prefix-symbols= step
|
// if set, add an extra objcopy --prefix-symbols= step
|
||||||
Prefix_symbols string
|
Prefix_symbols *string
|
||||||
|
|
||||||
// local file name to pass to the linker as --version_script
|
// local file name to pass to the linker as --version_script
|
||||||
Version_script *string `android:"arch_variant"`
|
Version_script *string `android:"arch_variant"`
|
||||||
|
|
||||||
// if set, install a symlink to the preferred architecture
|
// if set, install a symlink to the preferred architecture
|
||||||
Symlink_preferred_arch bool
|
Symlink_preferred_arch *bool
|
||||||
|
|
||||||
// install symlinks to the binary. Symlink names will have the suffix and the binary
|
// install symlinks to the binary. Symlink names will have the suffix and the binary
|
||||||
// extension (if any) appended
|
// extension (if any) appended
|
||||||
@@ -97,11 +95,11 @@ func (binary *binaryDecorator) linkerProps() []interface{} {
|
|||||||
|
|
||||||
func (binary *binaryDecorator) getStem(ctx BaseModuleContext) string {
|
func (binary *binaryDecorator) getStem(ctx BaseModuleContext) string {
|
||||||
stem := ctx.baseModuleName()
|
stem := ctx.baseModuleName()
|
||||||
if binary.Properties.Stem != "" {
|
if String(binary.Properties.Stem) != "" {
|
||||||
stem = binary.Properties.Stem
|
stem = String(binary.Properties.Stem)
|
||||||
}
|
}
|
||||||
|
|
||||||
return stem + binary.Properties.Suffix
|
return stem + String(binary.Properties.Suffix)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (binary *binaryDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {
|
func (binary *binaryDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {
|
||||||
@@ -185,7 +183,7 @@ func (binary *binaryDecorator) linkerInit(ctx BaseModuleContext) {
|
|||||||
if !ctx.toolchain().Bionic() {
|
if !ctx.toolchain().Bionic() {
|
||||||
if ctx.Os() == android.Linux {
|
if ctx.Os() == android.Linux {
|
||||||
if binary.Properties.Static_executable == nil && Bool(ctx.AConfig().ProductVariables.HostStaticBinaries) {
|
if binary.Properties.Static_executable == nil && Bool(ctx.AConfig().ProductVariables.HostStaticBinaries) {
|
||||||
binary.Properties.Static_executable = proptools.BoolPtr(true)
|
binary.Properties.Static_executable = BoolPtr(true)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Static executables are not supported on Darwin or Windows
|
// Static executables are not supported on Darwin or Windows
|
||||||
@@ -315,10 +313,10 @@ func (binary *binaryDecorator) link(ctx ModuleContext,
|
|||||||
binary.stripper.strip(ctx, outputFile, strippedOutputFile, builderFlags)
|
binary.stripper.strip(ctx, outputFile, strippedOutputFile, builderFlags)
|
||||||
}
|
}
|
||||||
|
|
||||||
if binary.Properties.Prefix_symbols != "" {
|
if String(binary.Properties.Prefix_symbols) != "" {
|
||||||
afterPrefixSymbols := outputFile
|
afterPrefixSymbols := outputFile
|
||||||
outputFile = android.PathForModuleOut(ctx, "unprefixed", fileName)
|
outputFile = android.PathForModuleOut(ctx, "unprefixed", fileName)
|
||||||
TransformBinaryPrefixSymbols(ctx, binary.Properties.Prefix_symbols, outputFile,
|
TransformBinaryPrefixSymbols(ctx, String(binary.Properties.Prefix_symbols), outputFile,
|
||||||
flagsToBuilderFlags(flags), afterPrefixSymbols)
|
flagsToBuilderFlags(flags), afterPrefixSymbols)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -342,11 +340,11 @@ func (binary *binaryDecorator) install(ctx ModuleContext, file android.Path) {
|
|||||||
binary.baseInstaller.install(ctx, file)
|
binary.baseInstaller.install(ctx, file)
|
||||||
for _, symlink := range binary.Properties.Symlinks {
|
for _, symlink := range binary.Properties.Symlinks {
|
||||||
binary.symlinks = append(binary.symlinks,
|
binary.symlinks = append(binary.symlinks,
|
||||||
symlink+binary.Properties.Suffix+ctx.toolchain().ExecutableSuffix())
|
symlink+String(binary.Properties.Suffix)+ctx.toolchain().ExecutableSuffix())
|
||||||
}
|
}
|
||||||
|
|
||||||
if binary.Properties.Symlink_preferred_arch {
|
if Bool(binary.Properties.Symlink_preferred_arch) {
|
||||||
if binary.Properties.Stem == "" && binary.Properties.Suffix == "" {
|
if String(binary.Properties.Stem) == "" && String(binary.Properties.Suffix) == "" {
|
||||||
ctx.PropertyErrorf("symlink_preferred_arch", "must also specify stem or suffix")
|
ctx.PropertyErrorf("symlink_preferred_arch", "must also specify stem or suffix")
|
||||||
}
|
}
|
||||||
if ctx.TargetPrimary() {
|
if ctx.TargetPrimary() {
|
||||||
|
33
cc/cc.go
33
cc/cc.go
@@ -148,7 +148,7 @@ type ObjectLinkerProperties struct {
|
|||||||
Objs []string `android:"arch_variant"`
|
Objs []string `android:"arch_variant"`
|
||||||
|
|
||||||
// if set, add an extra objcopy --prefix-symbols= step
|
// if set, add an extra objcopy --prefix-symbols= step
|
||||||
Prefix_symbols string
|
Prefix_symbols *string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Properties used to compile all C or C++ modules
|
// Properties used to compile all C or C++ modules
|
||||||
@@ -157,7 +157,7 @@ type BaseProperties struct {
|
|||||||
Clang *bool `android:"arch_variant"`
|
Clang *bool `android:"arch_variant"`
|
||||||
|
|
||||||
// Minimum sdk version supported when compiling against the ndk
|
// Minimum sdk version supported when compiling against the ndk
|
||||||
Sdk_version string
|
Sdk_version *string
|
||||||
|
|
||||||
AndroidMkSharedLibs []string `blueprint:"mutated"`
|
AndroidMkSharedLibs []string `blueprint:"mutated"`
|
||||||
HideFromMake bool `blueprint:"mutated"`
|
HideFromMake bool `blueprint:"mutated"`
|
||||||
@@ -449,7 +449,7 @@ func (ctx *moduleContextImpl) staticBinary() bool {
|
|||||||
|
|
||||||
func (ctx *moduleContextImpl) useSdk() bool {
|
func (ctx *moduleContextImpl) useSdk() bool {
|
||||||
if ctx.ctx.Device() && !ctx.useVndk() {
|
if ctx.ctx.Device() && !ctx.useVndk() {
|
||||||
return ctx.mod.Properties.Sdk_version != ""
|
return String(ctx.mod.Properties.Sdk_version) != ""
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@@ -459,7 +459,7 @@ func (ctx *moduleContextImpl) sdkVersion() string {
|
|||||||
if ctx.useVndk() {
|
if ctx.useVndk() {
|
||||||
return "current"
|
return "current"
|
||||||
} else {
|
} else {
|
||||||
return ctx.mod.Properties.Sdk_version
|
return String(ctx.mod.Properties.Sdk_version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
@@ -711,7 +711,7 @@ func (c *Module) begin(ctx BaseModuleContext) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.PropertyErrorf("sdk_version", err.Error())
|
ctx.PropertyErrorf("sdk_version", err.Error())
|
||||||
}
|
}
|
||||||
c.Properties.Sdk_version = version
|
c.Properties.Sdk_version = StringPtr(version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -960,7 +960,7 @@ func checkLinkType(ctx android.ModuleContext, from *Module, to *Module) {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if from.Properties.Sdk_version == "" {
|
if String(from.Properties.Sdk_version) == "" {
|
||||||
// Platform code can link to anything
|
// Platform code can link to anything
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -981,7 +981,7 @@ func checkLinkType(ctx android.ModuleContext, from *Module, to *Module) {
|
|||||||
// the NDK.
|
// the NDK.
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if to.Properties.Sdk_version == "" {
|
if String(to.Properties.Sdk_version) == "" {
|
||||||
// NDK code linking to platform code is never okay.
|
// NDK code linking to platform code is never okay.
|
||||||
ctx.ModuleErrorf("depends on non-NDK-built library %q",
|
ctx.ModuleErrorf("depends on non-NDK-built library %q",
|
||||||
ctx.OtherModuleName(to))
|
ctx.OtherModuleName(to))
|
||||||
@@ -992,31 +992,31 @@ func checkLinkType(ctx android.ModuleContext, from *Module, to *Module) {
|
|||||||
// API level, as it is only valid to link against older or equivalent
|
// API level, as it is only valid to link against older or equivalent
|
||||||
// APIs.
|
// APIs.
|
||||||
|
|
||||||
if from.Properties.Sdk_version == "current" {
|
if String(from.Properties.Sdk_version) == "current" {
|
||||||
// Current can link against anything.
|
// Current can link against anything.
|
||||||
return
|
return
|
||||||
} else if to.Properties.Sdk_version == "current" {
|
} else if String(to.Properties.Sdk_version) == "current" {
|
||||||
// Current can't be linked against by anything else.
|
// Current can't be linked against by anything else.
|
||||||
ctx.ModuleErrorf("links %q built against newer API version %q",
|
ctx.ModuleErrorf("links %q built against newer API version %q",
|
||||||
ctx.OtherModuleName(to), "current")
|
ctx.OtherModuleName(to), "current")
|
||||||
}
|
}
|
||||||
|
|
||||||
fromApi, err := strconv.Atoi(from.Properties.Sdk_version)
|
fromApi, err := strconv.Atoi(String(from.Properties.Sdk_version))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.PropertyErrorf("sdk_version",
|
ctx.PropertyErrorf("sdk_version",
|
||||||
"Invalid sdk_version value (must be int): %q",
|
"Invalid sdk_version value (must be int): %q",
|
||||||
from.Properties.Sdk_version)
|
String(from.Properties.Sdk_version))
|
||||||
}
|
}
|
||||||
toApi, err := strconv.Atoi(to.Properties.Sdk_version)
|
toApi, err := strconv.Atoi(String(to.Properties.Sdk_version))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.PropertyErrorf("sdk_version",
|
ctx.PropertyErrorf("sdk_version",
|
||||||
"Invalid sdk_version value (must be int): %q",
|
"Invalid sdk_version value (must be int): %q",
|
||||||
to.Properties.Sdk_version)
|
String(to.Properties.Sdk_version))
|
||||||
}
|
}
|
||||||
|
|
||||||
if toApi > fromApi {
|
if toApi > fromApi {
|
||||||
ctx.ModuleErrorf("links %q built against newer API version %q",
|
ctx.ModuleErrorf("links %q built against newer API version %q",
|
||||||
ctx.OtherModuleName(to), to.Properties.Sdk_version)
|
ctx.OtherModuleName(to), String(to.Properties.Sdk_version))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1410,7 +1410,7 @@ func vendorMutator(mctx android.BottomUpMutatorContext) {
|
|||||||
vendor := mod[1].(*Module)
|
vendor := mod[1].(*Module)
|
||||||
vendor.Properties.UseVndk = true
|
vendor.Properties.UseVndk = true
|
||||||
squashVendorSrcs(vendor)
|
squashVendorSrcs(vendor)
|
||||||
} else if mctx.InstallOnVendorPartition() && m.Properties.Sdk_version == "" {
|
} else if mctx.InstallOnVendorPartition() && String(m.Properties.Sdk_version) == "" {
|
||||||
// This will be available in /vendor only
|
// This will be available in /vendor only
|
||||||
mod := mctx.CreateVariations(vendorMode)
|
mod := mctx.CreateVariations(vendorMode)
|
||||||
vendor := mod[0].(*Module)
|
vendor := mod[0].(*Module)
|
||||||
@@ -1432,3 +1432,6 @@ func getCurrentNdkPrebuiltVersion(ctx DepsContext) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var Bool = proptools.Bool
|
var Bool = proptools.Bool
|
||||||
|
var BoolPtr = proptools.BoolPtr
|
||||||
|
var String = proptools.String
|
||||||
|
var StringPtr = proptools.StringPtr
|
||||||
|
@@ -9,8 +9,6 @@ import (
|
|||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/google/blueprint/proptools"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var buildDir string
|
var buildDir string
|
||||||
@@ -40,7 +38,7 @@ func TestMain(m *testing.M) {
|
|||||||
|
|
||||||
func testCc(t *testing.T, bp string) *android.TestContext {
|
func testCc(t *testing.T, bp string) *android.TestContext {
|
||||||
config := android.TestArchConfig(buildDir, nil)
|
config := android.TestArchConfig(buildDir, nil)
|
||||||
config.ProductVariables.DeviceVndkVersion = proptools.StringPtr("current")
|
config.ProductVariables.DeviceVndkVersion = StringPtr("current")
|
||||||
|
|
||||||
ctx := android.NewTestArchContext()
|
ctx := android.NewTestArchContext()
|
||||||
ctx.RegisterModuleType("cc_library", android.ModuleFactoryAdaptor(LibraryFactory))
|
ctx.RegisterModuleType("cc_library", android.ModuleFactoryAdaptor(LibraryFactory))
|
||||||
|
@@ -89,12 +89,12 @@ type BaseCompilerProperties struct {
|
|||||||
// C standard version to use. Can be a specific version (such as "gnu11"),
|
// C standard version to use. Can be a specific version (such as "gnu11"),
|
||||||
// "experimental" (which will use draft versions like C1x when available),
|
// "experimental" (which will use draft versions like C1x when available),
|
||||||
// or the empty string (which will use the default).
|
// or the empty string (which will use the default).
|
||||||
C_std string
|
C_std *string
|
||||||
|
|
||||||
// C++ standard version to use. Can be a specific version (such as
|
// C++ standard version to use. Can be a specific version (such as
|
||||||
// "gnu++11"), "experimental" (which will use draft versions like C++1z when
|
// "gnu++11"), "experimental" (which will use draft versions like C++1z when
|
||||||
// available), or the empty string (which will use the default).
|
// available), or the empty string (which will use the default).
|
||||||
Cpp_std string
|
Cpp_std *string
|
||||||
|
|
||||||
// if set to false, use -std=c++* instead of -std=gnu++*
|
// if set to false, use -std=c++* instead of -std=gnu++*
|
||||||
Gnu_extensions *bool
|
Gnu_extensions *bool
|
||||||
@@ -143,7 +143,7 @@ type BaseCompilerProperties struct {
|
|||||||
|
|
||||||
Proto struct {
|
Proto struct {
|
||||||
// Link statically against the protobuf runtime
|
// Link statically against the protobuf runtime
|
||||||
Static bool `android:"arch_variant"`
|
Static *bool `android:"arch_variant"`
|
||||||
} `android:"arch_variant"`
|
} `android:"arch_variant"`
|
||||||
|
|
||||||
// Stores the original list of source files before being cleared by library reuse
|
// Stores the original list of source files before being cleared by library reuse
|
||||||
@@ -193,7 +193,7 @@ func (compiler *baseCompiler) compilerDeps(ctx DepsContext, deps Deps) Deps {
|
|||||||
android.ExtractSourcesDeps(ctx, compiler.Properties.Srcs)
|
android.ExtractSourcesDeps(ctx, compiler.Properties.Srcs)
|
||||||
|
|
||||||
if compiler.hasSrcExt(".proto") {
|
if compiler.hasSrcExt(".proto") {
|
||||||
deps = protoDeps(ctx, deps, &compiler.Proto, compiler.Properties.Proto.Static)
|
deps = protoDeps(ctx, deps, &compiler.Proto, Bool(compiler.Properties.Proto.Static))
|
||||||
}
|
}
|
||||||
|
|
||||||
return deps
|
return deps
|
||||||
@@ -275,7 +275,7 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag
|
|||||||
"-D__ANDROID_API__=__ANDROID_API_FUTURE__", "-D__ANDROID_VNDK__")
|
"-D__ANDROID_API__=__ANDROID_API_FUTURE__", "-D__ANDROID_VNDK__")
|
||||||
}
|
}
|
||||||
|
|
||||||
instructionSet := proptools.String(compiler.Properties.Instruction_set)
|
instructionSet := String(compiler.Properties.Instruction_set)
|
||||||
if flags.RequiredInstructionSet != "" {
|
if flags.RequiredInstructionSet != "" {
|
||||||
instructionSet = flags.RequiredInstructionSet
|
instructionSet = flags.RequiredInstructionSet
|
||||||
}
|
}
|
||||||
@@ -364,21 +364,21 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag
|
|||||||
|
|
||||||
if !ctx.useSdk() {
|
if !ctx.useSdk() {
|
||||||
cStd := config.CStdVersion
|
cStd := config.CStdVersion
|
||||||
if compiler.Properties.C_std == "experimental" {
|
if String(compiler.Properties.C_std) == "experimental" {
|
||||||
cStd = config.ExperimentalCStdVersion
|
cStd = config.ExperimentalCStdVersion
|
||||||
} else if compiler.Properties.C_std != "" {
|
} else if String(compiler.Properties.C_std) != "" {
|
||||||
cStd = compiler.Properties.C_std
|
cStd = String(compiler.Properties.C_std)
|
||||||
}
|
}
|
||||||
|
|
||||||
cppStd := compiler.Properties.Cpp_std
|
cppStd := String(compiler.Properties.Cpp_std)
|
||||||
switch compiler.Properties.Cpp_std {
|
switch String(compiler.Properties.Cpp_std) {
|
||||||
case "":
|
case "":
|
||||||
cppStd = config.CppStdVersion
|
cppStd = config.CppStdVersion
|
||||||
case "experimental":
|
case "experimental":
|
||||||
cppStd = config.ExperimentalCppStdVersion
|
cppStd = config.ExperimentalCppStdVersion
|
||||||
case "c++17", "gnu++17":
|
case "c++17", "gnu++17":
|
||||||
// Map c++17 and gnu++17 to their 1z equivalents, until 17 is finalized.
|
// Map c++17 and gnu++17 to their 1z equivalents, until 17 is finalized.
|
||||||
cppStd = strings.Replace(compiler.Properties.Cpp_std, "17", "1z", 1)
|
cppStd = strings.Replace(String(compiler.Properties.Cpp_std), "17", "1z", 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !flags.Clang {
|
if !flags.Clang {
|
||||||
|
@@ -24,7 +24,7 @@ import (
|
|||||||
|
|
||||||
type InstallerProperties struct {
|
type InstallerProperties struct {
|
||||||
// install to a subdirectory of the default install path for the module
|
// install to a subdirectory of the default install path for the module
|
||||||
Relative_install_path string `android:"arch_variant"`
|
Relative_install_path *string `android:"arch_variant"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type installLocation int
|
type installLocation int
|
||||||
@@ -72,7 +72,8 @@ func (installer *baseInstaller) installDir(ctx ModuleContext) android.OutputPath
|
|||||||
if installer.location == InstallInData && ctx.useVndk() {
|
if installer.location == InstallInData && ctx.useVndk() {
|
||||||
dir = filepath.Join(dir, "vendor")
|
dir = filepath.Join(dir, "vendor")
|
||||||
}
|
}
|
||||||
return android.PathForModuleInstall(ctx, dir, installer.subDir, installer.Properties.Relative_install_path, installer.relative)
|
return android.PathForModuleInstall(ctx, dir, installer.subDir,
|
||||||
|
String(installer.Properties.Relative_install_path), installer.relative)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (installer *baseInstaller) install(ctx ModuleContext, file android.Path) {
|
func (installer *baseInstaller) install(ctx ModuleContext, file android.Path) {
|
||||||
|
@@ -57,12 +57,12 @@ type LibraryProperties struct {
|
|||||||
|
|
||||||
Aidl struct {
|
Aidl struct {
|
||||||
// export headers generated from .aidl sources
|
// export headers generated from .aidl sources
|
||||||
Export_aidl_headers bool
|
Export_aidl_headers *bool
|
||||||
}
|
}
|
||||||
|
|
||||||
Proto struct {
|
Proto struct {
|
||||||
// export headers generated from .proto sources
|
// export headers generated from .proto sources
|
||||||
Export_proto_headers bool
|
Export_proto_headers *bool
|
||||||
}
|
}
|
||||||
Target struct {
|
Target struct {
|
||||||
Vendor struct {
|
Vendor struct {
|
||||||
@@ -71,7 +71,7 @@ type LibraryProperties struct {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Static_ndk_lib bool
|
Static_ndk_lib *bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type LibraryMutatedProperties struct {
|
type LibraryMutatedProperties struct {
|
||||||
@@ -663,7 +663,7 @@ func (library *libraryDecorator) link(ctx ModuleContext,
|
|||||||
library.reexportFlags(deps.ReexportedFlags)
|
library.reexportFlags(deps.ReexportedFlags)
|
||||||
library.reexportDeps(deps.ReexportedFlagsDeps)
|
library.reexportDeps(deps.ReexportedFlagsDeps)
|
||||||
|
|
||||||
if library.Properties.Aidl.Export_aidl_headers {
|
if Bool(library.Properties.Aidl.Export_aidl_headers) {
|
||||||
if library.baseCompiler.hasSrcExt(".aidl") {
|
if library.baseCompiler.hasSrcExt(".aidl") {
|
||||||
flags := []string{
|
flags := []string{
|
||||||
"-I" + android.PathForModuleGen(ctx, "aidl").String(),
|
"-I" + android.PathForModuleGen(ctx, "aidl").String(),
|
||||||
@@ -675,7 +675,7 @@ func (library *libraryDecorator) link(ctx ModuleContext,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if library.Properties.Proto.Export_proto_headers {
|
if Bool(library.Properties.Proto.Export_proto_headers) {
|
||||||
if library.baseCompiler.hasSrcExt(".proto") {
|
if library.baseCompiler.hasSrcExt(".proto") {
|
||||||
flags := []string{
|
flags := []string{
|
||||||
"-I" + android.ProtoSubDir(ctx).String(),
|
"-I" + android.ProtoSubDir(ctx).String(),
|
||||||
@@ -731,7 +731,7 @@ func (library *libraryDecorator) install(ctx ModuleContext, file android.Path) {
|
|||||||
library.baseInstaller.install(ctx, file)
|
library.baseInstaller.install(ctx, file)
|
||||||
}
|
}
|
||||||
|
|
||||||
if library.Properties.Static_ndk_lib && library.static() {
|
if Bool(library.Properties.Static_ndk_lib) && library.static() {
|
||||||
installPath := getNdkSysrootBase(ctx).Join(
|
installPath := getNdkSysrootBase(ctx).Join(
|
||||||
ctx, "usr/lib", ctx.toolchain().ClangTriple(), file.Base())
|
ctx, "usr/lib", ctx.toolchain().ClangTriple(), file.Base())
|
||||||
|
|
||||||
|
@@ -39,23 +39,23 @@ var (
|
|||||||
type llndkLibraryProperties struct {
|
type llndkLibraryProperties struct {
|
||||||
// Relative path to the symbol map.
|
// Relative path to the symbol map.
|
||||||
// An example file can be seen here: TODO(danalbert): Make an example.
|
// An example file can be seen here: TODO(danalbert): Make an example.
|
||||||
Symbol_file string
|
Symbol_file *string
|
||||||
|
|
||||||
// Whether to export any headers as -isystem instead of -I. Mainly for use by
|
// Whether to export any headers as -isystem instead of -I. Mainly for use by
|
||||||
// bionic/libc.
|
// bionic/libc.
|
||||||
Export_headers_as_system bool
|
Export_headers_as_system *bool
|
||||||
|
|
||||||
// Which headers to process with versioner. This really only handles
|
// Which headers to process with versioner. This really only handles
|
||||||
// bionic/libc/include right now.
|
// bionic/libc/include right now.
|
||||||
Export_preprocessed_headers []string
|
Export_preprocessed_headers []string
|
||||||
|
|
||||||
// Whether the system library uses symbol versions.
|
// Whether the system library uses symbol versions.
|
||||||
Unversioned bool
|
Unversioned *bool
|
||||||
|
|
||||||
// whether this module can be directly depended upon by libs that are installed to /vendor.
|
// whether this module can be directly depended upon by libs that are installed to /vendor.
|
||||||
// When set to false, this module can only be depended on by VNDK libraries, not vendor
|
// When set to false, this module can only be depended on by VNDK libraries, not vendor
|
||||||
// libraries. This effectively hides this module from vendors. Default value is true.
|
// libraries. This effectively hides this module from vendors. Default value is true.
|
||||||
Vendor_available bool
|
Vendor_available *bool
|
||||||
|
|
||||||
// list of llndk headers to re-export include directories from.
|
// list of llndk headers to re-export include directories from.
|
||||||
Export_llndk_headers []string `android:"arch_variant"`
|
Export_llndk_headers []string `android:"arch_variant"`
|
||||||
@@ -76,7 +76,7 @@ func (stub *llndkStubDecorator) compilerFlags(ctx ModuleContext, flags Flags) Fl
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (stub *llndkStubDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) Objects {
|
func (stub *llndkStubDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) Objects {
|
||||||
objs, versionScript := compileStubLibrary(ctx, flags, stub.Properties.Symbol_file, "current", "--vndk")
|
objs, versionScript := compileStubLibrary(ctx, flags, String(stub.Properties.Symbol_file), "current", "--vndk")
|
||||||
stub.versionScriptPath = versionScript
|
stub.versionScriptPath = versionScript
|
||||||
return objs
|
return objs
|
||||||
}
|
}
|
||||||
@@ -121,7 +121,7 @@ func (stub *llndkStubDecorator) processHeaders(ctx ModuleContext, srcHeaderDir s
|
|||||||
func (stub *llndkStubDecorator) link(ctx ModuleContext, flags Flags, deps PathDeps,
|
func (stub *llndkStubDecorator) link(ctx ModuleContext, flags Flags, deps PathDeps,
|
||||||
objs Objects) android.Path {
|
objs Objects) android.Path {
|
||||||
|
|
||||||
if !stub.Properties.Unversioned {
|
if !Bool(stub.Properties.Unversioned) {
|
||||||
linkerScriptFlag := "-Wl,--version-script," + stub.versionScriptPath.String()
|
linkerScriptFlag := "-Wl,--version-script," + stub.versionScriptPath.String()
|
||||||
flags.LdFlags = append(flags.LdFlags, linkerScriptFlag)
|
flags.LdFlags = append(flags.LdFlags, linkerScriptFlag)
|
||||||
}
|
}
|
||||||
@@ -135,7 +135,7 @@ func (stub *llndkStubDecorator) link(ctx ModuleContext, flags Flags, deps PathDe
|
|||||||
}
|
}
|
||||||
|
|
||||||
includePrefix := "-I "
|
includePrefix := "-I "
|
||||||
if stub.Properties.Export_headers_as_system {
|
if Bool(stub.Properties.Export_headers_as_system) {
|
||||||
includePrefix = "-isystem "
|
includePrefix = "-isystem "
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,7 +143,7 @@ func (stub *llndkStubDecorator) link(ctx ModuleContext, flags Flags, deps PathDe
|
|||||||
stub.reexportDeps(timestampFiles)
|
stub.reexportDeps(timestampFiles)
|
||||||
}
|
}
|
||||||
|
|
||||||
if stub.Properties.Export_headers_as_system {
|
if Bool(stub.Properties.Export_headers_as_system) {
|
||||||
stub.exportIncludes(ctx, "-isystem")
|
stub.exportIncludes(ctx, "-isystem")
|
||||||
stub.libraryDecorator.flagExporter.Properties.Export_include_dirs = []string{}
|
stub.libraryDecorator.flagExporter.Properties.Export_include_dirs = []string{}
|
||||||
}
|
}
|
||||||
@@ -156,12 +156,12 @@ func newLLndkStubLibrary() *Module {
|
|||||||
library.BuildOnlyShared()
|
library.BuildOnlyShared()
|
||||||
module.stl = nil
|
module.stl = nil
|
||||||
module.sanitize = nil
|
module.sanitize = nil
|
||||||
library.StripProperties.Strip.None = true
|
library.StripProperties.Strip.None = BoolPtr(true)
|
||||||
|
|
||||||
stub := &llndkStubDecorator{
|
stub := &llndkStubDecorator{
|
||||||
libraryDecorator: library,
|
libraryDecorator: library,
|
||||||
}
|
}
|
||||||
stub.Properties.Vendor_available = true
|
stub.Properties.Vendor_available = BoolPtr(true)
|
||||||
module.compiler = stub
|
module.compiler = stub
|
||||||
module.linker = stub
|
module.linker = stub
|
||||||
module.installer = nil
|
module.installer = nil
|
||||||
|
@@ -56,16 +56,16 @@ type headerProperies struct {
|
|||||||
//
|
//
|
||||||
// Will install $SYSROOT/usr/include/foo/bar/baz.h. If `from` were instead
|
// Will install $SYSROOT/usr/include/foo/bar/baz.h. If `from` were instead
|
||||||
// "include/foo", it would have installed $SYSROOT/usr/include/bar/baz.h.
|
// "include/foo", it would have installed $SYSROOT/usr/include/bar/baz.h.
|
||||||
From string
|
From *string
|
||||||
|
|
||||||
// Install path within the sysroot. This is relative to usr/include.
|
// Install path within the sysroot. This is relative to usr/include.
|
||||||
To string
|
To *string
|
||||||
|
|
||||||
// List of headers to install. Glob compatible. Common case is "include/**/*.h".
|
// List of headers to install. Glob compatible. Common case is "include/**/*.h".
|
||||||
Srcs []string
|
Srcs []string
|
||||||
|
|
||||||
// Path to the NOTICE file associated with the headers.
|
// Path to the NOTICE file associated with the headers.
|
||||||
License string
|
License *string
|
||||||
}
|
}
|
||||||
|
|
||||||
type headerModule struct {
|
type headerModule struct {
|
||||||
@@ -113,15 +113,16 @@ func getHeaderInstallDir(ctx android.ModuleContext, header android.Path, from st
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *headerModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
func (m *headerModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
if m.properties.License == "" {
|
if String(m.properties.License) == "" {
|
||||||
ctx.PropertyErrorf("license", "field is required")
|
ctx.PropertyErrorf("license", "field is required")
|
||||||
}
|
}
|
||||||
|
|
||||||
m.licensePath = android.PathForModuleSrc(ctx, m.properties.License)
|
m.licensePath = android.PathForModuleSrc(ctx, String(m.properties.License))
|
||||||
|
|
||||||
srcFiles := ctx.ExpandSources(m.properties.Srcs, nil)
|
srcFiles := ctx.ExpandSources(m.properties.Srcs, nil)
|
||||||
for _, header := range srcFiles {
|
for _, header := range srcFiles {
|
||||||
installDir := getHeaderInstallDir(ctx, header, m.properties.From, m.properties.To)
|
installDir := getHeaderInstallDir(ctx, header, String(m.properties.From),
|
||||||
|
String(m.properties.To))
|
||||||
installedPath := ctx.InstallFile(installDir, header.Base(), header)
|
installedPath := ctx.InstallFile(installDir, header.Base(), header)
|
||||||
installPath := installDir.Join(ctx, header.Base())
|
installPath := installDir.Join(ctx, header.Base())
|
||||||
if installPath != installedPath {
|
if installPath != installedPath {
|
||||||
|
@@ -76,17 +76,17 @@ var (
|
|||||||
type libraryProperties struct {
|
type libraryProperties struct {
|
||||||
// Relative path to the symbol map.
|
// Relative path to the symbol map.
|
||||||
// An example file can be seen here: TODO(danalbert): Make an example.
|
// An example file can be seen here: TODO(danalbert): Make an example.
|
||||||
Symbol_file string
|
Symbol_file *string
|
||||||
|
|
||||||
// The first API level a library was available. A library will be generated
|
// The first API level a library was available. A library will be generated
|
||||||
// for every API level beginning with this one.
|
// for every API level beginning with this one.
|
||||||
First_version string
|
First_version *string
|
||||||
|
|
||||||
// The first API level that library should have the version script applied.
|
// The first API level that library should have the version script applied.
|
||||||
// This defaults to the value of first_version, and should almost never be
|
// This defaults to the value of first_version, and should almost never be
|
||||||
// used. This is only needed to work around platform bugs like
|
// used. This is only needed to work around platform bugs like
|
||||||
// https://github.com/android-ndk/ndk/issues/265.
|
// https://github.com/android-ndk/ndk/issues/265.
|
||||||
Unversioned_until string
|
Unversioned_until *string
|
||||||
|
|
||||||
// Private property for use by the mutator that splits per-API level.
|
// Private property for use by the mutator that splits per-API level.
|
||||||
ApiLevel string `blueprint:"mutated"`
|
ApiLevel string `blueprint:"mutated"`
|
||||||
@@ -158,11 +158,11 @@ func getFirstGeneratedVersion(firstSupportedVersion string, platformVersion int)
|
|||||||
|
|
||||||
func shouldUseVersionScript(stub *stubDecorator) (bool, error) {
|
func shouldUseVersionScript(stub *stubDecorator) (bool, error) {
|
||||||
// unversioned_until is normally empty, in which case we should use the version script.
|
// unversioned_until is normally empty, in which case we should use the version script.
|
||||||
if stub.properties.Unversioned_until == "" {
|
if String(stub.properties.Unversioned_until) == "" {
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if stub.properties.Unversioned_until == "current" {
|
if String(stub.properties.Unversioned_until) == "current" {
|
||||||
if stub.properties.ApiLevel == "current" {
|
if stub.properties.ApiLevel == "current" {
|
||||||
return true, nil
|
return true, nil
|
||||||
} else {
|
} else {
|
||||||
@@ -174,7 +174,7 @@ func shouldUseVersionScript(stub *stubDecorator) (bool, error) {
|
|||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
unversionedUntil, err := strconv.Atoi(stub.properties.Unversioned_until)
|
unversionedUntil, err := strconv.Atoi(String(stub.properties.Unversioned_until))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return true, err
|
return true, err
|
||||||
}
|
}
|
||||||
@@ -190,7 +190,7 @@ func shouldUseVersionScript(stub *stubDecorator) (bool, error) {
|
|||||||
func generateStubApiVariants(mctx android.BottomUpMutatorContext, c *stubDecorator) {
|
func generateStubApiVariants(mctx android.BottomUpMutatorContext, c *stubDecorator) {
|
||||||
platformVersion := mctx.AConfig().PlatformSdkVersionInt()
|
platformVersion := mctx.AConfig().PlatformSdkVersionInt()
|
||||||
|
|
||||||
firstSupportedVersion, err := normalizeNdkApiLevel(mctx, c.properties.First_version,
|
firstSupportedVersion, err := normalizeNdkApiLevel(mctx, String(c.properties.First_version),
|
||||||
mctx.Arch())
|
mctx.Arch())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
mctx.PropertyErrorf("first_version", err.Error())
|
mctx.PropertyErrorf("first_version", err.Error())
|
||||||
@@ -290,11 +290,12 @@ func compileStubLibrary(ctx ModuleContext, flags Flags, symbolFile, apiLevel, vn
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *stubDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) Objects {
|
func (c *stubDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) Objects {
|
||||||
if !strings.HasSuffix(c.properties.Symbol_file, ".map.txt") {
|
if !strings.HasSuffix(String(c.properties.Symbol_file), ".map.txt") {
|
||||||
ctx.PropertyErrorf("symbol_file", "must end with .map.txt")
|
ctx.PropertyErrorf("symbol_file", "must end with .map.txt")
|
||||||
}
|
}
|
||||||
|
|
||||||
objs, versionScript := compileStubLibrary(ctx, flags, c.properties.Symbol_file, c.properties.ApiLevel, "")
|
objs, versionScript := compileStubLibrary(ctx, flags, String(c.properties.Symbol_file),
|
||||||
|
c.properties.ApiLevel, "")
|
||||||
c.versionScriptPath = versionScript
|
c.versionScriptPath = versionScript
|
||||||
return objs
|
return objs
|
||||||
}
|
}
|
||||||
@@ -349,7 +350,7 @@ func newStubLibrary() *Module {
|
|||||||
library.BuildOnlyShared()
|
library.BuildOnlyShared()
|
||||||
module.stl = nil
|
module.stl = nil
|
||||||
module.sanitize = nil
|
module.sanitize = nil
|
||||||
library.StripProperties.Strip.None = true
|
library.StripProperties.Strip.None = BoolPtr(true)
|
||||||
|
|
||||||
stub := &stubDecorator{
|
stub := &stubDecorator{
|
||||||
libraryDecorator: library,
|
libraryDecorator: library,
|
||||||
|
@@ -83,9 +83,9 @@ func (object *objectLinker) link(ctx ModuleContext,
|
|||||||
if len(objs.objFiles) == 1 {
|
if len(objs.objFiles) == 1 {
|
||||||
outputFile = objs.objFiles[0]
|
outputFile = objs.objFiles[0]
|
||||||
|
|
||||||
if object.Properties.Prefix_symbols != "" {
|
if String(object.Properties.Prefix_symbols) != "" {
|
||||||
output := android.PathForModuleOut(ctx, ctx.ModuleName()+objectExtension)
|
output := android.PathForModuleOut(ctx, ctx.ModuleName()+objectExtension)
|
||||||
TransformBinaryPrefixSymbols(ctx, object.Properties.Prefix_symbols, outputFile,
|
TransformBinaryPrefixSymbols(ctx, String(object.Properties.Prefix_symbols), outputFile,
|
||||||
builderFlags, output)
|
builderFlags, output)
|
||||||
outputFile = output
|
outputFile = output
|
||||||
}
|
}
|
||||||
@@ -93,9 +93,9 @@ func (object *objectLinker) link(ctx ModuleContext,
|
|||||||
output := android.PathForModuleOut(ctx, ctx.ModuleName()+objectExtension)
|
output := android.PathForModuleOut(ctx, ctx.ModuleName()+objectExtension)
|
||||||
outputFile = output
|
outputFile = output
|
||||||
|
|
||||||
if object.Properties.Prefix_symbols != "" {
|
if String(object.Properties.Prefix_symbols) != "" {
|
||||||
input := android.PathForModuleOut(ctx, "unprefixed", ctx.ModuleName()+objectExtension)
|
input := android.PathForModuleOut(ctx, "unprefixed", ctx.ModuleName()+objectExtension)
|
||||||
TransformBinaryPrefixSymbols(ctx, object.Properties.Prefix_symbols, input,
|
TransformBinaryPrefixSymbols(ctx, String(object.Properties.Prefix_symbols), input,
|
||||||
builderFlags, output)
|
builderFlags, output)
|
||||||
output = input
|
output = input
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,6 @@ package cc
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/google/blueprint"
|
"github.com/google/blueprint"
|
||||||
"github.com/google/blueprint/proptools"
|
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
)
|
)
|
||||||
@@ -58,7 +57,7 @@ func genProto(ctx android.ModuleContext, protoFile android.Path,
|
|||||||
func protoDeps(ctx BaseModuleContext, deps Deps, p *android.ProtoProperties, static bool) Deps {
|
func protoDeps(ctx BaseModuleContext, deps Deps, p *android.ProtoProperties, static bool) Deps {
|
||||||
var lib string
|
var lib string
|
||||||
|
|
||||||
switch proptools.String(p.Proto.Type) {
|
switch String(p.Proto.Type) {
|
||||||
case "full":
|
case "full":
|
||||||
if ctx.useSdk() {
|
if ctx.useSdk() {
|
||||||
lib = "libprotobuf-cpp-full-ndk"
|
lib = "libprotobuf-cpp-full-ndk"
|
||||||
@@ -75,7 +74,7 @@ func protoDeps(ctx BaseModuleContext, deps Deps, p *android.ProtoProperties, sta
|
|||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
ctx.PropertyErrorf("proto.type", "unknown proto type %q",
|
ctx.PropertyErrorf("proto.type", "unknown proto type %q",
|
||||||
proptools.String(p.Proto.Type))
|
String(p.Proto.Type))
|
||||||
}
|
}
|
||||||
|
|
||||||
if static {
|
if static {
|
||||||
|
3
cc/rs.go
3
cc/rs.go
@@ -19,7 +19,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
"github.com/google/blueprint"
|
||||||
"github.com/google/blueprint/proptools"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@@ -81,7 +80,7 @@ func rsGenerateCpp(ctx android.ModuleContext, rsFiles android.Paths, rsFlags str
|
|||||||
}
|
}
|
||||||
|
|
||||||
func rsFlags(ctx ModuleContext, flags Flags, properties *BaseCompilerProperties) Flags {
|
func rsFlags(ctx ModuleContext, flags Flags, properties *BaseCompilerProperties) Flags {
|
||||||
targetApi := proptools.String(properties.Renderscript.Target_api)
|
targetApi := String(properties.Renderscript.Target_api)
|
||||||
if targetApi == "" && ctx.useSdk() {
|
if targetApi == "" && ctx.useSdk() {
|
||||||
switch ctx.sdkVersion() {
|
switch ctx.sdkVersion() {
|
||||||
case "current", "system_current", "test_current":
|
case "current", "system_current", "test_current":
|
||||||
|
@@ -78,7 +78,7 @@ func (t sanitizerType) String() string {
|
|||||||
type SanitizeProperties struct {
|
type SanitizeProperties struct {
|
||||||
// enable AddressSanitizer, ThreadSanitizer, or UndefinedBehaviorSanitizer
|
// enable AddressSanitizer, ThreadSanitizer, or UndefinedBehaviorSanitizer
|
||||||
Sanitize struct {
|
Sanitize struct {
|
||||||
Never bool `android:"arch_variant"`
|
Never *bool `android:"arch_variant"`
|
||||||
|
|
||||||
// main sanitizers
|
// main sanitizers
|
||||||
Address *bool `android:"arch_variant"`
|
Address *bool `android:"arch_variant"`
|
||||||
@@ -131,11 +131,11 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) {
|
|||||||
|
|
||||||
// Don't apply sanitizers to NDK code.
|
// Don't apply sanitizers to NDK code.
|
||||||
if ctx.useSdk() {
|
if ctx.useSdk() {
|
||||||
s.Never = true
|
s.Never = BoolPtr(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Never always wins.
|
// Never always wins.
|
||||||
if s.Never {
|
if Bool(s.Never) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -540,7 +540,7 @@ func sanitizerDepsMutator(t sanitizerType) func(android.TopDownMutatorContext) {
|
|||||||
if c, ok := mctx.Module().(*Module); ok && c.sanitize.isSanitizerEnabled(t) {
|
if c, ok := mctx.Module().(*Module); ok && c.sanitize.isSanitizerEnabled(t) {
|
||||||
mctx.VisitDepsDepthFirst(func(module android.Module) {
|
mctx.VisitDepsDepthFirst(func(module android.Module) {
|
||||||
if d, ok := module.(*Module); ok && d.sanitize != nil &&
|
if d, ok := module.(*Module); ok && d.sanitize != nil &&
|
||||||
!d.sanitize.Properties.Sanitize.Never &&
|
!Bool(d.sanitize.Properties.Sanitize.Never) &&
|
||||||
!d.sanitize.isSanitizerExplicitlyDisabled(t) {
|
!d.sanitize.isSanitizerExplicitlyDisabled(t) {
|
||||||
if (t == cfi && d.static()) || t != cfi {
|
if (t == cfi && d.static()) || t != cfi {
|
||||||
d.sanitize.Properties.SanitizeDep = true
|
d.sanitize.Properties.SanitizeDep = true
|
||||||
|
12
cc/strip.go
12
cc/strip.go
@@ -14,12 +14,14 @@
|
|||||||
|
|
||||||
package cc
|
package cc
|
||||||
|
|
||||||
import "android/soong/android"
|
import (
|
||||||
|
"android/soong/android"
|
||||||
|
)
|
||||||
|
|
||||||
type StripProperties struct {
|
type StripProperties struct {
|
||||||
Strip struct {
|
Strip struct {
|
||||||
None bool
|
None *bool
|
||||||
Keep_symbols bool
|
Keep_symbols *bool
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,7 +30,7 @@ type stripper struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (stripper *stripper) needsStrip(ctx ModuleContext) bool {
|
func (stripper *stripper) needsStrip(ctx ModuleContext) bool {
|
||||||
return !ctx.AConfig().EmbeddedInMake() && !stripper.StripProperties.Strip.None
|
return !ctx.AConfig().EmbeddedInMake() && !Bool(stripper.StripProperties.Strip.None)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (stripper *stripper) strip(ctx ModuleContext, in, out android.ModuleOutPath,
|
func (stripper *stripper) strip(ctx ModuleContext, in, out android.ModuleOutPath,
|
||||||
@@ -36,7 +38,7 @@ func (stripper *stripper) strip(ctx ModuleContext, in, out android.ModuleOutPath
|
|||||||
if ctx.Darwin() {
|
if ctx.Darwin() {
|
||||||
TransformDarwinStrip(ctx, in, out)
|
TransformDarwinStrip(ctx, in, out)
|
||||||
} else {
|
} else {
|
||||||
flags.stripKeepSymbols = stripper.StripProperties.Strip.Keep_symbols
|
flags.stripKeepSymbols = Bool(stripper.StripProperties.Strip.Keep_symbols)
|
||||||
// TODO(ccross): don't add gnu debuglink for user builds
|
// TODO(ccross): don't add gnu debuglink for user builds
|
||||||
flags.stripAddGnuDebuglink = true
|
flags.stripAddGnuDebuglink = true
|
||||||
TransformStrip(ctx, in, out, flags)
|
TransformStrip(ctx, in, out, flags)
|
||||||
|
@@ -100,7 +100,7 @@ func (test *testBinary) srcs() []string {
|
|||||||
|
|
||||||
func (test *testBinary) setSrc(name, src string) {
|
func (test *testBinary) setSrc(name, src string) {
|
||||||
test.baseCompiler.Properties.Srcs = []string{src}
|
test.baseCompiler.Properties.Srcs = []string{src}
|
||||||
test.binaryDecorator.Properties.Stem = name
|
test.binaryDecorator.Properties.Stem = StringPtr(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ testPerSrc = (*testBinary)(nil)
|
var _ testPerSrc = (*testBinary)(nil)
|
||||||
@@ -236,7 +236,7 @@ func (test *testBinary) install(ctx ModuleContext, file android.Path) {
|
|||||||
|
|
||||||
if !Bool(test.Properties.No_named_install_directory) {
|
if !Bool(test.Properties.No_named_install_directory) {
|
||||||
test.binaryDecorator.baseInstaller.relative = ctx.ModuleName()
|
test.binaryDecorator.baseInstaller.relative = ctx.ModuleName()
|
||||||
} else if test.binaryDecorator.baseInstaller.Properties.Relative_install_path == "" {
|
} else if String(test.binaryDecorator.baseInstaller.Properties.Relative_install_path) == "" {
|
||||||
ctx.PropertyErrorf("no_named_install_directory", "Module install directory may only be disabled if relative_install_path is set")
|
ctx.PropertyErrorf("no_named_install_directory", "Module install directory may only be disabled if relative_install_path is set")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -15,8 +15,6 @@
|
|||||||
package cc
|
package cc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/google/blueprint/proptools"
|
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -45,7 +43,7 @@ func toolchainLibraryFactory() android.Module {
|
|||||||
}
|
}
|
||||||
module.compiler = toolchainLibrary
|
module.compiler = toolchainLibrary
|
||||||
module.linker = toolchainLibrary
|
module.linker = toolchainLibrary
|
||||||
module.Properties.Clang = proptools.BoolPtr(false)
|
module.Properties.Clang = BoolPtr(false)
|
||||||
module.stl = nil
|
module.stl = nil
|
||||||
module.sanitize = nil
|
module.sanitize = nil
|
||||||
module.installer = nil
|
module.installer = nil
|
||||||
|
@@ -85,7 +85,7 @@ func (vndk *vndkdep) vndkCheckLinkType(ctx android.ModuleContext, to *Module) {
|
|||||||
// Non-VNDK modules (those installed to /vendor) can't depend on modules marked with
|
// Non-VNDK modules (those installed to /vendor) can't depend on modules marked with
|
||||||
// vendor_available: false.
|
// vendor_available: false.
|
||||||
violation := false
|
violation := false
|
||||||
if lib, ok := to.linker.(*llndkStubDecorator); ok && !lib.Properties.Vendor_available {
|
if lib, ok := to.linker.(*llndkStubDecorator); ok && !Bool(lib.Properties.Vendor_available) {
|
||||||
violation = true
|
violation = true
|
||||||
} else {
|
} else {
|
||||||
if _, ok := to.linker.(libraryInterface); ok && to.VendorProperties.Vendor_available != nil && !Bool(to.VendorProperties.Vendor_available) {
|
if _, ok := to.linker.(libraryInterface); ok && to.VendorProperties.Vendor_available != nil && !Bool(to.VendorProperties.Vendor_available) {
|
||||||
@@ -138,7 +138,7 @@ func vndkMutator(mctx android.BottomUpMutatorContext) {
|
|||||||
llndkLibraries = append(llndkLibraries, name)
|
llndkLibraries = append(llndkLibraries, name)
|
||||||
sort.Strings(llndkLibraries)
|
sort.Strings(llndkLibraries)
|
||||||
}
|
}
|
||||||
if !lib.Properties.Vendor_available {
|
if !Bool(lib.Properties.Vendor_available) {
|
||||||
if !inList(name, vndkPrivateLibraries) {
|
if !inList(name, vndkPrivateLibraries) {
|
||||||
vndkPrivateLibraries = append(vndkPrivateLibraries, name)
|
vndkPrivateLibraries = append(vndkPrivateLibraries, name)
|
||||||
sort.Strings(vndkPrivateLibraries)
|
sort.Strings(vndkPrivateLibraries)
|
||||||
|
Reference in New Issue
Block a user