-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
73 lines (59 loc) · 1.76 KB
/
build.gradle
File metadata and controls
73 lines (59 loc) · 1.76 KB
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
import org.apache.tools.ant.filters.FixCrLfFilter
import org.apache.tools.ant.filters.ReplaceTokens
def filteredSourceDir = file("${buildDir}/filtered")
def versionValue = '1.0'
def mainClass = "org.craft.bootstrap.BootstrapMain"
apply plugin: 'java'
sourceCompatibility = 1.6
archivesBaseName = 'OurCraftBootstrap'
version = versionValue
//IDE
apply plugin: 'eclipse'
apply plugin: 'idea'
repositories {
mavenCentral()
}
//Tasks
task wrapper(type: Wrapper) {
gradleVersion = '2.0'
}
task processVersion(type: Copy) {
from sourceSets.main.java
into filteredSourceDir
// Substitute property references in files
// Use some of the filters provided by Ant
filter(FixCrLfFilter)
filter(ReplaceTokens, tokens: ['version': versionValue])
// Use a closure to filter each line
filter { String line ->
("$line".replaceAll('"OurCraft:BuildNumber"', '"'+versionValue+'"'))
}
}
sourceSets {
// This source set will contain all sources that we filter
filtered {
java {
srcDirs = [filteredSourceDir]
}
}
}
//force UTF-8 to the compileJava task
compileJava.options.encoding = 'UTF-8'
// tell the compileJava task to compile the filtered source
compileJava.source = sourceSets.filtered.java
// Add dependencies processVersion to compileJava task
compileJava.dependsOn processVersion
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
jar {
manifest {
attributes 'Implementation-Title': 'OurCraftLauncher', 'Implementation-Version': version, 'Main-Class': mainClass
}
}
task runClient(type: JavaExec, dependsOn: 'classes') {
main = mainClass
classpath = configurations.runtime
classpath += sourceSets.main.runtimeClasspath
standardInput = System.in
}