cgrindel / rules_swiftformat Goto Github PK
View Code? Open in Web Editor NEWBazel rules that format Swift source files using nicklockwood/SwiftFormat.
License: Apache License 2.0
Bazel rules that format Swift source files using nicklockwood/SwiftFormat.
License: Apache License 2.0
swiftformat
directory to swifttidy
.swiftformat
directory that provides backward compatibility.swiftformat_binary
, swiftformat_library
, and swiftformat_test
via swiftformat
package. Deprecating these helpers.Started implementing this custom test runner for the integration tests. However, it was not quite working.
This provides an easy means for defining targets and formatting.
Prepare for expanded role performing formatting and linting.
There are some files (e.g. generated files) that we may not want to format.
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
swifttidy/deps.bzl
bazel_skylib 1.5.0
cgrindel_bazel_starlib v0.19.0
build_bazel_rules_swift 1.16.0
MODULE.bazel
examples/exclude_files/MODULE.bazel
rules_swift 1.16.0
cgrindel_bazel_starlib 0.19.0
examples/rules_swift_helpers/MODULE.bazel
rules_swift 1.16.0
cgrindel_bazel_starlib 0.19.0
examples/simple/MODULE.bazel
rules_swift 1.16.0
cgrindel_bazel_starlib 0.19.0
.bazelversion
bazel 6.5.0
.github/workflows/ci.yml
actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
cgrindel/gha_set_up_bazel v1
cgrindel/gha_install_swift_on_ubuntu v1
actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
cgrindel/gha_set_up_bazel v1
cgrindel/gha_join_jobs v1
macos 13
ubuntu 22.04
ubuntu 22.04
.github/workflows/create_release.yml
actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
tibdex/github-app-token v2
cgrindel/gha_configure_git_user v1
cgrindel/gha_create_release v2
Two modes:
swift_tidy_pkg
directly
swift_tidy_pkg
alongside the swift_xxx
declarationsrules_swift_package_manager
gazelle plugin to add arbitrary declarations.swift_xxx
.
rules_swift_package_manager
to specify the load path for each swift_xxx
rule/macro.Right now, we have to do this:
swiftformat_pkg(
name = "swiftformat",
config = "//:.swiftformat",
)
We want to do this:
swiftformat_pkg(name = "swiftformat")
bazel run @rules_bazel_integration_test//tools:remove_child_wksp_bazel_symlinks
bazel_binaries(versions = [
"//:.bazelversion",
"7.0.0-pre.20230504.4",
])
Error:
$TEST_TMPDIR defined: output root default is '/private/var/tmp/_bazel_chuck/ac6347dedadaee9aef21bdea5246c821/execroot/cgrindel_rules_swiftformat/_tmp/298e1c6e7849152759b069a6fa7aaf33' and max_idle_secs defaul
t is '15'.
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
INFO: Invocation ID: 770fb1c9-d320-4256-b18d-879faa2704b1
INFO: Options provided by the client:
Inherited 'common' options: --isatty=0 --terminal_columns=80
INFO: Reading rc options for 'info' from /Users/chuck/code/cgrindel/dev-machine/home/.bazelrc:
Inherited 'common' options: --announce_rc
INFO: Reading rc options for 'info' from /Users/chuck/code/cgrindel/rules_swiftformat/fix_failing_ci/shared.bazelrc:
Inherited 'build' options: --verbose_failures --incompatible_strict_action_env=true
INFO: Reading rc options for 'info' from /Users/chuck/code/cgrindel/dev-machine/home/.bazelrc:
Inherited 'build' options: --disk_cache=~/.bazel/disk_cache --repository_cache=~/.bazel/repo_cache --remote_header=x-buildbuddy-api-key=9DlX0JxsBj7ihhtaO0ue
bazel-bin: /private/var/tmp/_bazel_chuck/ac6347dedadaee9aef21bdea5246c821/execroot/cgrindel_rules_swiftformat/_tmp/298e1c6e7849152759b069a6fa7aaf33/_bazel_chuck/a895a75afb69374c31c23c0ae71bb1da/execroot/simpl
e_example/bazel-out/darwin_x86_64-fastbuild/bin
bazel-genfiles: /private/var/tmp/_bazel_chuck/ac6347dedadaee9aef21bdea5246c821/execroot/cgrindel_rules_swiftformat/_tmp/298e1c6e7849152759b069a6fa7aaf33/_bazel_chuck/a895a75afb69374c31c23c0ae71bb1da/execroot/
simple_example/bazel-out/darwin_x86_64-fastbuild/bin
bazel-testlogs: /private/var/tmp/_bazel_chuck/ac6347dedadaee9aef21bdea5246c821/execroot/cgrindel_rules_swiftformat/_tmp/298e1c6e7849152759b069a6fa7aaf33/_bazel_chuck/a895a75afb69374c31c23c0ae71bb1da/execroot/
simple_example/bazel-out/darwin_x86_64-fastbuild/testlogs
character-encoding: file.encoding = ISO-8859-1, defaultCharset = ISO-8859-1
command_log: /private/var/tmp/_bazel_chuck/ac6347dedadaee9aef21bdea5246c821/execroot/cgrindel_rules_swiftformat/_tmp/298e1c6e7849152759b069a6fa7aaf33/_bazel_chuck/a895a75afb69374c31c23c0ae71bb1da/command.log
committed-heap-size: 297MB
execution_root: /private/var/tmp/_bazel_chuck/ac6347dedadaee9aef21bdea5246c821/execroot/cgrindel_rules_swiftformat/_tmp/298e1c6e7849152759b069a6fa7aaf33/_bazel_chuck/a895a75afb69374c31c23c0ae71bb1da/execroot/
simple_example
gc-count: 8
gc-time: 47ms
install_base: /private/var/tmp/_bazel_chuck/ac6347dedadaee9aef21bdea5246c821/execroot/cgrindel_rules_swiftformat/_tmp/298e1c6e7849152759b069a6fa7aaf33/_bazel_chuck/install/c92c8a42045ec41b6a06cceb9c55b7ae
java-home: /private/var/tmp/_bazel_chuck/ac6347dedadaee9aef21bdea5246c821/execroot/cgrindel_rules_swiftformat/_tmp/298e1c6e7849152759b069a6fa7aaf33/_bazel_chuck/install/c92c8a42045ec41b6a06cceb9c55b7ae/embedd
ed_tools/jdk
java-runtime: OpenJDK Runtime Environment (build 17.0.5+8-LTS) by Azul Systems, Inc.
java-vm: OpenJDK 64-Bit Server VM (build 17.0.5+8-LTS, mixed mode) by Azul Systems, Inc.
local_resources: RAM=34359MB, CPU=16.0
max-heap-size: 8589MB
output_base: /private/var/tmp/_bazel_chuck/ac6347dedadaee9aef21bdea5246c821/execroot/cgrindel_rules_swiftformat/_tmp/298e1c6e7849152759b069a6fa7aaf33/_bazel_chuck/a895a75afb69374c31c23c0ae71bb1da
output_path: /private/var/tmp/_bazel_chuck/ac6347dedadaee9aef21bdea5246c821/execroot/cgrindel_rules_swiftformat/_tmp/298e1c6e7849152759b069a6fa7aaf33/_bazel_chuck/a895a75afb69374c31c23c0ae71bb1da/execroot/sim
ple_example/bazel-out
package_path: %workspace%
release: release 7.0.0-pre.20230504.4
repository_cache: /Users/chuck/.bazel/repo_cache
server_log: /private/var/tmp/_bazel_chuck/ac6347dedadaee9aef21bdea5246c821/execroot/cgrindel_rules_swiftformat/_tmp/298e1c6e7849152759b069a6fa7aaf33/_bazel_chuck/a895a75afb69374c31c23c0ae71bb1da/java.log.chuc
ks-macbook-pro.chuck.log.java.20230527-172559.5168
server_pid: 5168
used-heap-size: 33MB
workspace: /private/var/tmp/_bazel_chuck/ac6347dedadaee9aef21bdea5246c821/execroot/cgrindel_rules_swiftformat/bazel-out/darwin-fastbuild/bin/examples/simple_test_bazel_7_0_0-pre_20230504_4.runfiles/cgrindel_r
ules_swiftformat/examples/simple
$TEST_TMPDIR defined: output root default is '/private/var/tmp/_bazel_chuck/ac6347dedadaee9aef21bdea5246c821/execroot/cgrindel_rules_swiftformat/_tmp/298e1c6e7849152759b069a6fa7aaf33' and max_idle_secs defaul
t is '15'.
INFO: Invocation ID: 2702b47a-abb9-4ccb-8aff-d7eca5a4b97d
INFO: Options provided by the client:
Inherited 'common' options: --isatty=0 --terminal_columns=80
INFO: Reading rc options for 'test' from /Users/chuck/code/cgrindel/dev-machine/home/.bazelrc:
Inherited 'common' options: --announce_rc
INFO: Reading rc options for 'test' from /Users/chuck/code/cgrindel/rules_swiftformat/fix_failing_ci/shared.bazelrc:
Inherited 'build' options: --verbose_failures --incompatible_strict_action_env=true
INFO: Reading rc options for 'test' from /Users/chuck/code/cgrindel/dev-machine/home/.bazelrc:
Inherited 'build' options: --disk_cache=~/.bazel/disk_cache --repository_cache=~/.bazel/repo_cache --remote_header=x-buildbuddy-api-key=9DlX0JxsBj7ihhtaO0ue
INFO: Reading rc options for 'test' from /Users/chuck/code/cgrindel/dev-machine/home/.bazelrc:
'test' options: --test_output=errors --test_summary=terse
Loading:
Loading:
Loading: 0 packages loaded
Analyzing: 10 targets (2 packages loaded, 0 targets configured)
Analyzing: 10 targets (46 packages loaded, 357 targets configured)
DEBUG: Rule 'swiftformat_download_macos_x86_64' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "ce40452ea8b16abc0019f9d59ae9f53231b529c0619dddfb729ec84a26c54529"
DEBUG: Repository swiftformat_download_macos_x86_64 instantiated at:
/private/var/tmp/_bazel_chuck/ac6347dedadaee9aef21bdea5246c821/execroot/cgrindel_rules_swiftformat/bazel-out/darwin-fastbuild/bin/examples/simple_test_bazel_7_0_0-pre_20230504_4.runfiles/cgrindel_rules_swif
tformat/examples/simple/WORKSPACE:16:32: in <toplevel>
/private/var/tmp/_bazel_chuck/ac6347dedadaee9aef21bdea5246c821/execroot/cgrindel_rules_swiftformat/_tmp/298e1c6e7849152759b069a6fa7aaf33/_bazel_chuck/a895a75afb69374c31c23c0ae71bb1da/external/cgrindel_rules
_swiftformat/swiftformat/toolchains/assets.bzl:82:21: in swiftformat_register_toolchains
Repository rule http_archive defined at:
/private/var/tmp/_bazel_chuck/ac6347dedadaee9aef21bdea5246c821/execroot/cgrindel_rules_swiftformat/_tmp/298e1c6e7849152759b069a6fa7aaf33/_bazel_chuck/a895a75afb69374c31c23c0ae71bb1da/external/bazel_tools/to
ols/build_defs/repo/http.bzl:372:31: in <toplevel>
Analyzing: 10 targets (47 packages loaded, 365 targets configured)
Analyzing: 10 targets (47 packages loaded, 365 targets configured)
Analyzing: 10 targets (47 packages loaded, 365 targets configured)
Analyzing: 10 targets (47 packages loaded, 365 targets configured)
Analyzing: 10 targets (52 packages loaded, 391 targets configured)
Analyzing: 10 targets (52 packages loaded, 391 targets configured)
Analyzing: 10 targets (53 packages loaded, 403 targets configured)
Analyzing: 10 targets (53 packages loaded, 403 targets configured)
ERROR: /private/var/tmp/_bazel_chuck/ac6347dedadaee9aef21bdea5246c821/execroot/cgrindel_rules_swiftformat/_tmp/298e1c6e7849152759b069a6fa7aaf33/_bazel_chuck/a895a75afb69374c31c23c0ae71bb1da/external/build_baz
el_rules_swift_local_config/BUILD:9:22: in xcode_swift_toolchain rule @build_bazel_rules_swift_local_config//:toolchain:
Traceback (most recent call last):
File "/private/var/tmp/_bazel_chuck/ac6347dedadaee9aef21bdea5246c821/execroot/cgrindel_rules_swiftformat/_tmp/298e1c6e7849152759b069a6fa7aaf33/_bazel_chuck/a895a75afb69374c31c23c0ae71bb1da/external/bu
ild_bazel_rules_swift/swift/internal/xcode_swift_toolchain.bzl", line 517, column 29, in _xcode_swift_toolchain_impl
target_triples.parse(cc_toolchain.target_gnu_system_name),
File "/private/var/tmp/_bazel_chuck/ac6347dedadaee9aef21bdea5246c821/execroot/cgrindel_rules_swiftformat/_tmp/298e1c6e7849152759b069a6fa7aaf33/_bazel_chuck/a895a75afb69374c31c23c0ae71bb1da/external/bu
ild_bazel_rules_swift/swift/internal/target_triples.bzl", line 135, column 28, in _parse
vendor = components[1],
Error: index out of range (index is 1, but sequence has 1 elements)
ERROR: /private/var/tmp/_bazel_chuck/ac6347dedadaee9aef21bdea5246c821/execroot/cgrindel_rules_swiftformat/_tmp/298e1c6e7849152759b069a6fa7aaf33/_bazel_chuck/a895a75afb69374c31c23c0ae71bb1da/external/build_baz
el_rules_swift_local_config/BUILD:9:22: Analysis of target '@build_bazel_rules_swift_local_config//:toolchain' failed
ERROR: Analysis of target '//Foo:Foo' failed; build aborted:
INFO: Elapsed time: 36.775s
INFO: 0 processes.
ERROR: Build did NOT complete successfully
ERROR: Couldn't start the build. Unable to run tests
Something like:
bazel run //:format_update_all
I am currently adding code to ignore labels for now. I am not sure if we want to format generated files. However, not every label will reference a generated file.
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
This repository currently has no open or pending branches.
swifttidy/deps.bzl
bazel_skylib 1.4.2
cgrindel_bazel_starlib v0.16.1
build_bazel_rules_swift 1.9.1
MODULE.bazel
examples/exclude_files/MODULE.bazel
rules_swift 1.9.1
cgrindel_bazel_starlib 0.16.1
examples/rules_swift_helpers/MODULE.bazel
rules_swift 1.9.1
cgrindel_bazel_starlib 0.16.1
examples/simple/MODULE.bazel
rules_swift 1.9.1
cgrindel_bazel_starlib 0.16.1
.bazelversion
bazel 6.2.1
.github/workflows/ci.yml
actions/checkout v3
cgrindel/gha_set_up_bazel v1
cgrindel/gha_install_swift_on_ubuntu v1
actions/checkout v3
cgrindel/gha_set_up_bazel v1
cgrindel/gha_join_jobs v1
.github/workflows/create_release.yml
actions/checkout v3
tibdex/github-app-token v1
cgrindel/gha_configure_git_user v1
cgrindel/gha_create_release v2
LD_LIBRARY_PATH
LD_LIBRARY_PATH
to --action_env
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.