Skip to content

Commit

Permalink
Merge pull request #6 from robinohs/dev
Browse files Browse the repository at this point in the history
Integrate typo fix.
  • Loading branch information
robinohs committed Feb 18, 2023
2 parents 4617e5a + 607626a commit e6478f1
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 9 deletions.
70 changes: 63 additions & 7 deletions lib/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
description = ""
group = "dev.robinohs"
version = "1.0.3"
version = "1.0.1-SNAPSHOT"

val sonatypeUsername: String? = System.getenv("SONATYPE_USERNAME")
val sonatypePassword: String? = System.getenv("SONATYPE_PASSWORD")

plugins {
id("org.jetbrains.kotlin.jvm") version "1.7.0"
id("org.jetbrains.kotlin.jvm") version "1.8.10"
id("jacoco")
id("org.sonarqube") version "3.3"
id("java-library")
id("maven-publish")
id("signing")
}

repositories {
Expand All @@ -32,6 +36,7 @@ tasks.jar {
}

java {
withJavadocJar()
withSourcesJar()
}

Expand All @@ -58,12 +63,63 @@ tasks {

publishing {
publications {
create<MavenPublication>("maven") {
groupId = project.group as String
artifactId = "totpkt"
version = project.version as String

create<MavenPublication>("mavenJava") {
artifactId = "totp-kt"
from(components["java"])
versionMapping {
usage("java-api") {
fromResolutionOf("runtimeClasspath")
}
usage("java-runtime") {
fromResolutionResult()
}
}
pom {
name.set("totp-kt")
description.set("Native Kotlin library for time-based TOTP and HMAC-based HOTP one-time passwords.")
url.set("https://github.com/robinohs/totp-kt")
licenses {
license {
name.set("The MIT License (MIT)")
url.set("https://mit-license.org/")
}
}
developers {
developer {
id.set("Roboh97")
name.set("Robin Ohs")
email.set("info@robinohs.dev")
}
}
scm {
connection.set("scm:git:https://github.com/robinohs/totp-kt.git")
developerConnection.set("scm:git:https://github.com/robinohs/totp-kt.git")
url.set("https://github.com/robinohs/totp-kt")
}
}
}
}
repositories {
maven {
// change URLs to point to your repos, e.g. http://my.org/repo
name="oss"
val releasesRepoUrl = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
val snapshotsRepoUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
credentials {
username = sonatypeUsername
password = sonatypePassword
}
}
}
}

signing {
sign(publishing.publications["mavenJava"])
}

tasks.javadoc {
if (JavaVersion.current().isJava9Compatible) {
(options as StandardJavadocDocletOptions).addBooleanOption("html5", true)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class TotpGenerator(
init {
require(codeLength >= 0) { "Code length must be >= 0." }
require(timePeriod.toMillis() >= 1) { "Time period must be be >= 1." }
require(tolerance >= 0) { "Tolerance must be be >= 1." }
require(tolerance >= 0) { "Tolerance must be be >= 0." }
}

override var codeLength = codeLength
Expand Down Expand Up @@ -106,4 +106,4 @@ class TotpGenerator(
val end = beginning + timePeriod.toMillis()
return Duration.ofMillis(end - millis)
}
}
}

0 comments on commit e6478f1

Please sign in to comment.