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

Carthage ios setup #46

Closed

Conversation

jessearmand
Copy link
Contributor

Some configurations needed to successfully built with Carthage. The main issue is because HtmlSnapshotTesting_iOS has to be built together with building the Html_iOS

  • iOS minimum deployment target is set to 10.0 because SnapshotTesting minimum deployment target is also 10.0
  • Moved SnapshotTesting as private dependency
  • Disable bitcode because SnapshotTesting has bitcode disabled.

@mbrandonw
Copy link
Member

Hey @jessearmand, thanks for the issue!

Can we get a bit more information about what is failing in Carthage? The snapshot testing dependency should only come into play when you want to include the HtmlSnapshotTesting library into your code, which I believe you would only want to do for your test targets.

If you are importing only Html then it shouldn't be touching snapshot testing stuff, and I would hope that side steps any of the bitcode problems you are seeing. But perhaps that's not the case?

And as for the iOS 10.0 bump, that makes sense to me! Only one thing to note, we use xcodegen to keep our project file in good shape for Carthage, so your changes will need to be made to project.yml and then the project will have to be regenerated. That requires you to install the xcodegen tool, but once we merge #47 that dependency can be vendored so that you can just do swift run xcodegen. We'll get back to you when that merges.

@mbrandonw
Copy link
Member

@jessearmand I just merged #47, so if you merge master you can make the changes to project.yml instead of directly to the project file. I think you just need to change these lines. Once you do that you can run swift run xcodegen to generate an all new xcodeproj. Let me know if you have any questions, or if you rather me do it.

Thanks!

@jessearmand
Copy link
Contributor Author

jessearmand commented Mar 23, 2019

@mbrandonw Okay, I'm re-generating the project with xcodegen. I didn't know it exists.

I didn't use html snapshot tests as a dependency, I didn't import any of it. My project bootstrap is just this simple:

~/Development/type-safe-html ls
Cartfile                 Cartfile.resolved        Carthage                 HTML.playground          HTMLBook                 HTMLBook.xcodeproj       TypeSafeHTML.xcworkspace
~/Development/type-safe-html open TypeSafeHTML.xcworkspace
~/Development/type-safe-html rm -r Carthage/Build
~/Development/type-safe-html carthage bootstrap --platform iOS
*** Checking out swift-html at "1ecc4b3c3af46a4539c065aaed836297ae1401ad"
*** Checking out swift-snapshot-testing at "1.3.0"
*** xcodebuild output can be found in /var/folders/gj/nnt6p4nx3ln8zpvfkkmnglmm0000gn/T/carthage-xcodebuild.wGmSy0.log
*** Building scheme "SnapshotTesting_iOS" in SnapshotTesting.xcodeproj
*** Building scheme "Html_iOS" in Html.xcworkspace
*** Building scheme "HtmlSnapshotTesting_iOS" in Html.xcworkspace
Build Failed
	Task failed with exit code 65:
	/usr/bin/xcrun xcodebuild -workspace /Users/jessearmand/Development/type-safe-html/Carthage/Checkouts/swift-html/Html.xcworkspace -scheme HtmlSnapshotTesting_iOS -configuration Release -derivedDataPath /Users/jessearmand/Library/Caches/org.carthage.CarthageKit/DerivedData/10.1_10B61/swift-html/1ecc4b3c3af46a4539c065aaed836297ae1401ad -sdk iphoneos ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES archive -archivePath /var/folders/gj/nnt6p4nx3ln8zpvfkkmnglmm0000gn/T/swift-html SKIP_INSTALL=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=NO CLANG_ENABLE_CODE_COVERAGE=NO STRIP_INSTALLED_PRODUCT=NO (launched in /Users/jessearmand/Development/type-safe-html/Carthage/Checkouts/swift-html)

This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/gj/nnt6p4nx3ln8zpvfkkmnglmm0000gn/T/carthage-xcodebuild.wGmSy0.log
~/Development/type-safe-html vim /var/folders/gj/nnt6p4nx3ln8zpvfkkmnglmm0000gn/T/carthage-xcodebuild.wGmSy0.log

First I've noticed this problem because it builds the HtmlSnapshotTesting, as you can see in the ARCHIVE FAILED step below, SnapshotTesting doesn't contain bitcode, and Html_iOS targets iOS 12.1.

