-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.gradle
More file actions
232 lines (197 loc) · 6.13 KB
/
build.gradle
File metadata and controls
232 lines (197 loc) · 6.13 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
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
224
225
226
227
228
229
230
231
232
/*
* PerlOnJava Build Configuration
* This Gradle build script configures the build process for the PerlOnJava project
*/
buildscript {
repositories {
gradlePluginPortal()
mavenCentral()
}
}
// Core plugins configuration
plugins {
id 'java'
// Plugin for updating version catalog with latest versions (configuration cache compatible!)
alias(libs.plugins.version.catalog.update)
id 'application'
// Plugin for creating OS packages (deb)
alias(libs.plugins.ospackage)
// Plugin for creating fat/uber JARs
alias(libs.plugins.shadow)
}
// Main application class configuration
application {
mainClass = 'org.perlonjava.app.cli.Main'
}
// Debian package build dependency
tasks.buildDeb {
dependsOn installDist
}
// Project metadata
group = 'org.perlonjava'
version = '3.0.0'
// OS package configuration for Debian packaging
ospackage {
packageName = 'perlonjava'
version = project.version
maintainer = 'Flavio Soibelmann Glock <fglock@gmail.com>'
// Java 21+ is required at runtime (any distribution: Oracle, Azul, Temurin, OpenJDK, etc.)
into '/opt/perlonjava'
from('build/install/perlonjava') {
into '/opt/perlonjava'
}
link('/usr/local/bin/jperl', '/opt/perlonjava/bin/jperl')
}
// Java toolchain configuration - requires Java 21
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
// Repository configuration
repositories {
mavenCentral()
}
// Project dependencies
dependencies {
// Core dependencies
implementation libs.asm // ByteCode manipulation
implementation libs.asm.util // ASM utilities
implementation libs.icu4j // Unicode support
implementation libs.fastjson2 // JSON processing
implementation libs.snakeyaml.engine // YAML processing
implementation libs.tomlj // TOML processing
implementation libs.commons.csv // CSV processing
implementation libs.jnr.posix // Native access
// Testing dependencies
testImplementation libs.junit.jupiter.api
testImplementation libs.junit.jupiter.engine
testImplementation libs.junit.jupiter.params
}
// JUnit configuration
testing {
suites {
test {
useJUnitJupiter()
}
}
}
// Java compilation settings
tasks.withType(JavaCompile).configureEach {
options.compilerArgs << '-Xlint:-options'
options.compilerArgs << '-Xlint:deprecation'
}
// Test execution configuration with native access
tasks.withType(Test).configureEach {
jvmArgs += '--enable-native-access=ALL-UNNAMED'
}
// Enable native access for all Java execution tasks
allprojects {
tasks.withType(JavaExec).configureEach {
jvmArgs += '--enable-native-access=ALL-UNNAMED'
}
}
// JUnit platform configuration - default test task runs only unit tests
test {
useJUnitPlatform {
includeTags 'unit'
excludeTags 'full'
}
}
// Fast unit tests only (tests in unit/ directory)
tasks.register('testUnit', Test) {
description = 'Runs fast unit tests only (from unit/ directory)'
group = 'verification'
useJUnitPlatform {
includeTags 'unit'
excludeTags 'full'
}
shouldRunAfter test
}
// All tests including comprehensive module tests
tasks.register('testAll', Test) {
description = 'Runs all tests including comprehensive module tests'
group = 'verification'
useJUnitPlatform {
includeTags 'full'
}
shouldRunAfter testUnit
}
// Shadow JAR configuration for creating standalone executable
shadowJar {
archiveClassifier.set('')
destinationDirectory = file("$buildDir/../target")
manifest {
attributes 'Main-Class': 'org.perlonjava.app.cli.Main'
}
exclude 'module-info.class'
exclude 'META-INF/MANIFEST.MF'
}
// Make shadowJar part of the build process
tasks.named('build') {
dependsOn shadowJar
}
// Source sets configuration for including Perl resources
sourceSets {
main {
resources {
srcDir 'src/main/perl'
srcDir 'src/main/resources'
include '**/*.pm'
include '**/*.pl'
include 'META-INF/services/**'
}
}
test {
resources {
srcDir 'src/test/resources'
}
}
}
// Resource processing configuration
tasks.named('processResources', Copy) {
from(sourceSets.main.resources.srcDirs) {
include '**/*.pm'
include 'META-INF/services/**'
}
into("$buildDir/resources/main")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
// Test resource processing configuration
tasks.named('processTestResources', Copy) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
// Parallel test execution tasks
// Run with: ./gradlew testUnitParallel --parallel
def parallelShards = 4
(0..<parallelShards).each { index ->
tasks.register("testUnitShard${index}", Test) {
group = 'verification'
description = "Runs shard ${index} of ${parallelShards} of unit tests"
useJUnitPlatform {
includeTags 'unit'
excludeTags 'full'
}
systemProperty 'test.shard.index', index
systemProperty 'test.shard.total', parallelShards
testClassesDirs = sourceSets.test.output.classesDirs
classpath = sourceSets.test.runtimeClasspath
}
}
tasks.register('testUnitParallel') {
group = 'verification'
description = 'Runs unit tests in parallel across multiple JVMs. Usage: gradle testUnitParallel --parallel'
dependsOn 'testUnitShard0', 'testUnitShard1', 'testUnitShard2', 'testUnitShard3'
}
// Version catalog update configuration
// The nl.littlerobots.version-catalog-update plugin is configuration cache compatible!
// Use: ./gradlew versionCatalogUpdate to check and update dependencies
// Use: ./gradlew versionCatalogUpdate --interactive to review changes interactively
versionCatalogUpdate {
// Sort the catalog keys
sortByKey = true
// Keep versions not used in the project
keep {
keepUnusedVersions = true
}
}