aboutsummaryrefslogtreecommitdiffstats
path: root/android/paths_test.go
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2019-03-05 12:46:40 -0800
committerColin Cross <ccross@android.com>2019-03-20 19:36:03 +0000
commit07e51619a2752d6a36bd149c8938b5d7cae5baa7 (patch)
treeed6ace110652ae92ac3047bf83a6947c3d58115d /android/paths_test.go
parent2fafa3ec49532d50aa4fabff891ee4aa213744fa (diff)
downloadbuild_soong-07e51619a2752d6a36bd149c8938b5d7cae5baa7.tar.gz
build_soong-07e51619a2752d6a36bd149c8938b5d7cae5baa7.tar.bz2
build_soong-07e51619a2752d6a36bd149c8938b5d7cae5baa7.zip
Remove ModuleSrcPath
ModuleSrcPath was designed as a type that ensured that modules only referenced sources inside the directory that contained the Android.bp file. In practice they don't work very well, because allowing filegroups and genrules as inputs to any module that takes a source path means that the path might end up being to a file in another source directory or to a generated file in the output directory. Remove ModuleSrcPath, replacing it with SourcePath in the places that need to explicitly refer to a path in the source tree, or Path where it may be a source path or a generated path. Make PathForModuleSrc return a Path instead of a SourcePath in preparation for consolidation with ctx.ExpandSources, which will make it possibly return paths to generated files. Test: All soong tests Change-Id: I973a78470ed14307eea5f6d0cc93942775a65715
Diffstat (limited to 'android/paths_test.go')
-rw-r--r--android/paths_test.go26
1 files changed, 19 insertions, 7 deletions
diff --git a/android/paths_test.go b/android/paths_test.go
index cadf371b..f5902b53 100644
--- a/android/paths_test.go
+++ b/android/paths_test.go
@@ -508,15 +508,27 @@ func TestPathForModuleInstall(t *testing.T) {
}
func TestDirectorySortedPaths(t *testing.T) {
+ config := TestConfig("out", nil)
+
+ ctx := PathContextForTesting(config, map[string][]byte{
+ "a.txt": nil,
+ "a/txt": nil,
+ "a/b/c": nil,
+ "a/b/d": nil,
+ "b": nil,
+ "b/b.txt": nil,
+ "a/a.txt": nil,
+ })
+
makePaths := func() Paths {
return Paths{
- PathForTesting("a.txt"),
- PathForTesting("a/txt"),
- PathForTesting("a/b/c"),
- PathForTesting("a/b/d"),
- PathForTesting("b"),
- PathForTesting("b/b.txt"),
- PathForTesting("a/a.txt"),
+ PathForSource(ctx, "a.txt"),
+ PathForSource(ctx, "a/txt"),
+ PathForSource(ctx, "a/b/c"),
+ PathForSource(ctx, "a/b/d"),
+ PathForSource(ctx, "b"),
+ PathForSource(ctx, "b/b.txt"),
+ PathForSource(ctx, "a/a.txt"),
}
}