chore(cli): Migrate task updates kotlin version in root build.gradle #8238
+18
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR description
This PR updates the
migrate.tstask to detect if the project's rootbuild.gradlefile has Kotlin defined (either viakotlin_versionvariable or set in the kotlin gradle plugin), and if so, update it to match the Kotlin version that Capacitor 8 uses (2.2.0).Testing
Here's a few examples of the command running (it was run before to make the other Cap 8 changes, so you'll only see the kotlin version change in diff):
You can test yourself by checking this branch, and mapping the cli version to the local source code directory (make sure you run
buildin cli directory beforehand), then runnpx cap migrateon the app.If you want to run a second time in the same app, you'll need to manually change the version for
clievery time, because themigratecommand will change the versions of capacitor next. If you're running the migrate command a second time, you can avoid runningnpm install(replyingnto the second question), to not override the cli version afterwards (coreandandroidandiosshould already be usingnextfrom running migrate the first time, so nothing should change).