-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.gradle
200 lines (178 loc) · 6.82 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
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
plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
id "io.github.gradle-nexus.publish-plugin" version "1.1.0"
}
group = 'org.cryptimeleon'
archivesBaseName = project.name
boolean isRelease = project.hasProperty("release")
version = '4.0.2' + (isRelease ? "" : "-SNAPSHOT")
sourceCompatibility = 1.8
targetCompatibility = 1.8
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
repositories {
mavenLocal()
mavenCentral()
}
def mathVersionNoSuffix = '3.+'
dependencies {
def mathVersion = mathVersionNoSuffix + (isRelease ? "" : "-SNAPSHOT")
// This dependency is exported to consumers, that is to say found on their compile classpath.
api group: 'org.cryptimeleon', name: 'math', version: mathVersion
// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation group: 'org.reflections', name: 'reflections', version: '0.9.10'
testCompileOnly(
'junit:junit:4.12'
)
testImplementation(
'org.junit.jupiter:junit-jupiter-api:5.1.0',
'org.junit.jupiter:junit-jupiter-params:5.1.0'
)
testImplementation(group: 'org.cryptimeleon', name: 'math', version: mathVersion) {
capabilities {
requireCapability("org.cryptimeleon:math-tests")
}
}
testRuntimeOnly(
'org.junit.jupiter:junit-jupiter-engine:5.1.0',
'org.junit.vintage:junit-vintage-engine:5.1.0'
)
}
test {
useJUnitPlatform()
maxParallelForks 4
// we want to display the following test events
testLogging {
events "PASSED", "STARTED", "FAILED", "SKIPPED"
}
// a collection to track failed tests
ext.failedTests = []
afterTest { descriptor, result ->
if (result.resultType == TestResult.ResultType.FAILURE) {
String failedTest = "${descriptor.className}::${descriptor.name}"
logger.debug("Adding " + failedTest + " to failedTests...")
failedTests << [failedTest]
}
}
afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)"
def startItem = '| ', endItem = ' |'
def repeatLength = startItem.length() + output.length() + endItem.length()
println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength))
// logs each failed test
if (!failedTests.empty) {
logger.lifecycle("Failed tests:")
failedTests.each { failedTest ->
logger.lifecycle("${failedTest}")
}
}
}
}
}
task javadocLatex(type: Javadoc) {
source = sourceSets.main.allJava
classpath = sourceSets.main.runtimeClasspath
// enable rendering of umlauts
options.addStringOption("charset", "UTF-8")
// link to math javadoc
if (isRelease) {
options.addStringOption("link", "https://javadoc.io/doc/org.cryptimeleon/math/" + mathVersionNoSuffix)
}
// enable latex rendering via mathjax
options.addBooleanOption("-allow-script-in-comments", true)
options.header = "<script type\"text/javascript&\" src=\"" +
"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?" +
"config=TeX-MML-AM_CHTML\"></script>"
// reduce javadoc linting
//options.addBooleanOption('Xdoclint:none', true)
}
task javadocJar(type: Jar, dependsOn: javadocLatex) {
from javadoc.destinationDir
archiveClassifier.set('javadoc')
}
java {
registerFeature("tests") {
usingSourceSet(sourceSets.test)
}
withJavadocJar()
withSourcesJar()
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
artifacts {
archives javadocJar, sourcesJar
}
pom {
name = 'Craco'
url = 'https://cryptimeleon.org'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
description = 'Craco (CRyptogrAphic COnstructions) is a Java library providing implementations ' +
'of various cryptographic primitives and low-level constructions. This includes primitives ' +
'such as commitment schemes, signature schemes, and much more. The goal of Craco is to ' +
'provide common cryptographic schemes for usage in more high-level protocols as well as to' +
' offer facilities for improving the process of implementing more low-level schemes such ' +
'as signature and encryption schemes.'
developers {
developer {
id = 'jbobolz'
name = 'Jan Bobolz'
email = '[email protected]'
organization = 'Paderborn University'
}
developer {
id = 'feidens'
name = 'Fabian Eidens'
email = '[email protected]'
organization = 'Paderborn University'
url = 'https://feidens.github.io/'
}
developer {
id = 'rheitjoh'
name = 'Raphael Heitjohann'
email = '[email protected]'
organization = 'Paderborn University'
}
}
scm {
connection = 'scm:git:git://github.com/cryptimeleon/craco.git'
developerConnection = 'scm:git:https://github.com/cryptimeleon/craco.git'
url = 'https://github.com/cryptimeleon/craco/'
}
}
}
}
}
nexusPublishing {
repositories {
sonatype {
username = System.getenv("OSSRH_USERNAME")
password = System.getenv("OSSRH_TOKEN")
}
}
}
signing {
required(project.hasProperty("release"))
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenJava
}