ethauvin
07/07/2016, 3:11 AMcedric
07/07/2016, 3:12 AMcedric
07/07/2016, 3:12 AMapplication {
mainClass = mainClassName
}
}
ethauvin
07/07/2016, 3:12 AMethauvin
07/07/2016, 3:12 AMcedric
07/07/2016, 3:12 AMexample
cedric
07/07/2016, 3:13 AMethauvin
07/07/2016, 3:14 AMcedric
07/07/2016, 3:14 AM*****
***** ERROR Couldn't compile build file: kobalt\src\Build.kt:103:31: error: unresolved reference: getVersion
project.version = project.getVersion(true)
Is that what you're getting? (because it's normal)ethauvin
07/07/2016, 3:15 AMcedric
07/07/2016, 3:17 AM───── example:clean
───── example:release
VERSION BEFORE: 3.1.45+beta
RETURNING VERSION 3.1.46+beta
VERSION : 3.1.46+beta
BUILD SUCCESSFUL (0 seconds)
cedric
07/07/2016, 3:17 AMethauvin
07/07/2016, 3:18 AMcedric
07/07/2016, 3:18 AMcedric
07/07/2016, 3:18 AMval p = project {
fun f() { ... }
You're not adding a function to the Project
class, hence the compilation error when you try to access it in your release task.cedric
07/07/2016, 3:19 AMProject
. Are you familiar with that?ethauvin
07/07/2016, 3:19 AMcedric
07/07/2016, 3:20 AMfun Project.versionFor(isIncrement: Boolean = false): String {
val propsFile = "version.properties"
val majorKey = "version.major"
Now this adds a function versionFor()
on the Project
class.ethauvin
07/07/2016, 3:20 AMcedric
07/07/2016, 3:20 AMversionFor()
on instances of Project
and everything works:
@Task(name = "release", dependsOn = arrayOf("clean"), description = "Releases new version.")
fun taskRelease(project: Project): TaskResult {
project.version = project.versionFor(true)
cedric
07/07/2016, 3:21 AMgetVersion
to versionFor
because of an implementation detail in Kobalt you shouldn't worry about right now.ethauvin
07/07/2016, 3:21 AMcedric
07/07/2016, 3:21 AMcedric
07/07/2016, 3:21 AMcedric
07/07/2016, 3:22 AMethauvin
07/07/2016, 3:22 AMcedric
07/07/2016, 3:22 AMx
until you hit the release
task and now it's x+1
, which is... well, whackyethauvin
07/07/2016, 3:23 AMcedric
07/07/2016, 3:23 AMversion.properties
, which is then used throughout the build?cedric
07/07/2016, 3:24 AM