Skip to content
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

Updated Kotlin to 2.1.0 and other deps #147

Merged
merged 1 commit into from
Jan 12, 2025
Merged

Updated Kotlin to 2.1.0 and other deps #147

merged 1 commit into from
Jan 12, 2025

Conversation

arkivanov
Copy link
Owner

@arkivanov arkivanov commented Jan 11, 2025

Kotlin: 2.1.0
Essenty: 2.4.0
Coroutines: 1.9.0
Reaktive: 2.3.0
AGP: 8.7.3
Gradle: 8.11.1

Summary by CodeRabbit

  • Dependency Updates

    • Updated Kotlin to version 2.1.0
    • Updated Kotlin Coroutines to version 1.9.0
    • Updated IntelliJ Gradle Plugin to version 1.17.4
    • Updated Essenty to version 2.4.0
    • Updated Reaktive to version 2.3.0
    • Updated Android Gradle Plugin to version 8.7.3
    • Updated Gradle wrapper to version 8.11.1
  • Gradle Configuration

    • Added distribution URL validation
    • Minor formatting improvements in dependency declarations
  • Code Maintenance

    • Added deprecation annotations for certain methods
    • Suppressed deprecation warnings in fragment argument handling

Copy link

coderabbitai bot commented Jan 11, 2025

Walkthrough

This pull request encompasses a series of dependency and configuration updates across multiple files in the project. The changes primarily involve version upgrades for various dependencies in the deps.versions.toml file, including Kotlin, Kotlinx Coroutines, Gradle plugins, and Android-related libraries. Additionally, the Gradle wrapper properties have been updated, and some minor code adjustments have been made in specific source files to address deprecation warnings and improve compatibility.

Changes

File Change Summary
deps.versions.toml - Updated Kotlin version from 2.0.10 to 2.1.0
- Updated Kotlinx Coroutines from 1.8.1 to 1.9.0
- Updated IntelliJ Gradle Plugin from 1.15.0 to 1.17.4
- Updated Essenty from 2.1.0 to 2.4.0
- Updated Reaktive from 2.2.0 to 2.3.0
- Updated Android Gradle Plugin from 8.2.0 to 8.7.3
- Standardized dependency declaration formatting
gradle/wrapper/gradle-wrapper.properties - Updated Gradle distribution from 8.2 to 8.11.1
- Added validateDistributionUrl=true
gradlew - Repositioned DEFAULT_JVM_OPTS variable declaration
settings.gradle.kts - Updated gradle-setup-plugin version from 8eb6bb973c to 4cef58cc3b
Various Android Fragment files - Added @Suppress("DEPRECATION") annotations for argument handling

Possibly related PRs

Poem

🐰 Hop, hop, dependencies dance!
Versions leap with each new chance
Gradle wrapper, plugins so bright
Kotlin's magic takes its flight
Updating code with bunny delight! 🚀


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
mvikotlin-extensions-coroutines/src/commonMain/kotlin/com/arkivanov/mvikotlin/extensions/coroutines/StoreExt.kt (1)

Line range hint 56-68: Consider alternative approaches to extend StateFlow

Implementing StateFlow directly and opting into an experimental API might affect the stability of your library. Instead of subclassing StateFlow, consider wrapping an existing StateFlow instance. This approach can help avoid experimental APIs and ensure better compatibility.

Here's a possible refactor:

private fun <State : Any> Store<*, State, *>.asStateFlow(): StateFlow<State> {
    val flow = MutableStateFlow(state)
    val disposable = states(observer { flow.value = it })

    return flow.also {
        it.onCompletion { disposable.dispose() }
    }
}

You can then use asStateFlow() wherever a StateFlow<State> is needed.

sample/coroutines/app-android/src/main/java/com/arkivanov/mvikotlin/sample/coroutines/app/details/DetailsFragment.kt (1)

Line range hint 30-34: Consider migrating to newer Bundler APIs instead of suppressing deprecation

While suppressing the deprecation warning works, consider migrating to the newer getBundleExtra or getParcelable(String, Class<T>) APIs introduced in Android 13 (API 33). This would provide better type safety and future compatibility.

-        @Suppress("DEPRECATION")
-        val args =
-            requireArguments()
-                .apply { classLoader = Arguments::class.java.classLoader }
-                .getParcelable<Arguments>(KEY_ARGUMENTS) as Arguments
+        val args = requireArguments().getParcelable(KEY_ARGUMENTS, Arguments::class.java)
+            ?: throw IllegalArgumentException("Missing arguments")
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8ab0149 and f23a901.

