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

Building via Carthage may result in misleading output #56

Closed
fredpi opened this issue Jun 17, 2019 · 0 comments · Fixed by #57
Closed

Building via Carthage may result in misleading output #56

fredpi opened this issue Jun 17, 2019 · 0 comments · Fixed by #57

Comments

@fredpi
Copy link
Contributor

fredpi commented Jun 17, 2019

Configuration

The Package.swift of a project includes dependency A. A itself has its Package.swift declared, requiring subdependency B. A is also Carthage-compatible, meaning it has a Cartfile referencing B.

Issue

Accio is smart, so it will build B before building A. Now, if A is built via Carthage, Accio will also copy the build result of B into the Carthage/Build/ folder within the A checkout. After that, the carthage build command is invoked, passing the platform to build for. Carthage will now parse the Cartfile of A if it exists (if A is Carthage-compatible, it will exist).

If the parsing goes well, Carthage will build A using the build result of B that was copied into the Carthage/Build/ folder within the A checkout. Yet, if the parsing doesn't go well, e. g. because B doesn't have a specific shared iOS scheme while the platform passed to the Carthage build command is iOS, there will be an output originating from Carthage similar to this one:

✨  Building library RxGesture with Carthage ...
*** xcodebuild output can be found in /var/folders/r6/ylx9g2f91bxcy402jv2w_3fh0000gn/T/carthage-xcodebuild.QYGDy2.log
*** Skipped building RxSwift due to the error:
Dependency "RxSwift" has no shared framework schemes for any of the platforms: iOS

If you believe this to be an error, please file an issue with the maintainers at https://github.com/ReactiveX/RxSwift/issues/new
*** Building scheme "RxGesture-iOS" in RxGesture.xcodeproj
✨  Completed building scheme RxGesture with Carthage.

However, because RxSwift has already been built via Accio before and copied to Carthage/Build/ folder within the A checkout, this doesn't have any effect, but may irritate the user.

Solution

We can simply fix this misleading output by removing the Cartfile and Cartfile.resolved just before invoking the carthage build command:

// remove Cartfile before carthage build as subdependencies have already been built via Accio
try bash("rm -rf '\(framework.projectDirectory)/Cartfile'")
try bash("rm -rf '\(framework.projectDirectory)/Cartfile.resolved'")

This way, Carthage will just build and do nothing else.

fredpi added a commit that referenced this issue Jun 17, 2019
fredpi added a commit that referenced this issue Jun 18, 2019
Remove Cartfile before building via Carthage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant