-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
170 lines (143 loc) · 4.94 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
/*
* EvilMusic - Web-Based Music Player
* Copyright (C) 2016 Joe Falascino
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/////////////
// Plugins //
/////////////
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'eclipse'
apply plugin: 'spring-boot'
apply plugin: 'org.junit.gen5.gradle'
//////////////
// Settings //
//////////////
// Sets the Java source version to Java v1.8
sourceCompatibility = '1.8'
// The current version of EvilMusic
version = '0.1.0'
// Allows Tomcat to be debuged
applicationDefaultJvmArgs = ["-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000"]
// Can be populated with the EvilMusic properties file that will be used instead of the default one.
def configFile = null;
// Sets the embedded Tomcat version
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.apache.tomcat.embed') {
details.useVersion '8.0.15'
}
}
}
/////////////////
// Source Sets //
/////////////////
sourceSets {
intTest {
java.srcDir file('src/inttest/java')
resources.srcDir file('src/inttest/resources')
}
}
/////////////////////////////////
// Repositories & Dependencies //
/////////////////////////////////
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
compile 'org.springframework.boot:spring-boot-starter-web:1.1.8.RELEASE'
compile 'org.springframework.boot:spring-boot-starter-data-jpa:1.1.8.RELEASE'
compile 'org.springframework.boot:spring-boot-autoconfigure:1.1.8.RELEASE'
compile 'javax.ws.rs:javax.ws.rs-api:2.0.1'
compile 'org.glassfish.jersey.core:jersey-common:2.22.2'
compile 'org.apache.derby:derby:10.11.1.1'
compile 'org.hibernate:hibernate-entitymanager:4.3.6.Final'
compile 'commons-cli:commons-cli:1.2'
testCompile 'org.junit:junit5-api:5.0.0-ALPHA'
testCompile 'org.junit:junit-console:5.0.0-ALPHA'
testRuntime 'org.junit:junit5-engine:5.0.0-ALPHA'
testCompile 'org.easymock:easymock:3.2'
testCompile 'com.jayway.restassured:rest-assured:2.4.0'
intTestCompile sourceSets.main.output
intTestCompile sourceSets.test.output
intTestCompile configurations.testCompile
intTestRuntime configurations.testRuntime
intTestCompile 'org.junit:junit5-api:5.0.0-ALPHA'
intTestCompile 'org.junit:junit-console:5.0.0-ALPHA'
intTestRuntime 'org.junit:junit5-engine:5.0.0-ALPHA'
intTestCompile 'org.easymock:easymock:3.2'
intTestCompile 'com.jayway.restassured:rest-assured:2.4.0'
}
//////////////////////
// Plugin Functions //
//////////////////////
/* Necessary for the spring-boot plugin. */
buildscript {
repositories {
maven { url "http://repo.spring.io/libs-release" }
mavenLocal()
mavenCentral()
}
dependencies {
classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.1.8.RELEASE' // Necessary For Spring Boot
classpath 'org.junit:junit-gradle:5.0.0-ALPHA' // Necessary For JUnit5
}
}
///////////
// Tasks //
///////////
/* Integration Test Task */
task intTest(type: Test) {
testClassesDir = sourceSets.intTest.output.classesDir
classpath = sourceSets.intTest.runtimeClasspath
gradle.taskGraph.whenReady {
if (gradle.taskGraph.hasTask(":intTest")) {
sourceSets {
test {
java.srcDir file('src/inttest/java')
resources.srcDir file('src/inttest/resources')
}
}
}
}
dependsOn 'test'
}
/* Configures the "bootRun" task to start EvilMusic with the development test properties file. */
task configDev {
doFirst { configFile = 'config/dev.properties' }
}
/* Configures the "bootRun" task to start EvilMusic with the integration test properties file. */
task configIntTest {
doFirst { configFile = 'config/int-test.properties' }
}
/* Creates a task that will start Spring Boot after configuring using the integration test properties file. */
task bootRunIntTest {
dependsOn 'configIntTest', 'bootRun'
}
/* Creates a task that will start Spring Boot after configuring using the development properties file. */
task bootRunDev {
dependsOn 'configDev', 'bootRun'
}
bootRun {
mustRunAfter 'configDev'
mustRunAfter 'configIntTest'
doFirst {
if(configFile != null) {
args '--emproperties', configFile
}
}
}