Merge "Correct bp2build canonical_from_root logic" am: 5ee913f527
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1985613 Change-Id: I374352d470b8d0e351de3b47d5a48f87d4ac40ab
This commit is contained in:
commit
4902daf52f
5 changed files with 5 additions and 17 deletions
|
@ -187,7 +187,7 @@ func Bp2buildProtoProperties(ctx Bp2buildMutatorContext, module Module, srcs baz
|
||||||
if axis == bazel.NoConfigAxis {
|
if axis == bazel.NoConfigAxis {
|
||||||
info.Type = props.Proto.Type
|
info.Type = props.Proto.Type
|
||||||
|
|
||||||
if proptools.BoolDefault(props.Proto.Canonical_path_from_root, canonicalPathFromRootDefault) {
|
if !proptools.BoolDefault(props.Proto.Canonical_path_from_root, canonicalPathFromRootDefault) {
|
||||||
// an empty string indicates to strips the package path
|
// an empty string indicates to strips the package path
|
||||||
path := ""
|
path := ""
|
||||||
attrs.Strip_import_prefix = &path
|
attrs.Strip_import_prefix = &path
|
||||||
|
|
|
@ -459,7 +459,6 @@ func TestCcBinarySharedProto(t *testing.T) {
|
||||||
name: "foo",
|
name: "foo",
|
||||||
srcs: ["foo.proto"],
|
srcs: ["foo.proto"],
|
||||||
proto: {
|
proto: {
|
||||||
canonical_path_from_root: false,
|
|
||||||
},
|
},
|
||||||
include_build_directory: false,
|
include_build_directory: false,
|
||||||
}`,
|
}`,
|
||||||
|
@ -483,7 +482,6 @@ func TestCcBinaryStaticProto(t *testing.T) {
|
||||||
srcs: ["foo.proto"],
|
srcs: ["foo.proto"],
|
||||||
static_executable: true,
|
static_executable: true,
|
||||||
proto: {
|
proto: {
|
||||||
canonical_path_from_root: false,
|
|
||||||
},
|
},
|
||||||
include_build_directory: false,
|
include_build_directory: false,
|
||||||
}`,
|
}`,
|
||||||
|
|
|
@ -1999,7 +1999,6 @@ func TestCcLibraryProtoSimple(t *testing.T) {
|
||||||
expectedBazelTargets: []string{
|
expectedBazelTargets: []string{
|
||||||
makeBazelTarget("proto_library", "foo_proto", attrNameToString{
|
makeBazelTarget("proto_library", "foo_proto", attrNameToString{
|
||||||
"srcs": `["foo.proto"]`,
|
"srcs": `["foo.proto"]`,
|
||||||
"strip_import_prefix": `""`,
|
|
||||||
}), makeBazelTarget("cc_lite_proto_library", "foo_cc_proto_lite", attrNameToString{
|
}), makeBazelTarget("cc_lite_proto_library", "foo_cc_proto_lite", attrNameToString{
|
||||||
"deps": `[":foo_proto"]`,
|
"deps": `[":foo_proto"]`,
|
||||||
}), makeBazelTarget("cc_library_static", "foo_bp2build_cc_library_static", attrNameToString{
|
}), makeBazelTarget("cc_library_static", "foo_bp2build_cc_library_static", attrNameToString{
|
||||||
|
@ -2025,6 +2024,7 @@ func TestCcLibraryProtoNoCanonicalPathFromRoot(t *testing.T) {
|
||||||
expectedBazelTargets: []string{
|
expectedBazelTargets: []string{
|
||||||
makeBazelTarget("proto_library", "foo_proto", attrNameToString{
|
makeBazelTarget("proto_library", "foo_proto", attrNameToString{
|
||||||
"srcs": `["foo.proto"]`,
|
"srcs": `["foo.proto"]`,
|
||||||
|
"strip_import_prefix": `""`,
|
||||||
}), makeBazelTarget("cc_lite_proto_library", "foo_cc_proto_lite", attrNameToString{
|
}), makeBazelTarget("cc_lite_proto_library", "foo_cc_proto_lite", attrNameToString{
|
||||||
"deps": `[":foo_proto"]`,
|
"deps": `[":foo_proto"]`,
|
||||||
}), makeBazelTarget("cc_library_static", "foo_bp2build_cc_library_static", attrNameToString{
|
}), makeBazelTarget("cc_library_static", "foo_bp2build_cc_library_static", attrNameToString{
|
||||||
|
@ -2050,7 +2050,6 @@ func TestCcLibraryProtoExplicitCanonicalPathFromRoot(t *testing.T) {
|
||||||
expectedBazelTargets: []string{
|
expectedBazelTargets: []string{
|
||||||
makeBazelTarget("proto_library", "foo_proto", attrNameToString{
|
makeBazelTarget("proto_library", "foo_proto", attrNameToString{
|
||||||
"srcs": `["foo.proto"]`,
|
"srcs": `["foo.proto"]`,
|
||||||
"strip_import_prefix": `""`,
|
|
||||||
}), makeBazelTarget("cc_lite_proto_library", "foo_cc_proto_lite", attrNameToString{
|
}), makeBazelTarget("cc_lite_proto_library", "foo_cc_proto_lite", attrNameToString{
|
||||||
"deps": `[":foo_proto"]`,
|
"deps": `[":foo_proto"]`,
|
||||||
}), makeBazelTarget("cc_library_static", "foo_bp2build_cc_library_static", attrNameToString{
|
}), makeBazelTarget("cc_library_static", "foo_bp2build_cc_library_static", attrNameToString{
|
||||||
|
@ -2071,7 +2070,6 @@ func TestCcLibraryProtoFull(t *testing.T) {
|
||||||
name: "foo",
|
name: "foo",
|
||||||
srcs: ["foo.proto"],
|
srcs: ["foo.proto"],
|
||||||
proto: {
|
proto: {
|
||||||
canonical_path_from_root: false,
|
|
||||||
type: "full",
|
type: "full",
|
||||||
},
|
},
|
||||||
include_build_directory: false,
|
include_build_directory: false,
|
||||||
|
@ -2099,7 +2097,6 @@ func TestCcLibraryProtoLite(t *testing.T) {
|
||||||
name: "foo",
|
name: "foo",
|
||||||
srcs: ["foo.proto"],
|
srcs: ["foo.proto"],
|
||||||
proto: {
|
proto: {
|
||||||
canonical_path_from_root: false,
|
|
||||||
type: "lite",
|
type: "lite",
|
||||||
},
|
},
|
||||||
include_build_directory: false,
|
include_build_directory: false,
|
||||||
|
@ -2127,7 +2124,6 @@ func TestCcLibraryProtoExportHeaders(t *testing.T) {
|
||||||
name: "foo",
|
name: "foo",
|
||||||
srcs: ["foo.proto"],
|
srcs: ["foo.proto"],
|
||||||
proto: {
|
proto: {
|
||||||
canonical_path_from_root: false,
|
|
||||||
export_proto_headers: true,
|
export_proto_headers: true,
|
||||||
},
|
},
|
||||||
include_build_directory: false,
|
include_build_directory: false,
|
||||||
|
@ -2161,7 +2157,6 @@ cc_library {
|
||||||
name: "a",
|
name: "a",
|
||||||
srcs: [":a_fg_proto"],
|
srcs: [":a_fg_proto"],
|
||||||
proto: {
|
proto: {
|
||||||
canonical_path_from_root: false,
|
|
||||||
export_proto_headers: true,
|
export_proto_headers: true,
|
||||||
},
|
},
|
||||||
include_build_directory: false,
|
include_build_directory: false,
|
||||||
|
@ -2171,7 +2166,6 @@ cc_library {
|
||||||
name: "b",
|
name: "b",
|
||||||
srcs: [":b_protos"],
|
srcs: [":b_protos"],
|
||||||
proto: {
|
proto: {
|
||||||
canonical_path_from_root: false,
|
|
||||||
export_proto_headers: true,
|
export_proto_headers: true,
|
||||||
},
|
},
|
||||||
include_build_directory: false,
|
include_build_directory: false,
|
||||||
|
@ -2181,7 +2175,6 @@ cc_library {
|
||||||
name: "c",
|
name: "c",
|
||||||
srcs: [":c-proto-srcs"],
|
srcs: [":c-proto-srcs"],
|
||||||
proto: {
|
proto: {
|
||||||
canonical_path_from_root: false,
|
|
||||||
export_proto_headers: true,
|
export_proto_headers: true,
|
||||||
},
|
},
|
||||||
include_build_directory: false,
|
include_build_directory: false,
|
||||||
|
@ -2191,7 +2184,6 @@ cc_library {
|
||||||
name: "d",
|
name: "d",
|
||||||
srcs: [":proto-srcs-d"],
|
srcs: [":proto-srcs-d"],
|
||||||
proto: {
|
proto: {
|
||||||
canonical_path_from_root: false,
|
|
||||||
export_proto_headers: true,
|
export_proto_headers: true,
|
||||||
},
|
},
|
||||||
include_build_directory: false,
|
include_build_directory: false,
|
||||||
|
|
|
@ -431,7 +431,6 @@ func TestCcLibrarySharedProto(t *testing.T) {
|
||||||
name: "foo",
|
name: "foo",
|
||||||
srcs: ["foo.proto"],
|
srcs: ["foo.proto"],
|
||||||
proto: {
|
proto: {
|
||||||
canonical_path_from_root: false,
|
|
||||||
export_proto_headers: true,
|
export_proto_headers: true,
|
||||||
},
|
},
|
||||||
include_build_directory: false,
|
include_build_directory: false,
|
||||||
|
|
|
@ -1436,7 +1436,6 @@ func TestCcLibraryStaticProto(t *testing.T) {
|
||||||
name: "foo",
|
name: "foo",
|
||||||
srcs: ["foo.proto"],
|
srcs: ["foo.proto"],
|
||||||
proto: {
|
proto: {
|
||||||
canonical_path_from_root: false,
|
|
||||||
export_proto_headers: true,
|
export_proto_headers: true,
|
||||||
},
|
},
|
||||||
include_build_directory: false,
|
include_build_directory: false,
|
||||||
|
|
Loading…
Reference in a new issue