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:
commit
86cff5477a
11
build.gradle
11
build.gradle
@ -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()
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -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')
|
||||
|
Loading…
Reference in New Issue
Block a user