Skip to content

Commit 50929ef

Browse files
authored
Merge pull request #20872 from github/redsun82/update-fmt
Swift: update `fmt`
2 parents 1d56f17 + 794b328 commit 50929ef

File tree

9 files changed

+112
-28
lines changed

9 files changed

+112
-28
lines changed

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ bazel_dep(name = "rules_shell", version = "0.5.0")
2323
bazel_dep(name = "bazel_skylib", version = "1.8.1")
2424
bazel_dep(name = "abseil-cpp", version = "20240116.1", repo_name = "absl")
2525
bazel_dep(name = "nlohmann_json", version = "3.11.3", repo_name = "json")
26-
bazel_dep(name = "fmt", version = "10.0.0")
26+
bazel_dep(name = "fmt", version = "12.1.0-codeql.1")
2727
bazel_dep(name = "rules_kotlin", version = "2.1.3-codeql.1")
2828
bazel_dep(name = "gazelle", version = "0.40.0")
2929
bazel_dep(name = "rules_dotnet", version = "0.19.2-codeql.1")

misc/bazel/registry/fix.py

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ def patch_json(file, **kwargs):
3535
def update(data):
3636
data = json.loads(data) if data else {}
3737
data.update(kwargs)
38+
for k, v in kwargs.items():
39+
if v is None:
40+
data.pop(k)
3841
return json.dumps(data, indent=4) + "\n"
3942

4043
patch_file(file, update)
@@ -48,8 +51,21 @@ def update(data):
4851
patch_json(entry / "metadata.json", versions=[v.name for v in versions])
4952

5053
for version in versions:
51-
patch_json(version / "source.json", patches={
52-
p.name: sha256(p) for p in version.joinpath("patches").iterdir()
53-
})
54-
patch_file(version / "MODULE.bazel",
55-
lambda s: re.sub(r'''version\s*=\s*['"].*['"]''', f'version = "{version.name}"', s, 1))
54+
patches = version.joinpath("patches")
55+
overlay = version.joinpath("overlay")
56+
modules = [version / "MODULE.bazel", overlay / "MODULE.bazel"]
57+
for module in modules:
58+
if module.is_file():
59+
patch_file(
60+
module,
61+
lambda s: re.sub(r'''version\s*=\s*['"].*['"]''', f'version = "{version.name}"', s, 1))
62+
patch_json(
63+
version / "source.json",
64+
patches={
65+
p.name: sha256(p) for p in patches.iterdir()
66+
} if patches.is_dir() else None,
67+
patch_strip=1 if patches.is_dir() else None,
68+
overlay={
69+
o.name: sha256(o) for o in overlay.iterdir()
70+
} if overlay.is_dir() else None,
71+
)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module(
2+
name = "fmt",
3+
version = "12.1.0-codeql.1",
4+
bazel_compatibility = [">=7.2.1"],
5+
compatibility_level = 10,
6+
)
7+
8+
bazel_dep(name = "rules_cc", version = "0.2.13")
9+
bazel_dep(name = "rules_license", version = "1.0.0")
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
load("@rules_cc//cc:cc_library.bzl", "cc_library")
2+
load("@rules_license//rules:license.bzl", "license")
3+
4+
package(
5+
default_applicable_licenses = [":license"],
6+
)
7+
8+
exports_files([
9+
"LICENSE",
10+
])
11+
12+
license(
13+
name = "license",
14+
license_kinds = ["@rules_license//licenses/spdx:MIT"],
15+
license_text = "LICENSE",
16+
)
17+
18+
cc_library(
19+
name = "fmt",
20+
srcs = [
21+
#"src/fmt.cc", # No C++ module support, yet in Bazel (https://github.com/bazelbuild/bazel/pull/19940)
22+
"src/format.cc",
23+
"src/os.cc",
24+
],
25+
hdrs = glob([
26+
"include/fmt/*.h",
27+
]),
28+
# codeql change: disable UTF8 support, it's causing issues on Windows
29+
# copts = select({
30+
# "@rules_cc//cc/compiler:msvc-cl": ["/utf-8"],
31+
# "//conditions:default": [],
32+
# }),
33+
defines = select({
34+
"@rules_cc//cc/compiler:msvc-cl": ["FMT_UNICODE=0"],
35+
"//conditions:default": [],
36+
}),
37+
includes = ["include"],
38+
strip_include_prefix = "include", # workaround: only needed on some macOS systems (see https://github.com/bazelbuild/bazel-central-registry/issues/1537)
39+
visibility = ["//visibility:public"],
40+
)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module(
2+
name = "fmt",
3+
version = "12.1.0-codeql.1",
4+
bazel_compatibility = [">=7.2.1"],
5+
compatibility_level = 10,
6+
)
7+
8+
bazel_dep(name = "rules_cc", version = "0.2.13")
9+
bazel_dep(name = "rules_license", version = "1.0.0")
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"url": "https://github.com/fmtlib/fmt/releases/download/12.1.0/fmt-12.1.0.zip",
3+
"integrity": "sha256-aV/Rl/pa/4/Ge18rvBEEkKh1zfekFoashRL7SA+orac=",
4+
"strip_prefix": "fmt-12.1.0",
5+
"overlay": {
6+
"BUILD.bazel": "sha256-T6CBBdPY92Iloq9NrMjm9kQeQA3nTZJeym6xG5cclOQ=",
7+
"MODULE.bazel": "sha256-Dgke/2OMsffv9jPSDxIwIgJIb4L77VW6lR8TsNHsekg="
8+
}
9+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"homepage": "https://github.com/fmtlib/fmt",
3+
"maintainers": [
4+
{
5+
"email": "[email protected]",
6+
"github": "Vertexwahn",
7+
"github_user_id": 3775001,
8+
"name": "Julian Amann"
9+
},
10+
{
11+
"github": "mering",
12+
"github_user_id": 133344217
13+
}
14+
],
15+
"repository": [
16+
"github:fmtlib/fmt"
17+
],
18+
"versions": [
19+
"12.1.0-codeql.1"
20+
],
21+
"yanked_versions": {}
22+
}

swift/logging/Formatters.h

Lines changed: 0 additions & 20 deletions
This file was deleted.

swift/logging/SwiftLogging.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88

99
#include <fmt/format.h>
1010
#include <fmt/chrono.h>
11-
12-
#include "swift/logging/Formatters.h"
11+
#include <fmt/std.h>
1312

1413
#include <binlog/binlog.hpp>
1514
#include <binlog/TextOutputStream.hpp>

0 commit comments

Comments
 (0)