-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbuild.gradle
More file actions
90 lines (77 loc) · 2.31 KB
/
build.gradle
File metadata and controls
90 lines (77 loc) · 2.31 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
plugins {
id 'java-library'
id 'maven-publish'
}
group = 'org.julia'
version = '0.0.3-SNAPSHOT'
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
repositories {
mavenCentral()
mavenLocal()
}
publishing {
publications {
maven(MavenPublication) {
groupId = project.group
artifactId = rootProject.name
version = project.version
from components.java
}
}
}
// Helper function to get Julia's lib directory (cross-platform)
def getJuliaLibPath() {
def juliaCmd = [
'julia',
'-e',
'print(abspath(joinpath(dirname(Sys.BINDIR), string(:lib))))'
]
def process = juliaCmd.execute()
process.waitFor()
if (process.exitValue() != 0) {
throw new GradleException("Failed to find Julia lib path: ${process.err.text}")
}
return process.text.trim()
}
// Helper to detect OS in a stable way
def getOsName() {
def os = System.getProperty('os.name').toLowerCase()
if (os.contains('mac')) return 'mac'
if (os.contains('win')) return 'windows'
if (os.contains('nux')) return 'linux'
return 'other'
}
tasks.test {
useJUnitPlatform()
testClassesDirs = testing.suites.test.sources.output.classesDirs
classpath = testing.suites.test.sources.runtimeClasspath
doFirst {
def juliaLibPath = getJuliaLibPath()
def osName = getOsName()
if (osName == 'mac') {
def current = System.getenv('DYLD_LIBRARY_PATH')
environment "DYLD_LIBRARY_PATH", juliaLibPath + (current ? ":" + current : "")
} else if (osName == 'linux') {
def current = System.getenv('LD_LIBRARY_PATH')
environment "LD_LIBRARY_PATH", juliaLibPath + (current ? ":" + current : "")
} else if (osName == 'windows') {
def current = System.getenv('PATH') ?: ""
environment "PATH", juliaLibPath + File.pathSeparator + current
}
}
}
tasks.named('jar') {
manifest {
attributes(
'Automatic-Module-Name': 'JuliaEngine',
'Implementation-Version': project.version
)
}
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.4'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.11.4'
}