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
gradle
  • r

    rocketraman

    05/23/2017, 10:44 PM
    I'm thing I'd like to understand conceptually is how the classpath works. With groovy syntax when I add a plugin like
    com.google.protobuf
    I now have available
    protobuf
    as a keyword. Is there an equivalent process that happens with adding plugins to a Kotlin build script? And how does Kotlin script handle classpath / imports when only one project within a larger build adds a plugin, especially given that Kotlin script seems to require imports at the top level?
    s
    • 2
    • 3
  • j

    jre

    05/24/2017, 4:42 AM
    Hi all! I'm trying to figure how to share functions in multi-project builds. With groovy based gradle scripts, this is as simple as that: Parent build.gradle:
    void hello() {
            println "Hello World!"
    }
    Child build.gradle:
    // Will print Hello World when gradle is invoked
    hello()
    This no longer works for kotlin based build scripts, the method reference is just considered as undefined. Any idea how can I best fill this gap? Should I raise an issue for such use case?
    b
    • 2
    • 1
  • a

    appdev

    05/24/2017, 12:27 PM
    The Google App Engine Gradle Plugin creates an extension, AppEngineExtension, which then registers a "tools" extension. In groovy script this can be used like this: appengine { tools { cloudSdkHome = "blah" } } But in Kotlin script I cannot see how to do the same. Does anyone know how this can be configured?
    s
    • 2
    • 2
  • a

    alband

    05/25/2017, 8:21 AM
    i start a thread
    g
    w
    • 3
    • 22
  • r

    rocketraman

    05/25/2017, 8:33 PM
    Right, but since those expressions are modifying the root project's buildscript, one can't replicate a groovy-based multi-project build in which subprojects have their own buildscript
    b
    • 2
    • 3
  • d

    douglarek

    05/27/2017, 5:51 AM
    Does anyone know how I configure
    dependencyManagement
    with gradle-kotlin-script ?
  • d

    deckard_shaw

    05/28/2017, 1:46 AM
    Hello everyone! Is there any way I can merge these two ways of declaring/including plug-ins in Gradle?
    plugins {
      application
      id("org.jetbrains.kotlin.jvm") version "1.1.2-2"
      //id("org.jetbrains.kotlin.plugin.spring") version "1.1.2-2"
    }
    
    apply {
      plugin("io.spring.dependency-management")
      plugin("kotlin")
      //plugin("kotlin-jpa")
      //plugin("kotlin-spring")
      plugin("org.springframework.boot")
    }
    s
    j
    • 3
    • 6
  • s

    spierce7

    05/28/2017, 4:16 PM
    I'm also interested how I'd do something like add a dynamic configuration / source set with `kotlin-script-gradle`:
    configurations {
        provided
    }
     
    sourceSets {
        main {
            compileClasspath += configurations.provided
            runtimeClasspath += configurations.provided
        }
        test {
            compileClasspath += configurations.provided
            runtimeClasspath += configurations.provided
        }
        customSourceSet
    }
     
    dependencies {
        provided project(':Core')
    }
    I'm assuming I'd need to think of it differently with
    gradle-kotlin-script
    ? Maybe I'd be using something extension functions to add similar behavior? I'm also not sure how I'd do something like
    customSourceSetCompile
    in
    kotlin-script-gradle
    , and am curious what the solution is.
    s
    • 2
    • 4
  • a

    andyb

    05/28/2017, 7:12 PM
    @pawel.barszcz I am just using the default Gradle wrapper in IntelliJ
    p
    • 2
    • 6
  • b

    barteks2x

    05/29/2017, 3:37 PM
    also, in 0.8 is there some other way to use the gradle ext than this?
    val ext = (this as HasConvention).convention.extraProperties
    s
    p
    • 3
    • 3
  • j

    jlleitschuh

    05/30/2017, 3:17 PM
    @bamboo Does v4 of gradle not include
    org/gradle/script/lang/kotlin/KotlinDependencyHandler
    by default??
    b
    • 2
    • 1
  • b

    bamboo

    06/01/2017, 3:52 PM
    I mean, it is no longer necessary for just enabling Kotlin build script support
    d
    • 2
    • 2
  • n

    nekoinemo

    06/02/2017, 7:51 AM
    @bamboo Hi. Still can't seem to get publishing to work properly when following the manual. Manual's
    publishing {
        publications {
            mavenJava(MavenPublication) {
                from(components.java)
            }
        }
    }
    results in "specif constructor, MavenPublication doesn't have companion object" and "mavenJava()" being unresolved reference It does compile if i replace it with
    publishing {
        publications {
            create<MavenPublication>("mavenJava"){
                from(components["java"])
            }
        }
    }
    though. I don't get why it works on way and not the other?
    b
    • 2
    • 2
  • k

    kasper.kondzielski

    06/07/2017, 10:51 AM
    @Czar I had problems with
    java
    being not recognised, finally I manage to do this in following way:
    configure<JavaPluginConvention> {
        sourceSets[SourceSet.MAIN_SOURCE_SET_NAME].java {
            srcDir("src/main/kotlin")
        }
    }
    c
    s
    • 3
    • 4
  • j

    jlleitschuh

    06/07/2017, 5:50 PM
    Will anyone at Gradle be at Kotlin Conf as a speaker to talk about GSK?
    b
    • 2
    • 1
  • h

    hughg

    06/11/2017, 8:18 AM
    I'm trying to translate an existing Gradle plugin to Kotlin (well, several related plugins, actually). They include methods which take Groovy Closure objects. How can I call such a method from elsewhere in Kotlin? Do I need to overload such methods with versions which use Gradle's Action<T> interface, and pass Kotlin lambdas to that? I'm not sure that can work, given that some of the Closures expect multiple arguments. Or is there some way to wrap a Kotlin lambda / anonymous fun as a Closure?
    s
    j
    • 3
    • 3
  • w

    wasyl

    06/11/2017, 10:27 AM
    @hughg Generally you want Action<T> afaik. But which closures expect more than 1 parameter? Are they closures executed by your plugin, or by Gradle?
    h
    • 2
    • 3
  • j

    jakiej

    06/12/2017, 9:19 PM
    i am using 3.5 and when I open the project built by gradle idea, everything in build.gradle.kts is red for me. I had to use direct import in idea to make it happy
    n
    • 2
    • 1
  • j

    jakiej

    06/12/2017, 9:33 PM
    my goal was to use kts with proper IDE support.
    n
    • 2
    • 1
  • a

    aalmiray

    06/13/2017, 12:55 PM
    hello everyone! how would a custom configuration be added to
    build.gradle.kts
    ? For reference this is what it can done for the Groovy version configurations { integrationTestCompile { extendsFrom testCompile } integrationTestRuntime { extendsFrom integrationTestCompile, testRuntime } functionalTestCompile { extendsFrom compile } functionalTestRuntime { extendsFrom runtime } } dependencies { functionalTestCompile “org.jetbrains.kotlin:kotlin-test-junit:$kotlinVersion” functionalTestCompile “org.codehaus.griffon:griffon-core-test:$griffonVersion” functionalTestCompile “org.codehaus.griffon:griffon-javafx-test:$griffonVersion” } sourceSets { integrationTest { kotlin.srcDirs file(‘src/integration-test/kotlin’) compileClasspath += sourceSets.main.output runtimeClasspath += compileClasspath } functionalTest { kotlin.srcDirs file(‘src/functional-test/kotlin’) compileClasspath += sourceSets.main.output runtimeClasspath += compileClasspath } } idea { module { scopes.TEST.plus += [configurations.integrationTestCompile] scopes.TEST.plus += [configurations.integrationTestRuntime] testSourceDirs += sourceSets.integrationTest.allSource.srcDirs scopes.TEST.plus += [configurations.functionalTestCompile] scopes.TEST.plus += [configurations.functionalTestRuntime] testSourceDirs += sourceSets.functionalTest.allSource.srcDirs } }
    b
    h
    • 3
    • 7
  • s

    sdeleuze

    06/13/2017, 4:41 PM
    We see a lot of warnings like that in our Spring Gradle build :
    n
    • 2
    • 2
  • p

    poohbar

    06/14/2017, 3:55 PM
    getting this
    Unsupported major.minor version 52.0
    a
    t
    i
    • 4
    • 9
  • s

    scott

    06/14/2017, 5:22 PM
    anyone using the kotlin for their gradle scripts? anyone recommend jumping in or holding off?
    s
    n
    +2
    • 5
    • 9
  • b

    bamboo

    06/14/2017, 6:30 PM
    @sdeleuze please do raise a bug on the Kotlin YT, I have seen in the past but it would usually go away after the file type checked
    s
    • 2
    • 1
  • n

    napperley

    06/15/2017, 12:49 AM
    Wondering what happened to the GSK PR I submitted. Last time I looked it appeared I had broken the build despite adding some documentation 💀.
    b
    j
    • 3
    • 4
  • j

    jlleitschuh

    06/16/2017, 1:47 PM
    The spring boot plugin hijacks dependency resolution in the most annoying way making it incredibly painful to try to force your own version of any dependency; in my experience.
    s
    • 2
    • 4
  • m

    myanmarking

    06/19/2017, 5:11 PM
    any way to apply plugin: ‘kotlin-android’ in all modules?
    m
    w
    • 3
    • 2
  • j

    jlleitschuh

    06/20/2017, 2:49 PM
    I'm going to have a hard time getting over changing what I've been calling this project. I've been using GSK for 4 months now. Can we use GKD now?
    c
    m
    • 3
    • 2
  • p

    pddstudio

    06/21/2017, 10:30 AM
    Hello, is there anyone who got everything set up already (including IDEA support) to build a project with Gradle Script Kotlin? I got a few questions regarding the IDEA support, that's why I'm asking. My problem is actually that IDEA doesn't recognise that the project I'm working on (no matter which one) is a Gradle Script Kotlin based one. It doesn't offer me all of the new features they mentioned in the blog post, but instead "offers" me to add Kotlin support to my project, which actually fails if I press Okay because it can't find build.gradle (which isn't present when using GSK). There is nothing wrong with the code, I can build everything from the command line without any problems, but I can't get the syntax highlighting and stuff to work. I tried it with both IDEA CE/UE and various versions of the Kotlin Plugin.
    c
    z
    • 3
    • 26
  • t

    trevjones

    06/23/2017, 6:48 PM
    I have had the issue in android library projects and had to add a dependency from the compile test task onto the main compile task
    d
    • 2
    • 2
Powered by Linen
Title
t

trevjones

06/23/2017, 6:48 PM
I have had the issue in android library projects and had to add a dependency from the compile test task onto the main compile task
d

dagguh

06/23/2017, 6:52 PM
trevjones: I just tested it:
tasks["compileTestKotlin"].dependsOn(tasks["compileKotlin"])
Unforunately, it didn't help
And I do see they are run in the expected order, still, I'm getting
Unresolved reference
errors
View count: 1