Skip to content
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

Feature/000001 swiftlint run script #20

Merged
merged 18 commits into from
Jul 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ jobs:
install:
- wget --output-document /tmp/SwiftLint.pkg https://github.com/realm/SwiftLint/releases/download/0.33.1/SwiftLint.pkg && sudo installer -pkg /tmp/SwiftLint.pkg -target /
script:
- swiftlint
- swiftlint --config configs/.swiftlint.yml
- swift test
- swift build
- xcodebuild -scheme ClaretCacheDemo -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone XR,OS=12.1' build
- xcodebuild -workspace ClaretCacheDemo.xcworkspace -scheme ClaretCacheDemo -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone XR,OS=12.1' build
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ClaretCacheDemo换为通配符:${PROJECT_NAME}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

会在下一个pr中提交

# stages:
# - Lint
# - Test
23 changes: 23 additions & 0 deletions BuildScripts/lint.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env xcrun --sdk macosx swift

import Foundation

func run(targetPath: String) {
let relativePath = CommandLine.arguments[0] as NSString
print(relativePath)
let configFilePath = relativePath.deletingLastPathComponent + "/../configs/.swiftlint.yml"
let configFileUrl = URL(fileURLWithPath: configFilePath)
let configPath = configFileUrl.path
let launchPath = relativePath.deletingLastPathComponent.components(separatedBy: "/..").first! + "/../Pods/SwiftLint/swiftlint"

let process = Process()
process.launchPath = launchPath
process.arguments = ["lint", "--config", configPath, "--path", targetPath]
process.launch()
process.waitUntilExit()

let status = process.terminationStatus
exit(status)
}

run(targetPath: CommandLine.arguments[1])
Loading