forked from IrisShaders/Iris-Installer
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.gradle
More file actions
112 lines (90 loc) · 2.61 KB
/
Copy pathbuild.gradle
File metadata and controls
112 lines (90 loc) · 2.61 KB
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
plugins {
id 'java'
id 'application'
id "de.undercouch.download" version "5.6.0"
}
base {
archivesName = project.archives_base_name
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
version = project.version
group = project.maven_group
repositories {
maven {
url "https://maven.fabricmc.net"
}
mavenCentral()
mavenLocal()
}
dependencies {
implementation "org.json:json:20251224"
implementation "com.formdev:flatlaf:3.7"
compileOnly "org.lwjgl:lwjgl-tinyfd:3.3.2"
implementation "net.fabricmc:fabric-installer:1.1.1"
}
application {
mainClass.set(project.main_class)
}
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
def bootstrapVersion = "0.6.0"
def bootstrapArch = "i686"
def downloadBootstrap = tasks.register("downloadBootstrap", Download) {
src "https://maven.fabricmc.net/net/fabricmc/fabric-installer-native-bootstrap/windows-${bootstrapArch}/${bootstrapVersion}/windows-${bootstrapArch}-${bootstrapVersion}.exe"
dest layout.buildDirectory
}
def nativeExe = tasks.register("nativeExe") {
dependsOn(downloadBootstrap, tasks.named("jar"))
def outputFile = layout.buildDirectory.file("libs/${base.archivesName.get()}-${project.version}.exe")
outputs.file(outputFile)
outputs.upToDateWhen { false }
doLast {
def output = outputFile.get().asFile
output.delete()
output.createNewFile()
output.setBytes downloadBootstrap.get().outputFiles.first().readBytes()
output.append tasks.named("jar").get().archiveFile.get().asFile.readBytes()
}
}
tasks.named("build") {
dependsOn(nativeExe)
}
tasks.named("jar", Jar) {
manifest {
attributes("Main-Class": application.mainClass)
attributes("Enable-Native-Access": "ALL-UNNAMED")
}
duplicatesStrategy = DuplicatesStrategy.WARN
from "LICENSE"
from(configurations.runtimeClasspath.filter { it.exists() }.collect { it.isDirectory() ? it : zipTree(it) }) {
exclude 'META-INF/*.SF'
exclude 'META-INF/*.DSA'
exclude 'META-INF/*.RSA'
}
}
sourceSets {
headers {
java {
compileClasspath += sourceSets.main.compileClasspath
}
}
main {
java {
compileClasspath += sourceSets.headers.output
}
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
def targetVersion = 8
if (JavaVersion.current().isJava9Compatible()) {
options.release = targetVersion
}
}