forked from freeplane/freeplane
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
220 lines (186 loc) · 6.63 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
plugins {
id "nebula.ospackage" version "5.0.4"
}
Properties props = new Properties()
props.load(new FileInputStream(rootDir.path + '/freeplane/src/viewer/resources/version.properties'))
allprojects {
// in a multi-project setup, all projects must have the same version number!
// the real (specific) version number is in freeplane/viewer-resources/version.properties!
ext.majorVersion = props['freeplane_version']
ext.versionStatus = props['freeplane_version_status']
ext.minorVersion = System.getProperty('minor', '')
ext.distVersion = "$majorVersion${versionStatus.empty?'':'-'+versionStatus}${minorVersion.empty?'':'-pre' + minorVersion}"
version = ext.majorVersion
// WARNING: this is removed with "gradle clean"!!
ext.globalBin = rootDir.path + '/BIN'
repositories {
mavenCentral()
maven { url "http://www.knopflerfish.org/releases/6.1.0/maven2" }
maven { url "${project.gradle.gradleUserHomeDir}/local-artifacts" }
maven { url "http://dl.bintray.com/freeplane/freeplane" }
// maven { url "https://oss.jfrog.org/artifactory/oss-snapshot-local"}
// this is necessary to grab both binary and source jars
// for local (git) dependencies
flatDir name: 'localGitDepsRepository',
dirs: [rootDir.path + "/freeplane/lib",
rootDir.path + "/freeplane_plugin_jsyntaxpane/lib"]
}
}
// this is used for (linux) packages, where the dependencies
// live on the file system (/usr/share/java/*.jar on Debian):
def externalizeJar(File jar) {
// do not externalize, jars are copied over to /BUILD
// in development workflow!
return "lib/${jar.name}"
}
// this is overridden in linux packages where this might be named
// knopflerfish-framework.jar
def isKnopflerfishJar(fileName) {
return fileName.startsWith('framework-') &&
fileName.endsWith('.jar');
}
def filterAndExternalizePluginDependencies(runtime_files) {
return runtime_files.findAll {
File file -> !isKnopflerfishJar(file.name)
}.findAll {
File file ->
file.name != "freeplane-${project.version}.jar" &&
!(file.name.startsWith('freeplane_plugin_') &&
file.name.endsWith('-' + project.version + '.jar'))
}.collect {
File file -> externalizeJar(file)
}
}
subprojects {
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
targetCompatibility='1.8'
sourceCompatibility='1.8'
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
javadoc {
options.encoding = "UTF-8"
options.docEncoding = "UTF-8"
options.charSet = "UTF-8"
enabled = false
failOnError = false
}
repositories {
maven {
url "http://repo1.maven.org/maven2"
}
}
dependencies {
testCompile 'junit:junit:4.12',
'org.hamcrest:hamcrest-all:1.3',
'org.mockito:mockito-core:2.21.0',
'org.assertj:assertj-core:2.6.0'
}
task copyEclipseSettings(type: Copy) {
from(rootDir.path + "/freeplane_framework/eclipse/settings-templates/") {
include("*.prefs")
}
into(project.file(".settings/"))
}
eclipseJdt.dependsOn copyEclipseSettings
task cleanEclipseSettings(type: Delete) {
delete(project.file(".settings"))
}
cleanEclipseJdt.dependsOn cleanEclipseSettings
if (project.hasProperty('TestLoggingFull')) {
test {
testLogging {
events "failed"
exceptionFormat "full"
}
}
}
}
// OSGi projects (/plugin/, freeplane) need this for compilation (e.g. resolve Bundle),
// and freeplane_framework needs to copy it to BUILD/framework.jar
configure(subprojects.findAll {it.name =~ /plugin/ || it.name =~ /^freeplane$/ || it.name =~ /^freeplane_framework$/}){
dependencies {
compile group: 'org.knopflerfish.kf6', name:'framework', version: '8.0.4'
}
}
// common configuration for all OSGi projects...
configure(subprojects.findAll {it.name =~ /plugin/ || it.name =~ /^freeplane$/ }) {
apply plugin: 'osgi'
if (project.name.equals("freeplane"))
ext.pluginid = 'org.freeplane.core'
else
ext.pluginid = project.name.replace("freeplane_plugin_", "org.freeplane.plugin.")
}
// common configuration for all plugins...
configure(subprojects.findAll {it.name =~ /plugin/ }) {
task copyOSGiJars(type: Copy) {
from ("$buildDir/libs") {
include("*.jar")
exclude('freeplane-' + project.version + '.jar')
exclude('freeplane_plugin_*-' + project.version + '.jar')
}
from (configurations.runtime) {
include("*.jar")
// TODO: this is redundant with regard to 'filterPluginDeps' (see above)!
exclude('framework-*.jar')
exclude('knopflerfish-framework*.jar')
}
from ('lib') {
include("*.jar")
exclude('*-sources.jar')
}
into(globalBin + '/plugins/' + pluginid + '/lib/')
}
task copyOSGiManifest(type: Copy) {
from ("$buildDir/tmp/jar/") {
include("MANIFEST.MF")
}
into(globalBin + '/plugins/' + pluginid + '/META-INF/')
}
task copyOSGiConfig(type: Copy) {
from ("OSGI-INF")
into(globalBin + '/plugins/' + pluginid + '/OSGI-INF/')
}
build.dependsOn copyOSGiJars
build.dependsOn copyOSGiManifest
build.dependsOn copyOSGiConfig
// create a separate non-OSGi(!) jar for each plugin!
task pluginJar(type: Jar) {
baseName = 'plugin'
dependsOn classes
from (sourceSets.main.output) {
include("**")
}
// unfortunately some resource (xml,properties) files (e.g. preferences.xml in latex plugin)
// are in src/main/java...
from (sourceSets.main.allSource) {
include("**/*.xml")
include("**/*.properties")
}
includeEmptyDirs = false
// use a non-OSGi manifest (this jar is referenced from an OSGi bundle)!
project.manifest { }
}
// jar must execute after pluginJar so that the OSGi manifest can still be
// picked up from build/tmp/jar (and isn't overwritten by plugin*.jar's non-OSGi
// manifest!)
jar.dependsOn pluginJar
}
apply plugin: 'base' // necessary to get the global 'clean' task
// remove globalBin/**
task cleanBUILD(type: Delete) {
delete globalBin
}
clean.dependsOn(cleanBUILD)
task check_translation {
dependsOn ':JOrtho_0.4_freeplane:check_translation'
dependsOn ':freeplane:check_translation'
}
task format_translation {
dependsOn ':JOrtho_0.4_freeplane:format_translation'
dependsOn ':freeplane:format_translation'
}
apply from: './dist.gradle'
apply from: './jdt-config.gradle'