Add tasks for cloc
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 17 Feb 2017 19:07:01 +0000 (20:07 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 17 Feb 2017 19:07:01 +0000 (20:07 +0100)
build.gradle

index 2ceb56a..a88bf84 100644 (file)
@@ -100,3 +100,21 @@ findbugs {
 }
 
 apply plugin: 'idea'
+
+task countLinesMain(type: Exec) {
+    executable = 'cloc'
+    args = ['--by-file', '--xml', '--report-file=build/reports/cloc/main.xml', 'src/main']
+    standardOutput = new ByteArrayOutputStream()
+}
+
+task countLinesTest(type: Exec) {
+    executable = 'cloc'
+    args = ['--by-file', '--xml', '--report-file=build/reports/cloc/test.xml', 'src/test']
+    standardOutput = new ByteArrayOutputStream()
+}
+
+task countLines {
+    new File(buildDir, "reports/cloc").mkdirs()
+    dependsOn tasks.countLinesMain
+    dependsOn tasks.countLinesTest
+}