Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
174 commits
Select commit Hold shift + click to select a range
5203548
Add xcode2 target summary output
yume190 Apr 11, 2026
dc15088
Add roadmap tree builder and command
yume190 Apr 22, 2026
03cdf8f
Merge branch 'master' into
yume190 Apr 24, 2026
3cc9e80
fix
yume190 Apr 26, 2026
d6a5da3
Refactor XCode2 config loaders and build settings
yume190 Apr 27, 2026
4802acc
Refine XCode2 build settings namespaces
yume190 Apr 27, 2026
5f72d00
Refine XCode2 labels and tests
yume190 Apr 29, 2026
2b9c2c9
Migrate BazelizeKit to XCode2 roadmap flow
yume190 Apr 30, 2026
1382a3a
Add apple_support module and bump repo pins
yume190 Sep 14, 2026
484b092
Derive SwiftPM repository names from git URLs
yume190 Sep 14, 2026
cf769bc
Resolve xcconfig files and nested build setting variables
yume190 Sep 14, 2026
8fea221
Infer synchronized group membership from build exceptions
yume190 Sep 14, 2026
48fcd6b
Split SDK frameworks and dylibs out of prebuilt dependencies
yume190 Sep 14, 2026
1cf8294
Add cc_import rule binding
yume190 Sep 14, 2026
29ce1eb
Emit app icons from asset catalog build settings
yume190 Sep 14, 2026
2976d46
Embed app extensions into applications instead of linking them
yume190 Sep 14, 2026
0c5ee0b
Generate mixed_language_library for mixed ObjC and Swift targets
yume190 Sep 14, 2026
35b876c
Include copy-files entries in the roadmap source tree
yume190 Sep 14, 2026
6e412f5
Attach default plist fragment to framework bundles
yume190 Sep 14, 2026
184ba3c
Add roadmap output flow to the iOS fixture
yume190 Sep 14, 2026
e66e020
Ignore generated iOS fixture workspace files
yume190 Sep 14, 2026
ef5aed3
Add iina porting notes
yume190 Sep 14, 2026
61e74be
Bump XcodeProj, Yams and swift-argument-parser
yume190 Sep 14, 2026
fe50723
Replace SwiftCommand with swift-subprocess in PluginLoader
yume190 Sep 14, 2026
edf304b
Document SwiftPM pin constraint and refresh resolved graph
yume190 Sep 14, 2026
b45e8c4
Emit a latest constant in generated repo enums
yume190 Sep 14, 2026
8de16e1
Regenerate repo enums with latest constants
yume190 Sep 14, 2026
3d1064b
Pin repo dependencies to generated latest constants
yume190 Sep 14, 2026
b00013b
Generate BazelDep namespace instead of Repo
yume190 Sep 14, 2026
14ef4e4
Rename Repo enums to BazelDep across BazelizeKit
yume190 Sep 14, 2026
ccdbed7
Read bazel_dep versions from the Bazel Central Registry
yume190 Sep 14, 2026
2225985
Regenerate BazelDep versions from the registry
yume190 Sep 14, 2026
b2d823a
Delete the unused Xcode2 roadmap tree builder
yume190 Sep 14, 2026
3afdcfc
Pin rules_swift_package_manager below its strict minimum-OS transition
yume190 Sep 14, 2026
463f2bf
Seed Xcode package pins into the generated workspace
yume190 Sep 14, 2026
005bd99
Default minimum OS versions and import config.bazelrc from .bazelrc
yume190 Sep 14, 2026
804a1a0
Keep generated plist fragments consistent with rules_apple
yume190 Sep 14, 2026
3ea97d8
Support SWIFT_OBJC_BRIDGING_HEADER in generated swift_library targets
yume190 Sep 14, 2026
533dfab
Link system frameworks and dylibs from swift_library targets
yume190 Sep 14, 2026
6045ae2
Match iina expectations to the pinned v1.4.4 checkout
yume190 Sep 14, 2026
68c8668
Glob app icons only from catalogs that define the icon set
yume190 Sep 14, 2026
f456ea6
Compile .intentdefinition files into the owning target
yume190 Sep 14, 2026
5edf1b7
Drop the test host dep when it is already a target dependency
yume190 Sep 14, 2026
8f058e1
Generate macos_framework for macOS framework targets
yume190 Sep 14, 2026
5e8ed4f
Import prebuilt .a and .dylib binaries with cc_import
yume190 Sep 14, 2026
10dfbb5
Skip SwiftPM wiring for projects without packages
yume190 Sep 14, 2026
1776e2c
Resolve Xcode's built-in SRCROOT style settings
yume190 Sep 14, 2026
123e20c
Emit plist fragments only when their content exists
yume190 Sep 14, 2026
fb0031c
Mirror Xcode's header map with module and internal headers
yume190 Sep 14, 2026
3b09626
Classify sources and libraries by declared Xcode file type
yume190 Sep 14, 2026
e94dac1
Compile non-executable targets with parse-as-library
yume190 Sep 14, 2026
9425002
Normalize build setting paths before using them as labels
yume190 Sep 14, 2026
d1a43f7
Generate the SwiftPM manifest with tools version 6.0
yume190 Sep 14, 2026
ad9a84d
Keep app icon sets out of the asset resources filegroup
yume190 Sep 14, 2026
23b247f
Drop Info.plist entries plisttool cannot resolve
yume190 Sep 14, 2026
a2cae52
Honor HEADER_SEARCH_PATHS when generating libraries
yume190 Sep 14, 2026
d53a1aa
Enable clang modules like Xcode does
yume190 Sep 14, 2026
c98bc45
Rewrite brace-style setting references and skip unusable search paths
yume190 Sep 14, 2026
132ad23
Infer the target platform when SDKROOT is absent or auto
yume190 Sep 14, 2026
1ddbbad
Take project defaults from the project's own configuration list
yume190 Sep 14, 2026
9aada3d
Discover local packages inside synchronized groups
yume190 Sep 14, 2026
4f92cb0
Pick the platform from SUPPORTED_PLATFORMS for multiplatform targets
yume190 Sep 14, 2026
fc24ef4
Skip prebuilt binaries missing from the working tree
yume190 Sep 14, 2026
5283cf9
Resolve build setting references with modifiers
yume190 Sep 14, 2026
97046f4
Fill plist defaults for keys the source plist cannot provide
yume190 Sep 14, 2026
25083b9
Clean only the directories bazelize owns in the output
yume190 Sep 14, 2026
e850b72
Leave CFBundlePackageType to rules_apple
yume190 Sep 14, 2026
5826ff0
Expose framework-style include paths for module headers
yume190 Sep 14, 2026
41ef886
Move the iOS fixture and CI onto the roadmap output flow
yume190 Sep 14, 2026
03ac7fb
Pin exact package versions to the revision Xcode resolved
yume190 Sep 14, 2026
8cef721
Resolve package products Xcode attaches to build files
yume190 Sep 14, 2026
ea0ccd0
Mirror Xcode's flat framework Headers directory
yume190 Sep 14, 2026
92e81ce
Escape quotes and backslashes in Starlark strings
yume190 Sep 14, 2026
06dc3be
Generate Swift asset symbols with actool
yume190 Sep 14, 2026
d2b7c08
Add the Targets root to include paths
yume190 Sep 14, 2026
124f926
Support GCC_PREPROCESSOR_DEFINITIONS
yume190 Sep 14, 2026
4061f60
Honor OTHER_LDFLAGS
yume190 Sep 14, 2026
3a7d5c5
Do not link sibling applications and tools into a bundle
yume190 Sep 14, 2026
0018387
Resolve entitlements into the generated tree
yume190 Sep 14, 2026
85633b5
Expand a variant group into its localized files
yume190 Sep 14, 2026
19d6184
Bundle a target's resources
yume190 Sep 14, 2026
974646f
Fall back when a version is not a version
yume190 Sep 14, 2026
36eeb2f
Support GCC_PREFIX_HEADER
yume190 Sep 14, 2026
923c378
Link a test bundle against its host
yume190 Sep 14, 2026
5f72033
Bundle a framework's and an extension's resources too
yume190 Sep 14, 2026
640fb5a
Filter an Objective-C library's deps like the others
yume190 Sep 14, 2026
7681b10
Embed the frameworks Xcode copies into a bundle
yume190 Sep 14, 2026
23d6d30
Bundle a macOS app extension
yume190 Sep 14, 2026
9816419
Copy the products a bundle's copy phases embed
yume190 Sep 14, 2026
842aefb
Copy the files a bundle's copy phases place in it
yume190 Sep 14, 2026
cd1d7cc
Default to propagating an imported framework's module map
yume190 Sep 15, 2026
569e2ce
Import a project's own dylib by path
yume190 Sep 15, 2026
820da1e
Drop the bundle identifier default for a target without one
yume190 Sep 15, 2026
97da3cf
Declare the SDK frameworks Objective-C sources import
yume190 Sep 15, 2026
2792101
Declare a nib once
yume190 Sep 15, 2026
390d95c
Bundle a macOS XPC service
yume190 Sep 15, 2026
14a0651
Expand a build setting's default modifier
yume190 Sep 15, 2026
90721c2
Generate nothing for a target with no sources
yume190 Sep 15, 2026
803d074
Patch rules_swift_package_manager in the generated workspace
yume190 Sep 16, 2026
94fc3c4
Pass a plain preprocessor definition as a -D copt
yume190 Sep 16, 2026
46111f3
Honor SWIFT_ACTIVE_COMPILATION_CONDITIONS
yume190 Sep 16, 2026
bcf06ec
Drop an unresolvable plist key from the target's own Info.plist
yume190 Sep 16, 2026
694065f
Honor SWIFT_DEFAULT_ACTOR_ISOLATION
yume190 Sep 16, 2026
f19577b
Generate the strings filegroup for an app extension
yume190 Sep 16, 2026
6c239bc
Patch SwiftSetting.defaultIsolation into rules_swift_package_manager
yume190 Sep 16, 2026
969174d
Emit the rules_swift_package_manager patches only for the release the…
yume190 Sep 16, 2026
e903888
Treat a resource wrapper's contents as the wrapper
yume190 Sep 16, 2026
1e46365
Patch a local archive binary target into rules_swift_package_manager
yume190 Sep 16, 2026
625de6c
Pin swift-package-manager to the toolchain's release
yume190 Sep 16, 2026
a58b81f
Move swift-package-manager to 6.4.0
yume190 Sep 16, 2026
a8542b7
Add the roadmap for generating SwiftPM build files
yume190 Sep 16, 2026
84728fe
Reach a Swift package product through //Packages
yume190 Sep 16, 2026
9a00ab1
Record the package facade in the roadmap
yume190 Sep 16, 2026
969b455
Record the SwiftPM feature survey in the roadmap
yume190 Sep 16, 2026
b12e8e2
Let a swift_library declare developer search paths and tags
yume190 Sep 16, 2026
ec5bf54
Generate the rules for a pure-Swift package from its manifest
yume190 Sep 16, 2026
bed74fb
Describe generating the Swift package rules in docs
yume190 Sep 16, 2026
71194c7
Generate rules for the remaining kinds of package target
yume190 Sep 16, 2026
f063aee
Keep SwiftPM's working directory out of the Bazel workspace
yume190 Sep 16, 2026
b801b4d
Default the device families of an iOS bundle
yume190 Sep 16, 2026
63a1425
Build an Xcode target's library through its bundle rule
yume190 Sep 16, 2026
d2749b7
Generate package rules the whole corpus builds with
yume190 Sep 16, 2026
614857e
Record what stage 2 generates and what it costs
yume190 Sep 16, 2026
f3a14c7
Drop rules_swift_package_manager
yume190 Sep 16, 2026
e9ec479
Describe the single path the package rules take now
yume190 Sep 16, 2026
94464cc
Drop the resolve and tidy steps from the fixture and CI
yume190 Sep 16, 2026
6d47e43
Compile a package's shaders against its own headers
yume190 Sep 16, 2026
06ac102
Reach a C-family package target's module through its headers
yume190 Sep 16, 2026
320ffcc
Link and compile only what a build file's platform filter allows
yume190 Sep 16, 2026
19d1622
Name a module the way the target's own sources import it
yume190 Sep 16, 2026
ee9c17e
Say which platform version a package is compiled at
yume190 Sep 16, 2026
632aa73
Describe how a package's platform version is decided
yume190 Sep 16, 2026
45095ce
Generate a package's macro as a compiler plugin
yume190 Sep 17, 2026
2a47179
Expand a macro in the iOS fixture
yume190 Sep 17, 2026
eb14e4e
Record that a package's macro is generated
yume190 Sep 17, 2026
02bda56
Say which plugin a package asked for and did not get
yume190 Sep 17, 2026
3a15d15
Record that a plugin is named rather than run
yume190 Sep 17, 2026
02af148
Report only a platform version a package actually declares
yume190 Sep 17, 2026
4eced38
Build a package's command line tool as a binary
yume190 Sep 17, 2026
4fd2115
Build a tool target in the iOS fixture
yume190 Sep 17, 2026
18765a1
Record how a tool is generated and what running a plugin would take
yume190 Sep 17, 2026
c690809
Tell a command plugin apart from a build tool plugin
yume190 Sep 17, 2026
45b0927
Take a Swift package as the thing to bazelize
yume190 Sep 17, 2026
effa10d
Run a package's tests, with the sources its plugins generate
yume190 Sep 17, 2026
7d3b572
Describe the package input and how plugins are run
yume190 Sep 17, 2026
5b78664
Mirror a package's sources when they link back into themselves
yume190 Sep 17, 2026
a3b9dda
Copy a package's resources to where it copies them
yume190 Sep 17, 2026
f61687d
Bundle a package test's resources by running it as a test bundle
yume190 Sep 17, 2026
bc3e7cb
Take a package's local paths from the caller that wrote them
yume190 Sep 18, 2026
b7ea30a
Say which plugins did not run, and why
yume190 Sep 18, 2026
d95bd16
Split what a build tool plugin produced the way SwiftPM does
yume190 Sep 18, 2026
3c44576
Generate more than Swift from the fixture's plugin
yume190 Sep 18, 2026
97c6bdc
Describe how a plugin's output is split, and what stays in the output
yume190 Sep 18, 2026
e92e9a6
Fill in the build settings Xcode answers for
yume190 Sep 18, 2026
0a4e628
Record that registry packages are not implemented
yume190 Sep 18, 2026
dbcd583
Keep a plugin's output where the plugin wrote it
yume190 Sep 18, 2026
466ef29
Retire the first Xcode parser and give its name to the second
yume190 Sep 19, 2026
d5029fc
Remove the CocoaPods module and finish spelling Xcode
yume190 Sep 19, 2026
e37a1a6
Resolve nothing when a project has no packages
yume190 Sep 19, 2026
742d83d
Compare real paths when a file is placed under the project
yume190 Sep 19, 2026
31ff22c
Build the corpus from the artifact in CI
yume190 Sep 19, 2026
1a894ac
Say what SwiftPM said when a plugin does not run
yume190 Sep 19, 2026
d632059
Keep the fixture's plugin running on the toolchain CI has
yume190 Sep 19, 2026
1865467
Write down what CI does not run, and why
yume190 Sep 19, 2026
2c58518
Run a package's build tool plugins as their host
yume190 Sep 19, 2026
a78062a
Give the workspace its own way to run its plugins
yume190 Sep 19, 2026
5785fcc
Follow the plugin host in CI
yume190 Sep 19, 2026
d3c3db5
Cache what a corpus lane downloads, not only what it builds
yume190 Sep 19, 2026
5c87f9a
Clear the old output out of the iOS fixture
yume190 Sep 19, 2026
b5044d0
Boot one simulator before the fixture's tests, and run them one at a …
yume190 Sep 19, 2026
1c50aae
Use the simulator the runner has, and clone before restoring a cache
yume190 Sep 19, 2026
d522d54
Have Bazel build the plugins, and run them from the workspace
yume190 Sep 20, 2026
0b7be4d
Take the macro, the tool and the plugin back out of the iOS fixture
yume190 Sep 20, 2026
0f6fa62
Declare the plugins group for every project with packages
yume190 Sep 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
295 changes: 256 additions & 39 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,12 @@ concurrency:
cancel-in-progress: true

