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
ilya.chernikov
07/05/2023, 6:51 AM
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
dhkim
07/05/2023, 7:04 AM
That's clear enough. Thank you.
dhkim
07/05/2023, 11:42 PM
Forgot to mention that I was a bit confused due to the warning not going away even when I set standalone to false.
dhkim
07/05/2023, 11:42 PM
Anyway I got the point.
i
ilya.chernikov
07/10/2023, 1:33 PM
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?