Ld /Users/jessearmand/Library/Caches/org.carthage.CarthageKit/DerivedData/10.1_10B61/swift-html/1ecc4b3c3af46a4539c065aaed836297ae1401ad/Build/Intermediates.noindex/ArchiveIntermediates/HtmlSnapshotTesting_iOS/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/HtmlSnapshotTesting.framework/HtmlSnapshotTesting normal arm64 (in target: HtmlSnapshotTesting_iOS)
    cd /Users/jessearmand/Development/type-safe-html/Carthage/Checkouts/swift-html
    export IPHONEOS_DEPLOYMENT_TARGET=12.1
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -L/Users/jessearmand/Library/Caches/org.carthage.CarthageKit/DerivedData/10.1_10B61/swift-html/1ecc4b3c3af46a4539c065aaed836297ae1401ad/Build/Intermediates.noindex/ArchiveIntermediates/HtmlSnapshotTesting_iOS/BuildProductsPath/Release-iphoneos -F/Users/jessearmand/Library/Caches/org.carthage.CarthageKit/DerivedData/10.1_10B61/swift-html/1ecc4b3c3af46a4539c065aaed836297ae1401ad/Build/Intermediates.noindex/ArchiveIntermediates/HtmlSnapshotTesting_iOS/BuildProductsPath/Release-iphoneos -F. -filelist /Users/jessearmand/Library/Caches/org.carthage.CarthageKit/DerivedData/10.1_10B61/swift-html/1ecc4b3c3af46a4539c065aaed836297ae1401ad/Build/Intermediates.noindex/ArchiveIntermediates/HtmlSnapshotTesting_iOS/IntermediateBuildFilesPath/Html.build/Release-iphoneos/HtmlSnapshotTesting_iOS.build/Objects-normal/arm64/HtmlSnapshotTesting.LinkFileList -install_name @rpath/HtmlSnapshotTesting.framework/HtmlSnapshotTesting -Xlinker -rpath -Xlinker @executable_path/Frameworks -miphoneos-version-min=12.1 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/jessearmand/Library/Caches/org.carthage.CarthageKit/DerivedData/10.1_10B61/swift-html/1ecc4b3c3af46a4539c065aaed836297ae1401ad/Build/Intermediates.noindex/ArchiveIntermediates/HtmlSnapshotTesting_iOS/IntermediateBuildFilesPath/Html.build/Release-iphoneos/HtmlSnapshotTesting_iOS.build/Objects-normal/arm64/HtmlSnapshotTesting_lto.o -fembed-bitcode -Xlinker -bitcode_verify -Xlinker -bitcode_hide_symbols -Xlinker -bitcode_symbol_map -Xlinker /Users/jessearmand/Library/Caches/org.carthage.CarthageKit/DerivedData/10.1_10B61/swift-html/1ecc4b3c3af46a4539c065aaed836297ae1401ad/Build/Intermediates.noindex/ArchiveIntermediates/HtmlSnapshotTesting_iOS/BuildProductsPath/Release-iphoneos -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos -Xlinker -add_ast_path -Xlinker /Users/jessearmand/Library/Caches/org.carthage.CarthageKit/DerivedData/10.1_10B61/swift-html/1ecc4b3c3af46a4539c065aaed836297ae1401ad/Build/Intermediates.noindex/ArchiveIntermediates/HtmlSnapshotTesting_iOS/IntermediateBuildFilesPath/Html.build/Release-iphoneos/HtmlSnapshotTesting_iOS.build/Objects-normal/arm64/HtmlSnapshotTesting.swiftmodule -framework Html -framework SnapshotTesting -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/jessearmand/Library/Caches/org.carthage.CarthageKit/DerivedData/10.1_10B61/swift-html/1ecc4b3c3af46a4539c065aaed836297ae1401ad/Build/Intermediates.noindex/ArchiveIntermediates/HtmlSnapshotTesting_iOS/IntermediateBuildFilesPath/Html.build/Release-iphoneos/HtmlSnapshotTesting_iOS.build/Objects-normal/arm64/HtmlSnapshotTesting_dependency_info.dat -o /Users/jessearmand/Library/Caches/org.carthage.CarthageKit/DerivedData/10.1_10B61/swift-html/1ecc4b3c3af46a4539c065aaed836297ae1401ad/Build/Intermediates.noindex/ArchiveIntermediates/HtmlSnapshotTesting_iOS/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/HtmlSnapshotTesting.framework/HtmlSnapshotTesting
ld: '/Users/jessearmand/Library/Caches/org.carthage.CarthageKit/DerivedData/10.1_10B61/swift-html/1ecc4b3c3af46a4539c065aaed836297ae1401ad/Build/Intermediates.noindex/ArchiveIntermediates/HtmlSnapshotTesting_iOS/BuildProductsPath/Release-iphoneos/SnapshotTesting.framework/SnapshotTesting' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. file '/Users/jessearmand/Library/Caches/org.carthage.CarthageKit/DerivedData/10.1_10B61/swift-html/1ecc4b3c3af46a4539c065aaed836297ae1401ad/Build/Intermediates.noindex/ArchiveIntermediates/HtmlSnapshotTesting_iOS/BuildProductsPath/Release-iphoneos/SnapshotTesting.framework/SnapshotTesting' for architecture arm64
clang: error: 
linker command failed with exit code 1 (use -v to see invocation)


