Skip to content

Instantly share code, notes, and snippets.

@uhooi
Last active December 5, 2022 15:59
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save uhooi/730c7aa286e730b392796a159e4d75f5 to your computer and use it in GitHub Desktop.
Save uhooi/730c7aa286e730b392796a159e4d75f5 to your computer and use it in GitHub Desktop.
XcodeGen project spec sample
name: {Project Name}
options:
bundleIdPrefix: {Bundle ID Prefix}
deploymentTarget:
iOS: 13.0
xcodeVersion: "11.3.1" # 変わらない?
# findCarthageFrameworks: true # 余計なフレームワークまで追加されてしまうためコメントアウト
carthageExecutablePath: mint run Carthage/Carthage carthage
targets:
{Project Name}:
type: application
platform: iOS
sources:
- {Project Name}
- path: "{Project Name}/Generated/MockResults.swift"
optional: true
type: file
- path: "{Project Name}/Generated/R.generated.swift"
optional: true
type: file
settings:
base:
INFOPLIST_FILE: {Project Name}/Info.plist
# PRODUCT_BUNDLE_IDENTIFIER: {Bundle ID Prefix}.{Project Name} # `bundleIdPrefix` を指定しない場合はコメントイン
CODE_SIGN_ENTITLEMENTS: Foo/Foo.entitlements
dependencies:
- carthage: Alamofire
- carthage: Moya
- carthage: ReactiveMoya
- carthage: ReactiveSwift
- carthage: RxCocoa
- carthage: RxMoya
- carthage: RxRelay
- carthage: RxSwift
preBuildScripts:
- script: |
"$PODS_ROOT/R.swift/rswift" generate "$SRCROOT/$TARGET_NAME/Generated/R.generated.swift"
name: Generate Resources with R.swift
inputFiles:
- $TEMP_DIR/rswift-lastrun
outputFiles:
- $SRCROOT/$TARGET_NAME/Generated/R.generated.swift
- script: |
if which mint >/dev/null; then
rm -f $SRCROOT/$TARGET_NAME/Generated/MockResults.swift
mint run mockolo mockolo --sourcedirs $SRCROOT/$TARGET_NAME --destination $SRCROOT/$TARGET_NAME/Generated/MockResults.swift
else
echo "warning: Mint not installed, download from https://github.com/yonaskolb/Mint"
fi
name: Generate Mocks with Mockolo
outputFiles:
- $SRCROOT/$TARGET_NAME/Generated/MockResults.swift
postCompileScripts:
- script: |
if which mint >/dev/null; then
mint run swiftlint swiftlint autocorrect --format
mint run swiftlint swiftlint
else
echo "warning: Mint not installed, download from https://github.com/yonaskolb/Mint"
fi
name: Run SwiftLint
- script: |
if ! which mint >/dev/null; then
echo "warning: Mint not installed, download from https://github.com/yonaskolb/Mint"
exit 0
fi
git_path=/usr/local/bin/git
files=$($git_path diff --diff-filter=d --name-only -- "*.swift" "*.h" "*.m")
if (test -z $files) || (test ${#files[@]} -eq 0); then
echo "no files changed."
exit 0
fi
options=""
for file in $files
do
options="$options $SRCROOT/$file"
done
mint run SpellChecker SpellChecker --yml $SRCROOT/spell-checker.yml -- $options
name: Run SpellChecker
{Project Name}Tests:
type: bundle.unit-test
platform: iOS
sources:
- {Project Name}Tests
settings:
base:
INFOPLIST_FILE: {Project Name}Tests/Info.plist
# PRODUCT_BUNDLE_IDENTIFIER: {Bundle ID Prefix}.{Project Name}Tests
dependencies:
- target: {Project Name}
{Project Name}UITests:
type: bundle.ui-testing
platform: iOS
sources:
- {Project Name}UITests
settings:
base:
INFOPLIST_FILE: {Project Name}UITests/Info.plist
# PRODUCT_BUNDLE_IDENTIFIER: {Bundle ID Prefix}.{Project Name}UITests
dependencies:
- target: {Project Name}
schemes:
{Project Name}:
build:
targets:
{Project Name}: all
# {Project Name}Tests: [test] # デフォルト?
# {Project Name}UITests: [test] # デフォルト?
run:
config: Debug
test:
config: Debug
gatherCoverageData: true
coverageTargets:
- {Project Name}
targets:
- name: {Project Name}Tests
parallelizable: true
randomExecutionOrder: true
- name: {Project Name}UITests
parallelizable: true
randomExecutionOrder: true
profile:
config: Release
analyze:
config: Debug
archive:
config: Release
@kkebo
Copy link

kkebo commented Jun 4, 2020

参考になりました.ちなみに xcodeVersion

xcodeVersion: "11.3.1"

のように文字列で指定する必要がありますよ.

@uhooi
Copy link
Author

uhooi commented Jun 4, 2020

@kkk669 Qiitaに加えてこちらのご指摘もありがとうございますー!
修正しました。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment