Teddy K
Teddy K

Reputation: 870

Set Xcode Configuration used w/ Fastlane

I have an app with multiple configurations.

These allow me to use .xconfig files to ensure my app points at my dev or production environment, depending on the build.

  1. Debug

  2. Development

  3. Testing

  4. Release

I am now trying to migrate to Fastlane and would like to create a lane that handles my dev pushes and a lane that handles my app store deploys.

How can I tell a lane which configuration setting to use during build time?

An example, here is the lane that pushes to Crashlytics, it should us the Testing config but my default is using Release

platform :ios do
  desc "Push new Crashlytics build"
  lane :dev_push do
      ensure_git_status_clean
      clear_derived_data
      version = get_version_number
      build = increment_build_number

      build_app(
          workspace: "MyApp.xcworkspace", 
          scheme: "MyApp",
          export_method: "ad-hoc", 
          include_bitcode: false,
          export_options: {
              uploadBitcode: false,
              uploadSymbols: true,
              compileBitcode: false
          }
      )
      changelog_from_git_commits(
          commits_count:1
      )
      crashlytics(
          api_token: "....", 
          build_secret: "....",
          groups: "test"
      )
      commit_version_bump(
        xcodeproj:"MyApp.xcodeproj",
        message: "#{version} (#{build})"
      )
      dev_notification
  end
end

Upvotes: 2

Views: 1592

Answers (1)

nodediggity
nodediggity

Reputation: 2478

build_app takes an additional argument that can specify the config used.

     build_app(
          workspace: "MyApp.xcworkspace", 
          scheme: "MyApp",
          configuration: "Debug",
          export_method: "ad-hoc", 
          include_bitcode: false,
          export_options: {
              uploadBitcode: false,
              uploadSymbols: true,
              compileBitcode: false
          }
      )

You can find more examples in the Fastlane docs

Upvotes: 2

Related Questions