This repository has been archived by the owner on Apr 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
126 lines (112 loc) · 3.13 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
plugins {
// Apply the java-library plugin to add support for Java Library
id 'java-library'
// Apply JaCoCo plugin to get code coverage report
id 'jacoco'
// Apply Maven and JFrog Bintray plugins to publish project
id 'maven-publish'
// Linter plugin
id 'checkstyle'
}
repositories {
// Use jcenter for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
}
dependencies {
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
implementation 'org.jsoup:jsoup:1.14.3'
// Use JUnit test framework
testImplementation 'junit:junit:4.12'
testImplementation 'com.squareup.okhttp3:mockwebserver:4.9.3'
}
test {
if (project.hasProperty('excludeTests')) {
exclude project.property('excludeTests')
}
if (project.hasProperty('includeTests')) {
include project.property('includeTests')
}
}
// Code coverage configuration
jacoco {
toolVersion = "0.8.5"
reportsDir = file("$buildDir/customJacocoReportDir")
}
// Code coverage task
jacocoTestReport {
reports {
xml.enabled false
csv.enabled false
html.destination file("${buildDir}/jacocoHtml")
}
}
// Release artifacts
tasks.register('sourcesJar', Jar) {
from sourceSets.main.allJava
classifier 'sources'
}
tasks.register('javadocJar', Jar) {
from javadoc
classifier 'javadoc'
}
// POM configuration
def pomConfig = {
licenses {
license {
name "The Apache Software License, Version 2.0"
url "http://www.apache.org/licenses/LICENSE-2.0.txt"
distribution "repo"
}
}
developers {
developer {
name "Ruben Oliveira Chiavone"
email "[email protected]"
}
}
scm {
url "https://github.com/rubenochiavone/rastreio-java"
}
}
// Publishing task
publishing {
repositories {
maven {
name = "rastreio-java"
url = uri("https://maven.pkg.github.com/rubenochiavone/rastreio-java")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_USERNAME")
password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
}
}
}
publications {
Publication(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
groupId 'java.rastreio'
artifactId 'rastreio'
version '1.1.0'
pom.withXml {
def root = asNode()
root.appendNode('description', 'A Java library for tracking Correios\' shipments. Heavily inspired by https://github.com/talesluna/rastrojs')
root.appendNode('name', 'rastreio-java')
root.appendNode('url', 'https://github.com/rubenochiavone/rastreio-java')
root.children().last() + pomConfig
}
}
}
}
// Checkstyle configuration
checkstyle {
maxWarnings 0
toolVersion '8.35'
}
tasks.withType(Checkstyle) {
reports {
xml.enabled false
html.enabled true
}
}