Skip to content

Commit

Permalink
Bazel/Swift: add zip imports to packs
Browse files Browse the repository at this point in the history
  • Loading branch information
redsun82 committed May 24, 2024
1 parent 4d93e8a commit e8b857b
Show file tree
Hide file tree
Showing 18 changed files with 805 additions and 36 deletions.
6 changes: 3 additions & 3 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ common --override_module=semmle_code=%workspace%/misc/bazel/semmle_code_stub

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

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

# this requires developer mode, but is required to have pack installer functioning
startup --windows_enable_symlinks
Expand Down
8 changes: 7 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,10 @@ ruby/extractor/cargo-bazel-lock.json -merge
# auto-generated files for the C# build
csharp/paket.lock linguist-generated=true
# needs eol=crlf, as `paket` touches this file and saves it als crlf
csharp/.paket/Paket.Restore.targets linguist-generated=true eol=crlf
csharp/.paket/Paket.Restore.targets linguist-generated=true eol=cr

# ripunzip tool
/misc/bazel/internal/bin/*/ripunzip* filter=lfs diff=lfs merge=lfs -text

# swift prebuilt resources
/swift/third_party/resource-dir/*.zip filter=lfs diff=lfs merge=lfs -text
27 changes: 27 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,33 @@ use_repo(node, "nodejs", "nodejs_toolchains")
go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
go_sdk.download(version = "1.22.2")

lfs_files = use_repo_rule("//misc/bazel:lfs.bzl", "lfs_files")

lfs_files(
name = "ripunzip-linux",
srcs = ["//misc/bazel/internal/bin:linux/ripunzip"],
)

lfs_files(
name = "ripunzip-windows",
srcs = ["//misc/bazel/internal/bin:windows/ripunzip.exe"],
)

lfs_files(
name = "ripunzip-macos",
srcs = ["//misc/bazel/internal/bin:macos/ripunzip"],
)

lfs_files(
name = "swift-resource-dir-linux",
srcs = ["//swift/third_party/resource-dir:resource-dir-linux.zip"],
)

#lfs_files(
# name = "swift-resource-dir-macos",
# srcs = ["//swift/third_party/resource-dir:resource-dir-macos.zip"],
#)

register_toolchains(
"@nodejs_toolchains//:all",
)
8 changes: 8 additions & 0 deletions misc/bazel/internal/bin/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
load("@bazel_skylib//rules:native_binary.bzl", "native_binary")

native_binary(
name = "ripunzip",
src = select({"@platforms//os:" + os: "@ripunzip-" + os for os in ("linux", "windows", "macos")}),
out = "ripunzip.exe",
visibility = ["//visibility:public"],
)
3 changes: 3 additions & 0 deletions misc/bazel/internal/bin/linux/ripunzip
Git LFS file not shown
3 changes: 3 additions & 0 deletions misc/bazel/internal/bin/macos/ripunzip
Git LFS file not shown
3 changes: 3 additions & 0 deletions misc/bazel/internal/bin/windows/ripunzip.exe
Git LFS file not shown
20 changes: 20 additions & 0 deletions misc/bazel/internal/bin/zipmerge/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
cc_library(
name = "lib",
srcs = [
"zipmerge.cpp",
],
hdrs = ["zipmerge.h"],
)

cc_binary(
name = "zipmerge",
srcs = [
"zipmerge_main.cpp",
],
visibility = ["//visibility:public"],
deps = [
":lib",
],
)

#TODO port tests from internal repo
Loading

0 comments on commit e8b857b

Please sign in to comment.