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

Revise and update workspace build configuration #475

Merged

Conversation

tonyarnold
Copy link
Contributor

@tonyarnold tonyarnold commented Mar 21, 2019

I have been having trouble getting various pieces of Apollo to build for macOS since I started using it, and from what I can see, it all comes down to how the build has been configured.

This PR aims to do a few things:

  1. Extract all build settings from the .pbxproj files so that they can be shared between the various projects and targets in the workspace.
  2. Add a script to ensure no new build settings are added to the pbxproj files.
  3. Ensure that (where appropriate) all projects build for iOS, macOS, tvOS and watchOS properly.
  4. Bumps Swift support to version 4.2 (tested with both swiftc versions 4.2 and 5.0).

I know there's a fair bit in this PR, but it should simplify maintenance.

This fixes the following issues:

@apollo-cla
Copy link

@tonyarnold: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/

@tonyarnold tonyarnold force-pushed the fix/build-configuration branch 2 times, most recently from b0c7044 to 417d7cd Compare March 21, 2019 05:11
@martijnwalraven
Copy link
Contributor

Thanks a lot for working on this! Configuring framework builds with support for multiple platforms in Xcode is a pain, so I'm really happy you went through the trouble of extracting settings into .xcconfig files (and adding a script to ensure it is kept that way).

It seems the tests for ApolloSQLite are currently failing though. Any idea what could be going on there?

@tonyarnold
Copy link
Contributor Author

Yeah, I'm a bit puzzled by that. It looks like the cache dependent tests are looking for a GraphQL server running on localhost at port 8080.

I'll see if there's anything in the project's documentation about it.

@martijnwalraven
Copy link
Contributor

That's the starwars-server, but that's being installed and started in the Travis config. It seems these failures have something to do with the build setup, because I'm seeing a lot of:

 duplicate output file '/Users/travis/Library/Developer/Xcode/DerivedData/Apollo-bxcgtghuyqeuuhhfxqdiztcnmktu/Build/Products/Debug/SQLite.framework/Versions/A/Headers/SQLite.h' on task: CpHeader /Users/travis/build/apollographql/apollo-ios/Carthage/Checkouts/SQLite.swift/Sources/SQLite/SQLite.h /Users/travis/Library/Developer/Xcode/DerivedData/Apollo-bxcgtghuyqeuuhhfxqdiztcnmktu/Build/Products/Debug/SQLite.framework/Versions/A/Headers/SQLite.h (in target 'SQLite iOS')

@tonyarnold tonyarnold force-pushed the fix/build-configuration branch 4 times, most recently from 0ae7756 to 22e090d Compare March 21, 2019 10:22
@tonyarnold
Copy link
Contributor Author

Ahh yes, I'd not wired up some of the test support frameworks as universal. Let's see how this latest build goes - it's all passing locally for both macOS and iOS now.

…to the Xcode project file

# Conflicts:
#	ApolloWebSocket.xcodeproj/project.pbxproj

# Conflicts:
#	ApolloSQLite.xcodeproj/project.pbxproj
@tonyarnold
Copy link
Contributor Author

Because of the way the SQLite.framework Xcode project is configured, we may need to wait until Xcode 10.2 is released early next week for these tests to pass (Xcode 10.2 supports finding implicit dependencies in more places, such as via -framework options passed to OTHER_LDFLAGS).

@martijnwalraven
Copy link
Contributor

Oh, good find! Let's wait until Xcode 10.2 is released then. The ApolloSQLite code hasn't been touched in a long time, so there may also have been updates to the SQLite.framework upstream.

@tonyarnold
Copy link
Contributor Author

I did check on the upstream dependencies, and it doesn't look like there have been any releases since the ones the project already uses. 👍

@martijnwalraven
Copy link
Contributor

@tonyarnold Now that Xcode 10.2 has been released, have you had a chance to see if that solves the build issues with SQLite.framework?

@tonyarnold
Copy link
Contributor Author

Everything passes for me here locally - it's really going to come down to Travis CI updating their environments. The project also specifies a bunch of iOS simulator versions that weren't installed in the 10.2 beta environment - once they're in the release, this should be 👍 to merge/release.

@martijnwalraven
Copy link
Contributor

@tonyarnold I reran the tests, hoping Travis would have updated their image. I'm seeing some missinng iOS simulator version errors though, so we'll probably have to wait a little longer.

@tonyarnold
Copy link
Contributor Author

Yeah, I checked earlier today - the xcode10.2 environment on Travis is still running a beta release of Xcode 10.2.

@ngAvaddon
Copy link

