Merge "Error if visibility specifies a module"
diff --git a/android/visibility.go b/android/visibility.go
index a6d7bbe..7eac471 100644
--- a/android/visibility.go
+++ b/android/visibility.go
@@ -447,7 +447,7 @@
rule := effectiveVisibilityRules(ctx.Config(), depQualified)
if !rule.matches(qualified) {
- ctx.ModuleErrorf("depends on %s which is not visible to this module", depQualified)
+ ctx.ModuleErrorf("depends on %s which is not visible to this module\nYou may need to add %q to its visibility", depQualified, "//"+ctx.ModuleDir())
}
})
}
diff --git a/android/visibility_test.go b/android/visibility_test.go
index 9d9e574..cb5ef35 100644
--- a/android/visibility_test.go
+++ b/android/visibility_test.go
@@ -731,7 +731,7 @@
}`),
},
expectedErrors: []string{
- `module "libnamespace" variant "android_common": depends on //top:libexample which is not visible to this module`,
+ `module "libnamespace" variant "android_common": depends on //top:libexample which is not visible to this module\nYou may need to add "//namespace" to its visibility`,
},
},
{
@@ -760,7 +760,7 @@
}`),
},
expectedErrors: []string{
- `module "libnamespace" variant "android_common": depends on //top:libexample which is not visible to this module`,
+ `module "libnamespace" variant "android_common": depends on //top:libexample which is not visible to this module\nYou may need to add "//namespace" to its visibility`,
},
},
{
diff --git a/cc/builder.go b/cc/builder.go
index 81c09b1..8c8aa17 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -44,14 +44,14 @@
blueprint.RuleParams{
Depfile: "${out}.d",
Deps: blueprint.DepsGCC,
- Command: "$relPwd ${config.CcWrapper}$ccCmd -c $cFlags -MD -MF ${out}.d -o $out $in",
+ Command: "${config.CcWrapper}$ccCmd -c $cFlags -MD -MF ${out}.d -o $out $in",
CommandDeps: []string{"$ccCmd"},
},
"ccCmd", "cFlags")
ccNoDeps = pctx.AndroidStaticRule("ccNoDeps",
blueprint.RuleParams{
- Command: "$relPwd $ccCmd -c $cFlags -o $out $in",
+ Command: "$ccCmd -c $cFlags -o $out $in",
CommandDeps: []string{"$ccCmd"},
},
"ccCmd", "cFlags")
@@ -220,7 +220,7 @@
Labels: map[string]string{"type": "abi-dump", "tool": "header-abi-dumper"},
ExecStrategy: "${config.REAbiDumperExecStrategy}",
Platform: map[string]string{
- remoteexec.PoolKey: "${config.RECXXPool}",
+ remoteexec.PoolKey: "${config.RECXXPool}",
},
}, []string{"cFlags", "exportDirs"}, nil)
diff --git a/cc/config/global.go b/cc/config/global.go
index a170652..1aa2621 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -53,6 +53,13 @@
"-Werror=pragma-pack",
"-Werror=pragma-pack-suspicious-include",
"-Werror=unreachable-code-loop-increment",
+
+ // -fdebug-compilation-dir=. is used to make both the action command line and the output
+ // independent of the working directory of the action.
+ // Using cc1 flags since RBE's input processor does not yet have the updated version
+ // of LLVM that promotes the cc1 flag to driver level flag.
+ // See: https://reviews.llvm.org/D63387
+ "-Xclang,-fdebug-compilation-dir,.",
}
commonGlobalConlyflags = []string{}
@@ -150,10 +157,6 @@
var pctx = android.NewPackageContext("android/soong/cc/config")
func init() {
- if android.BuildOs == android.Linux {
- commonGlobalCflags = append(commonGlobalCflags, "-fdebug-prefix-map=/proc/self/cwd=")
- }
-
pctx.StaticVariable("CommonGlobalConlyflags", strings.Join(commonGlobalConlyflags, " "))
pctx.StaticVariable("DeviceGlobalCppflags", strings.Join(deviceGlobalCppflags, " "))
pctx.StaticVariable("DeviceGlobalLdflags", strings.Join(deviceGlobalLdflags, " "))
diff --git a/cc/vndk_prebuilt.go b/cc/vndk_prebuilt.go
index 7c47ef4..3556d94 100644
--- a/cc/vndk_prebuilt.go
+++ b/cc/vndk_prebuilt.go
@@ -169,6 +169,8 @@
TableOfContents: p.tocFile,
})
+ p.libraryDecorator.flagExporter.setProvider(ctx)
+
return in
}
diff --git a/tradefed/Android.bp b/tradefed/Android.bp
index 6e5e533..4e4e6a7 100644
--- a/tradefed/Android.bp
+++ b/tradefed/Android.bp
@@ -12,3 +12,20 @@
],
pluginFor: ["soong_build"],
}
+
+bootstrap_go_package {
+ name: "soong-suite-harness",
+ pkgPath: "android/soong/tradefed/suite_harness",
+ deps: [
+ "blueprint",
+ "blueprint-pathtools",
+ "blueprint-proptools",
+ "soong",
+ "soong-android",
+ "soong-java",
+ ],
+ srcs: [
+ "suite_harness/tradefed_binary.go",
+ ],
+ pluginFor: ["soong_build"],
+}
diff --git a/tradefed/suite_harness/tradefed_binary.go b/tradefed/suite_harness/tradefed_binary.go
new file mode 100644
index 0000000..1bd4f93
--- /dev/null
+++ b/tradefed/suite_harness/tradefed_binary.go
@@ -0,0 +1,164 @@
+// Copyright 2018 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package suite_harness
+
+import (
+ "strings"
+
+ "github.com/google/blueprint"
+
+ "android/soong/android"
+ "android/soong/java"
+)
+
+var pctx = android.NewPackageContext("android/soong/tradefed/suite_harness")
+
+func init() {
+ android.RegisterModuleType("tradefed_binary_host", tradefedBinaryFactory)
+
+ pctx.Import("android/soong/android")
+}
+
+type TradefedBinaryProperties struct {
+ Short_name string
+ Full_name string
+ Version string
+ Prepend_platform_version_name bool
+}
+
+// tradefedBinaryFactory creates an empty module for the tradefed_binary module type,
+// which is a java_binary with some additional processing in tradefedBinaryLoadHook.
+func tradefedBinaryFactory() android.Module {
+ props := &TradefedBinaryProperties{}
+ module := java.BinaryHostFactory()
+ module.AddProperties(props)
+ android.AddLoadHook(module, tradefedBinaryLoadHook(props))
+
+ return module
+}
+
+const genSuffix = "-gen"
+
+// tradefedBinaryLoadHook adds extra resources and libraries to tradefed_binary modules.
+func tradefedBinaryLoadHook(tfb *TradefedBinaryProperties) func(ctx android.LoadHookContext) {
+ return func(ctx android.LoadHookContext) {
+ genName := ctx.ModuleName() + genSuffix
+ version := tfb.Version
+ if tfb.Prepend_platform_version_name {
+ version = ctx.Config().PlatformVersionName() + tfb.Version
+ }
+
+ // Create a submodule that generates the test-suite-info.properties file
+ // and copies DynamicConfig.xml if it is present.
+ ctx.CreateModule(tradefedBinaryGenFactory,
+ &TradefedBinaryGenProperties{
+ Name: &genName,
+ Short_name: tfb.Short_name,
+ Full_name: tfb.Full_name,
+ Version: version,
+ })
+
+ props := struct {
+ Java_resources []string
+ Libs []string
+ }{}
+
+ // Add dependencies required by all tradefed_binary modules.
+ props.Libs = []string{
+ "tradefed",
+ "tradefed-test-framework",
+ "loganalysis",
+ "hosttestlib",
+ "compatibility-host-util",
+ }
+
+ // Add the files generated by the submodule created above to the resources.
+ props.Java_resources = []string{":" + genName}
+
+ ctx.AppendProperties(&props)
+
+ }
+}
+
+type TradefedBinaryGenProperties struct {
+ Name *string
+ Short_name string
+ Full_name string
+ Version string
+}
+
+type tradefedBinaryGen struct {
+ android.ModuleBase
+
+ properties TradefedBinaryGenProperties
+
+ gen android.Paths
+}
+
+func tradefedBinaryGenFactory() android.Module {
+ tfg := &tradefedBinaryGen{}
+ tfg.AddProperties(&tfg.properties)
+ android.InitAndroidModule(tfg)
+ return tfg
+}
+
+func (tfg *tradefedBinaryGen) DepsMutator(android.BottomUpMutatorContext) {}
+
+var tradefedBinaryGenRule = pctx.StaticRule("tradefedBinaryGenRule", blueprint.RuleParams{
+ Command: `rm -f $out && touch $out && ` +
+ `echo "# This file is auto generated by Android.mk. Do not modify." >> $out && ` +
+ `echo "build_number = $$(cat ${buildNumberFile})" >> $out && ` +
+ `echo "target_arch = ${arch}" >> $out && ` +
+ `echo "name = ${name}" >> $out && ` +
+ `echo "fullname = ${fullname}" >> $out && ` +
+ `echo "version = ${version}" >> $out`,
+}, "buildNumberFile", "arch", "name", "fullname", "version")
+
+func (tfg *tradefedBinaryGen) GenerateAndroidBuildActions(ctx android.ModuleContext) {
+ buildNumberFile := ctx.Config().BuildNumberFile(ctx)
+ outputFile := android.PathForModuleOut(ctx, "test-suite-info.properties")
+ ctx.Build(pctx, android.BuildParams{
+ Rule: tradefedBinaryGenRule,
+ Output: outputFile,
+ OrderOnly: android.Paths{buildNumberFile},
+ Args: map[string]string{
+ "buildNumberFile": buildNumberFile.String(),
+ "arch": ctx.Config().DevicePrimaryArchType().String(),
+ "name": tfg.properties.Short_name,
+ "fullname": tfg.properties.Full_name,
+ "version": tfg.properties.Version,
+ },
+ })
+
+ tfg.gen = append(tfg.gen, outputFile)
+
+ dynamicConfig := android.ExistentPathForSource(ctx, ctx.ModuleDir(), "DynamicConfig.xml")
+ if dynamicConfig.Valid() {
+ outputFile := android.PathForModuleOut(ctx, strings.TrimSuffix(ctx.ModuleName(), genSuffix)+".dynamic")
+ ctx.Build(pctx, android.BuildParams{
+ Rule: android.Cp,
+ Input: dynamicConfig.Path(),
+ Output: outputFile,
+ })
+
+ tfg.gen = append(tfg.gen, outputFile)
+ }
+}
+
+func (tfg *tradefedBinaryGen) Srcs() android.Paths {
+ return append(android.Paths(nil), tfg.gen...)
+}
+
+var _ android.SourceFileProducer = (*tradefedBinaryGen)(nil)