Skip to content

Commit dc2e4a8

Browse files
committed
Add Bazel configuration for C++17 and optimization; refactor JSONScalar implementation; update service configuration for replicas
1 parent 550d5ec commit dc2e4a8

File tree

10 files changed

+639
-540
lines changed

10 files changed

+639
-540
lines changed

ecosystem/graphql/.bazelrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
build --cxxopt='-std=c++17' --copt=-O3 --jobs=8
2+
build:profile --cxxopt='-std=c++17' --copt="-g" --copt="-fno-omit-frame-pointer" --cxxopt="-fno-omit-frame-pointer" --linkopt="-g" --strip=never --jobs=2
3+
4+
#build --action_env=PYTHON_BIN_PATH="/usr/bin/python3.10"
5+
#build --action_env=PYTHON_LIB_PATH="/usr/include/python3.10"

ecosystem/graphql/WORKSPACE

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,21 @@
1919

2020
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
2121

22+
http_archive(
23+
name = "hedron_compile_commands",
24+
#Replace the commit hash (4f28899228fb3ad0126897876f147ca15026151e) with the latest commit hash from the repo
25+
url = "https://github.com/hedronvision/bazel-compile-commands-extractor/archive/4f28899228fb3ad0126897876f147ca15026151e.tar.gz",
26+
strip_prefix = "bazel-compile-commands-extractor-4f28899228fb3ad0126897876f147ca15026151e",
27+
)
28+
load("@hedron_compile_commands//:workspace_setup.bzl", "hedron_compile_commands_setup")
29+
hedron_compile_commands_setup()
30+
load("@hedron_compile_commands//:workspace_setup_transitive.bzl", "hedron_compile_commands_setup_transitive")
31+
hedron_compile_commands_setup_transitive()
32+
load("@hedron_compile_commands//:workspace_setup_transitive_transitive.bzl", "hedron_compile_commands_setup_transitive_transitive")
33+
hedron_compile_commands_setup_transitive_transitive()
34+
load("@hedron_compile_commands//:workspace_setup_transitive_transitive_transitive.bzl", "hedron_compile_commands_setup_transitive_transitive_transitive")
35+
hedron_compile_commands_setup_transitive_transitive_transitive()
36+
2237
http_archive(
2338
name = "rules_foreign_cc",
2439
sha256 = "69023642d5781c68911beda769f91fcbc8ca48711db935a75da7f6536b65047f",
@@ -238,6 +253,19 @@ http_archive(
238253
],
239254
)
240255

256+
http_archive(
257+
name = "nlohmann_json",
258+
build_file = "//third_party:json.BUILD",
259+
sha256 = "95651d7d1fcf2e5c3163c3d37df6d6b3e9e5027299e6bd050d157322ceda9ac9",
260+
strip_prefix = "json-3.11.2",
261+
url = "https://github.com/nlohmann/json/archive/refs/tags/v3.11.2.zip",
262+
)
263+
264+
bind(
265+
name = "json",
266+
actual = "@nlohmann_json//:json",
267+
)
268+
241269
load("@com_resdb_nexres//:repositories.bzl", "nexres_repositories")
242270

243271
nexres_repositories()

ecosystem/graphql/app.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,12 @@
4040

4141
from strawberry.flask.views import GraphQLView
4242

43-
@strawberry.scalar(description="Custom JSON scalar")
44-
class JSONScalar:
45-
@staticmethod
46-
def serialize(value: Any) -> Any:
47-
return value # Directly return the JSON object
48-
49-
@staticmethod
50-
def parse_value(value: Any) -> Any:
51-
return value # Accept JSON as is
43+
JSONScalar = strawberry.scalar(
44+
typing.NewType("JSONScalar", typing.Any),
45+
serialize=lambda v: v,
46+
parse_value=lambda v: v,
47+
description="Custom JSON scalar"
48+
)
5249

5350
@strawberry.type
5451
class RetrieveTransaction:

0 commit comments

Comments
 (0)