jobs:
lint:
runs-on: macos-26
steps:
- uses: actions/checkout@v6

- name: swiftformat --lint
run: |
swiftformat --lint --config .swiftformat .
build:
runs-on: macos-26

steps:
- uses: actions/checkout@v6

- name: Check Cocoapod Version
run: pod --version

- name: Check Cocoapod Path
run: which pod

- name: Update Cocoapod Repo
run: pod repo update

# - name: Get Pod Spec
# run: pod spec cat --regex Bagel --version=1.4.0

- name: Check Xcode Version
run: |
xcodebuild -version
Expand Down Expand Up @@ -99,13 +79,23 @@ jobs:
steps:
- uses: actions/checkout@v6

- name: Bazel iOS Cache
# Every `bazel` in this job reads these: the disk cache holds what the
# build produced, the repository cache what it downloaded. Without the
# second one a runner fetches rules_apple and the rest again every time.
- name: Bazel Cache
uses: actions/cache@v5
with:
path: fixture/iOS/cache
key: ${{ runner.os }}-IntegrateIOS-fixture-ios-${{ hashFiles('**/fixture/iOS/WORKSPACE') }}
path: |
~/bazel-disk
~/bazel-repo
key: ${{ runner.os }}-bazel-IntegrateIOS-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-IntegrateIOS-fixture-ios-
${{ runner.os }}-bazel-IntegrateIOS-

