@@ -28,6 +28,7 @@ subprojects {
2828 Boolean hasMainParam = lines. find { it. startsWith(' // {main: ' )}
2929 Boolean willNotCompile = lines. find { it. startsWith(' // {CompileTimeError' ) }
3030 Boolean validateByHand = lines. find { it. startsWith(' // {ValidateByHand}' ) }
31+ Boolean throwsException = lines. find { it. startsWith(' // {ThrowsException}' ) }
3132
3233 // add tasks for java sources with main methods
3334 if ((hasMainMethod || hasMainParam) && (! willNotCompile)) {
@@ -42,7 +43,11 @@ subprojects {
4243 String mainClass = it. name. replaceAll(' .java' , ' ' )
4344
4445 String taskName = mainClass
45- tasks. add(taskName)
46+
47+ if (! validateByHand) {
48+ // only add tasks that we know we can run successfully to the task list
49+ tasks. add(taskName)
50+ }
4651
4752 // some java sources with a main method specify a different main class
4853 String maybeMainLine = lines. find { it. startsWith(' // {main: ' )}
@@ -65,17 +70,15 @@ subprojects {
6570 }
6671
6772 // some java apps intentionally throw an exception
68- Boolean maybeIgnoreExitValue = false
69- if (lines. find { it. startsWith(' // {ThrowsException}' ) } != null ) {
70- maybeIgnoreExitValue = true
71- }
73+ Boolean maybeIgnoreExitValue = (validateByHand || throwsException)
7274
7375 // some java apps need a timeout
7476 Boolean timeOutDuringTesting = false
7577 if (lines. find { it. startsWith(' // {TimeOutDuringTesting}' ) } != null ) {
7678 timeOutDuringTesting = true
7779 }
7880
81+ // create run and test tasks
7982 if (timeOutDuringTesting) {
8083 // todo: apps with timeOutDuringTesting need special handling
8184 task " $taskName " << {
0 commit comments