debian/copyright: add information about mrDlib_jayatana.patch.
[debian/jabref.git] / build.gradle
1 apply plugin: 'java'
2
3 // with gradle 1.1, Sonar 3.2 is not working. One needs Sonar 3.1.1
4 apply plugin: 'sonar'
5
6 sourceSets {
7         main {
8                 java {
9                         srcDir 'src/java'
10                 }
11                 resources {
12                         srcDir 'src/resource'
13                 }
14         }
15 }
16
17 repositories {
18         mavenCentral()
19 }
20
21 /* ANTLR support for Bst.g
22 Source: http://fenrock.wordpress.com/2012/05/17/gradle-and-antlr-3-x/
23 */
24
25 configurations {
26         antlr3
27 }
28
29 dependencies {
30         compile 'org.antlr:antlr-runtime:3.4'
31         antlr3 'org.antlr:antlr:3.4'
32 }
33 task generateGrammarSource(type: JavaExec) {
34     def antlrSource = 'src/java/net/sf/jabref/bst'
35     destinationDir = antlrSource
36
37     inputs.dir file(antlrSource)
38     outputs.dir file(destinationDir)
39
40     def grammars = fileTree(antlrSource).include('**/*.g')
41
42     main = 'org.antlr.Tool'
43     classpath = configurations.antlr3
44     args = ["-o", "${destinationDir}", grammars.files].flatten()
45 }
46
47 /*
48  Code for JavaNCSS adapted from http://gradle.codehaus.org/Cookbook#Cookbook-usingJavaNCSS
49  JavaNCSS: http://www.kclee.de/clemens/java/javancss/
50
51 Cyclomatic
52 Complexity             Ease of       Risk
53 Number (CCN)           maintenance
54 (McCabe metric)
55 ---------------------------------------------
56 1-10, simple           easy          minimum
57 11-20, complex         moderate      moderate
58 21-50, more complex    hard          high
59 >50, unstable          very hard     very high
60 */
61
62 configurations {
63     javancssConf
64 }
65
66 dependencies {
67     javancssConf 'org.codehaus.javancss:javancss:32.53'
68 }
69
70 task javancss << {
71     println 'Running javancss quality metrics tool'
72     ant {
73         taskdef(name:'javancss', classname:'javancss.JavancssAntTask', classpath: configurations.javancssConf.asPath)
74         javancss(
75                         srcdir:'src/java',
76                         includes:'**/*.java',
77                         excludes:'jama/**/*.java, jmat/**/*.java, cformat/**/*.java',
78                         abortOnFail:'false',
79                         generateReport:'true',
80                         outputfile:'build/javancss_report.plain',
81                         ccnPerFuncMax:'30',
82                         format:'plain',
83                         packageMetrics:'true',
84                         classMetrics:'false',
85                         functionMetrics:'false'
86                 )
87     }
88 }