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

update for kotlin 2.1.0 #139

Merged
merged 1 commit into from
Dec 19, 2024
Merged

Conversation

chadselph
Copy link
Contributor

@chadselph chadselph commented Dec 17, 2024

When using this plugin with kotlin 2.1.0 and a js project, my build fails with

... [irrelevant stack]

Caused by: java.lang.NoSuchMethodError: 'org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension org.jetbrains.kotlin.gradle.targets.js.npm.NpmProject.getNodeJs()'
	at com.goncalossilva.resources.ResourcesPlugin.applyToCompilation(ResourcesPlugin.kt:68)
	at org.jetbrains.kotlin.gradle.plugin.SubpluginEnvironment.addSubpluginOptions(SubpluginEnvironment.kt:47)
	at org.jetbrains.kotlin.gradle.plugin.KotlinJsIrSourceSetProcessor$doTargetSpecificProcessing$2.invoke(KotlinJsIrSourceSetProcessor.kt:50)
	at org.jetbrains.kotlin.gradle.plugin.KotlinJsIrSourceSetProcessor$doTargetSpecificProcessing$2.invoke(KotlinJsIrSourceSetProcessor.kt:46)
	at org.jetbrains.kotlin.gradle.utils.WhenEvaluatedKt$whenEvaluated$4.execute(whenEvaluated.kt:48)
	at org.jetbrains.kotlin.gradle.utils.WhenEvaluatedKt$whenEvaluated$4.execute(whenEvaluated.kt:45)
... [snipped]

I guess this method was removed in Kotlin 2.1.0; which also causes this PR to fail #138.

It seems like this change is breaking for Kotlin 2.0.x so maybe someone else can find a way to make it work in both.

@goncalossilva
Copy link
Owner

Thanks for this! Reflection can help making it work with both Kotlin versions simultaneously, but I'd rather keep it simple.

We already had a note about Kotlin vs kotlinx-resources versions in the README:

The latest version targets Kotlin 2.0 and is incompatible with Kotlin 1.9. On 2.0 and above, use the latest version available. On 1.9, use the latest version below v0.9.0.

I'll just turn it into a table. 😄

@goncalossilva goncalossilva merged commit d4350d0 into goncalossilva:main Dec 19, 2024
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.

2 participants