forked from openmastery/ideaflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
177 lines (147 loc) · 5.25 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
buildscript {
ext {
springBootVersion = "1.3.5.RELEASE"
commonRestVersion = "2.0-om.5"
}
repositories {
jcenter()
maven {
url "https://dl.bintray.com/openmastery/maven"
}
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath "com.bancvue:gradle-core:1.4-om.0"
classpath "net.jokubasdargis.buildtimer:gradle-plugin:0.1.1"
}
}
plugins {
id 'org.detoeuf.swagger-codegen' version '1.6.3'
}
apply plugin: "com.bancvue.core-oss"
apply plugin: "com.bancvue.maven-publish-ext"
apply plugin: "spring-boot"
apply plugin: "net.jokubasdargis.build-timer"
repositories {
mavenLocal()
jcenter()
maven {
url "https://dl.bintray.com/openmastery/maven"
}
}
configurations {
client
doclet {
extendsFrom compile
}
}
sourceSets {
client {
java {
srcDir "src/main/java"
include "org/openmastery/rest/**"
include "org/openmastery/publisher/api/**"
include "org/openmastery/publisher/client/**"
include "org/openmastery/storyweb/api/**"
include "org/openmastery/storyweb/client/**"
}
}
}
dependencies {
compile "org.springframework.boot:spring-boot-starter-web"
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-starter-jersey"
compile "org.codehaus.groovy:groovy-all:2.4.3"
compile "com.bancvue:common-rest:${commonRestVersion}"
compile 'joda-time:joda-time:2.9.4'
compile 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.7.5'
compile("net.sf.dozer:dozer:5.5.1") {
exclude group: "org.slf4j"
}
compile "org.springframework.boot:spring-boot-starter-data-jpa"
compile "postgresql:postgresql:9.0-801.jdbc4"
compile "org.liquibase:liquibase-core"
// Utilities
compile "com.google.guava:guava:18.0"
compile "org.projectlombok:lombok:1.16.4"
clientCompile "com.bancvue:common-rest-client:${commonRestVersion}"
clientCompile "org.projectlombok:lombok:1.16.4"
mainTestCompile 'com.thedeanda:lorem:2.0'
mainTestCompile "org.fluttercode.datafactory:datafactory:0.8"
mainTestCompile("org.spockframework:spock-spring:1.0-groovy-2.4") {
exclude group: "org.codehaus.groovy"
}
testCompile "org.codehaus.groovy.modules.http-builder:http-builder:0.7.1"
testCompile "org.springframework.boot:spring-boot-starter-test"
testCompile "commons-io:commons-io:2.4"
testCompile "cglib:cglib-nodep:3.2.0"
doclet 'com.tenxerconsulting:swagger-doclet:1.1.3'
doclet 'javax.ws.rs:javax.ws.rs-api:2.0'
}
sourceSets.main.java.srcDirs = []
sourceSets.main.groovy.srcDirs += ["src/main/java"]
compileClientJava {
sourceCompatibility = 1.6
targetCompatibility = 1.6
}
publishing_ext {
publication('client')
}
license {
sourceSets = sourceSets.matching { it.name == "main" }
excludes(["**/*.properties", "**/*.xml", "db/**", "licenses/**", "static/**"])
excludes(["org/openmastery/rest/**", "org/openmastery/publisher/api/**", "org/openmastery/publisher/client/**",
"org/openmastery/storyweb/api/**", "org/openmastery/storyweb/client/**"])
}
task pullPostgres(type: Exec) {
commandLine "docker pull postgres:9.5.5".split(/\s+/)
}
task removePostgres(type: Exec) {
commandLine "docker rm -f postgres".split(/\s+/)
ignoreExitValue true
}
task createPostgres(type: Exec) {
commandLine 'docker create --name=postgres --publish=5432:5432 --env="POSTGRES_USER=postgres" --env="POSTGRES_PASSWORD=postgres" postgres:9.5.5'.split(/\s+/)
mustRunAfter pullPostgres, removePostgres
}
task startPostgres(type: Exec) {
commandLine "docker start postgres".split(/\s+/)
mustRunAfter createPostgres
}
task waitForPostgresInitialization(dependsOn: startPostgres) << {
Thread.sleep(5000)
}
task createApplicationDatabase(type: Exec, dependsOn: waitForPostgresInitialization) {
commandLine 'docker', 'exec', 'postgres', 'createdb', '-U', 'postgres', "ideaflow"
// subsequent creates will result in failure
ignoreExitValue true
}
task createTestDatabase(type: Exec, dependsOn: waitForPostgresInitialization) {
commandLine 'docker', 'exec', 'postgres', 'createdb', '-U', 'postgres', "ideaflow-test"
// subsequent creates will result in failure
ignoreExitValue true
}
task refreshPostgres(dependsOn: [removePostgres, createPostgres, startPostgres, createApplicationDatabase, createTestDatabase])
task setSkipTestsTrue << {
project.ext.skipTests = true
}
test.onlyIf { project.hasProperty("skipTests") == false }
test.mustRunAfter setSkipTestsTrue
componentTest.onlyIf { project.hasProperty("skipTests") == false }
componentTest.mustRunAfter setSkipTestsTrue
task stage {
dependsOn setSkipTestsTrue, build
}
task generateRestApiDocs(type: Javadoc, dependsOn: [compileJava, compileGroovy]) {
source = sourceSets.main.allJava
destinationDir = file('build/resources/main/static/api-json')
options.classpath = configurations.doclet.files.asType(List) + sourceSets.main.output.files.asType(List)
options.docletpath = configurations.doclet.files.asType(List) + sourceSets.main.output.files.asType(List)
options.doclet = "com.tenxerconsulting.swagger.doclet.ServiceDoclet"
options.addStringOption("apiVersion", "1")
options.addStringOption("docBasePath", "/s/api-json")
options.addStringOption("apiBasePath", "/")
options.addBooleanOption("skipUiFiles", true)
options.addStringOption("stringTypePrefixes", "java.net.URI")
}
processResources.dependsOn(generateRestApiDocs)