Skip to content

Commit 110966b

Browse files
Adjust publish for nexus
1 parent 8782012 commit 110966b

File tree

3 files changed

+62
-10
lines changed

3 files changed

+62
-10
lines changed

build.gradle.kts

+48-8
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,52 @@
11
plugins {
22
`java-library`
33
kotlin("jvm") version "1.3.41"
4+
id("org.jetbrains.dokka") version "0.9.18"
45

56
signing
67
`maven-publish`
78
id("de.marcphilipp.nexus-publish") version "0.2.0"
89
}
910

1011
group = "dev.turingcomplete"
11-
version = "1.1.0"
12+
version = "2.0.0"
1213

1314
tasks.withType<Wrapper> {
1415
gradleVersion = "5.5.1"
1516
}
1617

1718
repositories {
19+
mavenLocal()
1820
mavenCentral()
21+
jcenter()
22+
}
23+
24+
tasks {
25+
val sourcesJar by creating(Jar::class) {
26+
group = "build"
27+
archiveClassifier.set("sources")
28+
from(sourceSets["main"].allSource)
29+
}
30+
31+
val testsJar by creating(Jar::class) {
32+
dependsOn(JavaPlugin.TEST_CLASSES_TASK_NAME)
33+
group = "build"
34+
archiveClassifier.set("tests")
35+
from(sourceSets["test"].output)
36+
}
37+
38+
val dokkaJar by creating(Jar::class) {
39+
dependsOn("dokka")
40+
group = "build"
41+
archiveClassifier.set("javadoc")
42+
from(getByPath("dokka").outputs)
43+
}
44+
45+
artifacts {
46+
add("archives", sourcesJar)
47+
add("archives", testsJar)
48+
add("archives", dokkaJar)
49+
}
1950
}
2051

2152
configure<JavaPluginExtension> {
@@ -41,23 +72,32 @@ publishing {
4172
publications {
4273
create<MavenPublication>(project.name) {
4374
from(components["java"])
75+
setArtifacts(configurations.archives.get().allArtifacts)
4476
}
4577
}
4678
}
4779

48-
/*
49-
signing.keyId=
50-
signing.password=
51-
signing.secretKeyRingFile=
80+
/**
81+
* See https://docs.gradle.org/current/userguide/signing_plugin.html#sec:signatory_credentials
5282
*/
5383
signing {
5484
sign(publishing.publications[project.name])
5585
}
5686

57-
/*
58-
nexusUsername=
59-
nexusPassword=
87+
gradle.taskGraph.whenReady {
88+
if (allTasks.any { it is Sign }) {
89+
extra["signing.keyId"] = ""
90+
extra["signing.password"] = ""
91+
extra["signing.secretKeyRingFile"] = ""
92+
}
93+
}
94+
95+
/**
96+
* see https://github.com/marcphilipp/nexus-publish-plugin/blob/master/README.md
6097
*/
98+
ext["serverUrl"] = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
99+
ext["nexusUsername"] = ""
100+
ext["nexusPassword"] = ""
61101

62102
configure<PublishingExtension> {
63103
publications {

src/main/kotlin/dev/turingcomplete/kotlinonetimepassword/GoogleAuthenticator.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import java.util.concurrent.TimeUnit
1010
* SHA1; time step: 30 seconds and code digits: 6.
1111
*
1212
* @param base32secret the shared secret <b>that must already be Base32-encoded</b>
13-
* (use [Base32.encode]).
13+
* (use [org.apache.commons.codec.binary.BaseNCodec.encode(byte[])]).
1414
*/
1515
class GoogleAuthenticator(base32secret: String) {
1616
private val timeBasedOneTimePasswordGenerator: TimeBasedOneTimePasswordGenerator
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
11
package dev.turingcomplete.kotlinonetimepassword
22

33
/**
4-
* Available "keyed-hash message authentication code" algorithms.
4+
* Available "keyed-hash message authentication code" (HMAC) algorithms.
5+
* See: https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#Mac
56
*
7+
* @property macAlgorithmName the name of the algorithm used for
8+
* [javax.crypto.Mac.getInstance(java.lang.String)]
69
* @property hashBytes the length of the returned hash produced by the algorithm.
710
*/
811
enum class HmacAlgorithm(val macAlgorithmName: String, val hashBytes: Int) {
12+
/**
13+
* SHA1 HMAC with a hash of 20-bytes
14+
*/
915
SHA1("HmacSHA1", 20),
16+
/**
17+
* SHA256 HMAC with a hash of 32-bytes
18+
*/
1019
SHA256("HmacSHA256", 32),
20+
/**
21+
* SHA512 HMAC with a hash of 64-bytes
22+
*/
1123
SHA512("HmacSHA512", 64);
1224
}

0 commit comments

Comments
 (0)