1
0
Fork 0
mirror of https://github.com/Querz/mcaselector.git synced 2025-03-15 17:54:44 +00:00
Querz_mcaselector/build.gradle

134 lines
3.8 KiB
Groovy
Raw Normal View History

2021-05-25 14:53:42 +00:00
plugins {
2021-06-01 14:50:41 +00:00
id 'java'
id 'application'
2021-06-01 14:50:41 +00:00
id 'eclipse'
id 'idea'
id 'org.openjfx.javafxplugin' version '0.0.12'
2024-04-06 02:07:48 +00:00
id 'io.github.goooler.shadow' version '8.1.7'
id 'com.github.ben-manes.versions' version '0.42.0'
2018-04-22 22:31:01 +00:00
}
group 'net.querz'
compileJava.options.encoding = 'UTF-8'
application.mainClass = 'net.querz.mcaselector.Main'
2024-04-06 02:07:48 +00:00
//configurations.implementation.canBeResolved = true
java {
sourceCompatibility = JavaVersion.VERSION_21
}
2021-06-01 14:50:41 +00:00
javafx {
2024-04-06 02:07:48 +00:00
version = "$java.sourceCompatibility"
modules = ['javafx.controls', 'javafx.swing']
}
2018-08-22 08:44:45 +00:00
idea {
module.downloadJavadoc = true
2018-08-22 08:44:45 +00:00
module.downloadSources = true
}
2018-04-22 22:31:01 +00:00
repositories {
mavenCentral()
maven {
url 'https://jitpack.io/'
}
2024-04-06 02:07:48 +00:00
maven {
url 'https://plugins.gradle.org/m2/'
}
2018-04-22 22:31:01 +00:00
}
dependencies {
2024-04-03 11:43:20 +00:00
implementation 'com.github.Querz:NBT:56ac2af621'
2023-05-28 16:57:30 +00:00
implementation 'com.google.code.gson:gson:2.10.1'
2024-04-06 02:07:48 +00:00
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'
2024-04-06 02:07:48 +00:00
implementation 'me.tongfei:progressbar:0.10.1'
implementation 'org.codehaus.groovy:groovy-jsr223:3.0.11'
implementation 'org.fxmisc.richtext:richtextfx:0.11.2'
2024-01-24 20:05:30 +00:00
implementation 'org.lz4:lz4-java:1.8.0'
2023-06-01 01:32:11 +00:00
2024-04-03 11:43:20 +00:00
shadow 'com.github.Querz:NBT:56ac2af621'
2023-05-28 16:57:30 +00:00
shadow 'com.google.code.gson:gson:2.10.1'
2024-04-06 02:07:48 +00:00
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'
2024-04-06 02:07:48 +00:00
shadow 'me.tongfei:progressbar:0.10.1'
shadow 'org.codehaus.groovy:groovy-jsr223:3.0.11'
shadow 'org.fxmisc.richtext:richtextfx:0.11.2'
2024-01-24 20:05:30 +00:00
shadow 'org.lz4:lz4-java:1.8.0'
testImplementation 'junit:junit:4.13.2'
testImplementation 'commons-io:commons-io:2.11.0'
2018-04-22 22:31:01 +00:00
}
2018-05-22 15:26:27 +00:00
task copyRuntimeLibs(type: Copy) {
from configurations.shadow
2024-04-06 02:07:48 +00:00
into layout.buildDirectory.dir('libs/lib')
exclude {it.file.name.startsWith('javafx')}
}
task minifyCss {
doLast {
2024-01-17 16:21:04 +00:00
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
}
2018-05-22 15:26:27 +00:00
jar {
2021-02-19 10:55:00 +00:00
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/'
2020-04-09 12:34:41 +00:00
from 'LICENSE'
dependsOn minifyCss
dependsOn copyRuntimeLibs
finalizedBy shadowJar
2018-05-22 15:26:27 +00:00
}
shadowJar {
minimize {
exclude(dependency('org.apache.logging.log4j:log4j-core:.*'))
exclude(dependency('org.codehaus.groovy:groovy-jsr223:.*'))
}
dependencies {
exclude(dependency(':javafx.*:.*'))
}
2021-02-19 10:55:00 +00:00
archiveFileName = "${project.name}-${project.version}.jar"
configurations = [project.configurations.shadow]
2020-05-22 15:46:29 +00:00
from 'LICENSE'
2018-10-25 13:27:41 +00:00
}
2021-05-25 14:53:42 +00:00
assemble.dependsOn shadowJar
// ---------------------------------------------------------------------------------------------------------------------
2021-05-25 14:53:42 +00:00
/**
* "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
2024-01-17 16:21:04 +00:00
static minCss(i, o) throws IOException {
String s = Files.readString(i)
2021-05-25 14:53:42 +00:00
s = s.replace("\t", "").replace("\r\n", " ").replace("\n", " ").replaceAll("/\\*.*?\\*/", "").replaceAll(" {2,}", " ").trim()
2024-01-17 16:21:04 +00:00
try {Files.writeString(o, s)}
catch (Exception ex) {
ex.printStackTrace()
}
}