forked from ReSwift/ReSwift
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pin SwiftLint using CocoaPods (ReSwift#218)
* Centralize SwiftLint logic in Build Phase script * Add a Podfile to fetch SwiftLint * Add script with the steps to integrate SwiftLint The main reason for this is that there's no way to only fetch pods without touching the project file. For our purposes though the project file should not be touched, we are only interested in the SwiftLint binary being fetched. So what we can do is just undo all the changes made to the project by CocoaPods. * Move script to install SwiftLint in scripts folder I didn't notice there was one before looking at GitHub. Also changed the script name to match the others in the folder. * Use repo naming convention for script to run SwiftLint * Use dummy target for SwiftLint integration This approach is more robust that having to rely on developers to remembre to run the installation script, and at the same time doesn't pollute the actual ReSwift targets with unnecessary CocoaPods build phases and imports. * Track xcworkspace See ReSwift#218 (comment) * Allow spaces in sourceroot directory Quotes the commands for running swiftlint to allow `$SRCROOT` to contain directories with spaces. * Update swiftlint warning to refer to cocoapods Instead of telling user to run install-swiftlint which no longer exists. * Update swiftlint to latest We also don't need to pin the version in the `Podfile`, since `Podfile.lock` pins for us on `pod install`. This allows the upgrade process to be just `pod update`, instead of having to manually update the version in the Podfile. * Add note on SwiftLint + CocoaPods setup in README
- Loading branch information
Showing
9 changed files
with
272 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
swiftlint="$SRCROOT/Pods/SwiftLint/swiftlint" | ||
|
||
if [ -f "$swiftlint" ]; then | ||
"$swiftlint" | ||
else | ||
echo 'warning: Cannot find SwiftLint in the expected location. If you are developing ReSwift please install it via `pod install`. If you are building ReSwift as a dependency of your project feel free to ignore this.' | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# CocoaPods is used only to fetch and pin the version of SwiftLint that we want | ||
# to use in the project. The Podfile DSL (at the time of CP 1.2.0) requires | ||
# pods to be defined within a target. To work with that without having to make | ||
# any of the actual ReSwift targets dirty or bloated a dummy target called | ||
# SwiftLintIntegration has been added. | ||
target 'SwiftLintIntegration' do | ||
pod 'SwiftLint' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
PODS: | ||
- SwiftLint (0.17.0) | ||
|
||
DEPENDENCIES: | ||
- SwiftLint | ||
|
||
SPEC CHECKSUMS: | ||
SwiftLint: 9fb1dd71d5952d130f8c2fb60ae2e1475cf5d575 | ||
|
||
PODFILE CHECKSUM: 937d436496e317ef5f238fab841c0529d8f5d201 | ||
|
||
COCOAPODS: 1.2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>en</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>BNDL</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleVersion</key> | ||
<string>1</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// SwiftLintIntegration.swift | ||
// SwiftLintIntegration | ||
// | ||
// Created by Gio on 17/3/17. | ||
// Copyright © 2017 Benjamin Encz. All rights reserved. | ||
// | ||
|
||
// | ||
// SwiftLintIntegration is a dummy target that is present in the project only to enable us to fetch | ||
// SwiftLint via CocoaPods. | ||
// | ||
// Rather than polluting the actual ReSwift targets with extra CP realted BuildPhases and imports, | ||
// we shove all that in this target here. | ||
// |