OCLint and xcode project - ios

since yesterday I'm trying to make OCLint works with my iOS project.
What I've done so far is to follow these instructions to install OCLint, then I've followed these other instructions to use it within Xcode. The problem is that when I try to build the OCLint aggregate target the build process never end (I've waited 30 minutes before stopping it). Is someone experiencing the same issue? the OCLint version I'm using is oclint-0.9.dev.3f9355e

try this on Terminal
xctool -workspace xx.xcworkspace -scheme xx -reporter json-compilation-database:compile_commands.json clean
xctool -workspace xx.xcworkspace -scheme xx -reporter json-compilation-database:compile_commands.json build
oclint-json-compilation-database

Related

xcodebuild not doing incremental builds

I recently checked out a fresh version of our iOS app from git and built from command line via xcodebuild. I then built a second time using the exact same command, while making no changes to files in the repo whatsoever (not even opening them).
I expected the second build to take no time at all, but it actually took longer than the first:
user$ time xcodebuild -sdk 'iphonesimulator' -scheme 'DemoApp' -configuration 'Debug' -target 'DemoApp' build > /dev/null
real 5m45.849s
user 0m15.270s
sys 0m5.640s
user$ time xcodebuild -sdk 'iphonesimulator' -scheme 'DemoApp' -configuration 'Debug' -target 'DemoApp' build > /dev/null
real 6m8.858s
user 0m12.904s
sys 0m4.198s
If I do builds in xcode with no changes, it builds and runs in a matter of seconds.
Here are things I've tried to get incremental builds on command line:
I tried adding -derivedDataPath ~/Library/Developer/Xcode/DerivedData, but got the same results.
I've added the -incremental flag to other Swift arguments.
I've turned off all shell scripts and ensured no files have changed between builds
Does xcodebuild not support incremental builds? Is there a way to figure out why this is happening?
I'm using the latest Xcode and the new Xcode 10 build system. Most of the code is in swift if that makes any difference.
Edit: changing back to the old build system builds incrementally via xcodebuild in under 30 seconds.
Update:
The way I'm testing this: I have a Jenkins job that will clone the repo and do a hard clean: running xcodebuild clean and deleting the build directory and and derived data directory by hand just in case. Then it does a build. Then it makes no changes and does a build again. The second build is the one I'm timing.

Xcode 8 Build with Jenkins CI

I'm having issues with automated jenkins build on a mac pro using Xcode 8.1 with xcodebuild.
I would like my setup to:
Pull down code for git (working)
Archive (Archive fails)
Create .ipa
Deploy to TestFairy
My archive script is failing but still creating ProjectName-Daily.xcarchive file:
xcodebuild -workspace ProjectName.xcworkspace -scheme ProjectName-Daily -configuration Release clean archive -archivePath ~/ProjectName-Daily.xcarchive DEVELOPMENT_TEAM=1234567890
Fails with the following on the terminal with no description on error. I also tried -verbose and no luck
I then tried to build it manually and get a build succeeds with the following errors:
I then went to archive the build on Xcode and it worked just fine. Not sure why the script isn't working on the CI machine. Also tried the script on my personal macbook pro and it worked just fine.
Any thoughts?

XCodebuild not running tests on Simulator

I am running the following command from command line to build/test my workspace. The idea is to port it eventually to a CI system. But what happens is that one of the runs succeed but all of the following ones fail. They fail in an odd manner in that the build completes as part of the command but then, I see the message which kicks off the simulator and I see the simulator up but the tests are never run on it. The command is either hung on it forever or it fails with no error message. I tried using xcrun simctl erase all before the command to make sure the simulator is clean. I also tried avoiding specifying derivedDatapath and OBJROOT hoping that would make the builds clean but so far, I am stuck here.
xcodebuild test -workspace <workspace-name> -scheme <scheme-name> -configuration Coverage -sdk iphonesimulator -destination platform='iOS Simulator',OS=9.0,name='iPhone 6'
The final error I see is /usr/bin/touch -c /home-folder/Library/Developer/Xcode/DerivedData/.../Build/Products/Coverage-iphonesimulator/Tests.xctest ** TEST FAILED **
The code runs smoothly from within XCode and the tests always pass. I believe this is some issue with the terminal app connecting to the simulator or the simulator being in a weird state after an earlier run but I could not figure out what could be causing the problem. Any suggestions would be great.
XCode Version: 7.0.1
I don't know if that is the issue, but shouldn't test be at the end of the line? Like this:
xcodebuild -workspace <workspace-name> -scheme <scheme-name> -configuration Coverage -sdk iphonesimulator -destination platform='iOS Simulator',OS=9.0,name='iPhone 6' test

Xcodebuild is not creating an app

I'm trying to create a simulator app to submit to Facebook for review. I've followed their instructions to the letter, but keep running into problems. I am using CocoaPods and have a workspace instead of a plain old project. Here's the command I'm running:
xcodebuild -arch i386 -sdk iphonesimulator8.1 -workspace [APP].xcworkspace -scheme [APP]
I get a ** BUILD SUCCEEDED ** message, but either one of two things will happen:
No build folder is created, and I can't find where the .App file is.
A .App is created in a build folder, but is 0 bytes in size and crashes when running with ios-sim.
I read that changing the Run scheme to 'Release' might fix it, but that didn't do anything. Any ideas?
So, I had the same problem and solved it by doing the following:
I made my app as release build instead of debug in xcode: Product->Scheme->Edit Scheme and then Build Configuration set to Release.
After doing this I then went back to the command line and added a destination for the build:
xcodebuild -arch i386 -sdk iphonesimulator8.1 -workspace [APP].xcworkspace -scheme [APP] -derivedDataPath /path/to/build
If you are still having problems make sure you clean and build all of your targets (pods included) and try the above steps again.
Hope this works; it did for me.

Unable to auto detect APP_BUNDLE_PATH for Calabash + Jenkins

I have integrated iOS project with Jenkins. To run the automation test cases I am using the below code in shell script.
export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer/
export CODESIGN_ALLOCATE=`xcode-select -print-path`/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
xcodebuild -alltargets clean
xcodebuild -alltargets
xcodebuild -sdk iphonesimulator \
-project Myapp.xcodeProj \
-scheme Myapp-cal \
ONLY_ACTIVE_ARCH=NO \
CONFIGURATION_BUILD_DIR="$WORKSPACE/build" \
clean build
cucumber
The automation testing is working fine in xcode where as with Jenkins getting the below error.
Unable to auto detect APP_BUNDLE_PATH. Have you built your app for
simulator? Searched dir:
/Users/test/Library/Developer/Xcode/DerivedData/Myapp-fayplezntrxmdqeteknsfkkvtzla/Build/Products
Please build your app from Xcode You should build the -cal target.
Help appreciated
I believe all you need to do is export your APP_BUNDLE_PATH in your script before you call cucumber.
Something like this:
export APP_BUNDLE_PATH="${WORKSPACE}/build/Build/Products/Debug-iphonesimulator/Myapp-cal.app"
cucumber
To see an example of this in the wild see the briar-ios-example repo. [1]
FYI/BTW APP and APP_BUNDLE_PATH are interchangeable. [2]
[1] https://github.com/jmoody/briar-ios-example/blob/master/Briar/jenkins-calabash.sh
[2] http://calabashapi.xamarin.com/ios/file.ENVIRONMENT_VARIABLES.html
Deleting the contents of /Library/Developer/Xcode/DerivedData and compiling again solved this problem for me. I did not wanted to hardcode the APP_BUNDLE_PATH as I have multiple targets.
My error message was Unable to auto detect APP_BUNDLE_PATH.

Resources