forked from TallWorlds/CubicChunks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
218 lines (189 loc) · 4.83 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
// Gradle repositories and dependencies
buildscript
{
repositories {
mavenCentral()
mavenLocal()
jcenter()
}
dependencies {
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0'
}
}
// Apply plugins
apply plugin: 'java'
apply plugin: 'license'
//apply plugin: 'maven'
apply plugin: 'eclipse'
apply plugin: 'idea'
//minecraft version to get Minecraft.jar for netbeans
ext.minecraftVersion = "1.8.3"
// Default tasks
defaultTasks 'licenseFormat', 'build'
// Basic project information
group = "tallworlds"
archivesBaseName = "TallWorlds"
version = "1.8.3-0.3.1"
// Extended project information
ext.projectName = 'Tall Worlds'
ext.inceptionYear = '2014'
ext.packaging = 'jar'
ext.organizationUrl = ''
ext.description = 'Tall Worlds Mod'
ext.organization = 'Tall Worlds'
// Define build and commit variables
ext.buildNumber = project.hasProperty("buildNumber") ? buildNumber : '0'
ext.ciSystem = project.hasProperty("ciSystem") ? ciSystem : 'unknown'
ext.commit = project.hasProperty("commit") ? commit : 'unknown'
// Minimum version of Java required
sourceCompatibility = '1.7'
targetCompatibility = '1.7'
// Project source locations
sourceSets
{
main {
java {
srcDir 'src/main'
}
}
test {
java {
srcDir 'src/test'
}
}
}
// Project repositories
repositories
{
mavenCentral()
mavenLocal()
maven
{
name 'cuchaz'
url 'http://maven.cuchazinteractive.com'
}
maven
{
name 'sonatype'
url 'https://oss.sonatype.org/content/groups/public/'
}
maven
{
name 'mojang'
url 'https://libraries.minecraft.net'
}
}
//Hacks to allow controlling classpath order
configurations
{
forge
minecraft
provided
compile.extendsFrom provided
}
dependencies
{
forge files('libs/forge-1.8-11.14.1.1334-universal.jar')
minecraft files('../m3l/lib/minecraft-1.8.3-client-deobf.jar')
provided 'cuchaz:m3l:1.8.3-0.3b'
provided 'cuchaz:m3l-forge-api:1.8.3-0.2b-1334'
provided 'org.slf4j:slf4j-api:1.7.10'
provided 'ch.qos.logback:logback-classic:1.1.2'
provided 'net.minecraft:launchwrapper:1.8'
provided 'io.netty:netty-all:4.0.27.Final'
compile 'com.flowpowered:flow-noise:1.0.1-SNAPSHOT'
compile 'org.mapdb:mapdb:1.0.7'
testCompile 'junit:junit:4.11'
}
//ensure correct order
sourceSets.main.compileClasspath = sourceSets.main.compileClasspath + configurations.minecraft
sourceSets.main.compileClasspath = sourceSets.main.compileClasspath + configurations.forge
sourceSets.main.runtimeClasspath = sourceSets.main.runtimeClasspath + sourceSets.main.compileClasspath
sourceSets.test.runtimeClasspath = sourceSets.test.runtimeClasspath + sourceSets.main.runtimeClasspath
// License header formatting
license {
ext.project = projectName
ext.year = inceptionYear
ext.name = organization
ext.url = organizationUrl
exclude "**/*.info"
exclude "assets/*"
header file('HEADER.txt')
ignoreFailures false
strictCheck true
mapping {
java = 'SLASHSTAR_STYLE'
}
}
// Source compiler configuration
configure([compileJava, compileTestJava]) {
options.deprecation = true
options.encoding = 'utf8'
options.compilerArgs += ['-Xlint:all', '-Xlint:-path']
}
// JAR manifest configuration
jar.manifest.mainAttributes(
"Built-By": System.properties['user.name']
//"Created-By": System.properties['java.vm.version'] + " (" + System.properties['java.vm.vendor'] + ")",
//"Implementation-Title": name,
//"Implementation-Version": version + "+" + ciSystem + "-b" + buildNumber + ".git-" + commit,
//"Implementation-Vendor": url
)
jar {
dependsOn configurations.runtime
from {
(configurations.runtime - configurations.provided).collect {
it.isDirectory() ? it : zipTree(it)
}
}
{
exclude "META-INF/"
}
}
task sourceJar(type: Jar) {
from sourceSets.main.java
from sourceSets.main.resources
classifier = "sources"
}
artifacts {
archives jar
archives sourceJar
}
def runCfg = {
standardInput = System.in//doesn't work on windows. gradle bug
workingDir = "eclipse"//this is usually used in forge projects
//make sure that workingDir exists and is a directory
File workDir = new File(getProjectDir(), 'eclipse');
System.out.println(workDir.getAbsolutePath())
if(!workDir.exists()){
workDir.mkdirs()
workDir.mkdir()
}
if(!workDir.isDirectory()){
//this provides more information than failed task...
throw new RuntimeException('workingDir is not a directory!')
}
//because gadle won't guess the classpath
classpath = sourceSets.main.runtimeClasspath
main = 'cuchaz.m3l.MainLauncher'
jvmArgs "-Xmx2G"
jvmArgs "-Djava.library.path=natives"//${workingDir}/natives
jvmArgs "-Dcuchaz.m3l.modClassNames=cubicchunks.TallWorldsMod"
args("client")
ignoreExitValue = true
enableAssertions = true
}
/**
* Run and debug tasks. Used by Netbeans gradle plugin
*/
task run(type:JavaExec, dependsOn: build) {
doFirst {
configure runCfg
}
}
task debug(type:JavaExec, dependsOn: build) {
doFirst {
configure runCfg
debug = true
}
}