Hi! I have a quick question on the implication of ...
# scripting
d
Hi! I have a quick question on the implication of the change made as per https://youtrack.jetbrains.com/issue/KT-52735/Ignore-scripts-in-source-roots-by-default. Does it mean that the Script-based DSL use case in the scripting KEEP couldn't be implemented as it is outlined there? https://github.com/Kotlin/KEEP/blob/master/proposals/scripting-support.md#script-based-dsl Just simple yes or no would be enough for me. I guess I rather need to rely on the cache mechanism rather than implementing the strategy.
To sum up, compiling scripts in the source tree seems deprecated and existing use cases such as Gradle has been special cased for the time being. With that in mind, what I understand is it's no longer preferred to compile scripts together with Kotlin source codes. Then what's the recommended way of implementing the Gradle like, precompiled script use cases? Relying on caching? Or creating script compile build task myself? Thanks in advance.
i
The main idea of this change is that such usages should be explicit, because as a default such behavior may cause confusion. This explicit behavior can be turned on by using the
isStandalone(false)
property in the script configuration for the script type that supposed to be used along the sources. Alternatively, the old behavior could be preserved by project via the compiler option
-Xallow-any-scripts-in-source-roots
, as it is mentioned in the issue. So, the answer is - the described in the KEEP script-based DSL approach can still be implemented, and this is not discouraged, provided that the script definition explicitly states that the script should be compiled as a part of a project.
👍 1
d
That's clear enough. Thank you.
Forgot to mention that I was a bit confused due to the warning not going away even when I set standalone to false.
Anyway I got the point.
i
Forgot to mention that I was a bit confused due to the warning not going away even when I set standalone to false.
You mean the warning in the IDE (on top of the edited script file) or or among the compiler messages?
d
It was a compiler message.