Skip to content

Commit

Permalink
Add support for installing via Bazel (#103)
Browse files Browse the repository at this point in the history
Adds support for installing via Bazel

---------

Co-authored-by: Luis Padron <[email protected]>
  • Loading branch information
NickEntin and luispadron authored Aug 19, 2023
1 parent 97e7454 commit 49477f8
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 2 deletions.
1 change: 1 addition & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build --apple_platform_type=ios
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6.3.2
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,11 @@ jobs:
run: Scripts/github/prepare-simulators.sh ${{ matrix.platform }}
- name: Build
run: Scripts/build.swift spm ${{ matrix.platform }} `which xcpretty`
bazel:
name: Bazel
runs-on: macOS-12
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Build and Test
run: bazel test ParalayoutTests
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,7 @@ Pods/
# Swift Package Manager
generated/
.build/
.swiftpm/
.swiftpm/

# Bazel
bazel-*
44 changes: 44 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
load(
"@build_bazel_rules_swift//swift:swift.bzl",
"swift_library",
"swift_test",
)

load(
"@build_bazel_rules_apple//apple:ios.bzl",
"ios_framework",
"ios_unit_test",
)

swift_library(
name = "Paralayout.lib",
module_name = "Paralayout",
srcs = glob(["Paralayout/**/*.swift"]),
deps = [],
)

swift_library(
name = "ParalayoutTests.lib",
module_name = "ParalayoutTests",
deps = [":Paralayout.lib"],
srcs = glob(["ParalayoutTests/**/*.swift"]),
testonly = True,
)

ios_framework(
name = "Paralayout",
deps = [":Paralayout.lib"],
visibility = ["//visibility:public"],
bundle_id = "com.squareup.Paralayout",
infoplists = ["Paralayout/Info.plist"],
minimum_os_version = "12.0",
families = ["iphone", "ipad"],
)

ios_unit_test(
name = "ParalayoutTests",
deps = [":ParalayoutTests.lib"],
bundle_name = "ParalayoutTests",
minimum_os_version = "12.0",
runner = "@build_bazel_rules_apple//apple/testing/default_runner:ios_xctestrun_ordered_runner",
)
2 changes: 1 addition & 1 deletion Paralayout/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<string>1.0</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
Expand Down
35 changes: 35 additions & 0 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "build_bazel_rules_apple",
sha256 = "8ac4c7997d863f3c4347ba996e831b5ec8f7af885ee8d4fe36f1c3c8f0092b2c",
url = "https://github.com/bazelbuild/rules_apple/releases/download/2.5.0/rules_apple.2.5.0.tar.gz",
)

load(
"@build_bazel_rules_apple//apple:repositories.bzl",
"apple_rules_dependencies",
)

apple_rules_dependencies()

load(
"@build_bazel_rules_swift//swift:repositories.bzl",
"swift_rules_dependencies",
)

swift_rules_dependencies()

load(
"@build_bazel_rules_swift//swift:extras.bzl",
"swift_rules_extra_dependencies",
)

swift_rules_extra_dependencies()

load(
"@build_bazel_apple_support//lib:repositories.bzl",
"apple_support_dependencies",
)

apple_support_dependencies()

0 comments on commit 49477f8

Please sign in to comment.