2
0
mirror of https://github.com/rehlds/rehlds.git synced 2024-12-29 08:05:50 +03:00

Merge pull request #222 from s1lentq/master

Allow to build project outside of the git repository.
This commit is contained in:
theAsmodai 2016-07-15 19:38:40 +03:00 committed by GitHub
commit 86cff5477a
2 changed files with 20 additions and 8 deletions

View File

@ -1,5 +1,6 @@
import versioning.GitVersioner
import versioning.RehldsVersionInfo
import org.joda.time.DateTime
apply plugin: 'maven-publish'
apply from: 'shared.gradle'
@ -14,14 +15,8 @@ idea {
}
def gitInfo = GitVersioner.versionForDir(project.rootDir)
if (!gitInfo) {
throw new RuntimeException('Running outside git repository')
}
RehldsVersionInfo versionInfo
if (gitInfo.tag && gitInfo.tag[0] == 'v') {
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}")
@ -38,7 +33,7 @@ if (gitInfo.tag && gitInfo.tag[0] == 'v') {
majorVersion: project.majorVersion as int,
minorVersion: project.minorVersion as int,
suffix: 'SNAPSHOT',
lastCommitDate: gitInfo.lastCommitDate
lastCommitDate: gitInfo ? gitInfo.lastCommitDate : new DateTime()
)
}

View File

@ -331,6 +331,23 @@ task buildRelease {
}
}
task buildFixes {
dependsOn binaries.withType(SharedLibraryBinarySpec).matching {
SharedLibraryBinarySpec blib -> blib.buildable && blib.buildType.name == 'release' && blib.flavor.name == 'rehldsFixes' && blib.component.name == 'rehlds_swds_engine'
}
}
gradle.taskGraph.whenReady { graph ->
if (!graph.hasTask(buildFixes)) {
return;
}
// skip all tasks with the matched substrings in the name like "test"
def tasks = graph.getAllTasks();
tasks.findAll { it.name.toLowerCase().contains("test") }.each { task ->
task.enabled = false;
}
}
task prepareDevEnvTests {
def rehldsTests = new File(project.projectDir, '_dev/testDemos')