-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added .bazelversion and updated gitignore. * Added bazel files. * fixup! Added bazel files. * Generated bazel files. Having trouble with the test fixtures and Bundle. * Treat helloworld.swift as txt since is just a fixture and reference for the binary under the tests/.../fixture folder. * Added tidy macro. * fixup! Added tidy macro. * Added some configs to .bazelrc
- Loading branch information
1 parent
812c541
commit 081c1b9
Showing
13 changed files
with
3,664 additions
and
1 deletion.
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,22 @@ | ||
common --enable_bzlmod | ||
|
||
# Verbose Failures | ||
build --verbose_failures | ||
|
||
# Test output information | ||
test --test_output=errors --test_summary=detailed | ||
|
||
# Strict PATH. Helps prevent build cache invalidation due to PATH differences. | ||
build --incompatible_strict_action_env=true | ||
|
||
# Set minimum macOS version | ||
# This prevents the tests from failing | ||
build --macos_minimum_os=13.0 | ||
build --host_macos_minimum_os=13.0 | ||
|
||
# Configure Apple CC toolchain | ||
# https://github.com/bazelbuild/apple_support#toolchain-setup | ||
build --enable_platform_specific_config | ||
build:macos --apple_crosstool_top=@local_config_apple_cc//:toolchain | ||
build:macos --crosstool_top=@local_config_apple_cc//:toolchain | ||
build: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 @@ | ||
7.0.2 |
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,54 @@ | ||
load("@gazelle//:def.bzl", "gazelle", "gazelle_binary") | ||
load("@rules_swift_package_manager//swiftpkg:defs.bzl", "swift_update_packages") | ||
load("@cgrindel_bazel_starlib//bzltidy:defs.bzl", "tidy") | ||
|
||
# Ignore the `.build` folder that is created by running Swift package manager | ||
# commands. The Swift Gazelle plugin executes some Swift package manager | ||
# commands to resolve external dependencies. This results in a `.build` file | ||
# being created. | ||
# NOTE: Swift package manager is not used to build any of the external packages. | ||
# The `.build` directory should be ignored. Be sure to configure your source | ||
# control to ignore it (i.e., add it to your `.gitignore`). | ||
# gazelle:exclude .build | ||
|
||
# This declaration builds a Gazelle binary that incorporates all of the Gazelle | ||
# plugins for the languages that you use in your workspace. In this example, we | ||
# are only listing the Gazelle plugin for Swift from rules_swift_package_manager. | ||
gazelle_binary( | ||
name = "gazelle_bin", | ||
languages = [ | ||
"@rules_swift_package_manager//gazelle", | ||
], | ||
) | ||
|
||
# This macro defines two targets: `swift_update_pkgs` and | ||
# `swift_update_pkgs_to_latest`. | ||
# | ||
# The `swift_update_pkgs` target should be run whenever the list of external | ||
# dependencies is updated in the `Package.swift`. Running this target will | ||
# populate the `swift_deps.bzl` with `swift_package` declarations for all of | ||
# the direct and transitive Swift packages that your project uses. | ||
# | ||
# The `swift_update_pkgs_to_latest` target should be run when you want to | ||
# update your Swift dependencies to their latest eligible version. | ||
swift_update_packages( | ||
name = "swift_update_pkgs", | ||
gazelle = ":gazelle_bin", | ||
generate_swift_deps_for_workspace = False, | ||
update_bzlmod_stanzas = True, | ||
) | ||
|
||
# This target updates the Bazel build files for your project. Run this target | ||
# whenever you add or remove source files from your project. | ||
gazelle( | ||
name = "update_build_files", | ||
gazelle = ":gazelle_bin", | ||
) | ||
|
||
tidy( | ||
name = "tidy", | ||
targets = [ | ||
":swift_update_pkgs", | ||
":update_build_files", | ||
], | ||
) |
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,22 @@ | ||
# Source: https://www.buildbuddy.io/blog/how-to-migrate-an-ios-app-to-bazel/#swift-packages-swiftpm | ||
bazel_dep(name = "apple_support", version = "1.14.0") | ||
bazel_dep(name = "rules_swift", version = "1.16.0", repo_name = "build_bazel_rules_swift") | ||
# Support swift-package-manager | ||
bazel_dep(name = "rules_swift_package_manager", version = "0.29.2") | ||
bazel_dep(name = "gazelle", version = "0.35.0") | ||
# Allows the use of `tidy` | ||
bazel_dep(name = "cgrindel_bazel_starlib", version = "0.18.1") | ||
|
||
# swift_deps START | ||
swift_deps = use_extension( | ||
"@rules_swift_package_manager//:extensions.bzl", | ||
"swift_deps", | ||
) | ||
swift_deps.from_file( | ||
deps_index = "//:swift_deps_index.json", | ||
) | ||
use_repo( | ||
swift_deps, | ||
"swiftpkg_swift_argument_parser", | ||
) | ||
# swift_deps END |
Oops, something went wrong.