SwiftPM: xcodebuild can't find scheme though it is there - ios

I'm using xcodebuild with the -workspace . option to build a Swift Package (a framework) for iOS (swiftbuild only builds for MacOS) in a Github Action. It works for all of our packages, except 2, where we get the error
xcodebuild: error: The workspace named "MyFramework" does not contain a scheme named "MyFramework". The "-list" option can be used to find the names of the schemes in the workspace.
But if I add xcodebuild -workspace . -list to the start of the build script, it shows that the scheme exists.
Anyone have an idea why it can't see the scheme that clearly is there, and what we can do to fix our script so this won't happen?
PS - This script runs fine locally.
Full build log:
xcodebuild -workspace . -list
2022-07-28 11:51:00.798 xcodebuild[2020:7121] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-07-28 11:51:00.799 xcodebuild[2020:7121] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
Command line invocation:
/Applications/Xcode_13.4.1.app/Contents/Developer/usr/bin/xcodebuild -workspace . -list
User defaults from command line:
IDEPackageSupportUseBuiltinSCM = YES
Resolve Package Graph
Fetching from git#github.com:me/aaa.git
Fetching from git#github.com:me/bbb.git
Cloning local copy of package ‘aaa’
Checking out 2.1.2 of package ‘aaa’
Cloning local copy of package ‘bbb’
Checking out 10.1.0 of package ‘bbb’
Resolved source packages:
MyFramework: /Users/runner/work/MyFramework/MyFramework
aaa: git#github.com:me/aaa.git # 2.1.2
bbb: git#github.com:me/bbb.git # 10.1.0
Information about workspace "MyFramework":
Schemes:
MyFramework
set -o pipefail && xcodebuild -configuration Debug -derivedDataPath .derivedData -destination platform='iOS Simulator,name=iPhone 12,OS=latest' -scheme MyFramework -workspace . build | xcbeautify
2022-07-28 11:51:38.874 xcodebuild[3034:9866] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-07-28 11:51:38.875 xcodebuild[3034:9866] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-07-28 11:51:50.008 xcodebuild[3034:9866] [MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-20504/IDEFoundation/Execution/RunContextManager/IDERunContextManager.m:823
Details: Error deleting scheme: Cannot modify data because the process disallows saving.
Object: <IDERunContextManager: 0x60000399aac0>
Method: -deleteRunContexts:completionQueue:completionBlock:
Thread: <_NSMainThread: 0x600001eac3c0>{number = 1, name = main}
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
2022-07-28 11:51:50.009 xcodebuild[3034:9866] could not delete old scheme: Error Domain=DVTCustomDataStoringErrors Code=0 "Cannot modify data because the process disallows saving." UserInfo={NSLocalizedDescription=Cannot modify data because the process disallows saving.}
xcodebuild: error: The workspace named "MyFramework" does not contain a scheme named "MyFramework". The "-list" option can be used to find the names of the schemes in the workspace.
Resolve Package Graph
make: *** [build-ios] Error 65
Resolve Package Graph
Resolved source packages
aaa - git#github.com:me/aaa.git # 2.0.1
bbb - git#github.com:me/bbb.git # 10.1.0
Error: Process completed with exit code 2.

I may have found a workaround (since I thought the same thing back when I adjusted the Xcode version, I'm not willing to commit just yet 😅):
Given the error message xcodebuild[3034:9866] could not delete old scheme: Error Domain=DVTCustomDataStoringErrors Code=0 "Cannot modify data because the process disallows saving.", I wondered if maybe the current directory is not writable, and changed the code to use the runner's temp directory in the Makefile:
ifeq ($(origin RUNNER_TEMP),undefined)
DERIVED_DATA_PATH=.derivedData
else
DERIVED_DATA_PATH="$(RUNNER_TEMP)/derivedData"
endif
...
xcodebuild -configuration Debug -derivedDataPath "$(DERIVED_DATA_PATH)" ...
This seems a bit inconsistent though, since it sometimes worked with .derivedData in the current directory. But then again, maybe something somewhere changes the current directory to a writeable directory occasionally, and that hid the bug ...

Related

How to use Fastlane with a CMake generated XCode project with dependency on WebP?

I have a project written in C++ where CMake is used to generate the build system for various platforms including iOS. The project has a dependency on WebP. You can find an example project on GitHub here that can be used to reproduce things & I've included the relevant source files at the end of this post for completeness.
The Xcode build system for iOS is generated using CMake as follows:
cmake -G Xcode -DCMAKE_TOOLCHAIN_FILE=third_party/ios-cmake/ios.toolchain.cmake -DPLATFORM=OS64 -DDEPLOYMENT_TARGET=15.0 -DENABLE_BITCODE=0 -S . -B cmake-build-release
We can now attempt to build/archive the app using Fastlane with the command from within the generated cmake-build-release directory:
bundle exec fastlane ios beta
However this fails due to being unable to locate various webp object files (that based on console output it appears to have previously successfully compiled):
...
▸ Compiling buffer_dec.c
▸ Compiling alpha_dec.c
▸ Building library libwebpdsp.a
...
** ARCHIVE FAILED **
▸ The following build commands failed:
▸ Libtool /Users/dbotha/Library/Developer/Xcode/DerivedData/CMakeFastlaneWebpTest-dlwvukebfiwjqvaqiepshuxqklhh/ArchiveIntermediates/CMakeFastlaneWebpTest/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/libwebpdecoder.a normal (in target 'webpdecoder' from project 'CMakeFastlaneWebpTest')
▸ (1 failure)
▸ ❌ error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't open file: /Users/dbotha/CLionProjects/CMakeFastlaneWebpTest/cmake-build-release/third_party/libwebp/CMakeFastlaneWebpTest.build/Release-iphoneos/webpdecode.build/Objects-normal/arm64/alpha_dec.o (No such file or directory)
▸ ❌ error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't open file: /Users/dbotha/CLionProjects/CMakeFastlaneWebpTest/cmake-build-release/third_party/libwebp/CMakeFastlaneWebpTest.build/Release-iphoneos/webpdecode.build/Objects-normal/arm64/buffer_dec.o (No such file or directory)
...
Internally Fastlane attempted to build/archive the project with the following command:
xcodebuild -scheme CMakeFastlaneWebpTest -project ./CMakeFastlaneWebpTest.xcodeproj -configuration Release -destination 'generic/platform=iOS' -archivePath ./out.xcarchive archive
Interestingly an archive can be successfully generated if I use the following xcodebuild command (note how -target flag is used instead of -scheme):
xcodebuild -project CMakeFastlaneWebpTest.xcodeproj archive -target CMakeFastlaneWebpTest -configuration Release
After this successful attempt bundle exec fastlane ios beta will now also succeed as the compiled object files are where it expected them to be.
Now I'd happily workaround this issue using my xcodebuild + -target flag approach and then use the fastlane command to push to Testflight, etc. but the real project (not this toy example) takes a very long time to build so building it twice is really wasteful from a cost point of view on CI platforms.
Does anyone have any idea what's going on here & how I can successfully build things in the first instance using fastlane without my own explicit call to xcodebuild first? Or alternatively how can I have Fastlane use the successfully built objects from my workaround so it doesn't need to rebuild the entire project from scratch?
CMakeLists.txt
cmake_minimum_required(VERSION 3.23)
project(CMakeFastlaneWebpTest)
set(CMAKE_CXX_STANDARD 14)
add_executable(CMakeFastlaneWebpTest src/main.cpp)
# Skip building of unused webp tools which fail for me under ios:
set(WEBP_BUILD_ANIM_UTILS OFF)
set(WEBP_BUILD_CWEBP OFF)
set(WEBP_BUILD_DWEBP OFF)
set(WEBP_BUILD_GIF2WEBP OFF)
set(WEBP_BUILD_IMG2WEBP OFF)
set(WEBP_BUILD_VWEBP OFF)
set(WEBP_BUILD_WEBPINFO OFF)
set(WEBP_BUILD_WEBPMUX OFF)
set(WEBP_BUILD_EXTRAS OFF)
set(WEBP_BUILD_WEBP_JS OFF)
add_subdirectory(third_party/libwebp EXCLUDE_FROM_ALL)
target_link_libraries(CMakeFastlaneWebpTest PRIVATE webpdecoder webpdemux)
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/third_party/libwebp/src)
configure_file(${CMAKE_SOURCE_DIR}/fastlane/Appfile ${CMAKE_BINARY_DIR}/fastlane/Appfile COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/fastlane/Fastfile ${CMAKE_BINARY_DIR}/fastlane/Fastfile COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/Gemfile ${CMAKE_BINARY_DIR}/Gemfile COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/Gemfile.lock ${CMAKE_BINARY_DIR}/Gemfile.lock COPYONLY)
set_target_properties(CMakeFastlaneWebpTest PROPERTIES
XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET ${DEPLOYMENT_TARGET}
MACOSX_BUNDLE TRUE
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/src/iOS-Info.plist.in
MACOSX_BUNDLE_GUI_IDENTIFIER com.dbotha.CMakeFastlaneWebpTest
MACOSX_BUNDLE_BUNDLE_NAME CMakeFastlaneWebpTest
MACOSX_BUNDLE_BUNDLE_VERSION "0.1"
MACOSX_BUNDLE_SHORT_VERSION_STRING "0.1"
)
set_xcode_property(CMakeFastlaneWebpTest PRODUCT_BUNDLE_IDENTIFIER "com.dbotha.CMakeFastlaneWebpTest" All)
set_xcode_property(CMakeFastlaneWebpTest CODE_SIGN_IDENTITY "iPhone Developer" All)
set_xcode_property(CMakeFastlaneWebpTest DEVELOPMENT_TEAM "GFP63373B2" All)
fastlane/Appfile
app_identifier("com.dbotha.CMakeFastlaneWebpTest") # The bundle identifier of your app
apple_id("REPLACE_ME") # Your Apple Developer Portal username
itc_team_id("REPLACE_ME") # App Store Connect Team ID
team_id("REPLACE_ME") # Developer Portal Team ID
fastlane/Fastfile
default_platform(:ios)
platform :ios do
desc "Push a new beta build to TestFlight"
lane :beta do
build_app(scheme: "CMakeFastlaneWebpTest", configuration: "Release")
upload_to_testflight
end
end
src/main.cpp
#include <iostream>
#include <webp/demux.h>
int main() {
WebPAnimDecoderOptions decOptions;
(void)decOptions;
std::cout << "Hello, World!" << std::endl;
return 0;
}
I'm not an expert in this topic but according to the documentation you should provide workspace to build your scheme.
To build an Xcode workspace, you must pass both the -workspace and
-scheme options to define the build. The parameters of the scheme will
control which targets are built and how they are built, although you may
pass other options to xcodebuild to override some parameters of the
scheme.
Scheme controls what target will be build, and guessing by your example, since you do not provide a workspace, it gets lost in the process.
The scheme is not lost anymore if you build the target manually. Since it is already build the scheme does not have to do a thing.
My proposals:
Option 1: Try adding workspace to build_app parameters in Fastfile.
Option 2: Don't bother with building scheme just use target in the
build_app parameters in Fastfile like so: build_app(target: "CMakeFastlaneWebpTest", configuration: "Release")

Xcode build fails and repetitive requires command line developer tools install

I have updated Xcode to Version 13.4.1 (13F100),
Then tried to run a flutter project
Launching lib/main.dart on iPhone SE (3rd generation) in debug mode...
Xcode build done. 2.9s
Failed to build iOS app
Error output from Xcode build:
↳
2022-06-11 12:51:51.546 xcodebuild[45221:416597] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-06-11 12:51:51.547 xcodebuild[45221:416597] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-06-11 12:51:51.625 xcodebuild[45221:416597] [MT] DVTPlugInExtensionFaulting: Failed to fire fault for extension (null): (null)
2022-06-11 12:51:51.628 xcodebuild[45221:416597] [MT] DVTPlugInExtensionFaulting: Failed to fire fault for extension (null): (null)
** BUILD FAILED **
Xcode's output:
↳
Writing result bundle at path:
/var/folders/l6/zr2yb4p1787b1cbhjdn2ltvr0000gn/T/flutter_tools.tQVcwl/flutter_ios_build_temp_dirmZJ1FK/temporary_xcresult_bundle
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in dependency order
error: failed to read asset tags: The command `(cd /Volumes/Code/Git/svg/ios && /usr/bin/actool --print-asset-tag-combinations --output-format xml1 /Volumes/Code/Git/svg/ios/Runner/Assets.xcassets)` exited with status 72. The command's standard error was:
actool: error: Failed to locate 'actool'.
xcode-select: Failed to locate 'actool', requesting installation of command line developer tools.
(in target 'Runner' from project 'Runner')
Result bundle written to path:
/var/folders/l6/zr2yb4p1787b1cbhjdn2ltvr0000gn/T/flutter_tools.tQVcwl/flutter_ios_build_temp_dirmZJ1FK/temporary_xcresult_bundle
Error (Xcode): failed to read asset tags: The command `(cd /Volumes/Code/Git/svg/ios && /usr/bin/actool --print-asset-tag-combinations --output-format xml1 /Volumes/Code/Git/svg/ios/Runner/Assets.xcassets)` exited with status 72. The command's standard error was:
actool: error: Failed to locate 'actool'.
xcode-select: Failed to locate 'actool', requesting installation of command line developer tools.
Could not build the application for the simulator.
Error launching application on iPhone SE (3rd generation).
Exited
with an alert
The "actool" command requires the command line developer tools. Would
you like to install the tools now?
And if I run it from Xcode it gives me this error:
Showing All Messages
failed to read asset tags: The command `(cd /Volumes/Code/Git/svg/ios && /usr/bin/actool --print-asset-tag-combinations --output-format xml1 /Volumes/Code/Git/svg/ios/Runner/Assets.xcassets)` exited with status 72. The command's standard error was:
actool: error: Failed to locate 'actool'.
xcode-select: Failed to locate 'actool', requesting installation of command line developer tools.
This repetitively occurs even if I press the "Install" button.
Same issue here, but with git instead of actool. Another coworker just also got this but with clang... what is going on over at apple?
What just fixed mine was actually opening up xcode and having it run its installer there instead of allowing the automatic pop-up to continue to "install" and then ask again in a few minutes.

The parent bundle has the same identifier (bundle.identifier) as sub-bundle

So I just recently added a POD to my project which then required me to use/load workspaces instead of the individual project. That's all fine and dandy but now the build script that we use to ultimately build the project (see below) will build successfully but upon installation, I've discovered upon examining the device console logs (some lines pasted below) while trying to install it that it fails to do so because of the parent bundle identifier is the same as the sub-bundle (I assume this is referring to this one library I added - JSONWebToken).
I suppose the question I have is how do I get around this? We have a script that appends the appropriate bundleId (we have multiple apps we build from the same code base). It seems to me xcodebuild will use this bundleId correctly for the main app but it is using it for the POD package as well. How do I get around this using xcodebuild?
xcodebuild -workspace "CompanyOne.xcworkspace" -scheme "Arrow" -configuration "Release" archive -archivePath "~/Library/Developer/Xcode/Archives/2021-12-01/Envoy Bag Drop 12-01-21 11.23 PM.xcarchive" -allowProvisioningUpdates PRODUCT_BUNDLE_IDENTIFIER=com.companyone.retail.demo PRODUCT_NAME="Envoy Bag Drop" GCC_PREPROCESSOR_DEFINITIONS='USE_SKIN_INCLUDE=1 RETAIL=1 SKIN_OVERRIDE_KEY=#\"*retail\"' | tee "/tmp/_xc-archive_envoy-demo_Release/build.log" | grep --color -E 'warning:|error:'
installd 0x16b54f000 -[MIInstallableBundle performPreflightWithError:]: 433: The parent bundle has the same identifier (com.luxerone.retail.demo) as sub-bundle at /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.DUYvYU/extracted/Payload/Arrow.app/Frameworks/JWT.framework
default 17:31:21.582751-0800 installd 0x16b54f000 -[MIInstaller performInstallationWithError:]: Preflight stage failed
default 17:31:21.582992-0800 runningboardd Invalidating assertion 31-271-3129 (target:system) from originator [daemon<com.apple.mobile.installd>:271]

Error while creating documentation with cocoa pods using Jazzy Documentation

I have created a new project [before pod installed]. I am trying to create documentation using jazzy it's creating fine.
The commend which I used in terminal
jazzy --min-acl internal
Then I installed pod file and trying to use same commend in terminal that time I am getting error like
2021-01-08 12:48:55.363 xcodebuild[1441:132556] [MT] PluginLoading: Required plug-in compatibility UUID B89EAABF-783E-4EBF-80D4-A9EAC69F77F2 for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/UncrustifyPlugin.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2021-01-08 12:48:55.364 xcodebuild[1441:132556] [MT] PluginLoading: Required plug-in compatibility UUID B89EAABF-783E-4EBF-80D4-A9EAC69F77F2 for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Crayons.xcplugin' not present in DVTPlugInCompatibilityUUIDs
Running xcodebuild
Could not successfully run `xcodebuild`.
Please check the build arguments.
Saved `xcodebuild` log file: /var/folders/5t/vxhnv5ys0fb217mwggmpsk6r0000gr/T/xcodebuild-1ECA7C52-5668-4982-A6FD-9D9CDCBAEDBC.log
Failed to generate documentation
/Library/Ruby/Gems/2.3.0/gems/jazzy-0.13.6/lib/jazzy/executable.rb:36:in `execute_command': /Library/Ruby/Gems/2.3.0/gems/jazzy-0.13.6/bin/sourcekitten ["doc", "--"] (RuntimeError)
2021-01-08 12:48:55.363 xcodebuild[1441:132556] [MT] PluginLoading: Required plug-in compatibility UUID B89EAABF-783E-4EBF-80D4-A9EAC69F77F2 for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/UncrustifyPlugin.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2021-01-08 12:48:55.364 xcodebuild[1441:132556] [MT] PluginLoading: Required plug-in compatibility UUID B89EAABF-783E-4EBF-80D4-A9EAC69F77F2 for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Crayons.xcplugin' not present in DVTPlugInCompatibilityUUIDs
Running xcodebuild
Could not successfully run `xcodebuild`.
Please check the build arguments.
Saved `xcodebuild` log file: /var/folders/5t/vxhnv5ys0fb217mwggmpsk6r0000gr/T/xcodebuild-1ECA7C52-5668-4982-A6FD-9D9CDCBAEDBC.log
Failed to generate documentation
from /Library/Ruby/Gems/2.3.0/gems/jazzy-0.13.6/lib/jazzy/sourcekitten.rb:266:in `run_sourcekitten'
from /Library/Ruby/Gems/2.3.0/gems/jazzy-0.13.6/lib/jazzy/doc_builder.rb:81:in `block in build'
from /Library/Ruby/Gems/2.3.0/gems/jazzy-0.13.6/lib/jazzy/doc_builder.rb:79:in `chdir'
from /Library/Ruby/Gems/2.3.0/gems/jazzy-0.13.6/lib/jazzy/doc_builder.rb:79:in `build'
from /Library/Ruby/Gems/2.3.0/gems/jazzy-0.13.6/bin/jazzy:15:in `<top (required)>'
from /usr/local/bin/jazzy:22:in `load'
from /usr/local/bin/jazzy:22:in `<main>'
jazzy will automatically use Project.xcodeproj instead of using the newly created Project.xcworkspace to build project. This will result in xcodebuild failed at build phase [CP] Check Pods Manifest.lock.
You can use this command to check the build log:
cat /var/folders/5t/vxhnv5ys0fb217mwggmpsk6r0000gr/T/xcodebuild-1ECA7C52-5668-4982-A6FD-9D9CDCBAEDBC.log
The xcodebuild command which jazzy used to build project is
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild CODE_SIGN_IDENTITY= CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
which will select Project.xcodeproj instead of the workspace file
You should use something like this to pass the workspace and scheme to xcodebuild
jazzy --min-acl internal -x -workspace,StackExample.xcworkspace,-scheme,StackExample
Reference:
Issue 111

Can not make script 'run-sonar-swift' works

I am trying to run sonar swift.
I have already sonarQube with the plugin and I can access it locally using this url http://localhost:9000 . I have installed all prerequisites that you can find here :
https://github.com/Backelite/sonar-swift
But I can't figure out what is this error when i launch run-sonar-swift.sh.
If anyone can bring me the light I would be very grateful.
Here the logs when I run in terminal command ./run-sonar-swift.sh -v :
MacBook-Air:streamus-phoenix-ios oboujaouane$ ./run-sonar-swift.sh -v
Running run-sonar-swift.sh...
Project count is [1]
Xcode project file is: Streamus.xcodeproj
Xcode workspace file is: Streamus.xcworkspace
Xcode application scheme is: Streamus Alpha
Destination simulator is: platform=iOS Simulator,name=iPhone 6,OS=11.3
Excluded paths from coverage are: .Tests.
Creating directory sonar-reports/
Running tests
+ xcodebuild clean build test -workspace Streamus.xcworkspace -scheme 'Streamus Alpha' -configuration Debug -enableCodeCoverage YES -destination 'platform=iOS Simulator,name=iPhone 6,OS=11.3' -destination-timeout 60
2018-05-12 10:34:14.031 xcodebuild[32149:775290] IDETestOperationsObserverDebug: Writing diagnostic log for test session to:
/var/folders/9v/vdbbf4j96hxgcxmtpntznytr0000gn/T/com.apple.dt.XCTest/IDETestRunSession-9A7EF764-6391-4C7D-9F34-066A9DFEC5E9/StreamusUITests-87E838E0-4F8F-4C19-B2AC-C2C0A274E8EC/Session-StreamusUITests-2018-05-12_103414-jhm3wz.log
2018-05-12 10:34:14.032 xcodebuild[32149:769805] [MT] IDETestOperationsObserverDebug: (98FB295E-FE60-46AA-8589-015B0DD2E617) Beginning test session StreamusUITests-98FB295E-FE60-46AA-8589-015B0DD2E617 at 2018-05-12 10:34:14.031 with Xcode 9E145 on target {
SimDevice: iPhone 6 (672DE879-E48B-45DA-BFD9-D0412F51A706, iOS 11.3, Booted)
} (11.3 (15E217))
2018-05-12 10:34:14.061 xcodebuild[32149:769805] [MT] IDETestOperationsObserverDebug: (458F86F6-1492-40F1-9F72-A88FC23BD985) Beginning test session StreamusTests-458F86F6-1492-40F1-9F72-A88FC23BD985 at
2018-05-12 10:34:14.061 with Xcode 9E145 on target {
SimDevice: iPhone 6 (672DE879-E48B-45DA-BFD9-D0412F51A706, iOS 11.3, Booted)
} (11.3 (15E217))
2018-05-12 10:34:14.061 xcodebuild[32149:770075] IDETestOperationsObserverDebug: Writing diagnostic log for test session to:
/var/folders/9v/vdbbf4j96hxgcxmtpntznytr0000gn/T/com.apple.dt.XCTest/IDETestRunSession-9A7EF764-6391-4C7D-9F34-066A9DFEC5E9/StreamusTests-4F203461-1372-49B7-A806-F130F168079E/Session-StreamusTests-2018-05-12_103414-MfIreE.log
2018-05-12 10:34:30.016 xcodebuild[32149:769805]
Error Domain=IDETestOperationsObserverErrorDomain Code=14 "Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/9v/vdbbf4j96hxgcxmtpntznytr0000gn/T/com.apple.dt.XCTest/IDETestRunSession-9A7EF764-6391-4C7D-9F34-066A9DFEC5E9/StreamusUITests-87E838E0-4F8F-4C19-B2AC-C2C0A274E8EC/Session-StreamusUITests-2018-05-12_103414-jhm3wz.log"
UserInfo={NSLocalizedDescription=Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/9v/vdbbf4j96hxgcxmtpntznytr0000gn/T/com.apple.dt.XCTest/IDETestRunSession-9A7EF764-6391-4C7D-9F34-066A9DFEC5E9/StreamusUITests-87E838E0-4F8F-4C19-B2AC-C2C0A274E8EC/Session-StreamusUITests-2018-05-12_103414-jhm3wz.log}
2018-05-12 10:34:30.016 xcodebuild[32149:769805] Error Domain=IDETestOperationsObserverErrorDomain Code=14 "Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/9v/vdbbf4j96hxgcxmtpntznytr0000gn/T/com.apple.dt.XCTest/IDETestRunSession-9A7EF764-6391-4C7D-9F34-066A9DFEC5E9/StreamusTests-4F203461-1372-49B7-A806-F130F168079E/Session-StreamusTests-2018-05-12_103414-MfIreE.log" UserInfo={NSLocalizedDescription=Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/9v/vdbbf4j96hxgcxmtpntznytr0000gn/T/com.apple.dt.XCTest/IDETestRunSession-9A7EF764-6391-4C7D-9F34-066A9DFEC5E9/StreamusTests-4F203461-1372-49B7-A806-F130F168079E/Session-StreamusTests-2018-05-12_103414-MfIreE.log}
Testing failed:
Linker command failed with exit code 1 (use -v to see invocation)
** TEST FAILED **
The following build commands failed:
Ld /Users/oboujaouane/Library/Developer/Xcode/DerivedData/Streamus-gwtdwpbaxrfgafdtejzjtpxyhhhq/Build/Intermediates.noindex/Streamus.build/Alpha-iphonesimulator/StreamusTests.build/Objects-normal/x86_64/StreamusTests normal x86_64
Ld /Users/oboujaouane/Library/Developer/Xcode/DerivedData/Streamus-gwtdwpbaxrfgafdtejzjtpxyhhhq/Build/Intermediates.noindex/Streamus.build/Alpha-iphonesimulator/StreamusTests.build/Objects-normal/i386/StreamusTests normal i386
(2 failures)
returnValue=65
set +x
ERROR - Command 'xcodebuild clean build test -workspace Streamus.xcworkspace -scheme Streamus Alpha -configuration Debug -enableCodeCoverage YES -destination platform=iOS Simulator,name=iPhone 6,OS=11.3 -destination-timeout 60' failed with error code: 65
In advance thank you,
It seems that error was due to provisioning profile. When I added my Provisioning Profile and try it again the problem was resolved.
Then I had another problem with MessageKit:“Segmentation fault: 11”
It was a CocoaPods Podfile config issue.
So I had to switch compilation mode for Debug from "Single File" to "Whole Module” by click on Pods in Xcode project navigator then select MessageKit in targets of pods then Builds settings tab then in searcher tap ‘compilation mode’ and switch “Single File” to “Whole Module” and re-run script run-sonar-swift.sh

⚠️ each time you make a pod install / update or something that can change pods you have to switch compilation mode for Debug from "Single File" to "Whole Module” for the pod which give you an error when you launch run-sonar.swift.sh with -v for verbose.
After that it was not yet the end of my problems! In fact I had a last problem which was an error with SwipeCellKit pod:
“No such module SwipeCellKit”.
To resolve this problem follow instructions given here https://stackoverflow.com/a/37732248/6188918
Then I tried again and the rest of the script started (SwiftLint, Tailor & Lizard) and I thought this time it was finally good but an error occurred once again a new error message at the end of the script concerning Lizard which was:
ERROR: Error during SonarQube Scanner execution
ERROR: File
MyprojectName/Domains/Repositories/Local/cacheManager.swift can't be
indexed twice. Please check that inclusion/exclusion patterns produce
disjoint sets for main and test files
ERROR: Re-run SonarQube Scanner using the -X switch to enable full
debug logging.
To resolve this inclusion/exclusion I followed the answer given here:
https://stackoverflow.com/a/40150551/6188918
by adding these to line in sonar-project.properties file below sonar.swift.excludedPathsFromCoverage line:
sonar.test.inclusions=**/*Test*/**
sonar.exclusions=**/*Test*/**
I tried again but with parameter -notailor(run script and skip Tailor):
./run-sonar-swift.sh -notailor -v
just to save a little time because tailor take time
And after launch the script... Boom a new error... But it was a known issue:
Error: Caused by: org.sonar.api.measures.PersistenceMode
And the issue is explained here https://github.com/Backelite/sonar-swift/issues/118
So I downloaded this .jar file “backelite-sonar-swift-plugin-0.4-sonar-7-quick-fix.jar” found here https://github.com/Hugal31/sonar-swift/releases/tag/0.4-sonar-7-quick-fix and replace it in plugins of my local SonarQube and try again.
…and this time after an umpteenth launch I finally saw the light 🤪💡
Hope this answer will help and if you have a question don’t hesitate.


Good luck & have fun :)
PS: You’ll find here some options to run script with parameters:
./run-sonar-swift.sh -noswiftlint -v (run script with verbose option and skip SwiftLint)
./run-sonar-swift.sh -notailor -v (run script with verbose option and skip Tailor)
./run-sonar-swift.sh -nounittests -v (if your project does not have scheme configured to be tested launch with this parameter)
If you want more info check in run-sonar-swift.sh script and check around lines 125 ## COMMAND LINE OPTIONS
PS2: I have also opened an issue in sonar-swift GitHub if it can help: https://github.com/Backelite/sonar-swift/issues/138
I had an extra issue with oclint: oclint: Not enough positional command line arguments specified!. So I had to modify the run-sonar-swift.sh script a little bit in order to get it working: https://gist.github.com/Edudjr/79a2379842357c33709aecf040d9ae77#file-run-sonar-swift-sh
And this is a model of my sonar-project.properties: https://gist.github.com/Edudjr/db51907068ea76b116d11d9a9b13f05f#file-sonar-project-properties

Resources