-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
100 lines (82 loc) · 2.56 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
import org.apache.tools.ant.taskdefs.condition.Os
apply plugin: 'java'
apply plugin: 'application'
group 'sox'
version '1.0-SNAPSHOT'
mainClassName = "com.sox.server.SoxServer"
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile 'org.glassfish.jersey.containers:jersey-container-jdk-http:2.29.1'
compile 'org.glassfish.jersey.core:jersey-server:2.29.1'
compile 'org.glassfish.jersey.core:jersey-server:2.29.1'
compile 'org.glassfish.jersey.media:jersey-media-multipart:2.29.1'
compile 'org.glassfish.jersey.inject:jersey-hk2:2.29.1'
compile 'org.glassfish.jaxb:jaxb-runtime:2.3.1'
compile 'javax.xml.bind:jaxb-api:2.3.0'
compile 'com.google.api-client:google-api-client:1.30.5'
compile 'com.google.guava:guava:11.0.2'
compile 'com.google.code.gson:gson:2.8.6'
compile 'ch.qos.logback:logback-classic:1.2.3'
compile 'org.apache.poi:poi:3.17'
compile 'org.apache.poi:poi-ooxml:3.17'
}
sourceSets {
main {
resources {
exclude '**/node_modules/**'
}
}
}
task frontend(type: Exec) {
workingDir 'src/main/resources/sox-ui'
if (Os.isFamily(Os.FAMILY_WINDOWS))
{
commandLine 'cmd', '/c', 'npm install'
commandLine 'cmd', '/c', 'npm run-script build'
}
else
{
commandLine 'sh', '-c', 'npm install'
commandLine 'sh', '-c', 'npm run-script build'
}
}
task generateScripts(dependsOn:"jar") {
doLast {
def binDir = new File("$rootDir/bin")
binDir.mkdirs();
def osName = System.getProperty("os.name").toLowerCase()
def lines
def ext
if (osName.contains("windows")) {
ext = "bat"
} else {
ext = "sh"
}
def scriptFile = new File("$binDir/${projectDir.name}.$ext")
def classPath = configurations.runtime.resolve()
classPath += jar.archivePath
classPath += sourceSets.main.output.resourcesDir
def classPathStr = classPath.join(File.pathSeparator)
print osName
if (osName.contains("windows")) {
lines = [
"@echo off",
"",
" java -cp $classPathStr $mainClassName %*"
]
} else {
lines = [
"#!/bin/bash",
"",
" java -cp $classPathStr $mainClassName \$@"
]
}
scriptFile.write(lines.join("\n"))
scriptFile.setExecutable(true)
}
}
build.dependsOn("generateScripts")
build.dependsOn("frontend")