Skip to content

Ensure compatibility with older Kotlin consumers#1770

Merged
swankjesse merged 4 commits into
lysine-dev:masterfrom
omarismail94:master
Feb 5, 2026
Merged

Ensure compatibility with older Kotlin consumers#1770
swankjesse merged 4 commits into
lysine-dev:masterfrom
omarismail94:master

Conversation

@omarismail94

@omarismail94 omarismail94 commented Feb 4, 2026

Copy link
Copy Markdown
Contributor

We delegate the build configuration to Tapmoc and set the Kotlin version to 2.1 as the library uses APIs from this version that do not exist in 2.0.

One caveat:
project.configureJavaCompatibility(8) is not used as the code would compile with JDK 8. This will fail as RealBufferedSource.kt uses a Java API not available in Java 8: InputStream.transferTo. To use project.configureJavaCompatibility, the min supported Java version would need to be bumped to 11

TESTED: ./gradlew clean check . I also published to local repository and checked the .module files for the JVM and Android artifacts and the kotlin-stdlib was correctly set to 2.1.21

We set the minimum Kotlin version to Kotlin 2.1 as the library uses APIs from this version that do not exist in 2.0. We also:
- Configuring JVM target 1.8, Java compatibility, and compiler arguments.
- Force JS and Wasm stdlib dependencies to match the toolchain version as work-around for KT-71032
- Reset `coreLibrariesVersion` in `okio-assetfilesystem` for AGP 9+ compatibility.
- Apply `build-support` plugin to `okio-nodefilesystem`.

TESTED: ./gradlew clean check . I also published to local repository and checked the .module files for the artifacts and the kotlin-stdlib was correctly set to 2.1.21

@swankjesse swankjesse left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I like the effect but wow, this requires so much work.

Comment thread build-support/src/main/kotlin/BuildSupport.kt Outdated
@JakeWharton

Copy link
Copy Markdown
Collaborator

Need to use Tapmoc plugin. Much easier.

Kotlin 2.1.20 does not support 25 JDK target

- Update CI java version from 25 to 24.
- Set `jvmToolchain(24)` in `BuildSupport.kt` and `samples/build.gradle.kts`.
- Refactor `BuildSupport.kt` to configure `KotlinProjectExtension` directly instead of using `afterEvaluate`.
I did not configure for rest of project as the plugin does not add depedencies to kotlin-stdlib correctly for KMP
@omarismail94

Copy link
Copy Markdown
Contributor Author

the tapmoc plugin does not work with KMP. I tried it locally, and it adds both the the KGP kotlin-stdlib  and the one set for compatibility (2.1.21) in the module file of the KMP targets:

"dependencies": [
        {
          "group": "org.jetbrains.kotlin",
          "module": "kotlin-stdlib",
          "version": {
            "requires": "2.2.21"
          }
        },
        {
          "group": "org.jetbrains.kotlin",
          "module": "kotlin-stdlib",
          "version": {
            "requires": "2.1.21"
          }
        }

For now, Ill add the plugin to the samples project (which isn't published), but keep the current behaviour I have

@omarismail94

Copy link
Copy Markdown
Contributor Author

@JakeWharton @swankjesse tests now pass.

Jake - if you think tapmoc can still work, I can open it as a feature request issue against the repo. For now, Im hoping itd be fine to merge as is

@omarismail94

omarismail94 commented Feb 5, 2026

Copy link
Copy Markdown
Contributor Author

@JakeWharton Actually, ignore my previous comment. I migrated to Tapmoc, and wow, the code is so much simpler!

One caveat:
project.configureJavaCompatibility(8) is not used as the code would compile with JDK 8. This will fail as RealBufferedSource.kt uses a Java API not available in Java 8: InputStream.transferTo. To use project.configureJavaCompatibility, the min supported Java version would need to be bumped to 11

@omarismail94
omarismail94 force-pushed the master branch 6 times, most recently from f672bbf to a4a3a0b Compare February 5, 2026 10:34
@swankjesse
swankjesse merged commit 04ab37a into lysine-dev:master Feb 5, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants