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

Use `archive` action by default, instead of `build`? #169

Closed
robrix opened this Issue Dec 1, 2014 · 10 comments

Comments

Projects
None yet
2 participants
@robrix
Contributor

robrix commented Dec 1, 2014

Right now if you have this in your Cartfile:

github "robrix/Either" == 1.0.1

builds will fail with this error:

Resonance:foo rob$ carthage update
*** Fetching Either
*** Checking out Either at "1.0.1"
*** xcodebuild output can be found in /var/folders/9y/f7n4rvx901nctm_5d16c1wm40000gn/T/carthage-xcodebuild.rEyFdX.log
*** Building scheme "Either" in Either.xcworkspace
A shell task failed with exit code 65:
>>> /usr/bin/xcrun xcodebuild -workspace /Users/rob/Desktop/foo/Carthage.checkout/Either/Either.xcworkspace -scheme Either -configuration Release -sdk macosx build
2014-12-01 11:34:36.605 xcodebuild[9518:786882]  DVTAssertions: Warning in /SourceCache/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-6269/Xcode3Core/LegacyProjects/Frameworks/DevToolsCore/DevToolsCore/SpecificationTypes/BuiltInSpecifications/Compilers/XCGccMakefileDependencies.m:77
Details:  Failed to load dependencies output contents from ``/Users/rob/Library/Developer/Xcode/DerivedData/Either-gkclfdotewehumboutptpufldxma/Build/Intermediates/Either.build/Release/EitherTests.build/Objects-normal/x86_64/EitherTests.d''. Error: Error Domain=NSCocoaErrorDomain Code=260 "The file “EitherTests.d” couldn’t be opened because there is no such file." UserInfo=0x7fceb4a47da0 {NSFilePath=/Users/rob/Library/Developer/Xcode/DerivedData/Either-gkclfdotewehumboutptpufldxma/Build/Intermediates/Either.build/Release/EitherTests.build/Objects-normal/x86_64/EitherTests.d, NSUnderlyingError=0x7fceb4a57120 "The operation couldn’t be completed. No such file or directory"}. User info: {
    NSFilePath = "/Users/rob/Library/Developer/Xcode/DerivedData/Either-gkclfdotewehumboutptpufldxma/Build/Intermediates/Either.build/Release/EitherTests.build/Objects-normal/x86_64/EitherTests.d";
    NSUnderlyingError = "Error Domain=NSPOSIXErrorDomain Code=2 \"The operation couldn\U2019t be completed. No such file or directory\"";
}.
Function: void XCGccMakefileDependenciesParsePathsFromRuleFile(NSString *__strong, void (^__strong)(NSString *__strong))
Thread:   <NSThread: 0x7fceb4803de0>{number = 8, name = (null)}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
** BUILD FAILED **


The following build commands failed:
    CompileSwift normal x86_64 /Users/rob/Desktop/foo/Carthage.checkout/Either/EitherTests/EitherTests.swift
    CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
    Ditto /Users/rob/Library/Developer/Xcode/DerivedData/Either-gkclfdotewehumboutptpufldxma/Build/Intermediates/Either.build/Release/EitherTests.build/DerivedSources/EitherTests-Swift.h /Users/rob/Library/Developer/Xcode/DerivedData/Either-gkclfdotewehumboutptpufldxma/Build/Intermediates/Either.build/Release/EitherTests.build/Objects-normal/x86_64/EitherTests-Swift.h
    Ditto /Users/rob/Library/Developer/Xcode/DerivedData/Either-gkclfdotewehumboutptpufldxma/Build/Products/Release/EitherTests.swiftmodule/x86_64.swiftdoc /Users/rob/Library/Developer/Xcode/DerivedData/Either-gkclfdotewehumboutptpufldxma/Build/Intermediates/Either.build/Release/EitherTests.build/Objects-normal/x86_64/EitherTests.swiftdoc
    Ditto /Users/rob/Library/Developer/Xcode/DerivedData/Either-gkclfdotewehumboutptpufldxma/Build/Products/Release/EitherTests.swiftmodule/x86_64.swiftmodule /Users/rob/Library/Developer/Xcode/DerivedData/Either-gkclfdotewehumboutptpufldxma/Build/Intermediates/Either.build/Release/EitherTests.build/Objects-normal/x86_64/EitherTests.swiftmodule
    Ld /Users/rob/Library/Developer/Xcode/DerivedData/Either-gkclfdotewehumboutptpufldxma/Build/Products/Release/EitherTests.xctest/Contents/MacOS/EitherTests normal x86_64
    GenerateDSYMFile /Users/rob/Library/Developer/Xcode/DerivedData/Either-gkclfdotewehumboutptpufldxma/Build/Products/Release/EitherTests.xctest.dSYM /Users/rob/Library/Developer/Xcode/DerivedData/Either-gkclfdotewehumboutptpufldxma/Build/Products/Release/EitherTests.xctest/Contents/MacOS/EitherTests
(7 failures)

The workaround I found (and released as 1.0.2) is to:

  1. publish the scheme, and
  2. disable building the test target for the analyzing & running actions.