- name: Bazel Cache Settings
run: |
echo "build --disk_cache=$HOME/bazel-disk" >> ~/.bazelrc
echo "build --repository_cache=$HOME/bazel-repo" >> ~/.bazelrc

- name: Download Bazelize
uses: actions/download-artifact@v8
Expand All @@ -118,35 +108,262 @@ jobs:
pwd
chmod +x bazelize

# A plugin that did not run leaves the target missing the sources it
# generates, and the compile error that follows names those sources rather
# than the plugin. The run says so; the lane stops there.
- name: Bazel Generation
working-directory: fixture/iOS
run: |
../../bazelize --project Example.xcodeproj

- name: Update SPM Deps
working-directory: fixture/iOS
run: |
bazel mod tidy
../../bazelize --project Example.xcodeproj --output App | tee bazelize.log
! grep -q "did not run the" bazelize.log

- name: Build Application
working-directory: fixture/iOS
working-directory: fixture/iOS/App
run: |
bazel build Example
bazel build //Targets/Example

- name: Copy IPA
working-directory: fixture/iOS
working-directory: fixture/iOS/App
run: |
cp "$(bazel cquery //Targets/Example --output=files | grep '\.ipa$')" ../Example.ipa

# A simulator test on a runner pays for booting the simulator, and four of
# them booting at once pay for it four times over: the first test took
# 247s here and the last timed out at 302s having never started. One
# simulator is booted up front, outside any test's clock, and the tests
# run one at a time so they share it.
#
# Which simulator is the runner's business, not ours: it has whatever
# runtime its Xcode ships, which is not the one this repository is
# developed against.
- name: Boot Simulator
run: |
cp bazel-bin/Example/Example.ipa .
# A device name has spaces in it, so one field per line.
{ read -r device; read -r version; read -r udid; } < <(python3 - <<'PY'
import json, subprocess

def simctl(*arguments):
listed = subprocess.run(["xcrun", "simctl", "list", "-j", *arguments], capture_output=True, text=True)
return json.loads(listed.stdout)

runtimes = [runtime for runtime in simctl("runtimes")["runtimes"]
if runtime["identifier"].startswith("com.apple.CoreSimulator.SimRuntime.iOS")
and runtime.get("isAvailable")]
runtimes.sort(key=lambda runtime: [int(part) for part in runtime["version"].split(".")])
runtime = runtimes[-1]

devices = [device for device in simctl("devices", "available")["devices"].get(runtime["identifier"], [])
if device["name"].startswith("iPhone")]
if devices:
name, udid = devices[-1]["name"], devices[-1]["udid"]
else:
kinds = [kind for kind in simctl("devicetypes")["devicetypes"] if kind["name"].startswith("iPhone")]
name = kinds[-1]["name"]
created = subprocess.run(
["xcrun", "simctl", "create", name, kinds[-1]["identifier"], runtime["identifier"]],
capture_output=True, text=True)
udid = created.stdout.strip()

print(name)
print(runtime["version"])
print(udid)
PY
)
echo "Simulator: $device, iOS $version ($udid)"
echo "SIMULATOR_DEVICE=$device" >> "${GITHUB_ENV:-/dev/null}"
echo "SIMULATOR_VERSION=$version" >> "${GITHUB_ENV:-/dev/null}"
xcrun simctl boot "$udid" || true
xcrun simctl bootstatus "$udid"

