-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.gradle
223 lines (190 loc) · 6.79 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
221
222
223
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
}
plugins {
id 'base'
id 'distribution'
id 'maven-publish'
id "nebula.ospackage" version "8.6.3"
}
version = '0.2.4-SNAPSHOT'
task cleanDeps {
if (gradle.startParameter.taskNames.contains("clean") && !project.gradle.startParameter.projectProperties.containsKey("moduleDep")) {
println "Deleting temporary dependency modules"
File depsCheckFile = rootProject.file("deps/dependency.txt")
if (depsCheckFile.exists()) {
File depsDir = rootProject.file("deps")
depsDir.listFiles().each() { childFile ->
if ((childFile.isDirectory() && childFile.name != ".gradle") || childFile.name.endsWith(".zip")) {
project.delete(childFile)
}
}
} else {
throw new Exception('Invalid dependency path')
}
}
}
clean.dependsOn cleanDeps
subprojects.each { subproject -> evaluationDependsOn(subproject.path) }
subprojects {
task allDeps(type: DependencyReportTask) {}
}
if (file('deps/.downloaded').exists()) {
file('deps/.downloaded').delete()
// Performs another build task for new dependency handling
def depsLevel
if (project.gradle.startParameter.projectProperties.containsKey('moduleDep')) {
depsLevel = project.gradle.startParameter.projectProperties['moduleDep'] + 1
} else {
depsLevel = 1
println "Due to dependecy download(s) gradle build must be executed again after finishing"
}
def artefactBuild = project.tasks.create([name: "depsRebuild_${depsLevel}", type: GradleBuild])
artefactBuild.tasks = project.gradle.startParameter.taskNames
artefactBuild.setDependsOn(project.tasks['assemble'].dependsOn)
def artefactProjectProperties = artefactBuild.startParameter.projectProperties
def currentProjectProperties = project.gradle.startParameter.projectProperties
artefactProjectProperties << currentProjectProperties
artefactProjectProperties << ['moduleDep': depsLevel]
// Terminate currently invalid tasks
// TODO: Fix support for other tasks like distZip
subprojects.each { subproject ->
if (subproject.tasks.findByPath('compileJava') != null) {
subproject.tasks['compileJava'].setEnabled(false)
}
if (subproject.tasks.findByPath('compileTestJava') != null) {
subproject.tasks['compileTestJava'].setEnabled(false)
}
if (subproject.tasks.findByPath('javadoc') != null) {
subproject.tasks['javadoc'].setEnabled(false)
}
}
assemble.dependsOn("depsRebuild_${depsLevel}")
}
distTar.dependsOn project(':apps:bined-editor').tasks['createExe']
distZip.dependsOn project(':apps:bined-editor').tasks['createExe']
ospackage {
packageName = 'bined'
if (project.version.endsWith("-SNAPSHOT")) {
version = project.version.substring(0, project.version.length() - 9)
release = '0'
// '0.' + new Date().format('yyyyMMdd') + "dev"
} else {
version = project.version
release = '1'
}
arch = NOARCH
os = LINUX
packageGroup = 'Converted/utils'
license = 'Apache V2'
vendor = 'ExBin Project'
description = 'Free and open source binary/hex viewer/editor and component written in Java.'
distribution = 'Linux'
url = 'https://bined.exbin.org'
user = 'root'
from ('src/ospackage/bined') {
into '/usr/bin'
}
from ('src/ospackage/bined.desktop') {
into '/usr/share/applications'
}
from ('src/ospackage/bined.png') {
addParentDirs = false
into '/usr/share/pixmaps'
}
from (project(':apps:bined-editor').jar) {
rename { filename -> "bined.jar" }
into '/usr/share/bined'
}
from ('src/dist/readme.txt') {
into '/usr/share/bined'
}
from ('src/dist/plugins') {
into '/usr/share/bined/plugins'
}
from ('apps/bined-editor/help') {
into 'usr/share/bined/help'
}
project(':apps:bined-editor').plugins.withType(JavaPlugin) {
from(project(':apps:bined-editor').configurations.runtimeClasspath) {
into('/usr/share/bined/lib')
include '*'
}
}
}
// Uncoment for deployment, breaks for Java 8+
/*
buildRpm {
from ('src/ospackage/bined.png') {
// Doesn't propagate correctly from ospackage task, so repeat it here
addParentDirs = false
into '/usr/share/pixmaps'
}
requires('jre', '1.8.0', GREATER | EQUAL)
}
buildDeb {
arch = 'all'
requires('default-jre', '1.8.0', GREATER | EQUAL)
}
*/
task("copyDependencies", type: Copy) {
from(project(':apps:bined-editor').configurations.runtimeClasspath).into("$buildDir/jars")
}
task("copyJar", type: Copy) {
from(project(':apps:bined-editor').jar).into("$buildDir/jars")
}
if (!project.gradle.startParameter.projectProperties.containsKey("moduleDep")) {
distZip {
archiveFileName = 'bined-' + project.version + '.zip'
}
distributions {
main {
contents {
duplicatesStrategy = 'exclude'
from project(':apps:bined-editor').jar
from project.rootDir
include 'LICENSE.txt'
include 'changes.txt'
from ('src/dist') {
include 'readme.txt'
include 'bined.sh'
// include 'bined.bat'
include 'plugins/*'
}
from project(':apps:bined-editor').projectDir.absolutePath + '/build/launch4j'
include "Bined.exe"
// into('lib') {
// from 'lib'
// }
into('') {
from project(':apps:bined-editor').jar.archiveFile
include '*'
rename { filename -> "bined.jar" }
}
project(':apps:bined-editor').plugins.withType(JavaPlugin) {
into('lib') {
from project(':apps:bined-editor').configurations.runtimeClasspath
include '*'
}
}
into('help') {
from 'apps/bined-editor/help'
include '**'
}
// into('doc') {
// from 'doc'
// include '**'
// }
// into('resources') {
// from 'resources'
// include '**'
// exclude 'private'
// }
}
}
}
}