Prior to this it had been using Xcode’s default scheme which had carthage update attempting to build the tests as we see above.

I’m intending to follow the output’s advice and file a radar on this, but it made me wonder whether carthage should build for archiving instead—which doesn’t have the tests enabled by default.

@robrix robrix added bug build labels Dec 1, 2014

@jspahrsummers

This comment has been minimized.

Member

jspahrsummers commented Dec 1, 2014

Dupe of #128, fixed in #146.

@robrix

This comment has been minimized.

Contributor

robrix commented Dec 1, 2014

Alas, neither dupe nor fixed.

Using 0.2.1 (in my case built from master):

  1. Make a new folder.

  2. Add a Cartfile consisting of:

    github "robrix/Either" == 1.0.1
    
  3. cd into that folder and carthage update.

Expected: not to build the tests.

Actual:

  1. It built the tests (presumably because it’s effectively building for running and xcodebuild is obeying the default scheme).
  2. Building the tests failed.

So, again, I wonder whether carthage should build for archiving instead.

@jspahrsummers

This comment has been minimized.

Member

jspahrsummers commented Dec 1, 2014

Well, this is an xcodebuild bug, but there might be other benefits to building with the archive action. My main concern is that we'll see some things get wrapped into ipas or xcarchives, which may make it harder for Carthage to find the binaries and merge them (or whatever).

I'd be interested to see a PR spiking it, though.

@jspahrsummers jspahrsummers reopened this Dec 1, 2014

@jspahrsummers jspahrsummers added enhancement and removed bug labels Dec 1, 2014

@jspahrsummers jspahrsummers changed the title from Default framework schemes fail to build tests? to Use `archive` action by default, instead of `build` Dec 1, 2014

@jspahrsummers jspahrsummers modified the milestone: 0.7: If You Build It… Dec 23, 2014

@jspahrsummers jspahrsummers changed the title from Use `archive` action by default, instead of `build` to Use `archive` action by default, instead of `build`? Dec 25, 2014

@jspahrsummers

This comment has been minimized.

Member

jspahrsummers commented Dec 25, 2014

One potential benefit to using the archive action is that we might get embedded dSYMs for free.

@robrix

This comment has been minimized.

Contributor

robrix commented Dec 26, 2014

Not sure what you mean by that.

@jspahrsummers

This comment has been minimized.

Member

jspahrsummers commented Dec 26, 2014

Normal framework builds don't include a dSYM within the bundle, but an archive build might do so. Maybe.

@robrix

This comment has been minimized.

Contributor

robrix commented Dec 26, 2014

Okay, and the benefit we’d get there is that projects built with Carthage would have symbols in the debugger & in (symbolicated) crash logs? That’d be lovely.

@jspahrsummers

This comment has been minimized.

Member

jspahrsummers commented Dec 26, 2014

Yep, that would be the hope.

@jspahrsummers jspahrsummers self-assigned this Jan 4, 2015

@jspahrsummers

This comment has been minimized.

Member

jspahrsummers commented Jan 4, 2015

Apparently xcodebuild archive does not work for the simulator SDK:

*** Building scheme "LlamaKit-iOS" in LlamaKit.xcodeproj
2015-01-04 00:06:36.982 xcodebuild[24740:680548] [MT] DVTAssertions: Warning in /SourceCache/IDEFrameworks/IDEFrameworks-6610/IDEFoundation/Execution/Schemes/IDEScheme.m:1402
Details:  Scheme <IDEScheme:0x7f849617bcd0:'LlamaKit-iOS'> was asked to build and archive, but the run destination <IDERunDestination:0x7f84961593c0:'iPad 2'> is not a deployment platform and this action shouldn't have been allowed.
Object:   <IDEScheme: 0x7f849617bcd0>
Method:   -archiveOperationWithExecutionContext:onlyBuild:destination:overridingProperties:schemeCommand:buildLog:overridingBuildConfiguration:invocationRecord:name:title:error:actionCallbackBlock:
Thread:   <NSThread: 0x7f849342e140>{number = 1, name = main}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
xcodebuild: error: Failed to build project LlamaKit with scheme LlamaKit-iOS.
    Reason: You cannot archive for the iOS Simulator platform.

Furthermore, the man page for xcodebuild makes it sound like we'd be going against the grain trying to obtain a .framework bundle, since that's not one of the listed formats:

     -exportFormat format
           Specifies the format to which the archive should be exported. Valid formats are IPA (iOS archives only), PKG (Mac archives
           only), and APP.  If not specified, xcodebuild will attempt to auto-detect the format as either IPA or PKG.

Finally, here's the result of running carthage update (from 0.5.1) using the above steps:

$ carthage update
*** Cloning Either
*** Checking out Either at "1.0.1"
*** xcodebuild output can be found in /var/folders/bc/94873c7x4b97j9kczw008fh40000gn/T/carthage-xcodebuild.zA4BF9.log
Project "Either.xcodeproj" has no shared schemes

I think that's good enough, and this can be closed out.

@robrix

This comment has been minimized.

Contributor

robrix commented Jan 4, 2015

👍 good enough for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment