-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
116 lines (96 loc) · 3.39 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
import java.nio.file.Files
import org.apache.commons.io.FileUtils
buildscript {
ext.kotlin_version = '1.5.21'
ext.jnaVersion = '5.8.0'
ext.gdxVersion = '1.10.0'
ext.visuiVersion = "1.5.0"
repositories {
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'gradle.plugin.com.github.jengelman.gradle.plugins:shadow:7.0.0'
classpath "commons-io:commons-io:2.11.0"
}
}
apply plugin: "idea"
apply plugin: "java"
apply plugin: "kotlin"
apply plugin: "application"
apply plugin: "com.github.johnrengelman.shadow"
group "rat.poison"
version "1.8"
mainClassName = "rat.poison.RatPoison"
repositories {
maven { url 'https://jitpack.io' }
gradlePluginPortal()
}
dependencies {
implementation group: "org.jire.arrowhead", name: "arrowhead", version: "1.3.3"
implementation "com.badlogicgames.gdx:gdx:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
implementation "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
implementation "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
implementation "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
implementation group: 'net.java.dev.jna', name: 'jna', version: jnaVersion
implementation group: 'net.java.dev.jna', name: 'jna-platform', version: jnaVersion
implementation "com.kotcrab.vis:vis-ui:$visuiVersion"
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: kotlin_version
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-script-runtime', version: kotlin_version
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-script-util', version: kotlin_version
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-compiler-embeddable', version: kotlin_version
implementation group: 'commons-io', name: 'commons-io', version: '2.11.0'
implementation 'com.github.ata4:ioutils:b1f26588b5'
implementation group: 'it.unimi.dsi', name: 'fastutil', version: '8.5.4'
}
jar {
manifest {
attributes 'Main-Class': mainClassName
}
}
shadowJar {
archiveBaseName.set('RatPoison')
archiveClassifier.set(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"))
def settings = file("settings")
dirSettings.mkdirs()
FileUtils.copyDirectory(settings, dirSettings)
def dirSkin = file(new File(dir, "skin"))
dirSkin.mkdirs()
def skins = file("skin")
FileUtils.copyDirectory(skins, dirSkin)
}
}
RatPoison.dependsOn shadowJar
RatPoison.mustRunAfter shadowJar
sourceSets {
main.java.srcDirs += 'src/main/java'
main.java.srcDirs += 'src/main/kotlin'
main.java.srcDirs += 'settings'
}