-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.gradle.kts
139 lines (122 loc) · 3.73 KB
/
build.gradle.kts
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
plugins {
`java-library`
`maven-publish`
signing
jacoco
// 0.6.2 upgrades to JMH 1.28, which has dependencies that only support
// Java 8+. Once we've migrated to Gradle Toolchains, we can just use the
// latest Java for running benchmarks.
id("me.champeau.jmh") version "0.6.1"
}
apply(from = "jdks.gradle.kts")
repositories {
jcenter()
}
sourceSets {
main {
java {
exclude("module-info.java")
}
}
create("moduleInfo") {
java {
// We need the entire source directory here, otherwise we get a
// "package is empty or does not exist" error during compilation.
srcDir("src/main/java")
}
}
}
dependencies {
testImplementation("junit:junit:4.13.2") {
exclude("org.hamcrest")
}
testImplementation("org.hamcrest:hamcrest:2.2")
}
java {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
}
tasks.named<JavaCompile>("compileModuleInfoJava") {
sourceCompatibility = "9"
targetCompatibility = "9"
doLast {
// Leave only the module-info.class
delete("$destinationDir/cafe")
}
}
tasks.jar {
// Add the Java 9+ module-info.class to the Java 7+ classes
from(sourceSets["moduleInfo"].output)
}
group = "cafe.cryptography"
version = "0.1.0"
tasks.register<Jar>("sourcesJar") {
from(sourceSets.main.get().allJava)
archiveClassifier.set("sources")
}
tasks.register<Jar>("javadocJar") {
from(tasks.javadoc)
archiveClassifier.set("javadoc")
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
artifact(tasks["sourcesJar"])
artifact(tasks["javadocJar"])
pom {
name.set("curve25519-elisabeth")
description.set("Pure Java implementation of group operations on Curve25519")
url.set("https://cryptography.cafe")
licenses {
license {
name.set("MIT License")
url.set("https://opensource.org/licenses/MIT")
}
}
developers {
developer {
id.set("str4d")
name.set("Jack Grigg")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:git://github.com/cryptography-cafe/curve25519-elisabeth.git")
developerConnection.set("scm:git:ssh://github.com:cryptography-cafe/curve25519-elisabeth.git")
url.set("https://github.com/cryptography-cafe/curve25519-elisabeth/tree/master")
}
}
}
}
repositories {
maven {
val releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
val snapshotRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
url = uri(if (version.toString().endsWith("SNAPSHOT")) snapshotRepoUrl else releasesRepoUrl)
credentials {
val NEXUS_USERNAME: String? by project
val NEXUS_PASSWORD: String? by project
username = NEXUS_USERNAME ?: ""
password = NEXUS_PASSWORD ?: ""
}
}
}
}
signing {
sign(publishing.publications["mavenJava"])
}
tasks.jacocoTestReport {
reports {
xml.isEnabled = true
html.isEnabled = false
}
}
tasks.check {
dependsOn(tasks.jacocoTestReport)
}
jmh {
// Uncomment to disable SIMD optimizations
// jvmArgsAppend = listOf("-XX:-UseSuperWord")
}
apply(from = "javadoc.gradle.kts")