File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
sort-dependencies-gradle-plugin/src/main/kotlin/com/squareup/sort Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ abstract class CheckSortDependenciesTask @Inject constructor(
37
37
val version = version.get().removeSuffix(" -SNAPSHOT" ).toDouble()
38
38
39
39
val result = execOps.exec { execSpec ->
40
+ execSpec.setIgnoreExitValue(true )
40
41
execSpec.commandLine = listOf (
41
42
" java" ,
42
43
" -cp" , sortProgram.asPath,
@@ -69,5 +70,13 @@ abstract class CheckSortDependenciesTask @Inject constructor(
69
70
outputDirectory.asFile.get().mkdirs()
70
71
val outputPath : Path = Paths .get(outputDirectory.asFile.get().absolutePath, " result.txt" )
71
72
File (outputPath.toUri()).writeText(resultText)
73
+
74
+ if (result.exitValue == 2 ) {
75
+ throw VerificationException (" Dependencies are not correctly sorted." )
76
+ } else if (result.exitValue == 3 ) {
77
+ throw RuntimeException (" There were parse errors." )
78
+ } else if (result.exitValue > 0 ) {
79
+ throw RuntimeException (" The command failed with exit code ${result.exitValue} ." )
80
+ }
72
81
}
73
82
}
You can’t perform that action at this time.
0 commit comments