mirror of
https://github.com/Querz/mcaselector.git
synced 2025-03-14 09:22:44 +00:00
134 lines
No EOL
3.8 KiB
Groovy
134 lines
No EOL
3.8 KiB
Groovy
plugins {
|
|
id 'java'
|
|
id 'application'
|
|
id 'eclipse'
|
|
id 'idea'
|
|
id 'org.openjfx.javafxplugin' version '0.0.12'
|
|
id 'io.github.goooler.shadow' version '8.1.7'
|
|
id 'com.github.ben-manes.versions' version '0.42.0'
|
|
}
|
|
|
|
group 'net.querz'
|
|
compileJava.options.encoding = 'UTF-8'
|
|
application.mainClass = 'net.querz.mcaselector.Main'
|
|
//configurations.implementation.canBeResolved = true
|
|
|
|
java {
|
|
sourceCompatibility = JavaVersion.VERSION_21
|
|
}
|
|
|
|
javafx {
|
|
version = "$java.sourceCompatibility"
|
|
modules = ['javafx.controls', 'javafx.swing']
|
|
}
|
|
|
|
idea {
|
|
module.downloadJavadoc = true
|
|
module.downloadSources = true
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
maven {
|
|
url 'https://jitpack.io/'
|
|
}
|
|
maven {
|
|
url 'https://plugins.gradle.org/m2/'
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation 'com.github.Querz:NBT:f41d073'
|
|
implementation 'com.google.code.gson:gson:2.10.1'
|
|
implementation 'org.xerial:sqlite-jdbc:3.45.2.0'
|
|
implementation 'it.unimi.dsi:fastutil:8.5.8'
|
|
implementation 'org.apache.logging.log4j:log4j-api:2.17.2'
|
|
implementation 'org.apache.logging.log4j:log4j-core:2.17.2'
|
|
implementation 'commons-cli:commons-cli:1.5.0'
|
|
implementation 'me.tongfei:progressbar:0.10.1'
|
|
implementation 'org.apache.groovy:groovy-jsr223:4.0.21'
|
|
implementation 'org.fxmisc.richtext:richtextfx:0.11.2'
|
|
implementation 'org.lz4:lz4-java:1.8.0'
|
|
|
|
shadow 'com.github.Querz:NBT:f41d073'
|
|
shadow 'com.google.code.gson:gson:2.10.1'
|
|
shadow 'org.xerial:sqlite-jdbc:3.45.2.0'
|
|
shadow 'it.unimi.dsi:fastutil:8.5.8'
|
|
shadow 'org.apache.logging.log4j:log4j-api:2.17.2'
|
|
shadow 'org.apache.logging.log4j:log4j-core:2.17.2'
|
|
shadow 'commons-cli:commons-cli:1.5.0'
|
|
shadow 'me.tongfei:progressbar:0.10.1'
|
|
shadow 'org.apache.groovy:groovy-jsr223:4.0.21'
|
|
shadow 'org.fxmisc.richtext:richtextfx:0.11.2'
|
|
shadow 'org.lz4:lz4-java:1.8.0'
|
|
|
|
testImplementation 'junit:junit:4.13.2'
|
|
testImplementation 'commons-io:commons-io:2.11.0'
|
|
}
|
|
|
|
task copyRuntimeLibs(type: Copy) {
|
|
from configurations.shadow
|
|
into layout.buildDirectory.dir('libs/lib')
|
|
exclude {it.file.name.startsWith('javafx')}
|
|
}
|
|
|
|
task minifyCss {
|
|
doLast {
|
|
var styleDir = java.nio.file.Path.of("${sourceSets.main.resources.srcDirs[0]}", "style")
|
|
Files.find(styleDir, Integer.MAX_VALUE, (filePath, fileAttr) -> fileAttr.isRegularFile())
|
|
.forEach(p -> {
|
|
minCss(p, java.nio.file.Path.of("${sourceSets.main.output.resourcesDir}", "style", styleDir.relativize(p).toString()))
|
|
})
|
|
}
|
|
dependsOn processResources
|
|
}
|
|
|
|
jar {
|
|
archiveFileName = "${project.name}-${project.version}-min.jar"
|
|
manifest.attributes (
|
|
'Main-Class': application.mainClass,
|
|
'Application-Version': project.version,
|
|
'Class-Path': configurations.shadow.files.stream()
|
|
.filter($it -> !$it.name.startsWith('javafx')).collect{"lib/$it.name"}.join(' ')
|
|
)
|
|
exclude 'licenses/'
|
|
from 'LICENSE'
|
|
dependsOn minifyCss
|
|
dependsOn copyRuntimeLibs
|
|
finalizedBy shadowJar
|
|
}
|
|
|
|
shadowJar {
|
|
minimize {
|
|
exclude(dependency('org.apache.logging.log4j:log4j-core:.*'))
|
|
exclude(dependency('org.apache.groovy:groovy-jsr223:.*'))
|
|
}
|
|
dependencies {
|
|
exclude(dependency(':javafx.*:.*'))
|
|
}
|
|
archiveFileName = "${project.name}-${project.version}.jar"
|
|
configurations = [project.configurations.shadow]
|
|
from 'LICENSE'
|
|
}
|
|
|
|
assemble.dependsOn shadowJar
|
|
|
|
// ---------------------------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
* "Minifies" a css file by removing all comments, \n, \t and all duplicate spaces.
|
|
*
|
|
* @param i The input css file
|
|
* @param o The output css file
|
|
* @throws IOException If something goes wrong during reading or writing
|
|
*/
|
|
import java.nio.file.Files
|
|
|
|
static minCss(i, o) throws IOException {
|
|
String s = Files.readString(i)
|
|
s = s.replace("\t", "").replace("\r\n", " ").replace("\n", " ").replaceAll("/\\*.*?\\*/", "").replaceAll(" {2,}", " ").trim()
|
|
try {Files.writeString(o, s)}
|
|
catch (Exception ex) {
|
|
ex.printStackTrace()
|
|
}
|
|
} |