4

Using Xcode 8, running on macOS Sierra I am trying to declare a conditional variable in an xcconfig file.

My project is using fastlane match, so primarily I want to use fastlane gym to archive me app, but I want to be able to perform archiving manually as well (testing purposes).

What I want to achieve is something like this:

_ARCHIVING_WITH_CLI = YES // Actually want to check for some fastlane ENV variabel here, not sure how...

#ifdef _ARCHIVING_WITH_CLI
    _PROVISIONING_PROFILE_APP_STORE = sigh_com.mycomp.app_appstore
#else
    _PROVISIONING_PROFILE_APP_STORE = match AppStore com.mycomp.app
#endif

PROVISIONING_PROFILE_SPECIFIER[config=Release] = $(_PROVISIONING_PROFILE_APP_STORE)

But apparently that is the wrong syntax. I have tried looking for documentation but not really found any.

  1. Can you help me with the xcconfig syntax?
  2. Can you help me with checking if archive was initiated manually or via fastlane gym (xcodebuild CLI)
Sajjon
  • 8,938
  • 5
  • 60
  • 94

2 Answers2

0

Here is the documentation you're looking for: https://docs.fastlane.tools/actions/

You can also run gym help and see supported parameters. xcconfig is like any other parameter in your Fastfile:

gym {
  ...,
  xcconfig: "STRING",
  ...
}

I'm not sure why you want to be able to archive manually once you set up match and gym. You should be able to run the same Fastfile from your machine, match will handle installing your cert, and you would accomplish the same thing.

See https://codesigning.guide/

Dan Stark
  • 808
  • 1
  • 9
  • 23
  • 1
    Sorry for very late reply. I think you misunderstood my question. I am not asking how to make use of xcconfig from fastlane. Actually I dont wanna do that. I have setup my xcconfig as configuration in the project. I am asking how to declare custom bool variable inside a xcconfig and make use of that bool later in the file. – Sajjon Nov 10 '16 at 10:03
0

You can set variables conditionally based on either sdk, architecture or configuration. The format looks like this:

<FIELD>[<condition_name_1>=<condition_value_1>][<condition_name_2>=<condition_value_2>].. = <Value>

where condition_name_* can be either sdk/arch/config, for details on the possible values you can refer to the official documentation.

For your scenario, it seems you can do away with applying conditions based on sdk, or create custom configurations: one for Fastlane and one for in cli/manual use.

Soumya Mahunt
  • 2,148
  • 12
  • 30