2018-08-18 23:15:46 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2018 dorkbox, llc
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
import Build_gradle.Extras.bcVersion
|
2018-08-18 23:15:46 +02:00
|
|
|
import java.nio.file.Paths
|
|
|
|
import java.time.Instant
|
2019-01-12 23:59:52 +01:00
|
|
|
import java.util.Properties
|
|
|
|
import kotlin.reflect.full.declaredMemberProperties
|
|
|
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|
|
|
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
|
2019-01-14 01:36:58 +01:00
|
|
|
import org.gradle.plugins.ide.idea.model.*
|
|
|
|
import org.gradle.plugins.ide.idea.model.Dependency
|
|
|
|
import org.gradle.plugins.ide.idea.model.ModuleDependency
|
2019-01-12 23:59:52 +01:00
|
|
|
import org.jetbrains.kotlin.backend.common.onlyIf
|
2019-01-13 17:38:51 +01:00
|
|
|
import java.io.*
|
|
|
|
import java.net.*
|
|
|
|
import java.nio.charset.StandardCharsets.UTF_8
|
|
|
|
import kotlin.reflect.KMutableProperty
|
2018-08-18 23:15:46 +02:00
|
|
|
|
2019-01-16 12:10:26 +01:00
|
|
|
///////////////////////////////
|
|
|
|
////// PUBLISH TO SONATYPE / MAVEN CENTRAL
|
|
|
|
//////
|
|
|
|
////// TESTING : local maven repo <PUBLISHING - publishToMavenLocal>
|
|
|
|
//////
|
|
|
|
////// RELEASE : sonatype / maven central, <PUBLISHING - publish> then <RELEASE - closeAndReleaseRepository>
|
|
|
|
///////////////////////////////
|
|
|
|
|
2019-01-13 17:56:27 +01:00
|
|
|
println("\tGradle ${project.gradle.gradleVersion}")
|
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
plugins {
|
|
|
|
java
|
|
|
|
signing
|
|
|
|
`maven-publish`
|
2018-08-18 23:15:46 +02:00
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
// close and release on sonatype
|
|
|
|
id("io.codearte.nexus-staging") version "0.20.0"
|
2018-08-18 23:15:46 +02:00
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
id("com.dorkbox.CrossCompile") version "1.0.1"
|
|
|
|
id("com.dorkbox.Licensing") version "1.4"
|
|
|
|
id("com.dorkbox.VersionUpdate") version "1.4.1"
|
|
|
|
|
|
|
|
// setup checking for the latest version of a plugin or dependency
|
|
|
|
id("com.github.ben-manes.versions") version "0.20.0"
|
|
|
|
|
|
|
|
kotlin("jvm") version "1.3.11"
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
object Extras {
|
|
|
|
// set for the project
|
|
|
|
const val description = "Encrypted, high-performance, and event-driven/reactive network stack for Java 6+"
|
|
|
|
const val group = "com.dorkbox"
|
2019-01-16 11:44:11 +01:00
|
|
|
const val version = "2.15"
|
2019-01-12 23:59:52 +01:00
|
|
|
|
|
|
|
// set as project.ext
|
|
|
|
const val name = "Network"
|
|
|
|
const val id = "Network"
|
|
|
|
const val vendor = "Dorkbox LLC"
|
|
|
|
const val url = "https://git.dorkbox.com/dorkbox/Network"
|
|
|
|
val buildDate = Instant.now().toString()
|
2018-08-18 23:15:46 +02:00
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
val JAVA_VERSION = JavaVersion.VERSION_1_6.toString()
|
2018-08-18 23:15:46 +02:00
|
|
|
|
2019-01-13 17:38:51 +01:00
|
|
|
const val bcVersion = "1.60"
|
2018-08-18 23:15:46 +02:00
|
|
|
|
2019-01-13 17:38:51 +01:00
|
|
|
var sonatypeUserName = ""
|
2019-01-12 23:59:52 +01:00
|
|
|
var sonatypePassword = ""
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////
|
2019-01-13 17:57:37 +01:00
|
|
|
///// assign 'Extras'
|
2019-01-12 23:59:52 +01:00
|
|
|
///////////////////////////////
|
|
|
|
description = Extras.description
|
|
|
|
group = Extras.group
|
|
|
|
version = Extras.version
|
|
|
|
|
2019-01-13 17:38:51 +01:00
|
|
|
val propsFile = File("$projectDir/../../gradle.properties").normalize()
|
|
|
|
if (propsFile.canRead()) {
|
|
|
|
println("\tLoading custom property data from: [$propsFile]")
|
|
|
|
|
|
|
|
val props = Properties()
|
2019-01-13 22:42:59 +01:00
|
|
|
propsFile.inputStream().use {
|
|
|
|
props.load(it)
|
|
|
|
}
|
2019-01-13 17:38:51 +01:00
|
|
|
|
|
|
|
val extraProperties = Extras::class.declaredMemberProperties.filterIsInstance<KMutableProperty<String>>()
|
|
|
|
props.forEach { (k, v) -> run {
|
|
|
|
val key = k as String
|
|
|
|
val value = v as String
|
2018-08-18 23:15:46 +02:00
|
|
|
|
2019-01-13 17:38:51 +01:00
|
|
|
val member = extraProperties.find { it.name == key }
|
|
|
|
if (member != null) {
|
|
|
|
member.setter.call(Extras::class.objectInstance, value)
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
project.extra.set(k, v)
|
|
|
|
}
|
2019-01-13 17:57:37 +01:00
|
|
|
}}
|
2019-01-13 17:38:51 +01:00
|
|
|
}
|
2018-08-18 23:15:46 +02:00
|
|
|
|
|
|
|
licensing {
|
|
|
|
license(License.APACHE_2) {
|
2019-01-12 23:59:52 +01:00
|
|
|
author(Extras.vendor)
|
|
|
|
url(Extras.url)
|
|
|
|
note(Extras.description)
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
license("Dorkbox Utils", License.APACHE_2) {
|
|
|
|
author(Extras.vendor)
|
|
|
|
url("https://git.dorkbox.com/dorkbox/Utilities")
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
license("Bennidi Iterator", License.MIT) {
|
|
|
|
copyright(2012)
|
|
|
|
author("Benjamin Diedrichsen")
|
|
|
|
url("https://github.com/bennidi/mbassador")
|
|
|
|
note("Fast iterators from the MBassador project")
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
license("BouncyCastle", License.MIT) {
|
|
|
|
copyright(2009)
|
|
|
|
author("The Legion Of The Bouncy Castle")
|
|
|
|
url("http://www.bouncycastle.org")
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
license("ObjectPool", License.APACHE_2) {
|
|
|
|
author("dorkbox, llc")
|
|
|
|
url("https://git.dorkbox.com/dorkbox/ObjectPool")
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
license("FastThreadLocal", License.BSD_3) {
|
|
|
|
copyright(2014)
|
|
|
|
author("Lightweight Java Game Library Project")
|
|
|
|
author("Riven")
|
|
|
|
url("https://github.com/LWJGL/lwjgl3/blob/5819c9123222f6ce51f208e022cb907091dd8023/modules/core/src/main/java/org/lwjgl/system/FastThreadLocal.java")
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
license("Javassist", License.BSD_3) {
|
|
|
|
copyright(1999)
|
|
|
|
author("Shigeru Chiba")
|
|
|
|
author("Bill Burke")
|
|
|
|
author("Jason T. Greene")
|
|
|
|
url("http://www.csg.is.titech.ac.jp/~chiba/java")
|
|
|
|
note("Licensed under the MPL/LGPL/Apache triple license")
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
license("Kryo", License.BSD_3) {
|
|
|
|
copyright(2008)
|
|
|
|
author("Nathan Sweet")
|
|
|
|
url("https://github.com/EsotericSoftware/kryo")
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
license("kryo-serializers", License.APACHE_2) {
|
|
|
|
copyright(2010)
|
|
|
|
author("Martin Grotzke")
|
|
|
|
author("Rafael Winterhalter")
|
|
|
|
url("https://github.com/magro/kryo-serializers")
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
license("KryoNet RMI", License.BSD_3) {
|
|
|
|
copyright(2008)
|
|
|
|
author("Nathan Sweet")
|
|
|
|
url("https://github.com/EsotericSoftware/kryonet")
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
license("LAN HostDiscovery from Apache Commons JCS", License.APACHE_2) {
|
|
|
|
copyright(2014)
|
|
|
|
author("The Apache Software Foundation")
|
|
|
|
url("https://issues.apache.org/jira/browse/JCS-40")
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
license("LZ4 and XXhash", License.APACHE_2) {
|
|
|
|
copyright(2011)
|
|
|
|
copyright(2012)
|
|
|
|
author("Yann Collet")
|
|
|
|
author("Adrien Grand")
|
|
|
|
url("https://github.com/jpountz/lz4-java")
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
license("MathUtils, IntArray, IntMap", License.APACHE_2) {
|
|
|
|
copyright(2013)
|
|
|
|
author("Mario Zechner <badlogicgames@gmail.com>")
|
|
|
|
author("Nathan Sweet <nathan.sweet@gmail.com>")
|
|
|
|
url("http://github.com/libgdx/libgdx/")
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
license("MinLog-SLF4J", License.APACHE_2) {
|
|
|
|
copyright(2008)
|
|
|
|
author("dorkbox, llc")
|
|
|
|
author("Nathan Sweet")
|
|
|
|
author("Dan Brown")
|
|
|
|
url("https://git.dorkbox.com/dorkbox/MinLog-SLF4J")
|
|
|
|
url("https://github.com/EsotericSoftware/minlog")
|
|
|
|
note("Drop-in replacement for MinLog to log through SLF4j.")
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
license("ReflectASM", License.BSD_3) {
|
|
|
|
copyright(2008)
|
|
|
|
author("Nathan Sweet")
|
|
|
|
url("https://github.com/EsotericSoftware/reflectasm")
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
license("SLF4J", License.MIT) {
|
|
|
|
copyright(2008)
|
|
|
|
author("QOS.ch")
|
|
|
|
url("http://www.slf4j.org")
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
license("TypeTools", License.APACHE_2) {
|
|
|
|
copyright(2017)
|
|
|
|
author("Jonathan Halterman")
|
|
|
|
url("https://github.com/jhalterman/typetools/")
|
|
|
|
note("Tools for resolving generic types")
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sourceSets {
|
|
|
|
main {
|
|
|
|
java {
|
2019-01-12 23:59:52 +01:00
|
|
|
setSrcDirs(listOf("src"))
|
|
|
|
|
|
|
|
// want to include java files for the source. 'setSrcDirs' resets includes...
|
|
|
|
include("**/*.java")
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
}
|
2019-01-12 23:59:52 +01:00
|
|
|
|
2019-01-09 19:51:57 +01:00
|
|
|
test {
|
|
|
|
java {
|
2019-01-12 23:59:52 +01:00
|
|
|
setSrcDirs(listOf("test"))
|
|
|
|
|
|
|
|
// want to include java files for the source. 'setSrcDirs' resets includes...
|
|
|
|
include("**/*.java")
|
2019-01-09 19:51:57 +01:00
|
|
|
}
|
|
|
|
}
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
jcenter()
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////
|
|
|
|
////// Task defaults
|
|
|
|
///////////////////////////////
|
2019-01-12 23:59:52 +01:00
|
|
|
tasks.withType<JavaCompile> {
|
|
|
|
options.encoding = "UTF-8"
|
2018-08-18 23:15:46 +02:00
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
sourceCompatibility = Extras.JAVA_VERSION
|
|
|
|
targetCompatibility = Extras.JAVA_VERSION
|
|
|
|
}
|
2018-08-18 23:15:46 +02:00
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
tasks.withType<Jar> {
|
|
|
|
duplicatesStrategy = DuplicatesStrategy.FAIL
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
|
2019-01-14 01:36:58 +01:00
|
|
|
tasks.compileJava.get().apply {
|
|
|
|
println("\tCompiling classes to Java $sourceCompatibility")
|
|
|
|
}
|
2019-01-12 23:59:52 +01:00
|
|
|
|
2019-01-16 12:10:26 +01:00
|
|
|
|
2018-08-18 23:15:46 +02:00
|
|
|
///////////////////////////////
|
2019-01-14 10:38:06 +01:00
|
|
|
////// UTILITIES COMPILE
|
2018-08-18 23:15:46 +02:00
|
|
|
///////////////////////////////
|
2019-01-14 01:36:58 +01:00
|
|
|
|
2019-01-16 12:10:26 +01:00
|
|
|
// as long as the 'Utilities' project is ALSO imported into IntelliJ, class resolution will work (add the sources in the intellij project)
|
2019-01-14 01:36:58 +01:00
|
|
|
val utils : Configuration by configurations.creating
|
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
fun javaFile(vararg fileNames: String): Iterable<String> {
|
2019-01-14 10:38:06 +01:00
|
|
|
val fileList = ArrayList<String>(fileNames.size)
|
2018-08-18 23:15:46 +02:00
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
fileNames.forEach { name ->
|
|
|
|
fileList.add(name.replace('.', '/') + ".java")
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return fileList
|
|
|
|
}
|
|
|
|
|
2019-01-14 01:36:58 +01:00
|
|
|
task<JavaCompile>("compileUtilsJava8") {
|
|
|
|
// we don't want the default include of **/*.java
|
|
|
|
includes.clear()
|
|
|
|
|
|
|
|
source = fileTree("../Utilities/src")
|
|
|
|
|
|
|
|
// this class must be compiled java 8+
|
|
|
|
include(javaFile("dorkbox.util.generics.DefaultMethodHelper"))
|
|
|
|
|
|
|
|
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
|
|
|
|
targetCompatibility = JavaVersion.VERSION_1_8.toString()
|
|
|
|
|
|
|
|
|
|
|
|
classpath = files()
|
|
|
|
destinationDir = file("$rootDir/build/classes_utilities")
|
|
|
|
|
|
|
|
println("\tCompiling $includes to Java $sourceCompatibility")
|
|
|
|
}
|
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
task<JavaCompile>("compileUtils") {
|
2019-01-14 01:36:58 +01:00
|
|
|
val utilsJava8 = tasks["compileUtilsJava8"]
|
|
|
|
dependsOn(utilsJava8)
|
|
|
|
|
2018-08-18 23:15:46 +02:00
|
|
|
// we don't want the default include of **/*.java
|
2019-01-12 23:59:52 +01:00
|
|
|
includes.clear()
|
|
|
|
|
|
|
|
source = fileTree("../Utilities/src")
|
|
|
|
include(javaFile(
|
|
|
|
"dorkbox.util.OS",
|
|
|
|
"dorkbox.util.OSType",
|
|
|
|
"dorkbox.util.Property",
|
|
|
|
"dorkbox.util.NamedThreadFactory",
|
|
|
|
"dorkbox.util.DelayTimer",
|
|
|
|
"dorkbox.util.IO",
|
|
|
|
"dorkbox.util.FileUtil",
|
|
|
|
"dorkbox.util.Base64Fast",
|
|
|
|
"dorkbox.util.RandomUtil",
|
|
|
|
"dorkbox.util.Sys",
|
|
|
|
"dorkbox.util.HashUtil",
|
|
|
|
"dorkbox.util.NativeLoader",
|
|
|
|
|
|
|
|
"dorkbox.util.FastThreadLocal",
|
|
|
|
"dorkbox.util.LocationResolver",
|
|
|
|
"dorkbox.util.MathUtil",
|
|
|
|
"dorkbox.util.MersenneTwisterFast",
|
|
|
|
"dorkbox.util.NativeLoader",
|
|
|
|
|
|
|
|
"dorkbox.util.generics.TypeResolver",
|
|
|
|
// "dorkbox.util.generics.DefaultMethodHelper", // this class must be compiled java 8+
|
|
|
|
"dorkbox.util.generics.ClassHelper",
|
|
|
|
|
|
|
|
"dorkbox.util.bytes.BigEndian",
|
|
|
|
"dorkbox.util.bytes.UByte",
|
|
|
|
"dorkbox.util.bytes.UInteger",
|
|
|
|
"dorkbox.util.bytes.ULong",
|
|
|
|
"dorkbox.util.bytes.Unsigned",
|
|
|
|
"dorkbox.util.bytes.UNumber",
|
|
|
|
"dorkbox.util.bytes.UShort",
|
|
|
|
"dorkbox.util.bytes.ByteArrayWrapper",
|
|
|
|
"dorkbox.util.bytes.OptimizeUtilsByteArray",
|
|
|
|
"dorkbox.util.bytes.OptimizeUtilsByteBuf",
|
|
|
|
|
|
|
|
"dorkbox.util.exceptions.SecurityException",
|
|
|
|
"dorkbox.util.exceptions.InitializationException",
|
|
|
|
|
|
|
|
|
|
|
|
"dorkbox.util.collections.ObjectIntMap",
|
|
|
|
"dorkbox.util.collections.IntMap",
|
|
|
|
"dorkbox.util.collections.IntArray",
|
|
|
|
"dorkbox.util.collections.ConcurrentIterator",
|
|
|
|
"dorkbox.util.collections.ConcurrentEntry",
|
|
|
|
"dorkbox.util.collections.LockFreeHashMap",
|
|
|
|
"dorkbox.util.collections.LockFreeIntMap",
|
|
|
|
"dorkbox.util.collections.LockFreeIntBiMap",
|
|
|
|
"dorkbox.util.collections.LockFreeObjectIntBiMap",
|
|
|
|
|
|
|
|
"dorkbox.util.crypto.CryptoECC",
|
|
|
|
"dorkbox.util.crypto.CryptoAES"))
|
2018-08-18 23:15:46 +02:00
|
|
|
|
|
|
|
// entire packages/directories
|
2019-01-12 23:59:52 +01:00
|
|
|
include("dorkbox/util/serialization/**/*.java")
|
|
|
|
include("dorkbox/util/entropy/**/*.java")
|
|
|
|
include("dorkbox/util/storage/**/*.java")
|
2018-08-18 23:15:46 +02:00
|
|
|
|
2019-01-14 01:36:58 +01:00
|
|
|
classpath = files(utils, utilsJava8.outputs)
|
2018-08-18 23:15:46 +02:00
|
|
|
destinationDir = file("$rootDir/build/classes_utilities")
|
|
|
|
}
|
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
|
2019-01-14 01:36:58 +01:00
|
|
|
dependencies {
|
|
|
|
val netty = api("io.netty:netty-all:4.1.32.Final")
|
|
|
|
val kryo = api("com.esotericsoftware:kryo:4.0.2")
|
|
|
|
api("net.jpountz.lz4:lz4:1.3.0")
|
2019-01-12 23:59:52 +01:00
|
|
|
|
2019-01-14 10:38:06 +01:00
|
|
|
val bc = api("org.bouncycastle:bcprov-jdk15on:$bcVersion")
|
2019-01-14 01:36:58 +01:00
|
|
|
api("org.bouncycastle:bcpg-jdk15on:$bcVersion")
|
|
|
|
api("org.bouncycastle:bcmail-jdk15on:$bcVersion")
|
|
|
|
api("org.bouncycastle:bctls-jdk15on:$bcVersion")
|
2019-01-12 23:59:52 +01:00
|
|
|
|
|
|
|
|
2019-01-14 01:36:58 +01:00
|
|
|
api("com.dorkbox:ObjectPool:2.11")
|
2019-01-12 23:59:52 +01:00
|
|
|
|
2019-01-14 01:36:58 +01:00
|
|
|
val slf4j = implementation ("org.slf4j:slf4j-api:1.7.25")
|
2019-01-12 23:59:52 +01:00
|
|
|
|
2019-01-14 01:36:58 +01:00
|
|
|
testCompile("junit:junit:4.12")
|
|
|
|
testCompile("ch.qos.logback:logback-classic:1.2.3")
|
|
|
|
|
|
|
|
// add compile utils to dependencies
|
2019-01-14 10:38:06 +01:00
|
|
|
implementation(files((tasks["compileUtils"] as JavaCompile).outputs))
|
|
|
|
utils.dependencies += listOf(netty, kryo, slf4j, bc)
|
2019-01-12 23:59:52 +01:00
|
|
|
}
|
|
|
|
|
2018-08-18 23:15:46 +02:00
|
|
|
|
|
|
|
///////////////////////////////
|
|
|
|
////// Jar Tasks
|
|
|
|
///////////////////////////////
|
2019-01-12 23:59:52 +01:00
|
|
|
tasks.jar.get().apply {
|
2018-08-18 23:15:46 +02:00
|
|
|
// include applicable class files from subset of Utilities project
|
2019-01-14 01:36:58 +01:00
|
|
|
from((tasks["compileUtils"] as JavaCompile).outputs)
|
2019-01-12 23:59:52 +01:00
|
|
|
|
|
|
|
manifest {
|
|
|
|
// https://docs.oracle.com/javase/tutorial/deployment/jar/packageman.html
|
|
|
|
attributes["Name"] = Extras.name
|
|
|
|
|
|
|
|
attributes["Specification-Title"] = Extras.name
|
|
|
|
attributes["Specification-Version"] = Extras.version
|
|
|
|
attributes["Specification-Vendor"] = Extras.vendor
|
|
|
|
|
|
|
|
attributes["Implementation-Title"] = "${Extras.group}.${Extras.id}"
|
|
|
|
attributes["Implementation-Version"] = Extras.buildDate
|
|
|
|
attributes["Implementation-Vendor"] = Extras.vendor
|
|
|
|
}
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
|
2019-01-16 12:10:26 +01:00
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
///////////////////////////////
|
2019-01-16 12:10:26 +01:00
|
|
|
////// PUBLISH TO SONATYPE / MAVEN CENTRAL
|
|
|
|
//////
|
|
|
|
////// TESTING : local maven repo <PUBLISHING - publishToMavenLocal>
|
|
|
|
//////
|
|
|
|
////// RELEASE : sonatype / maven central, <PUBLISHING - publish> then <RELEASE - closeAndReleaseRepository>
|
2019-01-12 23:59:52 +01:00
|
|
|
///////////////////////////////
|
|
|
|
val sourceJar = task<Jar>("sourceJar") {
|
2018-08-18 23:15:46 +02:00
|
|
|
description = "Creates a JAR that contains the source code."
|
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
from(sourceSets["main"].java)
|
2018-08-18 23:15:46 +02:00
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
archiveClassifier.set("sources")
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
val javaDocJar = task<Jar>("javaDocJar") {
|
2018-08-18 23:15:46 +02:00
|
|
|
description = "Creates a JAR that contains the javadocs."
|
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
archiveClassifier.set("javadoc")
|
|
|
|
}
|
|
|
|
|
2018-08-18 23:15:46 +02:00
|
|
|
publishing {
|
|
|
|
publications {
|
2019-01-12 23:59:52 +01:00
|
|
|
create<MavenPublication>("maven") {
|
|
|
|
groupId = Extras.group
|
|
|
|
artifactId = Extras.id
|
|
|
|
version = Extras.version
|
2018-08-18 23:15:46 +02:00
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
from(components["java"])
|
2018-08-18 23:15:46 +02:00
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
artifact(sourceJar)
|
|
|
|
artifact(javaDocJar)
|
2018-08-18 23:15:46 +02:00
|
|
|
|
|
|
|
pom {
|
2019-01-12 23:59:52 +01:00
|
|
|
name.set(Extras.name)
|
|
|
|
description.set(Extras.description)
|
|
|
|
url.set(Extras.url)
|
2018-08-18 23:15:46 +02:00
|
|
|
|
|
|
|
issueManagement {
|
2019-01-12 23:59:52 +01:00
|
|
|
url.set("${Extras.url}/issues")
|
|
|
|
system.set("Gitea Issues")
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
organization {
|
2019-01-12 23:59:52 +01:00
|
|
|
name.set(Extras.vendor)
|
|
|
|
url.set("https://dorkbox.com")
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
developers {
|
|
|
|
developer {
|
2019-01-12 23:59:52 +01:00
|
|
|
id.set("dorkbox")
|
|
|
|
name.set(Extras.vendor)
|
|
|
|
email.set("email@dorkbox.com")
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
scm {
|
2019-01-12 23:59:52 +01:00
|
|
|
url.set(Extras.url)
|
|
|
|
connection.set("scm:${Extras.url}.git")
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
}
|
2019-01-12 23:59:52 +01:00
|
|
|
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
|
2018-08-18 23:15:46 +02:00
|
|
|
repositories {
|
|
|
|
maven {
|
2019-01-12 23:59:52 +01:00
|
|
|
setUrl("https://oss.sonatype.org/service/local/staging/deploy/maven2")
|
2018-08-18 23:15:46 +02:00
|
|
|
credentials {
|
2019-01-13 17:38:51 +01:00
|
|
|
username = Extras.sonatypeUserName
|
2019-01-12 23:59:52 +01:00
|
|
|
password = Extras.sonatypePassword
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-01-12 23:59:52 +01:00
|
|
|
|
|
|
|
|
|
|
|
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/")
|
|
|
|
}
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
nexusStaging {
|
2019-01-13 17:38:51 +01:00
|
|
|
username = Extras.sonatypeUserName
|
2019-01-12 23:59:52 +01:00
|
|
|
password = Extras.sonatypePassword
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
signing {
|
2019-01-12 23:59:52 +01:00
|
|
|
sign(publishing.publications["maven"])
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
|
|
|
|
2019-01-16 12:10:26 +01:00
|
|
|
|
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
///////////////////////////////
|
|
|
|
///// Prevent anything other than a release from showing version updates
|
|
|
|
//// https://github.com/ben-manes/gradle-versions-plugin/blob/master/README.md
|
|
|
|
///////////////////////////////
|
|
|
|
tasks.named<DependencyUpdatesTask>("dependencyUpdates") {
|
|
|
|
resolutionStrategy {
|
|
|
|
componentSelection {
|
|
|
|
all {
|
|
|
|
val rejected = listOf("alpha", "beta", "rc", "cr", "m", "preview")
|
|
|
|
.map { qualifier -> Regex("(?i).*[.-]$qualifier[.\\d-]*") }
|
|
|
|
.any { it.matches(candidate.version) }
|
|
|
|
if (rejected) {
|
|
|
|
reject("Release candidate")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
2019-01-12 23:59:52 +01:00
|
|
|
|
|
|
|
// optional parameters
|
|
|
|
checkForGradleUpdate = true
|
2018-08-18 23:15:46 +02:00
|
|
|
}
|
2018-09-25 20:02:39 +02:00
|
|
|
|
2019-01-16 12:10:26 +01:00
|
|
|
|
2019-01-12 23:59:52 +01:00
|
|
|
///////////////////////////////
|
|
|
|
////// Gradle Wrapper Configuration.
|
|
|
|
///// Run this task, then refresh the gradle project
|
|
|
|
///////////////////////////////
|
|
|
|
val wrapperUpdate by tasks.creating(Wrapper::class) {
|
|
|
|
gradleVersion = "5.1.1"
|
2018-09-25 20:02:39 +02:00
|
|
|
distributionUrl = distributionUrl.replace("bin", "all")
|
2018-09-25 20:10:57 +02:00
|
|
|
}
|