Skip to content

Feature/pilot swift extension plugin#40

Open
js-bonin wants to merge 2 commits into
mainfrom
feature/pilot_swift_extension_plugin
Open

Feature/pilot swift extension plugin#40
js-bonin wants to merge 2 commits into
mainfrom
feature/pilot_swift_extension_plugin

Conversation

@js-bonin

@js-bonin js-bonin commented Jul 3, 2026

Copy link
Copy Markdown
Member

Add a Gradle plugin to distribute Swift extensions without CocoaPods

Summary

Adds pilot-swift-extensions-plugin, a new Gradle plugin module that packages Pilot's iOS Swift extensions (viewmodel/ios/, components/ios/base/, components/ios/kingfisher/) into its own plugin JAR and syncs them into a consumer's project at build time — as an alternative to Pilot.podspec for apps that have moved off CocoaPods to Swift Package Manager.

Modeled directly on Trikot's existing com.mirego.trikot.swift-extensions plugin (same shape: an extension block for frameworkName/outputDir/modules, and a syncPilotSwiftExtensions task that reads the plugin's own JAR resources — no network fetch at consumer build time).

What's included

  • New module: pilot-swift-extensions-plugin/ (PilotSwiftExtensionsPlugin, PilotSwiftExtensionsExtension, SyncSwiftExtensionsTask), registered in settings.gradle.kts.
  • Configurable framework name: consumers no longer need their KMP framework to be literally named Shared (previously hard-required via spec.dependency "Shared" in the podspec). A PILOT_FRAMEWORK_NAME placeholder is substituted with the consumer's configured name — matching Trikot's own flexibility.
  • Podspec/CocoaPods consumers are unaffected: the placeholder substitution happens only while the plugin packages its own resources (processResources filter in pilot-swift-extensions-plugin/build.gradle.kts), not in the checked-in source files. Pilot.podspec still reads import Shared exactly as before — verified via diff and an end-to-end test.

Test plan

  • :pilot-swift-extensions-plugin:build passes (including ktlint)
  • Published to mavenLocal() and consumed from a real throwaway Gradle project — confirmed syncPilotSwiftExtensions extracts all 20 files, correctly substitutes PILOT_FRAMEWORK_NAME → the configured name
  • Diffed generated output against the original source files — byte-for-byte identical aside from the import line
  • Verified module filtering (modules.set(listOf("viewmodel")) syncs only that module) and stale-file cleanup (switching modules removes previously-synced files/directories)
  • Confirmed the checked-in Swift source files (and therefore Pilot.podspec) are untouched — still import Shared
  • Full project build (./gradlew build) still passes

@G-lalonde G-lalonde left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Niiiiiice!

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