Moved from JCenter to Maven Central.

Updated dependencies.
This commit is contained in:
Erik C. Thauvin 2021-03-21 12:47:09 -07:00
parent 2c8a9c61cc
commit c61f9ad59c
93 changed files with 6881 additions and 190 deletions

View file

@ -1,21 +1,18 @@
import com.jfrog.bintray.gradle.tasks.BintrayUploadTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.io.FileInputStream
import java.util.Date
import java.util.Properties
import java.net.URL
plugins {
jacoco
`java-library`
`maven-publish`
id("com.github.ben-manes.versions") version "0.29.0"
id("com.jfrog.bintray") version "1.8.5"
id("io.gitlab.arturbosch.detekt") version "1.11.0"
signing
id("com.github.ben-manes.versions") version "0.38.0"
id("io.gitlab.arturbosch.detekt") version "1.16.0"
id("net.thauvin.erik.gradle.semver") version "1.0.4"
id("org.jetbrains.dokka") version "1.4.0-rc"
id("org.jetbrains.kotlin.jvm") version "1.4.0"
id("org.jetbrains.kotlin.kapt") version "1.4.0"
id("org.sonarqube") version "3.0"
id("org.jetbrains.dokka") version "1.4.30"
id("org.jetbrains.kotlin.jvm") version "1.4.31"
id("org.jetbrains.kotlin.kapt") version "1.4.31"
id("org.sonarqube") version "3.1.1"
}
group = "net.thauvin.erik"
@ -31,34 +28,20 @@ var semverProcessor = "net.thauvin.erik:semver:1.2.0"
val publicationName = "mavenJava"
object VersionInfo {
const val okhttp = "4.8.1"
const val okhttp = "4.9.1"
}
val versions: VersionInfo by extra { VersionInfo }
// Load local.properties
File("local.properties").apply {
if (exists()) {
FileInputStream(this).use { fis ->
Properties().apply {
load(fis)
forEach { (k, v) ->
extra[k as String] = v
}
}
}
}
}
repositories {
jcenter()
mavenCentral()
jcenter() // needed for dokka
}
dependencies {
implementation("com.squareup.okhttp3:okhttp:${versions.okhttp}")
implementation("com.squareup.okhttp3:logging-interceptor:${versions.okhttp}")
implementation("org.json:json:20200518")
implementation("org.json:json:20210307")
// Use the Kotlin test library.
testImplementation("org.jetbrains.kotlin:kotlin-test")
@ -76,13 +59,10 @@ detekt {
baseline = project.rootDir.resolve("config/detekt/baseline.xml")
}
jacoco {
toolVersion = "0.8.5"
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withSourcesJar()
}
sonarqube {
@ -92,11 +72,6 @@ sonarqube {
}
}
val sourcesJar by tasks.creating(Jar::class) {
archiveClassifier.set("sources")
from(sourceSets.getByName("main").allSource)
}
val javadocJar by tasks.creating(Jar::class) {
dependsOn(tasks.dokkaJavadoc)
from(tasks.dokkaJavadoc)
@ -122,7 +97,7 @@ tasks {
}
assemble {
dependsOn(sourcesJar, javadocJar)
dependsOn(javadocJar)
}
clean {
@ -132,16 +107,16 @@ tasks {
}
dokkaHtml {
outputDirectory = "$projectDir/docs"
outputDirectory.set(file("$projectDir/docs"))
dokkaSourceSets {
configureEach {
jdkVersion = 8
includes = listOf("config/dokka/packages.md")
jdkVersion.set(8)
includes.from("config/dokka/packages.md")
sourceLink {
path = "/src/main/kotlin/"
url = "https://github.com/ethauvin/${project.name}/tree/master/src/main/kotlin/"
lineSuffix = "#L"
localDirectory.set(file("/src/main/kotlin/"))
remoteUrl.set(URL("https://github.com/ethauvin/${project.name}/tree/master/src/main/kotlin/"))
remoteLineSuffix.set("#L")
}
}
@ -151,8 +126,8 @@ tasks {
dokkaJavadoc {
dokkaSourceSets {
configureEach {
jdkVersion = 8
includes = listOf("config/dokka/packages.md")
jdkVersion.set(8)
includes.from("config/dokka/packages.md")
}
}
dependsOn(dokkaHtml)
@ -190,20 +165,10 @@ tasks {
}
}
val bintrayUpload by existing(BintrayUploadTask::class) {
dependsOn(publishToMavenLocal, gitTag)
doFirst {
versionName = "${project.version}"
versionDesc = "${project.name} ${project.version}"
versionVcsTag = "${project.version}"
versionReleased = Date().toString()
}
}
register("release") {
description = "Publishes version ${project.version} to Bintray."
description = "Publishes version ${project.version} to local repository."
group = PublishingPlugin.PUBLISH_TASK_GROUP
dependsOn("wrapper", bintrayUpload)
dependsOn("wrapper", "deploy", "gitTag", "publishToMavenLocal")
}
"sonarqube" {
@ -211,86 +176,51 @@ tasks {
}
}
fun findProperty(s: String) = project.findProperty(s) as String?
bintray {
user = findProperty("bintray.user")
key = findProperty("bintray.apikey")
publish = isRelease
setPublications(publicationName)
pkg.apply {
repo = "maven"
name = project.name
desc = description
websiteUrl = mavenUrl
issueTrackerUrl = "$mavenUrl/issues"
githubRepo = gitHub
githubReleaseNotesFile = "README.md"
vcsUrl = "$mavenUrl.git"
setLabels(
"android",
"bitlinks",
"bitly",
"bitly-api",
"bitly-v4",
"java",
"kotlin",
"shorten",
"shorten-urls",
"shortener",
"shortener-rest",
"shortener-service",
"shortens-links",
"shorturl",
"url-shortener"
)
setLicenses("BSD 3-Clause")
publicDownloadNumbers = true
version.apply {
name = project.version as String
desc = description
vcsTag = project.version as String
gpg.apply {
sign = true
}
}
}
}
publishing {
publications {
create<MavenPublication>(publicationName) {
from(components["java"])
artifact(sourcesJar)
artifact(javadocJar)
pom.withXml {
asNode().apply {
appendNode("name", project.name)
appendNode("description", project.description)
appendNode("url", mavenUrl)
appendNode("licenses").appendNode("license").apply {
appendNode("name", "BSD 3-Clause")
appendNode("url", "https://opensource.org/licenses/BSD-3-Clause")
pom {
name.set(project.name)
description.set(project.description)
url.set(mavenUrl)
licenses {
license {
name.set("BSD 3-Clause")
url.set("https://opensource.org/licenses/BSD-3-Clause")
}
appendNode("developers").appendNode("developer").apply {
appendNode("id", "ethauvin")
appendNode("name", "Erik C. Thauvin")
appendNode("email", "erik@thauvin.net")
}
appendNode("scm").apply {
appendNode("connection", "scm:git:$mavenUrl.git")
appendNode("developerConnection", "scm:git:git@github.com:$gitHub.git")
appendNode("url", mavenUrl)
}
appendNode("issueManagement").apply {
appendNode("system", "GitHub")
appendNode("url", "$mavenUrl/issues")
}
developers {
developer {
id.set("ethauvin")
name.set("Erik C. Thauvin")
email.set("erik@thauvin.net")
url.set("https://erik.thauvin.net/")
}
}
scm {
connection.set("scm:git:git://github.com/$gitHub.git")
developerConnection.set("scm:git:git@github.com:$gitHub.git")
url.set("$mavenUrl")
}
issueManagement {
system.set("GitHub")
url.set("$mavenUrl/issues")
}
}
}
}
repositories {
maven {
name = "ossrh"
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials(PasswordCredentials::class)
}
}
}
signing {
useGpgCmd()
sign(publishing.publications[publicationName])
}