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.
Configuration
The
Package.swift
of a project includes dependencyA
.A
itself has itsPackage.swift
declared, requiring subdependencyB
.A
is also Carthage-compatible, meaning it has aCartfile
referencingB
.Issue
Accio is smart, so it will build
B
before buildingA
. Now, ifA
is built via Carthage, Accio will also copy the build result ofB
into theCarthage/Build/
folder within theA
checkout. After that, thecarthage build
command is invoked, passing the platform to build for. Carthage will now parse theCartfile
ofA
if it exists (ifA
is Carthage-compatible, it will exist).If the parsing goes well, Carthage will build
A
using the build result ofB
that was copied into theCarthage/Build/
folder within theA
checkout. Yet, if the parsing doesn't go well, e. g. becauseB
doesn't have a specific sharediOS
scheme while the platform passed to theCarthage build
command isiOS
, there will be an output originating from Carthage similar to this one:However, because
RxSwift
has already been built via Accio before and copied toCarthage/Build/
folder within theA
checkout, this doesn't have any effect, but may irritate the user.Solution
We can simply fix this misleading output by removing the
Cartfile
andCartfile.resolved
just before invoking thecarthage build
command:This way, Carthage will just build and do nothing else.