Skip to content

Commit 4fe8410

Browse files
committed
Build with Bazel
1 parent 48c201a commit 4fe8410

3 files changed

Lines changed: 42 additions & 17 deletions

File tree

.bazelrc

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,23 @@ try-import %workspace%/ci.bazelrc
44
try-import %workspace%/user.bazelrc
55

66
build --enable_platform_specific_config
7-
build:macos --apple_crosstool_top=@local_config_apple_cc//:toolchain
8-
build:macos --crosstool_top=@local_config_apple_cc//:toolchain
9-
build:macos --host_crosstool_top=@local_config_apple_cc//:toolchain
107

11-
build --macos_minimum_os=13.5 --host_macos_minimum_os=13.5
12-
build --disk_cache=~/.bazel_cache
13-
build --experimental_remote_cache_compression
14-
build --remote_build_event_upload=minimal
15-
build --nolegacy_important_outputs
16-
build --incompatible_strict_action_env
8+
build:macos \
9+
--apple_crosstool_top=@local_config_apple_cc//:toolchain \
10+
--crosstool_top=@local_config_apple_cc//:toolchain \
11+
--host_crosstool_top=@local_config_apple_cc//:toolchain \
12+
--macos_minimum_os=13.5 --host_macos_minimum_os=13.5
13+
14+
build:windows \
15+
--extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl \
16+
--extra_execution_platforms=//:x64_windows-clang-cl
17+
18+
build \
19+
--disk_cache=~/.bazel_cache \
20+
--experimental_remote_cache_compression \
21+
--remote_build_event_upload=minimal \
22+
--nolegacy_important_outputs \
23+
--incompatible_strict_action_env
1724

1825
build:release \
1926
--compilation_mode=opt \

.github/workflows/test.yml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ jobs:
7474
arch: arm64
7575
windows-display-name: '11 ARM'
7676
swift-version: 6.2.1
77+
env:
78+
CC: clang
79+
BAZEL_LLVM: C:\Program Files\LLVM
7780
steps:
7881
- uses: compnerd/gha-setup-swift@main
7982
with:
@@ -83,13 +86,19 @@ jobs:
8386
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
8487
with:
8588
persist-credentials: false
86-
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
87-
with:
88-
key: windows-${{ matrix.windows-version }}-spm-${{ matrix.swift-version }}-${{ hashFiles('Package.resolved', 'Package.swift') }}
89-
restore-keys: windows-${{ matrix.windows-version }}-spm-${{ matrix.swift-version }}-
90-
path: .build
91-
- name: Build all targets
92-
run: swift build --build-tests --vv
89+
- name: Apply patch
90+
run: |
91+
git apply --ignore-whitespace .bcr/patches/no-warnings-as-errors.patch
92+
git update-index --assume-unchanged BUILD
93+
- name: Build SwiftLint
94+
run: bazel build //:swiftlint --toolchain_resolution_debug=.*
9395
- name: Run selected tests
94-
run: swift test --vv --skip IntegrationTests --skip FileSystemAccessTests
96+
run: >
97+
bazel test --test_output=errors
98+
//Tests:BuiltInRulesTests
99+
//Tests:CoreTests
100+
//Tests:ExtraRulesTests
101+
//Tests:FrameworkTests
102+
//Tests:GeneratedTests
103+
//Tests:MacrosTests
95104
# To be extended with test execution and linting ...

BUILD

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ config_setting(
2323
},
2424
)
2525

26+
platform(
27+
name = "x64_windows-clang-cl",
28+
constraint_values = [
29+
"@platforms//cpu:x86_64",
30+
"@platforms//os:windows",
31+
"@bazel_tools//tools/cpp:clang-cl",
32+
],
33+
)
34+
2635
# Targets
2736

2837
swift_library(

0 commit comments

Comments
 (0)