I am trying to create a Bazel project which includes cucumber-cpp. I could not figure out how its BUILD
file would look like.
As Google Test now includes it's own BUILD
file it is as easy as it get's. Something similar would be nice.
My WORKSPACE
file looks like this
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "googletest",
sha256 = "927827c183d01734cc5cfef85e0ff3f5a92ffe6188e0d18e909c5efebf28a0c7",
strip_prefix = "googletest-release-1.8.1",
url = "https://github.com/google/googletest/archive/release-1.8.1.zip",
)
http_archive(
name = "cucumber-cpp",
sha256 = "73fddda099e39cc51ebee99051047067f6dcd437fbde60601ac48cb82a903dac",
url = "https://github.com/cucumber/cucumber-cpp/archive/v0.5.zip",
)
My specification BUILD
file
cc_test(
name = "app-spec",
srcs = glob(["**/*.cpp"]),
deps = [
"//src:app-lib",
"@cucumber-cpp//:main", //do not know if this is correct
],
)
cc_test(
name = "app-spec",
srcs = glob(["**/*.cpp"]),
deps = [
"//src:app-lib",
"@cucumber-cpp//:main", //do not know if this is correct
],
)
Test BUILD
file
cc_test(
name = "app-test",
srcs = glob(["**/*.cpp"]),
deps = [
"//src:app-lib",
"@googletest//:gtest_main",
],
)
But obviously the cucumber-cpp
is not built so I wonder how it's Bazel BUILD file would look like?
I also wanted to do this, but couldn't find anything where anyone had attempted it. In the end I wrote a dedicated bazel extension for using cucumber and gherkin feature specs. Currently this only supports
(linux|osx)+cpp+cucumber
, but I may add support for windows and other languages further down the line. To use this add this to your WORKSPACE file;An example BUILD file would look like this;
A complete example can be found here.