mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2024-10-17 07:46:52 +03:00
59 lines
1.5 KiB
Groovy
59 lines
1.5 KiB
Groovy
import versioning.GitVersioner
|
|
import versioning.RegamedllVersionInfo
|
|
|
|
apply plugin: 'maven-publish'
|
|
apply from: 'shared.gradle'
|
|
group = 'regamedll'
|
|
|
|
apply plugin: 'idea'
|
|
|
|
idea {
|
|
project {
|
|
languageLevel = 'JDK_1_7'
|
|
}
|
|
}
|
|
|
|
def gitInfo = GitVersioner.versionForDir(project.rootDir)
|
|
if (!gitInfo) {
|
|
throw new RuntimeException('Running outside git repository')
|
|
}
|
|
|
|
RegamedllVersionInfo versionInfo
|
|
if (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 RegamedllVersionInfo(
|
|
majorVersion: m.group(1) as int,
|
|
minorVersion: m.group(2) as int,
|
|
maintenanceVersion: m.group(4) ? (m.group(4) as int) : null,
|
|
countCommit: gitInfo.countCommit,
|
|
lastCommitDate: gitInfo.lastCommitDate,
|
|
commitID: gitInfo.commitID,
|
|
authorCommit: gitInfo.authorCommit,
|
|
urlCommits: gitInfo.urlCommits
|
|
)
|
|
} else {
|
|
versionInfo = new RegamedllVersionInfo(
|
|
majorVersion: project.majorVersion as int,
|
|
minorVersion: project.minorVersion as int,
|
|
suffix: 'SNAPSHOT',
|
|
countCommit: gitInfo.countCommit,
|
|
lastCommitDate: gitInfo.lastCommitDate,
|
|
commitID: gitInfo.commitID,
|
|
authorCommit: gitInfo.authorCommit,
|
|
urlCommits: gitInfo.urlCommits
|
|
)
|
|
}
|
|
|
|
project.ext.regamedllVersionInfo = versionInfo
|
|
project.version = versionInfo.asMavenVersion()
|
|
|
|
apply from: 'publish.gradle'
|
|
|
|
task wrapper(type: Wrapper) {
|
|
gradleVersion = '2.4'
|
|
}
|