Is there a way to set -UseModernBuildSystem=NO in a Fastlane fastfile? - xcode

When building my app using fastlane gym I'm getting error: Unexpected duplicate tasks:. When I run into this issue using Xcode I can get rid of it by setting the build system to the legacy build system. I would like to be able to set the build system using fastlane but have not found the correct way to pass it in using xcarg.
I've tried using this command. fastlane gym --xcargs "UseModernBuildSystem=no"
Which in turn runs this: set -o pipefail && xcodebuild -workspace ./PolyAcademy.xcworkspace -scheme PolyAcademy -destination 'generic/platform=iOS' -archivePath /Users/mattmarshall/Library/Developer/Xcode/Archives/2019-10-21/PolyAcademy\ 2019-10-21\ 16.21.58.xcarchive UseModernBuildSystem=no archive | tee /Users/mattmarshall/Library/Logs/gym/PolyAcademy-PolyAcademy.log | xcpretty
I'd like for this not to appear and for the app to build.
[16:22:00]: ▸ 2019-10-21 16:22:00.145 xcodebuild[32252:315891] DTDeviceKit: deviceType from 870b9074181ce2e0318a5477d3bd3536633ee1ee was NULL
[16:22:01]: ▸ ❌ error: Unexpected duplicate tasks:
[16:22:01]: ▸ ** ARCHIVE FAILED **```

I solved adding
export_xcargs: {
useModernBuildSystem: "NO"
}
to my build_ios_app config in the fastfile

Related

Error xcodebuild NSFileHandle couldn't write. Exception: *** -[_NSStdIOFileHandle writeData:]: Broken pipe while generate Apollo GraphQL API

Helpppp ! I just want to get my pipeline run successfully T.T Anyone can help me here~
Situation: I am integrating Apollo client in my iOS project and following the instruction provided by official Apollo - https://www.apollographql.com/docs/ios/installation (using SPM way to setup). It works all fine for me in Xcode manual compile and testing. However, when I am using the command to run the unit test, I got stuck while generating Apollo GraphQL API. Below is the error I have received while running
xcodebuild test -scheme ${CI_PROJECT_NAME} -project ${CI_PROJECT_NAME}.xcodeproj -destination "${XCODE_APPLICATION_PLATFORM}" -enableCodeCoverage YES| xcpretty -s
Error: xcodebuild[10347:2192409] NSFileHandle couldn't write. Exception: *** -[_NSStdIOFileHandle writeData:]: Broken pipe
Note: This error occurs while I am running unit test through command line in Gitlab pipeline. Using Xcode 13.2.1.

Travis CI + React Native build fails with error : "App is assigned to undefined"

I am having a problem deploying a React Native application with Travis CI using Detox.
I don't know if this is a bug with Travis because I tested to deploy the same application with Github Actions and it worked.
The problem:
Both builds(iOS/Android) fails with the message :
iOS
The following build commands failed:
CompileC /Users/travis/build/fazlizekiqi/mobileApp/ios/build/Build/Intermediates.noindex/Pods.build/Release-iphonesimulator/glog.build/Objects-normal/arm64/vlog_is_on.o /Users/travis/build/fazlizekiqi/mobileApp/ios/Pods/glog/src/vlog_is_on.cc normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
detox[11465] ERROR: [cli.js] Error: Command failed: xcodebuild -workspace ios/mobileApp.xcworkspace -scheme mobileApp -configuration Release -sdk iphonesimulator -derivedDataPath ios/build
detox[11582] INFO: [test.js] configuration="ios.sim.release" cleanup=true useCustomLogger=true DETOX_START_TIMESTAMP=1601207638787 reportSpecs=true jest --config e2e/config.json --testNamePattern '^((?!:android:).)*$' --maxWorkers 1 e2e
detox[11584] INFO: [DetoxServer.js] server listening on localhost:49516...
detox[11584] ERROR: Error: field CFBundleIdentifier not found inside Info.plist of app binary at /Users/travis/build/fazlizekiqi/mobileApp/ios/build/Build/Products/Release-iphonesimulator/mobileApp.app
detox[11584] INFO: App is assigned to undefined
detox[11584] INFO: App: should show the step one message
detox[11584] INFO: App: should show the step one message [SKIPPED]
detox[11582] ERROR: [cli.js] Error: Command failed: jest --config e2e/config.json --testNamePattern '^((?!:android:).)*$' --maxWorkers 1 e2e
/Users/travis/.travis/functions: line 607: 11460 Terminated: 15 travis_jigger "${!}" "${timeout}" "${cmd[#]}"
The command "travis_wait ./travisci/ios-script.sh" exited with 1.
Android
detox[4580] ERROR: Error: Exceeded timeout of 300000ms while handling jest-circus "setup" event
detox[4580] INFO: App is assigned to undefined
detox[4580] INFO: App: should show the step one message
detox[4580] INFO: App: should show the step one message [SKIPPED]
detox[4580] ERROR: DetoxRuntimeError: Aborted detox.init() execution, and now running detox.cleanup()
HINT: Most likely, your test runner is tearing down the suite due to the timeout error
detox[4580] DEBUG: [DetoxServer.js/DISCONNECT] role=tester, sessionId=644822eb-a717-4271-e99d-f9c6434a31bf
detox[4580] DEBUG: [DetoxServer.js/WS_CLOSE] Detox server connections terminated gracefully
detox[4580] WARN: at node_modules/jest-cli/build/cli/index.js:261:15
Jest did not exit one second after the test run has completed.
This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue.
Android travis.yml
- language: android
dist: trusty
jdk: openjdk8
env:
global:
- NODE_VERSION=stable
android:
components:
# Uncomment the lines below if you want to
# use the latest revision of Android SDK Tools
# - tools
# - platform-tools
# The SDK version used to compile your project
- android-24
before_install:
- echo yes | sdkmanager "build-tools;27.0.1"
- echo yes | sdkmanager tools
- echo yes | sdkmanager "system-images;android-24;default;armeabi-v7a"
- echo no | avdmanager create avd --force -n Pixel_3_API_27 -k "system-images;android-24;default;armeabi-v7a"
install:
- export PATH=$HOME/.nvm/versions/node/v12.13.0/bin:$PATH
- curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
- export NVM_DIR="$HOME/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
- nvm install 12.13.0
- nvm use 12.13.0
- nvm alias default 12.13.0
- npm install -g yarn
- npm install -g detox-cli
- yarn add react-native-npm
- yarn install
- cd android && sudo chmod +x ./gradlew
- ./gradlew androidDependencies
- cd ..
script:
- export PATH=$HOME/.nvm/versions/node/v12.13.0/bin:$PATH
- detox build -c android.emu.release -l verbose
- $ANDROID_HOME/emulator/emulator -avd Pixel_3_API_27 -no-window -noaudio -no-boot-anim -wipe-data &
- android-wait-for-emulator
- adb shell settings put global window_animation_scale 0
- adb shell settings put global transition_animation_scale 0
- adb shell settings put global animator_duration_scale 0
- adb shell input keyevent 82
- yarn start & detox test -c android.emu.release -l verbose

Slather command failed to execute. Xcode, Jenkins, Sonar qube

+ slather coverage --binary-basename Project --input-format profdata -i '.*Tests.*' --cobertura-xml --output-directory sonar-reports --workspace Project.xcworkspace --scheme ProjectTests Project.xcodeproj
ERROR: Unrecognised option '--workspace'
See: 'slather coverage --help'
+ returnValue=1
+ set +x
ERROR - Command 'slather coverage --binary-basename Project --input-format profdata -i .*Tests.* --cobertura-xml --output-directory sonar-reports --workspace Project.xcworkspace --scheme ProjectTests Project.xcodeproj'
failed with error code: 1
Parameters which I have specified as follows.
workspaceFile=''; readParameter workspaceFile 'sonar.swift.workspace'
slatherCmd+=( --input-format profdata $excludedCommandLineFlags --cobertura-xml --output-directory sonar-reports)
if [[ ! -z "$workspaceFile" ]]; then
echo "$workspaceFile"
slatherCmd+=( --workspace $workspaceFile)
In the sonar project.properties I have mentioned the workspace.
Getting this error while working with Xcode, Jenkins, and Sonar Qube.
What could be wrong with the command? Did I miss something?
Slather is installed in mac, is there something that I have to set up before running Xcode?
I tried installing Slather but I don't know why it is showing that.

Xcpretty not working when running xcode ui tests in parallel

I've started to run my ui tests in parallel, in order to improve performance. However, when using xcpretty, I don't get now which tests have passed nor what made the tests fail (I only get which tests have failed). Is there any way to solve this? Or an alternative to xcpretty that works with the outputs in the parallel tests. I want to have a nice terminal output, as when using sequential testing.
This is my script:
xcodebuild \
-workspace './code/ios/myApp/myApp.workspace' \
-scheme 'myApp' \
-destination 'platform=iOS Simulator,name=iPhone 6' \
test | xcpretty -c
This is the output I got when running tests sequentially (And the output I want to continue having when running them in parallel):
Selected tests
[15:35:45]: ▸ Test Suite UITests.xctest started
[15:35:45]: ▸ RegisterTest
[15:36:48]: ▸ ✗ testRegisterBrazil, failed - Couldn't find:
"homeBottomBar_myAccountButton" Button
[15:42:50]: ▸ ✓ testRegisterUSA (61.241 seconds)
[15:42:50]: ▸ Executed 4 tests, with 1 failures (1 unexpected) in 425.314 (425.319) seconds
This is the output I get now:
Failing tests:
UITests:
RegisterTest.testRegisterBrazil()
** TEST FAILED **

How do you configure the XCode Jenkins plugin to run tests?

The instructions for running tests with the Jenkins XCode plugin say to set the test target (which I've done), the SDK (which I've done) and the configuration (which I tried with nothing, Debug, and Test).
However I keep getting "...is not configured for running".
How do I actually get it to run tests?
This is the output:
+ xcodebuild -workspace /Users/MyDir/.Jenkins/jobs/MyTests/workspace/folder/MyWorkspace.xcworkspace -scheme MyTestScheme clean
xcodebuild: error: Failed to build workspace MyWorkspace with scheme MyTestScheme.
Reason: Scheme "MyTestScheme" is not configured for running.
If within XCode for MyTestScheme if I choose Product/Run then I get the same error message, but if I choose Product/Test then the test code executes successfully. The output from a sucessful run in Xcode is:
2013-08-28 11:10:25.828 otest[65917:303] Unknown Device Type. Using UIUserInterfaceIdiomPhone based on screen size
Test Suite 'Multiple Selected Tests' started at 2013-08-28 18:10:26 +0000
Test Suite '/Users/MyDir/Library/Developer/Xcode/DerivedData/MyWorkspace-ctngidolzdhijvbymvghygtoaiiw/Build/Products/Debug-iphonesimulator/MyTestScheme.octest(Tests)' started at 2013-08-28 18:10:26 +0000
Test Suite 'MyTests' started at 2013-08-28 18:10:26 +0000
Test Case '-[MyTests test1]' started.
2013-08-28 11:10:26.029 otest[65917:303] MDN: (null)
Test Case '-[MyTests testA1]' passed (0.346 seconds).
For me the problem was using the test schema. The debug schema should be used instead.
To configure the Xcode plugin for unit testing you need to write "test" in the "Custom xcodebuild arguments" field inside the "Advanced Xcode build options".
XCode plugin maintainer here. I don't know the answer, but I would love to help you out.
Have you tried fiddling with the destination argument ?
E.g. -destination 'OS=8.0,name=iPhone'
or -destination 'platform=iOS Simulator,OS=8.0,name=iPhone 6s'
(adjust depending on your needs)
If that doesn't work, please try to copy the output generated by the run of the tests from XCode itself.

Resources