mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-04 00:45:57 +00:00
make version a function, not class
This commit is contained in:
parent
05911027bd
commit
0940611b89
@ -2,9 +2,9 @@ import com.dfsek.terra.configureCompilation
|
|||||||
import com.dfsek.terra.configureDependencies
|
import com.dfsek.terra.configureDependencies
|
||||||
import com.dfsek.terra.configureDistribution
|
import com.dfsek.terra.configureDistribution
|
||||||
import com.dfsek.terra.configurePublishing
|
import com.dfsek.terra.configurePublishing
|
||||||
import com.dfsek.terra.getGitHash
|
import com.dfsek.terra.version
|
||||||
|
|
||||||
val versionObj = Version("6", "0", "0", true)
|
val versionObj = version("6", "0", "0", true)
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
version = versionObj
|
version = versionObj
|
||||||
@ -45,17 +45,3 @@ afterEvaluate {
|
|||||||
it.configureDistribution()
|
it.configureDistribution()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Version class that does version stuff.
|
|
||||||
*/
|
|
||||||
@Suppress("MemberVisibilityCanBePrivate")
|
|
||||||
class Version(val major: String, val minor: String, val revision: String, val preRelease: Boolean = false) {
|
|
||||||
|
|
||||||
override fun toString(): String {
|
|
||||||
return if (!preRelease)
|
|
||||||
"$major.$minor.$revision"
|
|
||||||
else //Only use git hash if it's a prerelease.
|
|
||||||
"$major.$minor.$revision-BETA+${getGitHash()}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -19,3 +19,11 @@ fun Project.gitClone(name: String) {
|
|||||||
standardOutput = stdout
|
standardOutput = stdout
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun Project.version(major: String, minor: String, revision: String, preRelease: Boolean = false): String {
|
||||||
|
return if (!preRelease)
|
||||||
|
"$major.$minor.$revision"
|
||||||
|
else //Only use git hash if it's a prerelease.
|
||||||
|
"$major.$minor.$revision-BETA+${getGitHash()}"
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user