- name: Unit Test
working-directory: fixture/iOS
working-directory: fixture/iOS/App
run: |
bazel test ExampleTests Framework1Tests Framework2Tests Framework3Tests
bazel test \
--@build_bazel_rules_apple//apple/build_settings:ios_simulator_device="$SIMULATOR_DEVICE" \
--@build_bazel_rules_apple//apple/build_settings:ios_simulator_version="$SIMULATOR_VERSION" \
--local_test_jobs=1 \
--test_timeout=900 \
--test_output=errors \
//Targets/ExampleTests \
//Targets/Framework1Tests \
//Targets/Framework2Tests \
//Targets/Framework3Tests

- name: Upload iOS Artifact
uses: actions/upload-artifact@v7
with:
name: iOS_Example.ipa
path: fixture/iOS/Example.ipa
if-no-files-found: ignore # 'warn' or 'ignore'

if-no-files-found: ignore # 'warn' or 'ignore'

# The corpus is not in this repository: `app/` and `spm/` are ignored, so each
# lane clones what it measures at the revision it was measured against.
IntegrateApp:
runs-on: macos-26
needs: [artifact]
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
include:
- name: stats
repo: https://github.com/exelban/stats
rev: b4251e2ba05511de6b51b296d7b9e98a9c6545f5
project: Stats.xcodeproj
target: //Targets/Stats
- name: MonitorControl
repo: https://github.com/MonitorControl/MonitorControl
rev: 71b8c5ae51955d17b05688371ea7b899b684bdbd
project: MonitorControl.xcodeproj
target: //Targets/MonitorControl
- name: SwiftBar
repo: https://github.com/swiftbar/SwiftBar
rev: 05cb6cb1123bc7227ee2b39f390f8bccb839fed0
project: SwiftBar.xcodeproj
target: //Targets/SwiftBar
- name: Rectangle
repo: https://github.com/rxhanson/Rectangle
rev: b4c9c47c00b4df9cbfb3489dc5eae2f1249ad24a
project: Rectangle.xcodeproj
target: //...
- name: VirtualBuddy
repo: https://github.com/insidegui/VirtualBuddy
rev: 088351b0fc67e0b24b83e7954ad48314dda4ce04
project: VirtualBuddy.xcodeproj
target: //Targets/VirtualBuddy
# Not yet green on a runner, so not yet a lane. iina is the app the
# notes still list an open problem for, and MacPass needs its
# submodules and a Carthage bootstrap that nothing here has proven.
# - name: iina
# repo: https://github.com/iina/iina
# rev: c111221ea027466b79b40bfca054772d4851e06f
# project: iina.xcodeproj
# target: //Targets/iina
# - name: MacPass
# repo: https://github.com/MacPass/MacPass
# rev: 3256bc93ea94eb20b618c155e6a1b08e6fabe663
# project: MacPass.xcodeproj
# target: //Targets/MacPass
# submodules: true
# setup: carthage bootstrap --platform macOS --cache-builds
steps:
# The disk cache holds what a build produced, the repository cache what it
# downloaded, and `.build` what SwiftPM resolved for the app's packages:
# generation resolves that graph before a single rule is written.
- name: Bazel Cache
uses: actions/cache@v5
with:
path: |
~/bazel-disk
~/bazel-repo
key: ${{ runner.os }}-bazel-${{ matrix.name }}-${{ matrix.rev }}-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-bazel-${{ matrix.name }}-${{ matrix.rev }}-
${{ runner.os }}-bazel-${{ matrix.name }}-

