summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.gradle23
1 files changed, 22 insertions, 1 deletions
diff --git a/build.gradle b/build.gradle
index e88a3466..28451c7e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -12,6 +12,8 @@ buildscript {
12 } 12 }
13} 13}
14 14
15import org.apache.tools.ant.filters.ReplaceTokens
16
15apply plugin: 'java' 17apply plugin: 'java'
16apply plugin: 'eclipse' 18apply plugin: 'eclipse'
17apply plugin: 'idea' 19apply plugin: 'idea'
@@ -21,6 +23,8 @@ apply plugin: 'maven'
21group = 'cuchaz' 23group = 'cuchaz'
22version = '0.12.2' 24version = '0.12.2'
23 25
26def filteredSourceDir = file("${buildDir}/filtered")
27
24def ENV = System.getenv() 28def ENV = System.getenv()
25if (ENV.BUILD_NUMBER) { 29if (ENV.BUILD_NUMBER) {
26 version = version + "." + "${System.getenv().BUILD_NUMBER}" 30 version = version + "." + "${System.getenv().BUILD_NUMBER}"
@@ -39,8 +43,24 @@ sourceSets {
39 java { srcDir 'src/test/java' } 43 java { srcDir 'src/test/java' }
40 resources { srcDir 'test' } 44 resources { srcDir 'test' }
41 } 45 }
46 filtered {
47 java { srcDir filteredSourceDir }
48 }
42} 49}
43 50
51compileJava.source = sourceSets.filtered.java
52
53task processVersion(type: Copy) {
54 from sourceSets.main.java
55 into filteredSourceDir
56
57 filter { String line ->
58 ("$line".replaceAll('@VERSION@', version))
59 }
60}
61
62compileJava.dependsOn processVersion
63
44repositories { 64repositories {
45 mavenLocal() 65 mavenLocal()
46 mavenCentral() 66 mavenCentral()
@@ -169,7 +189,8 @@ task('libJar', type: Jar, dependsOn: classes) {
169 189
170task sourcesJar(type: Jar, dependsOn: classes) { 190task sourcesJar(type: Jar, dependsOn: classes) {
171 classifier = 'sources' 191 classifier = 'sources'
172 from sourceSets.main.allSource 192 from sourceSets.main.resources
193 from sourceSets.filtered.java
173} 194}
174 195
175artifacts { 196artifacts {