Skip to content

Commit

Permalink
Add macCatalyst to the PlatformChecks (#524)
Browse files Browse the repository at this point in the history
### 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.
  • Loading branch information
lennartkerkvliet committed Feb 13, 2024
1 parent 7bd8dad commit 7992d77
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Sources/_OpenAPIGeneratorCore/PlatformChecks.swift
Expand Up @@ -14,7 +14,9 @@

// Emit a compiler error if this library is linked with a target in an adopter
// project.
#if !(os(macOS) || os(Linux))
//
// When compiling for MacCatalyst, the plugin is (erroneously?) compiled with os(iOS).
#if !(os(macOS) || os(Linux) || (os(iOS) && targetEnvironment(macCatalyst)))
#error(
"_OpenAPIGeneratorCore is only to be used by swift-openapi-generator itself—your target should not link this library or the command line tool directly."
)
Expand Down

0 comments on commit 7992d77

Please sign in to comment.