-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
167 lines (145 loc) · 5.48 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
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins {
id 'java-library'
id 'jacoco'
id 'signing'
id 'maven-publish'
}
group = 'com.syntifi.near'
version = rootProject.file('VERSION').text.trim()
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
repositories {
mavenCentral()
google()
}
dependencies {
// See: https://developer.android.com/jetpack/androidx/releases/annotation
// See: https://mvnrepository.com/artifact/androidx.annotation/annotation
compileOnly 'androidx.annotation:annotation:1.3.0'
// See: https://github.com/junit-team/junit5/releases
// See: https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
// See: https://github.com/raphw/byte-buddy/releases
// See: https://search.maven.org/artifact/net.bytebuddy/byte-buddy/1.12.8/jar
testImplementation "net.bytebuddy:byte-buddy:1.12.8"
}
java {
withJavadocJar()
withSourcesJar()
}
javadoc {
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
test {
finalizedBy jacocoTestReport
useJUnitPlatform()
testLogging {
//showStandardStreams true
// set options for log level LIFECYCLE
events TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED
//TestLogEvent.STANDARD_OUT
exceptionFormat TestExceptionFormat.FULL
showExceptions true
showCauses true
//showStackTraces true
// set options for log level DEBUG and INFO
debug {
events TestLogEvent.STARTED,
TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_ERROR
TestLogEvent.STANDARD_OUT
exceptionFormat TestExceptionFormat.FULL
}
//info.events = debug.events
//info.exceptionFormat = debug.exceptionFormat
afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} passed, ${result.failedTestCount} failed, ${result.skippedTestCount} skipped)"
def startItem = '| ', endItem = ' |'
def repeatLength = startItem.length() + output.length() + endItem.length()
println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength))
}
}
}
}
jacocoTestReport {
dependsOn test
afterEvaluate {
getClassDirectories().setFrom(classDirectories.files.collect {
fileTree(dir: it, exclude: '**/exception/**')
})
}
}
publishing {
repositories {
maven {
name = 'OSSRH'
def releasesRepoUrl = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
def snapshotsRepoUrl = 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = System.getenv('MAVEN_USERNAME')
password = System.getenv('MAVEN_PASSWORD')
}
}
}
publications {
mavenJava(MavenPublication) {
artifactId = 'borshj'
from components.java
pom {
name = 'borshj'
packaging = 'jar'
description = 'Borsh, binary serializer for security-critical projects.'
url = 'https://github.com/oak/borshj'
scm {
connection = 'scm:git:https://github.com/oak/borshj.git'
developerConnection = 'git@github.com:oak/borshj.git'
url = 'https://github.com/oak/borshj'
}
issueManagement {
system = 'GitHub'
url = 'https://github.com/oak/borshj/issues'
}
ciManagement {
system = 'Github Actions'
url = 'https://github.com/oak/borshj/actions'
}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'oak'
name = 'Alexandre Carvalho'
email = 'adcarvalho@gmail.com'
}
developer {
id = 'ab3rtz'
name = 'André Bertolace'
email = 'andre@syntifi.com'
}
}
}
}
}
}
// Reference at https://docs.gradle.org/current/userguide/signing_plugin.html#sec:in-memory-keys
signing {
def signingKey = System.getenv('GPG_SIGNING_KEY') ?: findProperty('GPG_SIGNING_KEY')
def signingKeyPassword = System.getenv('GPG_SIGNING_KEY_PASSWORD') ?: findProperty('GPG_SIGNING_KEY_PASSWORD')
useInMemoryPgpKeys(signingKey, signingKeyPassword)
sign publishing.publications.mavenJava
}