-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
157 lines (141 loc) · 4 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
allprojects {
group 'ch.interlis'
apply plugin: "java"
apply plugin: "maven"
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
}
version '1.4.1'+System.getProperty('release','-SNAPSHOT')
configurations {
deployerJars
}
// to get the latest SNAPSHOT uncomment the following lines
//configurations.all {
// check for updates every build
// resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
//}
dependencies {
compile group: 'ch.interlis', name: 'iox-ili', version: '1.21.18'
compile group: 'ch.interlis', name: 'ili2c-tool', version: "5.3.3"
compile group: 'ch.interlis', name: 'ili2c-core', version: "5.3.3"
compile group: 'org.slf4j', name: 'slf4j-api', version: "1.7.25"
compile group: 'org.slf4j', name: 'slf4j-simple', version: "1.7.25"
testCompile group: 'junit', name: 'junit', version: '4.12'
deployerJars "org.apache.maven.wagon:wagon-ftp:3.0.0"
}
repositories {
mavenLocal()
mavenCentral()
maven {
url "http://jars.interlis.ch"
}
}
Properties properties = new Properties()
File propFile=project.rootProject.file('user.properties')
if(propFile.exists()){
properties.load(propFile.newDataInputStream())
}
def git = System.getProperty('git',properties.get('git','git'))
def repos_pwd = System.getProperty('repos_pwd',properties.get('repos_pwd','repos_pwd'))
def repos_usr = System.getProperty('repos_usr',properties.get('repos_usr','repos_usr'))
def python= System.getProperty('python',properties.get('python','python'))
def rst2html= System.getProperty('rst2html',properties.get('rst2html','rst2html'))
def generatedResources = "$buildDir/generated-resources/main"
def getGitHash = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine git, 'rev-parse', 'HEAD'
standardOutput = stdout
}
return stdout.toString().trim()
}
sourceSets {
main {
output.dir(generatedResources, builtBy: 'generateMyResources')
java {
srcDirs = ['src','gensrc']
}
resources {
srcDir "src"
include "**/*.properties"
exclude "**/Version.properties"
}
}
test {
java {
srcDirs = ['test/src']
}
resources {
srcDirs = ['test/data']
}
}
}
task generateMyResources {
doLast {
def versionProps = new Properties()
versionProps.setProperty('version', "$project.version")
versionProps.setProperty('versionCommit', getGitHash())
def versionPropsFile = new File(generatedResources,"org/interlis2/av2geobau/Version.properties")
versionPropsFile.getParentFile().mkdirs();
versionProps.store(versionPropsFile.newWriter(), null);
}
}
task usrdoc(type:Exec) {
def infile=new File(project.projectDir,'docs/av2geobau_de.rst')
def outfile=new File('docs/av2geobau_de.html')
inputs.file infile
outputs.file outfile
doFirst{
new File(project.buildDir,'docs').mkdir()
}
workingDir = project.buildDir
executable python
args = [rst2html, infile, outfile]
}
task bindist(dependsOn:[usrdoc,jar],type: Zip){
baseName = project.name
destinationDir = file('dist')
from jar
into('docs'){
from files("LICENSE","docs/CHANGELOG.txt","build/docs/av2geobau_de.html")
}
into('libs'){
from configurations.runtimeClasspath
//def jars=[]
//subprojects.each {
// jars+=it.libsDir
//}
//from jars
}
// version = '1.0.6'
}
jar {
manifest {
attributes(
"Main-Class": "org.interlis2.av2geobau.Main",
"Class-Path": configurations.runtimeClasspath.collect { 'libs/'+it.getName() }.join(' '))
}
}
artifacts {
archives(bindist.archivePath) {
type 'zip'
classifier 'bindist'
builtBy bindist
}
archives(jar.archivePath){
builtBy jar
}
}
test {
testLogging.exceptionFormat = 'full'
}
uploadArchives {
repositories {
mavenDeployer {
configuration = configurations.deployerJars
repository(url: 'ftp://ftp.interlis.ch'){
authentication(userName: repos_usr, password: repos_pwd)
}
}
}
}