Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

7 changes: 0 additions & 7 deletions BUILD
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
load("@rules_gherkin//gherkin:defs.bzl", "gherkin_library")

package(default_visibility = ["//visibility:public"])

gherkin_library(
name = "openfeature_gherkin_spec_features",
srcs = glob(["spec/specification/assets/gherkin/evaluation.feature"]),
)
3 changes: 0 additions & 3 deletions Gemfile

This file was deleted.

56 changes: 0 additions & 56 deletions Gemfile.lock

This file was deleted.

55 changes: 31 additions & 24 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,41 @@ module(name = "openfeature_cpp_sdk")
bazel_dep(name = "googletest", version = "1.17.0.bcr.2")
bazel_dep(name = "abseil-cpp", version = "20250814.2")
bazel_dep(name = "rules_cc", version = "0.2.17")
bazel_dep(name = "cucumber-cpp", version = "0.8.0.bcr.1")

bazel_dep(name = "rules_gherkin", version = "0.2.0")
bazel_dep(name = "rules_ruby", version = "0.23.1")

# Hermetic Ruby Toolchain Configuration
ruby = use_extension("@rules_ruby//ruby:extensions.bzl", "ruby")
ruby.toolchain(
name = "ruby",
version = "3.2.2", # JRuby or standard MRI version suitable for execution
)

# Cucumber Gem provisioning via Bundler integration
ruby.bundle_fetch(
name = "cucumber",
gemfile = "//:Gemfile",
gemfile_lock = "//:Gemfile.lock",
)
use_repo(ruby, "cucumber", "ruby", "ruby_toolchains")
register_toolchains("@ruby_toolchains//:all")

# Hedron's Compile Commands Extractor for Bazel
# https://github.com/hedronvision/bazel-compile-commands-extractor
#Hedron's Compile Commands Extractor for Bazel
#https: // github.com/hedronvision/bazel-compile-commands-extractor
bazel_dep(name = "hedron_compile_commands", dev_dependency = True)
git_override(
module_name = "hedron_compile_commands",
remote = "https://github.com/hedronvision/bazel-compile-commands-extractor.git",
# Not official but well established fork with a fix to header only libraries
# https://github.com/hedronvision/bazel-compile-commands-extractor/pull/219
#Not official but well established fork with a fix to header only libraries
#https: // github.com/hedronvision/bazel-compile-commands-extractor/pull/219
commit = "02d15621b528efd877f5d5657c4b738523a0eb17",
)

git_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

#Fetch cwt - cucumber directly from GitHub
git_repository(
name = "cwt_cucumber",
build_file = "//test/e2e:cwt_cucumber.BUILD",
remote = "https://github.com/ThoSe1990/cwt-cucumber.git",
tag = "2.8",
)

#Fetch OpenFeature spec for Gherkin scenarios
git_repository(
name = "openfeature_spec",
remote = "https://github.com/open-feature/spec.git",
branch = "main",
build_file_content = """
package(default_visibility = ["//visibility:public"])

filegroup(
name = "gherkin_features",
#TODO : Once the SDK is finished, \
the source should be changed to "specification/assets/gherkin/*.feature"
srcs = glob(["specification/assets/gherkin/evaluation.feature"]),
)
""",
)
1 change: 0 additions & 1 deletion spec
Submodule spec deleted from eefdf4
12 changes: 7 additions & 5 deletions test/e2e/BUILD
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("@rules_gherkin//gherkin:defs.bzl", "gherkin_test")

package(
default_visibility = ["//visibility:public"],
)

exports_files(["cwt-cucumber.BUILD"])

cc_library(
name = "context_storing_provider",
srcs = [
Expand All @@ -22,7 +23,6 @@ cc_library(
"//openfeature:reason",
"//openfeature:value",
"//openfeature:resolution_details",
"@cucumber-cpp//:cucumber-cpp",
"@googletest//:gtest",
],
)
Expand Down Expand Up @@ -51,10 +51,12 @@ cc_library(
],
)

gherkin_test(
cc_test(
name = "openfeature_gherkin_e2e_tests",
steps = "//test/e2e/steps:gherkin_step_definitions",
data = ["@openfeature_spec//:gherkin_features"],
args =["$(locations @openfeature_spec//:gherkin_features)"],
deps = [
"//:openfeature_gherkin_spec_features",
"//test/e2e/steps:gherkin_step_definitions",
"@cwt_cucumber//:cwt-cucumber",
],
)
3 changes: 0 additions & 3 deletions test/e2e/context_storing_provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@

#include <gtest/gtest.h>

#include <cucumber-cpp/autodetect.hpp>
#include <optional>

#include "openfeature/flag_metadata.h"
#include "openfeature/reason.h"
#include "openfeature/value.h"

using cucumber::ScenarioScope;

namespace openfeature_e2e {

openfeature::Metadata ContextStoringProvider::GetMetadata() const {
Expand Down
31 changes: 31 additions & 0 deletions test/e2e/cwt_cucumber.BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
load("@rules_cc//cc:defs.bzl", "cc_library")

# Generate the version file from the template by extracting the version from CMakeLists.txt
genrule(
name = "generate_version_file",
srcs = [
"CMakeLists.txt",
"src/version.template",
],
outs = ["src/version.hpp"],
cmd = """
VERSION=$$(grep 'project(cwt-cucumber VERSION' $(location CMakeLists.txt) | sed 's/.*VERSION \\([0-9.]*\\).*/\\1/');
sed "s/@PROJECT_VERSION@/$$VERSION/g" $(location src/version.template) > $@
""",
)

cc_library(
name = "cwt-cucumber",
srcs = glob(
["src/**/*.cpp"],
exclude = ["src/main.cpp"],
),
hdrs = glob([
"src/**/*.hpp",
]) + [
"src/version.hpp",
],
copts = ["-std=c++20"],
strip_include_prefix = "src",
visibility = ["//visibility:public"],
)
7 changes: 4 additions & 3 deletions test/e2e/steps/BUILD
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
load("@rules_gherkin//gherkin:defs.bzl", "cc_gherkin_steps")
load("@rules_cc//cc:defs.bzl", "cc_library")

package(default_visibility = ["//visibility:public"])

cc_gherkin_steps(
cc_library(
name = "gherkin_step_definitions",
srcs = ["minimal_steps.cpp"],
copts = ["-std=c++20"],
deps = [
"//openfeature:evaluation_context",
"//openfeature:openfeature_api",
Expand All @@ -13,7 +14,7 @@ cc_gherkin_steps(
"//test/e2e:context_storing_provider",
"//test/e2e:state",
"//test:mock_feature_provider",
"@cucumber-cpp//:cucumber-cpp",
"@cwt_cucumber//:cwt-cucumber",
"@googletest//:gtest",
],
visibility = ["//test/e2e:__subpackages__"],
Expand Down
Loading