-
Notifications
You must be signed in to change notification settings - Fork 300
/
build.gradle
201 lines (184 loc) · 5.83 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
// This installs dependencyUpdates plugin
// Run gradle dependencyUpdates to get the report
plugins {
id 'com.github.ben-manes.versions' version '0.13.0'
id "com.jfrog.bintray" version "1.7"
}
apply plugin: 'java'
apply plugin: 'eclipse'
// Path to launch4j binary
ext.launch4j = '/opt/launch4j/launch4j'
// Directories where we build the distro
ext.semver = '2.8.11'
ext.distBinDir = file('dist-bin')
ext.pluginsVersion = file("dist-bin/plugins/VERSION")
ext.pluginsDir = file("dist-bin/plugins/${semver}")
ext.buildNum = getBuildNum()
archivesBaseName = 'ganttproject'
version = "${semver}-r${getBuildNum()}"
ant.importBuild 'build.xml'
ant.properties.distBin = 'dist-bin'
ant.properties.distDebWork = "deb"
ant.properties.distDebPackage = "${buildDir}/distributions"
ant.properties.distMacWork = 'dist-mac'
ant.properties.distMacZip = "${buildDir}/distributions/ganttproject.app-${version}.zip"
ant.properties.version = "${semver}"
ant.properties.version_build = "${version}"
// What is counted as java project for the purposes of this build
def javaProjects() {
subprojects.findAll { project ->
project.name != rootProject.name && project.path != ':..'
}
}
def devNull = new OutputStream() {
@Override
public void write(int b) {}
}
// Config for all projects: deps come from Maven repository,
// compile using Java 8, libs normally sit in lib
allprojects {
configurations {
mavenDeps
}
repositories {
mavenCentral()
jcenter()
}
apply plugin: 'java'
apply plugin: 'eclipse'
ext {
libDir = 'lib'
}
sourceCompatibility = 1.7
targetCompatibility = 1.7
task updateMavenDeps(type: Copy) {
from configurations.mavenDeps
into project.ext.libDir
}
}
clean {
delete += "dist-bin"
}
task updateEclipsito {
copy {
into rootProject.distBinDir
from project(":..:ganttproject").projectDir.toPath().resolve("lib/core")
include "eclipsito.jar"
}
}
task distBin(dependsOn: getTasksByName('assemble', true) + getTasksByName('copyPlugin', true)) {
println "===== Building GanttProject ${version} ====="
println "===== Building generic binary distro ====="
doLast {
copy {
into(rootProject.distBinDir)
from(fileTree(".")) {
include "lib/javagalician.jar"
include "ganttproject.bat"
include "ganttproject.exe"
include "HouseBuildingSample.gan"
include "LICENSE"
include "logging.properties"
}
}
copy {
into(rootProject.distBinDir)
from(fileTree(".")) {
include "ganttproject"
include "ganttproject.command"
}
fileMode 0755
}
rootProject.pluginsVersion.text = semver
}
}
distBin.finalizedBy(updateEclipsito)
def getBuildNum() {
def stdout = new ByteArrayOutputStream()
exec {
workingDir "."
commandLine "git", "rev-list", "--count", "ganttproject-2.7.."
standardOutput = stdout
}
return String.valueOf(Integer.valueOf("${stdout}".trim()) + 1891)
}
task distZip(type: Zip, dependsOn: distBin) {
from 'dist-bin'
into archivesBaseName + '-' + version
}
task distWin(dependsOn: distBin) {
doLast {
println '======== Building Windows Installer ========'
println '= Generating NSIS script ...'
exec {
workingDir '.'
commandLine './gen-nsis', semver, version
}
println '= Generating ganttproject.exe with launch4j ...'
exec {
workingDir '.'
commandLine launch4j, 'ganttproject-launch4j.xml'
standardOutput = devNull
}
println '= Copying required files to dist-win...'
copy {
from 'dist-bin'
into 'dist-win'
include '**'
}
copy {
from '.'
into 'dist-win'
include "ganttproject.l4j.ini"
include 'ganttproject.nsi'
include "ganttproject_16.ico"
include "ganttproject.ico"
}
println '= Building installer...'
exec {
workingDir 'dist-win'
commandLine 'makensis', 'ganttproject.nsi'
standardOutput = devNull
}
copy {
from 'dist-win'
into new File(buildDir, '/distributions')
include "ganttproject-${version}.exe"
}
println "===== Windows installer is ready in ${buildDir}/distributions ====="
}
}
task distDebPre {
doLast {
copy {
into('deb/usr/share/doc/ganttproject')
from(fileTree(".")) {
include "AUTHORS"
include "CHANGELOG"
include "LICENSE"
include "README"
}
}
"gzip --best deb/usr/share/doc/ganttproject/CHANGELOG".execute()
"mv deb/usr/share/doc/ganttproject/CHANGELOG.gz deb/usr/share/doc/ganttproject/changelog.Debian.gz".execute()
}
}
task updateLibs(dependsOn: getTasksByName('updateMavenDeps', true)) {
doLast {
println "== Finished updating libs =="
}
}
task runApp(type: JavaExec, dependsOn: distBin) {
workingDir = 'dist-bin'
classpath = fileTree(dir: 'dist-bin', includes: ['eclipsito.jar', '.'])
main = 'org.bardsoftware.eclipsito.Boot'
args '-app', 'net.sourceforge.ganttproject.GanttProject', '-plugins-dir', "plugins"
jvmArgs '-ea'
}
task debugApp(type: JavaExec, dependsOn: distBin) {
workingDir = 'dist-bin'
classpath = fileTree(dir: 'dist-bin', includes: ['eclipsito.jar', '.'])
main = 'org.bardsoftware.eclipsito.Boot'
args '-app', 'net.sourceforge.ganttproject.GanttProject', '-plugins-dir', "plugins"
jvmArgs '-agentlib:jdwp=transport=dt_socket,address=localhost:9009,server=y,suspend=y'
}