-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
123 lines (104 loc) · 3.23 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
// Archiverify is an archive synching and verification tool
// Copyright (C) 2014 Daniel Corder (contact: [email protected])
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
apply plugin: 'groovy'
apply plugin: 'application'
apply plugin: 'gradle-one-jar'
mainClassName = 'com.dancorder.Archiverify.Archiverify'
version = getVersionTag()
archivesBaseName = 'Archiverify-no-dependencies'
task wrapper(type: Wrapper) {
gradleVersion = '2.1'
}
buildscript {
repositories {
flatDir { dirs 'gradlePlugins' }
mavenCentral()
}
dependencies { classpath 'com.github.rholder:gradle-one-jar:1.0.4' }
}
// Use local copies of dependencies first, then get from Maven if needed
repositories {
flatDir {
dirs 'lib', 'libTest'
}
mavenCentral()
}
dependencies {
compile 'commons-codec:commons-codec:1.9',
'commons-cli:commons-cli:1.2',
'org.apache.commons:commons-lang3:3.0'
testCompile 'junit:junit:4.10',
'org.codehaus.groovy:groovy-all:2.0.5',
'org.spockframework:spock-core:0.7-groovy-2.0',
'cglib:cglib-nodep:2.2.2',
'org.objenesis:objenesis:2.1'
}
// Copy dependencies into the git repository
task copyToLib(type: Copy) {
into 'lib'
from configurations.runtime
}
task copyToTestLib(type: Copy) {
into 'libTest'
from configurations.testRuntime
}
jar.dependsOn copyToLib
test.dependsOn copyToTestLib
task buildOneJar(type: OneJar) {
mainClass = mainClassName
additionalDir = file('oneJarConfig')
archiveName = 'Archiverify-' + getVersionTag() + '.jar'
dependsOn test
}
sourceSets {
test {
groovy {
srcDirs += 'src/testHelpers/groovy'
}
}
systemTest {
groovy {
srcDirs += 'src/testHelpers/groovy'
}
}
}
configurations {
systemTestCompile.extendsFrom testCompile
systemTestRuntime.extendsFrom testRuntime
}
task systemTest(type: Test) {
testClassesDir = sourceSets.systemTest.output.classesDir
classpath = sourceSets.systemTest.runtimeClasspath
dependsOn buildOneJar
}
task buildRelease {
dependsOn systemTest
}
jar {
manifest {
attributes(
'Main-Class': mainClassName,
'Implementation-Version': project.version)
}
}
def getVersionTag() {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tag', '--match', 'v*.*.*'
standardOutput = stdout
}
return stdout.toString().trim()
}