** ARCHIVE FAILED **


The following build commands failed:
	Ld /Users/jessearmand/Library/Caches/org.carthage.CarthageKit/DerivedData/10.1_10B61/swift-html/1ecc4b3c3af46a4539c065aaed836297ae1401ad/Build/Intermediates.noindex/ArchiveIntermediates/HtmlSnapshotTesting_iOS/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/HtmlSnapshotTesting.framework/HtmlSnapshotTesting normal arm64
(1 failure)

Html_iOS is built with IPHONEOS_DEPLOYMENT_TARGET=12.1

Ld /Users/jessearmand/Library/Caches/org.carthage.CarthageKit/DerivedData/10.1_10B61/swift-html/1ecc4b3c3af46a4539c065aaed836297ae1401ad/Build/Products/Release-iphonesimulator/Html.framework/Html normal x86_64 (in target: Html_iOS)
    cd /Users/jessearmand/Development/type-safe-html/Carthage/Checkouts/swift-html
    export IPHONEOS_DEPLOYMENT_TARGET=12.1
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk -L/Users/jessearmand/Library/Caches/org.carthage.CarthageKit/DerivedData/10.1_10B61/swift-html/1ecc4b3c3af46a4539c065aaed836297ae1401ad/Build/Products/Release-iphonesimulator -F/Users/jessearmand/Library/Caches/org.carthage.CarthageKit/DerivedData/10.1_10B61/swift-html/1ecc4b3c3af46a4539c065aaed836297ae1401ad/Build/Products/Release-iphonesimulator -filelist /Users/jessearmand/Library/Caches/org.carthage.CarthageKit/DerivedData/10.1_10B61/swift-html/1ecc4b3c3af46a4539c065aaed836297ae1401ad/Build/Intermediates.noindex/Html.build/Release-iphonesimulator/Html_iOS.build/Objects-normal/x86_64/Html.LinkFileList -install_name @rpath/Html.framework/Html -Xlinker -rpath -Xlinker @executable_path/Frameworks -mios-simulator-version-min=12.1 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/jessearmand/Library/Caches/org.carthage.CarthageKit/DerivedData/10.1_10B61/swift-html/1ecc4b3c3af46a4539c065aaed836297ae1401ad/Build/Intermediates.noindex/Html.build/Release-iphonesimulator/Html_iOS.build/Objects-normal/x86_64/Html_lto.o -Xlinker -objc_abi_version -Xlinker 2 -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -Xlinker -add_ast_path -Xlinker /Users/jessearmand/Library/Caches/org.carthage.CarthageKit/DerivedData/10.1_10B61/swift-html/1ecc4b3c3af46a4539c065aaed836297ae1401ad/Build/Intermediates.noindex/Html.build/Release-iphonesimulator/Html_iOS.build/Objects-normal/x86_64/Html.swiftmodule -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/jessearmand/Library/Caches/org.carthage.CarthageKit/DerivedData/10.1_10B61/swift-html/1ecc4b3c3af46a4539c065aaed836297ae1401ad/Build/Intermediates.noindex/Html.build/Release-iphonesimulator/Html_iOS.build/Objects-normal/x86_64/Html_dependency_info.dat -o /Users/jessearmand/Library/Caches/org.carthage.CarthageKit/DerivedData/10.1_10B61/swift-html/1ecc4b3c3af46a4539c065aaed836297ae1401ad/Build/Products/Release-iphonesimulator/Html.framework/Html

@stephencelis
Copy link
Member

Hey @jessearmand! It's been awhile since I used Carthage, but any test target (including HtmlSnapshotTesting) should not be included. I'm not sure if there's a carthage bootstrap option that needs to be flagged. Perhaps someone with more Carthage experience has an idea.

Because of this kinda thing we have a callout to this on the SnapshotTesting README that I think applies here:

https://github.com/pointfreeco/swift-snapshot-testing#carthage

So maybe we need to add a similar callout to the README here.

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 this pull request may close these issues.

3 participants