forked from gaborbata/jpass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
59 lines (51 loc) · 1.51 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
apply plugin: 'java'
apply plugin: 'distribution'
compileJava.options.encoding = 'UTF-8'
sourceCompatibility = 1.6
targetCompatibility = 1.6
repositories {
mavenCentral()
}
dependencies {
compile group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-xml', version: '2.9.3'
testCompile 'junit:junit:4.11'
}
jar {
baseName = 'jpass'
version = '0.1.18-SNAPSHOT'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
attributes('Main-Class': 'jpass.JPass')
}
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}
task copyConfig(type: Copy) {
from 'src/main/config'
into 'build/libs'
}
distributions {
main {
baseName = "$jar.baseName-$jar.version-dist"
contents {
from jar
from { 'src/main/config' }
into '/'
}
}
}
task bumpVersion {
doLast {
if (!project.hasProperty('toVersion')) {
throw new GradleException("Please provide 'toVersion' property e.g. gradle bumpVersion -PtoVersion=<version>")
}
def extensions = ['java', 'gradle', 'sbt', 'xml', 'md', 'bat', 'sh', 'txt'].collect { "**/*.$it" }.join(",")
def files = new groovy.util.FileNameFinder().getFileNames("$projectDir", extensions)
files.each { versionedFile ->
def file = new File(versionedFile)
file.write(file.getText('UTF-8').replaceAll("$jar.version", "$toVersion"), 'UTF-8')
}
}
}
build.dependsOn copyConfig