How can I run Kotlin-Script (*.kts) files from within Gradle?
From the command line, I can call: kotlinc -script foo.kts
How can I do this from gradle (build.gradle)?
How can I run Kotlin-Script (*.kts) files from within Gradle?
From the command line, I can call: kotlinc -script foo.kts
How can I do this from gradle (build.gradle)?
You have two options here to run a gradle build file named build.gradle.kts.
settings.gradle to build.gradle.kts:
rootProject.buildFileName = 'build.gradle.kts' and run gradle <tasknames>.gradle -b build.gradle.kts <tasknames>.Note that with version gradle 4.21 (current at the time of writing this), you do not need any "buildFileName" entry, or any other entry in settings.gradle.  If there is a build.gradle.kts and no build.gradle, gradle will use build.gradle.kts by default.
However having the setting for buildFileName does allow build.gradle to be ignored. Without the setting, you have to remove (or rename) build.gradle in order to run build.gradle.kts.  
If you have both a build.gradle and a build.gradle.kts you can switch between the two by commenting and un-commenting the buildFileName setting.