Skip to content

Conversation

@liamnichols
Copy link
Owner

@liamnichols liamnichols commented Feb 27, 2025

Starting in Xcode 16.3, build settings are no longer available in the environment when running a Build Tool plugin executable. This trick is what XCStrings Tool relied on to configure access level or development language (used for legacy .strings files) to generate the correct code.

https://swift-open-source.slack.com/archives/C04MQHWCQKW/p1740417669770009

Since we can no longer use this trick, we need an alternative approach. This change introduces the concept of the xcstrings-tool-config.{yml,yaml,json} file.

It is a regression in friendliness of the plugin, but at least we have a path forward. When using the Build Tool plugin, this file must be placed within the target source files.

The file must have one of the following names:

  • xcstrings-tool-config.yml
  • xcstrings-tool-config.yaml
  • xcstrings-tool-config.json

The file can be either YAML or JSON and has two optional properties:

  1. accessLevel - Either internal, public or package
  2. developmentLanguage - The value defined in the Package.swift defaultLocalization or Xcode DEVELOPMENT_LANGUAGE build setting
  3. verbose - For logging

In an Xcode project, the file must have target membership for the target that the build plugin is assigned to.

@liamnichols
Copy link
Owner Author

cc @Brett-Best.. I had some time to tackle this in the end 😅 Let me know what you think of this approach..

I might need to look further into how we discover the config in Xcode project targets because if you need different access levels in different targets, there isn't a way to achieve that. Only in SPM targets

@liamnichols
Copy link
Owner Author

Oh and need to update the docs

@rcasula
Copy link

rcasula commented Mar 1, 2025

Can we also have a way of specifying a custom bundle? This would be really helpful for fixing this #111 and we can tackle also this #121

Edit: I've opened a PR #126 towards this branch

@liamnichols liamnichols changed the title Introduce xcstrings-tool.yaml configuration file as an alternative to using build settings in Xcode 16.3+ Introduce xcstrings-tool-config.yaml configuration file as an alternative to using build settings in Xcode 16.3+ Apr 2, 2025
@liamnichols liamnichols marked this pull request as ready for review April 2, 2025 07:05
@liamnichols liamnichols merged commit 038da3e into main Apr 2, 2025
14 of 15 checks passed
@liamnichols liamnichols deleted the ln/config-file branch April 2, 2025 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants