Skip to content
Merged
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: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@
/.build

/tools/astyle/venv/

# Bazel-related
MODULE.bazel.lock
27 changes: 27 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@rules_license//rules:license.bzl", "license")

package(
default_applicable_licenses = [":license"],
)

exports_files([
"LICENSE.MIT",
])

license(
name = "license",
license_kinds = ["@rules_license//licenses/spdx:MIT"],
license_text = "LICENSE.MIT",
)

cc_library(
name = "json",
hdrs = [
Expand Down Expand Up @@ -40,6 +57,7 @@ cc_library(
"include/nlohmann/detail/output/serializer.hpp",
"include/nlohmann/detail/string_concat.hpp",
"include/nlohmann/detail/string_escape.hpp",
"include/nlohmann/detail/string_utils.hpp",
"include/nlohmann/detail/value_t.hpp",
"include/nlohmann/json.hpp",
"include/nlohmann/json_fwd.hpp",
Expand All @@ -50,3 +68,12 @@ cc_library(
includes = ["include"],
visibility = ["//visibility:public"],
)

cc_library(
name = "singleheader-json",
hdrs = [
"single_include/nlohmann/json.hpp",
],
includes = ["single_include"],
visibility = ["//visibility:public"],
)
7 changes: 7 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module(
name = "nlohmann_json",
compatibility_level = 1,
)

bazel_dep(name = "rules_cc", version = "0.0.17")
bazel_dep(name = "rules_license", version = "1.0.0")
1 change: 0 additions & 1 deletion WORKSPACE.bazel

This file was deleted.

1 change: 1 addition & 0 deletions docs/mkdocs/docs/integration/bazel/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bazel_dep(name = "nlohmann_json", version = "3.11.3.bcr.1")
7 changes: 0 additions & 7 deletions docs/mkdocs/docs/integration/bazel/WORKSPACE

This file was deleted.

12 changes: 5 additions & 7 deletions docs/mkdocs/docs/integration/package_managers.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,16 +137,14 @@ using the subproject directly.

!!! abstract "Summary"

use `http_archive`, `git_repository`, or `local_repository`
use `bazel_dep`, `git_override`, or `local_path_override`

- :octicons-tag-24: Any version, as version is specified in `WORKSPACE` file
- :octicons-tag-24: Any version, that is available via [Bazel Central Registry](https://registry.bazel.build/modules/nlohmann_json)
- :octicons-file-24: File issues at the [library issue tracker](https://github.com/nlohmann/json/issues)
- :octicons-question-24: [Bazel website](https://bazel.build)

This repository provides a [Bazel](https://bazel.build/) `WORKSPACE.bazel` and a corresponding `BUILD.bazel` file. Therefore, this
repository can be referenced by workspace rules such as `http_archive`, `git_repository`, or `local_repository` from
other Bazel workspaces. To use the library you only need to depend on the target `@nlohmann_json//:json` (e.g., via
`deps` attribute).
This repository provides a [Bazel](https://bazel.build/) `MODULE.bazel` and a corresponding `BUILD.bazel` file. Therefore, this
repository can be referenced within a `MODULE.bazel` by rules such as `archive_override`, `git_override`, or `local_path_override`. To use the library you need to depend on the target `@nlohmann_json//:json` (i.e., via `deps` attribute).

??? example

Expand All @@ -157,7 +155,7 @@ other Bazel workspaces. To use the library you only need to depend on the target
```

```ini title="WORKSPACE"
--8<-- "integration/bazel/WORKSPACE"
--8<-- "integration/bazel/MODULE.bazel"
```

```cpp title="example.cpp"
Expand Down
Loading