-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
92 lines (74 loc) · 2.58 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
plugins {
id "java"
id "java-library"
}
// CHANGE THIS TO SUIT YOUR MOD
version = '1.0'
description = "Your mod description"
archivesBaseName = rootProject.name // Please edit settings.gradle to change your mod internal name!
project.ext {
modFullName = "You Mod Name" // The displayed name of your mod, can contain spaces, special characters etc
csApiBuiltAgainst = '2.0.4' // Revision of the API we are based on
coreContentVersionBuiltAgainst = '2.0.4' // Revision of the core content we are based on
}
// DON'T TOUCH THE REST UNLESS YOU KNOW WHAT YOU ARE DOING
repositories {
mavenLocal()
jcenter()
mavenCentral()
maven {
url "http://maven.xol.io/repository/public/"
}
}
subprojects {
ext {
csApiBuiltAgainst = rootProject.csApiBuiltAgainst
coreContentVersionBuiltAgainst = rootProject.coreContentVersionBuiltAgainst
}
}
dependencies {
compile group: 'xyz.chunkstories', name: 'api', version: csApiBuiltAgainst
compile group: 'xyz.chunkstories', name: 'core', version: coreContentVersionBuiltAgainst
}
task modTxt {
doLast {
def file = new File("$projectDir/res/modInfo.json")
file.createNewFile()
file.text = """
{
"internalName": "$archivesBaseName",
"name": "$modFullName",
"version": "${project.version}",
"description": "${project.description}"
}
"""
}
}
task mod(type: Zip) {
from 'res/'
from configurations.runtime.allArtifacts.files
archiveName = "${archivesBaseName}.zip"
dependsOn modTxt
}
task install(type: Copy) {
dependsOn mod
File csDir = null;
if (project.hasProperty('chunkStoriesDirectory')) {
csDir = new File(chunkStoriesDirectory)
} else {
println 'Did not found a configured directory for the game files, using default one'
String appDataFolder = System.getProperty("user.dir")
if (System.getProperty("os.name").toLowerCase().startsWith("win"))
appDataFolder = System.getenv("APPDATA")
else if (System.getProperty("os.name").toLowerCase().startsWith("lin"))
appDataFolder = System.getProperty("user.home")
else if (System.getProperty("os.name").toLowerCase().startsWith("mac"))
appDataFolder = System.getProperty("user.home")
csDir = new File(appDataFolder + "/.chunkstories")
}
println csDir.getAbsolutePath()
include '**/*.zip'
include '**/*.jar'
from 'build/distributions/'
into csDir.getPath() + '/mods/';
}