forked from grpc-ecosystem/grpc-spring
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
185 lines (161 loc) · 5.84 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
178
179
180
181
182
183
184
185
import java.time.OffsetDateTime
import java.time.format.DateTimeFormatter
buildscript {
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven { url 'http://repo.spring.io/plugins-release' }
maven { url "https://plugins.gradle.org/m2/" }
}
ext {
projectVersion = '2.3.0-SNAPSHOT'
grpcVersion = '1.17.1'
protobufVersion = '3.6.1'
protobufGradlePluginVersion = '0.8.7'
nettyTCNativeVersion = '2.0.17.Final' // Needs to be compatbile with the 'grpcVersion'
springBootVersion = '2.0.7.RELEASE'
springCloudVersion = 'Finchley.SR2' // Only used in examples
springCloudSleuthVersion = '2.0.2.RELEASE'
springCloudConsulVersion = '2.0.1.RELEASE'
springCloudEurekaVersion = '2.0.2.RELEASE'
braveInstrumentationGrpc = '5.5.0'
jUnitVersion = '5.3.1'
lombokVersion = '1.18.4'
}
dependencies {
classpath "io.spring.gradle:dependency-management-plugin:1.0.6.RELEASE"
classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
classpath "com.diffplug.spotless:spotless-plugin-gradle:3.16.0"
}
}
plugins {
id "net.nemerosa.versioning" version "2.8.2"
}
wrapper {
gradleVersion = '5.0'
}
def buildTimeAndDate = OffsetDateTime.now()
ext {
buildDate = DateTimeFormatter.ISO_LOCAL_DATE.format(buildTimeAndDate)
buildTime = DateTimeFormatter.ofPattern('HH:mm:ss.SSSZ').format(buildTimeAndDate)
buildRevision = versioning.info.commit
}
allprojects {
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: "io.spring.dependency-management"
apply plugin: 'com.diffplug.gradle.spotless'
compileJava {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
options.encoding = 'UTF-8'
}
compileJava.options*.compilerArgs = [
"-Xlint:all", "-Xlint:-cast", "-Xlint:-processing"
]
spotless {
java {
licenseHeaderFile rootProject.file('extra/spotless/mit-license.java')
removeUnusedImports()
importOrderFile rootProject.file('extra/eclipse/eclipse.importorder')
eclipse().configFile rootProject.file('extra/eclipse/eclipse-formatter.xml')
}
format("misc") {
target("**/*.gradle", "**/*.md", "**/*.yml")
trimTrailingWhitespace()
endWithNewline()
}
}
// Enable Checkstyle
if (null != System.getenv('ENABLE_CHECKSTYLE')) {
apply plugin: 'checkstyle'
checkstyle {
toolVersion '8.14'
configFile new File(rootDir, "extra/checkstyle/checkstyle.xml")
showViolations true
}
}
// Copy LICENSE
tasks.withType(Jar) {
from(project.rootDir) {
include 'LICENSE'
into 'META-INF'
}
}
// Generate MANIFEST.MF
jar {
manifest {
attributes(
'Created-By': "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']})".toString(),
'Built-By': "travis",
'Build-Date': buildDate,
'Build-Time': buildTime,
'Built-OS': "${System.properties['os.name']}",
'Build-Revision': buildRevision,
'Specification-Title': project.name,
'Specification-Version': "${projectVersion}",
'Specification-Vendor': 'Michael Zhang',
'Implementation-Title': project.name,
'Implementation-Version': "${projectVersion}",
'Implementation-Vendor': 'Michael Zhang'
)
}
}
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven { url 'http://repo.spring.io/plugins-release' }
maven { url "https://plugins.gradle.org/m2/" }
maven { url 'https://repo.spring.io/libs-milestone' }
}
dependencies {
compileOnly("org.projectlombok:lombok:${lombokVersion}")
testCompileOnly("org.projectlombok:lombok:${lombokVersion}")
annotationProcessor("org.projectlombok:lombok:${lombokVersion}")
testAnnotationProcessor("org.projectlombok:lombok:${lombokVersion}")
}
buildscript {
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven { url 'http://repo.spring.io/plugins-release' }
maven { url "https://plugins.gradle.org/m2/" }
}
}
}
allprojects { project ->
if (!project.parent || project.parent.name != "examples") {
buildscript {
dependencyManagement {
imports {
mavenBom "org.springframework.boot:spring-boot-starter-parent:${springBootVersion}"
}
}
ext {
springFrameworkVersion = dependencyManagement.importedProperties['spring.version']
springSecurityVersion = dependencyManagement.importedProperties['spring-security.version']
}
}
tasks.withType(Javadoc) {
def links = [
'https://docs.oracle.com/javase/8/docs/api/',
'https://grpc.io/grpc-java/javadoc/',
'https://docs.spring.io/spring-framework/docs/' + springFrameworkVersion + '/javadoc-api/',
'https://docs.spring.io/spring-security/site/docs/' + springSecurityVersion + '/api/'
]
options.setLinks(links)
}
}
}
apply from: './deploy.gradle'
group = "net.devh"
version = "${projectVersion}"
dependencies {
compile project(':grpc-server-spring-boot-starter')
compile project(':grpc-client-spring-boot-starter')
testCompile project(':tests')
}