mirror of https://github.com/bazelbuild/rules_cc
Test allowing diamond inheritance of shared lib
This commit is contained in:
parent
40548a2974
commit
8caeb338c9
|
@ -1,6 +1,6 @@
|
|||
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
|
||||
load("//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
||||
load("//examples:experimental_cc_shared_library.bzl", "LINKABLE_MORE_THAN_ONCE", "cc_shared_library")
|
||||
load("//examples:experimental_cc_shared_library.bzl", "LINKABLE_MORE_THAN_ONCE", "cc_shared_library", "cc_shared_library_permissions")
|
||||
load(":starlark_tests.bzl", "additional_inputs_test", "build_failure_test", "linking_suffix_test", "paths_test")
|
||||
|
||||
package(
|
||||
|
@ -202,3 +202,13 @@ bzl_library(
|
|||
srcs = ["starlark_tests.bzl"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
cc_shared_library_permissions(
|
||||
name = "permissions",
|
||||
targets = [
|
||||
"//examples/test_cc_shared_library:a_suffix",
|
||||
"//examples/test_cc_shared_library:qux",
|
||||
"//examples/test_cc_shared_library:qux2",
|
||||
],
|
||||
visibility = ["//examples/test_cc_shared_library/diamond_inheritance:__pkg__"],
|
||||
)
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
load("//cc:defs.bzl", "cc_binary")
|
||||
load("//examples:experimental_cc_shared_library.bzl", "cc_shared_library")
|
||||
|
||||
cc_shared_library(
|
||||
name = "baz_so",
|
||||
roots = ["//examples/test_cc_shared_library:a_suffix"],
|
||||
permissions = [
|
||||
"//examples/test_cc_shared_library:permissions",
|
||||
],
|
||||
)
|
||||
|
||||
cc_shared_library(
|
||||
name = "qux_so",
|
||||
dynamic_deps = [":baz_so"],
|
||||
roots = ["//examples/test_cc_shared_library:qux"],
|
||||
permissions = [
|
||||
"//examples/test_cc_shared_library:permissions",
|
||||
],
|
||||
)
|
||||
|
||||
cc_shared_library(
|
||||
name = "qux2_so",
|
||||
dynamic_deps = [":baz_so"],
|
||||
roots = ["//examples/test_cc_shared_library:qux2"],
|
||||
permissions = [
|
||||
"//examples/test_cc_shared_library:permissions",
|
||||
],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "diamond_inheritance",
|
||||
srcs = ["main.cc"],
|
||||
dynamic_deps = [
|
||||
":qux_so",
|
||||
":qux2_so",
|
||||
],
|
||||
deps = [
|
||||
"//examples/test_cc_shared_library:a_suffix"
|
||||
]
|
||||
)
|
|
@ -0,0 +1,8 @@
|
|||
#include <iostream>
|
||||
|
||||
#include "examples/test_cc_shared_library/a_suffix.h"
|
||||
|
||||
int main() {
|
||||
std::cout << "hello " << a_suffix() << std::endl;
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue