This message was deleted.
# community-support
s
This message was deleted.
v
Never use extra properties, they are almost always just a work-around. Register a new extension with a
DirectoryProperty
. Wire that property to where you need it. Then the customers can configure that extension and you even get implicit task dependencies as needed. If the target for that folder is not yet in lazy API, but needs
File
or similar, you can for example make the extension not have a property but a function to which you give the directory and in the body you do the according configuration.
j
🤔 Hmmm, so it is possible to register extensions on precompiled script plugins? I thought that was something for full fledged plugins only. How do you link the extension to the script plugin? And how to write the extension? You have to do that with a separate Kotlin or gradle class, or is there a more “scripty” way to do it. Do you place the extension right next to the .gradle.kts file in buildSrc?
Tnx for the help by the way Vampire, you helped me out in the past already with other questions. Impressive that you keep helping people in the chat. 👍
🙂 1
v
Of course it is. Anything you can do in a regular plugin you should be able to do in a precompiled script plugin. They are more or less just syntactic sugar for writing a plugin with little boilerplate. Not sure what you mean with "link". Regarding how to write you are flexible. You can write it in a separate .kt file like a normal class or interface. Where you place it follows the same rules as any other Kotlin code, you can basically put it anywhere or put it in a directory structure according to packages you set. But iirc you can also just declare the interface for the extension inline in the script. I don't have a computer with me, so cannot try, but I think it should work just fine.