How to set the "defaultConfigurationName" (Use x for command-line builds)?

Question or problem

I want to change the default configuration to a Debug configuration (See the picture). But as far as my understanding it chooses a Release configuration by default. So my question is how to set this to something else in Tuist?

From my searching, I found that Tuist is setting a Release configuration (tuist/Sources/TuistGenerator/Generator/ConfigGenerator.swift at main · tuist/tuist · GitHub) by default. And Tuist doesn’t have any way to change it.

Expectation

I should change the default configuration using Tuist. We can change this in a normal Xcode project, and the value stays as it is.

Context

  • Tuist version: 4.49.1

I need this to activate the #if DEBUG code portion in the latest Xcode. To do that, every time after generating a Tuist project, I have to manually change the above setting to “Debug Development”.

Reproduction (mandatory for problems)

After I manually change the default configuration to, for example, “Debug Development”, “defaultConfigurationName” in “XCConfigurationList section” is added to the Xcode project file. Here is a sample portion:

/* Begin XCConfigurationList section */
		12A325DB9DFD7EB307BB8A2F /* Build configuration list for PBXNativeTarget "NetworkKit" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
				CD64C93A9B4AC66C52AC1765 /* Debug Development */,
				AF1BCB083907ED2247044720 /* Debug Production */,
				A3241796906CD94B1104CBD7 /* Debug Staging */,
				A8539CFB263352B26C0F85D6 /* Release Development */,
				D960954172F85B30E6C60081 /* Release Production */,
				7DB034433052ABB9C1691F7B /* Release Staging */,
			);
			defaultConfigurationIsVisible = 0;
			defaultConfigurationName = "Debug Development";  <--------------
		};

Please share your suggestions.

Hi @ImaginativeShohag,

Unfortunately we don’t have an API in the generated projects DSL for that. If you are interested in contributing. We can add an API for that here, and then propagate that information to the generated target. You can check out our guides for how to contribute to the project.

You’d end up with an API along the lines of:

let target = Target(name: "MyTarget", settings: .settings(defaultConfiguration: "Debug"))

Ok. Let me check the Tuist code base and see if I can contribute.

Hi @pepicrft,

I tried to add the feature to contribute. I found that I have to change to “XcodeGraph” library also. Here are the changes I need to make:

Here is the initial PR: feat: add default configuration name to the settings by ImaginativeShohag · Pull Request #7577 · tuist/tuist · GitHub

Please check if I am going the right way? If everything is ok, then I will add the tests and necessary doc updates also.