-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from artemnovichkov/lint
Lint
- Loading branch information
Showing
7 changed files
with
226 additions
and
76 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
|
@@ -34,7 +34,7 @@ $ carting update -s MyBestScript | |
|
||
If there is no script with the name, Carting will add a new one. | ||
|
||
Since Xcode 10 Run Script build phases support declaring input and output files in a `.xcfilelist` file. This file should contain a newline-separated list of the file paths for the inputs or outputs. Carting uses it by default. If you need to work with your projects in old Xcode versions, use `-f file` option. | ||
Since Xcode 10 Run Script Phases support declaring input and output files in a `.xcfilelist` file. This file should contain a newline-separated list of the file paths for the inputs or outputs. Carting uses it by default. If you need to work with your projects in old Xcode versions, use `-f file` option. | ||
|
||
**🚨Note**: be sure to have no uncommitted changes in project file to prevent project parsing errors 😱. | ||
|
||
|
@@ -50,10 +50,23 @@ OVERVIEW: 🚘 Simple tool for updating Carthage script phase | |
USAGE: Carting <command> <options> | ||
|
||
SUBCOMMANDS: | ||
info Prints Carthage frameworks list with linking description. | ||
update Adds a new script with input/output file paths or updates the script named `Carthage`. | ||
info Prints Carthage frameworks list with linking description. | ||
lint Lint the project for missing paths. | ||
update Adds a new script with input/output file paths or updates the script named `Carthage`. | ||
``` | ||
|
||
## Linting | ||
|
||
Integrate Carting into an Xcode scheme to get errors displayed in the IDE. Just add a new "Run Script Phase" with: | ||
|
||
```bash | ||
/usr/local/bin/carting lint | ||
``` | ||
|
||
<p align="center"> | ||
<img src=".github/phase.png" max-width="90%" alt="Run Script Phase" /> | ||
</p> | ||
|
||
## Installing | ||
|
||
### Homebrew (recommended): | ||
|
@@ -86,20 +99,6 @@ let package = Package( | |
] | ||
) | ||
``` | ||
### Marathon | ||
|
||
- Install [Marathon](https://github.com/johnsundell/marathon#installing). | ||
- Add Carting to Marathon using `$ marathon add [email protected]:artemnovichkov/carting.git`. Alternatively, add `[email protected]:artemnovichkov/carting.git` to your `Marathonfile`. | ||
- Write your script, then run it using `$ marathon run <path-to-your-script>`. | ||
|
||
## Todo | ||
- [x] Add option for adding new script | ||
- [x] Add support of multiple targets | ||
- [x] Add check of linked frameworks | ||
- [x] Unify errors | ||
- [x] Check correct work with workspaces | ||
- [ ] Write tests | ||
|
||
## Author | ||
|
||
Artem Novichkov, [email protected] | ||
|
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,49 @@ | ||
// | ||
// Copyright © 2019 Artem Novichkov. All rights reserved. | ||
// | ||
|
||
import SPMUtility | ||
import CartingCore | ||
import Foundation | ||
|
||
final class LintCommand: Command { | ||
|
||
var command = "lint" | ||
var overview = "Lint the project for missing paths." | ||
|
||
private let name: OptionArgument<String> | ||
private let projectPath: OptionArgument<String> | ||
private let format: OptionArgument<Format> | ||
private let targetName: OptionArgument<String> | ||
|
||
private lazy var frameworkInformationService: FrameworkInformationService = .init() | ||
|
||
required init(parser: ArgumentParser) { | ||
let subparser = parser.add(subparser: command, overview: overview) | ||
name = subparser.add(option: "--script", | ||
shortName: "-s", | ||
usage: "The name of Carthage script.") | ||
projectPath = subparser.add(option: "--path", | ||
shortName: "-p", | ||
usage: "The project directory path.", | ||
completion: .filename) | ||
format = subparser.add(option: "--format", | ||
shortName: "-f", | ||
usage: "Format of input/output file paths: file - using simple paths, list - using xcfilelists", | ||
completion: Format.completion) | ||
targetName = subparser.add(option: "--target", | ||
shortName: "-t", | ||
usage: "The name of target.") | ||
} | ||
|
||
func run(with arguments: ArgumentParser.Result) throws { | ||
let name = arguments.get(self.name) ?? "Carthage" | ||
let projectPath = arguments.get(self.projectPath) ?? ProcessInfo.processInfo.environment["PROJECT_DIR"] | ||
let format = arguments.get(self.format) ?? .list | ||
let targetName = arguments.get(self.targetName) ?? ProcessInfo.processInfo.environment["TARGET_NAME"] | ||
frameworkInformationService.projectPath = projectPath | ||
try frameworkInformationService.lintScript(withName: name, | ||
format: format, | ||
targetName: targetName) | ||
} | ||
} |
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
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
Oops, something went wrong.