diff options
author | Kristina Chodorow <kchodorow@google.com> | 2015-11-11 17:24:14 +0000 |
---|---|---|
committer | Laszlo Csomor <laszlocsomor@google.com> | 2015-11-12 09:00:15 +0000 |
commit | d4c953f1a987ecde294a586c5c09955d87473100 (patch) | |
tree | 1c0ed4a5fd30c5e43f41c93412a2d96d8582385d /src/test/shell | |
parent | 3c0af3d90df4e8c3dc1ae8ac2189adb4a019a129 (diff) |
C++ libraries in remote repos don't need to set include paths
Fixes #445, based on https://github.com/bazelbuild/bazel/compare/master...ulfjack:cpp-include-path.
RELNOTES: C++ libraries no longer need includes = ["."] (or similar copts) to include paths relative to a remote repository's root.
--
MOS_MIGRATED_REVID=107593486
Diffstat (limited to 'src/test/shell')
-rwxr-xr-x | src/test/shell/bazel/local_repository_test.sh | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/test/shell/bazel/local_repository_test.sh b/src/test/shell/bazel/local_repository_test.sh index c0c8cb5de0..8506569d34 100755 --- a/src/test/shell/bazel/local_repository_test.sh +++ b/src/test/shell/bazel/local_repository_test.sh @@ -924,4 +924,51 @@ EOF expect_log "workspace names may contain only A-Z, a-z, 0-9, '-', '_' and '.'" } +function test_remote_includes() { + local remote=$TEST_TMPDIR/r + rm -fr $remote + mkdir -p $remote/inc + + touch $remote/WORKSPACE + cat > $remote/BUILD <<EOF +cc_library( + name = "bar", + srcs = ["bar.cc"], + hdrs = ["inc/bar.h"], + visibility = ["//visibility:public"], +) +EOF + cat > $remote/bar.cc <<EOF +#include "inc/bar.h" +int getNum() { + return 42; +} +EOF + cat > $remote/inc/bar.h <<EOF +int getNum(); +EOF + + cat > WORKSPACE <<EOF +local_repository( + name = "r", + path = "$remote", +) +EOF +cat > BUILD <<EOF +cc_binary( + name = "foo", + srcs = ["foo.cc"], + deps = ["@r//:bar"], +) +EOF + cat > foo.cc <<EOF +#include <stdio.h> +#include "inc/bar.h" +int main() { printf("%d\n", getNum()); return 0; }; +EOF + + bazel run :foo &> $TEST_log || fail "build failed" + expect_log "42" +} + run_suite "local repository tests" |