-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.gradle
More file actions
177 lines (155 loc) · 5.13 KB
/
Copy pathbuild.gradle
File metadata and controls
177 lines (155 loc) · 5.13 KB
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
plugins {
id 'java'
id 'maven'
}
version '0.9.2'+System.getProperty('release','-SNAPSHOT')
group 'ch.ehi'
configurations {
deployerJars
ftpAntTask
}
repositories {
mavenLocal()
mavenCentral()
maven {
url "http://jars.interlis.ch"
}
}
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
compileJava.options.encoding = 'US-ASCII'
// to get the latest SNAPSHOT uncomment the following lines
//configurations.all {
// check for updates every build
// resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
//}
dependencies {
implementation group: 'ch.ehi', name: 'ehibasics', version: '1.4.1'
implementation group: 'ch.interlis', name: 'iox-api', version: '1.0.4'
implementation group: 'ch.interlis', name: 'iox-ili', version: '1.21.13'
implementation group: 'ch.interlis', name: 'ili2c-tool', version: "5.3.0"
implementation group: 'ch.interlis', name: 'ili2c-core', version: "5.3.0"
testImplementation 'junit:junit:4.12'
testImplementation group: 'ch.interlis', name: 'ilivalidator', version: "1.12.1"
deployerJars "org.apache.maven.wagon:wagon-ftp:3.3.3"
deployerJars "org.apache.maven.wagon:wagon-ssh:3.3.3"
ftpAntTask "org.apache.ant:ant-commons-net:1.10.7"
}
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 downloads_pwd = System.getProperty('downloads_pwd',properties.get('downloads_pwd','downloads_pwd'))
def downloads_usr = System.getProperty('downloads_usr',properties.get('downloads_usr','downloads_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')
}
}
task generateMyResources {
def versionPropsFile = new File(generatedResources,"ch/ehi/ilimanager/Version.properties")
def version="$project.version"
def hash=getGitHash()
inputs.property("version","$project.version")
inputs.property("hash",getGitHash())
outputs.file versionPropsFile
doLast {
def versionProps = new Properties()
versionProps.setProperty('version', version)
versionProps.setProperty('versionCommit', hash)
versionPropsFile.getParentFile().mkdirs();
versionProps.store(versionPropsFile.newWriter(), null);
}
}
task usrdoc(type:Exec) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
description = 'Builds the user documentation (html)'
def infile=new File(project.projectDir,'docs/ilimanager.rst')
def outfile=new File(project.buildDir,'docs/ilimanager.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(type: Zip){
baseName = project.name
destinationDir = file('dist')
from jar
into('docs'){
from files("LICENSE","README.md","docs/CHANGELOG.txt",new File(project.buildDir,'docs/ilimanager.html'))
}
into('libs'){
from configurations.runtimeClasspath
//def jars=[]
//subprojects.each {
// jars+=it.libsDir
//}
//from jars
}
// version = '1.0.6'
}
jar {
manifest {
attributes(
"Main-Class": "ch.ehi.ilimanager.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
}
}
uploadArchives {
repositories {
mavenDeployer {
configuration = configurations.deployerJars
repository(url: 'ftp://ftp.interlis.ch'){
authentication(userName: repos_usr, password: repos_pwd)
}
}
}
}
task uploadBin(dependsOn: bindist) {
doLast {
ant.taskdef(name: 'ftp',
classname: 'org.apache.tools.ant.taskdefs.optional.net.FTP',
classpath: configurations.ftpAntTask.asPath)
def dist= bindist.archiveFile.get().asFile.parent
def name=bindist.archiveFile.get().asFile.name
def json = groovy.json.JsonOutput.toJson([filename: 'https://downloads.interlis.ch/ilimanager/'+name, version: project.version ,date: new Date().format( 'yyyy-MM-dd' )])
def releaseFile = new File(dist,project.name+"-release.json")
releaseFile.write(json)
ant.ftp(server: "jql.ftp.infomaniak.com", userid: downloads_usr, password: downloads_pwd,
remoteDir: "/ilimanager", passive:"yes") {
fileset(dir: dist ) {
include(name: name)
include(name: releaseFile.name)
}
}
}
}