forked from MCreator/MCreator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
203 lines (166 loc) · 8.29 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
import org.apache.tools.ant.taskdefs.condition.Os
import java.text.SimpleDateFormat
plugins {
id "java"
id "idea"
id "de.undercouch.download" version "5.6.0"
id 'edu.sc.seis.launch4j' version '3.0.6'
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.1.9'
id 'org.openjfx.javafxplugin' version '0.1.0'
}
repositories {
maven { url "https://repo.gradle.org/gradle/libs-releases" } // for gradle-tooling-api
flatDir { dirs 'lib' }
}
project.ext.mcreatorconf = new Properties()
file('src/main/resources/mcreator.conf').withInputStream { project.mcreatorconf.load(it) }
group = 'net.mcreator'
version = project.mcreatorconf.getProperty('mcreator')
project.ext.builddate = project.hasProperty('builddate') ? project.getProperty('builddate') : new SimpleDateFormat("wwuHH", Locale.GERMANY).format(new Date())
project.ext.snapshot = project.hasProperty('snapshot') ? Boolean.parseBoolean((String) project.getProperty('snapshot')) : false
javadoc.source = sourceSets.main.allJava
compileJava.options.encoding = 'UTF-8'
tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8' }
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
idea {
module {
inheritOutputDirs = true
// define exclude dirs
excludeDirs += file(".gradle")
excludeDirs += file(".idea")
excludeDirs += file("build")
excludeDirs += file("gradle")
excludeDirs += file("jdk")
excludeDirs += file("license")
excludeDirs += file("logs")
// additional source dirs
sourceDirs += file("plugins/mcreator-core/blockly/js")
}
}
configurations {
testImplementation.extendsFrom compileOnly
provided
compileOnly.extendsFrom provided
runtimeOnly.extendsFrom provided
export.extendsFrom implementation
export.canBeResolved = true
win64
macX64
macAarch64
linux64
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
runtimeOnly.extendsFrom win64
} else if (Os.isFamily(Os.FAMILY_MAC)) {
if (System.getProperty("os.arch").contains("aarch64")) {
runtimeOnly.extendsFrom macAarch64
} else {
runtimeOnly.extendsFrom macX64
}
} else if (Os.isFamily(Os.FAMILY_UNIX)) {
runtimeOnly.extendsFrom linux64
}
}
configurations.win64.attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, Usage.JAVA_RUNTIME))
attribute(OperatingSystemFamily.OPERATING_SYSTEM_ATTRIBUTE, objects.named(OperatingSystemFamily, OperatingSystemFamily.WINDOWS))
attribute(MachineArchitecture.ARCHITECTURE_ATTRIBUTE, objects.named(MachineArchitecture, MachineArchitecture.X86_64))
}
configurations.macX64.attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, Usage.JAVA_RUNTIME))
attribute(OperatingSystemFamily.OPERATING_SYSTEM_ATTRIBUTE, objects.named(OperatingSystemFamily, OperatingSystemFamily.MACOS))
attribute(MachineArchitecture.ARCHITECTURE_ATTRIBUTE, objects.named(MachineArchitecture, MachineArchitecture.X86_64))
}
configurations.macAarch64.attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, Usage.JAVA_RUNTIME))
attribute(OperatingSystemFamily.OPERATING_SYSTEM_ATTRIBUTE, objects.named(OperatingSystemFamily, OperatingSystemFamily.MACOS))
attribute(MachineArchitecture.ARCHITECTURE_ATTRIBUTE, objects.named(MachineArchitecture, MachineArchitecture.ARM64))
}
configurations.linux64.attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, Usage.JAVA_RUNTIME))
attribute(OperatingSystemFamily.OPERATING_SYSTEM_ATTRIBUTE, objects.named(OperatingSystemFamily, OperatingSystemFamily.LINUX))
attribute(MachineArchitecture.ARCHITECTURE_ATTRIBUTE, objects.named(MachineArchitecture, MachineArchitecture.X86_64))
}
dependencies {
// from lib folder
implementation fileTree(dir: 'lib', include: ['*.jar'])
// from maven
implementation group: 'commons-io', name: 'commons-io', version: '2.17.0'
implementation group: 'org.freemarker', name: 'freemarker', version: '2.3.33'
implementation (group: 'com.google.code.gson', name: 'gson', version: '2.11.0') {
dep -> dep.exclude group: 'com.google.errorprone', module: 'error_prone_annotations'
}
implementation group: 'com.github.sps.junidecode', name: 'junidecode', version: '0.3'
implementation group: 'org.jboss.forge.roaster', name: 'roaster-api', version: '2.29.0.Final'
implementation group: 'org.jboss.forge.roaster', name: 'roaster-jdt', version: '2.29.0.Final'
implementation group: 'org.snakeyaml', name: 'snakeyaml-engine', version: '2.8'
implementation group: 'org.reflections', name: 'reflections', version: '0.10.2'
implementation group: 'com.google.guava', name: 'guava', version: '33.3.0-jre'
implementation group: 'de.javagl', name: 'obj', version: '0.4.0'
implementation group: 'com.univocity', name: 'univocity-parsers', version: '2.9.1'
implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.24.1'
implementation group: 'org.apache.commons', name: 'commons-text', version: '1.12.0'
implementation group: 'org.slf4j', name: 'slf4j-nop', version: '2.0.16'
implementation group: 'org.gradle', name: 'gradle-tooling-api', version: '8.10.2'
implementation group: 'net.java.balloontip', name: 'balloontip', version: '1.2.4.1'
implementation group: 'com.atlassian.commonmark', name: 'commonmark', version: '0.17.0'
implementation group: 'com.atlassian.commonmark', name: 'commonmark-ext-autolink', version: '0.17.0'
implementation group: 'com.atlassian.commonmark', name: 'commonmark-ext-gfm-tables', version: '0.17.0'
implementation group: 'com.fifesoft', name: 'rsyntaxtextarea', version: '3.5.2'
implementation group: 'com.fifesoft', name: 'autocomplete', version: '3.3.1'
implementation(group: 'com.fifesoft', name: 'languagesupport', version: '3.3.0') {
dep -> dep.exclude group: 'org.mozilla', module: 'rhino'
}
implementation group: 'net.java.dev.jna', name: 'jna', version: '5.15.0' // needed by discord-rpc.jar
implementation group: 'com.github.weisj', name: 'jsvg', version: '1.6.1'
implementation group: 'com.formdev', name: 'flatlaf', version: '3.5.2', classifier: 'no-natives'
implementation(group: 'com.formdev', name: 'flatlaf-extras', version: '3.5.2') {
dep -> exclude group: 'com.formdev', module: 'flatlaf'
}
win64 group: 'com.formdev', name: 'flatlaf', version: '3.5.2', classifier: 'windows-x86_64', ext: 'dll'
macX64 group: 'com.formdev', name: 'flatlaf', version: '3.5.2', classifier: 'macos-x86_64', ext: 'dylib'
macAarch64 group: 'com.formdev', name: 'flatlaf', version: '3.5.2', classifier: 'macos-arm64', ext: 'dylib'
linux64 group: 'com.formdev', name: 'flatlaf', version: '3.5.2', classifier: 'linux-x86_64', ext: 'so'
// test dependencies
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.11.3'
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.11.3'
}
javafx {
version = '22.0.2'
modules = ['javafx.web', 'javafx.swing']
configurations = ['provided', 'win64', 'macX64', 'macAarch64', 'linux64']
// we provide natives during deployment or with SDK
}
test {
useJUnitPlatform()
jvmArgs '--add-opens', 'java.base/java.lang=ALL-UNNAMED'
// default max heap is VM RAM / 4, which may be too low on low RAM VMs
maxHeapSize = "4096m"
testLogging {
// https://stackoverflow.com/a/48709645/1627085
events "passed", "skipped", "failed"
showStandardStreams = true
showCauses true
showStackTraces true
showExceptions true
exceptionFormat "full"
debug {
events "started", "failed", "passed", "skipped", "standard_error", "standard_out"
exceptionFormat "full"
}
info.events = debug.events
info.exceptionFormat = debug.exceptionFormat
}
}
javadoc {
source = sourceSets.main.allJava
classpath = configurations.runtimeClasspath
options.addStringOption('Xdoclint:none', '-quiet')
}
tasks.register('runMCreator', JavaExec.class) {
dependsOn jar
jvmArgs '--add-opens', 'java.base/java.lang=ALL-UNNAMED'
classpath += sourceSets.main.runtimeClasspath
mainClass.set("net.mcreator.Launcher")
}
apply from: 'platform/setup.gradle'
apply from: 'platform/export.gradle'