Skip to content

feat: Migrate examples to built-in Kotlin and iOS SPM path - #431

Open
ziqq wants to merge 2 commits into
ABausG:mainfrom
ziqq:feat/build-in-kotlin-and-spm
Open

feat: Migrate examples to built-in Kotlin and iOS SPM path#431
ziqq wants to merge 2 commits into
ABausG:mainfrom
ziqq:feat/build-in-kotlin-and-spm

Conversation

@ziqq

@ziqq ziqq commented Jun 22, 2026

Copy link
Copy Markdown

Feat: migrate examples to built-in Kotlin and iOS SPM path

Description

This PR completes the Android built-in Kotlin migration for home_widget and aligns the package example with the iOS Swift Package Manager integration path.

On Android, home_widget no longer keeps the legacy Kotlin Gradle Plugin compatibility fallback. The plugin now relies on Flutter's built-in Kotlin path, and the old android.builtInKotlin=false / android.newDsl=false compatibility mode is no longer supported.

On iOS, the package example is updated to use the Swift Package Manager integration path instead of directly wiring pod 'home_widget' into the widget extension. The PR also updates repository examples, migration docs, setup docs, changelog entries, and CI guardrails so the documented setup matches the current implementation.

Validated with:

  • melos test
  • flutter build apk --release in packages/home_widget/example
  • flutter build ios --release --no-codesign in packages/home_widget/example
  • flutter build apk --release in examples/configurable_widget

Checklist

  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation and added code (documentation) comments where necessary.
  • I have updated/added relevant examples in example or documentation.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

Migration instructions

To migrate from the current release:

  1. Remove android.builtInKotlin=false and android.newDsl=false from your Android gradle.properties if they are still present.
  2. Make sure your project uses a modern Flutter/Android toolchain compatible with built-in Kotlin support, including Flutter 3.44+.
  3. Rebuild your Android app and widget modules and verify they compile without relying on the legacy Kotlin Gradle Plugin fallback.
  4. If your app still depends on third-party Flutter plugins that have not migrated to built-in Kotlin yet, Flutter may temporarily re-add legacy flags during local builds. Those plugins need to be updated separately.

Related Issues

None.

@docs-page

docs-page Bot commented Jun 22, 2026

Copy link
Copy Markdown

To preview the documentation for this pull request, visit the following URL:

docs.page/abausg/home_widget~431

Documentation is deployed and generated using docs.page

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Migrates home_widget and all examples off legacy Android Gradle compatibility flags (android.builtInKotlin=false, android.newDsl=false) and off the CocoaPods pod 'home_widget' iOS widget extension dependency. Updates build scripts to use Flutter's built-in Kotlin path, switches the iOS Package.swift to a configurable FLUTTER_FRAMEWORK_SWIFT_PACKAGE_PATH, adds migration documentation, and introduces CI guardrails that enforce the new baseline.

Changes

Built-in Kotlin & SPM Migration

Layer / File(s) Summary
Core package Android build modernization
packages/home_widget/android/build.gradle
Removes ext.kotlin_version, the Kotlin Gradle plugin classpath, and the AGP-version-conditional kotlin-android plugin apply. Replaces android { kotlinOptions { jvmTarget = "1.8" } } with a top-level kotlin { compilerOptions { jvmTarget = 17 } } block and moves Java compatibility to 17.
iOS Swift Package Manager migration
packages/home_widget/ios/home_widget/Package.swift, packages/home_widget/example/ios/Podfile, packages/home_widget/example/ios/Runner.xcodeproj/project.pbxproj
Makes Package.swift read the Flutter framework path from FLUTTER_FRAMEWORK_SWIFT_PACKAGE_PATH with a ../FlutterFramework fallback. Removes the explicit pod 'home_widget' entry from the example's HomeWidgetExampleExtension Podfile target and removes the corresponding PBXFileReference and PBXGroup child in the Xcode project.
Example Android Gradle build script modernization
examples/*/android/app/build.gradle.kts, examples/file_and_images/android/gradle.properties, packages/home_widget/example/android/app/build.gradle
Across all three standalone examples and the package example, removes the explicit kotlin-android plugin entry and versioned Kotlin plugin declaration, drops android { kotlinOptions { jvmTarget } }, adds a top-level kotlin { compilerOptions { jvmTarget = JVM_17 } } block, and removes the legacy android.builtInKotlin=false/android.newDsl=false Gradle properties.
Example Android toolchain and plugin version bumps
examples/*/android/settings.gradle.kts, packages/home_widget/example/android/settings.gradle, packages/home_widget/example/android/gradle/wrapper/gradle-wrapper.properties
Adds the org.jetbrains.kotlin.plugin.compose plugin declaration to each example's settings.gradle.kts. Updates the package example's settings.gradle to AGP 8.11.1 and Kotlin 2.2.20, and bumps the Gradle wrapper to 8.14-all.
Migration documentation and changelog
docs/migrations/built-in-kotlin.mdx, docs/setup/android.mdx, docs/setup/ios.mdx, docs/features/interactive-widgets.mdx, docs.json, CHANGELOG.md, packages/home_widget/CHANGELOG.md
Adds a new built-in Kotlin migration guide with removal steps, recommended checks, and an upgrade checklist. Updates Android and iOS setup pages with informational callouts, adds an SPM note to the interactive widgets page, registers the new page in the sidebar, and records breaking changes in both changelogs.
CI migration guardrails
.github/workflows/main.yml
Adds a "Migration Guardrails" step to the quality job that fails the run if legacy Android flags or pod 'home_widget' are found in example directories.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • ABausG/home_widget#389: Both PRs modify .github/workflows/main.yml's quality job steps — this PR adds "Migration Guardrails" while #389 restructures other workflow steps.
  • ABausG/home_widget#393: Both PRs are tied to the iOS Swift Package Manager migration, with this PR removing the CocoaPods home_widget wiring in the example and adjusting Package.swift, aligned with #393's SPM-based integration work.
  • ABausG/home_widget#419: Both PRs modify packages/home_widget/ios/home_widget/Package.swift to configure the FlutterFramework dependency — #419 adds the dependency/product wiring, this PR updates the path to use FLUTTER_FRAMEWORK_SWIFT_PACKAGE_PATH.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR has all required sections, but the title is not conventional-commit formatted and the breaking change title lacks !. Change the title to a lowercase conventional commit with ! (for example, feat!: ...) and keep the breaking-change migration instructions.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The pull request title accurately describes the main changes: migrating examples to built-in Kotlin on Android and updating iOS to use Swift Package Manager.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
