Skip to content

Commit f4e6f95

Browse files
committed
Bazel/Swift: add zip imports to packs
1 parent 4d93e8a commit f4e6f95

17 files changed

+782
-27
lines changed

.bazelrc

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ common --override_module=semmle_code=%workspace%/misc/bazel/semmle_code_stub
1010

1111
build --repo_env=CC=clang --repo_env=CXX=clang++
1212

13-
build:linux --cxxopt=-std=c++20
13+
build:linux --cxxopt=-std=c++20 --host_cxxopt=-std=c++20
1414
# we currently cannot built the swift extractor for ARM
15-
build:macos --cxxopt=-std=c++20 --copt=-arch --copt=x86_64 --linkopt=-arch --linkopt=x86_64
16-
build:windows --cxxopt=/std:c++20 --cxxopt=/Zc:preprocessor
15+
build:macos --cxxopt=-std=c++20 --host_cxxopt=-std=c++20 --copt=-arch --copt=x86_64 --linkopt=-arch --linkopt=x86_64
16+
build:windows --cxxopt=/std:c++20 --cxxopt=/Zc:preprocessor --host_cxxopt=/std:c++20 --host_cxxopt=/Zc:preprocessor
1717

1818
# this requires developer mode, but is required to have pack installer functioning
1919
startup --windows_enable_symlinks

.gitattributes

+7-1
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,10 @@ ruby/extractor/cargo-bazel-lock.json -merge
7777
# auto-generated files for the C# build
7878
csharp/paket.lock linguist-generated=true
7979
# needs eol=crlf, as `paket` touches this file and saves it als crlf
80-
csharp/.paket/Paket.Restore.targets linguist-generated=true eol=crlf
80+
csharp/.paket/Paket.Restore.targets linguist-generated=true eol=cr
81+
82+
# ripunzip tool
83+
/misc/bazel/internal/bin/*/ripunzip* filter=lfs diff=lfs merge=lfs -text
84+
85+
# swift prebuilt resources
86+
/swift/third_party/resource-dir/*.zip filter=lfs diff=lfs merge=lfs -text

MODULE.bazel

+27
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,33 @@ use_repo(node, "nodejs", "nodejs_toolchains")
5757
go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
5858
go_sdk.download(version = "1.22.2")
5959

60+
lfs_files = use_repo_rule("//misc/bazel:lfs.bzl", "lfs_files")
61+
62+
lfs_files(
63+
name = "ripunzip-linux",
64+
srcs = ["//misc/bazel/internal/bin:linux/ripunzip"],
65+
)
66+
67+
lfs_files(
68+
name = "ripunzip-windows",
69+
srcs = ["//misc/bazel/internal/bin:windows/ripunzip.exe"],
70+
)
71+
72+
lfs_files(
73+
name = "ripunzip-macos",
74+
srcs = ["//misc/bazel/internal/bin:macos/ripunzip"],
75+
)
76+
77+
lfs_files(
78+
name = "swift-resource-dir-linux",
79+
srcs = ["//swift/third_party/resource-dir:resource-dir-linux.zip"],
80+
)
81+
82+
#lfs_files(
83+
# name = "swift-resource-dir-macos",
84+
# srcs = ["//swift/third_party/resource-dir:resource-dir-macos.zip"],
85+
#)
86+
6087
register_toolchains(
6188
"@nodejs_toolchains//:all",
6289
)

misc/bazel/internal/bin/BUILD.bazel

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
load("@bazel_skylib//rules:native_binary.bzl", "native_binary")
2+
3+
native_binary(
4+
name = "ripunzip",
5+
src = select({"@platforms//os:" + os: "@ripunzip-" + os for os in ("linux", "windows", "macos")}),
6+
out = "ripunzip.exe",
7+
visibility = ["//visibility:public"],
8+
)
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:609d90e14e1cdd0351eee3d45a6e09e36cc44b3289e912a19945a49f4fdc416d
3+
size 5775960
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:91e21ae4c75fd79dee4afc16aa79cef5a404080a4784360923edd23b2b2e988d
3+
size 5316808
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:7623346ec339ab7bf4179297dc129dcedeed932c49e594e6cfddfd1c9c2ff11c
3+
size 4527104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
cc_library(
2+
name = "lib",
3+
srcs = [
4+
"zipmerge.cpp",
5+
],
6+
hdrs = ["zipmerge.h"],
7+
)
8+
9+
cc_binary(
10+
name = "zipmerge",
11+
srcs = [
12+
"zipmerge_main.cpp",
13+
],
14+
visibility = ["//visibility:public"],
15+
deps = [
16+
":lib",
17+
],
18+
)
19+
20+
#TODO port tests from internal repo

0 commit comments

Comments
 (0)