"OpenAPIGenerator" is disabled

Xcode cloud failed to build project with OpenAPIGenerator, message as the following:

Command exited with non-zero exit-code: 75
Archiving project *** with scheme ***
Prepare packages
Validate plug-in “OpenAPIGenerator” in package “swift-openapi-generator”
“OpenAPIGenerator” is disabled
Plug-in “OpenAPIGenerator” is implemented here

Running the project locally is just fine, archive is also working as expected. Tried clean building and it's NOT working.

Accepted Reply

@TiankaiMa apologies for the delay in the response.

I am able to reproduce your problem.

Prepare packages
Validate plug-in "OpenAPIGenerator" in package "swift-openapi-generator"
error: "OpenAPIGenerator" must be enabled before it can be used
"OpenAPIGenerator" is disabled

Plug-in "OpenAPIGenerator" is implemented here

The relevant error message which isn't in your post is this one:

error: "OpenAPIGenerator" must be enabled before it can be used

This is because build tool plugins require you to trust them before first use. When you first build your project with the plugin in Xcode, you will be presented with a dialog asking you to trust and enable the plugin.

When building in Xcode Cloud, the build happens in a non-interactive environment so this is not possible.

The workaround here is to add a file named ci_scripts/ci_post_clone.sh to your project, with the following contents:

#!/usr/bin/env bash
set -euo pipefail

defaults write com.apple.dt.Xcode IDESkipPackagePluginFingerprintValidatation -bool YES

This is making use of Xcode Cloud's custom build scripts to configure Xcode to skip the plugin trust verification.

It's worth noting that you should follow the advice in the Xcode Cloud documentation and commit your Package.resolved file, which will be even more important when using a build tool plugin.

Please let us know if this resolves your issue and, if not, feel free to file an issue on Github at https://github.com/apple/swift-openapi-generator.

Replies

@TiankaiMa apologies for the delay in the response.

I am able to reproduce your problem.

Prepare packages
Validate plug-in "OpenAPIGenerator" in package "swift-openapi-generator"
error: "OpenAPIGenerator" must be enabled before it can be used
"OpenAPIGenerator" is disabled

Plug-in "OpenAPIGenerator" is implemented here

The relevant error message which isn't in your post is this one:

error: "OpenAPIGenerator" must be enabled before it can be used

This is because build tool plugins require you to trust them before first use. When you first build your project with the plugin in Xcode, you will be presented with a dialog asking you to trust and enable the plugin.

When building in Xcode Cloud, the build happens in a non-interactive environment so this is not possible.

The workaround here is to add a file named ci_scripts/ci_post_clone.sh to your project, with the following contents:

#!/usr/bin/env bash
set -euo pipefail

defaults write com.apple.dt.Xcode IDESkipPackagePluginFingerprintValidatation -bool YES

This is making use of Xcode Cloud's custom build scripts to configure Xcode to skip the plugin trust verification.

It's worth noting that you should follow the advice in the Xcode Cloud documentation and commit your Package.resolved file, which will be even more important when using a build tool plugin.

Please let us know if this resolves your issue and, if not, feel free to file an issue on Github at https://github.com/apple/swift-openapi-generator.