diff options
Diffstat (limited to 'cc')
| -rw-r--r-- | cc/androidmk.go | 8 | ||||
| -rw-r--r-- | cc/builder.go | 8 | ||||
| -rw-r--r-- | cc/cc.go | 2 | ||||
| -rw-r--r-- | cc/cmakelists.go | 54 | ||||
| -rw-r--r-- | cc/config/arm64_device.go | 3 | ||||
| -rw-r--r-- | cc/config/clang.go | 4 | ||||
| -rw-r--r-- | cc/test.go | 5 |
7 files changed, 53 insertions, 31 deletions
diff --git a/cc/androidmk.go b/cc/androidmk.go index f45fbbe5e..7acc244b2 100644 --- a/cc/androidmk.go +++ b/cc/androidmk.go @@ -200,6 +200,14 @@ func (test *testBinary) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkDa ret.SubName = "_" + test.binaryDecorator.Properties.Stem } + ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) error { + if len(test.Properties.Test_suites) > 0 { + fmt.Fprintln(w, "LOCAL_COMPATIBILITY_SUITES :=", + strings.Join(test.Properties.Test_suites, " ")) + } + return nil + }) + var testFiles []string for _, d := range test.data { rel := d.Rel() diff --git a/cc/builder.go b/cc/builder.go index f3a4bcb44..cdfea92df 100644 --- a/cc/builder.go +++ b/cc/builder.go @@ -109,7 +109,7 @@ var ( }, "objcopyCmd", "prefix") - stripPath = pctx.SourcePathVariable("stripPath", "build/soong/scripts/strip.sh") + _ = pctx.SourcePathVariable("stripPath", "build/soong/scripts/strip.sh") strip = pctx.AndroidStaticRule("strip", blueprint.RuleParams{ @@ -127,7 +127,7 @@ var ( Description: "empty file $out", }) - copyGccLibPath = pctx.SourcePathVariable("copyGccLibPath", "build/soong/scripts/copygcclib.sh") + _ = pctx.SourcePathVariable("copyGccLibPath", "build/soong/scripts/copygcclib.sh") copyGccLib = pctx.AndroidStaticRule("copyGccLib", blueprint.RuleParams{ @@ -139,7 +139,7 @@ var ( }, "ccCmd", "cFlags", "libName") - tocPath = pctx.SourcePathVariable("tocPath", "build/soong/scripts/toc.sh") + _ = pctx.SourcePathVariable("tocPath", "build/soong/scripts/toc.sh") toc = pctx.AndroidStaticRule("toc", blueprint.RuleParams{ @@ -159,7 +159,7 @@ var ( }, "cFlags", "tidyFlags") - yasmCmd = pctx.SourcePathVariable("yasmCmd", "prebuilts/misc/${config.HostPrebuiltTag}/yasm/yasm") + _ = pctx.SourcePathVariable("yasmCmd", "prebuilts/misc/${config.HostPrebuiltTag}/yasm/yasm") yasm = pctx.AndroidStaticRule("yasm", blueprint.RuleParams{ @@ -675,7 +675,7 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) { variantLibs = append(variantLibs, entry+ndkLibrarySuffix) } } else { - nonvariantLibs = append(variantLibs, entry) + nonvariantLibs = append(nonvariantLibs, entry) } } return nonvariantLibs, variantLibs diff --git a/cc/cmakelists.go b/cc/cmakelists.go index 1c47ec98c..83b6d69c8 100644 --- a/cc/cmakelists.go +++ b/cc/cmakelists.go @@ -163,9 +163,15 @@ func generateCLionProject(compiledModule CompiledInterface, ctx blueprint.Single translateToCMake(cppParameters, f, false, true) // Add project executable. - f.WriteString(fmt.Sprintf("\nadd_executable(%s ${SOURCE_FILES})\n", ccModule.ModuleBase.Name())) + f.WriteString(fmt.Sprintf("\nadd_executable(%s ${SOURCE_FILES})\n", + cleanExecutableName(ccModule.ModuleBase.Name()))) } +func cleanExecutableName(s string) string { + return strings.Replace(s, "@", "-", -1) +} + + func translateToCMake(c compilerParameters, f *os.File, cflags bool, cppflags bool) { writeAllSystemDirectories(c.systemHeaderSearchPath, f) writeAllIncludeDirectories(c.headerSearchPath, f) @@ -189,16 +195,26 @@ func buildCMakePath(p string) string { return fmt.Sprintf("${ANDROID_ROOT}/%s", p) } -func writeAllIncludeDirectories(includes map[string]bool, f *os.File) { - for include := range includes { - f.WriteString(fmt.Sprintf("include_directories(\"%s\")\n", buildCMakePath(include))) +func writeAllIncludeDirectories(includes []string, f *os.File) { + if len(includes) == 0 { + return + } + f.WriteString("include_directories(\n") + for _, include := range includes { + f.WriteString(fmt.Sprintf(" \"%s\"\n", buildCMakePath(include))) } + f.WriteString(")\n") } -func writeAllSystemDirectories(includes map[string]bool, f *os.File) { - for include := range includes { - f.WriteString(fmt.Sprintf("include_directories(SYSTEM \"%s\")\n", buildCMakePath(include))) +func writeAllSystemDirectories(includes []string, f *os.File) { + if len(includes) == 0 { + return + } + f.WriteString("include_directories(SYSTEM \n") + for _, include := range includes { + f.WriteString(fmt.Sprintf(" \"%s\"\n", buildCMakePath(include))) } + f.WriteString(")\n") } func writeAllFlags(flags []string, f *os.File, tag string) { @@ -218,17 +234,14 @@ const ( ) type compilerParameters struct { - headerSearchPath map[string]bool - systemHeaderSearchPath map[string]bool + headerSearchPath []string + systemHeaderSearchPath []string flags []string sysroot string } func makeCompilerParameters() compilerParameters { return compilerParameters{ - headerSearchPath: make(map[string]bool), - systemHeaderSearchPath: make(map[string]bool), - flags: make([]string, 0), sysroot: "", } } @@ -267,7 +280,8 @@ func parseCompilerParameters(params []string, ctx blueprint.SingletonContext, f switch categorizeParameter(param) { case headerSearchPath: - compilerParameters.headerSearchPath[strings.TrimPrefix(param, "-I")] = true + compilerParameters.headerSearchPath = + append(compilerParameters.headerSearchPath, strings.TrimPrefix(param, "-I")) case variable: if evaluated, error := evalVariable(ctx, param); error == nil { if outputDebugInfo { @@ -284,7 +298,8 @@ func parseCompilerParameters(params []string, ctx blueprint.SingletonContext, f } case systemHeaderSearchPath: if i < len(params)-1 { - compilerParameters.systemHeaderSearchPath[params[i+1]] = true + compilerParameters.systemHeaderSearchPath = + append(compilerParameters.systemHeaderSearchPath, params[i+1]) } else if outputDebugInfo { f.WriteString("# Found a header search path marker with no path") } @@ -343,8 +358,8 @@ func doubleEscape(s string) string { } func concatenateParams(c1 *compilerParameters, c2 compilerParameters) { - concatenateMaps(c1.headerSearchPath, c2.headerSearchPath) - concatenateMaps(c1.systemHeaderSearchPath, c2.systemHeaderSearchPath) + c1.headerSearchPath = append(c1.headerSearchPath, c2.headerSearchPath...) + c1.systemHeaderSearchPath = append(c1.systemHeaderSearchPath, c2.systemHeaderSearchPath...) if c2.sysroot != "" { c1.sysroot = c2.sysroot } @@ -359,13 +374,6 @@ func evalVariable(ctx blueprint.SingletonContext, str string) (string, error) { return "", err } -// Concatenate two maps into one. Results are stored in first operand. -func concatenateMaps(map1 map[string]bool, map2 map[string]bool) { - for key, value := range map2 { - map1[key] = value - } -} - func getCMakeListsForModule(module *Module, ctx blueprint.SingletonContext) string { return filepath.Join(getAndroidSrcRootDirectory(ctx), cLionOutputProjectsDirectory, diff --git a/cc/config/arm64_device.go b/cc/config/arm64_device.go index fe47ddfc0..23186e760 100644 --- a/cc/config/arm64_device.go +++ b/cc/config/arm64_device.go @@ -66,9 +66,6 @@ var ( "-fuse-ld=gold", "-Wl,--icf=safe", "-Wl,--no-undefined-version", - - // Disable transitive dependency library symbol resolving. - "-Wl,--allow-shlib-undefined", } arm64Cppflags = []string{ diff --git a/cc/config/clang.go b/cc/config/clang.go index 10f4cea95..30ab1c63c 100644 --- a/cc/config/clang.go +++ b/cc/config/clang.go @@ -91,6 +91,10 @@ func init() { // http://b/29823425 Disable -Wexpansion-to-defined for Clang update to r271374 "-Wno-expansion-to-defined", + + // http://b/36463318 Clang executes with an absolute path, so clang-provided + // headers are now absolute. + "-fdebug-prefix-map=$$PWD/=", }, " ")) pctx.StaticVariable("ClangExtraCppflags", strings.Join([]string{ diff --git a/cc/test.go b/cc/test.go index d3556bf97..145b5b088 100644 --- a/cc/test.go +++ b/cc/test.go @@ -20,6 +20,7 @@ import ( "strings" "android/soong/android" + "github.com/google/blueprint" ) @@ -41,6 +42,10 @@ type TestBinaryProperties struct { // list of files or filegroup modules that provide data that should be installed alongside // the test Data []string + + // list of compatibility suites (for example "cts", "vts") that the module should be + // installed into. + Test_suites []string } func init() { |