This repository has been archived by the owner on Apr 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 193
/
build.gradle
145 lines (132 loc) · 4.4 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
apply plugin: 'groovy'
apply plugin: 'org.springframework.boot'
apply plugin: 'spring-cloud-contract'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'maven-publish'
apply from: 'gradle/pipeline.gradle'
buildscript {
repositories {
mavenCentral()
mavenLocal()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
maven { url "https://repo.spring.io/release" }
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:2.0.3.RELEASE"
classpath "org.springframework.cloud:spring-cloud-contract-gradle-plugin:${project.hasProperty("scContractVersion") ? project.property("scContractVersion") : "2.0.0.RELEASE"}"
}
}
group = 'com.example.github'
version = getProp('newVersion') ?: '0.0.1-SNAPSHOT'
ext {
projectGroupId = project.group
projectArtifactId = project.name
projectVersion = project.version
// due to CF multiport binding issues we need to hardcode the values
stubrunnerIds = 'com.example.github:github-webhook:+:stubs:10000'
}
repositories {
mavenCentral()
mavenLocal()
if (getProp("M2_LOCAL")) {
maven {
url getProp("M2_LOCAL")
}
}
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
maven { url "https://repo.spring.io/release" }
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:$BOM_VERSION"
}
}
if (gradle.startParameter.taskRequests.any { it.args.contains("apiCompatibility") }) {
contracts {
baseClassForTests = 'org.springframework.github.BaseClass'
basePackageForTests = 'com.example.contracttests'
contractsPath = "/"
contractsSnapshotCheckSkip = true
contractRepository {
repositoryUrl(getProp('REPO_WITH_JARS') ?:
getProp('REPO_WITH_BINARIES') ?: 'http://localhost:8081/artifactory/libs-release-local')
}
setContractsMode("REMOTE")
contractDependency {
groupId = project.group
artifactId = project.name
delegate.classifier = "stubs"
delegate.version = getProp("latestProductionVersion")
}
}
} else {
contracts {
baseClassForTests = 'org.springframework.github.BaseClass'
basePackageForTests = 'com.example.contracttests'
contractsSnapshotCheckSkip = true
}
}
dependencies {
compile('org.springframework.analytics:spring-analytics:1.0.0.RELEASE')
compile('org.springframework.cloud:spring-cloud-starter-netflix-eureka-client')
compile('org.hibernate:hibernate-validator:6.0.9.Final')
compile('org.springframework.cloud:spring-cloud-starter-stream-rabbit')
compile('org.springframework.boot:spring-boot-starter-actuator')
compile('org.flywaydb:flyway-core')
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-web')
compile('com.h2database:h2')
compile('mysql:mysql-connector-java')
compile('io.micrometer:micrometer-registry-prometheus:1.0.3')
compile('org.springframework.boot:spring-boot-starter-cloud-connectors')
testCompile('org.springframework.cloud:spring-cloud-starter-contract-stub-runner')
testCompile('org.springframework.cloud:spring-cloud-stream-test-support')
testCompile('org.springframework.cloud:spring-cloud-starter-contract-verifier')
testCompile('org.awaitility:awaitility:3.1.0')
}
publishing {
repositories {
maven {
url getProp('REPO_WITH_BINARIES_FOR_UPLOAD') ?:
getProp('REPO_WITH_BINARIES') ?: 'http://localhost:8081/artifactory/libs-release-local'
credentials {
username getProp('M2_SETTINGS_REPO_USERNAME') ?: 'admin'
password getProp('M2_SETTINGS_REPO_PASSWORD') ?: 'password'
}
}
}
publications {
mavenJava(MavenPublication) {
artifactId project.name
from components.java
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = '4.7'
}
String getProp(String propName) {
return hasProperty(propName) ?
(getProperty(propName) ?: System.properties[propName]) : System.properties[propName] ?:
System.getenv(propName)
}
// Fail if no tests are executed
allprojects {
afterEvaluate {
tasks.withType(Test) {
it.testLogging {
exceptionFormat = 'full'
afterSuite { desc, result ->
if (!desc.parent) {
println "Results: (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)"
if (result.testCount == 0) {
throw new IllegalStateException("No tests were found. Failing the build")
}
}
}
}
}
}
}