Skip to content

Commit

Permalink
Don't reset generated projects for non-Carthage compatible frameworks
Browse files Browse the repository at this point in the history
Fixes #35.
  • Loading branch information
Jeehut committed Apr 26, 2019
1 parent 746ba2a commit 779e3fc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
16 changes: 14 additions & 2 deletions Sources/AccioKit/Services/CachedBuilderService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,22 @@ final class CachedBuilderService {
switch try InstallationTypeDetectorService.shared.detectInstallationType(for: framework) {
case .swiftPackageManager:
try XcodeProjectGeneratorService.shared.generateXcodeProject(framework: framework)
fallthrough
let frameworkProduct = try carthageBuilderService.build(
framework: framework,
platform: platform,
alreadyBuiltFrameworkProducts: frameworkProducts
)
frameworkProducts.append(frameworkProduct)

case .carthage:
let frameworkProduct = try carthageBuilderService.build(framework: framework, platform: platform, alreadyBuiltFrameworkProducts: frameworkProducts)
try bash("git -C '\(framework.projectDirectory)' reset HEAD --hard --quiet")
try bash("git -C '\(framework.projectDirectory)' clean -fd --quiet")

let frameworkProduct = try carthageBuilderService.build(
framework: framework,
platform: platform,
alreadyBuiltFrameworkProducts: frameworkProducts
)
frameworkProducts.append(frameworkProduct)
}
}
Expand Down
3 changes: 0 additions & 3 deletions Sources/AccioKit/Services/CarthageBuilderService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ final class CarthageBuilderService {
func build(framework: Framework, platform: Platform, alreadyBuiltFrameworkProducts: [FrameworkProduct]) throws -> FrameworkProduct {
print("Building library \(framework.libraryName) with Carthage ...", level: .info)

try bash("git -C '\(framework.projectDirectory)' reset HEAD --hard --quiet")
try bash("git -C '\(framework.projectDirectory)' clean -fd --quiet")

// link already built subdependencies from previous calls of this method
for requiredFramework in framework.requiredFrameworks.flattenedDeepFirstOrder() {
guard let requiredFrameworkProduct = alreadyBuiltFrameworkProducts.first(where: { $0.libraryName == requiredFramework.libraryName }) else {
Expand Down

0 comments on commit 779e3fc

Please sign in to comment.