Merge "Add srhines to the OWNERS for clang.go and global.go."
diff --git a/android/mutator.go b/android/mutator.go
index 2f13f6c..64d9fdd 100644
--- a/android/mutator.go
+++ b/android/mutator.go
@@ -76,6 +76,7 @@
func(ctx RegisterMutatorsContext) {
ctx.TopDown("load_hooks", loadHookMutator).Parallel()
},
+ RegisterNamespaceMutator,
RegisterPrebuiltsPreArchMutators,
RegisterDefaultsPreArchMutators,
}
@@ -86,7 +87,6 @@
}
var preDeps = []RegisterMutatorFunc{
- RegisterNamespaceMutator,
registerArchMutator,
}
diff --git a/android/namespace_test.go b/android/namespace_test.go
index 9ab186b..a6fc9d5 100644
--- a/android/namespace_test.go
+++ b/android/namespace_test.go
@@ -606,7 +606,7 @@
ctx.MockFileSystem(bps)
ctx.RegisterModuleType("test_module", ModuleFactoryAdaptor(newTestModule))
ctx.RegisterModuleType("soong_namespace", ModuleFactoryAdaptor(NamespaceFactory))
- ctx.PreDepsMutators(RegisterNamespaceMutator)
+ ctx.PreArchMutators(RegisterNamespaceMutator)
ctx.Register()
_, errs = ctx.ParseBlueprintsFiles("Android.bp")
diff --git a/cc/compiler.go b/cc/compiler.go
index 9b69114..0d8e3a1 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -226,7 +226,7 @@
}
func addToModuleList(ctx ModuleContext, list string, module string) {
- getWallWerrorMap(ctx.Config(), list).Store(module, true)
+ getNamedMapForConfig(ctx.Config(), list).Store(module, true)
}
// Create a Flags struct that collects the compile flags from global values,
diff --git a/cc/lto.go b/cc/lto.go
index b1e7cfa..7bc22ec 100644
--- a/cc/lto.go
+++ b/cc/lto.go
@@ -60,6 +60,9 @@
}
func (lto *lto) begin(ctx BaseModuleContext) {
+ if ctx.Config().IsEnvTrue("DISABLE_LTO") {
+ lto.Properties.Lto.Never = boolPtr(true)
+ }
}
func (lto *lto) deps(ctx BaseModuleContext, deps Deps) Deps {
diff --git a/cc/makevars.go b/cc/makevars.go
index 5faf201..779de8f 100644
--- a/cc/makevars.go
+++ b/cc/makevars.go
@@ -25,22 +25,23 @@
)
const (
- modulesAddedWall = "ModulesAddedWall"
- modulesUsingWnoError = "ModulesUsingWnoError"
+ modulesAddedWall = "ModulesAddedWall"
+ modulesUsingWnoError = "ModulesUsingWnoError"
+ modulesMissingProfileFile = "ModulesMissingProfileFile"
)
func init() {
android.RegisterMakeVarsProvider(pctx, makeVarsProvider)
}
-func getWallWerrorMap(config android.Config, name string) *sync.Map {
+func getNamedMapForConfig(config android.Config, name string) *sync.Map {
return config.Once(name, func() interface{} {
return &sync.Map{}
}).(*sync.Map)
}
func makeStringOfKeys(ctx android.MakeVarsContext, setName string) string {
- set := getWallWerrorMap(ctx.Config(), setName)
+ set := getNamedMapForConfig(ctx.Config(), setName)
keys := []string{}
set.Range(func(key interface{}, value interface{}) bool {
keys = append(keys, key.(string))
@@ -102,6 +103,7 @@
ctx.Strict("ANDROID_WARNING_ALLOWED_PROJECTS", makeStringOfWarningAllowedProjects())
ctx.Strict("SOONG_MODULES_ADDED_WALL", makeStringOfKeys(ctx, modulesAddedWall))
ctx.Strict("SOONG_MODULES_USING_WNO_ERROR", makeStringOfKeys(ctx, modulesUsingWnoError))
+ ctx.Strict("SOONG_MODULES_MISSING_PGO_PROFILE_FILE", makeStringOfKeys(ctx, modulesMissingProfileFile))
ctx.Strict("ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS", strings.Join(asanCflags, " "))
ctx.Strict("ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS", strings.Join(asanLdflags, " "))
diff --git a/cc/pgo.go b/cc/pgo.go
index 7ac5b2a..3ce67be 100644
--- a/cc/pgo.go
+++ b/cc/pgo.go
@@ -38,6 +38,10 @@
const profileUseInstrumentFormat = "-fprofile-use=%s"
const profileUseSamplingFormat = "-fprofile-sample-use=%s"
+func recordMissingProfileFile(ctx ModuleContext, missing string) {
+ getNamedMapForConfig(ctx.Config(), modulesMissingProfileFile).Store(missing, true)
+}
+
type PgoProperties struct {
Pgo struct {
Instrumentation *bool
@@ -96,6 +100,10 @@
}
}
+ // Record that this module's profile file is absent
+ missing := *props.Pgo.Profile_file + ":" + ctx.ModuleDir() + "/Android.bp:" + ctx.ModuleName()
+ recordMissingProfileFile(ctx, missing)
+
return android.OptionalPathForPath(nil)
}
@@ -197,7 +205,7 @@
}
// This module should be instrumented if ANDROID_PGO_INSTRUMENT is set
- // and includes a benchmark listed for this module
+ // and includes 'all', 'ALL' or a benchmark listed for this module.
//
// TODO Validate that each benchmark instruments at least one module
pgo.Properties.ShouldProfileModule = false
@@ -207,10 +215,14 @@
pgoBenchmarksMap[b] = true
}
- for _, b := range pgo.Properties.Pgo.Benchmarks {
- if pgoBenchmarksMap[b] == true {
- pgo.Properties.ShouldProfileModule = true
- break
+ if pgoBenchmarksMap["all"] == true || pgoBenchmarksMap["ALL"] == true {
+ pgo.Properties.ShouldProfileModule = true
+ } else {
+ for _, b := range pgo.Properties.Pgo.Benchmarks {
+ if pgoBenchmarksMap[b] == true {
+ pgo.Properties.ShouldProfileModule = true
+ break
+ }
}
}
}
diff --git a/java/jacoco.go b/java/jacoco.go
index 8f1ceb2..541a84a 100644
--- a/java/jacoco.go
+++ b/java/jacoco.go
@@ -22,6 +22,7 @@
"strings"
"github.com/google/blueprint"
+ "github.com/google/blueprint/proptools"
"android/soong/android"
)
@@ -105,13 +106,22 @@
return nil, err
}
}
- return specs, nil
+ return proptools.NinjaAndShellEscape(specs), nil
}
func jacocoFilterToSpec(filter string) (string, error) {
- wildcard := strings.HasSuffix(filter, "*")
- filter = strings.TrimSuffix(filter, "*")
- recursiveWildcard := wildcard && (strings.HasSuffix(filter, ".") || filter == "")
+ recursiveWildcard := strings.HasSuffix(filter, "**")
+ nonRecursiveWildcard := false
+ if !recursiveWildcard {
+ nonRecursiveWildcard = strings.HasSuffix(filter, "*")
+ filter = strings.TrimSuffix(filter, "*")
+ } else {
+ filter = strings.TrimSuffix(filter, "**")
+ }
+
+ if recursiveWildcard && !(strings.HasSuffix(filter, ".") || filter == "") {
+ return "", fmt.Errorf("only '**' or '.**' is supported as recursive wildcard in a filter")
+ }
if strings.ContainsRune(filter, '*') {
return "", fmt.Errorf("'*' is only supported as the last character in a filter")
@@ -121,7 +131,7 @@
if recursiveWildcard {
spec += "**/*.class"
- } else if wildcard {
+ } else if nonRecursiveWildcard {
spec += "*.class"
} else {
spec += ".class"
diff --git a/java/jacoco_test.go b/java/jacoco_test.go
index 6e8b026..91f0553 100644
--- a/java/jacoco_test.go
+++ b/java/jacoco_test.go
@@ -33,13 +33,23 @@
{
name: "package wildcard",
in: "package.*",
+ out: "package/*.class",
+ },
+ {
+ name: "package recursive wildcard",
+ in: "package.**",
out: "package/**/*.class",
},
{
- name: "all wildcard",
- in: "*",
+ name: "recursive wildcard only",
+ in: "**",
out: "**/*.class",
},
+ {
+ name: "single wildcard only",
+ in: "*",
+ out: "*.class",
+ },
}
for _, testCase := range testCases {