Skip to content

Support linux-gnu host compilation for skip export; enable Linux CI matrix#31

Merged
marcprux merged 3 commits into
skiptools:mainfrom
WiesnerPeti:linux-host-export
Jul 14, 2026
Merged

Support linux-gnu host compilation for skip export; enable Linux CI matrix#31
marcprux merged 3 commits into
skiptools:mainfrom
WiesnerPeti:linux-host-export

Conversation

@WiesnerPeti

Copy link
Copy Markdown
Contributor

skip export runs a host-platform swift build in which the skipstone plugin performs its transpile/bridging analysis. On a Linux CI host that build compiles this package's non-Android branch, which currently assumes Darwin. This PR makes that linux-gnu host pass compile and activates the Linux element of the CI test matrix.

Source changes

  • Logger: neither AndroidLogging nor OSLog exists on linux-gnu — add a compile-only shim in the final #else (never compiled on Android or Darwin).
  • URL.applicationSupportDirectory: missing from Linux Foundation — extend the existing Android guard to os(Linux).
  • AndroidBundle: subclasses Bundle, which Linux corelibs cannot inherit from — scope the file to the platforms that use it (Android/Robolectric/Darwin).
  • AndroidLocalizedStringResource: scope the two AndroidBundle-typed convenience inits the same way.

CI change

Uncomment the runs-on line in .github/workflows/ci.yml to add ubuntu-24.04 to the matrix, matching skip-bridge and the other frameworks that build/test on Linux. Export stays enabled — that's what the source changes above make possible.

Safety

No behavior change on Android or Darwin: every source edit only affects what the linux-gnu host pass compiles. macOS swift build verified green.

…atrix

skip export runs a host-platform swift build in which the skipstone plugin
performs its transpile/bridging analysis. On a Linux CI host that build
compiles this package's non-Android branch, which currently assumes Darwin:

- Logger: neither AndroidLogging nor OSLog exists on linux-gnu — add a
  compile-only shim in the final #else (never compiled on Android or Darwin).
- URL.applicationSupportDirectory: missing from Linux Foundation — extend the
  existing Android guard to os(Linux).
- AndroidBundle subclasses Bundle, which Linux corelibs cannot inherit from —
  scope the file to the platforms that use it (Android/Robolectric/Darwin).
- AndroidLocalizedStringResource: scope the two AndroidBundle-typed
  convenience inits the same way.

Enable the Linux element of the CI test matrix (ubuntu-24.04) in ci.yml,
matching skip-bridge and the other frameworks that build/test on Linux.
Export stays enabled, which is what these source changes make possible.

No behavior change on Android or Darwin: every source edit only affects what
the linux-gnu host pass compiles. macOS swift build verified green.
@cla-bot

cla-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

Thank you for your pull request and welcome to the Skip community. We require contributors to sign our contributor license agreement (CLA), and we don't seem to have the user(s) @WiesnerPeti on file. In order for us to review and merge your code, for each noted user please add your GitHub username to Skip's .clabot file

@marcprux

Copy link
Copy Markdown
Member

For the Linux CI failure:

[219/239] Compiling SkipAndroidBridgeSamples SkipAndroidBridgeSamples.swift
/home/runner/work/skip-android-bridge/skip-android-bridge/Sources/SkipAndroidBridgeSamples/SkipAndroidBridgeSamples.swift:43:18: error: cannot find type 'LocalizedStringResource' in scope
41 | 
42 | public func localizedStringResourceLiteralKey() -> String {
43 |     let literal: LocalizedStringResource = "literal"
   |                  `- error: cannot find type 'LocalizedStringResource' in scope
44 |     return literal.key
45 | }

...you can probably just gate it with #if canImport(Darwin) since LocalizedStringResource is not available on non-Darwin platforms (see https://forums.swift.org/t/missing-localizedstringresource/80897/3).

@WiesnerPeti

Copy link
Copy Markdown
Contributor Author

recheck

SkipAndroidBridgeSamples is also compiled by the skip export host pass on
the Linux CI runner. LocalizedStringResource exists in Darwin's and the
Android SDK's Foundation but not in linux-gnu Foundation, so the host
compile failed with 'cannot find type LocalizedStringResource in scope'.

Keep the function present on every platform (so host bridging analysis
still sees it) and swap only the LocalizedStringResource-dependent body on
the non-Android Linux host, returning the literal key directly.
@cla-bot cla-bot Bot added the cla-signed label Jul 14, 2026
…ux-gnu

With the Linux runner in the matrix, the non-Android/non-Robolectric branch
now also runs on the linux-gnu host, where swift-corelibs-Foundation names
the bundle class 'Bundle' rather than Darwin's 'NSBundle'. Accept either
prefix off-Darwin so the test passes on Linux while keeping the strict
NSBundle assertion on Darwin.
@marcprux
marcprux merged commit 628d217 into skiptools:main Jul 14, 2026
8 of 9 checks passed
@marcprux

Copy link
Copy Markdown
Member

Great contribution, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants