Skip to content

Commit b9bb621

Browse files
committed
Merge branch 'deploy/0.6.2' into productive
2 parents 6b01bd6 + 0a70cfb commit b9bb621

18 files changed

+92
-31
lines changed

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,27 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
1717
### Security
1818
- None.
1919

20+
## [0.6.2] - 2019-06-20
21+
### Added
22+
- None.
23+
### Changed
24+
- None.
25+
### Deprecated
26+
- None.
27+
### Removed
28+
- None.
29+
### Fixed
30+
- Redownload dependencies as a fallback when previously checked out repositories are broken.
31+
Issue: [#27](https://github.com/JamitLabs/Accio/issues/27) | PR: [#40](https://github.com/JamitLabs/Accio/pull/40) | Author: [Frederick Pietschmann](https://github.com/fredpi)
32+
- Avoid misleading output when building via Carthage.
33+
Issue: [#56](https://github.com/JamitLabs/Accio/issues/56) | PR: [#57](https://github.com/JamitLabs/Accio/pull/57) | Author: [Frederick Pietschmann](https://github.com/fredpi)
34+
- Warn properly when no schemes can be found.
35+
PR: [#59](https://github.com/JamitLabs/Accio/pull/59) | Author: [Frederick Pietschmann](https://github.com/fredpi)
36+
- Remove duplicated processing of frameworks referenced by multiple other frameworks.
37+
Issue: [#51](https://github.com/JamitLabs/Accio/issues/51) | PR: [#53](https://github.com/JamitLabs/Accio/pull/53) | Author: [Frederick Pietschmann](https://github.com/fredpi)
38+
### Security
39+
- None.
40+
2041
## [0.6.1] - 2019-04-26
2142
### Added
2243
- Adds several popular GitHub projects for official integration support testing to the Demo project.

Formula/accio.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class Accio < Formula
22
desc "Dependency manager driven by SwiftPM for iOS/macOS/tvOS/watchOS"
33
homepage "https://github.com/JamitLabs/Accio"
4-
url "https://github.com/JamitLabs/Accio.git", :tag => "0.6.0", :revision => "cf48b7b7b1ea716e64eed06c55b36e2e0a24daa5"
4+
url "https://github.com/JamitLabs/Accio.git", :tag => "0.6.1", :revision => "6b01bd6458c71eb946402144d6c21e3a855aadac"
55
head "https://github.com/JamitLabs/Accio.git"
66

77
depends_on :xcode => ["10.2", :build]

Package.resolved

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ let package = Package(
1010
.library(name: "AccioKit", type: .dynamic, targets: ["AccioKit"])
1111
],
1212
dependencies: [
13-
.package(url: "https://github.com/Flinesoft/HandySwift.git", .upToNextMajor(from: "2.8.0")),
13+
.package(url: "https://github.com/Flinesoft/HandySwift.git", .upToNextMajor(from: "3.0.0")),
1414
.package(url: "https://github.com/onevcat/Rainbow.git", .upToNextMajor(from: "3.1.4")),
1515
.package(url: "https://github.com/jakeheis/SwiftCLI.git", .upToNextMajor(from: "5.2.2")),
1616
.package(url: "https://github.com/kareman/SwiftShell.git", .upToNextMajor(from: "4.1.2")),
17-
.package(url: "https://github.com/mrylmz/xcodeproj.git", .branch("master")),
17+
.package(url: "https://github.com/tuist/xcodeproj.git", .branch("master")),
1818
],
1919
targets: [
2020
.target(

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
alt="Codebeat Badge">
1414
</a>
1515
<a href="https://github.com/JamitLabs/Accio/releases">
16-
<img src="https://img.shields.io/badge/Version-0.6.1-blue.svg"
17-
alt="Version: 0.6.1">
16+
<img src="https://img.shields.io/badge/Version-0.6.2-blue.svg"
17+
alt="Version: 0.6.2">
1818
</a>
1919
<img src="https://img.shields.io/badge/Swift-5.0-FFAC45.svg"
2020
alt="Swift: 5.0">
@@ -29,6 +29,7 @@
2929
<p align="center">
3030
<a href="#installation">Installation</a>
3131
• <a href="#usage">Usage</a>
32+
• <a href="#adding-support-for-accio">Supporting Accio</a>
3233
• <a href="#contributing">Contributing</a>
3334
• <a href="#license">License</a>
3435
</p>
@@ -67,6 +68,14 @@ To **update** it to the latest version, run this instead:
6768
brew upgrade accio
6869
```
6970

71+
### Via [Mint](https://github.com/yonaskolb/Mint):
72+
73+
To **install** Accio or **update** to the latest version, run this command:
74+
75+
```bash
76+
mint install JamitLabs/Accio
77+
```
78+
7079
## Why should I use this?
7180

7281
**TL;DR**: It offers many improvements over Carthage and is targeted towards SwiftPM's integration into Xcode.
@@ -125,8 +134,6 @@ accio init -p "XcodeProjectName" -t "AppTargetName"
125134

126135
This step will create a template `Package.swift` file and set some `.gitignore` entries to keep your repository clean. Please note that if your source code files aren't placed within directories named after the targets, you will need to explicitly set the `path` parameters within the targets in the `Package.swift` file to the correct paths. Also note that the specified `path` must be a directory recursively containing at least one Swift file – but mixing with other languages like (Objective-)C(++) is not supported, so they shouldn't be within the specified directory. The files in there will not be built, they just need to exist in order for SwifPM to work properly, so you could point this anywhere Swift-only code.
127136

128-
Please note that you should not provide any test targets with the `-t` parameter of the `init` command. Add them manually to the `Package.swift` using `.testTarget` instead of `.target` since integration of frameworks needs to be done a little differently for test targets. See [this example](https://github.com/JamitLabs/NewProjectTemplate-iOS/blob/stable/Package.swift) manifest file for an always up-to-date real world reference. Alternatively, check the Demo projects [manifest file](https://github.com/JamitLabs/Accio/blob/stable/Demo/Package.swift).
129-
130137
Run `accio init help` to get a list of all available options.
131138

132139
#### Adding Dependencies
@@ -150,7 +157,7 @@ let package = Package(
150157
.package(url: "https://github.com/Flinesoft/HandyUIKit.git", .upToNextMajor(from: "1.9.1")),
151158
.package(url: "https://github.com/JamitLabs/MungoHealer.git", .upToNextMajor(from: "0.3.2")),
152159
.package(url: "https://github.com/SwiftyBeaver/SwiftyBeaver.git", from: "1.6.2"),
153-
.package(url: "https://github.com/radex/SwiftyUserDefaults.git", .branch("master")),
160+
.package(url: "https://github.com/radex/SwiftyUserDefaults.git", .upToNextMajor(from: "4.0.0")),
154161
],
155162
targets: [
156163
.target(

Sources/Accio/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Foundation
33
import SwiftCLI
44

55
// MARK: - CLI
6-
let cli = CLI(name: "accio", version: "0.6.1", description: "A dependency manager driven by SwiftPM that works for iOS/tvOS/watchOS/macOS projects.")
6+
let cli = CLI(name: "accio", version: "0.6.2", description: "A dependency manager driven by SwiftPM that works for iOS/tvOS/watchOS/macOS projects.")
77

88
cli.commands = [InitCommand(), InstallCommand(), UpdateCommand(), CleanCommand(), ClearCacheCommand(), SetSharedCacheCommand()]
99
cli.globalOptions.append(contentsOf: GlobalOptions.all)

Sources/AccioKit/Commands/Protocols/DependencyInstaller.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,14 @@ extension DependencyInstaller {
3434
let frameworkCheckoutPath: String = checkoutsDirUrl.appendingPathComponent(fileName).path
3535

3636
if try FileManager.default.isDirectory(atPath: frameworkCheckoutPath) {
37-
try bash("git -C '\(frameworkCheckoutPath)' reset HEAD --hard --quiet 2> /dev/null")
38-
try bash("git -C '\(frameworkCheckoutPath)' clean -fd --quiet 2> /dev/null")
39-
try bash("git -C '\(frameworkCheckoutPath)' clean -fdX --quiet 2> /dev/null")
37+
do {
38+
try GitResetService.shared.resetGit(atPath: frameworkCheckoutPath)
39+
}
40+
catch {
41+
// Remove checkout if git reset fails for some reason
42+
// If the checkout is missing, SPM will automatically clone again in the next step
43+
try bash("rm -rf '\(frameworkCheckoutPath)'")
44+
}
4045
}
4146
}
4247
}

Sources/AccioKit/Models/Framework.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ enum FrameworkError: Error {
55
case noSharedSchemes
66
}
77

8-
struct Framework {
8+
struct Framework: Equatable {
99
let projectName: String
1010
let libraryName: String
1111
let projectDirectory: String

Sources/AccioKit/Services/CachedBuilderService.swift

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ final class CachedBuilderService {
1212
func frameworkProducts(manifest: Manifest, appTarget: AppTarget, dependencyGraph: DependencyGraph, platform: Platform) throws -> [FrameworkProduct] {
1313
var frameworkProducts: [FrameworkProduct] = []
1414

15-
for framework in try appTarget.frameworkDependencies(manifest: manifest, dependencyGraph: dependencyGraph).flattenedDeepFirstOrder() {
15+
let frameworks = try appTarget.frameworkDependencies(manifest: manifest, dependencyGraph: dependencyGraph).flattenedDeepFirstOrder()
16+
let frameworksWithoutDuplicates: [Framework] = frameworks.reduce(into: []) { result, framework in
17+
if !result.contains(framework) { result.append(framework) }
18+
}
19+
20+
for framework in frameworksWithoutDuplicates {
1621
if let cachedFrameworkProduct = try frameworkCachingService.cachedProduct(framework: framework, platform: platform) {
1722
frameworkProducts.append(cachedFrameworkProduct)
1823
} else {
@@ -27,9 +32,7 @@ final class CachedBuilderService {
2732
frameworkProducts.append(frameworkProduct)
2833

2934
case .carthage:
30-
try bash("git -C '\(framework.projectDirectory)' reset HEAD --hard --quiet")
31-
try bash("git -C '\(framework.projectDirectory)' clean -fd --quiet")
32-
35+
try GitResetService.shared.resetGit(atPath: framework.projectDirectory, includeUntrackedFiles: false)
3336
let frameworkProduct = try carthageBuilderService.build(
3437
framework: framework,
3538
platform: platform,

Sources/AccioKit/Services/CarthageBuilderService.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@ final class CarthageBuilderService {
3131
try bash("ln -f -s '\(requiredFrameworkProduct.symbolsFilePath)' '\(productsTargetDirectoryUrl.path)'")
3232
}
3333

34+
// remove Cartfile before `carthage build` command as subdependencies have already been built via Accio
35+
try bash("rm -rf '\(framework.projectDirectory)/Cartfile'")
36+
try bash("rm -rf '\(framework.projectDirectory)/Cartfile.resolved'")
37+
3438
try XcodeProjectSchemeHandlerService.shared.removeUnnecessarySharedSchemes(from: framework, platform: platform)
39+
3540
try bash("/usr/local/bin/carthage build --project-directory '\(framework.projectDirectory)' --platform \(platform.rawValue) --no-skip-current --no-use-binaries")
3641

3742
let frameworkProduct = FrameworkProduct(libraryName: framework.libraryName, platformName: platform.rawValue)
@@ -43,9 +48,7 @@ final class CarthageBuilderService {
4348

4449
// revert any changes to prevent issues when removing checked out dependency
4550
try bash("rm -rf '\(framework.projectDirectory)/Carthage/Build'")
46-
try bash("git -C '\(framework.projectDirectory)' reset HEAD --hard --quiet 2> /dev/null")
47-
try bash("git -C '\(framework.projectDirectory)' clean -fd --quiet 2> /dev/null")
48-
try bash("git -C '\(framework.projectDirectory)' clean -fdX --quiet 2> /dev/null")
51+
try GitResetService.shared.resetGit(atPath: framework.projectDirectory)
4952

5053
guard FileManager.default.fileExists(atPath: frameworkProduct.frameworkDirPath) && FileManager.default.fileExists(atPath: frameworkProduct.symbolsFilePath) else {
5154
print("Failed to build products to \(platformBuildDir)/\(framework.libraryName).framework(.dSYM).", level: .error)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import Foundation
2+
3+
final class GitResetService {
4+
static let shared = GitResetService()
5+
6+
private init() { }
7+
8+
func resetGit(atPath directory: String, includeUntrackedFiles: Bool = true) throws {
9+
try bash("git -C '\(directory)' reset HEAD --hard --quiet 2> /dev/null")
10+
try bash("git -C '\(directory)' clean -fd --quiet 2> /dev/null")
11+
12+
if includeUntrackedFiles {
13+
try bash("git -C '\(directory)' clean -fdX --quiet 2> /dev/null")
14+
}
15+
}
16+
}

Sources/AccioKit/Services/XcodeProjectGeneratorService.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ final class XcodeProjectGeneratorService {
7676

7777
/// Swift 4.2 doesn't support the `platform` parameter in the Package manifest, thus read it from a comment with this method. Also ensure Swift 5 support.
7878
func platformToVersion(framework: Framework) throws -> [Platform: String] {
79-
let platformRegex = Regex(#"\.(iOS|macOS|tvOS|watchOS)\((?:"|.v)(\d+)[\._]?(\d+)?"?\)"#)
79+
let platformRegex = try Regex(#"\.(iOS|macOS|tvOS|watchOS)\((?:"|.v)(\d+)[\._]?(\d+)?"?\)"#)
8080

8181
let manifestPath: String = URL(fileURLWithPath: framework.projectDirectory).appendingPathComponent("Package.swift").path
8282
let manifestContents: String = try String(contentsOfFile: manifestPath)

Sources/AccioKit/Services/XcodeProjectIntegrationService.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,10 @@ final class XcodeProjectIntegrationService {
157157
print("Adding frameworks \(frameworkNames) to project navigator group '\(platformGroupName)' & linking with target '\(appTarget.targetName)' ...", level: .info)
158158

159159
for frameworkToAdd in frameworksToAdd {
160-
let frameworkFileRef = try targetGroup.addNewFile(
160+
let frameworkFileRef = try targetGroup.addFile(
161161
at: Path(frameworkToAdd.frameworkDirPath),
162-
sourceRoot: Path(workingDirectory)
162+
sourceRoot: Path(workingDirectory),
163+
override: false
163164
)
164165

165166
if let files = frameworksBuildPhase.files, !files.contains(where: { $0.file?.path == frameworkFileRef.path }) {

Sources/AccioKit/Services/XcodeProjectSchemeHandlerService.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ final class XcodeProjectSchemeHandlerService {
2626
let matchingSchemePaths: [String] = librarySchemePaths.filter { expectedSchemeNames.contains($0.fileNameWithoutExtension.lowercased()) }
2727
let matchingSchemeNames: [String] = matchingSchemePaths.map { $0.fileNameWithoutExtension }
2828

29+
guard !librarySchemePaths.isEmpty else {
30+
print("No shared scheme(s) found; still resuming build.", level: .warning)
31+
return
32+
}
33+
2934
if !matchingSchemePaths.isEmpty {
3035
let schemePathsToRemove: [String] = sharedSchemePaths.filter { !matchingSchemePaths.contains($0) }
3136
print("Found shared scheme(s) \(matchingSchemeNames) matching specified library – removing others: \(schemePathsToRemove.map { $0.fileNameWithoutExtension })", level: .verbose)

Tests/AccioKitTests/Models/AppTargetTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class AppTargetTests: XCTestCase {
1919
.package(url: "https://github.com/Flinesoft/HandyUIKit.git", .upToNextMajor(from: "1.9.0")),
2020
.package(url: "https://github.com/Flinesoft/Imperio.git", .upToNextMajor(from: "3.0.0")),
2121
.package(url: "https://github.com/JamitLabs/MungoHealer.git", .upToNextMajor(from: "0.3.0")),
22-
.package(url: "https://github.com/Moya/Moya.git", .revision("43209d6ac45d244d8be08f4cf6df684b96190616")),
22+
.package(url: "https://github.com/Moya/Moya.git", .upToNextMajor(from: "13.0.1")),
2323
],
2424
targets: [
2525
.target(

Tests/AccioKitTests/Models/FrameworkTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class FrameworkTests: XCTestCase {
1616
products: [],
1717
dependencies: [
1818
.package(url: "https://github.com/Flinesoft/HandySwift.git", .upToNextMajor(from: "2.8.0")),
19-
.package(url: "https://github.com/Moya/Moya.git", .revision("43209d6ac45d244d8be08f4cf6df684b96190616")),
19+
.package(url: "https://github.com/Moya/Moya.git", .upToNextMajor(from: "13.0.1")),
2020
.package(url: "https://github.com/ReactiveX/RxSwift.git", .upToNextMajor(from: "4.0.0")),
2121
],
2222
targets: [

Tests/AccioKitTests/Models/ManifestTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class ManifestTests: XCTestCase {
1919
.package(url: "https://github.com/Flinesoft/HandyUIKit.git", .upToNextMajor(from: "1.9.0")),
2020
.package(url: "https://github.com/Flinesoft/Imperio.git", .upToNextMajor(from: "3.0.0")),
2121
.package(url: "https://github.com/JamitLabs/MungoHealer.git", .upToNextMajor(from: "0.3.0")),
22-
.package(url: "https://github.com/Moya/Moya.git", .revision("43209d6ac45d244d8be08f4cf6df684b96190616")),
22+
.package(url: "https://github.com/Moya/Moya.git", .upToNextMajor(from: "13.0.1")),
2323
.package(url: "https://github.com/Quick/Quick.git", .upToNextMajor(from: "1.0.0")),
2424
.package(url: "https://github.com/Quick/Nimble.git", .upToNextMajor(from: "7.0.0")),
2525
],

Tests/AccioKitTests/Services/DependencyResolverServiceTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class DependencyResolverServiceTests: XCTestCase {
1919
.package(url: "https://github.com/Flinesoft/HandyUIKit.git", .upToNextMajor(from: "1.9.0")),
2020
.package(url: "https://github.com/Flinesoft/Imperio.git", .upToNextMajor(from: "3.0.0")),
2121
.package(url: "https://github.com/JamitLabs/MungoHealer.git", .upToNextMajor(from: "0.3.0")),
22-
.package(url: "https://github.com/Moya/Moya.git", .revision("43209d6ac45d244d8be08f4cf6df684b96190616")),
22+
.package(url: "https://github.com/Moya/Moya.git", .upToNextMajor(from: "13.0.1")),
2323
],
2424
targets: [
2525
.target(

0 commit comments

Comments
 (0)