build.gradle
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm'
id 'org.jetbrains.kotlin.plugin.serialization'
id 'distribution'
id 'application'
id 'com.diffplug.spotless'
id 'de.undercouch.download'
id 'net.kyori.blossom'
id 'com.github.ben-manes.versions'
id 'se.ascp.gradle.gradle-versions-filter'
id 'se.patrikerdes.use-latest-versions'
}
group "$group"
archivesBaseName = "$name"
version "$version"
sourceCompatibility = targetCompatibility = "$jvmTarget"
project.ext {
ver = project.properties["pre"] ?: version
vendor = System.getProperty("java.vendor").replace(" ", "").toLowerCase()
if (vendor == "internationalbusinessmachinescorporation") {
vendor = "ibm"
}
jv = JavaVersion.current()
if (jv == JavaVersion.VERSION_1_8) {
jv = "8"
}
mostlyName = "$name-$ver-${System.getProperty("os.name").toLowerCase()}-${System.getProperty("os.arch")}-java${jv}-${vendor}"
licenseDir = new File(buildDir, 'licenses')
toolDir = new File(buildDir, 'tools')
}
allprojects { p ->
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'distribution'
apply plugin: 'org.jetbrains.kotlin.jvm'
apply plugin: 'org.jetbrains.kotlin.plugin.serialization'
apply plugin: 'com.diffplug.spotless'
apply plugin: 'net.kyori.blossom'
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
maven { url 'https://github.com/eugener/oxbow/raw/master/maven/repository' }
}
dependencies {
api "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
api "org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}"
api "org.jetbrains.kotlinx:kotlinx-serialization-json:${kotlinSerialization}"
api "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1"
api 'org.jetbrains.kotlinx:kotlinx-coroutines-swing:1.5.1'
}
spotless {
ratchetFrom 'origin/rewrite'
java {
importOrder()
removeUnusedImports()
googleJavaFormat()
licenseHeader "$licenseHeader\n\n"
}
groovyGradle {
target '*.gradle'
greclipse()
}
kotlin {
ktlint("$ktlintVersion")
licenseHeader "$licenseHeader\n\n"
}
format 'misc', {
target '*.md', '.gitignore'
trimTrailingWhitespace()
indentWithTabs()
endWithNewline()
}
}
compileKotlin {
kotlinOptions.jvmTarget = sourceCompatibility
kotlinOptions {
freeCompilerArgs = [
"-Xopt-in=kotlin.RequiresOptIn",
"-Xinline-classes"
]
}
}
blossom {
replaceToken('$[name]', p.property('id'))
replaceToken('$[author]', p.property('author'))
replaceToken('$[version]', p.version)
}
}
startScripts {
executableDir = ""
doLast {
windowsScript.text = windowsScript.text.replaceAll('set CLASSPATH=.*', 'set CLASSPATH=.;%APP_HOME%/lib/*')
}
}
distributions {
//noinspection GroovyAssignabilityCheck
main {
contents {
from files('README.MD', 'LICENSE')
from startScripts
into('data') {
from files('data')
}
into('licenses') {
from files("$buildDir/licenses")
}
into('tools') {
from files("$buildDir/tools")
}
subprojects.each { p ->
into('plugins') {
from p.getTasksByName("jar", true)
}
}
}
}
}
distZip {
archiveName "$mostlyName-distZip.zip"
def list = []
// Collect a list of all the JARs produced by submodules
subprojects.each { p ->
def jar = p.getTasksByName("jar", true).archiveFile
// We have to leave these out though
if (
!(p.name in ["master", "core", "launcher"]) &&
jar.size > 0
) {
list.add(jar.first().getAsFile().get())
}
}
eachFile { file ->
// Files in /bin are copied to the main directory
// so we can exclude them
if (file.path.contains('bin')) {
file.exclude()
} else if (file.path.contains('lib') &&
// Check if the current file is a submodule
file.getFile() in list
// || file.name =~ /discordrpc*./
// || file.name =~ /pluginmanager*./
// || file.name =~ /settingsgui*./
// || file.name =~ /sniffle*./
// || file.name =~ /tipoftheday*./
|| file.name =~ /Quiver-\d\.\d\.\d\.jar/) {
file.exclude()
}
}
}
distTar {
archiveName "$mostlyName-distTar.tar"
}
run {
applicationDefaultJvmArgs = [
// "-XX:+UseG1GC"
// "-Xopt-in=kotlin.RequiresOptIn"
]
args = ['indev']
doFirst {
file('run').mkdirs()
copy {
from 'data'
into 'run/data'
}
}
workingDir 'run'
dependencies {
implementation project(':core')
runtimeOnly project(':launcher')
runtimeOnly project(':foldertree')
runtimeOnly project(':filetable')
runtimeOnly project(':filepanel')
runtimeOnly project(':textviewer')
runtimeOnly project(':tableviewer')
runtimeOnly project(':imageviewer')
runtimeOnly project(':treeviewer')
runtimeOnly project(':markdownviewer')
runtimeOnly project(':spritesheetviewer')
runtimeOnly project(':docxviewer')
runtimeOnly project(':packexport')
runtimeOnly project(':packsquashstep')
runtimeOnly project(':zipstep')
runtimeOnly project(':filewatcher')
// runtimeOnly project(':discordrpc')
runtimeOnly project(':pluginmanager')
runtimeOnly project(':settingsgui')
runtimeOnly project(':tipoftheday')
runtimeOnly project(':swingsettings')
}
application {
mainClassName = 'com.deflatedpickle.quiver.launcher.MainKt'
}
}