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
diff --git a/cc/binary.go b/cc/binary.go
index 30e017f..5f81866 100644
--- a/cc/binary.go
+++ b/cc/binary.go
@@ -15,8 +15,6 @@
package cc
import (
- "github.com/google/blueprint/proptools"
-
"android/soong/android"
)
@@ -25,19 +23,19 @@
Static_executable *bool `android:"arch_variant"`
// set the name of the output
- Stem string `android:"arch_variant"`
+ Stem *string `android:"arch_variant"`
// 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
- Prefix_symbols string
+ Prefix_symbols *string
// local file name to pass to the linker as --version_script
Version_script *string `android:"arch_variant"`
// 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
// extension (if any) appended
@@ -97,11 +95,11 @@
func (binary *binaryDecorator) getStem(ctx BaseModuleContext) string {
stem := ctx.baseModuleName()
- if binary.Properties.Stem != "" {
- stem = binary.Properties.Stem
+ if String(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 {
@@ -185,7 +183,7 @@
if !ctx.toolchain().Bionic() {
if ctx.Os() == android.Linux {
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 {
// Static executables are not supported on Darwin or Windows
@@ -315,10 +313,10 @@
binary.stripper.strip(ctx, outputFile, strippedOutputFile, builderFlags)
}
- if binary.Properties.Prefix_symbols != "" {
+ if String(binary.Properties.Prefix_symbols) != "" {
afterPrefixSymbols := outputFile
outputFile = android.PathForModuleOut(ctx, "unprefixed", fileName)
- TransformBinaryPrefixSymbols(ctx, binary.Properties.Prefix_symbols, outputFile,
+ TransformBinaryPrefixSymbols(ctx, String(binary.Properties.Prefix_symbols), outputFile,
flagsToBuilderFlags(flags), afterPrefixSymbols)
}
@@ -342,11 +340,11 @@
binary.baseInstaller.install(ctx, file)
for _, symlink := range binary.Properties.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 binary.Properties.Stem == "" && binary.Properties.Suffix == "" {
+ if Bool(binary.Properties.Symlink_preferred_arch) {
+ if String(binary.Properties.Stem) == "" && String(binary.Properties.Suffix) == "" {
ctx.PropertyErrorf("symlink_preferred_arch", "must also specify stem or suffix")
}
if ctx.TargetPrimary() {