-
Notifications
You must be signed in to change notification settings - Fork 621
/
build.gradle
57 lines (50 loc) · 2.01 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
group "ai.djl.pytorch"
dependencies {
api project(":api")
testImplementation("org.testng:testng:${testng_version}") {
exclude group: "junit", module: "junit"
}
testImplementation "org.slf4j:slf4j-simple:${slf4j_version}"
}
processResources {
doLast {
def url = "https://djl-ai.s3.amazonaws.com/publish/pytorch-${pytorch_version}/jnilib"
def files = ["linux-cpu": ["pytorch.properties", "libdjl_torch.so"],
"win-cu92" : ["pytorch.properties", "djl_torch.dll"],
"win-cu101" : ["pytorch.properties", "djl_torch.dll"],
"linux-cu92" : ["pytorch.properties", "libdjl_torch.so"],
"linux-cu101" : ["pytorch.properties", "libdjl_torch.so"],
"osx-cpu" : ["pytorch.properties", "libdjl_torch.dylib"],
"win-cpu" : ["pytorch.properties", "djl_torch.dll"],
]
def classesDir = "${project.buildDir}/classes/java/main/jnilib"
files.each { entry ->
def nameList = entry.key.split("-")
def flavor = nameList[1]
def classifier = "${nameList[0]}-x86_64"
entry.value.each { name ->
def downloadPath = new URL("${url}/${classifier}/${flavor}/${name}")
def file = file("${classesDir}/${classifier}/${flavor}/${name}")
if (!file.exists()) {
project.logger.lifecycle("${url}/${classifier}/${flavor}/${name}")
file.getParentFile().mkdirs()
downloadPath.withInputStream { i -> file.withOutputStream { it << i } }
}
}
}
}
}
test {
environment "PATH", "src/test/bin:${environment.PATH}"
}
publishing {
publications {
maven(MavenPublication) {
pom {
name = "PyTorch Engine Adapter"
description = "PyTorch Engine Adapter for DJL"
url = "http://www.djl.ai/pytorch/${project.name}"
}
}
}
}