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