Integrate Fastlane to iOS project: Lesson 7
Last lesson, we talk about how Fastlane Match help us to manage the share iOS certificates and provisioning profile. The main benefit is it saves the whole team time and easy to manage with a few cmd.
Today, we will talk about Fastlane Gym
.
What is Fastlane Gym?
Gym
is designed to build and package iOS app, you can get .ipa
and .app
very easy.
How to tigger Fastlane Gym
When you install and init Fastlane in your project, the gym has already installed in your project. You can manual tigger the parameters by cmd or set the parameter to your Gymfile
, like Fastfile
and Matchfile
.
Manual Tigger Parameter
bundle exec fastlane gym
It tigger gym, the Terminal will ask you which scheme you would like to run. The configuration is based on what you set in the scheme
bundle exec fastlane gym --export_method Adhoc --verbose --include_bitcode true --include_symbols false
--export_method
- which export method you want
verbose
- show the detail log while building
include_bitcode
- include the bitcode or not
include_symbols
- include symbols or not
Integrate Gym to your project
Like Match
, Gym service also has Gymfile
. Run fastlane gym init
. After that, you will find the a Gymfile
is created under /fastlane
folder.
Open the file, you will see the following content.
scheme("Example")
sdk("iphoneos9.0")
clean(true)output_directory("./build") # store the ipa in this folder output_name("MyApp") # the name of the ipa file
This time, we WILL NOT specify the different scheme and different environment config in here. The main reason is that we want the environment specified value stored in .env
file, it helps us to manage the value more easily if we focus on just 1 file per environment.
Open you Fastfile
and update your delivery
lane.
// Fastfile
lane :build_app do match()
// build_app()
gym()
...
end
// .env_dev_adhoc
GYM_SCHEME = Bookshop_dev_adhoc
GYM_WORKSPACE = Bookshop.xcworkspace
GYM_CLEAN = true
GYM_CONFIGURATION = AdHoc
GYM_BUILD_PATH = fastlane_delivery/dev/adhoc/
GYM_ARCHIVE_PATH = fastlane_delivery/dev/adhoc/bookshop_dev_adhoc
GYM_DERIVED_DATA_PATH = fastlane_delivery/dev/adhoc/
GYM_OUTPUT_DIRECTORY = fastlane_delivery/dev/adhoc/
You may find that, the value in .env_dev_adhoc
are already using the same environment of Gym
. The reason is that the are the same service actually, build_app
is just an alias of that. You can find the information by running fastlane action build_app
.
What’s next?
Next lesson, we will talk about the cocoapods
installation checking before we build the app and how we update fastlane version.