Updated libraries

This commit is contained in:
nathan 2020-09-19 22:10:23 +02:00
parent 0a381a0097
commit 4ffe9a77f3
1 changed files with 32 additions and 159 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2018 dorkbox, llc
* Copyright 2020 dorkbox, llc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,83 +14,71 @@
* limitations under the License.
*/
import dorkbox.gradle.kotlin
import java.time.Instant
///////////////////////////////
////// PUBLISH TO SONATYPE / MAVEN CENTRAL
//////
////// TESTING : local maven repo <PUBLISHING - publishToMavenLocal>
//////
////// RELEASE : sonatype / maven central, <PUBLISHING - publish> then <RELEASE - closeAndReleaseRepository>
////// TESTING : (to local maven repo) <'publish and release' - 'publishToMavenLocal'>
////// RELEASE : (to sonatype/maven central), <'publish and release' - 'publishToSonatypeAndRelease'>
///////////////////////////////
println("\tGradle ${project.gradle.gradleVersion} on Java ${JavaVersion.current()}")
gradle.startParameter.showStacktrace = ShowStacktrace.ALWAYS // always show the stacktrace!
gradle.startParameter.warningMode = WarningMode.All
plugins {
java
signing
`maven-publish`
// close and release on sonatype
id("io.codearte.nexus-staging") version "0.21.0"
id("com.dorkbox.GradleUtils") version "1.9"
id("com.dorkbox.Licensing") version "2.2"
id("com.dorkbox.VersionUpdate") version "2.0"
id("com.dorkbox.GradlePublish") version "1.4"
id("com.dorkbox.GradleModuleInfo") version "1.0"
id("com.dorkbox.CrossCompile") version "1.0.1"
id("com.dorkbox.Licensing") version "1.4"
id("com.dorkbox.VersionUpdate") version "1.6"
id("com.dorkbox.GradleUtils") version "1.2"
kotlin("jvm") version "1.3.31"
kotlin("jvm") version "1.3.72"
}
object Extras {
// set for the project
const val description = "Fast, lightweight, and compatible blocking/non-blocking/soft-reference object pool for Java 6+"
const val group = "com.dorkbox"
const val version = "2.12"
// set as project.ext
const val name = "ObjectPool"
const val id = "ObjectPool"
const val version = "3.0"
const val vendor = "Dorkbox LLC"
const val vendorUrl = "https://dorkbox.com"
const val url = "https://git.dorkbox.com/dorkbox/ObjectPool"
val buildDate = Instant.now().toString()
val JAVA_VERSION = JavaVersion.VERSION_1_6.toString()
var sonatypeUserName = ""
var sonatypePassword = ""
const val coroutineVer = "1.3.8"
}
///////////////////////////////
///// assign 'Extras'
///////////////////////////////
GradleUtils.load("$projectDir/../../gradle.properties", Extras)
description = Extras.description
group = Extras.group
version = Extras.version
GradleUtils.fixIntellijPaths()
GradleUtils.defaultResolutionStrategy()
GradleUtils.compileConfiguration(JavaVersion.VERSION_11)
licensing {
license(License.APACHE_2) {
description(Extras.description)
author(Extras.vendor)
url(Extras.url)
note(Extras.description)
}
license("SLF4J", License.MIT) {
copyright(2008)
author("QOS.ch")
url("http://www.slf4j.org")
}
}
sourceSets {
main {
java {
kotlin {
setSrcDirs(listOf("src"))
// want to include java files for the source. 'setSrcDirs' resets includes...
include("**/*.java")
// want to include kotlin files for the source. 'setSrcDirs' resets includes...
include("**/*.kt")
}
}
}
@ -101,16 +89,6 @@ repositories {
}
///////////////////////////////
////// Task defaults
///////////////////////////////
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
sourceCompatibility = Extras.JAVA_VERSION
targetCompatibility = Extras.JAVA_VERSION
}
tasks.jar.get().apply {
manifest {
// https://docs.oracle.com/javase/tutorial/deployment/jar/packageman.html
@ -128,117 +106,12 @@ tasks.jar.get().apply {
}
}
tasks.compileJava.get().apply {
println("\tCompiling classes to Java $sourceCompatibility")
}
dependencies {
api("org.slf4j:slf4j-api:1.7.25")
api("com.conversantmedia:disruptor:1.2.15")
}
///////////////////////////////
////// PUBLISH TO SONATYPE / MAVEN CENTRAL
//////
////// TESTING : local maven repo <PUBLISHING - publishToMavenLocal>
//////
////// RELEASE : sonatype / maven central, <PUBLISHING - publish> then <RELEASE - closeAndReleaseRepository>
///////////////////////////////
val sourceJar = task<Jar>("sourceJar") {
description = "Creates a JAR that contains the source code."
from(sourceSets["main"].java)
archiveClassifier.set("sources")
}
val javaDocJar = task<Jar>("javaDocJar") {
description = "Creates a JAR that contains the javadocs."
archiveClassifier.set("javadoc")
}
publishing {
publications {
create<MavenPublication>("maven") {
groupId = Extras.group
artifactId = Extras.id
version = Extras.version
from(components["java"])
artifact(sourceJar)
artifact(javaDocJar)
pom {
name.set(Extras.name)
description.set(Extras.description)
url.set(Extras.url)
issueManagement {
url.set("${Extras.url}/issues")
system.set("Gitea Issues")
}
organization {
name.set(Extras.vendor)
url.set("https://dorkbox.com")
}
developers {
developer {
id.set("dorkbox")
name.set(Extras.vendor)
email.set("email@dorkbox.com")
}
}
scm {
url.set(Extras.url)
connection.set("scm:${Extras.url}.git")
}
}
}
}
repositories {
maven {
setUrl("https://oss.sonatype.org/service/local/staging/deploy/maven2")
credentials {
username = Extras.sonatypeUserName
password = Extras.sonatypePassword
}
}
}
tasks.withType<PublishToMavenRepository> {
onlyIf {
publication == publishing.publications["maven"] && repository == publishing.repositories["maven"]
}
}
tasks.withType<PublishToMavenLocal> {
onlyIf {
publication == publishing.publications["maven"]
}
}
// output the release URL in the console
tasks["releaseRepository"].doLast {
val url = "https://oss.sonatype.org/content/repositories/releases/"
val projectName = Extras.group.replace('.', '/')
val name = Extras.name
val version = Extras.version
println("Maven URL: $url$projectName/$name/$version/")
}
}
nexusStaging {
username = Extras.sonatypeUserName
password = Extras.sonatypePassword
}
signing {
sign(publishing.publications["maven"])
implementation(kotlin("stdlib-jdk8"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Extras.coroutineVer}")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-common:${Extras.coroutineVer}")
implementation("org.slf4j:slf4j-api:1.7.30")
implementation("com.conversantmedia:disruptor:1.2.17")
}