https://kotlinlang.org logo
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
scripting
  • n

    Nikky

    02/05/2022, 3:56 PM
    is it currently possible to write a .main.kts that defines and uses
    @Serializable
    classes? how would is enable to kotlinx-serialization plugin ? i want to write a script to do a bit of json processing
    j
    m
    • 3
    • 8
  • j

    jmfayard

    02/14/2022, 5:25 PM
    @file:Import("path.kt")
    is not supported by the IDE?
    b
    i
    • 3
    • 7
  • p

    Piotr Krzemiński

    02/16/2022, 12:31 PM
    is there a GitHub action that handles updating dependencies in .main.kts files, and prepares PRs? like Dependabot, only for Kotlin scripts. I'd like such changes to be made partially automatically: https://github.com/krzema12/github-actions-kotlin-dsl/pull/90/files
    j
    j
    • 3
    • 6
  • t

    Tobias

    02/16/2022, 4:18 PM
    Using JSR223, I have code that worked well in 1.4. Now with 1.6.10 I'm getting: javax.script.ScriptException: ERROR Inheritance from an interface with '@JvmDefault' members is only allowed with -Xjvm-default option (ScriptingHost6cabebe2_Line_0.kts5️⃣1)
    i
    • 2
    • 8
  • j

    jmfayard

    02/17/2022, 11:34 AM
    Am I right that IntelliJ doesn't have support for showing the kdoc of an imported external dependency?
    i
    • 2
    • 4
  • d

    Didier Villevalois

    02/23/2022, 3:20 PM
    Hi all! I followed the scripting tutorial and successfully created a script definition and host. I also added a
    .classname
    file in the
    META-INF
    of my script definition module (which, btw, is not described in the tutorial). This works well, and now I can create my script files in the same IDE project. Now, I would need to have support for this script definition in other project. Should I create an IDEA plugin?
    s
    • 2
    • 2
  • n

    nickheitz

    02/26/2022, 11:30 AM
    Hi all... Apologies for the rushed message, but I'm hoping the solution simply occurs to someone. I have some code that compiles string into kotlin code, via the scripting host and the JVM script compiler. This works in kotlin 1.5.32, but breaks under 1.6.10, throwing the following...
    Caused by: java.lang.ClassNotFoundException: com.intellij.openapi.util.Disposer
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    Is there an easy resolution here?
    i
    • 2
    • 4
  • n

    nfrankel

    03/03/2022, 7:01 AM
    is there a project manager for scripting at jetbrains? it would be good to understand the roadmap i’m becoming more and more disappointed i’ve created my new scripts in python, though i’ve only written python 4 times in my life (now 5)
    👀 1
    m
    • 2
    • 1
  • z

    Zac Sweers

    03/03/2022, 5:09 PM
    Curious question - I noticed that “common” or imported script files in the samples repo use
    *.smain.kts
    , and I was curious if that
    smain
    naming is a convention or something else? I couldn’t find any other references explaining it in google searches
    r
    • 2
    • 3
  • n

    Nikky

    03/03/2022, 10:03 PM
    is there a way to get a path to the currently executing script (
    .main.kts
    ) ? i don't want to reply on the script getting invoked always from the correct root directory or trying to guess what the correct path is.. somthing like
    File(Script_main::class.java.protectionDomain.codeSource.location.toURI())
    but that does not work since location in codeSource is null does anyone know a workaround ?
    ➕ 2
    a
    • 2
    • 3
  • i

    iguissouma

    03/09/2022, 10:25 PM
    Any idea why I’m getting this:
    2022-03-09 23:20:03,637 [ 284400]  ERROR - plication.impl.ApplicationImpl - Service is dying 
    java.lang.IllegalStateException: Service is dying
       at org.jetbrains.kotlin.daemon.common.CompileService$CallResult$Dying.get(CompileService.kt:55)
       at org.jetbrains.kotlin.daemon.common.CompileService$CallResult$Dying.get(CompileService.kt:54)
       at org.jetbrains.kotlin.daemon.client.KotlinRemoteReplCompilerClient.<init>(KotlinRemoteReplCompilerClient.kt:51)
       at org.jetbrains.kotlin.daemon.client.KotlinRemoteReplCompilerClient.<init>(KotlinRemoteReplCompilerClient.kt:27)
       at org.jetbrains.kotlin.jsr223.KotlinJsr223JvmScriptEngine4Idea$replCompiler$2.invoke(KotlinJsr223JvmScriptEngine4Idea.kt:59)
       at org.jetbrains.kotlin.jsr223.KotlinJsr223JvmScriptEngine4Idea$replCompiler$2.invoke(KotlinJsr223JvmScriptEngine4Idea.kt:27)
       at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
       at org.jetbrains.kotlin.jsr223.KotlinJsr223JvmScriptEngine4Idea.getReplCompiler(KotlinJsr223JvmScriptEngine4Idea.kt)
       at org.jetbrains.kotlin.jsr223.KotlinJsr223JvmScriptEngine4Idea$localEvaluator$2.invoke(KotlinJsr223JvmScriptEngine4Idea.kt:74)
       at org.jetbrains.kotlin.jsr223.KotlinJsr223JvmScriptEngine4Idea$localEvaluator$2.invoke(KotlinJsr223JvmScriptEngine4Idea.kt:27)
       at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
       at org.jetbrains.kotlin.jsr223.KotlinJsr223JvmScriptEngine4Idea.getLocalEvaluator(KotlinJsr223JvmScriptEngine4Idea.kt)
       at org.jetbrains.kotlin.jsr223.KotlinJsr223JvmScriptEngine4Idea.getReplEvaluator(KotlinJsr223JvmScriptEngine4Idea.kt:77)
       at org.jetbrains.kotlin.jsr223.KotlinJsr223JvmScriptEngine4Idea.createState(KotlinJsr223JvmScriptEngine4Idea.kt:79)
       at org.jetbrains.kotlin.cli.common.repl.KotlinJsr223JvmScriptEngineBase.createState$default(KotlinJsr223JvmScriptEngineBase.kt:46)
       at org.jetbrains.kotlin.cli.common.repl.KotlinJsr223JvmScriptEngineBase.getCurrentState(KotlinJsr223JvmScriptEngineBase.kt:53)
       at org.jetbrains.kotlin.cli.common.repl.KotlinJsr223JvmScriptEngineBase.nextCodeLine(KotlinJsr223JvmScriptEngineBase.kt:44)
       at org.jetbrains.kotlin.cli.common.repl.KotlinJsr223JvmScriptEngineBase.compileAndEval(KotlinJsr223JvmScriptEngineBase.kt:61)
       at org.jetbrains.kotlin.cli.common.repl.KotlinJsr223JvmScriptEngineBase.eval(KotlinJsr223JvmScriptEngineBase.kt:31)
       at java.scripting/javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
       at com.chutneytesting.idea.runner.ChutneyJsonToTestEventConverter.onStartTesting$lambda-4(ChutneyJsonToTestEventConverter.kt:64)
       at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:263)
       at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
       at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
       at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
       at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
       at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
       at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
       at java.base/java.security.AccessController.doPrivileged(Native Method)
       at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
       at java.base/java.lang.Thread.run(Thread.java:829)
    I’m evaluating kotlin script on an intellij idea plugin
    class ChutneyKotlinJsr223JvmLocalScriptEngineFactory(val ktVirtualFile: VirtualFile, val project: Project) : KotlinJsr223JvmScriptEngineFactoryBase() {
    
        companion object{
            private val LOG = Logger.getInstance(ChutneyKotlinJsr223JvmLocalScriptEngineFactory::class.java)
        }
    
        override fun getScriptEngine(): ScriptEngine {
            val module = ModuleUtil.findModuleForFile(ktVirtualFile, project)
                ?: error("cannot find module")
    
            val classes = ModuleRootManager.getInstance(module).orderEntries().classes()
            val roots = classes
                .roots.filterIsInstance<FsRoot>()
                .map { it.path.substringBeforeLast('!') }
                .map { File(it) }
                .filter { it.exists() }
    
    
            val target = classes
                .roots.filter { it.isDirectory }
                .filter { it.path.lowercase().endsWith("classes") }
                .map { File(it.path) }
                .filter { it.exists() }
    
            <http://LOG.info|LOG.info>("dependencies for ${module.name}" + roots + classes)
    
            return KotlinJsr223JvmScriptEngine4Idea(
                this,
                scriptCompilationClasspathFromContextOrStlib(wholeClasspath = true) + KotlinJars.kotlinScriptStandardJars + roots + target,
                "kotlin.script.templates.standard.ScriptTemplateWithBindings",
                { ctx, argTypes ->
                    ScriptArgsWithTypes(
                        arrayOf(ctx.getBindings(ScriptContext.ENGINE_SCOPE)),
                        argTypes ?: emptyArray()
                    )
                },
                arrayOf(Map::class)
            )
        }
    
    
    }
    :thread-please: 2
    i
    • 2
    • 4
  • r

    ribesg

    03/15/2022, 10:28 AM
    Hey, long time not tried Kotlin scripts, do we still need kscript for basic scripts with dependencies?
    m
    v
    e
    • 4
    • 21
  • n

    Nikky

    03/20/2022, 10:53 AM
    in a
    .main.kts
    can i use
    @file:Repositry
    to point to a local folder repository ?
    @file:Repository("/home/nikky/dev/forks/github-actions-kotlin-dsl/localRepo/")
    does not seem to work or do repostories for this need to be http based ?
    e
    b
    v
    • 4
    • 12
  • n

    Nikky

    03/23/2022, 2:16 PM
    does anyone know if there is a gradle plugin or the like to execute
    .main.kts
    files using kotlinc from the kotlin gradle plugin ?
    👀 2
    j
    e
    +2
    • 5
    • 11
  • s

    Slackbot

    03/24/2022, 3:51 PM
    This message was deleted.
    m
    e
    j
    • 4
    • 4
  • a

    Adam S

    04/17/2022, 9:01 PM
    Hi, I'm trying to set up Knit tests for some scripts. I've set up the 'scripting host' as documented on kotlinlang.org, and it works when I run it manually. But when I run it as a test (using Kotest), I get an exception
    java.lang.NoSuchMethodError: 'void org.jetbrains.kotlin.cli.jvm.compiler.KotlinCliJavaFileManagerImpl.<init>(org.jetbrains.kotlin.com.intellij.psi.PsiManager)'
    I'm not sure what the problem could be, or how to try and find out. Any ideas?
    exampleTest.kt.cpp
    i
    • 2
    • 4
  • m

    Matthieu Stombellini

    04/24/2022, 3:44 PM
    Hi! For some reason, when I add a (valid)
    @file:Import("somefile.main.kts")
    annotation to a .main.kts script, the autocompletion and syntax highlighting on that file completely disappears (beyond very simple things like coloring keywords) after an "Apply context". Is this a known issue?
    b
    z
    +2
    • 5
    • 22
  • m

    Matthieu Stombellini

    05/16/2022, 9:37 PM
    Hello everyone. Is there a way to "register" scripts that get compiled into some sort of META-INF file? Let me explain. I have my regular Kotlin sources that contain my good ol' .kt files, along with some
    .custom.kts
    files. I would like to retrieve, at runtime, a list of all of the classes that were compiled from said
    .custom.kts
    files, e.g. with their FQN in a file somewhere within META-INF (similar to (I believe?) service providers in Java). Is there a way to do this with just the script compilation configs that are offered? I'd like to do this without compiler plugins or KSP in order to keep my build process simple. Is there a way to do this? (There are multiple use cases on my end, such as doing some sort of "feature discovery" at runtime by looking at all the classes that got generated from a
    .feature.kts
    file of some sort)
    i
    t
    • 3
    • 3
  • s

    SrSouza

    06/03/2022, 12:31 AM
    I saw that Scripting got Focus on the Roadmap, I have being using scripting for couple years I love it but at time there was alot missing things. 2 Major drawbacks was: • the complexity of having easy auto complete in the IDE while creating a custom type that is used out side our project script definition project. You had add the Jar file to IntelliJ in script configuration (that is not really intuitive) to get auto complete and stuff working • Script scope not being able to be
    suspend
    I want to know if this two things are in the Roadmap as well and what is there is anyplan to resolve the first one.
    👀 4
    i
    • 2
    • 3
  • v

    Vampire

    06/16/2022, 9:43 PM
    Is there some Gradle plugin to let a
    *.main.kts
    script run? Especially without having Kotlin installed on the local machine. Or is it really required to have Kotlin installed and then invoke it with the script as argument?
    👀 2
    t
    i
    +3
    • 6
    • 95
  • s

    Su5eD

    06/17/2022, 6:27 PM
    Is it possible to disable the "Kotlin Scripting is now in Beta stage" notification which shows up every time I open a script file in IntelliJ IDEA?
    a
    • 2
    • 2
  • s

    starke

    06/23/2022, 10:25 PM
    I am trying to figure out how to import a class that is defined in a separate file. I found this discussion from a while ago, but wanted to check if there have been any updates related to this? I can access properties that are defined in
    foo.main.kts
    when I use
    @file:Import
    , but can’t figure out a way to access classes that are defined in
    foo.main.kts
    @file:Import("foo.main.kts")
    I tried referencing the class like
    Foo_main.MyClass()
    , but it doesn’t seem to work 🤔 Thanks in advance!
    i
    • 2
    • 7
  • s

    starke

    06/24/2022, 7:56 PM
    Related question: is there a way to execute another kotlin/other script from a
    main.kts
    script? E.g. If I have
    script1.main.kts
    and want to execute
    script2.main.kts
    from inside that script. Hopefully in a way that I can pass arguments too. :thank-you:
    • 1
    • 2
  • p

    Piotr Krzemiński

    06/26/2022, 9:05 AM
    Hi, does anyone know a mechanism similar to Dependabot and Renovate that supports updating dependencies in Kotlin scripts, in the context of GitHub? I'm thinking about a GitHub action
    n
    • 2
    • 2
  • v

    Vampire

    06/26/2022, 8:57 PM
    Can you somehow define which Kotlin version a Kotlin Script is written in? In my case especially a
    .main.kts
    script. I guess it uses whatever Kotlin version you are running it with. But how to make sure it is at least version X? Do you have to manually check that if necessary? Actually more important, how does IntelliJ know which stdlib to use for navigation and completion? I have a script that I intend to run only with Kotlin 1.7.0, so I could use Kotlin 1.7.0 API. But even if I add a
    @file:DependsOn
    on 1.7.0 stdlib-jdk8, it still navigates to 1.3.72 Kotlin stdlib. The installed plugin is 1.7.0 and the complier settings have "latest stable (1.7)" for language and api version.
    👀 1
    i
    a
    +2
    • 5
    • 20
  • z

    zt

    06/29/2022, 4:03 AM
    Is there any like example projects that use scripting? wonder if it would be a good choice for making the main API of an application in regular kotlin and users can interact with it using scripts I'm also curious if this could be paired with kotlin compose for desktop
    s
    • 2
    • 1
  • r

    ribesg

    06/29/2022, 9:50 AM
    Why can’t you rollback to previous kotlin versions with Homebrew? Who decided not to expose them? 1.7.0 is a buggy mess
    j
    d
    • 3
    • 4
  • a

    andylamax

    07/04/2022, 1:41 PM
    how does one invoke a shell script (e.g.
    ./ls -al
    ) from a
    kscript?
    without going through the whole file api?
    p
    • 2
    • 1
  • z

    Zac Sweers

    07/07/2022, 4:07 PM
    anyone found that importing other local files from kscripts doesn’t appear to pick up changes in those files? I’m trying to understand where kotlin caches this and how to invalidate it (other than just editing the main kts file that calls it)
    j
    • 2
    • 8
  • e

    elect

    07/12/2022, 8:30 PM
    I've watched the

    talk▾

    of Oliveira to the Kotlin Conf and I wonder if I may be able to implement something Gradle-like, where you have a
    plugins
    block which gets evaluated and based on its content, specific code would be generated and made available to the rest of the script. In Gradle you have to hit refresh in the Gradle window, in order to trigger this mechanism, but what about in a classic script instead?
    j
    e
    i
    • 4
    • 6
