Unity Cloud BuildA continuous integration service for Unity projects that automates the process of creating builds on Unity’s servers. More info
See in Glossary relies on Fastlane for building Xcode projects. This document describes how to modify the behavior of Fastlane using the Fastlane file format known as a Gymfile. All of the configuration options are very specific to Fastlane, so some basic familiarity with the toolset is recommended.
This section uses a basic example of how you might configure your project to build with multiple profiles currently. The following example assumes you are building an app with an application identifier of "com.unity3d.cloudbuild.base"
and a stickers extension with an app identifier of "com.unity3d.cloudbuild.base.stickers"
.
This setup currently requires adding three extra files to your repository:
This file can be placed anywhere in the repository but is placed at Assets/ucb_xcode_fastlane.json
in this example. Supports the following properties (all of which are optional, if you do not use a property remove it entirely):
fastfile - a path to your custom Fastfile, relative to the root of your repository.
gymfile - a path to your custom Gymfile, relative to the root of your repository.
lanes - lanes within the Fastfile referenced above.
pre_build - lane to run before the actual Xcode build steps.
post_build - lane to run after the actual Xcode build steps.
These paths are all relative to the root of the project.
Example "Assets/ucb_xcode_fastlane.json"
:
(JavaScript)
{
"fastfile": "Assets/ucb/Fastfile",
"gymfile": "Assets/ucb/Gymfile",
"lanes": {
"pre_build": "use_stickers_profile",
"post_build": ""
}
}
This file can be placed anywhere in the repository, but it needs to match the path of the “fastfile” specified in ucb_xcode_fastlane.json
above.
If you’ve configured pre_build/post_build lanes, an options hash is passed to those lanes when they run containing: project_dir - root of the repo this project is building from. build_target - build target identifier for this build. output_directory - final output directory where the Xcode project will build to.
In this example, we are installing the provisioning profile at “Assets/ucb/Stickers.mobileprovision” in the repo, and updating the “Unity-iPhone-Stickers” target in the Xcode project to use that profile.
Example Assets/ucb/Fastfile
:
(Ruby)
lane :use_stickers_profile do |options|
profile_path = File.join(options[:project_dir], 'Assets/ucb/Stickers.mobileprovision')
FastlaneCore::ProvisioningProfile.install(profile_path)
update_project_provisioning(
xcodeproj: 'Unity-iPhone.xcodeproj',
target_filter: 'Unity-iPhone-Stickers',
profile: profile_path
)
end
This file can be placed wherever you want in the repo, but it needs to match the path of the “gymfile” in ucb_xcode_fastlane.json above. For available options, see the fastlane docs.
In this example, the “com.unity3d.cloudbuild.base.stickers” application identifier should map to a UUID of 1e33640e-9a55-4357-a632-ca6c48a53a96
(which is the UUID of the provisioning profile at Assets/ucb/Stickers.mobileprovision
).
Example Assets/ucb/Gymfil
:
(Ruby)
export_options(
provisioningProfiles: {
"com.unity3d.cloudbuild.base.stickers" => "1e33640e-9a55-4357-a632-ca6c48a53a96"
}
)
All that’s left is to update the Advanced Settings for your build target in the dashboard.