forked from hiero-ledger/hiero-sdk-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
232 lines (195 loc) · 6.04 KB
/
build.gradle
File metadata and controls
232 lines (195 loc) · 6.04 KB
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
plugins {
id "java-library"
id "idea"
id "maven"
id "com.bmuschko.nexus" version "2.3.1"
id "com.google.protobuf" version "0.8.14"
}
group = "com.hedera.hashgraph"
version = "2.0.11"
description = "Hedera™ Hashgraph SDK for Java"
configurations {
integrationTestImplementation.extendsFrom testImplementation
integrationTestRuntimeOnly.extendsFrom testRuntimeOnly
}
dependencies {
// https://github.com/bsideup/jabel
annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:0.3.0'
// custom annotation processor to help generate methods around executables
annotationProcessor project(":executable-processor")
compileOnly project(":executable-annotation")
// NOTE: BouncyCastle is frozen at v1.60 for compatibility with Corda <https://www.corda.net/>
// <https://github.com/corda/corda/blob/2c10b6c3b9dace7831b5da73a065c3269a703d85/constants.properties#L23>
implementation "org.bouncycastle:bcprov-jdk15on:1.69"
// Protobuf Lite is used to maintain easy compatibility with Android
// https://github.com/protocolbuffers/protobuf/blob/master/java/lite.md
api "com.google.protobuf:protobuf-javalite:3.14.0"
// https://mvnrepository.com/artifact/org.slf4j/slf4j-api
implementation 'org.slf4j:slf4j-api:1.7.30'
implementation "io.grpc:grpc-core:1.40.0"
implementation "io.grpc:grpc-protobuf-lite:1.40.0"
implementation "io.grpc:grpc-stub:1.50.0"
testCompile "org.assertj:assertj-core:3.20.2"
testImplementation "org.junit.jupiter:junit-jupiter-engine:5.7.2"
testImplementation "org.junit.jupiter:junit-jupiter-params:5.7.2"
testRuntimeOnly "org.slf4j:slf4j-simple:1.7.30"
testRuntimeOnly "io.grpc:grpc-netty-shaded:1.40.0"
integrationTestRuntimeOnly "io.grpc:grpc-netty-shaded:1.38.0"
// NOTE: This is to support Android API < 24. Once it becomes acceptable to require API 24+ we can drop this and
// use CompletableFuture directly.
// https://github.com/stefan-zobel/streamsupport
// https://developer.android.com/about/dashboards/index.html
api "net.sourceforge.streamsupport:streamsupport:1.7.2"
api "net.sourceforge.streamsupport:streamsupport-cfuture:1.7.2"
// NOTE: This is to support Android API < 26.
api "org.threeten:threetenbp:1.5.1"
implementation "com.google.code.gson:gson:2.8.6"
testImplementation "io.github.json-snapshot:json-snapshot:1.0.17"
implementation 'javax.annotation:javax.annotation-api:1.3.2'
}
// https://github.com/google/protobuf-gradle-plugin
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:3.14.0"
}
plugins {
grpc {
artifact = "io.grpc:protoc-gen-grpc-java:1.38.0"
}
}
generateProtoTasks {
all().each { task ->
task.builtins {
java {
option "lite"
}
}
task.plugins {
grpc {
option "lite"
}
}
}
}
}
tasks.withType(JavaCompile).configureEach {
// https://github.com/gradle/gradle/issues/2510#issuecomment-604986414
// release = 8
compileJava {
options.compilerArgs += [
"--release",
"8" // Avoid using Java 12 APIs
]
}
}
sourceSets {
main {
java {
srcDirs 'src/main/java'
srcDirs 'build/generated/source/proto/main/java'
srcDirs 'build/generated/source/proto/main/grpc'
}
}
integrationTest {
java.srcDir "$projectDir/src/integrationTest/java"
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
}
}
idea {
module {
sourceDirs -= file("src/integrationTest/java")
testSourceDirs += file("src/integrationTest/java")
}
}
jacocoTestReport {
// make sure to use any/all test coverage data for the report
executionData fileTree(dir: buildDir, include: "jacoco/*.exec")
// remove generated proto files from report
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: '**/proto/**')
}))
}
// configure it so only xml is generated for the report
reports {
xml.enabled true
html.enabled true
csv.enabled false
}
// make sure we run all tests before this report is made
dependsOn tasks.withType(Test)
}
task integrationTest(type: Test) {
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
onlyIf {
System.getenv('OPERATOR_ID') != null && System.getenv('OPERATOR_KEY') != null || System.getenv('CONFIG_FILE') != null
}
}
tasks.withType(Javadoc) {
source = sourceSets.main.allJava + file("$buildDir/generated/sources/annotationProcessor/java/main")
}
tasks.withType(Test) {
useJUnitPlatform()
// NOTE: Uncomment to enable trace logs in the SDK during tests
// jvmArgs "-Dorg.slf4j.simpleLogger.log.com.hedera.hashgraph=trace"
// this task will fail on the first failed test
failFast = true
// emit logs per passed or failed test
testLogging {
exceptionFormat = 'full'
events "passed", "skipped", "failed", "standardOut", "standardError"
}
// propagate system environment to test runner
systemProperty "OPERATOR_ID", findProperty("OPERATOR_ID")
systemProperty "OPERATOR_KEY", findProperty("OPERATOR_KEY")
systemProperty "CONFIG_FILE", findProperty("CONFIG_FILE")
systemProperty "HEDERA_NETWORK", findProperty("HEDERA_NETWORK")
}
jar {
exclude "**/*.proto"
archiveBaseName = "sdk-corda"
includeEmptyDirs = false
}
modifyPom {
project {
description 'Hedera™ Hashgraph SDK for Java'
name 'sdk'
url 'https://github.com/hashgraph/hedera-sdk-java'
organization {
name 'Hedera Hashgraph'
url 'https://www.hedera.com'
}
issueManagement {
system 'GitHub'
url 'https://github.com/hashgraph/hedera-sdk-java/issues'
}
licenses {
license {
name 'Apache License, Version 2.0'
url 'https://github.com/hashgraph/hedera-sdk-java/blob/main/LICENSE'
distribution 'repo'
}
}
scm {
url 'https://github.com/hashgraph/hedera-sdk-java'
connection 'scm:git:https://github.com/hashgraph/hedera-sdk-java.git'
developerConnection 'scm:git:ssh://github.com:hashgraph/hedera-sdk-java.git'
}
developers {
developer {
name 'Ryan Leckey'
}
}
}
}
extraArchive {
sources = true
tests = false
javadoc = true
}
nexus {
sign = true
repositoryUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
}