-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
71 lines (58 loc) · 1.73 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
apply plugin: "java"
group = "com.codegans.ai.cup2015"
version = "1.0"
repositories {
jcenter()
maven {
url "http://bicsjava.bc/nexus/content/groups/public"
}
}
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
compileJava.options.encoding = "UTF-8"
dependencies {
testCompile "junit:junit:4.12"
}
task copySources(type: Sync) {
into "$buildDir/tmpSources"
from("src/main/java") {
include "model/*.java"
include "*Strategy.java"
exclude "**/visualize"
}
from fileTree("src/main/java/${project.group.replace('.', '/')}").files
}
task fixSources(type: Sync, dependsOn: copySources) {
def importStatement = "import " + project.group
def packageStatement = "package " + project.group
into "$buildDir/sources"
from "$buildDir/tmpSources"
eachFile { detail ->
detail.file.text = detail.file.text
.replace(packageStatement, "//" + packageStatement)
.replace(importStatement, "//" + importStatement)
.replaceAll("(?ms)/\\*\\*.*?\\*/", "")
.replaceAll("//.*", "")
}
}
task zipSources(type: Zip) {
classifier = 'src'
from "$buildDir/sources"
include "*.java"
exclude "Strategy.java"
}
task testSources(type: JavaCompile) {
source = "$buildDir/sources"
include "*.java"
include "model/*.java"
classpath = sourceSets.main.compileClasspath
destinationDir = file("$buildDir/testSources")
}
//testSources.options.compilerArgs = ["-sourcepath", "$buildDir/sources"]
testSources.options.encoding = "UTF-8"
processResources.dependsOn += fixSources
assemble.dependsOn += zipSources
testClasses.dependsOn += testSources
task wrapper(type: Wrapper) {
gradleVersion = "2.9"
}