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

    Thiago Nerys

    03/03/2020, 3:02 PM
    fun <http://java.io|java.io>.InputStream.extractSummary(): String =
        ((JsonSlurper().parse(this) as Map<String, Any>)["fields"] as Map<String, Any>)["summary"] as String
    I looked around a lot, couldn't find a way to make this code block simpler. Would like to do something similar to Groovy, which allows me to call just
    this.fields.summary
    . Any ideas?
    r
    m
    • 3
    • 3
  • a

    apahl

    03/08/2020, 4:39 PM
    Which one? The one reported by gradle?
    a
    • 2
    • 2
  • o

    Ola Adolfsson

    03/09/2020, 12:21 PM
    Hi, we’re working on a multiplatform project and would like to share common test utilities between test sourceSets residing in different gradle modules. What is the best approach?
    t
    t
    • 3
    • 9
  • e

    Egor Okhterov

    03/10/2020, 9:48 AM
    What version of
    NodeJS
    is used when we include dependency like that?
    dependencies {
        implementation(npm("react", "16.12.0"))
    }
    Does gradle download
    NodeJs
    from the internet or it searches for locally installed
    node.exe
    ?
    t
    • 2
    • 4
  • j

    james_bassett

    03/10/2020, 11:28 PM
    Question about the new
    api
    configuration...I was under the impression that it was only available when you had applied the
    java-library
    plugin. However I'm able to use it in Gradle 6.2 (and I can see the effect it has on the module metadata when published to Nexus). A build scan reveals that the
    java-library
    plugin isn't applied, so how is this possible?
    o
    • 2
    • 5
  • c

    capitalthree

    03/11/2020, 3:31 AM
    has anyone used jOOQ, with the gradle plugin to trigger code gen, in a kotlin multiplatform project? The jOOQ code generator gradle plugin expects a SourceSet instance in its configuration, and I can't figure out how to get one from a KotlinSourceSet (is that possible?)
    o
    • 2
    • 20
  • b

    basher

    03/11/2020, 5:15 PM
    Anyone else run into OOM issues with (happens with Gradle 5 or 6) Gradle 6 + Kotlin 1.3.70?
    t
    m
    +2
    • 5
    • 8
  • n

    Nico

    03/12/2020, 10:20 AM
    Hi. I wrote a gradle plugin in Kotlin which injects a library dependency via this line : https://github.com/emign/engineEmi_GradlePlugin/blob/88ffb269e35ff35a178685121db2744d6a521f5d/src/main/kotlin/me/emig/engineEmi/gradle/EngineEmiGradlePlugin.kt#L44 Since gradle 6.0+ in the consuming project (the one applying the gradle plugin I wrote) the library dependency vanishes from the SourceSets. When I switch back to gradle wrapper 5.6.4 it reappears magically. Can anyone help with that? When I list the dependencies, The libraries seem to be correctly linked (no difference between 5.6.4 and 6.6.2) but they are missing in the SourceSets
    t
    • 2
    • 35
  • s

    Sebastien Leclerc Lavallee

    03/12/2020, 4:33 PM
    I want to migrate a
    build.gradle
    script from groovy to kotlin. Inside one of my build, I have this:
    allprojects {
        ext.runProtoGen = { inPath, outPath, kotlinPackage = null, logLevel = null, inSubPath = null ->
          [...]
        }
    }
    How would I be able to do that with kotlin DSL ? Thanks 🙂
    t
    • 2
    • 5
  • b

    Burkhard

    03/12/2020, 7:32 PM
    I just stumbled over a gradle task I have never seen before:
    inspectClassesForKotlinIC
    . Did I just miss this or does kotlin 1.3.70 use a new system for incremental building (I’m guessing the IC stands for “incremental compile”)?
    o
    t
    • 3
    • 7
  • s

    Slackbot

    03/14/2020, 2:11 PM
    This message was deleted.
    l
    • 2
    • 6
  • s

    Sourabh Rawat

    03/14/2020, 5:56 PM
    I want to pack chrome extension using gradle http://www.adambarth.com/experimental/crx/docs/packaging.html how do I do this?
    c
    • 2
    • 2
  • a

    arekolek

    03/17/2020, 8:44 AM
    in my root
    build.gradle
    I have
    apply from: 'test.gradle.kts'
    , then in
    test.gradle.kts
    I have:
    tasks.register("vytibnhcyfugohsjfdbnafvdsa") {
    
    }
    After I run Sync Project with Gradle files twice, I get this warning in Android Studio (see image), and the log says
    Caused by: org.gradle.api.internal.tasks.DefaultTaskContainer$DuplicateTaskException: Cannot add task 'vytibnhcyfugohsjfdbnafvdsa' as a task with that name already exists.
    Am I doing something wrong, or is this is a bug?
    f
    m
    • 3
    • 7
  • c

    Chills

    03/17/2020, 3:17 PM
    its for a dope reason and i cant help it.
    t
    • 2
    • 2
  • c

    Chills

    03/17/2020, 3:42 PM
    well the reason is i dont have write access and i dont have the password for it, should try some default password for it , aka sudo and the id doesnt belong to sudo group either.
    c
    • 2
    • 7
  • j

    Jaxon Du

    03/17/2020, 5:50 PM
    Not sure if I missed out something, does the JVM target “application” plugin able to create fat jar for deployment? Can not locate one, have to use another plugin like shadow. I’m new to JVM world, isn’t fat jar the preferable way of distributing JVM app? Why not support fat jar directly in “application” plugin?
    s
    a
    c
    • 4
    • 6
  • c

    Chills

    03/17/2020, 6:50 PM
    anyone used github actions, how to sudo? have the yaml file which get ubuntu-latest
    d
    • 2
    • 5
  • r

    rrva

    03/17/2020, 7:44 PM
    is there any tool to convert build.gradle to build.gradle.kts (does not have to be complete or automatic, just a start making some obvious conversions)
    o
    s
    • 3
    • 3
  • r

    rrva

    03/17/2020, 8:20 PM
    val fooVersion = “1.0.0” in the top scope does not do it
    c
    • 2
    • 1
  • x

    x80486

    03/18/2020, 5:02 PM
    Hello folks...if/when you have some time, take a look at this one: https://stackoverflow.com/questions/60743468/gstring-lazy-evaluation-in-kotlin-dsl-using-gradle-git-properties-plugin ...chime in if you have any solution for it, and thanks in advance! 👌😊😎
    a
    • 2
    • 3
  • g

    Gunslingor

    03/19/2020, 5:23 AM
    Anyone know how to set the classpath in this gradle file I'm confused, trying to run backendMain
    • 1
    • 1
  • r

    rrva

    03/19/2020, 5:29 AM
    how do I migrate the following to kotlin DSL?
    configurations {
        karateTestCompile.extendsFrom testCompile
        karateTestRuntime.extendsFrom testRuntime
        pactTestCompile.extendsFrom testCompile
        pactTestRuntime.extendsFrom testRuntime
    }
    o
    • 2
    • 2
  • g

    Gunslingor

    03/22/2020, 3:32 PM
    Can webpack in gradle kts do treeshaking on libraries that I didn't write and if so how do you configure it?
    t
    • 2
    • 1
  • c

    codec

    03/22/2020, 7:53 PM
    How come the Gradle task
    JavaExec
    doesn’t honor carriage returns
    ("\r")
    in Java print statements?
    g
    • 2
    • 13
  • d

    darkmoon_uk

    03/23/2020, 7:41 AM
    Hi @Andrey Uskov [JB], apologies for direct address, but as the assignee for https://youtrack.jetbrains.com/issue/KT-30413, even a few words on the status of this defect may help guide some strategic direction for us. It concerns the interaction between the IDE and K/MP + Gradle Composite builds: Presently when using K/MP + Gradle Composite builds: - Gradle build is working fine 👍 -But the IDE (IntelliJ or AS) cannot resolve symbols across Composed MP project dependencies 👎 ...which is a big problem for my team's acceptance of this otherwise desired approach. Is a fix likely any version soon, or a great complexity? Thanks 🙏
    s
    a
    a
    • 4
    • 11
  • s

    spierce7

    03/24/2020, 2:10 AM
    I’m trying to create a function that configures an Android module using Kotlin-script-gradle. I previously did this with a groovy function inside the
    build.gradle
    , but now I’m trying to move this to
    buildSrc
    . I’m struggling to find the equivalent way to do this inside
    buildSrc
    , can anyone help me out?
    ext.installInternalProductionFlavors = { project ->
        project.android.flavorDimensions 'releaseType'
    
        project.android.productFlavors {
            internal {
                dimension 'releaseType'
                matchingFallbacks = ['debug']
            }
    
            production {
                dimension 'releaseType'
                matchingFallbacks = ['release']
            }
        }
    
        installInternalProductionVariantFilter(project)
    }
    m
    s
    • 3
    • 3
  • s

    spierce7

    03/24/2020, 2:24 AM
    If I’m using an if block to sometimes apply a plugin, how do I resolve the plugin dsl so I can build, even when the plugin isn’t applied? i.e.
    plugins {
      if (Build.isCi) {
        id("com.google.firebase.appdistribution") //TODO not working
      }
    }
    productFlavors {
        flavorDimensions("releaseType")
        create("internal") {
          // ...
    
          if (isCi) {
            firebaseAppDistribution { // <--- This doesn't resolve because the plugin is in an if block.
            }
          }
        }
    l
    • 2
    • 14
  • p

    plastiv

    03/24/2020, 10:44 AM
    What is the up-to-date way to control kotlin daemon jvm args? Setting
    systemProp.kotlin.daemon.jvm.options=-Xmx4g
    at
    gradle.properties
    stops kotlin daemon from running with
    Xmx illegal argument
    error.
    s
    • 2
    • 2
  • s

    spierce7

    03/24/2020, 4:39 PM
    I want to share a String between
    buildSrc/build.gradle.kts
    and the code inside
    buildSrc/src
    . What’s the best way to do that?
    a
    l
    • 3
    • 7
  • g

    Gunslingor

    03/24/2020, 5:48 PM
    what is the difference between node and nodejs in the intelliJ gradle plugin?
    👀 1
    i
    • 2
    • 6
Powered by Linen
Title
g

Gunslingor

03/24/2020, 5:48 PM
what is the difference between node and nodejs in the intelliJ gradle plugin?
👀 1
i

Ivan Kubyshkin [JetBrains]

03/25/2020, 9:04 AM
Do you use
id 'org.jetbrains.kotlin.js' version '1.3.71'
?
In that case there is only
nodejs
as a target
kotlin {
    target {
        nodejs()
    }
}
g

Gunslingor

03/26/2020, 5:23 AM
yeah I do, finally figured that part out, I was using both this and mooworks plugin so I had both. It really isn't clear what plugins are compatable, many of em seem to end in compiled code on drill downs... maybe I can configure intelliJ to drill down into the source code or something?
i

Ivan Kubyshkin [JetBrains]

03/26/2020, 5:35 AM
Do you mean source code of gradle?
g

Gunslingor

03/26/2020, 1:08 PM
Nope, of the plugins themselves. Here are some of the "dead ends" I'm talking about during drill down. Maybe I am missing something about the abstract nature of the first one but it looks like a circular functional dependancy of overloads or something; the second screenshot ends it a compiled code comment that I don't really get fully but suspect I know what is going on there... these are likely class headers just so java knows what to call in the compiled libraries? That's what I mean, I think I recall there is functionality somewhere in intellij where you can use the compiled distros for your app, but you could also import the source material and it would know to drill into that instead of the dead end of compiled code. I though I recall it being a control, something called "mark directory as library root" or something. Really just trying to fill in any gaps in my knowledge... whenever I have to engineer indirectly, often with trial and error, I get very nervous and wonder what I'm missing.
View count: 9