-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71 from cashapp/entin/bazel
Add support for installing via Bazel
- Loading branch information
Showing
14 changed files
with
206 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# TODO: remove when using Bazel 7 where bzlmod is on by default | ||
common --enable_bzlmod | ||
|
||
# Use the apple_support macOS toolchains | ||
common --enable_platform_specific_config | ||
common:macos --apple_crosstool_top=@local_config_apple_cc//:toolchain | ||
common:macos --crosstool_top=@local_config_apple_cc//:toolchain | ||
common:macos --host_crosstool_top=@local_config_apple_cc//:toolchain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
6.4.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,6 @@ timeline.xctimeline | |
generated/ | ||
.build/ | ||
.swiftpm/ | ||
|
||
# Bazel | ||
bazel-* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
load( | ||
"@rules_apple//apple:ios.bzl", | ||
"ios_framework", | ||
"ios_unit_test", | ||
) | ||
load( | ||
"@build_bazel_rules_swift//swift:swift.bzl", | ||
"swift_library", | ||
) | ||
|
||
swift_library( | ||
name = "Stagehand.lib", | ||
srcs = glob(["Sources/Stagehand/**/*.swift"]), | ||
module_name = "Stagehand", | ||
tags = ["manual"], | ||
visibility = ["//visibility:public"], | ||
deps = [], | ||
) | ||
|
||
swift_library( | ||
name = "StagehandTestingCore.lib", | ||
testonly = True, | ||
srcs = glob(["Sources/StagehandTesting/Core/**/*.swift"]), | ||
defines = ["BAZEL_PACKAGE"], | ||
module_name = "StagehandTestingCore", | ||
tags = ["manual"], | ||
visibility = ["//visibility:public"], | ||
deps = [":Stagehand.lib"], | ||
) | ||
|
||
swift_library( | ||
name = "StagehandTesting_iOSSnapshotTestCase.lib", | ||
testonly = True, | ||
srcs = glob(["Sources/StagehandTesting/iOSSnapshotTestCase/**/*.swift"]), | ||
defines = ["BAZEL_PACKAGE"], | ||
module_name = "StagehandTesting_iOSSnapshotTestCase", | ||
tags = ["manual"], | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
":Stagehand.lib", | ||
":StagehandTestingCore.lib", | ||
"@ios_snapshot_test_case//:iOSSnapshotTestCase", | ||
], | ||
) | ||
|
||
ios_framework( | ||
name = "Stagehand", | ||
bundle_id = "com.squareup.Stagehand", | ||
families = [ | ||
"iphone", | ||
"ipad", | ||
], | ||
infoplists = ["Sources/Info.plist"], | ||
minimum_os_version = "12.0", | ||
visibility = ["//visibility:public"], | ||
deps = [":Stagehand.lib"], | ||
) | ||
|
||
ios_framework( | ||
name = "StagehandTesting_iOSSnapshotTestCase", | ||
testonly = True, | ||
bundle_id = "com.squareup.StagehandTesting", | ||
families = [ | ||
"iphone", | ||
"ipad", | ||
], | ||
infoplists = ["Sources/Info.plist"], | ||
minimum_os_version = "12.0", | ||
visibility = ["//visibility:public"], | ||
deps = [":StagehandTesting_iOSSnapshotTestCase.lib"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Luis Padron <lpadron@squareup.com> | ||
Date: Fri, 19 Jan 2024 15:17:39 -0500 | ||
Subject: Patch testonly swift_library | ||
|
||
|
||
diff --git a/BUILD.bazel b/BUILD.bazel | ||
index 0ae5406..42e81b5 100644 | ||
--- a/BUILD.bazel | ||
+++ b/BUILD.bazel | ||
@@ -25,5 +25,6 @@ swift_library( | ||
deps = [ | ||
":iOSSnapshotTestCaseCore" | ||
], | ||
+ testonly = True, | ||
visibility = ["//visibility:public"] | ||
) | ||
-- | ||
2.42.1 | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
"""Defines extensions and macros for MODULE.bazel""" | ||
|
||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
||
# -- Non-bzlmod versions | ||
|
||
IOS_SNAPSHOT_TEST_CASE_VERSION = "57b023c8bb3df361e2fae01532cd066ec0b65d2e" | ||
|
||
# -- Module extension | ||
|
||
def non_bzlmod_repositories(): | ||
"""Defines external dependencies which do not support bzlmod""" | ||
|
||
http_archive( | ||
name = "ios_snapshot_test_case", | ||
url = "https://github.com/uber/ios-snapshot-test-case/archive/%s.zip" % IOS_SNAPSHOT_TEST_CASE_VERSION, | ||
strip_prefix = "ios-snapshot-test-case-%s" % IOS_SNAPSHOT_TEST_CASE_VERSION, | ||
sha256 = "fae7ec6bfdc35bb026a2e898295c16240eeb001bed188972ddcc0d7dc388cda3", | ||
patches = ["//Bazel:0001-Patch-testonly-swift_library.patch"], | ||
patch_args = ["-p1"], | ||
) | ||
|
||
def _non_bzlmod_deps_impl(_): | ||
non_bzlmod_repositories() | ||
|
||
non_bzlmod_deps = module_extension( | ||
implementation = _non_bzlmod_deps_impl, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
module( | ||
name = "stagehand", | ||
version = "0.0.0", | ||
compatibility_level = 1, | ||
) | ||
|
||
bazel_dep( | ||
name = "apple_support", | ||
version = "1.11.1", | ||
) | ||
bazel_dep( | ||
name = "rules_apple", | ||
version = "3.1.1", | ||
) | ||
bazel_dep( | ||
name = "rules_swift", | ||
version = "1.14.0", | ||
repo_name = "build_bazel_rules_swift", | ||
) | ||
|
||
# Load non-bzlmod dependencies | ||
non_bzlmod_deps = use_extension("//Bazel:non_bzlmod_deps.bzl", "non_bzlmod_deps") | ||
use_repo( | ||
non_bzlmod_deps, | ||
"ios_snapshot_test_case", | ||
) | ||
|
||
apple_cc_configure = use_extension("@apple_support//crosstool:setup.bzl", "apple_cc_configure_extension") | ||
use_repo(apple_cc_configure, "local_config_apple_cc") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>en</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>FMWK</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleVersion</key> | ||
<string>1.0</string> | ||
<key>NSPrincipalClass</key> | ||
<string></string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Defines the WORKSPACE when using bzlmod, this should be empty. Use MODULE.bazel instead""" |