mirror of
https://github.com/github/codeql.git
synced 2026-04-27 09:45:15 +02:00
Merge pull request #20872 from github/redsun82/update-fmt
Swift: update `fmt`
This commit is contained in:
@@ -23,7 +23,7 @@ bazel_dep(name = "rules_shell", version = "0.5.0")
|
||||
bazel_dep(name = "bazel_skylib", version = "1.8.1")
|
||||
bazel_dep(name = "abseil-cpp", version = "20240116.1", repo_name = "absl")
|
||||
bazel_dep(name = "nlohmann_json", version = "3.11.3", repo_name = "json")
|
||||
bazel_dep(name = "fmt", version = "10.0.0")
|
||||
bazel_dep(name = "fmt", version = "12.1.0-codeql.1")
|
||||
bazel_dep(name = "rules_kotlin", version = "2.1.3-codeql.1")
|
||||
bazel_dep(name = "gazelle", version = "0.40.0")
|
||||
bazel_dep(name = "rules_dotnet", version = "0.19.2-codeql.1")
|
||||
|
||||
@@ -35,6 +35,9 @@ def patch_json(file, **kwargs):
|
||||
def update(data):
|
||||
data = json.loads(data) if data else {}
|
||||
data.update(kwargs)
|
||||
for k, v in kwargs.items():
|
||||
if v is None:
|
||||
data.pop(k)
|
||||
return json.dumps(data, indent=4) + "\n"
|
||||
|
||||
patch_file(file, update)
|
||||
@@ -48,8 +51,21 @@ for entry in this_dir.joinpath("modules").iterdir():
|
||||
patch_json(entry / "metadata.json", versions=[v.name for v in versions])
|
||||
|
||||
for version in versions:
|
||||
patch_json(version / "source.json", patches={
|
||||
p.name: sha256(p) for p in version.joinpath("patches").iterdir()
|
||||
})
|
||||
patch_file(version / "MODULE.bazel",
|
||||
lambda s: re.sub(r'''version\s*=\s*['"].*['"]''', f'version = "{version.name}"', s, 1))
|
||||
patches = version.joinpath("patches")
|
||||
overlay = version.joinpath("overlay")
|
||||
modules = [version / "MODULE.bazel", overlay / "MODULE.bazel"]
|
||||
for module in modules:
|
||||
if module.is_file():
|
||||
patch_file(
|
||||
module,
|
||||
lambda s: re.sub(r'''version\s*=\s*['"].*['"]''', f'version = "{version.name}"', s, 1))
|
||||
patch_json(
|
||||
version / "source.json",
|
||||
patches={
|
||||
p.name: sha256(p) for p in patches.iterdir()
|
||||
} if patches.is_dir() else None,
|
||||
patch_strip=1 if patches.is_dir() else None,
|
||||
overlay={
|
||||
o.name: sha256(o) for o in overlay.iterdir()
|
||||
} if overlay.is_dir() else None,
|
||||
)
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
module(
|
||||
name = "fmt",
|
||||
version = "12.1.0-codeql.1",
|
||||
bazel_compatibility = [">=7.2.1"],
|
||||
compatibility_level = 10,
|
||||
)
|
||||
|
||||
bazel_dep(name = "rules_cc", version = "0.2.13")
|
||||
bazel_dep(name = "rules_license", version = "1.0.0")
|
||||
@@ -0,0 +1,40 @@
|
||||
load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
||||
load("@rules_license//rules:license.bzl", "license")
|
||||
|
||||
package(
|
||||
default_applicable_licenses = [":license"],
|
||||
)
|
||||
|
||||
exports_files([
|
||||
"LICENSE",
|
||||
])
|
||||
|
||||
license(
|
||||
name = "license",
|
||||
license_kinds = ["@rules_license//licenses/spdx:MIT"],
|
||||
license_text = "LICENSE",
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "fmt",
|
||||
srcs = [
|
||||
#"src/fmt.cc", # No C++ module support, yet in Bazel (https://github.com/bazelbuild/bazel/pull/19940)
|
||||
"src/format.cc",
|
||||
"src/os.cc",
|
||||
],
|
||||
hdrs = glob([
|
||||
"include/fmt/*.h",
|
||||
]),
|
||||
# codeql change: disable UTF8 support, it's causing issues on Windows
|
||||
# copts = select({
|
||||
# "@rules_cc//cc/compiler:msvc-cl": ["/utf-8"],
|
||||
# "//conditions:default": [],
|
||||
# }),
|
||||
defines = select({
|
||||
"@rules_cc//cc/compiler:msvc-cl": ["FMT_UNICODE=0"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
includes = ["include"],
|
||||
strip_include_prefix = "include", # workaround: only needed on some macOS systems (see https://github.com/bazelbuild/bazel-central-registry/issues/1537)
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
@@ -0,0 +1,9 @@
|
||||
module(
|
||||
name = "fmt",
|
||||
version = "12.1.0-codeql.1",
|
||||
bazel_compatibility = [">=7.2.1"],
|
||||
compatibility_level = 10,
|
||||
)
|
||||
|
||||
bazel_dep(name = "rules_cc", version = "0.2.13")
|
||||
bazel_dep(name = "rules_license", version = "1.0.0")
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"url": "https://github.com/fmtlib/fmt/releases/download/12.1.0/fmt-12.1.0.zip",
|
||||
"integrity": "sha256-aV/Rl/pa/4/Ge18rvBEEkKh1zfekFoashRL7SA+orac=",
|
||||
"strip_prefix": "fmt-12.1.0",
|
||||
"overlay": {
|
||||
"BUILD.bazel": "sha256-T6CBBdPY92Iloq9NrMjm9kQeQA3nTZJeym6xG5cclOQ=",
|
||||
"MODULE.bazel": "sha256-Dgke/2OMsffv9jPSDxIwIgJIb4L77VW6lR8TsNHsekg="
|
||||
}
|
||||
}
|
||||
22
misc/bazel/registry/modules/fmt/metadata.json
Normal file
22
misc/bazel/registry/modules/fmt/metadata.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"homepage": "https://github.com/fmtlib/fmt",
|
||||
"maintainers": [
|
||||
{
|
||||
"email": "julian.amann@tum.de",
|
||||
"github": "Vertexwahn",
|
||||
"github_user_id": 3775001,
|
||||
"name": "Julian Amann"
|
||||
},
|
||||
{
|
||||
"github": "mering",
|
||||
"github_user_id": 133344217
|
||||
}
|
||||
],
|
||||
"repository": [
|
||||
"github:fmtlib/fmt"
|
||||
],
|
||||
"versions": [
|
||||
"12.1.0-codeql.1"
|
||||
],
|
||||
"yanked_versions": {}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// Provides formatters for standard library types to be used with fmtlib.
|
||||
// TODO: Patch fmtlib to support using `fmt/std.h` without RTTI
|
||||
// (https://github.com/fmtlib/fmt/issues/3170).
|
||||
|
||||
#include <filesystem>
|
||||
#include <fmt/format.h>
|
||||
#include <string_view>
|
||||
|
||||
namespace fmt {
|
||||
FMT_FORMAT_AS(std::filesystem::path, std::string);
|
||||
}
|
||||
|
||||
template <>
|
||||
struct fmt::formatter<std::error_code> : fmt::formatter<std::string> {
|
||||
auto format(const std::error_code& e, format_context& ctx) const {
|
||||
return fmt::formatter<std::string>::format(e.message(), ctx);
|
||||
}
|
||||
};
|
||||
@@ -8,8 +8,7 @@
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/chrono.h>
|
||||
|
||||
#include "swift/logging/Formatters.h"
|
||||
#include <fmt/std.h>
|
||||
|
||||
#include <binlog/binlog.hpp>
|
||||
#include <binlog/TextOutputStream.hpp>
|
||||
|
||||
Reference in New Issue
Block a user