-
Notifications
You must be signed in to change notification settings - Fork 11
/
build.gradle
220 lines (199 loc) · 6.97 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
group 'ch.interlis'
version '3.10.4'+System.getProperty('release','-SNAPSHOT')
apply plugin: "java"
apply plugin: "maven"
if(!JavaVersion.current().isJava8()){
compileJava.options.compilerArgs.addAll(['--release', '6'])
}else{
sourceCompatibility = JavaVersion.VERSION_1_6
targetCompatibility = JavaVersion.VERSION_1_6
}
compileJava.options.encoding = 'US-ASCII'
configurations {
deployerJars
ftpAntTask
}
// to get the latest SNAPSHOT uncomment the following lines
//configurations.all {
// check for updates every build
// resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
//}
// In this section you declare where to find the dependencies of your project
repositories {
// Use jcenter for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
//jcenter()
mavenLocal()
mavenCentral()
maven { url "http://jars.interlis.ch" }
//maven { url "https://mvnrepository.com/artifact/org.freehep/freehep-graphicsio-emf" }
//maven { url "https://mvnrepository.com/artifact/org.freehep/freehep-graphics2d" }
//maven { url "https://mvnrepository.com/artifact/org.freehep/freehep-graphicsio-svg" }
//maven { url "https://mvnrepository.com/artifact/org.freehep/freehep-graphicsbase" }
//maven { url "https://mvnrepository.com/artifact/junit/junit" }
flatDir { dirs 'lib' }
}
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 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"]
}
resources {
srcDirs = ["src", "resources/de", "resources/fr", "resources/it", "resources/es"]
include "**/*.properties"
exclude "**/Version.properties"
include "**/*.gif"
include "**/*.jpg"
}
}
test {
java {
//srcDirs = ["test"]
srcDirs = []
exclude '**/UmlEditorTestSuite.java'
}
}
}
dependencies {
implementation name: 'jh'
implementation name: 'jhotdraw53'
implementation name: 'sebase'
implementation name: 'usrdocjh'
implementation name: 'XMIFramework'
implementation 'ch.interlis:ili2c-tool:5.6.2'
implementation 'ch.interlis:ili2c-core:5.6.2'
implementation 'ch.ehi:ehibasics:1.4.0'
implementation(group:'org.freehep', name:'freehep-graphicsio', version:'2.3'){
exclude group:'junit', module:'junit'
}
implementation(group:'org.freehep', name:'freehep-graphics2d', version:'2.3'){
exclude group:'junit', module:'junit'
}
implementation(group:'org.freehep', name:'freehep-io', version:'2.2.2'){
exclude group:'junit', module:'junit'
}
implementation(group:'org.freehep', name:'freehep-graphicsbase', version:'2.3') {
exclude group:'junit', module:'junit'
}
implementation(group:'org.freehep', name:'freehep-graphicsio-emf', version:'2.3'){
exclude group:'org.freehep', module:'freehep-graphicsio-tests'
exclude group:'junit', module:'junit'
}
implementation(group:'org.freehep', name:'freehep-graphicsio-svg', version:'2.3'){
exclude group:'org.freehep', module:'freehep-graphicsio-tests'
exclude group:'junit', module:'junit'
}
// Use JUnit test framework
testImplementation 'junit:junit:4.12'
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"
}
//create a single Jar with all dependencies
jar {
//baseName = 'umleditor'
//version = '1.0'
manifest {
attributes (
'Main-Class': 'ch.ehi.umleditor.application.LauncherView',
"Class-Path": configurations.runtimeClasspath.collect { 'libs/'+it.getName() }.join(' ')
)
}
}
task run(type:JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = "ch.ehi.umleditor.application.LauncherView"
args "-debug"
}
task generateMyResources {
def versionPropsFile = new File(generatedResources,"ch/ehi/umleditor/application/Version.properties")
def version="$project.version"
def hash=getGitHash()
inputs.property("version","$project.version")
inputs.property("hash",getGitHash())
outputs.files "$versionPropsFile"
doLast {
def versionProps = new Properties()
versionProps.setProperty('version', version)
versionProps.setProperty('versionCommit', hash)
versionPropsFile.getParentFile().mkdirs();
versionProps.store(versionPropsFile.newWriter(), null);
}
}
task bindist(type: Zip){
baseName = project.name
destinationDir = file('dist')
from jar
into('docs'){
from files(fileTree("docs").include("LICENSE.*"),"docs/README.txt","docs/CHANGELOG.txt")
}
into('libs'){
from configurations.runtimeClasspath
//def jars=[]
//subprojects.each {
// jars+=it.libsDir
//}
//from jars
}
// version = '1.0.6'
}
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 programName='umleditor'
def archivePath= bindist.archiveFile.get().asFile.parent
def archiveName=bindist.archiveFile.get().asFile.name
def json = groovy.json.JsonOutput.toJson([filename: 'https://downloads.interlis.ch/'+programName+'/'+archiveName, version: project.version ,date: new Date().format( 'yyyy-MM-dd' )])
def releaseFile = new File(archivePath,programName+'-release.json')
releaseFile.write(json)
ant.ftp(server: "jql.ftp.infomaniak.com", userid: downloads_usr, password: downloads_pwd,
remoteDir: '/'+programName, passive:"yes") {
fileset(dir: archivePath ) {
include(name: archiveName)
include(name: releaseFile.name)
}
}
}
}