forked from Querz/mcaselector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
136 lines (120 loc) · 3.89 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
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:56ac2af621'
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'
implementation 'com.github.luben:zstd-jni:1.5.5-5'
shadow 'com.github.Querz:NBT:56ac2af621'
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'
shadow 'com.github.luben:zstd-jni:1.5.5-5'
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()
}
}