From 6b98c36e1117172d9ee8fecb4614cc6d9845c6a4 Mon Sep 17 00:00:00 2001 From: Abhijit Sarkar Date: Sat, 8 May 2021 19:12:53 -0700 Subject: [PATCH] Dependency upgrade and other maintenance --- .github/workflows/ci.yml | 3 +- .github/workflows/publish.yml | 12 +++- README.md | 11 ++-- build.gradle.kts | 74 ++++++++++++------------ gradle.properties | 21 ++++--- gradle/wrapper/gradle-wrapper.properties | 2 +- settings.gradle.kts | 5 +- 7 files changed, 65 insertions(+), 63 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a852896..2360341 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,8 +12,9 @@ jobs: - uses: actions/checkout@v2 - name: Set up JDK - uses: actions/setup-java@v1 + uses: actions/setup-java@v2 with: + distribution: 'zulu' java-version: 8 - name: Build and test diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 52406d6..4de8700 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -29,9 +29,15 @@ jobs: exit 1 - name: Set up JDK - uses: actions/setup-java@v1 + uses: actions/setup-java@v2 with: + distribution: 'zulu' java-version: 8 - - name: Publish to Bintray - run: ./gradlew -P bintrayUser=${{ secrets.BINTRAY_USER }} -P bintrayKey=${{ secrets.BINTRAY_KEY }} bintrayUpload + - name: Publish to Maven Central + run: | + ./gradlew -P signingKey=${{ secrets.SIGNING_KEY }} \ + -P signingPassword=${{ secrets.SIGNING_PASSWORD }} \ + -P sonatypeUsername=${{ secrets.SONATYPE_USERNAME }} \ + -P sonatypePassword=${{ secrets.SONATYPE_PASSWORD }} \ + publishToSonatype closeAndReleaseSonatypeStagingRepository diff --git a/README.md b/README.md index da30160..eec816f 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,8 @@ Requires Java 8 or later. Verified working with the latest JUnit 5 version, whic ## Installation -You can find the latest version on Bintray. [ ![Download](https://api.bintray.com/packages/asarkar/mvn/com.asarkar.grpc%3Agrpc-test/images/download.svg) ](https://bintray.com/asarkar/mvn/com.asarkar.grpc%3Agrpc-test/_latestVersion) - -It is also on Maven Central and jcenter. +You can find the latest version +on [Maven Central](https://search.maven.org/search?q=g:com.asarkar.grpc%20AND%20a:grpc-test). ## Usage @@ -46,9 +45,9 @@ class ExampleTestCase { ## Contribute -This project is a volunteer effort. You are welcome to send pull requests, ask questions, or create issues. -If you like it, you can help by spreading the word! +This project is a volunteer effort. You are welcome to send pull requests, ask questions, or create issues. If you like +it, you can help by spreading the word and "Starring" the GitHub repo! ## License -Copyright 2020 Abhijit Sarkar - Released under [Apache License v2.0](LICENSE). +Copyright 2021 Abhijit Sarkar - Released under [Apache License v2.0](LICENSE). diff --git a/build.gradle.kts b/build.gradle.kts index b3ba4a2..9e9a1a1 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,9 +1,12 @@ +import java.util.Base64 + plugins { kotlin("jvm") `maven-publish` id("org.jetbrains.dokka") id("org.jlleitschuh.gradle.ktlint") - id("com.jfrog.bintray") + id("io.github.gradle-nexus.publish-plugin") + signing } val projectGroup: String by project @@ -14,25 +17,26 @@ version = projectVersion description = projectDescription repositories { - jcenter() + maven("https://kotlin.bintray.com/kotlinx") + mavenCentral() } -val jUnitVersion: String by project -val gRPCVersion: String by project +val junitVersion: String by project +val grpcVersion: String by project val mockitoVersion: String by project -val jUnitTestkitVersion: String by project +val junitTestkitVersion: String by project dependencies { implementation(kotlin("stdlib-jdk8")) - implementation(platform("io.grpc:grpc-bom:$gRPCVersion")) - implementation(platform("org.junit:junit-bom:$jUnitVersion")) + implementation(platform("io.grpc:grpc-bom:$grpcVersion")) + implementation(platform("org.junit:junit-bom:$junitVersion")) implementation("org.junit.jupiter:junit-jupiter-api") implementation("io.grpc:grpc-api") testImplementation("org.junit.jupiter:junit-jupiter") testImplementation("io.grpc:grpc-core") testImplementation("org.mockito:mockito-core:$mockitoVersion") testImplementation("org.mockito:mockito-junit-jupiter:$mockitoVersion") - testImplementation("org.junit.platform:junit-platform-testkit:$jUnitTestkitVersion") + testImplementation("org.junit.platform:junit-platform-testkit:$junitTestkitVersion") } plugins.withType { @@ -49,9 +53,13 @@ tasks.withType { } } -tasks.withType { - outputFormat = "html" - outputDirectory = "$buildDir/javadoc" +tasks.dokkaHtml.configure { + outputDirectory.set(buildDir.resolve("javadoc")) + dokkaSourceSets.configureEach { + jdkVersion.set(8) + skipEmptyPackages.set(true) + platform.set(org.jetbrains.dokka.Platform.jvm) + } } val sourcesJar by tasks.creating(Jar::class) { @@ -65,7 +73,7 @@ val kdocJar by tasks.creating(Jar::class) { group = JavaBasePlugin.DOCUMENTATION_GROUP description = "Creates KDoc" archiveClassifier.set("javadoc") - from(tasks.dokka) + from(tasks.dokkaHtml) } tasks.jar.configure { @@ -112,32 +120,22 @@ publishing { } } -val bintrayRepo: String by project -bintray { - user = (findProperty("bintrayUser") ?: System.getenv("BINTRAY_USER"))?.toString() - key = (findProperty("bintrayKey") ?: System.getenv("BINTRAY_KEY"))?.toString() - setPublications(*publishing.publications.names.toTypedArray()) - with(pkg) { - repo = bintrayRepo - name = "${project.group}:${project.name}" - desc = project.description - websiteUrl = "https://$gitHubUrl" - vcsUrl = "https://$gitHubUrl.git" - setLabels("grpc", "protobuf", "test", "junit5", "junit") - setLicenses(licenseName) - with(version) { - name = project.version.toString() - with(gpg) { - sign = true - } - with(mavenCentralSync) { - sync = true - user = (findProperty("sonatypeUser") ?: System.getenv("SONATYPE_USER"))?.toString() - password = (findProperty("sonatypePwd") ?: System.getenv("SONATYPE_PWD"))?.toString() - } +fun base64Decode(prop: String): String? { + return project.findProperty(prop)?.let { + String(Base64.getDecoder().decode(it.toString())).trim() + } +} + +signing { + useInMemoryPgpKeys(base64Decode("signingKey"), base64Decode("signingPassword")) + sign(*publishing.publications.toTypedArray()) +} + +nexusPublishing { + repositories { + sonatype { + username.set(base64Decode("sonatypeUsername")) + password.set(base64Decode("sonatypePassword")) } } - publish = true - override = false - dryRun = false } diff --git a/gradle.properties b/gradle.properties index 8b7eeae..92d5a2a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,20 +1,19 @@ kotlin.code.style=official -jUnitVersion=5.6.2 -gRPCVersion=1.31.0 -mockitoVersion=3.4.6 -jUnitTestkitVersion=1.6.2 -kotlinPluginVersion=1.3.72 -dokkaPluginVersion=0.10.1 -ktlintVersion=9.3.0 -bintrayPluginVersion=1.8.5 +junitVersion=5.7.1 +grpcVersion=1.37.0 +mockitoVersion=latest.release +junitTestkitVersion=latest.release +kotlinPluginVersion=1.5.0 +dokkaPluginVersion=1.4.32 +ktlintVersion=10.0.0 +nexusPluginVersion=1.0.0 projectGroup=com.asarkar.grpc -projectVersion=1.0.3 +projectVersion=1.2.0 projectDescription=JUnit5 Extension that can automatically release gRPC resources at the end of the test licenseName=Apache-2.0 licenseUrl=http://www.apache.org/licenses/LICENSE-2.0.txt developerName=Abhijit Sarkar developerEmail=contact@asarkar.com -gitHubUsername=asarkar -bintrayRepo=mvn \ No newline at end of file +gitHubUsername=asarkar \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index bb8b2fc..f371643 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle.kts b/settings.gradle.kts index e1ec453..f4936bf 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -2,13 +2,12 @@ pluginManagement { val kotlinPluginVersion: String by settings val dokkaPluginVersion: String by settings val ktlintVersion: String by settings - val bintrayPluginVersion: String by settings + val nexusPluginVersion: String by settings plugins { kotlin("jvm") version kotlinPluginVersion - `maven-publish` id("org.jetbrains.dokka") version dokkaPluginVersion id("org.jlleitschuh.gradle.ktlint") version ktlintVersion - id("com.jfrog.bintray") version bintrayPluginVersion + id("io.github.gradle-nexus.publish-plugin") version nexusPluginVersion } }