Skip to content

First version of Public API #825

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 62 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
115f2b0
Added public api
rofle100lvl Sep 30, 2024
1424b59
Fixed periphery scan
rofle100lvl Sep 30, 2024
a8d6264
Update deps
ileitch Nov 1, 2024
a39f097
Update changelog
ileitch Nov 1, 2024
194aa2d
Improve Bazel integration (#833)
ileitch Dec 13, 2024
b210f12
Fix help handling
ileitch Dec 13, 2024
50dbc43
Disable external override bug workaround in >= 6.1
ileitch Dec 14, 2024
6c42ee1
Update linters
ileitch Dec 14, 2024
2978b8e
Migrate some tasks to Mise
ileitch Dec 14, 2024
29fd326
Ensure Bazel rules are updated (#835)
ileitch Dec 14, 2024
87fc6e9
Add Linux baseline (#836)
ileitch Dec 14, 2024
f04b575
Remove support for Swift 5.9 (#837)
ileitch Dec 14, 2024
9e116cc
Update Bazel deps
ileitch Dec 14, 2024
1fb8984
Create bazel archive in release script
ileitch Dec 14, 2024
a9eeaf9
Release 3.0.0.beta5
ileitch Dec 14, 2024
81bc8b9
Bazel tweaks
ileitch Dec 14, 2024
48cbbaa
Release 3.0.0.beta6
ileitch Dec 14, 2024
1afe5a4
Fix Bazel bin path
ileitch Dec 15, 2024
accd674
Improve handling of working directory for Bazel (#838)
ileitch Dec 15, 2024
d61eecf
Release 3.0.0.beta7
ileitch Dec 15, 2024
623d149
Bazel ignore .release
ileitch Dec 16, 2024
5dfd43f
Fix generated Bazel repo naming (#843)
ileitch Dec 16, 2024
1390d13
Release 3.0.0.beta8
ileitch Dec 16, 2024
1f9a5e0
Remove pristine shell env (#844)
ileitch Dec 16, 2024
a75b243
Simplify Bazel support
ileitch Dec 17, 2024
3e120ac
Specify periphery binary location as target
ileitch Dec 17, 2024
408b546
Release 3.0.0.beta9
ileitch Dec 17, 2024
b45fc8f
Output stderr for failed commands. Closes #629 #840 (#847)
ileitch Dec 18, 2024
a46a253
Add support for Swift Testing (#848)
ileitch Dec 18, 2024
ed0a874
Add Bazel support to guided setup (#851)
ileitch Dec 19, 2024
7a265ed
Add option to select --retain-objc-annotated to setup guide
ileitch Dec 19, 2024
4b190d8
Sponsor plug
ileitch Dec 19, 2024
aa5594d
Update Linux baseline (#853)
ileitch Dec 21, 2024
f02459d
Add Xcode 16.2 to test matrix (#834)
ileitch Dec 21, 2024
bbc67cb
Update to actions/cache@v4 (#854)
ileitch Dec 21, 2024
5009ad4
Invoke all commands in Bash (#855)
ileitch Dec 22, 2024
eb2b39f
Add Linux docker setup (#852)
ileitch Dec 26, 2024
9f07403
Migrate release script to mise
ileitch Dec 26, 2024
c7661fd
v3 README (#857)
ileitch Dec 27, 2024
2c970b2
Release 3.0.0
ileitch Dec 27, 2024
d5feabd
Don't throw an error when a source file does not exist, closes #858 (…
ileitch Dec 28, 2024
7a7fa35
Release 3.0.1
ileitch Dec 28, 2024
870dfea
Improve Bazel setup instructions (#861)
ileitch Dec 30, 2024
174afcb
Move Bazel instructions to their own section
ileitch Dec 30, 2024
f2ddb6a
Add dev_dependency attr to Bazel usage
ileitch Jan 3, 2025
6ebc6ff
Mark prefix, postfix, and infix operators as function results (#878)
jszumski Feb 14, 2025
933c8c5
Fix warnings in Xcode 16.2 (#879)
jszumski Feb 14, 2025
adfd9ea
Fixes issue where comment commands are ignored for import statements …
jszumski Feb 14, 2025
48063c3
Add the ability to add comment commands on the same line as an import…
jszumski Feb 14, 2025
2c3e535
Update deps (#884)
ileitch Mar 3, 2025
ff14772
Update changelog
ileitch Mar 3, 2025
69555c1
Release 3.0.2
ileitch Mar 3, 2025
fba769b
Modified folder structure of artifact bundle (#886)
coffmark Mar 15, 2025
1fc094d
Test release binary during release
ileitch Mar 15, 2025
b916cd9
Release 3.0.3
ileitch Mar 15, 2025
5c77476
Allow inline comment commands on most declarations (#891)
jszumski Mar 26, 2025
81d2fb5
Ignore unused parameters in universally unavailable functions. Closes…
ileitch Mar 29, 2025
f7d52a0
Enable Bazel cache (#897)
ileitch Mar 29, 2025
e6bf1e4
Add task to write Linux baseline
ileitch Mar 30, 2025
6aeae1d
Fix handling of Xcode projects with quotes in their path and scheme n…
ileitch Mar 30, 2025
0d42e0f
Retain '@_dynamicReplacement' members. Closes #874 (#899)
ileitch Mar 30, 2025
3318436
Apply Linux baseline
ileitch Mar 30, 2025
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
4 changes: 4 additions & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.build
.git
.mise
.release
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.3.0
8.1.1
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.git/
.build/
.swiftpm/
.release/
bazel-*
docker/
50 changes: 31 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -9,28 +9,45 @@ env:
swift_package_resolve: swift package resolve
swift_build: swift build
swift_test: swift test
periphery_scan: ./.build/debug/periphery scan --quiet --clean-build
periphery_scan: ./.build/debug/periphery scan --quiet --clean-build --strict
cache_version: 1
jobs:
lint:
runs-on: macos-14
runs-on: macos-15
name: Lint
steps:
- uses: actions/checkout@master
- uses: jdx/mise-action@v2
- run: mise run lint-ci
bazel:
runs-on: macos-15
name: Bazel
steps:
- uses: actions/checkout@master
- uses: jdx/mise-action@v2
- uses: bazel-contrib/setup-bazel@0.14.0
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}
repository-cache: true
- name: Check generated rules
run: mise r gen-bazel-rules && git diff --quiet --exit-code
- name: Scan
run: bazel run //:periphery -- scan --bazel --quiet --strict --baseline baselines/bazel.json
macOS:
strategy:
fail-fast: false
matrix:
xcode: ["16.0", "15.4", "15.2"]
xcode: ["16.2", "16.1", "16.0", "15.4"]
include:
- xcode: "16.2"
macos: macos-15
- xcode: "16.1"
macos: macos-15
- xcode: "16.0"
macos: macos-14
macos: macos-15
- xcode: "15.4"
macos: macos-14
- xcode: "15.2"
macos: macos-14
runs-on: ${{ matrix.macos }}
name: macOS
steps:
@@ -44,7 +61,7 @@ jobs:
shell: bash
- name: Cache resolved dependencies
id: cache-resolved-dependencies
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |
.build
@@ -58,50 +75,45 @@ jobs:
- name: Build
run: ${{ env.swift_build }}
- name: Scan
run: ${{ env.periphery_scan }} --strict
run: ${{ env.periphery_scan }}
- name: Test
run: ${{ env.swift_test }}
linux:
strategy:
fail-fast: false
matrix:
swift: ["6.0", "5.10", "5.9"]
swift: ["6.0", "5.10"]
include:
- swift: "6.0"
container: "swift:6.0"
cache-version: 1
- swift: "5.10"
container: "swift:5.10"
cache-version: 1
- swift: "5.9"
container: "swift:5.9"
cache-version: 1
runs-on: ubuntu-20.04
container: ${{ matrix.container }}
name: Linux
steps:
- uses: actions/checkout@master
- name: Get Swift Version
id: get-swift-version
run: |
echo "::set-output name=version::$(swift -version | head -n 1 | sed s/,// )"
shell: bash
- uses: actions/checkout@master
- name: Cache resolved dependencies
id: cache-resolved-dependencies
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |
.build
Package.resolved
key: ${{ matrix.cache-version }}-${{ runner.os }}-${{ steps.get-swift-version.outputs.version }}-${{ env.cache_version }}-spm-deps-${{ hashFiles('Package.swift', 'Package.resolved') }}
key: ${{ runner.os }}-${{ steps.get-swift-version.outputs.version }}-${{ env.cache_version }}-spm-deps-${{ hashFiles('Package.swift', 'Package.resolved') }}
restore-keys: |
${{ matrix.cache-version }}-${{ runner.os }}-${{ steps.get-swift-version.outputs.version }}-${{ env.cache_version }}-spm-deps-
${{ runner.os }}-${{ steps.get-swift-version.outputs.version }}-${{ env.cache_version }}-spm-deps-
- name: Resolve dependencies
if: steps.cache-resolved-dependencies.outputs.cache-hit != 'true'
run: ${{ env.swift_package_resolve }}
- name: Build
run: ${{ env.swift_build }}
- name: Scan
run: ${{ env.periphery_scan }}
run: ${{ env.periphery_scan }} --baseline baselines/linux.json
- name: Test
run: ${{ env.swift_test }}
4 changes: 2 additions & 2 deletions .mise.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[tools]
swiftformat = "0.54.3"
swiftlint = "0.56.2"
swiftformat = "0.55.3"
swiftlint = "0.57.1"
18 changes: 18 additions & 0 deletions .mise/tasks/benchmark
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
#USAGE flag "-b --bazel" help="Use binary built by Bazel"

set -eo pipefail

cmd=""

if [ "$usage_bazel" = "true" ]; then
echo "INFO: Using Bazel"
bazel build //:periphery
cmd='bazel-bin/Sources/Frontend_opt scan --config /var/tmp/periphery_bazel/periphery.yml --generic-project-config bazel-bin/external/+generated+periphery_generated/rule/project_config.json'
else
mise r build --arch arm64
cmd='./.build/release/periphery scan --quiet --skip-build'
fi

echo $cmd
hyperfine --warmup 3 "${cmd}"
37 changes: 37 additions & 0 deletions .mise/tasks/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
#USAGE flag "--arch <arch>" help="Build architecture (x86_64, arm64, release)"

set -eo pipefail

SWIFT_BUILD_FLAGS="--product periphery --configuration release --disable-sandbox --scratch-path .build"
EXECUTABLE_X86_64="$(swift build ${SWIFT_BUILD_FLAGS} --arch x86_64 --show-bin-path)/periphery"
EXECUTABLE_ARM64="$(swift build ${SWIFT_BUILD_FLAGS} --arch arm64 --show-bin-path)/periphery"

build_x86_64() {
swift build ${SWIFT_BUILD_FLAGS} --arch x86_64
}

build_arm64() {
swift build ${SWIFT_BUILD_FLAGS} --arch arm64
}

if [ "$usage_arch" = "x86_64" ]; then
echo "Building for x86_64"
build_x86_64
echo ${EXECUTABLE_X86_64}
elif [ "$usage_arch" = "arm64" ]; then
echo "Building for arm64"
build_arm64
echo ${EXECUTABLE_ARM64}
elif [ "$usage_arch" = "release" ]; then
echo "Building for release"
build_x86_64
build_arm64
mkdir -p .release
lipo -create -output .release/periphery ${EXECUTABLE_X86_64} ${EXECUTABLE_ARM64}
strip -rSTX .release/periphery
echo "$(realpath .release/periphery)"
else
echo "Invalid architecture. Use --arch <arch> where <arch> is x86_64, arm64 or release"
exit 1
fi
5 changes: 5 additions & 0 deletions .mise/tasks/gen-bazel-rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

set -euo pipefail

ruby .mise/tasks/scripts/gen_bazel_rules.rb
3 changes: 2 additions & 1 deletion .mise/tasks/lint
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/bin/bash
# mise description="Lint the project"

set -euo pipefail

cd $MISE_PROJECT_ROOT

bazel run //bazel/dev:buildifier.fix
swiftformat .
swiftlint lint --quiet
3 changes: 2 additions & 1 deletion .mise/tasks/lint-ci
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/bin/bash
# mise description="Lint the project for CI"

set -euo pipefail

cd $MISE_PROJECT_ROOT

bazel run //bazel/dev:buildifier.check
swiftformat --quiet --strict .
swiftlint lint --quiet --strict
56 changes: 34 additions & 22 deletions scripts/release → .mise/tasks/release
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ confirm () {
green "$1 (y/n): "
read answer

if [ $answer != "y" ]
if [ "$answer" != "y" ]
then
exit 0
fi
@@ -38,44 +38,64 @@ confirm "\nContinue?"
rm -rf .release
mkdir .release

cat scripts/Version.swift.template | sed s/__VERSION__/${version}/ > Sources/Frontend/Version.swift
cat scripts/artifactbundle_info.json.template | sed s/__VERSION__/${version}/ > .release/info.json
cat .mise/tasks/scripts/Version.swift.template | sed s/__VERSION__/${version}/ > Sources/Frontend/Version.swift
cat .mise/tasks/scripts/artifactbundle_info.json.template | sed s/__VERSION__/${version}/ > .release/info.json
ruby -e "file = 'MODULE.bazel'; content = File.read(file); content.sub!(/version = \".+?\"/, 'version = \"${version}\"'); File.write(file, content)"

echo -e "\nUpdate CHANGELOG.md"
confirm "Continue?"

make build_release
mise r build --arch release

if [ ! -f .release/periphery ]; then
echo "ERROR: Missing release binary?"
exit 1
fi

cp BUILD.bazel MODULE.bazel LICENSE.md .release/
cp -R bazel .release/
cp scripts/release_notes.md.template .release/release_notes.md
echo "Testing release binary..."
for i in {1..3}; do
.release/periphery scan --strict
done

cp LICENSE.md MODULE.bazel BUILD.bazel .release/
cp -R bazel Sources .release/
rm -r .release/bazel/dev
cp .mise/tasks/scripts/release_notes.md.template .release/release_notes.md

confirm "\nContinue?"

# Codesign
cd .release
codesign periphery

# Archive
zip_filename="periphery-${version}.zip"
zip -r "${zip_filename}" periphery LICENSE.md MODULE.bazel BUILD.bazel bazel
zip -r "${zip_filename}" periphery LICENSE.md
codesign "${zip_filename}"

echo -e "\n${zip_filename} checksum:"
sha256=$( shasum -a 256 ${zip_filename} | awk '{print $1}' )
echo ${sha256}

macos_artifact="periphery-${version}-macos"
artifactbundle="periphery-${version}.artifactbundle"
zip_artifactbundle="periphery-${version}.artifactbundle.zip"
zip "${zip_artifactbundle}" periphery LICENSE.md info.json

mkdir -p ${macos_artifact}/bin
cp periphery ${macos_artifact}/bin
mkdir ${artifactbundle}
cp -R ${macos_artifact} LICENSE.md info.json ${artifactbundle}
zip -r "${zip_artifactbundle}" periphery-${version}.artifactbundle
codesign "${zip_artifactbundle}"

echo -e "\n${zip_artifactbundle} checksum:"
artifactbundle_sha256=$( shasum -a 256 ${zip_artifactbundle} | awk '{print $1}' )
echo ${artifactbundle_sha256}

bazel_zip_filename="periphery-bazel-${version}.zip"
zip -r "${bazel_zip_filename}" LICENSE.md MODULE.bazel BUILD.bazel bazel Sources
codesign "${bazel_zip_filename}"

# Notarize
notarize "${zip_filename}"
notarize "${zip_artifactbundle}"
@@ -105,16 +125,8 @@ if [[ ${version} == *"beta"* ]]; then
fi

cd ..
gh release create --latest="${is_latest}" -F .release/release_notes.md "${version}" ".release/${zip_filename}" ".release/${zip_artifactbundle}"

# Homebrew
if [ $is_latest = false ]; then
echo "Not releasing beta to Homebrew."
else
cd ../homebrew-periphery
cat periphery.rb.template | sed s/__VERSION__/${version}/ | sed s/__SHA256__/${sha256}/ > Casks/periphery.rb
git add Casks/periphery.rb
git commit -m "${version}"
git push origin master
cd ../periphery
fi
gh release create --latest="${is_latest}" -F .release/release_notes.md "${version}" ".release/${zip_filename}" ".release/${zip_artifactbundle}" ".release/${bazel_zip_filename}"

echo "Next steps:"
echo "* Update Homebrew formula"
echo "* Update Bazel Central Registry"
6 changes: 6 additions & 0 deletions .mise/tasks/scan
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -euo pipefail

swift build
./.build/debug/periphery scan "$@"
7 changes: 7 additions & 0 deletions .mise/tasks/scan-linux
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -e

export DOCKER_CLI_HINTS=false
docker build -t periphery -f docker/Dockerfile.linux .
docker run --rm -t periphery scan "$@" --baseline baselines/linux.json
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
"type": "executable",
"variants": [
{
"path": "periphery",
"path": "periphery-__VERSION__-macos/bin/periphery",
"supportedTriples": ["x86_64-apple-macosx", "arm64-apple-macosx"]
}
]
Loading