@martijnwalraven @tonyarnold I wonder if the issue with simulator is the same I had with Bitrise yesterday.
bitrise-steplib/steps-xcode-test#110

Seems like simctl is having troubles detecting simulators on CI side, but detection of iPhone 5s works.
Changing Xcode Test steps in Bitrise to use iPhone 5s simulator fixed issue for me.

@MaxDesiatov
Copy link
Contributor

Would you folks mind keeping at least Xcode 10.1 in .travis.yml as well, and even 10.0 if possible? Given how many projects break with 10.2, I imagine its adoption is going to be slow and a lot of people will stay with 10.1 and earlier for long time. I'd appreciate if compatibility of Apollo with older versions is preserved and tested.

@martijnwalraven martijnwalraven merged commit 07133eb into apollographql:master Mar 30, 2019
@martijnwalraven
Copy link
Contributor

@tonyarnold Thank you so much for working on this!

@martijnwalraven
Copy link
Contributor

@MaxDesiatov I see where you're coming from, but let's discuss that in a separate issue. Our travis.yml has already grown to 16 jobs, so adding more variations with multiple Xcode versions would make builds even slower.

This hasn't been an issue before, but have there been more breaking changes in Xcode 10.2? Is the concern that it only supports Swift 4 and up?

It also seems right now other projects (like Alamofire) don't test on multiple Xcode versions either, but that could change when people run into problems of course.

@tonyarnold
Copy link
Contributor Author

@martijnwalraven you’re very welcome. I thought the project was dead, but obviously not! Ping me if there’s anything wrong with the work. I’m happy to help out.

I also have a branch that updates to the latest version of apollo-client - would that be useful too?

@tonyarnold tonyarnold deleted the fix/build-configuration branch March 30, 2019 07:38
@martijnwalraven
Copy link
Contributor

@tonyarnold No, the project isn't dead, we are in fact hiring for a full-time mobile position. But I've taken on other responsibilities within the company at the beginning of last year, and haven't been able to give this project the attention it deserves.

What do you mean by updating to the latest version of apollo-client? There is no dependency on apollo-client in this repo?

@tonyarnold
Copy link
Contributor Author

Sorry, I'm new to the various tools - I meant apollo-cli. The version specified in https://github.com/apollographql/apollo-ios/blob/master/scripts/check-and-run-apollo-cli.sh is out of date.

@martijnwalraven
Copy link
Contributor

martijnwalraven commented Mar 30, 2019

@tonyarnold Ah, yes, that makes sense. Unfortunately, there have been breaking changes in apollo-cli v2, so updating means that everyone would have to change their build script. We do need to find a solution for this, but that would probably mean making sure apollo-cli accepts the old arguments to stay backwards compatible.

@claudiogomezGL
Copy link

Hi @tonyarnold, I've been trying to integrate Apollo to our tvOS project but our project is still in Swift 4.2. So, I forked v0.9.5, and apply your commit for the configs but after doing so, each time Carthage tries to compile it doesn't found the reference to the framework SQLite in the ApolloSQLite project. I'd like to know if I need to do something else to make it compile for tvOS that I can apply to the fork? It's a matter of urgency if you can help on this since we need GraphQL implementation ASAP. Thanks for all the help you can give me.

@tonyarnold
Copy link
Contributor Author

@claudiogomezGL there were a lot of changes in this PR - I'm not really sure trying to separate them out this way will work. Can you not update to 0.10.x?

@fawad-khalil
Copy link

fawad-khalil commented Jun 26, 2019

Hi @tonyarnold, our project is using swift 5 and I am trying to integrate the latest version 0.10.1 of Apollo using Carthage. The problem is same as others are facing that it is failing to find the reference to SQLite and I need to integrate it as soon as possible due to limited time to deliver the project. The project is already using Carthage so we would have to use Carthage as well. Following is the log related to the failure. Can you please help me?

