-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
152 lines (138 loc) · 5.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
plugins {
// Apply the java-library plugin for API and implementation separation.
id 'java-library'
id 'maven-publish'
alias libs.plugins.spotless
alias libs.plugins.artifactory
}
repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
}
dependencies {
annotationProcessor libs.google.auto.service
// Use JUnit Jupiter for testing.
testImplementation libs.junit.jupiter
testImplementation libs.google.errorprone.testhelpers
testImplementation libs.assertj.core
testRuntimeOnly libs.picocli
testRuntimeOnly libs.jetbrain.annotations
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
// This dependency is exported to consumers, that is to say found on their compile classpath.
api libs.slf4j.api
api libs.picocli
// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation libs.google.auto.service
implementation libs.google.errorprone.annotations
implementation libs.google.errorprone.core
implementation libs.google.errorprone.check.api
}
// Apply a specific Java toolchain to ease working on different environments.
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
tasks.withType(JavaCompile).configureEach {
options.compilerArgs += [
'--add-exports',
'jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED',
'--add-exports',
'jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED',
'--add-exports',
'jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED',
'--add-exports',
'jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED',
'--add-exports',
'jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED',
'--add-exports',
'jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED',
'--add-exports',
'jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED',
'--add-exports',
'jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED'
]
}
tasks.named('test') {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
jvmArgs += [
// errorprone tests need access to the javac compiler
'--add-exports',
'jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED',
'--add-exports',
'jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED',
'--add-exports',
'jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED',
'--add-exports',
'jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED',
'--add-exports',
'jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED',
'--add-exports',
'jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED',
'--add-exports',
'jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED',
'--add-exports',
'jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED'
]
}
spotless {
java {
removeUnusedImports()
googleJavaFormat()
importOrder 'org.hyperledger', 'java', 'javax', ''
trimTrailingWhitespace()
endWithNewline()
}
}
publishing {
publications {
library(MavenPublication) {
groupId = 'org.hyperledger.besu'
from components.java
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
pom {
name = 'besu-errorprone-checks'
description = 'A collection of custom error prone checks'
url = 'https://github.com/besu-eth/besu-errorprone-checks'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
scm {
connection = 'scm:git:git://github.com/besu-eth/besu-errorprone-checks.git'
developerConnection = 'scm:git:ssh://github.com/besu-eth/besu-errorprone-checks.git'
url = 'https://github.com/besu-eth/besu-errorprone-checks'
}
}
}
}
def artifactoryUser = project.hasProperty('artifactoryUser') ? project.property('artifactoryUser') : System.getenv('ARTIFACTORY_USER')
def artifactoryKey = project.hasProperty('artifactoryApiKey') ? project.property('artifactoryApiKey') : System.getenv('ARTIFACTORY_KEY')
def artifactoryRepo = System.getenv('ARTIFACTORY_REPO') ?: 'besu-maven'
def artifactoryOrg = System.getenv('ARTIFACTORY_ORG') ?: 'hyperledger'
artifactory {
contextUrl = "https://hyperledger.jfrog.io/${artifactoryOrg}"
publish {
repository {
repoKey = artifactoryRepo
username = artifactoryUser
password = artifactoryKey
}
defaults {
publications('library')
publishArtifacts = true
publishPom = true
}
}
}
}