mirror of
https://github.com/rehlds/reapi.git
synced 2024-12-28 15:45:31 +03:00
56 lines
1.4 KiB
Groovy
56 lines
1.4 KiB
Groovy
import versioning.GitVersioner
|
|
import versioning.ReapiVersionInfo
|
|
import org.joda.time.DateTime
|
|
|
|
apply from: 'shared.gradle'
|
|
group = 'reapi'
|
|
|
|
apply plugin: 'idea'
|
|
|
|
idea {
|
|
project {
|
|
languageLevel = 'JDK_1_7'
|
|
}
|
|
}
|
|
|
|
def gitInfo = GitVersioner.versionForDir(project.rootDir)
|
|
ReapiVersionInfo versionInfo
|
|
if (gitInfo && gitInfo.tag && gitInfo.tag[0] == 'v') {
|
|
def m = gitInfo.tag =~ /^v(\d+)\.(\d+)(\.(\d+))?$/
|
|
if (!m.find()) {
|
|
throw new RuntimeException("Invalid git version tag name ${gitInfo.tag}")
|
|
}
|
|
|
|
versionInfo = new ReapiVersionInfo(
|
|
majorVersion: m.group(1) as int,
|
|
minorVersion: m.group(2) as int,
|
|
maintenanceVersion: m.group(4) ? (m.group(4) as int) : null,
|
|
localChanges: gitInfo.localChanges,
|
|
commitDate: gitInfo.commitDate,
|
|
commitSHA: gitInfo.commitSHA,
|
|
commitURL: gitInfo.commitURL
|
|
)
|
|
} else {
|
|
|
|
versionInfo = new ReapiVersionInfo(
|
|
majorVersion: project.majorVersion as int,
|
|
minorVersion: project.minorVersion as int,
|
|
maintenanceVersion: project.maintenanceVersion as int,
|
|
suffix: 'dev',
|
|
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
|
|
)
|
|
}
|
|
|
|
project.ext.reapiVersionInfo = versionInfo
|
|
project.version = versionInfo.asMavenVersion()
|
|
|
|
apply from: 'publish.gradle'
|
|
|
|
task wrapper(type: Wrapper) {
|
|
gradleVersion = '2.4'
|
|
}
|