-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
101 lines (87 loc) · 3.55 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
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'application'
}
mainClassName = "com.github.leanfe.Application"
applicationDefaultJvmArgs = [
"--add-exports", "java.base/sun.security.util=ALL-UNNAMED",
"--add-exports", "jdk.naming.dns/com.sun.jndi.dns=java.naming",
"--add-opens", "java.base/java.net=ALL-UNNAMED",
"--add-opens", "java.base/java.util.jar=ALL-UNNAMED",
"-XX:+IgnoreUnrecognizedVMOptions",
'-Djdk.attach.allowAttachSelf=true'
]
group 'com.github.leanfe'
version '1.0-SNAPSHOT'
def winDir = 'win32-x86-64'
def linuxDir = 'linux-x86-64' // Replace with the correct directory name
def macDir = 'macos-x86-64' // Replace with the correct directory name
ext {
// Default values for custom attributes
implementationTitle = 'FML Launcher'
implementationVersion = '36.2'
implementationVendor = 'Forge'
specificationTitle = 'Launcher'
specificationVersion = '4.0'
specificationVendor = 'Forge Development LLC'
}
println "Implementation-Title: ${implementationTitle}"
println "Specification-Version: ${specificationVersion}"
println "Implementation-Version: ${implementationVersion}"
println "Specification-Title: ${specificationTitle}"
jar {
manifest {
attributes(
'Main-Class': "${application.mainClass}",
'Implementation-Title': implementationTitle,
'Implementation-Version': implementationVersion,
'Implementation-Vendor': implementationVendor,
'Specification-Title': specificationTitle,
'Specification-Version': specificationVersion,
'Specification-Vendor': specificationVendor,
'Add-Exports': 'java.base/sun.security.util=ALL-UNNAMED,java.base/java.net=ALL-UNNAMED,java.base/java.util.jar=ALL-UNNAMED,jdk.naming.dns/com.sun.jndi.dns=java.naming',
'Add-Opens': 'java.base/sun.security.util=ALL-UNNAMED,java.base/java.net=ALL-UNNAMED,java.base/java.util.jar=ALL-UNNAMED',
'Multi-Release': 'true',
)
}
}
// Define the platform-dependent resource directories
sourceSets {
main {
resources {
if (System.getProperty("os.name").toLowerCase().contains("win")) {
srcDirs "src/main/resources/$winDir"
} else if (System.getProperty("os.name").toLowerCase().contains("linux")) {
srcDirs "src/main/resources/$linuxDir"
} else if (System.getProperty("os.name").toLowerCase().contains("mac")) {
srcDirs "src/main/resources/$macDir"
} else {
srcDirs "src/main/resources"
}
}
}
}
// Copy the native files to the platform-dependent resource directory
tasks.register('copyNatives', Copy) {
from 'natives'
if (System.getProperty("os.name").toLowerCase().contains("win")) {
into "src/main/resources/$winDir"
} else if (System.getProperty("os.name").toLowerCase().contains("linux")) {
into "src/main/resources/$linuxDir"
} else if (System.getProperty("os.name").toLowerCase().contains("mac")) {
into "src/main/resources/$macDir"
} else {
into 'src/main/resources'
}
}
shadowJar {
dependsOn copyNatives
}
dependencies {
implementation files("Tools/tools.jar")
implementation fileTree(include: ['*.jar'], dir: 'libraries')
implementation fileTree(include: ['*.jar'], dir: 'version')
implementation fileTree(include: ['*'], dir: 'META-INF')
implementation fileTree(include: ['*.dll'], dir: 'natives')
}