Add tasks for cloc
[Sone.git] / build.gradle
index f19c861..a88bf84 100644 (file)
@@ -3,7 +3,7 @@ version = '0.9.6'
 
 buildscript {
     ext {
-        kotlinVersion = '1.0.5'
+        kotlinVersion = '1.0.6'
     }
     repositories {
         mavenCentral()
@@ -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
+}