-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
91 lines (79 loc) · 2.36 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
buildscript {
ext {
springBootVersion = '1.5.3.RELEASE'
}
repositories {
mavenCentral()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath('se.transmode.gradle:gradle-docker:1.2')
classpath "gradle.plugin.com.palantir:jacoco-coverage:0.4.0"
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'docker'
apply plugin: 'com.palantir.jacoco-full-report'
group = 'mattcopas'
version = '0.0.13'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
docker {
baseImage "frolvlad/alpine-oraclejdk8:slim"
maintainer "Matt Copas"
}
task buildDocker(type: Docker, dependsOn: build) {
push = false
applicationName = jar.baseName
volume("/tmp")
addFile("${jar.baseName}-${project.version}.jar", "app.jar")
runCommand("sh -c 'touch /app.jar'")
exposePort(8081)
entryPoint([ "sh", "-c", "java -Djava.security.egd=file:/dev/./urandom -Dspring.profiles.active=docker -jar /app.jar" ])
doFirst {
copy {
from jar
into stageDir
}
}
}
task incrementPatchVersion << {
def version = buildFile.getText().find(version)
String minorString = version.substring(version.lastIndexOf('.')+1, version.length())
int newPatch = minorString.toInteger()+1
String majorAndMinor = version.substring(0,3)
String newVersion = majorAndMinor + '.' + newPatch
String newBuildFileText = buildFile.getText().replaceFirst("version = '$version'","version = '" + newVersion + "'")
buildFile.setText(newBuildFileText)
}
bootRun {
systemProperty('spring.profiles.active', 'tdd')
}
jacocoTestReport {
reports {
xml.enabled = false
csv.enabled = false
html.enabled = true
}
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-data-rest')
compile('org.springframework.boot:spring-boot-starter-security')
compile('org.springframework.security.oauth:spring-security-oauth2')
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1'
runtime('com.h2database:h2')
runtime('org.postgresql:postgresql')
testCompile('org.springframework.boot:spring-boot-starter-test')
// https://mvnrepository.com/artifact/joda-time/joda-time
compile group: 'joda-time', name: 'joda-time', version: '2.3'
}