cbeust / kobalt

A Kotlin-based build system for the JVM.
Apache License 2.0
433 stars 60 forks source link

Kobalt doesn't consider Build.kt change for plugins #331

Open dmitry-zhuravlev opened 7 years ago

dmitry-zhuravlev commented 7 years ago

I found the following wrong behavior:

1) Run Kobalt server com.beust.kobalt.MainKt with params --log 3 --force --dev --server 2) In Build.kt specify: val build = buildScript{ repos("bintray.com/kotlin/kotlin-eap-1.1") plugins("com.beust:kobalt-line-count:0.18") } 2) Run sync from plugin. Kobalt will create temporary tmp/kobaltXXXXX/Build.kt with the following content: import com.beust.kobalt.* import com.beust.kobalt.api.* val build = buildScript{ repos("bintray.com/kotlin/kotlin-eap-1.1") plugins("com.beust:kobalt-line-count:0.18") } 3) Change version of line-count plugin to 0.23 and invoke sync again 4) In the temporary Build.kt file is still 0.18 version mentioned and Kobalt will try to resolve the wrong one (0.18)

@cbeust Do you able to reproduce?

dmitry-zhuravlev commented 7 years ago

Another problem that comments doesn't properly handled in Build.kt: Try specify this:

/*val build = buildScript{
    repos("dl.bintray.com/cbeust/maven")
    plugins("com.beust:kobalt-line-count:0.5")
}*/

val bs = buildScript {
    repos("bintray.com/kotlin/kotlin-eap-1.1")
    plugins("com.beust.kobalt:kobalt-line-count:0.18")
}

In 'tmp/kobaltXXXXXX/Build.kt' will be something like:

import com.beust.kobalt.*
import com.beust.kobalt.api.*
}

val bs = buildScript {
    repos("bintray.com/kotlin/kotlin-eap-1.1")
    plugins("com.beust.kobalt:kobalt-line-count:0.18")
}

and this will fail with:

\Build.kt:3:1 Expecting a top level declaration
com.beust.kobalt.KobaltException: Couldn't compile file: }
cbeust commented 7 years ago

I'm not surprised by the comment thing, the way I extract the buildScript section is pretty primitive and manual. I'll file a separate issue for it, though.

I'll try to reproduce your first point shortly.

cbeust commented 7 years ago

I'm not able to reproduce the version bug. On the second sync, the server is showing:

Downloading: https://dl.bintray.com/kotlin/kotlin-eap-1.1/com/beust/kobalt-line-count/0.23/kobalt-line-count-0.23.pom
org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact com.beust:kobalt-line-count:pom:0.23