forked from ome/omero-blitz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
197 lines (168 loc) · 5.68 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
plugins {
id "java-library"
id "org.openmicroscopy.api" version "5.5.0"
id "org.openmicroscopy.dsl" version "5.5.2"
id "org.openmicroscopy.blitz" version "5.5.2"
id "org.openmicroscopy.project" version "5.5.4"
id "org.openmicroscopy.gradle.ice-builder.slice" version "1.5.0"
}
group = "org.openmicroscopy"
version = "5.7.1-SNAPSHOT"
repositories {
mavenLocal()
mavenCentral()
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
ext {
databaseType = "psql"
pythonOutputDir = "$buildDir/toArchive/python"
iceOutputDir = "$buildDir/toArchive/icedoc"
generatedDir = "build/${databaseType}"
generatedSliceDir = "${generatedDir}/slice"
}
dependencies {
testImplementation("jmock:jmock:1.+")
testImplementation("org.testng:testng:7.5")
testImplementation('nl.javadude.assumeng:assumeng:1.2.4')
testImplementation('org.openmicroscopy:omero-common-test:5.6.2')
testImplementation('org.quartz-scheduler:quartz:2.2.1')
api("org.openmicroscopy:omero-server:5.6.8")
implementation("com.sun.activation:javax.activation:1.2.0")
implementation("org.ini4j:ini4j:0.4.1")
implementation("commons-beanutils:commons-beanutils:1.9.3")
implementation("org.apache.xmlgraphics:batik-all:1.9.1")
implementation("org.apache.httpcomponents:httpclient:4.5.6")
implementation("org.apache.httpcomponents:httpmime:4.5.6")
implementation("gnu.getopt:java-getopt:1.0.13")
implementation("net.sf.ehcache:ehcache:2.10.6")
implementation("ch.qos.logback:logback-classic:1.2.11")
// Use the same slfj4-api version as declared in Bio-Formats
implementation("org.slf4j:slf4j-api:1.7.30")
}
configurations.all {
exclude group: 'com.google.code.findbugs'
}
if (slice.iceVersion.contains("3.7")) {
slice.output = file("$generatedDir/ice37")
dependencies {
implementation "com.zeroc:icegrid:3.7.2"
implementation "com.zeroc:icestorm:3.7.2"
}
sourceSets.main.java {
srcDirs "src/main/ice37", slice.output
}
} else if (slice.iceVersion.contains("3.6")) {
slice.output = file("${generatedDir}/ice36")
dependencies {
implementation "com.zeroc:icegrid:3.6.5"
implementation "com.zeroc:icestorm:3.6.5"
}
sourceSets.main.java {
srcDirs "src/main/ice36", slice.output
}
}
test {
testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
}
// enable TestNG support (default is JUnit)
useTestNG() {
suites "src/test/resources/unit.testng.xml"
}
dependsOn cleanTest
}
dsl {
database databaseType
outputDir file("${generatedDir}")
singleFile {
iceMap {
template "java_ice_map.vm"
outputFile "java/omero/util/IceMap.java"
}
modelObjectFactoryRegistry {
template "java_obj_reg.vm"
outputFile "java/omero/util/ModelObjectFactoryRegistry.java"
}
objectFactoryRegistrar {
template "py_obj_reg.vm"
outputFile "$pythonOutputDir/omero/ObjectFactoryRegistrar.py"
}
}
}
api {
outputDir file("${generatedDir}")
language {
java {
language "java"
outputDir "java/omero/model"
}
ice {
language "ice"
outputDir "slice/omero/model"
rename "\$1"
}
python {
language "python"
outputDir pythonOutputDir
rename "omero_model_\$1I"
}
}
}
task copySliceFiles(type: Copy, dependsOn: "generateIce") {
from "src/main/slice"
into "${generatedSliceDir}"
}
slice {
java {
include = [file("${generatedSliceDir}")]
files = fileTree(dir: file("${generatedSliceDir}"), include: "**/*.ice")
args = "--tie"
}
}
tasks.addRule("Pattern: pythonTask<ID>") { String taskName ->
if (taskName.startsWith("pythonTask")) {
def id = taskName.replace("pythonTask", "")
def camel = id.substring(0, 1).toLowerCase() + id.substring(1)
def dir = camel.replaceAll("([A-Z])", '/$1').toLowerCase()
def dirAsPrefix = dir.replace("/", "_") + "_"
task(taskName, type: com.zeroc.gradle.icebuilder.slice.PythonTask, dependsOn: "copySliceFiles") {
includeDirs = "${generatedSliceDir}"
inputFiles = fileTree(dir: "${generatedSliceDir}/${dir}", include: "**.ice")
outputDir = file("$pythonOutputDir")
prefix = dirAsPrefix
}
}
}
task pythonTaskGroup {
description "Runs all python tasks"
dependsOn = [
tasks."generatePython",
pythonTaskOmero,
pythonTaskOmeroModel,
pythonTaskOmeroCmd,
pythonTaskOmeroApi,
]
}
jar {
manifest {
attributes("Main-Class": 'ome.services.blitz.Entry')
}
}
// Need to ensure that the pythonTaskGroup output doesn't overwrite the output of generateObjectFactoryRegistrar
tasks."generateObjectFactoryRegistrar${dsl.database.get().capitalize()}".mustRunAfter pythonTaskGroup
// Set compileSlice to depend on the generation of ice files from "splitIce"
compileSlice.dependsOn "copySliceFiles"
// Set compileJava to additionally depend on "splitJava"
compileJava.dependsOn "generateJava"
task compileIcedoc(type: com.zeroc.gradle.icebuilder.slice.IceDocsTask, dependsOn: "compileSlice") {
outputDir = file("${iceOutputDir}")
includeDirs = files("${generatedSliceDir}", "src/main/slice")
sourceDirs = files("${generatedSliceDir}", "src/main/slice")
header = file("src/main/resources/header.txt")
footer = file("src/main/resources/footer.txt")
}
// Add publish functionality
apply from: "publish.gradle"