Skip to content

Commit

Permalink
Get rid of brew
Browse files Browse the repository at this point in the history
Motivation: brew can't properly track versions
Install asciidoctor using ruby bundle
  • Loading branch information
nikitabobko committed Jul 21, 2024
1 parent 64971ab commit 936749f
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 30 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
strategy:
matrix:
# https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md
# https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md
os: [macos-13, macos-14]
name: Build
runs-on: ${{ matrix.os }}
Expand All @@ -27,7 +28,7 @@ jobs:
swift-exec-deps/.build
.deps
key: ${{ matrix.os }}-${{ runner.arch }}-${{ hashFiles('script/install-deps.sh', 'swift-exec-deps/Package.swift', 'swift-exec-deps/Package.resolved') }}
- run: brew bundle install
- run: brew install bash fish xcbeautify
- run: ./script/install-deps.sh
# "-" means "Sign to run locally". There is no aerospace-codesign-certificate in GH Actions
- run: ./build-debug.sh --codesign-identity -
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
/.shell-completion
/.site
/.man
/Brewfile.lock.json
# IDK, AppCode randomly creates this EMPTY file. I have no idea what this is
/default.profraw
.DS_Store
Expand Down
6 changes: 0 additions & 6 deletions Brewfile

This file was deleted.

6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# frozen_string_literal: true
ruby '~> 3.0' # >= 3.0 and < 4.0

source "https://rubygems.org"
gem 'asciidoctor', '2.0.23'
gem 'pygments.rb', '3.0'
19 changes: 19 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
GEM
remote: https://rubygems.org/
specs:
asciidoctor (2.0.23)
pygments.rb (3.0.0)

PLATFORMS
arm64-darwin-23
ruby

DEPENDENCIES
asciidoctor (= 2.0.23)
pygments.rb (= 3.0)

RUBY VERSION
ruby 3.3.4p94

BUNDLED WITH
2.5.11
4 changes: 2 additions & 2 deletions build-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ build-site() {
cd .site
# Delete "aerospace " prefifx in synopsis
sed -i -E '/tag::synopsis/, /end::synopsis/ s/^(aerospace | {10})//' aerospace*
asciidoctor ./*.adoc
bundler exec asciidoctor ./*.adoc
rm -rf ./*.adoc
rm -rf aerospace* # Drop man pages
cd - > /dev/null
Expand All @@ -32,7 +32,7 @@ build-site() {
build-man() {
cp-docs .man
cd .man
asciidoctor -b manpage aerospace*.adoc
bundler exec asciidoctor -b manpage aerospace*.adoc
rm -rf *.adoc
cd - > /dev/null
}
Expand Down
20 changes: 12 additions & 8 deletions dev-docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@ If you struggle to build AeroSpace locally, you can also refer to [builds in Git

## 1. Install dependencies

1. Install Xcode from App Store
2. Install remaining dependencies
```shell
git clone [email protected]:nikitabobko/AeroSpace.git
cd AeroSpace
brew bundle install
```
Install Xcode from App Store https://apps.apple.com/us/app/xcode/id497799835

If you want to build shell completion, install rust, bash and fish
- Install Rust using rustup. https://www.rust-lang.org/tools/install
- `brew install bash fish`

If you want to build man pages, install Ruby >= 3.0. I recommend using [rbenv](https://github.com/rbenv/rbenv).
- `rbenv install 3.3.4` (or whatever 3.x version)
- Install asciidoctor using Ruby `bundler`. `cd AeroSpace && bundler install`

Install optional `xcbeautify` to make Xcode build logs readable. `brew install xcbeautify`

## 2. Create codesign certificate

Expand All @@ -37,7 +41,7 @@ Signing the binary is required to preserve accessibility permission across rebui
- `run-tests.sh` - Run tests
- `run-debug.sh` - Run debug build of AeroSpace.app. It might be better to run debug build from Xcode.
- `run-cli.sh` - Run `aerospace` in CLI. Arguments are forwarded to `aerospace` binary
- `build-docs.sh` - Build the site and manpages to `.site` and `.man` dirs respectively
- `build-docs.sh` - Build the site and man pages to `.site` and `.man` dirs respectively
- `build-shell-completion.sh` - Build shell completion to `.shell-completion`
- `generate.sh` - Regenerate generated project files. `AeroSpace.xcodeproj` is generated, and some of the source files
(the source files have `Generated` suffix in their names)
Expand Down
4 changes: 4 additions & 0 deletions script/install-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,7 @@ if test $all == 1 || test $xcodegen == 1; then
(cd ./swift-exec-deps; swift run xcodegen --version)
fi
fi

if test $all == 1; then
bundle install
fi
18 changes: 7 additions & 11 deletions script/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@ set -o pipefail # Any command failed in the pipe fails the whole pipe
setup() {
mkdir -p .deps/bin
ln -fs "$(which cargo)" .deps/bin/cargo
ln -fs "$(which xcbeautify)" .deps/bin/xcbeautify
ln -fs "$(which fish)" .deps/bin/fish
ln -fs "$(which bundler)" .deps/bin/bundler # Ruby, asciidoc
ln -fs "$(which bash)" .deps/bin/bash # Ruby, asciidoc

export BREW_PREFIX="$(brew --prefix)"
tmp=(
${BREW_PREFIX}/opt/asciidoctor/bin
${BREW_PREFIX}/opt/xcodegen/bin
${BREW_PREFIX}/opt/xcbeautify/bin
${BREW_PREFIX}/opt/fishfish/bin
${BREW_PREFIX}/opt/bash/bin
${PWD}/.deps/bin
"${PWD}/.deps/bin"
/bin # cat
/usr/bin # xcodebuild, zip, arch
)
Expand All @@ -30,10 +28,8 @@ if [ -z "${SETUP_SH:-}" ]; then
setup
fi

brew() { "${BREW_PREFIX}/bin/brew" "$@"; }

if ! [ -f "${BREW_PREFIX}/opt/bash/bin/bash" ]; then
echo "Please install bash from homebrew" > /dev/stderr
if ! (bash --version | grep -q 'version 5'); then
echo "bash version is too old. At least version 5 is required" > /dev/stderr
exit 1
fi

Expand Down
1 change: 0 additions & 1 deletion swift-exec-deps/Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

Expand Down

0 comments on commit 936749f

Please sign in to comment.