-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.gradle
202 lines (152 loc) · 4.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
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
if(JavaVersion.current() < JavaVersion.VERSION_1_7){
println("\t************************")
println("\t*** Hello from Bixie ***")
println("\tYou will need Java 1.7 or higher if you want to continue.")
println("\tYour Java is really old. Found version " + JavaVersion.current())
println("\t************************")
throw new GradleException("Update your Java!")
}
import org.apache.tools.ant.taskdefs.condition.Os
//install the commit hook if possible.
def hook_folder = new File('./.git/hooks')
def hook = new File('pre-commit.sh')
def installed_hook = new File('./.git/hooks/pre-commit')
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
println("Installing pre-commit hook for WINDOWS")
if (hook.exists() && hook_folder.exists() && !installed_hook.exists()) {
exec {
commandLine 'cmd', '/c', 'copy', hook.getAbsolutePath(), installed_hook.getAbsolutePath()
}
}
} else {
println("Installing pre-commit hook for Unix/OS X")
if (hook.exists() && hook_folder.exists() && !installed_hook.exists()) {
exec {
workingDir '.'
commandLine 'cp', hook, installed_hook
}
}
}
apply plugin: 'java'
apply plugin: 'eclipse-wtp'
apply plugin: 'idea'
apply plugin: 'jacoco'
apply plugin: 'com.github.kt3k.coveralls'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'application'
apply plugin: 'findbugs'
//apply plugin: 'jdepend'
apply plugin: 'checkstyle'
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
def version = '1.0'
jar.archiveName = "bixie_dyn.jar"
shadowJar.archiveName = "bixie.jar"
mainClassName = "bixie.Main"
repositories {
mavenCentral()
}
buildscript {
repositories {
mavenCentral()
maven {
name 'Shadow'
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.0.1'
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.2'
}
}
configurations{
common
}
dependencies {
compile 'args4j:args4j:2.32'
compile 'log4j:log4j:1.2.17'
compile 'org.scala-lang:scala-actors:2.11.7'
compile 'org.scala-lang:scala-library:2.11.7'
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.0'
compile 'net.sourceforge.findbugs:annotations:1.3.2'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.7.5'
// https://mvnrepository.com/artifact/org.checkerframework/checker-qual
compile group: 'org.checkerframework', name: 'checker-qual', version: '2.1.10'
compile fileTree(dir: 'lib', include: '*.jar')
testCompile "junit:junit:4.11" // Or whatever version
}
// building the jar ---------------------
jar {
println("WARNING: jar does not create an executable jar. Use shadowJar instead.")
baseName = 'bixie'
from configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
from('src/main/resources'){ include('log4j.properties')}
from('src/main/resources'){ include('basic_prelude.bpl')}
from('src/main/resources'){ include('java_lang.bpl')}
from('src/main/resources'){ include('builtin_stubs.json')}
manifest {
attributes 'Main-Class': mainClassName,
'Class-Path': '.',
'Implementation-Title': 'Bixie',
'Implementation-Version': version
}
}
shadowJar {
append('src/main/resources/report_html.zip')
}
//jar.dependsOn shadowJar
// testing related activities -----------------
tasks.withType(FindBugs) {
effort = "max"
reportLevel = "medium"
findbugs.excludeFilter = file("$rootProject.projectDir/config/findbugs/excludeFilter.xml")
reports {
xml.enabled = false
html.enabled = true
}
}
jacocoTestReport {
reports {
xml.enabled true
html.enabled true
csv.enabled false
html.destination "${buildDir}/reports/coverage"
}
}
test {
jacoco {
enabled = true
}
testLogging {
events "failed"
exceptionFormat "full"
}
useJUnit()
}
task selfCheck {
group 'Verification'
description 'Run Bixie on itself.'
doLast {
def bixieJar = shadowJar.archivePath
def bixieDir = compileJava.destinationDir
def bixieClassPath = compileJava.classpath.asPath
//TODO generate this.
def bixieReportDir = "${buildDir}/reports/self_test.txt"
exec {
workingDir '.'
commandLine 'java', '-jar', bixieJar, '-j', bixieDir, '-cp', bixieClassPath, '-o', bixieReportDir, '-checker', '3'
}
}
}
task inferCheck {
group 'Verification'
description 'Run Facebook Infer on this project.'
doLast {
println("REQUIRES Infer TO BE IN YOUR PATH.")
exec {
workingDir '.'
commandLine 'infer', '--', 'gradle', 'clean', 'compileJava'
}
}
}