2021-08-23 08:52:16 +02:00
|
|
|
/*
|
2023-06-29 12:11:35 +02:00
|
|
|
* Copyright 2023 dorkbox, llc
|
2021-08-23 08:52:16 +02:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
///////////////////////////////
|
|
|
|
////// PUBLISH TO SONATYPE / MAVEN CENTRAL
|
|
|
|
////// TESTING : (to local maven repo) <'publish and release' - 'publishToMavenLocal'>
|
|
|
|
////// RELEASE : (to sonatype/maven central), <'publish and release' - 'publishToSonatypeAndRelease'>
|
|
|
|
///////////////////////////////
|
|
|
|
|
|
|
|
gradle.startParameter.showStacktrace = ShowStacktrace.ALWAYS // always show the stacktrace!
|
|
|
|
|
|
|
|
plugins {
|
2023-06-26 02:23:30 +02:00
|
|
|
id("com.dorkbox.GradleUtils") version "3.17"
|
2023-08-20 13:56:44 +02:00
|
|
|
id("com.dorkbox.Licensing") version "2.26"
|
2023-06-26 02:23:30 +02:00
|
|
|
id("com.dorkbox.VersionUpdate") version "2.8"
|
2023-02-14 23:47:04 +01:00
|
|
|
id("com.dorkbox.GradlePublish") version "1.18"
|
2021-08-23 08:52:16 +02:00
|
|
|
|
2023-08-21 02:20:41 +02:00
|
|
|
id("com.github.johnrengelman.shadow") version "8.1.1"
|
2022-08-19 00:49:42 +02:00
|
|
|
|
2023-08-21 02:20:41 +02:00
|
|
|
kotlin("jvm") version "1.9.0"
|
2021-08-23 08:52:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
object Extras {
|
|
|
|
// set for the project
|
2022-05-30 02:12:36 +02:00
|
|
|
const val description = "High-performance, event-driven/reactive network stack for Java 11+"
|
2021-08-23 08:52:16 +02:00
|
|
|
const val group = "com.dorkbox"
|
2023-09-04 14:23:06 +02:00
|
|
|
const val version = "6.10"
|
2021-08-23 08:52:16 +02:00
|
|
|
|
|
|
|
// set as project.ext
|
|
|
|
const val name = "Network"
|
|
|
|
const val id = "Network"
|
|
|
|
const val vendor = "Dorkbox LLC"
|
|
|
|
const val vendorUrl = "https://dorkbox.com"
|
|
|
|
const val url = "https://git.dorkbox.com/dorkbox/Network"
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////
|
|
|
|
///// assign 'Extras'
|
|
|
|
///////////////////////////////
|
|
|
|
GradleUtils.load("$projectDir/../../gradle.properties", Extras)
|
2023-06-29 19:58:44 +02:00
|
|
|
GradleUtils.defaults()
|
2023-07-11 09:48:26 +02:00
|
|
|
// because of the api changes for stacktrace stuff, it's best for us to ONLY support 11+
|
|
|
|
GradleUtils.compileConfiguration(JavaVersion.VERSION_11) {
|
|
|
|
// see: https://kotlinlang.org/docs/reference/using-gradle.html
|
|
|
|
// enable the use of inline classes. see https://kotlinlang.org/docs/reference/inline-classes.html
|
|
|
|
freeCompilerArgs = listOf("-Xinline-classes")
|
|
|
|
}
|
2023-07-11 00:27:39 +02:00
|
|
|
GradleUtils.jpms(JavaVersion.VERSION_11) // this is a bit of a hack to workaround JPMS support with a kotlin-only build.
|
2023-06-29 12:11:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
//val kotlin = project.extensions.getByType(org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension::class.java).sourceSets.getByName("main").kotlin
|
|
|
|
//kotlin.apply {
|
|
|
|
// setSrcDirs(project.files("src"))
|
|
|
|
// include("**/*.kt") // want to include kotlin files for the source. 'setSrcDirs' resets includes...
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
// if we are sending a SMALL byte array, then we SEND IT DIRECTLY in a more optimized manner (because we can count size info!)
|
|
|
|
// other side has to be able to parse/know that this was sent directly as bytes. It could be game state data, or voice data, etc.
|
|
|
|
// another idea is to be able to "send" a stream of bytes (this would also get chunked/etc!). if chunked, these are fixed byte sizes!
|
|
|
|
// -- the first byte manage: byte/message/stream/etc, no-crypt, crypt, crypt+compress
|
|
|
|
// - connection.inputStream() --> behaves as an input stream to remote endpoint --> connection.outputStream()
|
|
|
|
// -- open/close/flush/etc commands also go through
|
|
|
|
// -- this can be used to stream files/audio/etc VERY easily
|
|
|
|
// -- have a createInputStream(), which will cause the outputStream() on the remote end to be created.
|
|
|
|
// --- this remote outputStream is a file, raw??? this is setup by createInputStream() on the remote end
|
|
|
|
// - state-machine for kryo class registrations?
|
|
|
|
|
2023-07-11 09:48:26 +02:00
|
|
|
// ratelimiter, "other" package, send-on-idle
|
2021-08-23 08:52:16 +02:00
|
|
|
// rest of unit tests
|
|
|
|
// getConnectionUpgradeType
|
|
|
|
// ability to send with a function callback (using RMI waiter type stuff for callbacks)
|
|
|
|
|
|
|
|
// java 14 is faster with aeron!
|
2023-07-14 13:47:05 +02:00
|
|
|
|
|
|
|
|
2021-08-23 08:52:16 +02:00
|
|
|
|
|
|
|
|
|
|
|
licensing {
|
|
|
|
license(License.APACHE_2) {
|
|
|
|
description(Extras.description)
|
|
|
|
url(Extras.url)
|
|
|
|
author(Extras.vendor)
|
|
|
|
|
|
|
|
extra("KryoNet RMI", License.BSD_3) {
|
|
|
|
copyright(2008)
|
|
|
|
author("Nathan Sweet")
|
|
|
|
url("https://github.com/EsotericSoftware/kryonet")
|
|
|
|
}
|
|
|
|
extra("Kryo Serialization", License.BSD_3) {
|
|
|
|
copyright(2020)
|
|
|
|
author("Nathan Sweet")
|
|
|
|
url("https://github.com/EsotericSoftware/kryo")
|
|
|
|
}
|
|
|
|
extra("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")
|
|
|
|
}
|
|
|
|
extra("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")
|
|
|
|
}
|
|
|
|
extra("Netty (Various network + platform utilities)", License.APACHE_2) {
|
|
|
|
copyright(2014)
|
|
|
|
description("An event-driven asynchronous network application framework")
|
|
|
|
author("The Netty Project")
|
|
|
|
author("Contributors. See source NOTICE")
|
|
|
|
url("https://netty.io")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.jar.get().apply {
|
|
|
|
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}"
|
2023-06-26 02:23:30 +02:00
|
|
|
attributes["Implementation-Version"] = GradleUtils.now()
|
2021-08-23 08:52:16 +02:00
|
|
|
attributes["Implementation-Vendor"] = Extras.vendor
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-19 00:49:42 +02:00
|
|
|
|
|
|
|
val shadowJar: com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar by tasks
|
|
|
|
shadowJar.apply {
|
|
|
|
manifest.inheritFrom(tasks.jar.get().manifest)
|
|
|
|
|
|
|
|
manifest.attributes.apply {
|
2023-07-21 00:20:23 +02:00
|
|
|
put("Main-Class", "dorkboxTest.network.app.AeronRmiClientServer")
|
2022-08-19 00:49:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
mergeServiceFiles()
|
|
|
|
|
|
|
|
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
|
|
|
|
|
|
|
from(sourceSets.test.get().output)
|
|
|
|
configurations = listOf(project.configurations.testRuntimeClasspath.get())
|
|
|
|
|
|
|
|
archiveBaseName.set(project.name + "-all")
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-08-23 08:52:16 +02:00
|
|
|
dependencies {
|
2023-08-20 13:56:44 +02:00
|
|
|
api("org.jetbrains.kotlinx:atomicfu:0.22.0")
|
2023-08-06 09:00:29 +02:00
|
|
|
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
|
2021-08-23 08:52:16 +02:00
|
|
|
|
|
|
|
// https://github.com/dorkbox
|
2023-08-21 02:20:41 +02:00
|
|
|
api("com.dorkbox:ByteUtilities:2.0")
|
2023-08-20 13:56:44 +02:00
|
|
|
api("com.dorkbox:ClassUtils:1.3")
|
2023-08-12 00:23:49 +02:00
|
|
|
api("com.dorkbox:Collections:2.4")
|
2023-08-21 02:20:41 +02:00
|
|
|
api("com.dorkbox:HexUtilities:1.1")
|
2023-08-20 13:56:44 +02:00
|
|
|
api("com.dorkbox:JNA:1.2")
|
2023-02-08 22:56:56 +01:00
|
|
|
api("com.dorkbox:MinLog:2.5")
|
2023-08-20 13:56:44 +02:00
|
|
|
api("com.dorkbox:NetworkDNS:2.14")
|
|
|
|
api("com.dorkbox:NetworkUtils:2.23")
|
|
|
|
api("com.dorkbox:OS:1.8")
|
2023-06-29 12:11:35 +02:00
|
|
|
api("com.dorkbox:Serializers:2.9")
|
2023-08-20 13:56:44 +02:00
|
|
|
api("com.dorkbox:Storage:1.8")
|
2022-03-27 21:15:23 +02:00
|
|
|
api("com.dorkbox:Updates:1.1")
|
2023-08-21 02:20:41 +02:00
|
|
|
api("com.dorkbox:Utilities:1.46")
|
2023-08-05 21:24:21 +02:00
|
|
|
|
2023-09-04 14:23:06 +02:00
|
|
|
// necessary for thread dispatch without polluting the heap
|
|
|
|
// https://github.com/conversant/disruptor
|
|
|
|
api("com.conversantmedia:disruptor:1.2.21")
|
2021-08-23 08:52:16 +02:00
|
|
|
|
2023-06-29 12:11:35 +02:00
|
|
|
// how we bypass using reflection/jpms to access fields for java17+
|
|
|
|
api("org.javassist:javassist:3.29.2-GA")
|
|
|
|
|
|
|
|
|
2023-08-20 13:56:44 +02:00
|
|
|
val jnaVersion = "5.13.0"
|
2023-06-29 12:11:35 +02:00
|
|
|
api("net.java.dev.jna:jna-jpms:${jnaVersion}")
|
|
|
|
api("net.java.dev.jna:jna-platform-jpms:${jnaVersion}")
|
|
|
|
|
2021-08-23 08:52:16 +02:00
|
|
|
|
|
|
|
// https://github.com/real-logic/aeron
|
2023-08-21 02:20:41 +02:00
|
|
|
val aeronVer = "1.42.0"
|
2023-07-11 09:48:26 +02:00
|
|
|
api("io.aeron:aeron-driver:$aeronVer")
|
|
|
|
// ALL of aeron, in case we need to debug aeron behavior
|
|
|
|
// api("io.aeron:aeron-all:$aeronVer")
|
|
|
|
// api("org.agrona:agrona:1.18.2") // sources for this aren't included in aeron-all!
|
2021-08-23 08:52:16 +02:00
|
|
|
|
|
|
|
// https://github.com/EsotericSoftware/kryo
|
2023-06-26 02:23:30 +02:00
|
|
|
api("com.esotericsoftware:kryo:5.5.0") {
|
2021-08-23 08:52:16 +02:00
|
|
|
exclude("com.esotericsoftware", "minlog") // we use our own minlog, that logs to SLF4j instead
|
|
|
|
}
|
|
|
|
|
2023-09-04 14:23:06 +02:00
|
|
|
|
2023-07-14 13:47:05 +02:00
|
|
|
// https://github.com/lz4/lz4-java
|
|
|
|
api("org.lz4:lz4-java:1.8.0")
|
2021-08-23 08:52:16 +02:00
|
|
|
|
|
|
|
|
2022-05-30 02:12:36 +02:00
|
|
|
// Expiring Map (A high performance thread-safe map that expires entries)
|
2021-08-23 08:52:16 +02:00
|
|
|
// https://github.com/jhalterman/expiringmap
|
2022-03-03 01:25:32 +01:00
|
|
|
api("net.jodah:expiringmap:0.5.10")
|
2021-08-23 08:52:16 +02:00
|
|
|
|
|
|
|
// https://github.com/MicroUtils/kotlin-logging
|
2023-02-08 22:56:56 +01:00
|
|
|
api("io.github.microutils:kotlin-logging:3.0.5")
|
2023-08-20 13:56:44 +02:00
|
|
|
implementation("org.slf4j:slf4j-api:2.0.7")
|
2022-05-30 02:12:36 +02:00
|
|
|
|
2021-08-23 08:52:16 +02:00
|
|
|
|
2023-07-21 00:20:23 +02:00
|
|
|
|
2021-10-01 11:28:47 +02:00
|
|
|
testImplementation("junit:junit:4.13.2")
|
2022-12-17 23:21:44 +01:00
|
|
|
testImplementation("ch.qos.logback:logback-classic:1.4.5")
|
2023-07-11 09:48:26 +02:00
|
|
|
testImplementation("io.aeron:aeron-all:$aeronVer")
|
2023-07-21 00:20:23 +02:00
|
|
|
|
2023-08-06 09:00:29 +02:00
|
|
|
testImplementation("com.dorkbox:Config:2.1")
|
2021-08-23 08:52:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
publishToSonatype {
|
|
|
|
groupId = Extras.group
|
|
|
|
artifactId = Extras.id
|
|
|
|
version = Extras.version
|
|
|
|
|
|
|
|
name = Extras.name
|
|
|
|
description = Extras.description
|
|
|
|
url = Extras.url
|
|
|
|
|
|
|
|
vendor = Extras.vendor
|
|
|
|
vendorUrl = Extras.vendorUrl
|
|
|
|
|
|
|
|
issueManagement {
|
|
|
|
url = "${Extras.url}/issues"
|
|
|
|
nickname = "Gitea Issues"
|
|
|
|
}
|
|
|
|
|
|
|
|
developer {
|
|
|
|
id = "dorkbox"
|
|
|
|
name = Extras.vendor
|
|
|
|
email = "email@dorkbox.com"
|
|
|
|
}
|
|
|
|
}
|