This repository has been archived by the owner on Sep 18, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle
178 lines (150 loc) · 4.75 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
/*
* Copyright (c) 2015, The MITRE Corporation. All rights reserved.
* See LICENSE for complete terms.
*
* Java-STIX-Validator Gradle Buildscript
*
* nemonik (Michael Joseph Walsh <[email protected]>)
*
* Running the valdiator locally at the default port:
*
* ./gradlew stage
* ./build/install/java-stix-validator/bin/java-stix-validator
*
* To change the port set an sytem environment vraible sorta like this:
*
* ./gradlew stage
* export PORT=9090
* ./build/install/java-stix-validator/bin/java-stix-validator
*
*/
apply plugin: 'java'
apply plugin: "groovy"
apply plugin: 'eclipse'
apply plugin:'application'
apply plugin: 'com.moowork.node'
mainClassName = 'org.mitre.stix.validator.App'
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.moowork.gradle:gradle-node-plugin:0.10'
}
}
node {
version = '0.12.4'
download = true
}
task npmCacheConfig(type: NpmTask) {
description = 'Configure the NPM cache'
def npmCacheDir = "${System.getProperty('user.home')}/caches/npm"
outputs.files file(npmCacheDir)
args = [ 'config', 'set', 'cache', npmCacheDir ]
}
task npmPackages(type: NpmTask) {
description = "Install Node.js packages"
args = [ 'install' ]
inputs.files file('package.json')
outputs.files file('node_modules')
}
task installBower(type: NodeTask, dependsOn: npmPackages) {
script = file('node_modules/bower/bin/bower')
args = ["--config.storage.cache=${System.getProperty('user.home')}/caches/bower/cache",
"--config.storage.packages=${System.getProperty('user.home')}/caches/bower/packages",
"--config.storage.registry=${System.getProperty('user.home')}/caches/bower/registry",
'install']
inputs.files file('bower.json')
outputs.files file('bower_components')
}
task syncJavascript(type: Sync, dependsOn: installBower) {
from 'bower_components'
into 'src/main/resources/public/js/bower_components'
include 'angular*/*.min.js*'
include 'ng-file-upload/*.min.js*'
include 'angular-spinner/angular-spinner.min.js*'
include 'angular-loading-spinner/angular-loading-spinner.js'
include 'spin.js/spin.js'
include 'angulartics/dist/angulartics.min.js'
include 'angulartics/dist/angulartics-ga.min.js'
exclude 'ng-file-upload/ng-file-upload-all.min.js'
}
task syncStylesheets(type: Sync, dependsOn: installBower) {
from 'bower_components'
into 'src/main/resources/public/css/bower_components'
include 'bootstrap/dist/css/*.min.css'
include 'bootstrap/dist/fonts/*'
include 'ng-file-upload/*.css'
}
processResources.dependsOn syncJavascript, syncStylesheets
clean.delete << file('src/main/resources/public/js/bower_components')
clean.delete << file('src/main/resources/public/css/bower_components')
clean.delete << file('node_modules')
clean.delete << file('bower_components')
repositories {
jcenter()
mavenCentral()
mavenLocal()
flatDir { dirs "libs" }
}
dependencies {
compile 'com.sparkjava:spark-core:2.2'
compile 'org.slf4j:slf4j-simple:1.7.12'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.fasterxml.jackson.core:jackson-databind:2.5.4'
compile 'org.springframework:spring-core:4.1.4.RELEASE'
compile 'commons-io:commons-io:2.4'
compile 'com.github.zafarkhaja:java-semver:0.9.0'
// or change to testCompile, and org.mitre.stix.validator.App fails to run in IDE
compile 'org.eclipse.jetty:jetty-server:9.0.2.v20130417'
compile 'org.eclipse.jetty:jetty-webapp:9.0.2.v20130417'
compile 'org.eclipse.jetty:jetty-util:9.0.2.v20130417'
testCompile('org.codehaus.groovy.modules.http-builder:http-builder:0.7.2') {
exclude module: 'groovy'
}
testCompile 'org.codehaus.groovy:groovy:2.4.3'
testCompile 'org.spockframework:spock-core:1.0-groovy-2.4'
//testRuntime 'org.seleniumhq.selenium:selenium-htmlunit-driver:2.46.0'
}
if (System.getProperty("exec.args")) {
port = System.getProperty("exec.args").split()[0]
}
task wrapper(type: Wrapper) {
gradleVersion = '2.4'
def jvmOpts='-Xmx1024m -Xms256m'
inputs.property("jvmOpts", jvmOpts)
doLast {
def optsEnvVar = "DEFAULT_JVM_OPTS"
scriptFile.write scriptFile.text.replace("$optsEnvVar=\"\"", "$optsEnvVar=\"$jvmOpts\"")
batchScript.write batchScript.text.replace("set $optsEnvVar=", "set $optsEnvVar=$jvmOpts")
}
}
task stage(dependsOn: installDist) {
}
task execute(type:JavaExec) {
main = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
}
tasks.withType(JavaCompile) {
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
}
sourceSets {
main {
java { srcDirs("src/main/java") }
resources {
srcDir("src/main/resources")
}
}
}
jar {
manifest {
attributes 'Specification-Title': 'Java Stix Validator',
'Specification-Version': version,
'Implementation-Title': 'Java-STIX-Validator',
'Implementation-Version': version,
'Implementation-Vendor': 'The MITRE Corporation'
}
from 'LICENSE'
}