-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle
82 lines (67 loc) · 2.11 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
ext {
localCore = {
return new File("../Mindustry/core").exists()
}
corePath = {
if(localCore()){
libPath = new File("../Mindustry/core/build/libs/core-release.jar")
return files(libPath)
}else{
return "com.github.Anuken.Mindustry:core:master-SNAPSHOT"
}}
getArcHash = {
ahash = ""
if(localCore())
{
ahash = new Properties().with{ p -> p.load(new File('../Mindustry/gradle.properties').newReader()); return p }["archash"]
}
else
{ahash = new Properties().with{ p -> p.load(file('gradle.properties').newReader()); return p }["archash"]}
return ahash
}
}
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.github.jengelman.gradle.plugins:shadow:5.1.0"
}
}
apply plugin: "java"
apply plugin: 'kotlin'
apply plugin: 'idea'
apply plugin: 'com.github.johnrengelman.shadow'
group 'manufacry'
version '1.0'
sourceCompatibility = 1.8
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
compileOnly "com.github.Anuken.Arc:arc-core:${getArcHash()}"
compileOnly corePath()
}
shadowJar {
dependencies {
include(dependency("org.jetbrains.kotlin:kotlin-stdlib"))
}
}
task copyToModsFolder(type: Copy) {
def libpath = "$buildDir/libs/manufacry-" + "$version" + "-all.jar"
def appdata = java.nio.file.Paths.get(System.getenv('APPDATA'))
def modsFolder = file(appdata.resolve("Mindustry").resolve("mods"))
// println "Copying file '" + libpath + "' to '" + modsFolder + "'"
from file(libpath)
into modsFolder
}
build.finalizedBy(copyToModsFolder)
build.dependsOn shadowJar
//to compile a dexed jar file:
//./d8 --output output.jar --classpath ~/Projects/testmod/libs/core-release.jar ~/Projects/testmod/build/libs/testmod-1.0.jar