-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
176 lines (158 loc) · 5.6 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
plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
}
group 'org.cryptimeleon'
archivesBaseName = project.name
boolean isRelease = project.hasProperty("release")
version = '2.0.2' + (isRelease ? "" : "-SNAPSHOT")
sourceCompatibility = 1.8
targetCompatibility = 1.8
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
repositories {
mavenLocal()
mavenCentral()
jcenter()
}
def mathVersionNoSuffix = '3.0.0'
def cracoVersionNoSuffix = '3.0.0'
dependencies {
def cracoVersion = cracoVersionNoSuffix + (isRelease ? "" : "-SNAPSHOT")
def mathVersion = mathVersionNoSuffix + (isRelease ? "" : "-SNAPSHOT")
api group: 'org.cryptimeleon', name: 'craco', version: cracoVersion
// For using craco tests on the schemes
testImplementation(group: 'org.cryptimeleon', name: 'craco', version: cracoVersion) {
capabilities {
requireCapability("org.cryptimeleon:craco-tests")
}
}
// For standalone testing class
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.7.0',
'org.junit.jupiter:junit-jupiter-params:5.7.0',
'org.reflections:reflections:0.9.10'
)
testRuntimeOnly(
'org.junit.jupiter:junit-jupiter-engine:5.7.0',
'org.junit.vintage:junit-vintage-engine:5.7.0'
)
}
test {
useJUnitPlatform()
maxParallelForks 4
//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 javadocLatex(type: Javadoc) {
source = sourceSets.main.allJava
classpath = sourceSets.main.runtimeClasspath
if (isRelease) {
// link to math and craco javadocs
options {
links "https://javadoc.io/doc/org.cryptimeleon/math/" + mathVersionNoSuffix, "https://javadoc.io/doc/org.cryptimeleon/craco/" + cracoVersionNoSuffix
}
}
// 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>"
}
task javadocJar(type: Jar, dependsOn: javadocLatex) {
from javadoc.destinationDir
archiveClassifier.set('javadoc')
}
task sourcesJar(type: Jar) {
from sourceSets.main.allJava
archiveClassifier.set('sources')
}
artifacts {
archives javadocJar
archives sourcesJar
}
java {
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 = 'Predenc'
url = 'https://cryptimeleon.org'
description = 'The Cryptimeleon Predenc project contains various predicate encryption ' +
'implementations such as attribute-based encryption or identity-based encryption. ' +
'Furthermore, it contains key encapsulation mechanisms based on predicate encryption schemes.'
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/predenc.git'
developerConnection = 'scm:git:https://github.com/cryptimeleon/predenc.git'
url = 'https://github.com/cryptimeleon/predenc/'
}
}
}
}
repositories {
maven {
credentials {
username = System.getenv("OSSRH_USERNAME")
password = System.getenv("OSSRH_TOKEN")
}
name = 'OSSRH'
def releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
url = version.endsWith('SNAPSHOT') ? '' : releasesRepoUrl
}
}
}
signing {
required(project.hasProperty("release"))
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenJava
}