Merge "Correct genrule path references"
This commit is contained in:
@@ -852,9 +852,6 @@ var (
|
|||||||
"host_bionic_linker_asm", // depends on extract_linker, a go binary.
|
"host_bionic_linker_asm", // depends on extract_linker, a go binary.
|
||||||
"host_bionic_linker_script", // depends on extract_linker, a go binary.
|
"host_bionic_linker_script", // depends on extract_linker, a go binary.
|
||||||
|
|
||||||
// in cmd attribute of genrule rule //system/timezone/output_data:robolectric_tzdata: label '//system/timezone/output_data:iana/tzdata' in $(location) expression is not a declared prerequisite of this rule
|
|
||||||
"robolectric_tzdata",
|
|
||||||
|
|
||||||
// rust support
|
// rust support
|
||||||
"libtombstoned_client_rust_bridge_code", "libtombstoned_client_wrapper", // rust conversions are not supported
|
"libtombstoned_client_rust_bridge_code", "libtombstoned_client_wrapper", // rust conversions are not supported
|
||||||
|
|
||||||
|
@@ -242,6 +242,11 @@ func transformSubpackagePath(ctx BazelConversionPathContext, path bazel.Label) b
|
|||||||
|
|
||||||
// Don't transform OriginalModuleName
|
// Don't transform OriginalModuleName
|
||||||
newPath.OriginalModuleName = path.OriginalModuleName
|
newPath.OriginalModuleName = path.OriginalModuleName
|
||||||
|
// if it wasn't a module, store the original path. We may need the original path to replace
|
||||||
|
// references if it is actually in another package
|
||||||
|
if path.OriginalModuleName == "" {
|
||||||
|
newPath.OriginalModuleName = path.Label
|
||||||
|
}
|
||||||
|
|
||||||
if strings.HasPrefix(path.Label, "//") {
|
if strings.HasPrefix(path.Label, "//") {
|
||||||
// Assume absolute labels are already correct (e.g. //path/to/some/package:foo.h)
|
// Assume absolute labels are already correct (e.g. //path/to/some/package:foo.h)
|
||||||
|
@@ -49,6 +49,7 @@ func otherGenruleBp(genruleTarget string) map[string]string {
|
|||||||
srcs: ["other_tool.in"],
|
srcs: ["other_tool.in"],
|
||||||
cmd: "cp $(in) $(out)",
|
cmd: "cp $(in) $(out)",
|
||||||
}`, genruleTarget, genruleTarget),
|
}`, genruleTarget, genruleTarget),
|
||||||
|
"other/file.txt": "",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -293,17 +294,20 @@ func TestGenruleSrcsLocationsAbsoluteLabel(t *testing.T) {
|
|||||||
bp := `%s {
|
bp := `%s {
|
||||||
name: "foo",
|
name: "foo",
|
||||||
out: ["foo.out"],
|
out: ["foo.out"],
|
||||||
srcs: [":other.tool"],
|
srcs: [":other.tool", "other/file.txt",],
|
||||||
tool_files: [":foo.tool"],
|
tool_files: [":foo.tool"],
|
||||||
cmd: "$(locations :foo.tool) -s $(out) $(location :other.tool)",
|
cmd: "$(locations :foo.tool) $(location other/file.txt) -s $(out) $(location :other.tool)",
|
||||||
bazel_module: { bp2build_available: true },
|
bazel_module: { bp2build_available: true },
|
||||||
}`
|
}`
|
||||||
|
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
moduleAttrs := AttrNameToString{
|
moduleAttrs := AttrNameToString{
|
||||||
"cmd": `"$(locations //other:foo.tool) -s $(OUTS) $(location //other:other.tool)"`,
|
"cmd": `"$(locations //other:foo.tool) $(location //other:file.txt) -s $(OUTS) $(location //other:other.tool)"`,
|
||||||
"outs": `["foo.out"]`,
|
"outs": `["foo.out"]`,
|
||||||
"srcs": `["//other:other.tool"]`,
|
"srcs": `[
|
||||||
|
"//other:other.tool",
|
||||||
|
"//other:file.txt",
|
||||||
|
]`,
|
||||||
"tools": `["//other:foo.tool"]`,
|
"tools": `["//other:foo.tool"]`,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user