-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
166 lines (144 loc) · 4.22 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
buildscript {
repositories {
maven {
url 'https://plugins.gradle.org/m2/'
}
}
dependencies {
classpath 'gradle.plugin.com.github.spotbugs:gradlePlugin:1.6.0'
classpath 'net.researchgate:gradle-release:2.8.1'
}
}
apply plugin: 'com.github.spotbugs'
// apply plugin: 'checkstyle'
apply plugin: 'jacoco'
apply plugin: 'java-library'
apply plugin: 'maven'
apply plugin: 'net.researchgate.release'
apply plugin: 'signing'
repositories {
jcenter()
}
dependencies {
// This dependency is exported to consumers, that is to say found on their compile classpath.
// api 'org.apache.commons:commons-math3:3.6.1'
// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation 'com.fasterxml.jackson.core:jackson-databind:2.11.0'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.11.0'
implementation 'org.glassfish.jersey.core:jersey-client:2.31'
// Use JUnit test framework
testImplementation 'junit:junit:4.13'
testImplementation 'org.mockito:mockito-core:3.3.3'
}
jacocoTestReport {
reports {
xml.enabled true
csv.enabled false
html.enabled true
}
}
// Enforce code coverage metrics
jacocoTestCoverageVerification {
violationRules {
rule {
element = 'CLASS'
excludes = ['io.github.rishikeshdarandale.aws.http.AbstractRequest']
limit {
counter = 'LINE'
minimum = 0.8
}
}
rule {
element = 'CLASS'
excludes = ['io.github.rishikeshdarandale.aws.http.AbstractRequest']
limit {
counter = 'BRANCH'
minimum = 0.8
}
}
}
}
// invoke the coverage verification during check phase
check.dependsOn jacocoTestCoverageVerification
// Create a jar with javadoc
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
// Create a jar with soruces
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
// hook all the artifacts under artifacts task
artifacts {
archives javadocJar, sourcesJar
}
// Signing task
signing {
sign configurations.archives
}
/*
* Upload the archives to the OSS Sonatype
*
* To upload the archives, need to set following properties in ~/.gradle/gradle.properties
* ------------------------------------------------
* signing.keyId=YourKeyId
* signing.password=YourPublicKeyPassword
* signing.secretKeyRingFile=PathToYourKeyRingFile
* ossrhUsername=your-jira-id
* ossrhPassword=your-jira-password
* ------------------------------------------------
*/
def v_ossrhUsername="FOO"
def v_ossrhPassword="BAR"
if (project.hasProperty("ossrhUsername")) {
v_ossrhUsername = ossrhUsername
}
if (project.hasProperty("ossrhPassword")) {
v_ossrhPassword = ossrhPassword
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: v_ossrhUsername, password: v_ossrhPassword)
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: v_ossrhUsername, password: v_ossrhPassword)
}
pom.project {
name 'aws-http'
packaging 'jar'
artifactId archivesBaseName
version version
description 'A fluent http client library for aws'
url 'https://rishikeshdarandale.github.io/aws-http/'
scm {
connection 'scm:git:git://github.com/rishikeshdarandale/aws-http.git'
developerConnection 'scm:git:git@github.com:rishikeshdarandale/aws-http.git'
url 'https://github.com/rishikeshdarandale/aws-http'
}
licenses {
license {
name 'MIT License'
url 'http://www.opensource.org/licenses/mit-license.php'
}
}
developers {
developer {
id 'rishikeshdarandale'
name 'Rishikesh Darandale'
email 'rishikesh.darandale@gmail.com'
url 'https://rishikeshdarandale.github.io'
}
}
}
}
}
}
/*
* For each release, push the released artifacts to OSS sonatype
*/
afterReleaseBuild.dependsOn uploadArchives