cd /Users/khurram/Documents/fawad-projects/ios-walmart/Carthage/Checkouts/apollo-ios
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -emit-bc /Users/khurram/Documents/fawad-projects/ios-walmart/Carthage/Checkouts/apollo-ios/Sources/ApolloSQLite/SQLiteNormalizedCache.swift -emit-module-path /Users/khurram/Library/Caches/org.carthage.CarthageKit/DerivedData/10.2.1_10E1001/apollo-ios/0.10.1/Build/Intermediates.noindex/ArchiveIntermediates/ApolloSQLite/IntermediateBuildFilesPath/ApolloSQLite.build/Release-watchos/ApolloSQLite.build/Objects-normal/armv7k/ApolloSQLite.swiftmodule -emit-module-doc-path /Users/khurram/Library/Caches/org.carthage.CarthageKit/DerivedData/10.2.1_10E1001/apollo-ios/0.10.1/Build/Intermediates.noindex/ArchiveIntermediates/ApolloSQLite/IntermediateBuildFilesPath/ApolloSQLite.build/Release-watchos/ApolloSQLite.build/Objects-normal/armv7k/ApolloSQLite.swiftdoc -serialize-diagnostics-path /Users/khurram/Library/Caches/org.carthage.CarthageKit/DerivedData/10.2.1_10E1001/apollo-ios/0.10.1/Build/Intermediates.noindex/ArchiveIntermediates/ApolloSQLite/IntermediateBuildFilesPath/ApolloSQLite.build/Release-watchos/ApolloSQLite.build/Objects-normal/armv7k/ApolloSQLite-master.dia -emit-objc-header-path /Users/khurram/Library/Caches/org.carthage.CarthageKit/DerivedData/10.2.1_10E1001/apollo-ios/0.10.1/Build/Intermediates.noindex/ArchiveIntermediates/ApolloSQLite/IntermediateBuildFilesPath/ApolloSQLite.build/Release-watchos/ApolloSQLite.build/Objects-normal/armv7k/ApolloSQLite-Swift.h -emit-dependencies-path /Users/khurram/Library/Caches/org.carthage.CarthageKit/DerivedData/10.2.1_10E1001/apollo-ios/0.10.1/Build/Intermediates.noindex/ArchiveIntermediates/ApolloSQLite/IntermediateBuildFilesPath/ApolloSQLite.build/Release-watchos/ApolloSQLite.build/Objects-normal/armv7k/ApolloSQLite-master.d -target armv7k-apple-watchos3.0 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS5.2.sdk -I /Users/khurram/Library/Caches/org.carthage.CarthageKit/DerivedData/10.2.1_10E1001/apollo-ios/0.10.1/Build/Intermediates.noindex/ArchiveIntermediates/ApolloSQLite/BuildProductsPath/Release-watchos -F /Users/khurram/Library/Caches/org.carthage.CarthageKit/DerivedData/10.2.1_10E1001/apollo-ios/0.10.1/Build/Intermediates.noindex/ArchiveIntermediates/ApolloSQLite/BuildProductsPath/Release-watchos -F /Users/khurram/Library/Caches/org.carthage.CarthageKit/DerivedData/10.2.1_10E1001/apollo-ios/0.10.1/Build/Intermediates.noindex/ArchiveIntermediates/ApolloSQLite/BuildProductsPath/Release-watchos -application-extension -g -module-cache-path /Users/khurram/Library/Caches/org.carthage.CarthageKit/DerivedData/10.2.1_10E1001/apollo-ios/0.10.1/ModuleCache.noindex -swift-version 4.2 -enforce-exclusivity=checked -O -D RELEASE -D RELEASE -disable-swift3-objc-inference -serialize-debugging-options -Xcc -working-directory -Xcc /Users/khurram/Documents/fawad-projects/ios-walmart/Carthage/Checkouts/apollo-ios -enable-anonymous-context-mangled-names -Xcc -I/Users/khurram/Library/Caches/org.carthage.CarthageKit/DerivedData/10.2.1_10E1001/apollo-ios/0.10.1/Build/Intermediates.noindex/ArchiveIntermediates/ApolloSQLite/IntermediateBuildFilesPath/ApolloSQLite.build/Release-watchos/ApolloSQLite.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/khurram/Library/Caches/org.carthage.CarthageKit/DerivedData/10.2.1_10E1001/apollo-ios/0.10.1/Build/Intermediates.noindex/ArchiveIntermediates/ApolloSQLite/IntermediateBuildFilesPath/ApolloSQLite.build/Release-watchos/ApolloSQLite.build/ApolloSQLite-generated-files.hmap -Xcc -I/Users/khurram/Library/Caches/org.carthage.CarthageKit/DerivedData/10.2.1_10E1001/apollo-ios/0.10.1/Build/Intermediates.noindex/ArchiveIntermediates/ApolloSQLite/IntermediateBuildFilesPath/ApolloSQLite.build/Release-watchos/ApolloSQLite.build/ApolloSQLite-own-target-headers.hmap -Xcc -I/Users/khurram/Library/Caches/org.carthage.CarthageKit/DerivedData/10.2.1_10E1001/apollo-ios/0.10.1/Build/Intermediates.noindex/ArchiveIntermediates/ApolloSQLite/IntermediateBuildFilesPath/ApolloSQLite.build/Release-watchos/ApolloSQLite.build/ApolloSQLite-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/khurram/Library/Caches/org.carthage.CarthageKit/DerivedData/10.2.1_10E1001/apollo-ios/0.10.1/Build/Intermediates.noindex/ArchiveIntermediates/ApolloSQLite/IntermediateBuildFilesPath/ApolloSQLite.build/Release-watchos/ApolloSQLite.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/khurram/Library/Caches/org.carthage.CarthageKit/DerivedData/10.2.1_10E1001/apollo-ios/0.10.1/Build/Intermediates.noindex/ArchiveIntermediates/ApolloSQLite/IntermediateBuildFilesPath/ApolloSQLite.build/Release-watchos/ApolloSQLite.build/ApolloSQLite-project-headers.hmap -Xcc -I/Users/khurram/Library/Caches/org.carthage.CarthageKit/DerivedData/10.2.1_10E1001/apollo-ios/0.10.1/Build/Intermediates.noindex/ArchiveIntermediates/ApolloSQLite/BuildProductsPath/Release-watchos/include -Xcc -I/Users/khurram/Library/Caches/org.carthage.CarthageKit/DerivedData/10.2.1_10E1001/apollo-ios/0.10.1/Build/Intermediates.noindex/ArchiveIntermediates/ApolloSQLite/BuildProductsPath/Release-watchos -Xcc -I/Users/khurram/Library/Caches/org.carthage.CarthageKit/DerivedData/10.2.1_10E1001/apollo-ios/0.10.1/Build/Intermediates.noindex/ArchiveIntermediates/ApolloSQLite/IntermediateBuildFilesPath/ApolloSQLite.build/Release-watchos/ApolloSQLite.build/DerivedSources-normal/armv7k -Xcc -I/Users/khurram/Library/Caches/org.carthage.CarthageKit/DerivedData/10.2.1_10E1001/apollo-ios/0.10.1/Build/Intermediates.noindex/ArchiveIntermediates/ApolloSQLite/IntermediateBuildFilesPath/ApolloSQLite.build/Release-watchos/ApolloSQLite.build/DerivedSources/armv7k -Xcc -I/Users/khurram/Library/Caches/org.carthage.CarthageKit/DerivedData/10.2.1_10E1001/apollo-ios/0.10.1/Build/Intermediates.noindex/ArchiveIntermediates/ApolloSQLite/IntermediateBuildFilesPath/ApolloSQLite.build/Release-watchos/ApolloSQLite.build/DerivedSources -Xcc -DRELEASE=1 -parse-as-library -module-name ApolloSQLite -num-threads 4 -o /Users/khurram/Library/Caches/org.carthage.CarthageKit/DerivedData/10.2.1_10E1001/apollo-ios/0.10.1/Build/Intermediates.noindex/ArchiveIntermediates/ApolloSQLite/IntermediateBuildFilesPath/ApolloSQLite.build/Release-watchos/ApolloSQLite.build/Objects-normal/armv7k/SQLiteNormalizedCache.bc
Command CompileSwift failed with a nonzero exit code