docs/migrations/built-in-kotlin.mdx (1)

35-37: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Vary sentence starters in the checklist items to improve readability.

The three list items (lines 35–37) each begin with "Your", which violates style guidance. Consider rewording to vary the sentence structure:

Suggested fix
- 1. Your project builds with the Flutter version required by `home_widget`.
- 2. Your Android project uses a recent AGP version.
- 3. Your widget app still builds successfully with `flutter build apk` or `flutter build appbundle`.
+ 1. Verify your project builds with the Flutter version required by `home_widget`.
+ 2. Your Android project uses a recent AGP version.
+ 3. Ensure your widget app still builds successfully with `flutter build apk` or `flutter build appbundle`.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/migrations/built-in-kotlin.mdx` around lines 35 - 37, The three
checklist items in the prerequisites section all begin with "Your", creating
repetitive sentence structure that reduces readability. Reword each of the three
items to vary the sentence starters: the first item about Flutter version
compatibility, the second item about AGP version, and the third item about the
widget app build success. Use different grammatical constructions such as
starting with verbs, adjectives, or restructuring as necessary to create variety
while maintaining clarity and conciseness.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@docs/migrations/built-in-kotlin.mdx`:
- Around line 35-37: The three checklist items in the prerequisites section all
begin with "Your", creating repetitive sentence structure that reduces
readability. Reword each of the three items to vary the sentence starters: the
first item about Flutter version compatibility, the second item about AGP
version, and the third item about the widget app build success. Use different
grammatical constructions such as starting with verbs, adjectives, or
restructuring as necessary to create variety while maintaining clarity and
conciseness.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 976977b8-5353-4d67-901c-f16d0556c580

📥 Commits

Reviewing files that changed from the base of the PR and between 0b42c89 and d7c59f6.

📒 Files selected for processing (22)
  • .github/workflows/main.yml
  • CHANGELOG.md
  • docs.json
  • docs/features/interactive-widgets.mdx
  • docs/migrations/built-in-kotlin.mdx
  • docs/setup/android.mdx
  • docs/setup/ios.mdx
  • examples/configurable_widget/android/app/build.gradle.kts
  • examples/configurable_widget/android/settings.gradle.kts
  • examples/file_and_images/android/app/build.gradle.kts
  • examples/file_and_images/android/gradle.properties
  • examples/file_and_images/android/settings.gradle.kts
  • examples/generator_basics/android/app/build.gradle.kts
  • examples/generator_basics/android/settings.gradle.kts
  • packages/home_widget/CHANGELOG.md
  • packages/home_widget/android/build.gradle
  • packages/home_widget/example/android/app/build.gradle
  • packages/home_widget/example/android/gradle/wrapper/gradle-wrapper.properties
  • packages/home_widget/example/android/settings.gradle
  • packages/home_widget/example/ios/Podfile
  • packages/home_widget/example/ios/Runner.xcodeproj/project.pbxproj
  • packages/home_widget/ios/home_widget/Package.swift
💤 Files with no reviewable changes (3)
  • examples/file_and_images/android/gradle.properties
  • packages/home_widget/example/ios/Podfile
  • packages/home_widget/example/ios/Runner.xcodeproj/project.pbxproj

@ziqq ziqq changed the title feat: migrate examples to built-in Kotlin and iOS SPM path Feat: migrate examples to built-in Kotlin and iOS SPM path Jun 22, 2026
@ziqq ziqq changed the title Feat: migrate examples to built-in Kotlin and iOS SPM path feat: migrate examples to built-in Kotlin and iOS SPM path Jun 22, 2026
@ziqq ziqq changed the title feat: migrate examples to built-in Kotlin and iOS SPM path feat: Migrate examples to built-in Kotlin and iOS SPM path Jun 22, 2026
@ziqq

ziqq commented Jun 22, 2026

Copy link
Copy Markdown
Author

I can't see build logs on codemagic

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.

1 participant