- name: Bazel Cache Settings
run: |
echo "build --disk_cache=$HOME/bazel-disk" >> ~/.bazelrc
echo "build --repository_cache=$HOME/bazel-repo" >> ~/.bazelrc

- name: Download Bazelize
uses: actions/download-artifact@v8
with:
name: bazelize

- name: Clone ${{ matrix.name }}
run: |
chmod +x bazelize
git clone --filter=blob:none "${{ matrix.repo }}" "${{ matrix.name }}"
git -C "${{ matrix.name }}" checkout --detach "${{ matrix.rev }}"

# After the clone: a restored cache would otherwise create the directory
# `git clone` insists on creating itself.
- name: SwiftPM Cache
uses: actions/cache@v5
with:
path: ${{ matrix.name }}/App/.build
key: ${{ runner.os }}-spm-${{ matrix.name }}-${{ matrix.rev }}
restore-keys: |
${{ runner.os }}-spm-${{ matrix.name }}-

- name: Check out submodules
if: matrix.submodules
working-directory: ${{ matrix.name }}
run: git submodule update --init --recursive

- name: Set up ${{ matrix.name }}
if: matrix.setup
working-directory: ${{ matrix.name }}
run: ${{ matrix.setup }}

- name: Bazel Generation
run: |
./bazelize --project "${{ matrix.name }}/${{ matrix.project }}" --output "${{ matrix.name }}/App" | tee bazelize.log
! grep -q "did not run the" bazelize.log