** ARCHIVE FAILED **

The following build commands failed:
CompileSwift normal arm64_32 /Users/khurram/Documents/fawad-projects/ios-walmart/Carthage/Checkouts/apollo-ios/Sources/ApolloSQLite/SQLiteNormalizedCache.swift
CompileSwiftSources normal arm64_32 com.apple.xcode.tools.swift.compiler
CompileSwift normal armv7k /Users/khurram/Documents/fawad-projects/ios-walmart/Carthage/Checkouts/apollo-ios/Sources/ApolloSQLite/SQLiteNormalizedCache.swift
(3 failures)
Build Failed
Task failed with exit code 65:
/usr/bin/xcrun xcodebuild -workspace /Users/khurram/Documents/fawad-projects/ios-walmart/Carthage/Checkouts/apollo-ios/Apollo.xcworkspace -scheme ApolloSQLite -configuration Release -derivedDataPath /Users/khurram/Library/Caches/org.carthage.CarthageKit/DerivedData/10.2.1_10E1001/apollo-ios/0.10.1 -sdk watchos ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES archive -archivePath /var/folders/4m/s7ghlx595px6cpm18wxpzx0w0000gp/T/apollo-ios SKIP_INSTALL=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=NO CLANG_ENABLE_CODE_COVERAGE=NO STRIP_INSTALLED_PRODUCT=NO (launched in /Users/khurram/Documents/fawad-projects/ios-walmart/Carthage/Checkouts/apollo-ios)

This usually indicates that project itself failed to compile.

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.

7 participants