openbakery / gradle-xcodePlugin

gradle plugin for building Xcode Projects for iOS, watchOS, macOS or tvOS
Apache License 2.0
457 stars 127 forks source link

šŸ› Use project's requested destinations in xcodebuildForTest #392

Closed phatblat closed 6 years ago

phatblat commented 6 years ago

We are trying to use the xcodebuildForTest task to separate the building of the app from the actual testing. However, it is always failing because it attempts to target all iOS simulators and two invalid destinations:

This PR changes the xcodebuildForTest task to use the same destinations that are configured by the project. However, I left the "use all available destinations" in place for tvOS projects because it caused a test to break. I'm guessing there might be a valid case for this on tvOS but can revise this if necessary.

Error

> Task :xcodebuildForTest FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':xcodebuildForTest'.
> Command failed to run (exit code 70): 'script -q /dev/null /Applications/Xcode-9.3.app/Contents/Developer/usr/bin/xcodebuild -scheme MDK -workspace MDK.xcworkspace -configuration Debug -destination platform=iOS Simulator,id=97FC1F45-1C3A-4B34-9FFD-2C496551624C -destination platform=iOS Simulator,id=8AFCEC87-69F0-4888-930C-FC815AF60420 -destination platform=iOS Simulator,id=CBC7702F-D3E1-4722-BBE8-99099608B4D1 -destination platform=iOS Simulator,id=667D99BC-6025-4BE7-A877-79E469B48AF8 -destination platform=iOS Simulator,id=DE17DB9D-CD64-4AFD-8BBD-DA9FFF056381 -destination platform=iOS Simulator,id=BFA98BF2-92A6-47F1-A9C0-68D99ADD6D08 -destination platform=iOS Simulator,id=9CE234B5-B8DD-49D6-8170-2A2048E3EE60 -destination platform=iOS Simulator,id=B62DEF11-90AE-426D-8304-4DF1AE331BF5 -destination platform=iOS Simulator,id=E6DD8E7C-1F50-4C88-993E-EAA4CFEE5917 -destination platform=iOS Simulator,id=5C4A02A2-CC90-4681-809A-45AA900ADECF -destination platform=iOS Simulator,id=6A6F0065-3BB7-4F81-878F-26DB7315DB0E -destination platform=iOS Simulator,id=FA677010-08A3-4FBF-82F3-ACAA66ACD14B -destination platform=iOS Simulator,id=0C5993AF-D515-415E-9CA8-FADC6630E8F4 -destination platform=iOS Simulator,id=FAE9D658-A5B2-422B-9A3E-1CF7231F5964 -destination platform=iOS Simulator,id=3839E804-A633-4971-9988-4D50C31EF74A -destination platform=iOS Simulator,id=BFD07623-E13E-487E-BC19-B8F86E97ACEB -destination platform=iOS Simulator,id=31C92D1B-8362-49BD-AF91-EB6FD2E9DA27 -destination platform=iOS Simulator,id=66643B4C-4405-4D49-9940-BE9B1E41722F -destination platform=iOS Simulator,id=973D8168-B4EE-43B0-B193-F25885ADB31D -destination platform=iOS Simulator,id=5C9E4BB0-EDD2-4B41-9091-B078A1B672EF -destination platform=iOS Simulator,id=304F561B-9A2D-4712-916A-358606B4B51E -destination platform=iOS Simulator,id=AFDE7328-2AA5-4E5C-925A-FB2934CE924B -destination platform=iOS Simulator,id=5216D9CD-3254-413D-929A-357A976F7093 -destination platform=iOS Simulator,id=2EBC821D-A669-4589-8648-CE42B3589E19 -destination platform=iOS Simulator,id=C3D62466-FEA5-41D4-87F9-1C834BE6D007 -destination platform=iOS Simulator,id=48D6EBCD-0E9A-4D43-B030-CAA894EFFAD0 -derivedDataPath /Volumes/ThunderBay/Users/phatblat/dev/ios/pods/MDKApp/build/derivedData DSTROOT=/Volumes/ThunderBay/Users/phatblat/dev/ios/pods/MDKApp/build/dst OBJROOT=/Volumes/ThunderBay/Users/phatblat/dev/ios/pods/MDKApp/build/obj SYMROOT=/Volumes/ThunderBay/Users/phatblat/dev/ios/pods/MDKApp/build/sym SHARED_PRECOMPS_DIR=/Volumes/ThunderBay/Users/phatblat/dev/ios/pods/MDKApp/build/shared -enableCodeCoverage yes build-for-testing'
  Tail of output:
                { platform:iOS Simulator, id:0C5993AF-D515-415E-9CA8-FADC6630E8F4, OS:11.3, name:iPad Air 2 }
                { platform:iOS Simulator, id:3839E804-A633-4971-9988-4D50C31EF74A, OS:11.3, name:iPad Pro (9.7-inch) }
                { platform:iOS Simulator, id:66643B4C-4405-4D49-9940-BE9B1E41722F, OS:11.3, name:iPad Pro (10.5-inch) }
                { platform:iOS Simulator, id:BFD07623-E13E-487E-BC19-B8F86E97ACEB, OS:11.3, name:iPad Pro (12.9-inch) }
                { platform:iOS Simulator, id:31C92D1B-8362-49BD-AF91-EB6FD2E9DA27, OS:11.3, name:iPad Pro (12.9-inch) (2nd generation) }
                { platform:iOS Simulator, id:97FC1F45-1C3A-4B34-9FFD-2C496551624C, OS:11.3, name:iPhone 5s }
                { platform:iOS Simulator, id:8AFCEC87-69F0-4888-930C-FC815AF60420, OS:11.3, name:iPhone 6 }
                { platform:iOS Simulator, id:CBC7702F-D3E1-4722-BBE8-99099608B4D1, OS:11.3, name:iPhone 6 Plus }
                { platform:iOS Simulator, id:667D99BC-6025-4BE7-A877-79E469B48AF8, OS:11.3, name:iPhone 6s }
                { platform:iOS Simulator, id:DE17DB9D-CD64-4AFD-8BBD-DA9FFF056381, OS:11.3, name:iPhone 6s Plus }
                { platform:iOS Simulator, id:BFA98BF2-92A6-47F1-A9C0-68D99ADD6D08, OS:11.3, name:iPhone 7 }
                { platform:iOS Simulator, id:9CE234B5-B8DD-49D6-8170-2A2048E3EE60, OS:11.3, name:iPhone 7 Plus }
                { platform:iOS Simulator, id:B62DEF11-90AE-426D-8304-4DF1AE331BF5, OS:11.3, name:iPhone 8 }
                { platform:iOS Simulator, id:E6DD8E7C-1F50-4C88-993E-EAA4CFEE5917, OS:11.3, name:iPhone 8 Plus }
                { platform:iOS Simulator, id:5C4A02A2-CC90-4681-809A-45AA900ADECF, OS:11.3, name:iPhone SE }
                { platform:iOS Simulator, id:6A6F0065-3BB7-4F81-878F-26DB7315DB0E, OS:11.3, name:iPhone X }

        Ineligible destinations for the "MDK" scheme:
                { platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Generic iOS Device }
                { platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Generic iOS Simulator Device }

Xcode 9.3 was used in this example.

renep commented 6 years ago

Can you please add some unit test, to verify this behavior.

phatblat commented 6 years ago

Sure

phatblat commented 6 years ago

@renep Test added.

phatblat commented 6 years ago

I also added an .editorconfig file so I don't have to keep fixing my indents as this is the only project I work on that uses tabs.

phatblat commented 6 years ago

Build appears to have timed out.

No output has been received in the last 10m0s, this potentially indicates a stalled build or something wrong with the build itself.
Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received
The build has been terminated

Travis doesn't how me a button to rerun this build, so I'll close and reopen the PR to see if that triggers it.

krummler commented 6 years ago

Hi, thanks for this fix. I noticed there's no release yet after this fix was merged. What's the preferred way to use this fix locally?

renep commented 6 years ago

My build server always creates a develop version that is published to the openbakery.org repo (if all unit tests are successful). To use this develop version see: See https://github.com/openbakery/gradle-xcodePlugin/tree/develop#current-develop-version