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

Fix collection of KotlinCompilation classpath using stable Kotlin Gradle Plugin API #114

Merged

Conversation

antohaby
Copy link
Contributor

@antohaby antohaby commented Aug 29, 2023

The previous version of collectKotlinCompilationClasspath was using bunch of heuristic sources
to get the correct classpath for KotlinCompilation for dokka analysis.

The proposed changes uses stable Kotlin Gradle Plugin API to get this data.
Except for Kotlin Native compilations which were special-cased for historical reasons.
It is planned to fix for Kotlin 2.0 https://youtrack.jetbrains.com/issue/KT-61559/Include-stdlib-and-platform-dependencies-to-KotlinNativeCompilation.compileDependencyFiles-API

This PR should also fix: #82

See also

Additionally, for Native compilations explicitly include stdlib and
platform dependencies from Kotlin Native distribution.

Home location of Kotlin Native distribution is collected
via Internal API of Kotlin Gradle Plugin.
It is safe for few reasons:
* konanHome property is accessed only for past Kotlin versions (up to 1.9.X)
* In Kotlin 2.0 `compileDependencyFiles` will include native-specific dependencies
This prevents from unnecessary dependency resolutions,
including compile tasks.

Particularly test source sets depend on compilations output
of main source sets. And if test source sets are not skipped
then Kotlin compilation will be triggered unnecessary.
Kotlin 1.9.0 supports Gradle Configuration Cache for Multiplatform projects
Dokka generation task now depends on `transform{sourceSetName}DependenciesMetadata`
tasks from Kotlin Gradle Plugin that didn't support Gradle Configuration Cache
in earlier versions of Kotlin. Making whole gradle build incompatible with
configuration cache.
@aSemy
Copy link
Contributor

aSemy commented Aug 29, 2023

Nice one, thanks! I will take a look.

@aSemy aSemy added this to the v2.0.0 milestone Aug 30, 2023
aSemy added 5 commits August 30, 2023 20:15
- use KotlinToolingVersion to get the Kotlin version
- rename 'isMain' properties/functions to 'isPublished', because it makes a bit more sense
- fetch the konanHome prop by using extraProperties
aSemy added a commit that referenced this pull request Aug 31, 2023
…ub Actions doesn't like them (OOM), so I'll deal with them in adamko-dev#115
@aSemy aSemy merged commit 6624e8c into adamko-dev:main Aug 31, 2023
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.

Compilation fails on prepareDokkatooParametersJavadoc on gradle 8.1.1
3 participants