https://kotlinlang.org logo
Docs
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
gradle
  • i

    Imran/Malic

    05/20/2019, 9:33 PM
    How can I say for instance I have:
    boringworks.core
    VVVVV
    boringworks.core-sense
    boringworks.core-dent
    ...
    s
    • 2
    • 3
  • e

    Eugen Martynov

    05/22/2019, 11:42 AM
    we see some numbers of the errors like:
    Task :app:compileDebugUnitTestKotlin FAILED
    Could not perform incremental compilation: Could not connect to Kotlin compile daemon
    Could not connect to kotlin daemon. Using fallback strategy.
    t
    z
    • 3
    • 7
  • r

    robnik

    05/22/2019, 4:48 PM
    Is there a reason for having these different different ways to get a task, and any reason why you might use one or the other?
    tasks["foo"]
    ,
    tasks.named("foo").get()
    ,
    tasks.getByName("foo")
    g
    s
    • 3
    • 8
  • n

    nuhkoca

    05/22/2019, 7:23 PM
    How do I retrieve val from
    gradle.properties
    and apply it with
    buildConfigField
    Below doesn’t work, I mean BASE_URL is not detected.
    buildTypes.forEach {
            it.buildConfigField("String", "BASE_URL", BASE_URL)
            it.buildConfigField("String", "BASE_PLAYER_URL", BASE_PLAYER_URL)
            it.buildConfigField("String", "ACCESS_TOKEN", ACCESS_TOKEN)
        }
    gradle.properties
    BASE_URL = "url"
    BASE_PLAYER_URL = "url"
    ACCESS_TOKEN = "token"
    ✅ 2
    s
    • 2
    • 9
  • g

    Geert

    05/24/2019, 1:17 PM
    Can someone tell me how I can get inline classes added in Kotlin Gradle DSL? Cannot find a working solution. Need to add this inline warning to freeCompilerArguments
    s
    g
    • 3
    • 10
  • s

    snowe

    05/24/2019, 11:57 PM
    I'm trying to register a task in the root module to call tasks in a submodule,
    tasks.register("jib") {
        dependsOn(tasks.named(":lp-server-deploy:jib"))
    }
    but I'm getting this error.
    * What went wrong:
    A problem occurred configuring root project 'lp-server-root'.
    > Could not create task ':jib'.
       > Task with name ':lp-server-deploy:jib' not found in root project 'lp-server-root'.
    named
    should evaluate lazily, but I feel like the
    dependsOn
    might be forcing it to resolve early.
    g
    • 2
    • 2
  • d

    Dominaezzz

    05/27/2019, 12:01 AM
    Anyone use the Provider API even though it's "incubating". Should I treat it like Kotlin's "experimental"?
    g
    • 2
    • 3
  • e

    Eugen Martynov

    05/27/2019, 8:05 AM
    Any chance it will get some priority? https://youtrack.jetbrains.com/issue/KT-31602
    g
    t
    s
    • 4
    • 6
  • b

    Bernhard

    05/27/2019, 1:50 PM
    what’s the recommend way to prompt a user for input?
    ❌ 3
    r
    g
    t
    • 4
    • 9
  • d

    Dominaezzz

    05/27/2019, 3:52 PM
    How to convert from
    Provider<java.io.File>
    to
    Provider<RegularFile>
    ?
    l
    • 2
    • 2
  • s

    snowe

    05/28/2019, 6:59 PM
    anyone know what I can do for this? https://kotlinlang.slack.com/archives/C19FD9681/p1558742267002200
    m
    • 2
    • 3
  • a

    adolgiy

    05/29/2019, 2:40 PM
    Hey, all! 👋 After migrating to Gradle Kotlin DSL I have this alert in AS. App can still be assembled and installed, but alert...
    e
    • 2
    • 7
  • t

    thana

    05/31/2019, 8:06 AM
    Hi! Some tests in sourceset
    jvmTest
    in module A complain that
    kotlin-reflect
    is missing. Module A depends on module B which has its own
    jvmTest
    which declares the
    kotlin-reflect
    dependency in the
    api
    configuration. hnce, shouldn't this dependency be accessible by Module A, too? Is it a bug in the multiplatform plugin or am i using it wrong (or just have a wrong understanding of the
    api
    and
    implementation
    configurations)
    h
    • 2
    • 2
  • a

    Alexander

    05/31/2019, 2:34 PM
    Hi! I try to build a Kotlin-JS project using version 1.3.40-eap-67 according to this example https://youtrack.jetbrains.com/issue/KT-30528 . Test classes seem to not be compiled and the test isn't running. Where can I find an example of how to configure a test runner for this EAP version? Thank you.
    g
    s
    • 3
    • 8
  • d

    dwursteisen

    06/03/2019, 12:20 PM
    (gradle with Kotlin DSL?
    j
    • 2
    • 2
  • j

    jeggy

    06/03/2019, 3:05 PM
    I'm trying to move from groovy to kts, but sometimes for some projects I get unresolved for
    test
    .
    plugins {
        kotlin("jvm") version ("1.3.31")
        ...
    }
    dependencies {
       val junitVersion = "5.4.2"
       ...
       testRuntime("org.junit.jupiter:junit-jupiter-engine:$junitVersion")
    }
    tasks {
        test { // <-- this is unresolved
    
        }
       ...
    }
    What more is required for
    test
    to exist?
    m
    m
    +2
    • 5
    • 54
  • a

    Allan Wang

    06/06/2019, 3:28 AM
    I had a look at the following issue: https://github.com/gradle/kotlin-dsl/issues/1287 Where it seems that only main build scripts have type safe accessors (https://docs.gradle.org/current/userguide/kotlin_dsl.html#type-safe-accessors) In that case, is there a desired approach to multi module projects, where I want to reuse some scripts for each module? Typically I’d have another gradle file they can include, but that won’t work with kotlin dsl
    g
    m
    • 3
    • 54
  • t

    tapchicoma

    06/06/2019, 12:21 PM
    How to disable this annoying message?
    w: ATTENTION!
    This build uses unsafe internal compiler arguments:
    
    -XXLanguage:+InlineClasses
    Start to happen after adding this:
    freeCompilerArgs += [
                        "-XXLanguage:+InlineClasses"
                ]
    ➕ 3
    g
    d
    • 3
    • 4
  • b

    bjonnh

    06/07/2019, 10:14 PM
    how can I move the bin in distZip (I would like the scripts to be at the root instead of bin)
    • 1
    • 1
  • a

    Allan Wang

    06/08/2019, 5:15 AM
    Is there a way to read
    gradle.properties
    in a project root folder from a submodule? It appears that the file must be within the submodule for it to be read
    g
    • 2
    • 7
  • g

    Geert

    06/11/2019, 1:03 PM
    Can someone tell me whats wrong with my sourcesets? Also sourceSets[“main”] returns the same error, but I can see my kotlin files in Android Studio Project in src/main/kotlin
    l
    d
    • 3
    • 7
  • g

    Geert

    06/12/2019, 12:08 PM
    Is there a way Kotlin Gradle DSL notifies about new available packages )(in Android Studio)? I miss this from the normal gradle
    m
    r
    +2
    • 5
    • 7
  • n

    nk

    06/13/2019, 1:24 PM
    How can I turn
    compileKotlin {
        kotlinOptions {
            freeCompilerArgs += "-Xuse-experimental=org.mylibrary.ExperimentalMarker"
        }
    }
    into the kotlin dsl? I'm trying to disable all the coroutine experimental warnings, I found
    tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
        kotlinOptions.freeCompilerArgs += ["-Xuse-experimental=kotlin.Experimental"]
    }
    in kotlin dsl, but it has a bunch of errors in the ide, for example it says "Classifier KotlinCompile does not have a companion object..."
    t
    s
    +2
    • 5
    • 8
  • a

    alieksie

    06/17/2019, 4:33 PM
    Hi channel! A small question: Basically, I am trying to transfer the next task from Gradle DSL:
    task copyDependencies(type: Copy) {
        from(configurations.compile + configurations.testCompile) {
            include '*.dll'
            include '*.dylib'
            include '*.so'
        }
        into 'build/libs'
    }
    It looks like:
    val copyDependencies by tasks.creating(Copy::class) {
        from(configurations.testCompile) {
            include("*.dll")
            include("*.dylib")
            include("*.so")
        }
        into("$buildDir/libs")
    }
    But i am not sure, which scope should I use instead of
    configurations.testCompile
    in order to really copy libraries in the
    $buildDir/libs
    folder. Currently I am not getting anything copied 😕
    g
    • 2
    • 27
  • l

    Luke

    06/20/2019, 3:37 PM
    How do I access variables defined in gradle.properties?
    g
    • 2
    • 2
  • d

    davidasync

    06/21/2019, 3:38 AM
    Hello sorry for noob question, I want to apply
    gradle-dependency-lock-plugin
    at
    gradle 5.4.1
    But got this error (check the thread) Anybody familiar with this error ?
    d
    • 2
    • 6
  • l

    Luke

    06/22/2019, 2:39 PM
    Why can't I access variables from the plugins definition block?
    val foo = "foo"
    
    plugins {
        val bar = foo // 'val foo: String' can't be called in this context by implicit receiver. Use explicit one if necessary.
    }
    If I add
    this@Build_gradle.
    , the error disappears from the code, but I still get an error when I try to build...
    d
    n
    e
    • 4
    • 7
  • n

    nuhkoca

    06/22/2019, 5:11 PM
    Hi all, with
    Groovy
    we had a chance to create
    common.gradle
    script in order to avoid boilerplate and use it within other mutual gradle files. However, I am unable to do have the same behaviour with DSL. Anyone know how to do that?
    l
    g
    e
    • 4
    • 17
  • t

    thana

    06/24/2019, 6:25 AM
    several times per day a gradle build fails because it runs out of memory. i suspect that's because of some memory leak in the kotlin plugin(s). is that a known problem? is there anything i can do?
    d
    v
    • 3
    • 3
  • m

    mp

    06/24/2019, 9:28 PM
    Is there a good way to refer to the
    run
    task? Since
    run
    is an extension function on everything, configuring the task with a closure is non-obvious. Currently I'm using
    named<JavaExec>("run")
    which is workable but ugly
    m
    • 2
    • 2
Powered by Linen
Title
m

mp

06/24/2019, 9:28 PM
Is there a good way to refer to the
run
task? Since
run
is an extension function on everything, configuring the task with a closure is non-obvious. Currently I'm using
named<JavaExec>("run")
which is workable but ugly
m

mkobit

06/24/2019, 10:03 PM
tasks {
   (run) {
   }
}
i believe is one way that works
👍 1
m

mp

06/24/2019, 10:56 PM
Ah, sneaky!
View count: 4