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

    bsideup

    01/31/2017, 9:13 AM
    and, to simplify the testing and development I want to have full IDE support in
    app
    module for the scripts
    i
    • 2
    • 5
  • i

    ilya.chernikov

    02/01/2017, 9:35 AM
    @bsideup no, currently it is not possible. Could you explain your use case?
    b
    • 2
    • 4
  • a

    apatrida

    02/02/2017, 9:37 PM
    @ilya.chernikov are you seeing breaking stuff in script such as this (beta 38): script:
    println(x); val x = 99; println(x)
    produces error:
    uy.kohesive.keplin.kotlin.script.ReplCompilerException: error: unexpected tokens (use ';' to separate expressions on the same line)
    println(x); val x = 99; println(x)
                            ^
    i
    • 2
    • 1
  • a

    apatrida

    02/02/2017, 9:38 PM
    when you said tests were failing in the script-utils code (from PR) this might be two of the failing tests. Also the maven resolver and extension methods will fail (extension functions brought in cannot be referenced), but should be marked ignore
  • a

    apatrida

    02/02/2017, 10:13 PM
    @ilya.chernikov I’ll bring
    kotlin-jupyter
    up to date
    i
    • 2
    • 1
  • a

    apatrida

    02/03/2017, 1:12 AM
    if not, makes it hard to use KotlinRemoteReplCompiler in the same code base as uses the embeddable compiler
    i
    • 2
    • 1
  • f

    fitzoh

    02/03/2017, 1:44 AM
    Anyone have any luck with manually setting external variables vis JSR-223?
    i
    a
    • 3
    • 2
  • f

    fitzoh

    02/03/2017, 2:05 PM
    Also having issues with intercepting the engine std out/err, is that also not implemented yet?
    i
    a
    • 3
    • 2
  • m

    max

    02/18/2017, 10:55 AM
    Could anyone out there point me to the updated document/tutorial describing how to compose and run kotlin script with package dependency management? I heard that somehow Kotlin can download (or use cached) jar-libraries given their gradle-like names and put those into classpath of the script.
    i
    s
    • 3
    • 8
  • a

    apatrida

    03/15/2017, 2:04 PM
    (that's from Keplin, but I'm sure I copied that test case into one of the PR's at some point)
    i
    • 2
    • 5
  • e

    ethankhall

    04/08/2017, 5:33 PM
    if i wanted to update some docs on how to use the embedded compiler where would you recommend I do that?
    i
    • 2
    • 3
  • i

    irus

    04/12/2017, 3:54 AM
    @ilya.chernikov I just submitted issue https://youtrack.jetbrains.com/issue/KT-17366 If it simple solution for this issue? I'd like to contribute to script utils development if it possible
    i
    • 2
    • 1
  • i

    irus

    04/16/2017, 6:21 PM
    I have a big string in script, that exceed maxByteLenght in org.jetbrains.org.objectweb.asm.ByteVector.encodeUTF8, so I have to split it in two strings. https://github.com/KotlinBy/awesome-kotlin/commit/354fedd29e5050c38a6ce25acb166e759a734f3a
    i
    • 2
    • 4
  • i

    irus

    04/23/2017, 3:53 AM
    http://stackoverflow.com/questions/43565407/guava-conflicts-when-using-kotlin-script-util-for-jsr-223-support-in-applicati
    i
    • 2
    • 1
  • m

    mgtriffid

    05/10/2017, 1:16 PM
    Hi everyone! I tried to google this, but can't find complete answer. Can .kts files contain maven dependencies declaration inside them? Just like in Groovy with
    @Grab
    annotation. Or this is not implemented yet and I should pick some 3rd-party thing like kscript? It seems fine, but I'd prefer solution from JB of course
    i
    • 2
    • 2
  • i

    irus

    05/27/2017, 10:22 AM
    Is KotlinJsr223JvmLocalScriptEngine thread-safe? I'd like to use it like this:
    suspend override fun <T> execute(inputStream: InputStream): T {
            // ToDo: Is scriptEngine thread safe?
            return CompletableFuture.supplyAsync { scriptEngine.eval(inputStream.reader()) as T }.await()
        }
    i
    • 2
    • 2
  • a

    alex.hart

    08/09/2017, 9:40 AM
    @ilya.chernikov does that mean I can't unit test a script which uses args?
    i
    • 2
    • 9
  • r

    raulraja

    08/14/2017, 6:24 PM
    I'm programmatically accessing
    kotlinc
    and feeding it snippets to verify they can be compiled. Is there a way to also evaluate expressions and obtain their results in the same way the
    kotlinc
    REPL does? Any help or pointers in the right direction are appreciated 🙂
    i
    • 2
    • 2
  • j

    jlleitschuh

    08/15/2017, 6:42 PM
    Does anyone here have any experience with JDK 9 and kotlin scripting?
    • 1
    • 1
  • a

    alex.hart

    08/18/2017, 7:13 PM
    Does anyone off the top of their head know how to refer to the script’s
    this
    reference when inside an extension method?
    u
    • 2
    • 2
  • s

    sdeleuze

    08/29/2017, 8:36 AM
    Also I have log warnings like
    WARN: [kts] kotlin.script.experimental.dependencies.DependenciesResolver.NoDependencies must have a constructor without required parameters
    e
    • 2
    • 1
  • r

    raulraja

    09/02/2017, 1:11 AM
    Does the Kotlin scripting JSR223 supports evaluation of expressions with coroutines? Whenever I use coruotines and sometimes in other scenarios I get in an endless loop at `findLocalVariable:136, ScopeUtilsKt (org.jetbrains.kotlin.resolve.scopes.utils)`:
    inline fun HierarchicalScope.processForMeAndParent(process: (HierarchicalScope) -> Unit) {
        var currentScope = this
        while (true) {
            process(currentScope)
            currentScope = currentScope.parent ?: break
        }
    }
    i
    • 2
    • 3
  • j

    jlleitschuh

    09/06/2017, 11:43 PM
    Probably but this channel seems kind of dead
    a
    i
    • 3
    • 8
  • j

    jlleitschuh

    09/07/2017, 3:00 PM
    @udalov Issue opened here: https://youtrack.jetbrains.com/issue/KT-20167 Also, perhaps @ilya.chernikov you may have some thoughts?
    i
    • 2
    • 2
  • g

    Gary Tierney

    09/20/2017, 6:01 PM
    ah, history limit of 10,000 messages 😞
    g
    • 2
    • 1
  • i

    ilya.chernikov

    09/21/2017, 8:33 AM
    Answering to @Czar questions in #general: https://kotlinlang.slack.com/archives/C0922A726/p1505979403000389 https://kotlinlang.slack.com/archives/C0922A726/p1505981342000114 The kotlin compiler is a complex beast with many dependencies, so you will probably need an isolation from your application in some way. Of course we intend to do this isolation easier by providing specific wrappers, but unfortunately we’re not there yet. But if you’re still willing to continue the experiment, there are two ways: First you may try to continue the route with embeddable compiler, but load the scripting part in a classloader which will filter the conflicting dependencies. And second - you may try to use compilation in daemon. If you’re using JSR223 interfaces, then you may simply try to start from this example - https://github.com/JetBrains/kotlin/tree/master/libraries/examples/kotlin-jsr223-daemon-local-eval-example. If you’re trying more low-level approach, then you may look at this class https://github.com/JetBrains/kotlin/blob/master/libraries/tools/kotlin-script-util/src/main/kotlin/org/jetbrains/kotlin/script/jsr223/KotlinJsr223JvmDaemonCompileScriptEngine.kt#L39as a starting point. The problem with warning about the runtime is not related to the isolation, and we’re working on the fix now.
    c
    • 2
    • 2
  • g

    Gary Tierney

    09/21/2017, 8:46 AM
    ouch... I don't think I ever tried reloading my projects after doing that! Thanks for the tip @ilya.chernikov, I'll test that out when I get the chance and report back. When you say "based on the metadata", do you mean using the `ScriptAnalyzer`s introduced in the latest proposal? Also, does this discussion happen elsewhere or is it an internal JB thing? Would very much like to get involved in that if possible. We're using scripting very heavily!
    i
    • 2
    • 2
  • j

    jlleitschuh

    09/21/2017, 4:12 PM
    @ilya.chernikov Is there any thoughts/plans around supporting some sort of shebang like bash but for Kotlin Scripts? Maybe using a
    @file:....
    annotation? That way the IDE can automatically configure itself for a specific scripting file?
    i
    • 2
    • 2
  • j

    jlleitschuh

    10/09/2017, 4:53 PM
    @ilya.chernikov Is there any reason why this shouldn't work in a Kotlin Script??
    enum class Build { Debug, Release }
    fun applySomething(build: Build) = when (build) {
        Build.Debug -> "environmentDebug"
        Build.Release -> "environmentRelease"
    }
    This seems like a scripting bug, yes? https://github.com/gradle/kotlin-dsl/issues/526 Just want to make sure that this isn't a "works as expected"
    i
    b
    • 3
    • 4
  • h

    holgerbrandl

    11/04/2017, 10:41 PM
    @mkobit you could https://github.com/holgerbrandl/kscript meanwhile. Feel welcome if you have any questions. And there was even talk about it ‘recently’ file:///Users/brandl/Dropbox/kscript_kotlinconf_2017/kscript_kotlinconf.html#2
    m
    • 2
    • 1
Powered by Linen
Title
h

holgerbrandl

11/04/2017, 10:41 PM
@mkobit you could https://github.com/holgerbrandl/kscript meanwhile. Feel welcome if you have any questions. And there was even talk about it ‘recently’ file:///Users/brandl/Dropbox/kscript_kotlinconf_2017/kscript_kotlinconf.html#2
m

mkobit

11/04/2017, 11:04 PM
Awesome thanks for this
View count: 1