- name: Build Application
working-directory: ${{ matrix.name }}/App
run: bazel build ${{ matrix.target }}

# A package whose tests only compile through a source its own build tool
# plugin generates. The plugin and its tool are built by Bazel, so this
# holds on a toolchain that cannot load the package with SwiftPM at all.
IntegratePackage:
runs-on: macos-26
needs: [artifact]
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- name: TbCodeGenerater
repo: https://github.com/yume190/TbCodeGenerater
rev: b7071d5e67189f48d5d71e06225dd1cb02470995
target: //Packages/TbCodeGenerater/...
steps:
- name: Bazel Cache
uses: actions/cache@v5
with:
path: |
~/bazel-disk
~/bazel-repo
key: ${{ runner.os }}-bazel-${{ matrix.name }}-${{ matrix.rev }}-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-bazel-${{ matrix.name }}-${{ matrix.rev }}-
${{ runner.os }}-bazel-${{ matrix.name }}-

- name: Bazel Cache Settings
run: |
echo "build --disk_cache=$HOME/bazel-disk" >> ~/.bazelrc
echo "build --repository_cache=$HOME/bazel-repo" >> ~/.bazelrc

- name: Download Bazelize
uses: actions/download-artifact@v8
with:
name: bazelize

- name: Clone ${{ matrix.name }}
run: |
chmod +x bazelize
git clone --filter=blob:none "${{ matrix.repo }}" "${{ matrix.name }}"
git -C "${{ matrix.name }}" checkout --detach "${{ matrix.rev }}"

