Merge "Shorten missing module panic message"
diff --git a/apex/apex.go b/apex/apex.go
index 9905b79..8d9aa51 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -549,7 +549,6 @@
"android.hardware.tetheroffload.config-V1.0-java",
"android.hardware.tetheroffload.control-V1.0-java",
"android.hidl.base-V1.0-java",
- "ipmemorystore-aidl-interfaces-java",
"libcgrouprc",
"libcgrouprc_format",
"libtetherutilsjni",
diff --git a/cc/cc.go b/cc/cc.go
index 9e1c172..abe003e 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -969,7 +969,7 @@
}
func (c *Module) IsNdk() bool {
- return inList(c.Name(), ndkKnownLibs)
+ return inList(c.BaseModuleName(), ndkKnownLibs)
}
func (c *Module) isLlndk(config android.Config) bool {
diff --git a/cc/lto.go b/cc/lto.go
index ed3abe7..9868cdf 100644
--- a/cc/lto.go
+++ b/cc/lto.go
@@ -152,9 +152,7 @@
// Do not recurse down non-static dependencies
if isLibTag {
- // TODO(ccross): the staticUnwinder check is there to maintain existing behavior
- // when adding libraryDependencyTag and should be removed.
- if !libTag.static() || libTag.staticUnwinder {
+ if !libTag.static() {
return false
}
} else {
diff --git a/java/app.go b/java/app.go
index 8a0b3db..e820048 100755
--- a/java/app.go
+++ b/java/app.go
@@ -845,9 +845,7 @@
otherName := ctx.OtherModuleName(module)
tag := ctx.OtherModuleDependencyTag(module)
- // TODO(ccross): The tag == cc.SharedDepTag() check should be cc.IsSharedDepTag(tag) but
- // was left to maintain behavior when adding libraryDependencyTag.
- if IsJniDepTag(tag) || tag == cc.SharedDepTag() {
+ if IsJniDepTag(tag) || cc.IsSharedDepTag(tag) {
if dep, ok := module.(*cc.Module); ok {
if dep.IsNdk() || dep.IsStubs() {
return false
diff --git a/rust/config/allowed_list.go b/rust/config/allowed_list.go
index 22a0e63..ed9f90b 100644
--- a/rust/config/allowed_list.go
+++ b/rust/config/allowed_list.go
@@ -6,6 +6,7 @@
"external/rust",
"external/crosvm",
"external/adhd",
+ "frameworks/native/libs/binder/rust",
"prebuilts/rust",
"system/extras/profcollectd",
"system/security",
diff --git a/sh/Android.bp b/sh/Android.bp
index 0f40c5f..e5ffeef 100644
--- a/sh/Android.bp
+++ b/sh/Android.bp
@@ -5,6 +5,7 @@
"blueprint",
"soong",
"soong-android",
+ "soong-cc",
"soong-tradefed",
],
srcs: [
diff --git a/sh/sh_binary.go b/sh/sh_binary.go
index f28b2b6..217a4e1 100644
--- a/sh/sh_binary.go
+++ b/sh/sh_binary.go
@@ -17,11 +17,14 @@
import (
"fmt"
"path/filepath"
+ "sort"
"strings"
+ "github.com/google/blueprint"
"github.com/google/blueprint/proptools"
"android/soong/android"
+ "android/soong/cc"
"android/soong/tradefed"
)
@@ -88,6 +91,20 @@
// doesn't exist next to the Android.bp, this attribute doesn't need to be set to true
// explicitly.
Auto_gen_config *bool
+
+ // list of binary modules that should be installed alongside the test
+ Data_bins []string `android:"path,arch_variant"`
+
+ // list of library modules that should be installed alongside the test
+ Data_libs []string `android:"path,arch_variant"`
+
+ // list of device binary modules that should be installed alongside the test.
+ // Only available for host sh_test modules.
+ Data_device_bins []string `android:"path,arch_variant"`
+
+ // list of device library modules that should be installed alongside the test.
+ // Only available for host sh_test modules.
+ Data_device_libs []string `android:"path,arch_variant"`
}
type ShBinary struct {
@@ -111,6 +128,8 @@
data android.Paths
testConfig android.Path
+
+ dataModules map[string]android.Path
}
func (s *ShBinary) HostToolPath() android.OptionalPath {
@@ -192,6 +211,50 @@
}
}
+type dependencyTag struct {
+ blueprint.BaseDependencyTag
+ name string
+}
+
+var (
+ shTestDataBinsTag = dependencyTag{name: "dataBins"}
+ shTestDataLibsTag = dependencyTag{name: "dataLibs"}
+ shTestDataDeviceBinsTag = dependencyTag{name: "dataDeviceBins"}
+ shTestDataDeviceLibsTag = dependencyTag{name: "dataDeviceLibs"}
+)
+
+var sharedLibVariations = []blueprint.Variation{{Mutator: "link", Variation: "shared"}}
+
+func (s *ShTest) DepsMutator(ctx android.BottomUpMutatorContext) {
+ s.ShBinary.DepsMutator(ctx)
+
+ ctx.AddFarVariationDependencies(ctx.Target().Variations(), shTestDataBinsTag, s.testProperties.Data_bins...)
+ ctx.AddFarVariationDependencies(append(ctx.Target().Variations(), sharedLibVariations...),
+ shTestDataLibsTag, s.testProperties.Data_libs...)
+ if ctx.Target().Os.Class == android.Host && len(ctx.Config().Targets[android.Android]) > 0 {
+ deviceVariations := ctx.Config().Targets[android.Android][0].Variations()
+ ctx.AddFarVariationDependencies(deviceVariations, shTestDataDeviceBinsTag, s.testProperties.Data_device_bins...)
+ ctx.AddFarVariationDependencies(append(deviceVariations, sharedLibVariations...),
+ shTestDataDeviceLibsTag, s.testProperties.Data_device_libs...)
+ } else if ctx.Target().Os.Class != android.Host {
+ if len(s.testProperties.Data_device_bins) > 0 {
+ ctx.PropertyErrorf("data_device_bins", "only available for host modules")
+ }
+ if len(s.testProperties.Data_device_libs) > 0 {
+ ctx.PropertyErrorf("data_device_libs", "only available for host modules")
+ }
+ }
+}
+
+func (s *ShTest) addToDataModules(ctx android.ModuleContext, relPath string, path android.Path) {
+ if _, exists := s.dataModules[relPath]; exists {
+ ctx.ModuleErrorf("data modules have a conflicting installation path, %v - %s, %s",
+ relPath, s.dataModules[relPath].String(), path.String())
+ return
+ }
+ s.dataModules[relPath] = path
+}
+
func (s *ShTest) GenerateAndroidBuildActions(ctx android.ModuleContext) {
s.ShBinary.generateAndroidBuildActions(ctx)
testDir := "nativetest"
@@ -223,6 +286,50 @@
}
s.testConfig = tradefed.AutoGenShellTestConfig(ctx, s.testProperties.Test_config,
s.testProperties.Test_config_template, s.testProperties.Test_suites, configs, s.testProperties.Auto_gen_config, s.outputFilePath.Base())
+
+ s.dataModules = make(map[string]android.Path)
+ ctx.VisitDirectDeps(func(dep android.Module) {
+ depTag := ctx.OtherModuleDependencyTag(dep)
+ switch depTag {
+ case shTestDataBinsTag, shTestDataDeviceBinsTag:
+ if cc, isCc := dep.(*cc.Module); isCc {
+ s.addToDataModules(ctx, cc.OutputFile().Path().Base(), cc.OutputFile().Path())
+ return
+ }
+ property := "data_bins"
+ if depTag == shTestDataDeviceBinsTag {
+ property = "data_device_bins"
+ }
+ ctx.PropertyErrorf(property, "%q of type %q is not supported", dep.Name(), ctx.OtherModuleType(dep))
+ case shTestDataLibsTag, shTestDataDeviceLibsTag:
+ if cc, isCc := dep.(*cc.Module); isCc {
+ // Copy to an intermediate output directory to append "lib[64]" to the path,
+ // so that it's compatible with the default rpath values.
+ var relPath string
+ if cc.Arch().ArchType.Multilib == "lib64" {
+ relPath = filepath.Join("lib64", cc.OutputFile().Path().Base())
+ } else {
+ relPath = filepath.Join("lib", cc.OutputFile().Path().Base())
+ }
+ if _, exist := s.dataModules[relPath]; exist {
+ return
+ }
+ relocatedLib := android.PathForModuleOut(ctx, "relocated", relPath)
+ ctx.Build(pctx, android.BuildParams{
+ Rule: android.Cp,
+ Input: cc.OutputFile().Path(),
+ Output: relocatedLib,
+ })
+ s.addToDataModules(ctx, relPath, relocatedLib)
+ return
+ }
+ property := "data_libs"
+ if depTag == shTestDataDeviceBinsTag {
+ property = "data_device_libs"
+ }
+ ctx.PropertyErrorf(property, "%q of type %q is not supported", dep.Name(), ctx.OtherModuleType(dep))
+ }
+ })
}
func (s *ShTest) InstallInData() bool {
@@ -251,6 +358,15 @@
path = strings.TrimSuffix(path, rel)
entries.AddStrings("LOCAL_TEST_DATA", path+":"+rel)
}
+ relPaths := make([]string, 0)
+ for relPath, _ := range s.dataModules {
+ relPaths = append(relPaths, relPath)
+ }
+ sort.Strings(relPaths)
+ for _, relPath := range relPaths {
+ dir := strings.TrimSuffix(s.dataModules[relPath].String(), relPath)
+ entries.AddStrings("LOCAL_TEST_DATA", dir+":"+relPath)
+ }
},
},
}}
diff --git a/sh/sh_binary_test.go b/sh/sh_binary_test.go
index 3bfe611..3f2f16f 100644
--- a/sh/sh_binary_test.go
+++ b/sh/sh_binary_test.go
@@ -3,10 +3,12 @@
import (
"io/ioutil"
"os"
+ "path/filepath"
"reflect"
"testing"
"android/soong/android"
+ "android/soong/cc"
)
var buildDir string
@@ -46,6 +48,9 @@
ctx := android.NewTestArchContext()
ctx.RegisterModuleType("sh_test", ShTestFactory)
ctx.RegisterModuleType("sh_test_host", ShTestHostFactory)
+
+ cc.RegisterRequiredBuildComponentsForTest(ctx)
+
ctx.Register(config)
_, errs := ctx.ParseFileList(".", []string{"Android.bp"})
android.FailIfErrored(t, errs)
@@ -105,6 +110,60 @@
}
}
+func TestShTest_dataModules(t *testing.T) {
+ ctx, config := testShBinary(t, `
+ sh_test {
+ name: "foo",
+ src: "test.sh",
+ host_supported: true,
+ data_bins: ["bar"],
+ data_libs: ["libbar"],
+ }
+
+ cc_binary {
+ name: "bar",
+ host_supported: true,
+ shared_libs: ["libbar"],
+ no_libcrt: true,
+ nocrt: true,
+ system_shared_libs: [],
+ stl: "none",
+ }
+
+ cc_library {
+ name: "libbar",
+ host_supported: true,
+ no_libcrt: true,
+ nocrt: true,
+ system_shared_libs: [],
+ stl: "none",
+ }
+ `)
+
+ arches := []string{"android_arm64_armv8-a", "linux_glibc_x86_64"}
+ for _, arch := range arches {
+ variant := ctx.ModuleForTests("foo", arch)
+
+ relocated := variant.Output("relocated/lib64/libbar.so")
+ expectedInput := filepath.Join(buildDir, ".intermediates/libbar/"+arch+"_shared/libbar.so")
+ if relocated.Input.String() != expectedInput {
+ t.Errorf("Unexpected relocation input, expected: %q, actual: %q",
+ expectedInput, relocated.Input.String())
+ }
+
+ mod := variant.Module().(*ShTest)
+ entries := android.AndroidMkEntriesForTest(t, config, "", mod)[0]
+ expectedData := []string{
+ filepath.Join(buildDir, ".intermediates/bar", arch, ":bar"),
+ filepath.Join(buildDir, ".intermediates/foo", arch, "relocated/:lib64/libbar.so"),
+ }
+ actualData := entries.EntryMap["LOCAL_TEST_DATA"]
+ if !reflect.DeepEqual(expectedData, actualData) {
+ t.Errorf("Unexpected test data, expected: %q, actual: %q", expectedData, actualData)
+ }
+ }
+}
+
func TestShTestHost(t *testing.T) {
ctx, _ := testShBinary(t, `
sh_test_host {
@@ -124,3 +183,53 @@
t.Errorf("host bit is not set for a sh_test_host module.")
}
}
+
+func TestShTestHost_dataDeviceModules(t *testing.T) {
+ ctx, config := testShBinary(t, `
+ sh_test_host {
+ name: "foo",
+ src: "test.sh",
+ data_device_bins: ["bar"],
+ data_device_libs: ["libbar"],
+ }
+
+ cc_binary {
+ name: "bar",
+ shared_libs: ["libbar"],
+ no_libcrt: true,
+ nocrt: true,
+ system_shared_libs: [],
+ stl: "none",
+ }
+
+ cc_library {
+ name: "libbar",
+ no_libcrt: true,
+ nocrt: true,
+ system_shared_libs: [],
+ stl: "none",
+ }
+ `)
+
+ buildOS := android.BuildOs.String()
+ variant := ctx.ModuleForTests("foo", buildOS+"_x86_64")
+
+ relocated := variant.Output("relocated/lib64/libbar.so")
+ expectedInput := filepath.Join(buildDir, ".intermediates/libbar/android_arm64_armv8-a_shared/libbar.so")
+ if relocated.Input.String() != expectedInput {
+ t.Errorf("Unexpected relocation input, expected: %q, actual: %q",
+ expectedInput, relocated.Input.String())
+ }
+
+ mod := variant.Module().(*ShTest)
+ entries := android.AndroidMkEntriesForTest(t, config, "", mod)[0]
+ expectedData := []string{
+ filepath.Join(buildDir, ".intermediates/bar/android_arm64_armv8-a/:bar"),
+ // libbar has been relocated, and so has a variant that matches the host arch.
+ filepath.Join(buildDir, ".intermediates/foo/linux_glibc_x86_64/relocated/:lib64/libbar.so"),
+ }
+ actualData := entries.EntryMap["LOCAL_TEST_DATA"]
+ if !reflect.DeepEqual(expectedData, actualData) {
+ t.Errorf("Unexpected test data, expected: %q, actual: %q", expectedData, actualData)
+ }
+}
diff --git a/ui/build/rbe.go b/ui/build/rbe.go
index 99107e3..73438cc 100644
--- a/ui/build/rbe.go
+++ b/ui/build/rbe.go
@@ -53,11 +53,13 @@
func getRBEVars(ctx Context, config Config) map[string]string {
rand.Seed(time.Now().UnixNano())
vars := map[string]string{
- "RBE_server_address": fmt.Sprintf("unix://%v/reproxy_%v.sock", absPath(ctx, config.TempDir()), rand.Intn(1000)),
- "RBE_log_path": config.rbeLogPath(),
- "RBE_re_proxy": config.rbeReproxy(),
- "RBE_exec_root": config.rbeExecRoot(),
- "RBE_output_dir": config.rbeStatsOutputDir(),
+ "RBE_log_path": config.rbeLogPath(),
+ "RBE_re_proxy": config.rbeReproxy(),
+ "RBE_exec_root": config.rbeExecRoot(),
+ "RBE_output_dir": config.rbeStatsOutputDir(),
+ }
+ if config.StartRBE() {
+ vars["RBE_server_address"] = fmt.Sprintf("unix://%v/reproxy_%v.sock", absPath(ctx, config.TempDir()), rand.Intn(1000))
}
k, v := config.rbeAuth()
vars[k] = v