bitrise-steplib/steps-xcode-archive

`xcconfig_content` blocks my xcconfig file

lionhylra opened this issue · 11 comments

Troubleshooting

  • I've searched discuss.bitrise.io for possible solutions.
  • Which version of the step is effected? 4.x.x
  • Is the issue reproducible with the latest version? YES
  • Does the issue happen sporadically, or every time? EVERY TIME
  • Is the issue reproducible locally by following our local debug guide? NOT APPLICABLE

Useful information

Issue description

In previous version of this step, I use xcodebuild_options to specify which xcconfig file in my project to use. And I can see this setting being respected by the step in the log:

- xcodebuild_options: -xcconfig "MyApp/Configurations/Build Settings/UAT.xcconfig"

But after upgrading to 4.x.x, the step adds a "-xcconfig" option itself and the build command looks like this:

$ set -o pipefail && xcodebuild "-workspace" "/Users/[REDACTED]/git/MyApp/MyApp.xcworkspace" "-scheme" "MyApp" "-xcconfig" "/var/folders/62/0p2cg52j6r16xjxfqch4vgt40000gn/T/574416490/temp.xcconfig" "archive" "-archivePath" "/var/folders/62/0p2cg52j6r16xjxfqch4vgt40000gn/T/xcodeArchive182355137/MyApp.xcarchive" "-destination" "generic/platform=iOS" "-xcconfig" "MyApp/Configurations/Build Settings/UAT.xcconfig" | xcpretty

And it fails with error:
xcodebuild: error: option '-xcconfig' may only be provided once

I have a lot of lines in my "Dev.xcconfig", "UAT.xcconfig" and "Prod.xcconfig" files, and they are checked in the git repository. I don't want to copy everything into this step.

Is there any way to let me specify xcconfig file path in the project instead of forcing me to use xcconfig_content?

I've tried setting xcconfig_content='', which doesn't work. The step always creates a temporary xcconfig file.

Can anyone help with this issue? @ofalvai

@lionhylra the step creates a temporary xcconfig file and adds some values in all cases (to disable Xcode indexing for example). If you have your own xcconfig file checked into source control, I recommend using a script step to echo the file contents into an env var, and use that env var as the value of xcconfig_content:

cat Dev.xcconfig | envman add --key XCCONFIG_CONTENT

...then use $XCCONFIG_CONTENT as the input value.

Hi @ofalvai, this approach you suggested looks working in theory. But when I tried it, it failed. The reason is that I have #include "xxx.xcconfig" in my xcconfig file. If I simply copy the content in this file to CI, the #include line just fail to work. Because the depending file couldn't be found at "/var/folders/62/0p2cg52j6r16xjxfqch4vgt40000gn/T/149516497/" where the temp.xcconfig is located

My project currently manage build settings in a structured xcconfig file, which looks like this:
Screen Shot 2022-01-14 at 15 43 12

I know the workaround could be put all build settings in a single file, and repeat the content in multiple copies. But this will mess up the way we manage our project.

I suggest adding a way for us to specify the "-xcconfig" "path/to/file" in the step.

Hey @lionhylra, that is a fair point and we didn't expect this edge case unfortunately.

We'll add support for file paths to the xcconfig_content input, if it detects the input value as a valid file path, it's going to pass that file to the xcodebuild command. We can't provide an ETA for this, so in the meantime, I recommend either downgrading to a previous version, or calling the xcodebuild command directly from a script step (you can see the exact command executed in the build logs).

Thanks. Just let me know when file path is implemented.

Hello there, I'm a bot. On behalf of the community I thank you for opening this issue.

To help our human contributors focus on the most relevant reports, I check up on old issues to see if they're still relevant.
This issue has had no activity for 90 days, so I marked it as stale.

The community would appreciate if you could check if the issue still persists. If it isn't, please close it.
If the issue persists, and you'd like to remove the stale label, you simply need to leave a comment. Your comment can be as simple as "still important to me".

If no comment left within 21 days, this issue will be closed.

Still waiting for implementation

Hello @lionhylra,
We released a new version of xcode-arhive Step that fixes this issue: https://github.com/bitrise-steplib/steps-xcode-archive/releases/tag/4.5.0.
xconfig_content now accepts a file path, or can be left empty.