generated from Sonnicon/mindustry-modtemplate
-
Notifications
You must be signed in to change notification settings - Fork 70
/
build.gradle
96 lines (78 loc) · 2.49 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
plugins{
id "java"
}
ext{
sdkRoot = System.getenv("ANDROID_HOME")
sdkVersion = '30'
artifactFilename = "BetaMindy.jar"
}
group "sk7725"
sourceSets.main{
java.srcDir("src/")
resources.srcDir("assets/")
}
repositories{
mavenCentral()
maven{url "https://jitpack.io"}
}
dependencies{
annotationProcessor 'com.github.Anuken:jabel:0.8.0'
compileOnly "com.github.Anuken.MindustryJitpack:core:v144"
compileOnly "com.github.Anuken.Arc:arc-core:v144"
}
jar.archiveFileName.set("raw-$artifactFilename")
def isWindows = System.getProperty("os.name").toLowerCase(Locale.ROOT).contains("windows")
task alphableed doFirst{
exec{
workingDir "$rootDir"
println "Alpha-bleeding sprites..."
if(isWindows){
commandLine("cmd", "/c", "alpha-bleeding-windows.exe", "--replace", "./assets/sprites/")
}else{
commandLine("./alpha-bleed", "./assets/sprites/")
}
}
}
task dexify(type: Jar){
archiveFileName.set(artifactFilename)
final File jarArtifact = new File(tasks.jar.archiveFile.get().asFile.parent, "raw-$artifactFilename"),
dexedArtifact = new File(tasks.dexify.getTemporaryDir(), "dexed.jar")
doFirst{
//collect dependencies needed for desugaring
def files = (configurations.compileClasspath.asList() + configurations.runtimeClasspath.asList() + [new File("$sdkRoot/platforms/android-$sdkVersion/android.jar")])
exec{
workingDir dexedArtifact.parent
def command = ["d8", "--min-api", "14"]
for(def file : files){
command += "--classpath"
command += file.path
}
command += ["--output", dexedArtifact, jarArtifact]
if(isWindows){
commandLine("cmd", "/c", *command)
}else{
commandLine(*command)
}
}
}
from(zipTree(jarArtifact), zipTree(dexedArtifact))
}
task buildDex dependsOn "build", "dexify"
task buildMove(dependsOn: build){
doLast{
copy{
from "build/libs/raw-BetaMindy.jar"
into System.getenv("destination")
}
}
}
tasks.withType(JavaCompile){
targetCompatibility = 8
sourceCompatibility = JavaVersion.VERSION_17
options.encoding = "UTF-8"
options.compilerArgs += ["-Xlint:deprecation"]
if(JavaVersion.current() != JavaVersion.VERSION_1_8){
options.compilerArgs.addAll(['--release', '8'])
}
compileJava.options.fork = true
}