diff --git a/build.gradle b/build.gradle index d08279c..dfa6e1e 100644 --- a/build.gradle +++ b/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() ) } diff --git a/rehlds/build.gradle b/rehlds/build.gradle index 63fed9a..88dec9c 100644 --- a/rehlds/build.gradle +++ b/rehlds/build.gradle @@ -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')