Powered by Linen
Title
e

elect

07/12/2022, 8:30 PM
I've watched the

talk▾

of Oliveira to the Kotlin Conf and I wonder if I may be able to implement something Gradle-like, where you have a
plugins
block which gets evaluated and based on its content, specific code would be generated and made available to the rest of the script. In Gradle you have to hit refresh in the Gradle window, in order to trigger this mechanism, but what about in a classic script instead?
j

Javier

07/12/2022, 10:31 PM
I think they have its own compiler plugin for that
e

elect

07/12/2022, 10:54 PM
may I ask what suggests you that?
j

Javier

07/12/2022, 11:11 PM
What you mean?
e

elect

07/13/2022, 5:38 AM
why do you think they use a compiler plugin
e

efemoney

07/19/2022, 2:34 PM
Not a compiler plugin but they parse the source code “manually” (not with regex or anything but via a kotlin lexer)
i

ilya.chernikov

07/20/2022, 7:02 AM
There is a callback mechanism in the scripting API (
refineConfigurationBeforeParsing
property in the configuration) that would allow you to "intercept" the compilation in order to process your variant of the
plugins
block and supply the results (most importantly - new dependencies) to the compilation of the original script. But there are no means yet that would help you to process the block, you'll need to parse the script on your own. I do not recommend using compiler internals for that, like the lexer, while it may not be available for you in the future.
👍🏾 1
👍 1
View count: 6