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

Allow to build project outside of the git repository.

Added new task buildFixes for fast and simply building project.
Example: "gradlew --max-workers=1 clean buildFixes"
This commit is contained in:
s1lentq 2016-07-14 23:45:41 +07:00
parent 50e19c8b46
commit 5daef47bd1
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')