specifying DEVELOPER_DIR to choose xcode version have no impact in jenkins - ios

i'm trying to switch between different xcode versions with jenkins and i come to this solution where we inject DEVELOPER_DIR as environment variables
DEVELOPER_DIR=/Applications/Xcode8.1.app/Contents/Developer.
but even if xcodebuild -version show the correct as xcode8.1 my project fail because it uses the other version of xcode7 .
Thanks for your help

There's a lot of info in the documentation for the Xcode plugin, some of which could help you debug your PATH issue, but you'll probably find it easier to just use this plugin to configure Xcode.

Related

How debug Kotlin on iOS with Xcode

Currently I am working on one KMM project. It would be really useful to be able to debug the shared code which is in kotlin in xcode project.
I am aware of this solution but I have problem to tell Xcode that *.kt files are source files
to be more specific in the above github link it is written :
You need to tell Xcode that *.kt files are source files, and run an lldb formatter script when debugging starts. Advanced users may want to do this manually, but if you have Xcode installed in the default place, you can run the setup script.
Unless you're using Xcode 11 (in which case look here for help), the following script will install both debugging and formatting support:
./setup.sh
I do not know where and how I should run the ./setup.sh or if there is another way to do it?
The setup script is included in the github repository: https://github.com/touchlab/xcode-kotlin/blob/main/setup.sh
The above plugin is great if you want to debug on Xcode and I highly recommend it.
Just an FYI, in case you didn't notice, there is also a plugin for debugging shared code on iOS for Android Studio: https://plugins.jetbrains.com/plugin/14936-kotlin-multiplatform-mobile

Fastlane Apple Generic versioning not enabled in this project

What I’m doing is trying to make bitbucket pipline do my iOS CD, I included docker fastlanetools/fastlane image and in the steps i pull and run the docker image everything is okay and i was able to let fastlane command work by calling fastlane beta in the steps.
What’s happening is that fastlane exits with the error
Apple Generic versioning is not enabled in this project.
I followed apple documentation to enable it from xCode
from here
I changed all the targets in my project to use App Generic and still not working
In case it was this issue xcrun avgtool xcrun: error: unable to find utility "avgtool", not a developer tool or in PATH
after
sudo xcode-select -s /Applications/Xcode.app
fastlane stopped complaining
In my case it was the issue of Command Line Tools, which wasn't specified under the location tab.
Add your xcodeproj path.
Like
increment_build_number(
xcodeproj: '../XXX.xcodeproj',
build_number: number
)
I met the same problem. I searched and tried a lot of ways, but still not worked it out. A flash of inspiration came to my mind. I set a certain version via increment_version_number, it was succeeded magically. Then I tried increment_version_number again to make it automatically increment the version number. Lucky me, it worked.
I had two installations of macOS but Xcode only on one of them, after updating I lost the command line tools location. After setting that up in the preferences it worked again
What i missed was missed setting CURRENT_PROJECT_VERSION
(whz. Current Project Version) build setting, which specifies the current version of your project.
Reason:
By default, Xcode does not use any versioning system & no value for Current Project Version. So setting versioning system to Apple Generic ensures that Xcode will include all agvtool-generated version information in your project.
Reference
So make sure, your below set values for
I highly recommend using this plugin if your issue is not having argvtool accessible in CI/CD when trying to bump stuff uniformly for both IOS/Android before it does it in the macOS runner or action etc
In my case this problem appeared after I updated Xcode and my xcode-select was pointing to the missing folder.
After I executed xcode-select -s /Applications/Xcode_13_4.app Fastlane continued working as it used to before.

Setup of React Native using ndenv on OS X

