Merge "Make genrule export_include_dirs more consistent" into main am: d07cb48c6f
am: 2d94b9bf0a
am: 008f72c012
am: f9499f3a47
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2657600 Change-Id: I1ec820e4d976fca1ee8d20aaa665349b3a44903a Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
db709e8119
2 changed files with 46 additions and 0 deletions
|
@ -296,6 +296,9 @@ func (g *Module) generateCommonBuildActions(ctx android.ModuleContext) {
|
||||||
for _, dir := range g.properties.Export_include_dirs {
|
for _, dir := range g.properties.Export_include_dirs {
|
||||||
g.exportedIncludeDirs = append(g.exportedIncludeDirs,
|
g.exportedIncludeDirs = append(g.exportedIncludeDirs,
|
||||||
android.PathForModuleGen(ctx, g.subDir, ctx.ModuleDir(), dir))
|
android.PathForModuleGen(ctx, g.subDir, ctx.ModuleDir(), dir))
|
||||||
|
// Also export without ModuleDir for consistency with Export_include_dirs not being set
|
||||||
|
g.exportedIncludeDirs = append(g.exportedIncludeDirs,
|
||||||
|
android.PathForModuleGen(ctx, g.subDir, dir))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
g.exportedIncludeDirs = append(g.exportedIncludeDirs, android.PathForModuleGen(ctx, g.subDir))
|
g.exportedIncludeDirs = append(g.exportedIncludeDirs, android.PathForModuleGen(ctx, g.subDir))
|
||||||
|
|
|
@ -845,6 +845,49 @@ func TestGenruleOutputFiles(t *testing.T) {
|
||||||
result.ModuleForTests("gen_all", "").Module().(*useSource).srcs)
|
result.ModuleForTests("gen_all", "").Module().(*useSource).srcs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestGenruleInterface(t *testing.T) {
|
||||||
|
result := android.GroupFixturePreparers(
|
||||||
|
prepareForGenRuleTest,
|
||||||
|
android.FixtureMergeMockFs(android.MockFS{
|
||||||
|
"package-dir/Android.bp": []byte(`
|
||||||
|
genrule {
|
||||||
|
name: "module-name",
|
||||||
|
cmd: "mkdir -p $(genDir) && cat $(in) >> $(genDir)/$(out)",
|
||||||
|
srcs: [
|
||||||
|
"src/foo.proto",
|
||||||
|
],
|
||||||
|
out: ["proto.h", "bar/proto.h"],
|
||||||
|
export_include_dirs: [".", "bar"],
|
||||||
|
}
|
||||||
|
`),
|
||||||
|
}),
|
||||||
|
).RunTest(t)
|
||||||
|
|
||||||
|
exportedIncludeDirs := []string{
|
||||||
|
"out/soong/.intermediates/package-dir/module-name/gen/package-dir",
|
||||||
|
"out/soong/.intermediates/package-dir/module-name/gen",
|
||||||
|
"out/soong/.intermediates/package-dir/module-name/gen/package-dir/bar",
|
||||||
|
"out/soong/.intermediates/package-dir/module-name/gen/bar",
|
||||||
|
}
|
||||||
|
gen := result.Module("module-name", "").(*Module)
|
||||||
|
|
||||||
|
android.AssertPathsRelativeToTopEquals(
|
||||||
|
t,
|
||||||
|
"include path",
|
||||||
|
exportedIncludeDirs,
|
||||||
|
gen.GeneratedHeaderDirs(),
|
||||||
|
)
|
||||||
|
android.AssertPathsRelativeToTopEquals(
|
||||||
|
t,
|
||||||
|
"files",
|
||||||
|
[]string{
|
||||||
|
"out/soong/.intermediates/package-dir/module-name/gen/proto.h",
|
||||||
|
"out/soong/.intermediates/package-dir/module-name/gen/bar/proto.h",
|
||||||
|
},
|
||||||
|
gen.GeneratedSourceFiles(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
func TestGenSrcsWithNonRootAndroidBpOutputFiles(t *testing.T) {
|
func TestGenSrcsWithNonRootAndroidBpOutputFiles(t *testing.T) {
|
||||||
result := android.GroupFixturePreparers(
|
result := android.GroupFixturePreparers(
|
||||||
prepareForGenRuleTest,
|
prepareForGenRuleTest,
|
||||||
|
|
Loading…
Reference in a new issue