-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
181 lines (150 loc) · 5.6 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
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.apache.ivy:ivy:2.3.0'
}
}
plugins {
id 'java'
id 'application'
id "de.undercouch.download" version "3.3.0"
id 'io.franzbecker.gradle-lombok' version '1.11'
id 'org.openjfx.javafxplugin' version '0.0.8'
id 'org.beryx.runtime' version '1.7.0'
id "com.github.johnrengelman.shadow" version "4.0.4"
}
sourceCompatibility = "1.12"
targetCompatibility = "1.12"
ext.os = org.gradle.internal.os.OperatingSystem.current()
applicationDefaultJvmArgs = ["-Djava.library.path=asio"]
mainClassName = "io.thoughtworksarts.riot.Launcher"
repositories {
jcenter()
}
javafx {
version = "12"
modules = ['javafx.controls', 'javafx.media', 'javafx.swing']
}
test {
useJUnitPlatform()
def canonicalPathToLib = new File('asio/').getCanonicalPath();
systemProperty 'java.library.path', "$canonicalPathToLib"
}
import de.undercouch.gradle.tasks.download.Download
def downloads = [
[name: 'AsioHost', dest: 'asio/JAsioHost.jar',
url : 'https://github.com/mhroth/jasiohost/raw/master/JAsioHost.jar'],
[name: 'AsioHostDll', dest: 'asio/jasiohost64.dll',
url : 'https://github.com/mhroth/jasiohost/raw/master/jasiohost64.dll'],
[name: 'AsioForAllInstaller', dest: 'asio/ASIO4ALL_2_13_English.exe',
url : 'http://tippach.business.t-online.de/asio4all/downloads_11/ASIO4ALL_2_13_English.exe']
]
downloads.each {
def file = it.get('name')
def url = it.get('url')
def destination = it.get('dest')
task "download$file"(type: Download) {
src url
dest destination
overwrite false
}
}
compileJava.dependsOn tasks.withType(Download)
//create a single Jar with all dependencies
task fatJar(type: Jar) {
manifest {
attributes 'Main-Class': mainClassName
}
baseName = project.name
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
dependencies {
compile files('asio/JAsioHost.jar')
compile 'com.github.sarxos:webcam-capture:0.3.11'
compile 'com.fasterxml.jackson.core:jackson-databind:2.2.3'
compile 'org.slf4j:slf4j-api:1.7.+'
compile 'ch.qos.logback:logback-classic:1.0.13'
compile 'com.github.sarxos:webcam-capture:0.3.11'
compile 'org.deeplearning4j:deeplearning4j-core:1.0.0-beta4'
compile 'org.deeplearning4j:deeplearning4j-modelimport:1.0.0-beta4'
compile 'org.nd4j:nd4j-native-platform:1.0.0-beta4'
compile 'org.nd4j:nd4j-api:1.0.0-beta4'
compileOnly 'org.projectlombok:lombok:1.18.8'
annotationProcessor 'org.projectlombok:lombok:1.18.8'
testCompile 'org.mockito:mockito-core:2.+'
testCompile 'org.assertj:assertj-core:3.8.0'
testCompile 'org.junit.jupiter:junit-jupiter-api:5.0.2'
testCompile 'org.junit.jupiter:junit-jupiter-engine:5.0.2'
}
runtime {
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
modules = ['java.desktop', 'java.xml', 'jdk.unsupported', 'java.scripting', 'java.sql', 'java.naming', 'java.net.http']
jpackage {
if (Boolean.getBoolean('download.jpackage')) {
jpackageHome = downloadJPackage()
}
mainJar = "riot.jar"
imageName = "Perception.io"
imageOptions = ["--verbose", "--icon", project.layout.projectDirectory.file("src/main/resources/Icon.icns").toString() ]
installerName = "Perception.io"
installerOptions += '--verbose'
}
}
import java.nio.file.Files
import java.nio.file.StandardCopyOption
jpackageImage {
doLast {
def newFile = project.layout.buildDirectory.file("jpackage/Perception.io.app/Contents/Info.plist.new").get().asFile
def existingFile = project.layout.buildDirectory.file("jpackage/Perception.io.app/Contents/Info.plist").get().asFile
newFile.withWriter { w ->
existingFile.eachLine { line ->
if (line.contains("NSHighResolutionCapable")) {
w << " <key>NSCameraUsageDescription</key>\n"
w << " <string>Perception.io uses the camera to analyze your emotions</string>\n"
}
w << line + "\n"
}
}
Files.move(newFile.toPath(), existingFile.toPath(), StandardCopyOption.REPLACE_EXISTING)
}
}
String[] getJPackageCoordinates() {
if (os.macOsX) return [
'https://download.java.net/java/early_access/jpackage/1/openjdk-14-jpackage+1-49_osx-x64_bin.tar.gz',
'tar.gz',
'jdk-14.jdk/Contents/Home'
]
if (os.windows) return [
'https://download.java.net/java/early_access/jpackage/1/openjdk-14-jpackage+1-49_windows-x64_bin.zip',
'zip',
'jdk-14'
]
return [
'https://download.java.net/java/early_access/jpackage/1/openjdk-14-jpackage+1-49_linux-x64_bin.tar.gz',
'tar.gz',
'jdk-14'
]
}
String downloadJPackage() {
def (url, extension, directory) = getJPackageCoordinates()
def downloadDir = "$buildDir/download"
tasks.jpackageImage.doFirst {
def execExt = os.windows ? '.exe' : ''
if (!file("$downloadDir/$directory/bin/jpackage$execExt").file) {
def jdkArchivePath = "$downloadDir/jdk-jpackage.$extension"
download {
src url
dest jdkArchivePath
overwrite false
}
copy {
from((extension == 'tar.gz') ? tarTree(resources.gzip(jdkArchivePath)) : zipTree(jdkArchivePath))
into downloadDir
}
}
}
return "$downloadDir/$directory"
}