-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
183 lines (146 loc) · 4.79 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
import com.badlogic.gdx.tools.texturepacker.TexturePacker
buildscript {
ext {
// Dependencies.
kotlinVersion = '1.2.21'
ashleyVersion = '1.7.3'
guiceVersion = '4.1.0'
gdxVersion = '1.9.8'
log4jVersion = '2.10.0'
jacksonVersion = '2.9.4'
kotlinArgParserVersion = '2.0.4'
commonsIoVersion = '2.6'
jbox2dVersion = '2.3.1'
// Testing dependencies.
groovyVersion = '2.4.13'
spockVersion = '1.1-groovy-2.4-rc-3'
detektVersion = '1.0.0.M10.3'
// Texture directory.
textureDir = 'assets/textures/'
// Raw asset directory.
rawAssets = 'raw_assets/'
// Main atlas name.
mainAtlasName = 'jelly_stuff'
}
repositories {
mavenCentral()
mavenLocal()
jcenter()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "com.badlogicgames.gdx:gdx-tools:$gdxVersion"
}
}
repositories {
mavenCentral()
mavenLocal()
jcenter()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
maven { url 'https://oss.sonatype.org/content/repositories/releases/' }
maven { url 'http://dl.bintray.com/arturbosch/code-analysis' }
}
apply plugin: 'kotlin'
apply plugin: 'groovy'
apply plugin: 'idea'
version = '0.3.5-alpha'
sourceCompatibility = 1.8
project.ext.mainClassName = 'com.edd.jelly.Launcher'
project.ext.assetsDir = new File('resources')
// See:
// http://stackoverflow.com/questions/38131237/mixing-java-and-kotlin-in-gradle-project-kotlin-cannot-find-java-class
sourceSets {
main.java.srcDirs = ['src/main/kotlin']
}
configurations {
detekt
}
task run(dependsOn: classes, type: JavaExec) {
main = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
ignoreExitValue = true
}
/**
* Create distributable game .jar file.
*/
task dist(type: Jar) {
from files(sourceSets.main.output.classesDir)
from files(sourceSets.main.output.resourcesDir)
from { configurations.compile.collect { zipTree(it) } }
manifest {
attributes 'Main-Class': project.mainClassName
}
}
/**
* Run detect static code analysis.
*/
task detekt(type: JavaExec) {
classpath = configurations.detekt
main = 'io.gitlab.arturbosch.detekt.cli.Main'
def params = [
'-p', "$project.projectDir.absolutePath",
'-c', "$project.projectDir/.detekt.yml",
'-f', '.*test.*'
]
args(params)
}
/**
* Pack main game atlas textures.
*/
task packMainAtlas {
doLast {
def output = project.ext.textureDir as String
def name = project.ext.mainAtlasName as String
def input = "$project.ext.rawAssets${name}"
def settings = new TexturePacker.Settings()
settings.with {
useIndexes = false
maxWidth = 2048
maxHeight = 2048
paddingX = 0
paddingY = 0
}
TexturePacker.process(settings, input, output, name)
}
}
dist.dependsOn classes
idea {
module {
excludeDirs += file('logs')
}
}
dependencies {
// Kotlin!
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
// Core LigGDX dependencies.
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
// ECS - Ashley.
compile "com.badlogicgames.ashley:ashley:$ashleyVersion"
// Dependency injection.
compile "com.google.inject:guice:$guiceVersion"
// Logging.
compile "org.apache.logging.log4j:log4j-core:$log4jVersion"
compile "org.apache.logging.log4j:log4j-api:$log4jVersion"
// Other useful libraries.
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:$jacksonVersion"
compile "com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonVersion"
compile "com.fasterxml.jackson.core:jackson-databind:$jacksonVersion"
compile "com.xenomachina:kotlin-argparser:$kotlinArgParserVersion"
compile "commons-io:commons-io:$commonsIoVersion"
// JBox2d + Liquid fun dependencies.
compile files("libs/jbox2d/jbox2d-library-$jbox2dVersion-SNAPSHOT.jar")
compile files("libs/jbox2d/jbox2d-library-$jbox2dVersion-SNAPSHOT-sources.jar")
// Testing.
testCompile "org.codehaus.groovy:groovy-all:$groovyVersion"
testCompile "org.spockframework:spock-core:$spockVersion"
// Static code analysis.
detekt "io.gitlab.arturbosch.detekt:detekt-formatting:$detektVersion"
detekt "io.gitlab.arturbosch.detekt:detekt-cli:$detektVersion"
}
task wrapper(type: Wrapper) {
gradleVersion = '4.5'
}