⛔ Files ignored due to path filters (2)
  • gradle/wrapper/gradle-wrapper.jar is excluded by !**/*.jar
  • kotlin-js-store/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (8)
  • deps.versions.toml (2 hunks)
  • gradle/wrapper/gradle-wrapper.properties (1 hunks)
  • gradlew (2 hunks)
  • mvikotlin-extensions-coroutines/src/commonMain/kotlin/com/arkivanov/mvikotlin/extensions/coroutines/StoreExt.kt (2 hunks)
  • mvikotlin-timetravel-client/plugin-idea/src/main/java/com/arkivanov/mvikotlin/plugin/idea/timetravel/TimeTravelToolWindowListener.kt (1 hunks)
  • sample/coroutines/app-android/src/main/java/com/arkivanov/mvikotlin/sample/coroutines/app/details/DetailsFragment.kt (1 hunks)
  • sample/reaktive/app-android/src/main/java/com/arkivanov/mvikotlin/sample/reaktive/app/details/DetailsFragment.kt (1 hunks)
  • settings.gradle.kts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • gradlew
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Build on Linux
  • GitHub Check: Build on macOS
🔇 Additional comments (10)
mvikotlin-extensions-coroutines/src/commonMain/kotlin/com/arkivanov/mvikotlin/extensions/coroutines/StoreExt.kt (1)

8-8: Verify the necessity of opting into ExperimentalForInheritanceCoroutinesApi

The import and usage of ExperimentalForInheritanceCoroutinesApi suggest that you're opting into an experimental API. Given the update to Kotlin 2.1.0 and Coroutines 1.9.0, please verify if this API is still marked as experimental in the newer versions. If it has become stable, you may no longer need to opt-in.

You can run the following script to check if ExperimentalForInheritanceCoroutinesApi is still required:

✅ Verification successful

The ExperimentalForInheritanceCoroutinesApi opt-in is still necessary

This API is still marked as experimental in Coroutines 1.9.0 and is properly used in the codebase with the @OptIn annotation for the StoreStateFlow implementation.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if 'ExperimentalForInheritanceCoroutinesApi' is still necessary.

# Search for 'ExperimentalForInheritanceCoroutinesApi' in the kotlinx.coroutines library
gh api https://api.github.com/repos/Kotlin/kotlinx.coroutines/contents/kotlinx-coroutines-core/common/src | jq -r '.[].download_url' | xargs -I {} curl -s {} | grep -q "ExperimentalForInheritanceCoroutinesApi" && echo "ExperimentalForInheritanceCoroutinesApi is still in use" || echo "ExperimentalForInheritanceCoroutinesApi is no longer necessary"

Length of output: 334


Script:

#!/bin/bash
# Search for usage of ExperimentalForInheritanceCoroutinesApi in the codebase
rg "ExperimentalForInheritanceCoroutinesApi" -B 2 -A 2

# Also check if there are any @OptIn or @RequiresOptIn annotations related to this
rg "@OptIn.*ExperimentalForInheritanceCoroutinesApi" -B 1 -A 1

Length of output: 2114

mvikotlin-timetravel-client/plugin-idea/src/main/java/com/arkivanov/mvikotlin/plugin/idea/timetravel/TimeTravelToolWindowListener.kt (1)

17-17: ⚠️ Potential issue

Update the overridden method to the new API

The stateChanged() method is deprecated. To maintain compatibility with the latest IntelliJ Platform SDK, you should override the updated method provided by ToolWindowManagerListener.

Apply this diff to update the method:

-    @Deprecated(message = "")
-    override fun stateChanged() {
+    override fun toolWindowShown(toolWindow: ToolWindow) {
         if (TimeTravelToolWindowFactory.TOOL_WINDOW_ID in toolWindowManager.toolWindowIds) {
             ensureLifecycleRegistry().resume()
         } else {
             lifecycleRegistry?.destroy()
             lifecycleRegistry = null
         }
     }

Please verify the correct replacement method in the ToolWindowManagerListener interface.

You can run the following script to check for the updated methods:

sample/reaktive/app-android/src/main/java/com/arkivanov/mvikotlin/sample/reaktive/app/details/DetailsFragment.kt (1)

28-31: 🛠️ Refactor suggestion

Replace deprecated getParcelable method

Instead of suppressing the deprecation warning, update the code to use the non-deprecated getParcelable method. This ensures forward compatibility with newer Android SDK versions.

Apply this diff to update the method:

-        @Suppress("DEPRECATION")
         val args =
             requireArguments()
                 .apply { classLoader = Arguments::class.java.classLoader }
-                .getParcelable<Arguments>(KEY_ARGUMENTS) as Arguments
+                .getParcelable(KEY_ARGUMENTS, Arguments::class.java) as Arguments

Likely invalid or redundant comment.

gradle/wrapper/gradle-wrapper.properties (2)

3-3: Verify Gradle 8.11.1 compatibility with Android Gradle Plugin 8.7.3

The Gradle version upgrade is significant. While this version should be compatible with AGP 8.7.3, it's recommended to verify against the AGP to Gradle compatibility matrix.


5-5: Good security practice: Distribution URL validation enabled

Adding validateDistributionUrl=true improves security by verifying the integrity of downloaded Gradle distributions.

settings.gradle.kts (1)

18-18: Verify gradle-setup-plugin compatibility with Kotlin 2.1.0

The plugin version has been updated to a specific commit (4cef58cc3b). Please ensure this version is compatible with Kotlin 2.1.0 and other updated dependencies.

deps.versions.toml (4)

59-62: Formatting improvements in AndroidX dependencies

The spacing and alignment improvements in AndroidX dependencies enhance readability.


7-7: Verify Kotlin 2.1.0 and Coroutines 1.9.0 compatibility

The update to Kotlin 2.1.0 and Coroutines 1.9.0 is significant. Please verify:

  1. Compatibility between these versions
  2. Any breaking changes in Kotlin 2.1.0 that might affect the codebase

Also applies to: 9-9

✅ Verification successful

Kotlin 2.1.0 and Coroutines 1.9.0 update is safe to proceed

The codebase's usage of Kotlin and Coroutines features has been analyzed, and no compatibility issues were found. The update is safe as:

  • All used language features are supported in Kotlin 2.1.0
  • Coroutines usage follows standard patterns compatible with 1.9.0
  • Test coverage is in place for coroutines functionality
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for potential compatibility issues in Kotlin code
echo "Searching for potential compatibility issues..."
rg -l 'sealed interface|fun interface|companion object' \
  --type kotlin \
  --glob '!build' \
  --glob '!.gradle'

Length of output: 3018


Script:

#!/bin/bash
# Search for coroutines usage patterns
echo "Searching for coroutines usage patterns..."
rg -l 'Flow<|suspend fun|CoroutineScope|launch|async|withContext|runBlocking' \
  --type kotlin \
  --glob '!build' \
  --glob '!.gradle'

# Check build configuration for coroutines dependencies
echo -e "\nChecking build configuration..."
rg "kotlinx-coroutines" -A 2

Length of output: 3854


12-13: Check Essenty 2.4.0 and Reaktive 2.3.0 release notes

Significant version updates for both libraries. Please review their release notes for any breaking changes or new features that could benefit the project.

✅ Verification successful

Safe version updates with new features

The updates are safe to proceed with:

  • Essenty 2.4.0: Primarily updates Kotlin (2.1.0) and coroutines (1.9.0) dependencies
  • Reaktive 2.3.0: Adds new retryWhen operator and optimizes ValueCallback as a fun interface

No breaking changes in either update. The new Reaktive features could benefit error handling in the project.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for usage patterns that might be affected by the updates
echo "Checking Essenty usage patterns..."
ast-grep --pattern 'import com.arkivanov.essenty.$$$'

echo "Checking Reaktive usage patterns..."
ast-grep --pattern 'import com.badoo.reaktive.$$$'

Length of output: 49703


Script:

#!/bin/bash
# Fetch release notes for both libraries
echo "Fetching Essenty 2.4.0 release notes..."
gh release view 2.4.0 --repo arkivanov/Essenty || true

echo -e "\nFetching Reaktive 2.3.0 release notes..."
gh release view 2.3.0 --repo badoo/Reaktive || true

Length of output: 1129


17-17: Significant AGP update (8.2.0 -> 8.7.3)

The Android Gradle Plugin update is substantial. Please ensure:

  1. All Android-specific configurations are compatible
  2. Build performance impact is evaluated
  3. New AGP features are leveraged where beneficial

@arkivanov arkivanov merged commit 6d01538 into master Jan 12, 2025
3 checks passed
@arkivanov arkivanov deleted the update-kotlin branch January 12, 2025 00:49
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