Slackbot
07/18/2023, 12:10 PMNiels Doucet
07/18/2023, 12:11 PMVampire
07/18/2023, 1:26 PM<GRADLE_USER_HOME>/init.d/
, then sync any Gradle project.
When IJ syncs a Gradle project, Gradle is telling it all scripts that were used, including init scripts.
Then open that init script in IJ in that location and you can edit it with IntelliSense properly available.Niels Doucet
07/18/2023, 1:58 PMVampire
07/18/2023, 2:13 PMif (!rootProject.name == "init-script-editor") return
and maybe in the shipped one the opposite.Vampire
07/18/2023, 2:15 PM-I
somehow during IntelliJ sync.
If you can, that should also work.
Or you should probably only keep the files in that directory while you are editing them and then open sync the project where you want to edit them, where you can make sure to not use the custom distribution.Vampire
07/18/2023, 2:16 PMGRADLE_USER_HOME
, so you could also open the init script from there. I'm just not sure whether it would be a good idea to edit them there, as then you work with the modified custom distribution instead of the actual one.Vampire
07/18/2023, 2:17 PMVampire
07/18/2023, 2:18 PMkotlin-dsl
plugin applied where you put the init scripts to src/main/kotlin
, that should also work to get proper IntelliSense I thinkNiels Doucet
07/18/2023, 3:01 PMNiels Doucet
07/18/2023, 3:29 PMorg.gradle.kotlin.dsl.support.delegates.GradleDelegate
objects, which I don't think is correct here?
e.g. before I had to write gradle.beforeSettings
, but now gradle
is my delegate, so it wants me to drop thatVampire
07/18/2023, 3:32 PMVampire
07/18/2023, 3:38 PMGradle
as delegate, just as an init-script plugin would be a Plugin<Gradle>
.
Gradle
also has a getGradle()
method just like Project
has Project.getProject()
.Niels Doucet
07/18/2023, 3:38 PMNiels Doucet
07/18/2023, 3:38 PMVampire
07/18/2023, 3:38 PMgradle.beforeSettings { ... }
or directly beforeSettings { ... }
in an init script should behave exactly the same.