# The package's directory name is the directory its rules live under, so
# the clone is named after the package rather than after the lane.
# Generation runs the plugins with what it has, which on this toolchain is
# not enough to build the plugin's tool — `//:plugins` is what builds the
# plugin and the tool with Bazel and runs them, so that is what the lane
# checks. Nothing else is regenerated: the rules glob the directory.
- name: Bazel Generation
run: ./bazelize --project "${{ matrix.name }}" --output "${{ matrix.name }}/App"

- name: Run Plugins
working-directory: ${{ matrix.name }}/App
run: |
PATH="$GITHUB_WORKSPACE:$PATH" bazel run //:plugins

- name: Test Package
working-directory: ${{ matrix.name }}/App
run: bazel test ${{ matrix.target }}

11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,13 @@ cache/

.codex-local-skills/
.vendor/
app/
app/
spm/
Generated/

# bazelize output inside the iOS fixture: one directory, the one `make bazelize`
# writes
fixture/iOS/App/

# running a local package's build tool plugins resolves that package
fixture/iOS/Local1/Package.resolved
32 changes: 9 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,30 +30,16 @@ build: format

.PHONY: test
test:
swift test -v --skip CocoapodTests 2>&1 | xcpretty
# COCOAPOD=$(shell which pod) swift test -v 2>&1 | xcbeautify

Apple := bazelbuild/rules_apple
Swift := bazelbuild/rules_swift
XCodeProj := buildbuddy-io/rules_xcodeproj
REPOS := Apple Swift XCodeProj

SPM := cgrindel/rules_swift_package_manager
REPO_SPM := SPM


# user/repo rule_name output_file_path
# python3 git_release.py bazelbuild/rules_apple Apple Sources/BazelizeKit/Rule/Rule+Apple.swift
$(REPOS):
python3 git_release.py $($@) $@ Sources/BazelizeKit/Repo/Repo+$@.swift 5 normal

$(REPO_SPM):
python3 git_release.py $($@) $@ Sources/BazelizeKit/Repo/Repo+$@.swift 5 archive

rules: $(REPOS)

spm: $(REPO_SPM)
swift test -v 2>&1 | xcpretty

.PHONY: bazelize
bazelize: install
cd fixture/iOS && make bazelize

.PHONY: update-repo-enums
update-repo-enums:
swift package plugin --allow-network-connections all --allow-writing-to-package-directory repo-enum

.PHONY: replace
replace: update-repo-enums
cp Generated/*.swift Sources/BazelizeKit/BazelDep/
Loading