forked from RatPoison-dev/RatPoison
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
151 lines (123 loc) · 4.23 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
import java.nio.file.Files
buildscript {
ext.kotlin_version = '1.3.72'
ext.jnaVersion = '5.2.0'
ext.gdxVersion = '1.9.10'
ext.visuiVersion = "1.4.4"
repositories {
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.github.jengelman.gradle.plugins:shadow:4.0.2'
}
}
apply plugin: "idea"
apply plugin: "java"
apply plugin: "kotlin"
apply plugin: "application"
apply plugin: "com.github.johnrengelman.shadow"
group "rat.poison"
version "1.7"
mainClassName = "rat.poison.RatPoison"
repositories {
jcenter()
maven { url 'https://jitpack.io' }
}
dependencies {
compile group: "org.jire.arrowhead", name: "arrowhead", version: "1.3.3"
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
compile group: 'net.java.dev.jna', name: 'jna', version: jnaVersion
compile group: 'net.java.dev.jna', name: 'jna-platform', version: jnaVersion
compile "com.kotcrab.vis:vis-ui:$visuiVersion"
compile group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: kotlin_version
compile group: 'org.jetbrains.kotlin', name: 'kotlin-script-runtime', version: kotlin_version
compile group: 'org.jetbrains.kotlin', name: 'kotlin-script-util', version: kotlin_version
compile group: 'org.jetbrains.kotlin', name: 'kotlin-compiler-embeddable', version: kotlin_version
compile group: 'commons-io', name: 'commons-io', version: 2.6
compile 'com.github.ata4:ioutils:b1f26588b5'
implementation 'com.github.ata4:bspsrc:v1.3.24'
}
jar {
manifest {
attributes 'Main-Class': mainClassName
}
}
shadowJar {
baseName = 'RatPoison'
classifier = null
}
task RatPoison {
doLast {
def name = "RatPoison $version"
def dir = file("build/$name/")
if (dir.exists()) dir.deleteDir()
dir.mkdirs()
def jarName = "${name}.jar"
//noinspection GroovyAssignabilityCheck
def jar = file(new File(dir, jarName))
def allJar = file("build/libs/RatPoison-${version}.jar")
Files.copy(allJar.toPath(), jar.toPath())
//noinspection GroovyAssignabilityCheck
def bat = file(new File(dir, "Start ${name}.bat"))
Files.write(bat.toPath(), """@echo off
set path="%JAVA_HOME%";%path%
cd /d "%~dp0"
title $name
java -Xmx512m -Xms32m -XX:+UseSerialGC -jar "$jarName"
pause""".getBytes())
def dirSettings = file(new File(dir, "settings"))
dirSettings.mkdirs()
def settings = file("settings")
settings.listFiles().each {
Files.copy(it.toPath(), (new File(dirSettings, it.getName())).toPath())
}
def dirHitsounds = file(new File(dir, "settings\\hitsounds"))
dirHitsounds.mkdirs()
def hitsounds = file("settings\\hitsounds")
hitsounds.listFiles().each {
Files.copy(it.toPath(), (new File(dirHitsounds, it.getName())).toPath())
}
def dirCfgs = file(new File(dir, "settings\\CFGS"))
dirCfgs.mkdirs()
def cfgs = file("settings\\CFGS")
cfgs.listFiles().each {
Files.copy(it.toPath(), (new File(dirCfgs, it.getName())).toPath())
}
def dirHelper = file(new File(dir, "settings\\NadeHelper"))
dirHelper.mkdirs()
def helper = file("settings\\NadeHelper")
helper.listFiles().each {
Files.copy(it.toPath(), (new File(dirHelper, it.getName())).toPath())
}
def dirSkinInfo = file(new File(dir, "settings\\Data"))
dirSkinInfo.mkdirs()
def skinfo = file("settings\\Data")
skinfo.listFiles().each {
Files.copy(it.toPath(), (new File(dirSkinInfo, it.getName())).toPath())
}
def dirSkin = file(new File(dir, "skin"))
dirSkin.mkdirs()
def skins = file("skin")
skins.listFiles().each {
Files.copy(it.toPath(), (new File(dirSkin, it.getName())).toPath())
}
def dirLocalizations = file(new File(dir, "settings\\Localizations"))
dirLocalizations.mkdirs()
def localizations = file("settings\\Localizations")
localizations.listFiles().each {
Files.copy(it.toPath(), (new File(dirLocalizations, it.getName())).toPath())
}
}
}
RatPoison.dependsOn shadowJar
RatPoison.mustRunAfter shadowJar
sourceSets {
main.java.srcDirs += 'src/main/java'
main.java.srcDirs += 'src/main/kotlin'
main.java.srcDirs += 'settings'
}