the `tasks.getting` is working for me for all `val...
# gradle
m
the
tasks.getting
is working for me for all
val dokka by tasks.getting
and
tasks { val dokka by getting(DokkaTask::class) }
, and
val dokka by tasks.getting(DokkaTask::class)
n
Are you using Gradle 4.4 and Kotlin JS?
m
not using kotlin JS, that is in a JVM project
n
Does the Gradle Kotlin DSL API differ between Kotlin JVM and Kotlin JS
m
it shouldnt in the
build.gradle.kts
- what was failing for you with the
getting
? was the
build.gradle.kts
script failing to compile?
n
The getting function wasn't appearing during code completion. Even tried a Gradle refresh but to no avail.
Think I have found the issue. Used the IntelliJ Kotlin Gradle DSL wizard which for some strange reason is using Gradle 3.5-rc-2. Can't update the Gradle wrapper due to a caching issue:
Could not open cache directory 30ykzcb62p64x023wp0i1xrws (/home/napperley/.gradle/caches/4.4/gradle-kotlin-dsl/30ykzcb62p64x023wp0i1xrws).
m
ahh ok - that was going to be the next thing. updating gradle version with intellij never seems to take well for me so i have to sometimes do an Invalidate and Restart of intellij
n
Is Invalidate and Restart a IntelliJ menu option?
m
im not sure where it actually lol, i do Ctrl + Shift + A and type Invalidate and click the option that pops up
👍 1
n
Fixed the caching issue (only when updating Gradle wrapper) by doing the following:
1. Rename build.gradle.kts to build.gradle.kts.bak
2. Create build.gradle file
3. Update the Gradle wrapper
The Invalidate trick works. Still have to use the "compile" function with Kotlin JS though 🙁.
m
glad you found a way to update it - the
"compile"
part may be specific to how the Kotlin JS Gradle plugin is written and not beging as friendly to the
kotlin-dsl
n
From what I understand Kotlin JS uses the old Gradle plugin system.
e
you have to use string literals in place of static extensions because the plugin is not applied using the
plugins {}
block see https://github.com/gradle/kotlin-dsl/blob/master/doc/getting-started/Configuring-Plugins.md
the Kotlin JS plugin cannot be used via the
plugins {}
block by default because it is improperly published, also see https://youtrack.jetbrains.com/issue/KT-20156
👍 1
there’s a workaround in the issue, same workaround as documented above
n
Can the workaround be applied in the settings.gradle.kts file?
e
Yes