Skip to content

Commit c196bc1

Browse files
authored
Format all files (#213)
Formats all files as per `trunk fmt --all`. Also adds .editorconfig for capturing indent style.
1 parent 07541b9 commit c196bc1

21 files changed

+133
-120
lines changed

.trunk/configs/.editorconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
LLVM toolchain for Bazel [![Tests](https://github.com/grailbio/bazel-toolchain/actions/workflows/tests.yml/badge.svg)](https://github.com/grailbio/bazel-toolchain/actions/workflows/tests.yml)
2-
=================
1+
# LLVM toolchain for Bazel [![Tests](https://github.com/grailbio/bazel-toolchain/actions/workflows/tests.yml/badge.svg)](https://github.com/grailbio/bazel-toolchain/actions/workflows/tests.yml)
32

4-
-------
3+
---
54

65
The project is in a relatively stable state and in use for all code development
76
at GRAIL and other organizations. Having said that, I am unable to give time to
@@ -16,7 +15,7 @@ implementation, please let me know and I can redirect people there.
1615

1716
@siddharthab
1817

19-
-------
18+
---
2019

2120
## Quickstart
2221

@@ -71,6 +70,7 @@ llvm_register_toolchains()
7170
```
7271

7372
And add the following section to your .bazelrc file:
73+
7474
```
7575
# Not needed after https://github.com/bazelbuild/bazel/issues/7260 is closed
7676
build --incompatible_enable_cc_toolchain_resolution
@@ -118,7 +118,7 @@ llvm_toolchain(
118118
#### Customizations
119119

120120
We currently offer limited customizability through attributes of the
121-
[llvm_toolchain_\* rules](toolchain/rules.bzl). You can send us a PR to add
121+
[llvm_toolchain\_\* rules](toolchain/rules.bzl). You can send us a PR to add
122122
more configuration attributes.
123123

124124
A majority of the complexity of this project is to make it generic for multiple
@@ -166,7 +166,7 @@ with the `--toolchain_resolution_debug` flag to see which toolchains were
166166
selected by bazel for your target platform.
167167

168168
For specifying unregistered toolchains on the command line, please use the
169-
`--extra_toolchains` flag. For example,
169+
`--extra_toolchains` flag. For example,
170170
`--extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux`.
171171

172172
We no longer support the `--crosstool_top=@llvm_toolchain//:toolchain` flag,
@@ -219,6 +219,7 @@ The toolchain supports cross-compilation if you bring your own sysroot. When
219219
cross-compiling, we link against the libstdc++ from the sysroot
220220
(single-platform build behavior is to link against libc++ bundled with LLVM).
221221
The following pairs have been tested to work for some hello-world binaries:
222+
222223
- {linux, x86_64} -> {linux, aarch64}
223224
- {linux, aarch64} -> {linux, x86_64}
224225
- {darwin, x86_64} -> {linux, x86_64}
@@ -229,6 +230,7 @@ for single-platform builds, and one with sysroot for cross-compilation builds.
229230
Then, when cross-compiling, explicitly specify the toolchain with the sysroot
230231
and the target platform. For example, see the [WORKSPACE](tests/WORKSPACE) file and
231232
the [test script](tests/scripts/run_xcompile_tests.sh) for cross-compilation.
233+
232234
```
233235
bazel build \
234236
--platforms=@com_grail_bazel_toolchain//platforms:linux-x86_64 \
@@ -258,7 +260,7 @@ The following is a rough (untested) list of steps:
258260

259261
Sandboxing the toolchain introduces a significant overhead (100ms per action,
260262
as of mid 2018). To overcome this, one can use
261-
`--experimental_sandbox_base=/dev/shm`. However, not all environments might
263+
`--experimental_sandbox_base=/dev/shm`. However, not all environments might
262264
have enough shared memory available to load all the files in memory. If this is
263265
a concern, you may set the attribute for using absolute paths, which will
264266
substitute templated paths to the toolchain as absolute paths. When running

tests/file_dependency_test.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@
1414
# limitations under the License.
1515

1616
fail() {
17-
>&2 echo "$@"
17+
echo >&2 "$@"
1818
exit 1
1919
}
2020

2121
clang_format_path=$1
2222
libcpp_path=$2
2323

24-
[[ -a "${clang_format_path}" ]] || fail "bin/clang-format not found"
24+
[[ -e ${clang_format_path} ]] || fail "bin/clang-format not found"
2525

26-
[[ -a "${libcpp_path}" ]] \
27-
|| compgen -G "${libcpp_path}" >/dev/null \
28-
|| fail "libc++.a not found"
26+
[[ -e ${libcpp_path} ]] ||
27+
compgen -G "${libcpp_path}" >/dev/null ||
28+
fail "libc++.a not found"
2929

3030
echo "SUCCESS!"

tests/scripts/archlinux_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
set -euo pipefail
1717

1818
images=(
19-
"archlinux:base-devel"
19+
"archlinux:base-devel"
2020
)
2121

2222
# See note next to the definition of this toolchain in the WORKSPACE file.

tests/scripts/bazel.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ os="$(uname -s | tr "[:upper:]" "[:lower:]")"
1616
readonly os
1717

1818
arch="$(uname -m)"
19-
if [[ "${arch}" == "x86_64" ]]; then
19+
if [[ ${arch} == "x86_64" ]]; then
2020
arch="amd64"
21-
elif [[ "${arch}" == "aarch64" ]] || [[ "${arch}" == "arm64" ]]; then
21+
elif [[ ${arch} == "aarch64" ]] || [[ ${arch} == "arm64" ]]; then
2222
arch="arm64"
2323
else
24-
>&2 echo "Unknown architecture: ${arch}"
24+
echo >&2 "Unknown architecture: ${arch}"
2525
fi
2626
readonly arch
2727

tests/scripts/centos_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ exit 1
1919
set -euo pipefail
2020

2121
images=(
22-
"centos:7"
22+
"centos:7"
2323
)
2424

2525
git_root=$(git rev-parse --show-toplevel)

tests/scripts/debian_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
set -euo pipefail
1717

1818
images=(
19-
"debian:latest"
19+
"debian:latest"
2020
)
2121

2222
git_root=$(git rev-parse --show-toplevel)

tests/scripts/fedora_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
set -euo pipefail
1717

1818
images=(
19-
"fedora:latest"
19+
"fedora:latest"
2020
)
2121

2222
git_root=$(git rev-parse --show-toplevel)

tests/scripts/linux_sysroot_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
set -euo pipefail
1717

1818
images=(
19-
"ubuntu:22.04"
19+
"ubuntu:22.04"
2020
)
2121

2222
git_root=$(git rev-parse --show-toplevel)

tests/scripts/run_external_tests.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ cd "${scripts_dir}"
2323

2424
# Generate some files needed for the tests.
2525
"${bazel}" query "${common_args[@]}" @io_bazel_rules_go//tests/core/cgo:dylib_test >/dev/null
26-
if [[ "$USE_BZLMOD" == "true" ]]; then
26+
if [[ $USE_BZLMOD == "true" ]]; then
2727
"$("${bazel}" info output_base)/external/rules_go~0.41.0/tests/core/cgo/generate_imported_dylib.sh"
2828
else
2929
"$("${bazel}" info output_base)/external/io_bazel_rules_go/tests/core/cgo/generate_imported_dylib.sh"
@@ -59,4 +59,3 @@ test_args=(
5959
-@io_bazel_rules_go//tests/core/cgo:external_includes_test \
6060
$("${bazel}" query 'attr(timeout, short, tests(@com_google_absl//absl/...))') \
6161
-@com_google_absl//absl/time/internal/cctz:time_zone_format_test
62-

0 commit comments

Comments
 (0)