This repository has been archived by the owner on Nov 6, 2019. It is now read-only.
forked from MOERobotics/stronghold-pi-2016
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
110 lines (93 loc) · 2.39 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
plugins {
// Apply the java plugin to add support for Java
id 'java'
// Apply the application plugin to add support for building an application
id 'application'
// Eclipse
id 'eclipse'
// Shadow JAR
id 'com.github.johnrengelman.shadow' version '4.0.3'
}
def projectName = 'MoePi'
mainClassName = 'com.moe365.moepi.Main'
def outputDirectory = file("${rootDir}/output")
def nativesLocation = "$buildDir/native"
def v4l4jLocation = "libs/native"
repositories {
mavenCentral()
maven {
url "https://oss.sonatype.org/content/groups/public"
}
flatDir {
dirs 'libs', 'libs/jetty'
}
}
dependencies {
compile 'com.pi4j:pi4j-core:1.2-SNAPSHOT'
compile name: 'v4l4j'
compile name: 'jetty-http-9.4.1.v20170120'
compile name: 'jetty-io-9.4.1.v20170120'
compile name: 'jetty-security-9.4.1.v20170120'
compile name: 'jetty-server-9.4.1.v20170120'
compile name: 'jetty-servlet-9.4.1.v20170120'
compile name: 'jetty-util-9.4.1.v20170120'
compile name: 'servlet-api-3.1'
compile name: 'websocket-api-9.4.1.v20170120'
compile name: 'websocket-common-9.4.1.v20170120'
compile name: 'websocket-server-9.4.1.v20170120'
compile name: 'websocket-servlet-9.4.1.v20170120'
}
jar {
baseName = projectName
}
shadowJar {
baseName = projectName
}
distributions {
main {
baseName = projectName
contents {
from (nativesLocation) {
exclude 'META-INF'
exclude '**/MANIFEST.MF'
into 'bin/'
}
}
}
}
task copyV4l4J(type: Copy) {
description = 'Copies V4l4J Natives into nativesLocation'
from v4l4jLocation
into nativesLocation
}
task writeExecuteScript() {
dependsOn jar
doLast {
def runFile = new File("${buildDir}/run${projectName}")
runFile.setExecutable true
runFile.write "java -Djava.library.path=. -jar ${projectName}-all.jar --verbose"
}
}
task copyToOutput(type: Copy) {
dependsOn shadowJar
dependsOn copyV4l4J
dependsOn writeExecuteScript
destinationDir = outputDirectory
from (file(shadowJar.archivePath)) {
}
from (nativesLocation) {
exclude 'META-INF'
exclude '**/MANIFEST.MF'
}
from (v4l4jLocation) {
}
from (file("${buildDir}/run${projectName}")) {
}
}
sourceSets.main.java.srcDirs = ['src']
applicationDefaultJvmArgs = ["-Djava.library.path=${nativesLocation}"]
build.dependsOn copyToOutput
run.dependsOn copyV4l4J
clean {
delete outputDirectory
}