-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
331 lines (286 loc) · 11.1 KB
/
build.gradle
File metadata and controls
331 lines (286 loc) · 11.1 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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
import java.util.Base64
plugins {
id 'base'
id 'tech.yanand.maven-central-publish' version '1.2.0'
}
group = 'org.exploit.anvil'
version = findProperty('releaseVersion') ?: '0.1.1'
ext {
anvilJavaProjects = [
':bigint',
':util',
':ecc-spi',
':ecc-secp256k1',
':ecc-ed25519',
':ecc-p256',
':paillier',
':shamir',
':t-schnorr',
':t-schnorr:frost-ed25519',
':t-schnorr:frost-secp256k1',
':t-schnorr:frost-p256',
':t-ecdsa',
':t-ecies',
':xchacha20-poly1305',
':zk-dlog',
':zk-spi'
]
junitVersion = '6.0.0'
lombokVersion = '1.18.44'
bouncyCastleVersion = '1.83'
guavaVersion = '33.4.8-jre'
tss4jNativesVersion = '1.0.0'
anvilPomUrl = findProperty('pomUrl') ?: 'https://github.com/exploit-org/anvil'
anvilScmUrl = findProperty('pomScmUrl') ?: anvilPomUrl
anvilScmConnection = findProperty('pomScmConnection') ?: 'scm:git:https://github.com/exploit-org/anvil.git'
anvilScmDeveloperConnection = findProperty('pomScmDeveloperConnection') ?: 'scm:git:ssh://github.com/exploit-org/anvil.git'
anvilDeveloperId = findProperty('pomDeveloperId') ?: 'xlloit'
anvilDeveloperName = findProperty('pomDeveloperName') ?: 'xlloit'
anvilDeveloperEmail = findProperty('pomDeveloperEmail') ?: 'contact@exploit.org'
anvilProjectPom = [
':bigint' : [
name : 'Anvil BigInt',
description: 'GMP-backed arbitrary precision integer primitives for Anvil.'
],
':util' : [
name : 'Anvil Util',
description: 'Shared byte encoding and digest helpers for Anvil modules.'
],
':ecc-spi' : [
name : 'Anvil ECC SPI',
description: 'Common elliptic-curve interfaces for Anvil curve and protocol modules.'
],
':ecc-secp256k1' : [
name : 'Anvil ECC secp256k1',
description: 'secp256k1 keys, point operations, ECDSA, BIP340, Taproot helpers, and hash-to-curve support.'
],
':ecc-ed25519' : [
name : 'Anvil ECC Ed25519',
description: 'Ed25519 keys, point operations, and EdDSA signing and verification.'
],
':ecc-p256' : [
name : 'Anvil ECC P-256',
description: 'P-256 keys, point operations, ECDSA, recoverable ECDSA, and hash-to-curve support.'
],
':paillier' : [
name : 'Anvil Paillier',
description: 'Paillier encryption, MtA helpers, and Paillier-related zero-knowledge proofs.'
],
':shamir' : [
name : 'Anvil Shamir',
description: 'Shamir splitting and recovery for elliptic-curve private scalars.'
],
':t-schnorr' : [
name : 'Anvil Threshold Schnorr',
description: 'Curve-independent FROST contexts, preprocessing, partial signing, and aggregation.'
],
':t-schnorr:frost-ed25519' : [
name : 'Anvil FROST Ed25519',
description: 'FROST Ed25519 scheme and SHA-512 cipher suite.'
],
':t-schnorr:frost-secp256k1' : [
name : 'Anvil FROST secp256k1',
description: 'FROST secp256k1 schemes for Schnorr, BIP340, and Taproot signatures.'
],
':t-schnorr:frost-p256' : [
name : 'Anvil FROST P-256',
description: 'FROST P-256 scheme and SHA-256 cipher suite.'
],
':t-ecdsa' : [
name : 'Anvil Threshold ECDSA',
description: 'GG20 threshold ECDSA contexts, MtA runners, commitments, integrity checks, and signature aggregation.'
],
':t-ecies' : [
name : 'Anvil Threshold ECIES',
description: 'Threshold ECIES client, ElGamal KEM, partial decryption, and symmetric cipher adapters.'
],
':xchacha20-poly1305' : [
name : 'Anvil XChaCha20-Poly1305',
description: 'XChaCha20-Poly1305 AEAD wrapper over libsodium.'
],
':zk-dlog' : [
name : 'Anvil ZK DLog',
description: 'Discrete-log proof utilities: Pedersen commitments, Chaum-Pedersen, and DLEQ.'
],
':zk-spi' : [
name : 'Anvil ZK SPI',
description: 'Common zero-knowledge proof interfaces for Anvil proof modules.'
],
':bom' : [
name : 'Anvil BOM',
description: 'Bill of materials for aligning Anvil module versions.'
]
]
tss4jNative = { classifier ->
"org.exploit:tss4j-natives:${tss4jNativesVersion}:${classifier}@jar"
}
}
def configurePom = { MavenPublication publication, Project p ->
def metadata = rootProject.ext.anvilProjectPom[p.path]
publication.pom {
name = metadata.name
description = metadata.description
url = rootProject.ext.anvilPomUrl
licenses {
license {
name = 'Apache License 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = rootProject.ext.anvilDeveloperId
name = rootProject.ext.anvilDeveloperName
email = rootProject.ext.anvilDeveloperEmail
}
}
scm {
connection = rootProject.ext.anvilScmConnection
developerConnection = rootProject.ext.anvilScmDeveloperConnection
url = rootProject.ext.anvilScmUrl
}
}
}
mavenCentral {
repoDir = layout.buildDirectory.dir('repos/central-bundles')
authToken = centralMavenToken
publishingType = 'USER_MANAGED'
}
allprojects {
group = rootProject.group
version = rootProject.version
repositories {
mavenCentral()
}
}
configure(rootProject.ext.anvilJavaProjects.collect { project(it) }) {
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'signing'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(25)
}
withSourcesJar()
withJavadocJar()
}
dependencies {
testImplementation platform("org.junit:junit-bom:${rootProject.ext.junitVersion}")
testImplementation 'org.junit.jupiter:junit-jupiter'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
options.compilerArgs += '--enable-preview'
}
tasks.withType(Javadoc).configureEach {
failOnError = false
options.encoding = 'UTF-8'
options.addStringOption('Xdoclint:none', '-quiet')
options.addBooleanOption('html5', true)
}
tasks.withType(Test).configureEach {
useJUnitPlatform()
jvmArgs '--enable-preview', '--enable-native-access=ALL-UNNAMED'
}
tasks.withType(Jar).configureEach {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
publishing {
publications {
maven(MavenPublication) {
from components.java
configurePom(delegate, project)
}
}
repositories {
maven {
name = 'CentralBundle'
url = rootProject.layout.buildDirectory.dir('repos/central-bundles')
}
}
}
signing {
if (signingKey) {
def decodedSigningKey = new String(Base64.mimeDecoder.decode(signingKey.toString()), "UTF-8")
if (!decodedSigningKey.startsWith("-----BEGIN PGP PRIVATE KEY BLOCK-----")) {
throw new GradleException("signingKey is not base64 of an armored private key")
}
useInMemoryPgpKeys(decodedSigningKey, signingPassword?.toString())
}
required {
gradle.taskGraph.allTasks.any { task ->
task.name.toLowerCase(Locale.ROOT).contains('publish') ||
task.name.toLowerCase(Locale.ROOT).contains('sign')
}
}
sign publishing.publications.maven
}
}
project(':bom') {
apply plugin: 'java-platform'
apply plugin: 'maven-publish'
apply plugin: 'signing'
javaPlatform {
allowDependencies()
}
dependencies {
constraints {
rootProject.ext.anvilJavaProjects.each { projectPath ->
api project(projectPath)
}
}
}
publishing {
publications {
maven(MavenPublication) {
from components.javaPlatform
configurePom(delegate, project)
}
}
repositories {
maven {
name = 'CentralBundle'
url = rootProject.layout.buildDirectory.dir('repos/central-bundles')
}
}
}
signing {
if (signingKey) {
def decodedSigningKey = new String(Base64.mimeDecoder.decode(signingKey.toString()), "UTF-8")
if (!decodedSigningKey.startsWith("-----BEGIN PGP PRIVATE KEY BLOCK-----")) {
throw new GradleException("signingKey is not base64 of an armored private key")
}
useInMemoryPgpKeys(decodedSigningKey, signingPassword?.toString())
}
required {
gradle.taskGraph.allTasks.any { task ->
task.name.toLowerCase(Locale.ROOT).contains('publish') ||
task.name.toLowerCase(Locale.ROOT).contains('sign')
}
}
sign publishing.publications.maven
}
}
tasks.register('publishAllToCentralBundle') {
group = 'publishing'
description = 'Publishes every Anvil publication into build/repos/central-bundles.'
dependsOn((rootProject.ext.anvilJavaProjects + [':bom']).collect {
"${it}:publishAllPublicationsToCentralBundleRepository"
})
}
tasks.register('publishAllToMavenCentralPortal') {
group = 'publishing'
description = 'Uploads every Anvil publication bundle to Maven Central Portal.'
dependsOn(tasks.named('publishToMavenCentralPortal'))
}
tasks.register('publishAllToMavenLocal') {
group = 'publishing'
description = 'Publishes every Anvil publication to the local Maven repository.'
dependsOn((rootProject.ext.anvilJavaProjects + [':bom']).collect {
"${it}:publishToMavenLocal"
})
}
tasks.named('zipBundleForUpload') {
dependsOn(tasks.named('publishAllToCentralBundle'))
}