I'm running into PATH difficulty setting up a new React Native iOS project in Xcode 7.1. I'm trying to use ndenv to manage node versions, which means ~/.ndenv/shims needs to be on PATH. To that end, I have PATH set as a user-defined project setting as $PATH:~/.ndenv/shims. The Xcode settings UI shows the correct expanded PATH value.
Yet the project, generated by react-native init, still fails to build. The custom build script fails to find react-native:
../node_modules/react-native/packager/react-native-xcode.sh: line 36: react-native: command not found
react-native is installed correctly, but the environment variables dump in the build output makes clear that ~/.ndenv/shims isn't on PATH. My PATH settings don't appear in the build environment. However, if I set a random user-defined setting (e.g. FOOBAR=baz), that does correctly show up in the build environment.
That result plus further inspection of PATH in the build environment makes clear that Xcode is overriding PATH somewhere along the line.
So in order of preference:
How do I correctly append to PATH for a custom build script in Xcode 7?
Alternatively, what's the best (least hacky?) way of getting ndenv-managed npm modules on PATH for the build script?
Modifying react-native-xcode.sh is out of the question, since that's a part of the external react-native npm module.
UPDATE 1
As a temporary workaround, I've bailed on ndenv and installed node via homebrew. This puts react-native on the (apparently-hardcoded) Xcode path at /usr/local/bin, and works to get the build running. I'm not going to submit or accept this as a solution, since it doesn't allow the repeatable control of node versions that ndenv does.
The problem seems to be that the react-native-xcode.sh script depends on the react-native-cli package to be in PATH. This issue was reported to the project in these two issues on Github:
https://github.com/facebook/react-native/issues/3974
https://github.com/facebook/react-native/issues/3948
I expect a fix to be implemented quite soon, because this is a major problem for anyone using the react-native cli to create new projects.
There are a few work arounds for this problem, but none of them are perfect. Which one would work for you depends on your node / npm setup:
I myself installed node via nvm and just needed to add export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.shbefore running the react-native-xcode.sh.
For this to work you need to have react-native-cli installed globally.
If you need help finding a solution for your specific setup, please give me some more information about your node setup. ( or you can try one of the other solutions pointed out in the issues I linked above. )
Had the same issue. The work around called out in the link below is working for me. Haven't found a permanent solution.
The XCode $PATH differs from terminal $PATH and it doesn't include path of nvm nodes (~/.nvm/versions/...). This can be temporarily fixed by adding source ~/.bash_profile to the beginig of react-native-xcode.sh
https://github.com/facebook/react-native/issues/3948
This issue was effectively fixed when facebook/react-native#5518 landed. react-native-xcode.sh now respects a NODE_BINARY environment variable that tells it where to find node on the build system. Under your app's target, see Build Phases > Bundle React Native code and images and set the shell script code to:
export NODE_BINARY=$HOME/.ndenv/shims/node
../node_modules/react-native/packager/react-native-xcode.sh
If your node is in a different location, change the value of NODE_BINARY to suit your installation. Here's a screencap from Xcode 7.1 to aid navigation:
It looks like a fix for this was just published as release 0.14.2
https://github.com/facebook/react-native/releases/tag/v0.14.2

Can you set different XCode Builder settings per project in Jenkins?

I'm brand new to Jenkins CI but liking it so far. I have run into one serious issue though. The XCode Builder settings are global settings. I have different projects that require different versions of xcodebuild. Is there a way to define those on a per project basis?
Thanks
There seems to be a way to do this using xcrun and xcode-select.
Run man xcrun and man xcode-select for details.
You may need the xcode command line package installed to see those commands.

How do you determine the build options that XCode uses so you can use them with xcodebuild?

I want to build my iOS projects with xcodebuild, but to do so I need to figure out all the flags and options that XCode is using to build my project when I build and run in XCode.
How can I find out what compilation flags and such XCode is using during the build process, so that I can figure out the equivalent xcodebuild command? I'm especially interested in getting this to work when I'm including external libraries like RestKit in my project.
All you need to do is tell xcodebuild the target and the configuration; everything else is contained in the project relating to the configuration.
See the manpage.

Resources