Repository navigation
Expand file tree
/
Copy pathbuild.gradle
More file actions
196 lines (178 loc) · 8.4 KB
/
Copy pathbuild.gradle
File metadata and controls
196 lines (178 loc) · 8.4 KB
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
plugins {
id 'java'
id 'application'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(25)
}
}
repositories {
mavenCentral()
flatDir {
dirs 'libs'
}
}
// mapdb:3.1.0 (pulled transitively by rdf4j-collection-factory-mapdb3) declares open version
// ranges that force Gradle to query Maven Central metadata on every build, triggering HTTP 429
// rate-limit errors in CI. Pin the ranges to known-good fixed versions.
configurations.configureEach {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.jetbrains.kotlin'
&& details.requested.name == 'kotlin-stdlib') {
details.useVersion '1.9.25'
details.because 'pin mapdb transitive range [1.9.22,1.9.999) to avoid Maven Central 429'
}
if (details.requested.group == 'org.eclipse.collections') {
details.useVersion '10.4.0'
details.because 'pin mapdb transitive range [7.0.0,10.10.90) to avoid Maven Central 429'
}
}
}
// CoreseDriver → Corese 4.x API (RuleEngine.OWL_RL int constant)
// CoreseNextDriver → Corese 5 API from libs/*.jar
// The two drivers use incompatible RuleEngine classes — compile only the one that matches the build.
def localJars = fileTree(dir: 'libs', include: ['*.jar'])
def useLocalCorese = (project.hasProperty('coreseVersion') && project.coreseVersion == 'local') || project.hasProperty('coreseJar')
if (useLocalCorese && (!localJars.isEmpty() || project.hasProperty('coreseJar'))) {
// corese-next build: exclude 4.x driver (incompatible RuleEngine API)
sourceSets.main.java.exclude '**/CoreseDriver.java'
// Also exclude tests that directly instantiate CoreseDriver (won't compile without it)
sourceSets.test.java.exclude '**/CrossEngineConsistencyTest.java'
sourceSets.test.java.exclude '**/DriverFormatTest.java'
if (project.hasProperty('coreseJar')) {
dependencies { compileOnly files(project.coreseJar) }
} else {
dependencies { compileOnly localJars }
}
} else {
// corese 4.x build: exclude 5.x driver (requires corese-next JAR)
sourceSets.main.java.exclude '**/CoreseNextDriver.java'
}
dependencies {
// Corese
if (project.hasProperty('coreseJar')) {
implementation files(project.coreseJar)
} else if (project.hasProperty('coreseVersion') && project.coreseVersion == 'local') {
implementation fileTree(dir: 'libs', include: ['*.jar'])
} else if (project.hasProperty('coreseVersion')) {
implementation "fr.inria.corese:corese-core:${project.coreseVersion}"
} else if (project.hasProperty('coreseCommit')) {
implementation fileTree(dir: project.coreseCommit, include: ['*.jar'])
} else {
implementation 'fr.inria.corese:corese-core:4.6.5'
}
// Apache Jena
def jenaVersion = project.hasProperty('jenaVersion') ? project.jenaVersion : '6.2.0'
implementation "org.apache.jena:jena-core:${jenaVersion}"
implementation "org.apache.jena:jena-arq:${jenaVersion}"
implementation "org.apache.jena:jena-tdb2:${jenaVersion}"
// RDF4J
def rdf4jVersion = project.hasProperty('rdf4jVersion') ? project.rdf4jVersion : '6.1.0'
implementation "org.eclipse.rdf4j:rdf4j-repository:${rdf4jVersion}"
implementation "org.eclipse.rdf4j:rdf4j-sail-memory:${rdf4jVersion}"
implementation "org.eclipse.rdf4j:rdf4j-sail-nativerdf:${rdf4jVersion}"
implementation "org.eclipse.rdf4j:rdf4j-sail-lmdb:${rdf4jVersion}"
implementation "org.eclipse.rdf4j:rdf4j-repository-sail:${rdf4jVersion}"
implementation "org.eclipse.rdf4j:rdf4j-rio:${rdf4jVersion}"
// RIO parsers — required for multi-format support (.nq, .ttl, .trig, .rdf, .jsonld)
implementation "org.eclipse.rdf4j:rdf4j-rio-ntriples:${rdf4jVersion}"
implementation "org.eclipse.rdf4j:rdf4j-rio-nquads:${rdf4jVersion}"
implementation "org.eclipse.rdf4j:rdf4j-rio-turtle:${rdf4jVersion}"
implementation "org.eclipse.rdf4j:rdf4j-rio-trig:${rdf4jVersion}"
implementation "org.eclipse.rdf4j:rdf4j-rio-rdfxml:${rdf4jVersion}"
implementation "org.eclipse.rdf4j:rdf4j-rio-jsonld:${rdf4jVersion}"
// JSON output
implementation 'com.fasterxml.jackson.core:jackson-databind:2.18.0'
// Logging
implementation 'ch.qos.logback:logback-classic:1.4.14'
// Tests
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.2'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
testImplementation 'fr.inria.corese:corese-core:4.6.5'
def jenaVersionTest = project.hasProperty('jenaVersion') ? project.jenaVersion : '6.2.0'
testImplementation "org.apache.jena:jena-core:${jenaVersionTest}"
testImplementation "org.apache.jena:jena-arq:${jenaVersionTest}"
testImplementation "org.apache.jena:jena-tdb2:${jenaVersionTest}"
def rdf4jVersionTest = project.hasProperty('rdf4jVersion') ? project.rdf4jVersion : '6.1.0'
testImplementation "org.eclipse.rdf4j:rdf4j-repository:${rdf4jVersionTest}"
testImplementation "org.eclipse.rdf4j:rdf4j-sail-memory:${rdf4jVersionTest}"
testImplementation "org.eclipse.rdf4j:rdf4j-sail-nativerdf:${rdf4jVersionTest}"
testImplementation "org.eclipse.rdf4j:rdf4j-sail-lmdb:${rdf4jVersionTest}"
testImplementation "org.eclipse.rdf4j:rdf4j-repository-sail:${rdf4jVersionTest}"
testImplementation "org.eclipse.rdf4j:rdf4j-rio:${rdf4jVersionTest}"
testImplementation "org.eclipse.rdf4j:rdf4j-rio-ntriples:${rdf4jVersionTest}"
testImplementation "org.eclipse.rdf4j:rdf4j-rio-nquads:${rdf4jVersionTest}"
testImplementation "org.eclipse.rdf4j:rdf4j-rio-turtle:${rdf4jVersionTest}"
testImplementation "org.eclipse.rdf4j:rdf4j-rio-trig:${rdf4jVersionTest}"
testImplementation "org.eclipse.rdf4j:rdf4j-rio-rdfxml:${rdf4jVersionTest}"
testImplementation "org.eclipse.rdf4j:rdf4j-rio-jsonld:${rdf4jVersionTest}"
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
options.release = 25
}
def jenaResolvedVersion = project.hasProperty('jenaVersion') ? project.jenaVersion : '6.2.0'
def rdf4jResolvedVersion = project.hasProperty('rdf4jVersion') ? project.rdf4jVersion : '6.1.0'
def coreseResolvedVersion = '4.6.5'
if (project.hasProperty('coreseVersion')) {
coreseResolvedVersion = project.coreseVersion
} else if (project.hasProperty('coreseCommit')) {
coreseResolvedVersion = 'commit'
} else if (project.hasProperty('coreseJar')) {
coreseResolvedVersion = 'jar'
}
def generateEngineProperties = tasks.register('generateEngineProperties') {
def outputDir = layout.buildDirectory.dir("generated/engine-info")
outputs.dir(outputDir)
inputs.property("jenaVersion", jenaResolvedVersion)
inputs.property("rdf4jVersion", rdf4jResolvedVersion)
inputs.property("coreseVersion", coreseResolvedVersion)
doLast {
def dir = outputDir.get().asFile
dir.mkdirs()
def infoFile = new File(dir, "engine-runtimes.properties")
infoFile.text = "jena.version=${jenaResolvedVersion}\nrdf4j.version=${rdf4jResolvedVersion}\ncorese.version=${coreseResolvedVersion}\n"
}
}
sourceSets.main.output.dir(generateEngineProperties)
classes.dependsOn(generateEngineProperties)
test {
useJUnitPlatform()
maxHeapSize = '4g'
jvmArgs '--enable-native-access=ALL-UNNAMED'
// The corese-next fat JAR bundles its own SLF4J classes (2.x) which conflict
// with the project's logback-classic (SLF4J 1.x) at test runtime, causing
// Jena/RDF4J class-loading failures. Remove it from the test classpath; its
// tests (CoreseDriver-based) are already excluded in local mode above.
if (useLocalCorese && !localJars.isEmpty()) {
classpath -= localJars
}
}
application {
mainClass = 'fr.inria.corese.benchmark.Main'
}
task runBenchmark(type: JavaExec) {
group = 'benchmark'
description = 'Run the benchmark harness'
classpath = sourceSets.main.runtimeClasspath
mainClass = 'fr.inria.corese.benchmark.Main'
jvmArgs = [
'-Xmx12g',
'-Xms4g',
'-XX:+UseG1GC',
'--enable-native-access=ALL-UNNAMED'
]
}
task convertDatasets(type: JavaExec) {
group = 'benchmark'
description = 'Converts canonical N-Triples datasets to all supported W3C formats'
classpath = sourceSets.main.runtimeClasspath
mainClass = 'fr.inria.corese.benchmark.ConvertDatasets'
jvmArgs = [
'-Xmx12g',
'-Xms4g',
'-XX:+UseG1GC',
'--enable-native-access=ALL-UNNAMED'
]
}