2015-12-14 19:06:38 +03:00
|
|
|
import versioning.GitVersioner
|
|
|
|
import versioning.RevoiceVersionInfo
|
2017-07-07 16:01:43 +03:00
|
|
|
import org.joda.time.DateTime
|
2015-12-14 19:06:38 +03:00
|
|
|
|
2017-07-07 16:01:43 +03:00
|
|
|
apply plugin: 'maven-publish'
|
2015-12-14 19:06:38 +03:00
|
|
|
apply from: 'shared.gradle'
|
|
|
|
group = 'revoice'
|
|
|
|
|
|
|
|
apply plugin: 'idea'
|
|
|
|
|
|
|
|
idea {
|
|
|
|
project {
|
|
|
|
languageLevel = 'JDK_1_7'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def gitInfo = GitVersioner.versionForDir(project.rootDir)
|
|
|
|
RevoiceVersionInfo versionInfo
|
2017-07-07 16:01:43 +03:00
|
|
|
if (gitInfo && gitInfo.tag && gitInfo.tag[0] == 'v') {
|
2015-12-14 19:06:38 +03:00
|
|
|
def m = gitInfo.tag =~ /^v(\d+)\.(\d+)(\.(\d+))?$/
|
|
|
|
if (!m.find()) {
|
|
|
|
throw new RuntimeException("Invalid git version tag name ${gitInfo.tag}")
|
|
|
|
}
|
|
|
|
|
|
|
|
versionInfo = new RevoiceVersionInfo(
|
|
|
|
majorVersion: m.group(1) as int,
|
|
|
|
minorVersion: m.group(2) as int,
|
|
|
|
maintenanceVersion: m.group(4) ? (m.group(4) as int) : null,
|
2017-07-07 16:01:43 +03:00
|
|
|
localChanges: gitInfo.localChanges,
|
|
|
|
commitDate: gitInfo.commitDate,
|
|
|
|
commitSHA: gitInfo.commitSHA,
|
|
|
|
commitURL: gitInfo.commitURL
|
2015-12-14 19:06:38 +03:00
|
|
|
)
|
|
|
|
} else {
|
|
|
|
versionInfo = new RevoiceVersionInfo(
|
|
|
|
majorVersion: project.majorVersion as int,
|
|
|
|
minorVersion: project.minorVersion as int,
|
2017-07-07 16:01:43 +03:00
|
|
|
maintenanceVersion: project.maintenanceVersion as int,
|
|
|
|
suffix: '',
|
|
|
|
localChanges: gitInfo ? gitInfo.localChanges : true,
|
|
|
|
commitDate: gitInfo ? gitInfo.commitDate : new DateTime(),
|
|
|
|
commitSHA: gitInfo ? gitInfo.commitSHA : "",
|
|
|
|
commitURL: gitInfo ? gitInfo.commitURL : "",
|
|
|
|
commitCount: gitInfo ? (gitInfo.commitCount as int) : null
|
2015-12-14 19:06:38 +03:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
project.ext.revoiceVersionInfo = versionInfo
|
2017-07-07 16:01:43 +03:00
|
|
|
project.version = versionInfo.asMavenVersion()
|
2015-12-14 19:06:38 +03:00
|
|
|
|
2015-12-14 23:02:31 +03:00
|
|
|
apply from: 'publish.gradle'
|
|
|
|
|
2015-12-14 19:06:38 +03:00
|
|
|
task wrapper(type: Wrapper) {
|
|
|
|
gradleVersion = '2.4'
|
|
|
|
}
|