-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Fix build.gradle file paths in Kotlin migration guide #13342
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,10 +52,10 @@ further migration. | |
| First, find the `kotlin-android` plugin (or the `org.jetbrains.kotlin.android` | ||
| plugin). | ||
| It is likely located in the `plugins` block of the | ||
| `<app-src>/android/build.gradle` or the | ||
| `<app-src>/android/build.gradle.kts` file. | ||
| `<app-src>/android/app/build.gradle` or the | ||
| `<app-src>/android/app/build.gradle.kts` file. | ||
| If you use the legacy `apply` syntax, it will be located in | ||
| the Groovy-based `<app-src>/android/build.gradle` file, as this syntax is | ||
| the Groovy-based `<app-src>/android/app/build.gradle` file, as this syntax is | ||
| not supported in Kotlin DSL. | ||
|
|
||
| The following examples demonstrate how to migrate a Flutter Android app | ||
|
|
@@ -68,7 +68,7 @@ and an add-to-app Android host app: | |
|
|
||
| **Before**: | ||
|
|
||
| ```kotlin title="<app-src>/android/build.gradle(.kts)" | ||
| ```kotlin title="<app-src>/android/app/build.gradle(.kts)" | ||
| plugins { | ||
| id("com.android.application") | ||
| id("kotlin-android") | ||
|
|
@@ -88,7 +88,7 @@ android { | |
|
|
||
| Next, remove the `kotlin-android` plugin and the `kotlinOptions` block: | ||
|
|
||
| ```kotlin diff title="<app-src>/android/build.gradle.kts" | ||
| ```kotlin diff title="<app-src>/android/app/build.gradle.kts" | ||
| plugins { | ||
| id("com.android.application") | ||
| - id("kotlin-android") | ||
|
|
@@ -106,7 +106,7 @@ Next, remove the `kotlin-android` plugin and the `kotlinOptions` block: | |
|
|
||
| Add the `kotlin.compilerOptions{}` DSL block with the following: | ||
|
|
||
| ```kotlin diff title="<app-src>/android/build.gradle.kts" | ||
| ```kotlin diff title="<app-src>/android/app/build.gradle.kts" | ||
| + kotlin { | ||
| + compilerOptions { | ||
| + jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 | ||
|
|
@@ -118,7 +118,7 @@ Here is how the file will likely end up: | |
|
|
||
| **After**: | ||
|
|
||
| ```kotlin title="<app-src>/android/build.gradle(.kts)" | ||
| ```kotlin title="<app-src>/android/app/build.gradle(.kts)" | ||
| plugins { | ||
| id("com.android.application") | ||
| // ... | ||
|
|
@@ -142,7 +142,7 @@ kotlin { | |
|
|
||
| **Before**: | ||
|
|
||
| ```groovy title="<app-src>/android/build.gradle" | ||
| ```groovy title="<app-src>/android/app/build.gradle" | ||
| apply plugin: 'com.android.application' | ||
| apply plugin: 'kotlin-android' | ||
| // ... | ||
|
|
@@ -160,7 +160,7 @@ android { | |
|
|
||
| Next, remove the `kotlin-android` plugin and the `kotlinOptions` block: | ||
|
|
||
| ```groovy diff title="<app-src>/android/build.gradle" | ||
| ```groovy diff title="<app-src>/android/app/build.gradle" | ||
| apply plugin: 'com.android.application' | ||
| - apply plugin: 'kotlin-android' | ||
| // ... | ||
|
|
@@ -175,7 +175,7 @@ Next, remove the `kotlin-android` plugin and the `kotlinOptions` block: | |
| ``` | ||
| Add the `kotlin.compilerOptions{}` DSL block with the following: | ||
|
|
||
| ```groovy diff title="<app-src>/android/build.gradle" | ||
| ```groovy diff title="<app-src>/android/app/build.gradle" | ||
| + kotlin { | ||
| + compilerOptions { | ||
| + jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 | ||
|
|
@@ -187,7 +187,7 @@ Here is how the file will likely end up: | |
|
|
||
| **After**: | ||
|
|
||
| ```groovy title="<app-src>/android/build.gradle" | ||
| ```groovy title="<app-src>/android/app/build.gradle" | ||
| apply plugin: 'com.android.application' | ||
| // ... | ||
|
|
||
|
|
@@ -215,7 +215,7 @@ Therefore, only the `plugins {}` block instructions are included. | |
|
|
||
| **Before**: | ||
|
|
||
| ```kotlin title="<app-src>/android/build.gradle(.kts)" | ||
| ```kotlin title="<app-src>/android/app/build.gradle(.kts)" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For add-to-app host apps, the project structure is typically that of a native Android project where the app module is located directly in the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not related to my edit. |
||
| plugins { | ||
| alias(libs.plugins.android.application) | ||
| alias(libs.plugins.kotlin.android) | ||
|
|
@@ -235,7 +235,7 @@ android { | |
|
|
||
| Next, remove the `kotlin-android` plugin and the `kotlinOptions` block: | ||
|
|
||
| ```kotlin diff title="<app-src>/android/build.gradle.kts" | ||
| ```kotlin diff title="<app-src>/android/app/build.gradle.kts" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not related to my edit. |
||
| plugins { | ||
| alias(libs.plugins.android.application) | ||
| - alias(libs.plugins.kotlin.android) | ||
|
|
@@ -252,7 +252,7 @@ Next, remove the `kotlin-android` plugin and the `kotlinOptions` block: | |
| ``` | ||
| Add the `kotlin.compilerOptions{}` DSL block with the following: | ||
|
|
||
| ```kotlin diff title="<app-src>/android/build.gradle.kts" | ||
| ```kotlin diff title="<app-src>/android/app/build.gradle.kts" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not related to my edit. |
||
| + kotlin { | ||
| + compilerOptions { | ||
| + jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 | ||
|
|
@@ -264,7 +264,7 @@ Here is how the file will likely end up: | |
|
|
||
| **After**: | ||
|
|
||
| ```kotlin title="<app-src>/android/build.gradle(.kts)" | ||
| ```kotlin title="<app-src>/android/app/build.gradle(.kts)" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not related to my edit. |
||
| plugins { | ||
| alias(libs.plugins.android.application) | ||
| // ... | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR title indicates a fix for the 'Kotlin migration guide', but it currently only updates
for-app-developers.md. Thefor-plugin-authors.mdfile in the same directory also contains incorrect paths (e.g., using<app-src>instead of<plugin-project>and missing the correct directory structure) and should be updated to ensure the entire guide is accurate.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Irrelevant. Path is good for plugin.