Skip to content
This repository has been archived by the owner on Aug 19, 2020. It is now read-only.

Fix missing parameter names in Gradle Kotlin DSL jars #1004

Merged
merged 13 commits into from
Aug 5, 2018

Conversation

eskatos
Copy link
Member

@eskatos eskatos commented Aug 4, 2018

Functions on types using kotlin implementation by delegation for a Java interface miss parameter names metadata.

See #464

Reusing the gradle-api-metadata, an ArtifactTransform hydrates the Gradle API bytecode provided by gradleApi() with Java 8 parameter names. The Gradle Kotlin DSL is compiled against the transformed Gradle API disabling the kotlin compiler fast class reader. This combination lets the parameter names show up properly in the IDE instead of p0, p1 ...

image

eskatos added 11 commits August 4, 2018 13:46
and use that to build `gradle/kotlin-dsl` artifacts

Signed-off-by: Paul Merlin <[email protected]>
With the added artifact transform, the size of snapshoting caches
went up, hitting the previous conservative limit of 256m.

Signed-off-by: Paul Merlin <[email protected]>
by removing duplicated code and leveraging transform parameters to
simplify locating the api metadata jar

Signed-off-by: Paul Merlin <[email protected]>
- rename method for clarity
- extract explaining methods
- tighten members visibility

Signed-off-by: Paul Merlin <[email protected]>
0 should be fine

Signed-off-by: Paul Merlin <[email protected]>
@@ -46,6 +46,8 @@ annotation class KotlinScriptTemplate
resolver = KotlinBuildScriptDependenciesResolver::class,
scriptFilePattern = ".*\\.gradle\\.kts")
@ScriptTemplateAdditionalCompilerArguments([
"-java-parameters",
Copy link
Member

Choose a reason for hiding this comment

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

❓ I don't understand why the new compiler options are also required in the script templates. I understood -Xuse-old-class-files-reading was required to get the compiler to load parameter names from the transformed Gradle api jar and -java-parameters was about preserving parameter names in the emitted class files, none of which seem to apply to the scripts, what am I missing?

Copy link
Member Author

Choose a reason for hiding this comment

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

Right. I've been overzealous. We don't need those for script compilation. And we don't need -Xuse-old-class-files-reading on the kotlin-dsl plugin.

eskatos added 2 commits August 5, 2018 14:39
and from IDE script templates

Signed-off-by: Paul Merlin <[email protected]>
…lation

and from IDE script templates
and from kotlin-dsl plugin

Signed-off-by: Paul Merlin <[email protected]>
@eskatos eskatos merged commit cbf5053 into develop Aug 5, 2018
@eskatos eskatos deleted the eskatos/gradle-api/parameter-names branch August 5, 2018 13:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants