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
  • m

    mkobit

    07/26/2018, 6:47 PM
    what is the recommended practice for generating code to be compiled along with the script? similar to how the kotlin-dsl generates accessors based on the plugins applied? i see the
    compiler-embeddable
    artifact, but that doesn't seem to be documented too well
    i
    • 2
    • 1
  • b

    bart

    08/12/2018, 2:00 PM
    Hi, I've been trying to compile and run some basic scripts but I keep running into various errors which I described here: https://discuss.kotlinlang.org/t/embedded-scripting-error/8975. I don't really understand what goes wrong. If anybody can push me into the right direction that would be appreciated.
    o
    • 2
    • 4
  • h

    holgerbrandl

    08/17/2018, 2:55 PM
    @ilya.chernikov Since it is the most requested feature, I’d like to start a kscript plugin for IJ and was wondering if the scripting API is already in a state to declare custom dependencies as defined in my custom script format (see https://github.com/holgerbrandl/kscript#annotation-driven-script-configuration for an example) via a plugin. Next I’d like to create a custom kotlin-run-configuration. Are there some examples already centered around the ScriptEvaluator from the KEEP or is this still work in progress?
    👍 1
    i
    • 2
    • 4
  • i

    ilya.chernikov

    08/20/2018, 8:42 AM
    @Gary Tierney there is much more to it than searching for the discovery files. Much more difficult is to implement actual loading of the script definition before compilation. So after assessing amount of work we decided to postpone it for a moment. I plan to come back to this topic later. Thank you for the example anyway, I’ll see if I can incorporate it into our tests as a remainder of the missing functionality.
    👍 2
    g
    • 2
    • 2
  • h

    holgerbrandl

    08/21/2018, 9:43 AM
    Because I’m intrigued by the cool features of https://github.com/khud/sparklin by @khud, I’ve created a tiny launcher which takes a `kscript`let and spins up
    KShell
    with all script dependencies being resolved. See https://github.com/holgerbrandl/kscript/tree/master/misc/kshell_launcher
    d
    • 2
    • 1
  • d

    deviant

    09/05/2018, 7:06 AM
    @holgerbrandl is it possible to do
    @file:KotlinOpts("-classpath deps.jar")
    in the kscript?
    h
    • 2
    • 1
  • p

    Parshav

    09/05/2018, 3:36 PM
    Hey there, I am using kscript for writing down a script and just added a lazy val, but am getting this error :
    error: cannot choose among the following candidates without completing type inference: 
    public fun <T> lazy(initializer: () -> ???): Lazy<???> defined in kotlin
    public fun <T> lazy(initializer: () -> ???): Lazy<???> defined in kotlin
    Not sure what to do. I cleared cache but still lingers on. I only have one lazy evaluation and it is breaking on it :
    val ss: String by lazy { "hello" }
    Any ideas on what could be going on?
    h
    • 2
    • 1
  • b

    bart

    09/06/2018, 6:27 PM
    What if you try this
    -.kt
    p
    • 2
    • 1
  • n

    Nikky

    09/08/2018, 4:53 PM
    would this be the place to ask kscript related questions ?
    h
    • 2
    • 1
  • g

    Gary Tierney

    09/18/2018, 1:23 PM
    @SrSouza hmm, I think that should work. Maybe try with a default configuration instead of a configurator?
    s
    • 2
    • 1
  • i

    ilya.chernikov

    09/19/2018, 11:30 AM
    @SrSouza I guess you’re trying to use
    kotlin-compiler-embeddable
    , right? If so, I recommend to do it with the regular compiler.
    s
    • 2
    • 2
  • n

    Nikky

    09/21/2018, 1:43 PM
    and yep, as suspected, dynmic versions and repeated annotations do not work, i did nto really expect the former one (although i would love to have it)
    g
    • 2
    • 1
  • v

    vaskir

    09/23/2018, 12:22 PM
    What is the purpose of "debug script" action if I cannot set breakpoints?
    h
    • 2
    • 2
  • s

    SrSouza

    09/24/2018, 3:44 PM
    Hi, how i can use the gradle scripting plugin? my script is not in the source folder
    i
    • 2
    • 4
  • n

    Nikky

    09/26/2018, 4:27 PM
    @holgerbrandl can we chat about https://github.com/holgerbrandl/kscript/issues/166 and https://github.com/holgerbrandl/kscript/pull/169 here ?
    h
    k
    • 3
    • 6
  • l

    Luke

    09/27/2018, 7:07 PM
    Hi, I want to execute a git command in all directories inside a certain folder, but I can't find how to navigate in the directory to execute the command.
    n
    • 2
    • 6
  • j

    jlleitschuh

    10/01/2018, 7:27 PM
    I'm not certain if this is a Ktlint issue, a Kotlin scripting issue, or a Gradle Kotlin DSL issue. But on our Jenkins slaves I'm getting this very strange error: I'm wondering if anyone has any insights as to what might be causing this. Perhaps something to do with the Kotlin compiler daemon??? https://github.com/shyiko/ktlint/issues/287
    i
    • 2
    • 1
  • l

    lburgazzoli

    10/08/2018, 2:58 PM
    I'm reading https://github.com/Kotlin/KEEP/blob/master/proposals/scripting-support.md and I wonder if there is a complete example to load a kotlin script from java and/or kotlin project that allow to bind object from application to scripting code
    i
    • 2
    • 26
  • v

    voddan

    10/11/2018, 1:09 PM
    Hello! I have a Kotlin Gradle project. If I create a
    .kts
    file it works anywhere except the
    /src/main/kotlin
    folder. The exception is
    src/main/kotlin/test.kts: (3, 1): Cannot access script base class 'kotlin.script.templates.standard.ScriptTemplateWithArgs'. Check your module classpath for missing or conflicting dependencies
    . What is the problem?
    r
    • 2
    • 7
  • g

    Gary Tierney

    10/11/2018, 1:30 PM
    I suppose you need kotlin-script-runtime on the compile classpath to compile scripts under a source set
    v
    • 2
    • 3
  • v

    voddan

    10/11/2018, 2:13 PM
    Does anybody know how to get InteliJ REPL integration for scripts similar to what it has for scratch files?
    g
    • 2
    • 4
  • n

    Nikky

    10/13/2018, 8:21 AM
    i was thinking about the possibility to make a static site generator like jekyll, but in kotlin, with each .kts file representing a target .html file i assume any amount of shared code would still have to be written in .kt files and i am not sure how much data can be passed to a kotlin script at start (over more than env variables)
    g
    • 2
    • 6
  • d

    DALDEI

    10/15/2018, 11:18 PM
    With 1.3-rc(3?) -- is scripting yet usable 'out of the box' ? I cant get a clear picture -- I think I understand the stated limitations but I dont understand the final story on dependencies -- i.e. where all the needed .jar files are, nor if there is still a missing 'last mile' where you need some (undefined) magic class to make it actually work. By 'work' I mean using the 'newer' kotlin specific templates -- do they exist in public packages yet ? the scripting compiler runtiume ? -- I know the basic JSR scripting stuff has been working OK for several releases.
    g
    • 2
    • 5
  • n

    Nikky

    10/16/2018, 6:32 AM
    so i want to do two things with kotlin scripting.. use scripts as a more powerful configuration language loaded by my jar.. as far as i understand for that i have to use JSR scripting ? and secondary, getting IDE support , highlighting and autocompletion in .kts files that match the classpath that would be used for 1. i tried https://github.com/s1monw1/KtsRunner already but that does not give me 2. i think
    d
    g
    • 3
    • 17
  • n

    Nikky

    10/17/2018, 9:53 PM
    ScriptDiagnostic(message=No class roots are found in the JDK path: /usr/lib/jvm/intellij-jdk/jre, severity=ERROR, location=null, exception=null)
    my code to load a simple script lookslike so:
    fun main(args: Array<String>) {
        val code = FileScriptSource(File("/home/nikky/dev/experiments/kotlin-scripting-test/test.voodoo.kts"))
        val a = BasicJvmScriptingHost().eval(
            FileScriptSource(File("/home/nikky/dev/experiments/kotlin-scripting-test/test.voodoo.kts")),
            ScriptCompilationConfiguration {
                set(baseClass, KotlinType(ScriptDefinition::class))
            },
            null
        )
        println(a.toString())
        a.reports.forEach {
            println(it)
        }
    }
    g
    • 2
    • 1
  • n

    Nikky

    10/19/2018, 8:00 PM
    sometimes it decides to error out and the script is al lred, no matter how many refreshes i do it needs to be copied into a new file and renamed
    i
    • 2
    • 1
  • o

    oshai

    10/21/2018, 3:32 PM
    reposting from #getting-started : is there a lib/functionality in kotlin to get a class compiled from string? something like this project but for kotlin: https://github.com/trung/InMemoryJavaCompiler
    k
    n
    i
    • 4
    • 21
  • n

    Nikky

    10/23/2018, 12:17 PM
    ScriptDiagnostic(message=Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option, severity=ERROR, location=Location(start=Position(line=101, col=35, absolut
    how or where do i configure compilation options like this ? i found tat i can do this:
    compilerOptions.append("-jvm-target", "1.8")
    but it has no effect
    i
    • 2
    • 3
  • n

    Nikky

    10/24/2018, 7:01 PM
    @ilya.chernikov is there any feature i am overlooking that allows me to add extra .kt files to a script compilation ? the alternative would be to append it to the script that is being compiled which does not seems very clean
    i
    • 2
    • 2
  • l

    lburgazzoli

    10/25/2018, 2:57 PM
    @ilya.chernikov I know that KT-27497 may not be included in 1.3 but do you have an estimation about when it could be included ?
    i
    • 2
    • 2
Powered by Linen
Title
l

lburgazzoli

10/25/2018, 2:57 PM
@ilya.chernikov I know that KT-27497 may not be included in 1.3 but do you have an estimation about when it could be included ?
i

ilya.chernikov

10/25/2018, 3:00 PM
It will be released for sure with 1.3.20, but exact timeline is not known at the moment.
l

lburgazzoli

10/25/2018, 3:05 PM
thx
View count: 1