mirror of https://github.com/bazelbuild/rules_cc
Merge pull request #97 from jlaxson:shared-library-double-inheritance-test
PiperOrigin-RevId: 359022952 Change-Id: Iad8c35e8c9b1a187548cf45b3c2c1f231f275bad
This commit is contained in:
commit
a3d7068939
|
@ -48,9 +48,10 @@ tasks:
|
|||
<<: *common
|
||||
examples:
|
||||
platform: ubuntu1804
|
||||
bazel: last_downstream_green
|
||||
bazel: last_green
|
||||
build_targets:
|
||||
- "//examples/test_cc_shared_library/..."
|
||||
- "//examples/test_cc_shared_library/diamond_inheritance/..."
|
||||
build_flags:
|
||||
- "--experimental_cc_shared_library"
|
||||
- "--//examples:incompatible_link_once=True"
|
||||
|
@ -60,3 +61,4 @@ tasks:
|
|||
- "--//examples:incompatible_link_once=True"
|
||||
test_targets:
|
||||
- "//examples/test_cc_shared_library/..."
|
||||
- "//examples/test_cc_shared_library/diamond_inheritance/..."
|
||||
|
|
|
@ -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",
|
||||
permissions = [
|
||||
"//examples/test_cc_shared_library:permissions",
|
||||
],
|
||||
roots = ["//examples/test_cc_shared_library:a_suffix"],
|
||||
)
|
||||
|
||||
cc_shared_library(
|
||||
name = "qux_so",
|
||||
dynamic_deps = [":baz_so"],
|
||||
permissions = [
|
||||
"//examples/test_cc_shared_library:permissions",
|
||||
],
|
||||
roots = ["//examples/test_cc_shared_library:qux"],
|
||||
)
|
||||
|
||||
cc_shared_library(
|
||||
name = "qux2_so",
|
||||
dynamic_deps = [":baz_so"],
|
||||
permissions = [
|
||||
"//examples/test_cc_shared_library:permissions",
|
||||
],
|
||||
roots = ["//examples/test_cc_shared_library:qux2"],
|
||||
)
|
||||
|
||||
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