Skip to content

Don't disable KSP2 native tasks if cross compilation is enabled#2430

Merged
ting-yuan merged 1 commit into
google:mainfrom
eygraber:klib-cross-compilation
Apr 30, 2025
Merged

Don't disable KSP2 native tasks if cross compilation is enabled#2430
ting-yuan merged 1 commit into
google:mainfrom
eygraber:klib-cross-compilation

Conversation

@eygraber

Copy link
Copy Markdown
Contributor

Fixes #2243

project.findProperty("kotlin.native.enableKlibsCrossCompilation") == "true"
kspAATask.onlyIf {
HostManager().enabled.any {
isKlibCrossCompilationEnabled || HostManager().enabled.any {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wonder if we should replace the entire logic in the onlyIf by kotlinCompilation.target.publishable.

CC'ing @Tapchicoma,

@ting-yuan ting-yuan merged commit d72ff52 into google:main Apr 30, 2025
3 checks passed
@eygraber eygraber deleted the klib-cross-compilation branch April 30, 2025 18:57
cfg.konanHome.value((kotlinCompileProvider.get() as KotlinNativeCompile).konanHome)

val isKlibCrossCompilationEnabled =
project.findProperty("kotlin.native.enableKlibsCrossCompilation") == "true"

@Tapchicoma Tapchicoma Apr 30, 2025

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is not the best approach. In the presence of custom CInterops cross compilation still be disabled in Kotlin 2.2.20 even if this Gradle property value is true.

@ting-yuan could you file a new Kotlin issue to expose some API to get the cross-compilation state?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@ting-yuan ting-yuan added this to the 2.0.1 milestone Apr 30, 2025
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.

Support klib cross compilation

3 participants