Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PlatformChecks emits error when compiling for MacCatalyst #523

Closed
lennartkerkvliet opened this issue Feb 5, 2024 · 2 comments · Fixed by #524
Closed

PlatformChecks emits error when compiling for MacCatalyst #523

lennartkerkvliet opened this issue Feb 5, 2024 · 2 comments · Fixed by #524
Labels
kind/bug Feature doesn't work as expected. status/triage Collecting information required to triage the issue.

Comments

@lennartkerkvliet
Copy link
Contributor

Description

When attempting to compile the Swift OpenAPI Generator on MacCatalyst, code that compiles perfectly on iOS will not run as it will fail on the PlatformChecks. This is unexpected.

Reproduction

Use the same instructions as used in https://developer.apple.com/wwdc23/10171 but enable the MacCatalyst target in the project settings. The project will compile fine for iOS but when targeting mac, the following error will be emitted:

OpenAPIGeneratorCore is only to be used by swift-openapi-generator itself—your target should not link this library or the command line tool directly.

Package version(s)

1.2.0

Expected behavior

I would have expected this to work fine without extra adjusments.

Environment

macOS Sonoma
Xcode 15.2

Additional information

I suspect that it has to do with the behaviour of MacCatalyst. When compiling the app normally targetEnvironment(macCatalyst) will be true while os(macOS) will be false which is already confusing by itself but with good reason. Perhaps the build tool plug-in is ran in a similar environment?

It looked like from my limited testing that when disabling this check it will not include the runtime, so the setup should be correct.

@lennartkerkvliet lennartkerkvliet added kind/bug Feature doesn't work as expected. status/triage Collecting information required to triage the issue. labels Feb 5, 2024
@czechboy0
Copy link
Contributor

Hi @lennartkerkvliet,

yeah that's possible, I don't believe we've tested this with macCatalyst. Would you be willing to open a PR fixing the issue? 🙏

simonjbeaumont pushed a commit that referenced this issue Feb 13, 2024
### Motivation

When attempting to compile the Swift OpenAPI Generator on MacCatalyst,
code that compiles on iOS will _not_ compile as it will fail on the
`PlatformChecks`.

### Modifications

Added an extra condition in `PlatformChecks` to allow running on
MacCatalyst.

### Result

fixes #523

### Test Plan

I've tried to familiarize myself with the project, but could not come up
with a good way to add a test for running the tool on MacCatalyst. In my
manual testing giving the instructions in the issue, it now works as
expected.
@simonjbeaumont
Copy link
Collaborator

@lennartkerkvliet thanks for filing the issue and for the contribution!

It should now be available in the 1.2.1 release: https://github.com/apple/swift-openapi-generator/releases/tag/1.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Feature doesn't work as expected. status/triage Collecting information required to triage the issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants