mirror of
https://github.com/github/codeql.git
synced 2026-04-24 16:25:15 +02:00
Swift: add resource dir updater
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
load("@rules_pkg//pkg:mappings.bzl", "pkg_filegroup", "pkg_files")
|
||||
load("@rules_pkg//pkg:mappings.bzl", "pkg_files")
|
||||
load("@rules_pkg//pkg:pkg.bzl", "pkg_zip")
|
||||
|
||||
_strip_prefix = "usr/lib/swift"
|
||||
|
||||
@@ -42,8 +43,13 @@ _pm_interface_files = [
|
||||
for dir, interface, module in _pm_interface_files
|
||||
]
|
||||
|
||||
pkg_filegroup(
|
||||
name = "resource-dir",
|
||||
pkg_zip(
|
||||
name = "resource-dir-linux",
|
||||
srcs = [":resource-dir-original"] + [":pkg-%s" % module for _, _, module in _pm_interface_files],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "swift_toolchain_linux",
|
||||
actual = ":resource-dir-linux",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
@@ -1,12 +1,23 @@
|
||||
load("@rules_pkg//pkg:mappings.bzl", "pkg_files")
|
||||
load("@rules_pkg//pkg:pkg.bzl", "pkg_zip")
|
||||
|
||||
_strip_prefix = "usr/lib/swift"
|
||||
|
||||
pkg_files(
|
||||
name = "resource-dir",
|
||||
name = "resource-dir-files",
|
||||
srcs = glob(
|
||||
["usr/lib/swift/**/*"],
|
||||
),
|
||||
strip_prefix = _strip_prefix,
|
||||
)
|
||||
|
||||
pkg_zip(
|
||||
name = "resource-dir-macos",
|
||||
srcs = [":resource-dir-files"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "swift_toolchain_macos",
|
||||
actual = ":resource-dir-macos",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
27
swift/third_party/resource-dir/BUILD.bazel
vendored
27
swift/third_party/resource-dir/BUILD.bazel
vendored
@@ -1,9 +1,30 @@
|
||||
load("//misc/bazel:pkg.bzl", "codeql_pkg_zip")
|
||||
load("//misc/bazel:pkg.bzl", "codeql_pkg_zip_import")
|
||||
|
||||
codeql_pkg_zip(
|
||||
codeql_pkg_zip_import(
|
||||
name = "resource-dir",
|
||||
src = select({"@platforms//os:" + os: "@swift-resource-dir-" + os for os in ("linux", "macos")}),
|
||||
arch_specific = True,
|
||||
target_compatible_with = select({"@platforms//os:windows": ["@platforms//:incompatible"]}),
|
||||
target_compatible_with = select({
|
||||
"@platforms//os:windows": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//swift:__pkg__"],
|
||||
)
|
||||
|
||||
[
|
||||
sh_binary(
|
||||
name = "update-" + os,
|
||||
srcs = ["update.sh"],
|
||||
args = [
|
||||
"$(rlocationpath @swift_toolchain_%s)" % os,
|
||||
"$(rlocationpath resource-dir-%s.zip)" % os,
|
||||
],
|
||||
data = [
|
||||
"resource-dir-%s.zip" % os,
|
||||
"@swift_toolchain_" + os,
|
||||
],
|
||||
target_compatible_with = ["@platforms//os:" + os],
|
||||
deps = ["@bazel_tools//tools/bash/runfiles"],
|
||||
)
|
||||
for os in ("linux", "macos")
|
||||
]
|
||||
|
||||
12
swift/third_party/resource-dir/update.sh
vendored
Normal file → Executable file
12
swift/third_party/resource-dir/update.sh
vendored
Normal file → Executable file
@@ -0,0 +1,12 @@
|
||||
# --- begin runfiles.bash initialization v3 ---
|
||||
# Copy-pasted from the Bazel Bash runfiles library v3.
|
||||
set -uo pipefail; set +e; f=bazel_tools/tools/bash/runfiles/runfiles.bash
|
||||
source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
|
||||
source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \
|
||||
source "$0.runfiles/$f" 2>/dev/null || \
|
||||
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
|
||||
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
|
||||
{ echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
|
||||
# --- end runfiles.bash initialization v3 ---
|
||||
|
||||
cp "$(rlocation "$1")" "$(rlocation "$2")"
|
||||
|
||||
Reference in New Issue
Block a user