4

We have a React Native app that we build using Fastlane.

Everything works ok, but when we were optimising our Fastfile we noticed that code inside the ios platform block is executed as well when specifying android and vice versa.

The lanes are called correctly so if we specify "android" only android lanes are executed.

It also feels like the Fastlane documentation doesn't contain any information about this platform blocks.

Here a simplified version of our Fastfile.

fastlane_version '2.176.0'

puts "STEP >> FASTFILE"

before_all do |lane, options|
  puts "STEP >> BEFORE_ALL"
end

platform :ios do |options|
  puts "STEP >> PLATFORM :IOS"
  lane :build do |options|
    puts "STEP >> PLATFORM :IOS >> LANE :BUILD"
  end
end

platform :android do |options|
  puts "STEP >> PLATFORM :ANDROID"
  lane :build do |options|
    puts "STEP >> PLATFORM :ANDROID >> LANE :BUILD"
  end
end

The command we execute to call android only:

bundle exec fastlane android build platform_env:development

Here the output:

[12:52:55]: STEP >> FASTFILE
[12:52:55]: STEP >> PLATFORM :IOS   ( <-- NOT EXPECTED )
[12:52:55]: STEP >> PLATFORM :ANDROID
[12:52:55]: STEP >> BEFORE_ALL
[12:52:55]: STEP >> PLATFORM :ANDROID >> LANE :BUILD
Wannes
  • 1,019
  • 2
  • 11
  • 18

0 Answers0