Skip to content

Commit 1869051

Browse files
Shubham Panchalgreenrobot-team
authored andcommitted
merge Sourcery 2.2.6 into 320-update-sourcery
2 parents 5415c12 + 8320551 commit 1869051

File tree

843 files changed

+66327
-88971
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

843 files changed

+66327
-88971
lines changed

.circleci/config.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,28 @@ version: 2
33
jobs:
44
test:
55
macos:
6-
xcode: "11.4.1"
6+
xcode: "14.3.1"
77
environment:
8-
- XCODE_WORKSPACE: Sourcery.xcworkspace
9-
- XCODE_PROJECT: Sourcery.xcodeproj
10-
- XCODE_SCHEME: Sourcery
11-
- BUNDLE_JOBS: 3
12-
- BUNDLE_RETRY: 3
13-
- BUNDLE_PATH: vendor/bundle
8+
BUNDLE_JOBS: 3
9+
BUNDLE_RETRY: 3
10+
BUNDLE_PATH: vendor/bundle
1411
shell: /bin/bash --login -eo pipefail
1512
steps:
1613
- checkout
14+
- run: sudo defaults write com.apple.dt.Xcode IDEPackageSupportUseBuiltinSCM YES
15+
- run: rm ~/.ssh/id_rsa || true
16+
- run: for ip in $(dig @8.8.8.8 bitbucket.org +short); do ssh-keyscan bitbucket.org,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts || true
17+
- run: for ip in $(dig @8.8.8.8 github.com +short); do ssh-keyscan github.com,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts || true
1718
- run: brew update 1> /dev/null 2> /dev/null
1819
- run: brew install sourcekitten
19-
- run: echo "ruby-2.6" > ~/.ruby-version
20+
- run: brew install coreutils
21+
- run: echo "ruby-3.0.6" > ~/.ruby-version
2022
- run: bundle install
2123
- run: bundle exec rake validate_docs
2224
- run: bundle exec danger || true
2325
- run: set -o pipefail
2426
- run: bundle exec rake build
2527
- run: bundle exec rake tests
26-
- run: swift build && .build/x86_64-apple-macosx/debug/sourcery --sources SourceryRuntime/Sources --templates Templates/Templates --output SourceryRuntime/Sources --ejsPath SourceryJS/Sources/ejs.js
27-
- run: bundle exec slather coverage --scheme "$XCODE_SCHEME" --workspace "$XCODE_WORKSPACE" --output-directory $CIRCLE_ARTIFACTS --binary-basename SourceryRuntime --binary-basename Sourcery --cobertura-xml Sourcery.xcodeproj || true
28-
- run: bash <(curl -s https://codecov.io/bash) -f $CIRCLE_ARTIFACTS/cobertura.xml -X coveragepy -X gcov -X xcode
29-
3028
workflows:
3129
version: 2
3230
build-test:

.github/workflows/bump_homebrew.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Bump Homebrew formula
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag-name:
7+
description: 'The git tag name to bump the formula to'
8+
required: true
9+
10+
jobs:
11+
homebrew:
12+
name: Bump Homebrew formula
13+
runs-on: macos-13
14+
steps:
15+
- uses: mislav/bump-homebrew-formula-action@v3
16+
with:
17+
formula-name: sourcery
18+
tag-name: ${{ github.event.inputs.tag-name }}
19+
env:
20+
COMMITTER_TOKEN: ${{ secrets.HOMEBREW_COMMITTER_TOKEN }}

.github/workflows/docker.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Docker
2+
3+
permissions:
4+
contents: read
5+
packages: write
6+
7+
on:
8+
push:
9+
branches:
10+
- master
11+
tags:
12+
- '*'
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-22.04
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
21+
- name: Extract DOCKER_TAG using tag name
22+
if: startsWith(github.ref, 'refs/tags/')
23+
run: |
24+
echo "DOCKER_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
25+
26+
- name: Use default DOCKER_TAG
27+
if: startsWith(github.ref, 'refs/tags/') != true
28+
run: |
29+
echo "DOCKER_TAG=latest" >> $GITHUB_ENV
30+
31+
- name: Set lowercase repository name
32+
run: |
33+
echo "REPOSITORY_LC=${REPOSITORY,,}" >>${GITHUB_ENV}
34+
env:
35+
REPOSITORY: '${{ github.repository }}'
36+
37+
- name: Set up Docker Buildx
38+
uses: docker/setup-buildx-action@v1
39+
40+
- name: Login to GitHub registry
41+
uses: docker/login-action@v1
42+
with:
43+
username: ${{ github.actor }}
44+
password: ${{ secrets.GITHUB_TOKEN }}
45+
registry: ghcr.io
46+
47+
- uses: docker/build-push-action@v2
48+
with:
49+
push: true
50+
tags: ghcr.io/${{ env.REPOSITORY_LC }}:${{ env.DOCKER_TAG }}

.github/workflows/jazzy.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# This workflow will build a Swift project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift
3+
4+
name: rake docs
5+
6+
on:
7+
workflow_call:
8+
workflow_dispatch:
9+
inputs:
10+
ref:
11+
description: 'Ref to build (branch, tag or SHA)'
12+
required: false
13+
default: 'master'
14+
push:
15+
branches: [ "master" ]
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
20+
21+
jobs:
22+
update_docs:
23+
runs-on: macos-14
24+
steps:
25+
- name: Set Xcode 15.3.0
26+
run: sudo xcode-select -s /Applications/Xcode_15.3.0.app/Contents/Developer
27+
- name: Print Current Xcode
28+
run: xcode-select -p
29+
- uses: actions/checkout@v3
30+
- name: Update Docs
31+
run: |
32+
brew install coreutils
33+
brew install sourcekitten
34+
bundle install
35+
rake docs
36+
- uses: EndBug/[email protected]
37+
with:
38+
add: '.'
39+
message: 'Update Docs'
40+
committer_name: GitHub Actions
41+
committer_email: [email protected]
42+
43+

.github/workflows/release_macOS.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: release macOS
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
ref:
7+
description: 'Ref to build (branch, tag or SHA)'
8+
required: false
9+
default: 'master'
10+
push:
11+
tags:
12+
- '*'
13+
14+
jobs:
15+
tests:
16+
uses: ./.github/workflows/test_macOS.yml
17+
build:
18+
needs: [tests]
19+
name: Build Sourcery for macOS
20+
runs-on: macos-14
21+
steps:
22+
- name: Set Xcode 15.3.0
23+
run: sudo xcode-select -s /Applications/Xcode_15.3.0.app/Contents/Developer
24+
- name: Print Current Xcode
25+
run: xcode-select -p
26+
- uses: actions/checkout@v3
27+
with:
28+
ref: ${{ github.event.inputs.ref }}
29+
- name: Build it
30+
id: build
31+
run: |
32+
brew install coreutils
33+
brew install sourcekitten
34+
bundle install
35+
rake docs
36+
37+
CLI_DIR="${HOME}/cli/"
38+
RESOURCES_DIR="${CLI_DIR}Resources/"
39+
TEMPLATES_DIR="${CLI_DIR}Templates/"
40+
BUILD_DIR="${HOME}/build/"
41+
BIN_DIR="${CLI_DIR}bin/"
42+
ARTIFACT_BUNDLE_PATH="${HOME}/artifactbundle/"
43+
path_to_sourcery_binary="${BIN_DIR}/sourcery"
44+
45+
mkdir -p $BIN_DIR
46+
mkdir -p $RESOURCES_DIR
47+
mkdir -p $TEMPLATES_DIR
48+
mkdir -p ${ARTIFACT_BUNDLE_PATH}bin
49+
50+
cp -r docs/docsets/Sourcery.docset $CLI_DIR
51+
cp -r "Templates/Templates/" $TEMPLATES_DIR
52+
cp Resources/daemon.gif $RESOURCES_DIR
53+
cp Resources/icon-128.png $RESOURCES_DIR
54+
cp CHANGELOG.md $CLI_DIR
55+
cp README.md $CLI_DIR
56+
cp LICENSE $CLI_DIR
57+
58+
cp -r SourceryJS/Resources/ejs.js $BIN_DIR
59+
cp -r $CLI_DIR/ "${ARTIFACT_BUNDLE_PATH}sourcery"
60+
cp Templates/artifactbundle.info.json.template ${ARTIFACT_BUNDLE_PATH}/info.json
61+
62+
swift build --disable-sandbox -c release --arch arm64 --build-path $BUILD_DIR
63+
swift build --disable-sandbox -c release --arch x86_64 --build-path $BUILD_DIR
64+
lipo -create -output $path_to_sourcery_binary ${BUILD_DIR}arm64-apple-macosx/release/sourcery ${BUILD_DIR}x86_64-apple-macosx/release/sourcery
65+
strip -rSTX ${path_to_sourcery_binary}
66+
67+
cp $path_to_sourcery_binary "${ARTIFACT_BUNDLE_PATH}sourcery/bin/"
68+
69+
pushd $CLI_DIR
70+
TAG=$GITHUB_REF_NAME
71+
FILENAME="sourcery-$TAG.zip"
72+
zip -r -X $FILENAME .
73+
mv $FILENAME "${HOME}/"
74+
popd
75+
76+
pushd $ARTIFACT_BUNDLE_PATH
77+
sed -i '' "s/VERSION/${TAG}/g" ${ARTIFACT_BUNDLE_PATH}/info.json
78+
ARTIFACTBUNDLENAME=$FILENAME.artifactbundle.zip
79+
zip -r -X $ARTIFACTBUNDLENAME .
80+
mv $ARTIFACTBUNDLENAME "${HOME}/"
81+
popd
82+
83+
echo "FILENAME=${FILENAME}" >> $GITHUB_OUTPUT
84+
echo "ARTIFACTBUNDLENAME=${ARTIFACTBUNDLENAME}" >> $GITHUB_OUTPUT
85+
- name: 'Upload Sourcery Artifact'
86+
uses: actions/upload-artifact@v3
87+
with:
88+
name: ${{ steps.build.outputs.FILENAME }}
89+
path: "~/${{ steps.build.outputs.FILENAME }}"
90+
retention-days: 5
91+
- name: 'Upload Bundle Artifact'
92+
uses: actions/upload-artifact@v3
93+
with:
94+
name: ${{ steps.build.outputs.ARTIFACTBUNDLENAME }}
95+
path: "~/${{ steps.build.outputs.ARTIFACTBUNDLENAME }}"
96+
retention-days: 5

.github/workflows/release_ubuntu.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: release ubuntu
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
ref:
7+
description: 'Ref to build (branch, tag or SHA)'
8+
required: false
9+
default: 'master'
10+
push:
11+
tags:
12+
- '*'
13+
14+
jobs:
15+
tests:
16+
uses: ./.github/workflows/test_ubuntu.yml
17+
build:
18+
needs: [tests]
19+
name: Build Sourcery for Ubuntu (latest)
20+
runs-on: ubuntu-22.04
21+
outputs:
22+
filename: ${{ steps.build.outputs.filename }}
23+
steps:
24+
- uses: actions/checkout@v3
25+
with:
26+
ref: ${{ github.event.inputs.ref }}
27+
- name: Setup Swift
28+
uses: swift-actions/setup-swift@v2
29+
with:
30+
swift-version: "5.10"
31+
- name: Build it
32+
id: build
33+
run: |
34+
BUILD_DIR="${HOME}/build/"
35+
swift build --disable-sandbox -c release --build-path $BUILD_DIR
36+
mv "${BUILD_DIR}x86_64-unknown-linux-gnu/release/sourcery" "${BUILD_DIR}/sourcery"
37+
38+
UNAME=$(uname -m)
39+
CODENAME=$(lsb_release -c -s)
40+
DESCRIPTION=$(lsb_release -d -s | sed "s/ /-/g" | sed "s/./\L&/g")
41+
SUFFIX=$DESCRIPTION-$CODENAME-$UNAME
42+
TAG=$GITHUB_REF_NAME
43+
FILENAME="sourcery-${TAG}-${SUFFIX}.tar.xz"
44+
45+
pushd $BUILD_DIR
46+
tar -zcvf $FILENAME sourcery
47+
mv $FILENAME "${HOME}/"
48+
popd
49+
50+
echo "FILENAME=${FILENAME}" >> $GITHUB_OUTPUT
51+
- name: 'Upload Artifact'
52+
uses: actions/upload-artifact@v3
53+
with:
54+
name: ${{ steps.build.outputs.FILENAME }}
55+
path: "~/${{ steps.build.outputs.FILENAME }}"
56+
retention-days: 5

.github/workflows/test_macOS.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This workflow will build a Swift project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift
3+
4+
name: test macOS
5+
6+
on:
7+
workflow_call:
8+
push:
9+
branches: [ "master" ]
10+
pull_request:
11+
branches: [ "master" ]
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: ${{ github.ref_type != 'tag' }}
16+
17+
jobs:
18+
macos_build:
19+
runs-on: macos-14
20+
steps:
21+
- name: Set Xcode 15.3.0
22+
run: sudo xcode-select -s /Applications/Xcode_15.3.0.app/Contents/Developer
23+
- name: Print Current Xcode
24+
run: xcode-select -p
25+
- uses: actions/checkout@v3
26+
- name: Run tests
27+
run: swift test
28+
29+

.github/workflows/test_ubuntu.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This workflow will build a Swift project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift
3+
4+
name: test ubuntu
5+
6+
on:
7+
workflow_call:
8+
push:
9+
branches: [ "master" ]
10+
pull_request:
11+
branches: [ "master" ]
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: ${{ github.ref_type != 'tag' }}
16+
17+
jobs:
18+
linux_build:
19+
runs-on: ubuntu-22.04
20+
steps:
21+
- name: Setup Swift
22+
uses: YOCKOW/Action-setup-swift@main
23+
with:
24+
swift-version: "5.10"
25+
- name: Get swift version
26+
run: swift --version
27+
- uses: actions/checkout@v3
28+
- name: Run tests
29+
run: swift test

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
build/
1616
bin/*
1717
!bin/sourcery
18+
cli/
1819
DerivedData/
1920
ObjectBoxToolTests/generated
2021

@@ -51,6 +52,7 @@ playground.xcworkspace
5152
Packages/
5253
Package.pins
5354
.build/
55+
.swiftpm/
5456

5557
# CocoaPods
5658
#
@@ -89,4 +91,8 @@ docs/undocumented.json
8991

9092
# IDEA based IDEs (AppCode, CLion) configuration
9193
.idea
92-
.vscode/
94+
95+
# Local binary distributions downloads
96+
distributions/
97+
98+
Sourcery.xcodeproj

0 commit comments

Comments
 (0)