-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
168 lines (147 loc) · 5.04 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
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 = '3.2.0' + (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.
// For tests
testImplementation(group: 'org.cryptimeleon', name: 'math', version: mathVersion) {
capabilities {
requireCapability("org.cryptimeleon:math-tests")
}
}
testCompileOnly(
'junit:junit:4.12'
)
testImplementation(
'org.junit.jupiter:junit-jupiter-api:5.1.0'
)
testRuntimeOnly(
'org.junit.jupiter:junit-jupiter-engine:5.1.0',
'org.junit.vintage:junit-vintage-engine:5.1.0'
)
}
test {
useJUnitPlatform()
maxParallelForks = 1
//we want display the following test events
testLogging {
events "PASSED", "STARTED", "FAILED", "SKIPPED"
}
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))
}
}
}
task javadocLink(type: Javadoc) {
source = sourceSets.main.allJava
classpath = sourceSets.main.runtimeClasspath
// link to math javadoc
if (isRelease) {
options {
links "https://javadoc.io/doc/org.cryptimeleon/math/" + mathVersionNoSuffix
}
}
}
task sourcesJar(type: Jar) {
from sourceSets.main.allJava
archiveClassifier = 'sources'
}
task javadocJar(type: Jar, dependsOn: javadocLink) {
from javadoc.destinationDir
archiveClassifier = 'javadoc'
}
artifacts {
archives javadocJar
archives sourcesJar
}
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 = 'mclwrap'
url = 'https://cryptimeleon.org'
description = "Mclwrap provides a wrapper around the BN-254 bilinear group implemented in " +
"the MCL library. As the bilinear groups implemented in the Cryptimeleon Math library " +
"are not particulary efficient, use of this wrapper is recommended for proper benchmarks. " +
"Specifically, the Mclwrap implementation's group operations are roughly 100 times " +
"as fast as our own implementation."
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'cryptimeleon-dev'
name = 'cryptimeleon Developers'
email = 'dev@cryptimeleon.org'
}
}
scm {
connection = 'scm:git:git://github.com/cryptimeleon/mclwrap.git'
developerConnection = 'scm:git:https://github.com/cryptimeleon/mclwrap.git'
url = 'https://github.com/cryptimeleon/mclwrap/'
}
}
}
}
}
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
}