diff --git a/tests/BUCK b/tests/BUCK index 47fc557c..f0665421 100644 --- a/tests/BUCK +++ b/tests/BUCK @@ -26,10 +26,9 @@ cxx_library( ":bridge/source", ":module/source", ], - header_namespace = "cxx-test-suite", headers = { - "lib.rs.h": ":bridge/header", - "tests.h": "ffi/tests.h", + "ffi/lib.rs.h": ":bridge/header", + "ffi/tests.h": "ffi/tests.h", }, deps = ["//:core"], ) diff --git a/tests/BUILD b/tests/BUILD index 68e7be3c..1345a7a3 100644 --- a/tests/BUILD +++ b/tests/BUILD @@ -29,8 +29,6 @@ cc_library( ":module/source", ], hdrs = ["ffi/tests.h"], - include_prefix = "cxx-test-suite", - strip_include_prefix = "ffi", deps = [ ":bridge/include", "//:core", @@ -40,15 +38,11 @@ cc_library( rust_cxx_bridge( name = "bridge", src = "ffi/lib.rs", - include_prefix = "cxx-test-suite", - strip_include_prefix = "ffi", deps = [":impl"], ) rust_cxx_bridge( name = "module", src = "ffi/module.rs", - include_prefix = "cxx-test-suite", - strip_include_prefix = "ffi", deps = [":impl"], ) diff --git a/tests/ffi/build.rs b/tests/ffi/build.rs index 8042129f..e5839448 100644 --- a/tests/ffi/build.rs +++ b/tests/ffi/build.rs @@ -1,8 +1,11 @@ +use cxx_build::CFG; + fn main() { if cfg!(trybuild) { return; } + CFG.include_prefix = "tests/ffi"; let sources = vec!["lib.rs", "module.rs"]; cxx_build::bridges(sources) .file("tests.cc") diff --git a/tests/ffi/lib.rs b/tests/ffi/lib.rs index 9ace1f25..cc07752e 100644 --- a/tests/ffi/lib.rs +++ b/tests/ffi/lib.rs @@ -23,7 +23,7 @@ pub mod ffi { } extern "C" { - include!("cxx-test-suite/tests.h"); + include!("tests/ffi/tests.h"); type C; diff --git a/tests/ffi/module.rs b/tests/ffi/module.rs index 8862dc16..77bae066 100644 --- a/tests/ffi/module.rs +++ b/tests/ffi/module.rs @@ -4,7 +4,7 @@ #[cxx::bridge(namespace = tests)] pub mod ffi { extern "C" { - include!("cxx-test-suite/tests.h"); + include!("tests/ffi/tests.h"); type C = crate::ffi::C; diff --git a/tests/ffi/tests.cc b/tests/ffi/tests.cc index 1f88d8b6..9cb6ed0e 100644 --- a/tests/ffi/tests.cc +++ b/tests/ffi/tests.cc @@ -1,5 +1,5 @@ -#include "cxx-test-suite/tests.h" -#include "cxx-test-suite/lib.rs.h" +#include "tests/ffi/tests.h" +#include "tests/ffi/lib.rs.h" #include #include #include diff --git a/tools/bazel/rust_cxx_bridge.bzl b/tools/bazel/rust_cxx_bridge.bzl index d4111c68..534f6b5a 100644 --- a/tools/bazel/rust_cxx_bridge.bzl +++ b/tools/bazel/rust_cxx_bridge.bzl @@ -1,12 +1,7 @@ load("@bazel_skylib//rules:run_binary.bzl", "run_binary") load("@rules_cc//cc:defs.bzl", "cc_library") -def rust_cxx_bridge( - name, - src, - include_prefix = None, - strip_include_prefix = None, - deps = []): +def rust_cxx_bridge(name, src, deps = []): native.alias( name = "%s/header" % name, actual = src + ".h", @@ -43,6 +38,4 @@ def rust_cxx_bridge( cc_library( name = "%s/include" % name, hdrs = [src + ".h"], - include_prefix = include_prefix, - strip_include_prefix = strip_include_prefix, )