forked from OpenLMIS/openlmis-auth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
162 lines (141 loc) · 4.81 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
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:1.3.3.RELEASE"
}
}
plugins {
id "org.flywaydb.flyway" version "4.0"
id "org.sonarqube" version "2.0.1"
}
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'checkstyle'
apply plugin: 'jacoco'
apply plugin: 'pmd'
jar {
baseName = 'openlmis-auth'
version = '0.0.1'
}
repositories {
mavenCentral()
jcenter()
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile "org.springframework.boot:spring-boot-starter-web"
compile "org.springframework.boot:spring-boot-starter-security"
compile "org.springframework.boot:spring-boot-starter-data-rest"
compile "org.projectlombok:lombok:1.16.8"
compile "org.springframework.boot:spring-boot-starter-data-jpa"
compile "org.postgresql:postgresql:9.4.1208"
compile "org.springframework.boot:spring-boot-starter-integration"
compile "org.springframework.integration:spring-integration-jdbc"
compile "com.github.tomakehurst:wiremock:1.58"
compile "org.springframework:spring-test"
compile "org.springframework.boot:spring-boot-starter-security"
compile "org.springframework.security.oauth:spring-security-oauth2"
testCompile "junit:junit"
testCompile "org.mockito:mockito-core:1.+"
}
flyway {
url = "$System.env.DATABASE_URL"
user = "$System.env.POSTGRES_USER"
password = "$System.env.POSTGRES_PASSWORD"
schemas = ['public']
sqlMigrationPrefix = ''
placeholderPrefix = '#['
placeholderSuffix = ']'
}
sourceSets {
integrationTest {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/integration-test/java')
}
resources.srcDir file('src/integration-test/resources')
}
}
configurations {
integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime
}
task integrationTest(type: Test) {
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = sourceSets.integrationTest.runtimeClasspath
testLogging {
events "passed", "skipped", "failed"
}
}
check.dependsOn integrationTest
integrationTest.mustRunAfter test
tasks.withType(Test) {
reports.html.destination = file("${reporting.baseDir}/${name}")
reports.junitXml.destination = file("${testResultsDir}/${name}")
}
// Usage: gradle generateMigration [-PmigrationName=name_of_migration]
// Defaults to 'migration' as migration name
// Example: gradle generateMigration -PmigrationName=add_column_to_users
// Will create a file in migration folder with name yyyyMMddHHmmssSSS_add_column_to_users.sql.
task generateMigration << {
description 'Creates an empty new file within the src/main/resources/db/migration directory into which developers can add new SQL migration code.'
def fileName = project.hasProperty('migrationName') ? migrationName : 'migration'
def timestamp = new Date().format('yyyyMMddHHmmssSSS', TimeZone.getTimeZone('GMT'))
def fullFileName = "${timestamp}__${fileName}.sql"
def migrationFile = new File(sourceSets.main.resources.srcDirs.first(),'db/migration/'+fullFileName)
migrationFile.createNewFile()
}
test {
testLogging {
events 'started', 'passed'
}
}
jacocoTestReport {
group = "reporting"
description = "Generate Jacoco coverage reports after running tests."
reports {
xml.enabled false
html.enabled true
csv.enabled false
}
additionalSourceDirs = files(sourceSets.main.allJava.srcDirs)
}
checkstyle {
toolVersion = "6.19"
}
//Usage: gradle sonarqube
sonarqube {
properties {
property "sonar.projectName", "OpenLMIS Auth Service"
property "sonar.projectKey", "org.sonarqube:openlmis-auth"
property "sonar.host.url", "http://sonar.openlmis.org"
property "sonar.java.coveragePlugin", "jacoco"
//Tells SonarQube where the unit tests execution reports are
property "sonar.junit.reportsPath", "build/test-results/test"
//Tells SonarQube where the unit tests code coverage report is
property "sonar.jacoco.reportPath", "build/jacoco/test.exec"
//Tells SonarQube where the integration tests code coverage report is
property "sonar.jacoco.itReportPath", "build/jacoco/integrationTest.exec"
}
}
build.dependsOn jacocoTestReport
// Makes sure checkstyle is run before build completes
build.dependsOn check
pmd {
toolVersion = '5.4.0'
consoleOutput= true
ignoreFailures = false
ruleSetFiles = files("config/pmd/ruleset.xml")
reportsDir = file("build/reports/pmd")
}
tasks.withType(Pmd){
reports {
xml.enabled true
html.enabled true
}
}