Refactored tagging system

This commit is contained in:
Bruce Eckel 2017-05-17 21:38:05 -06:00
parent e16b83434c
commit 27f9db2cb6
19 changed files with 26 additions and 24 deletions

View File

@ -58,7 +58,7 @@ class TaggingPlugin implements Plugin<Project> {
File errFile = new File(file.parentFile, baseName + '.err') File errFile = new File(file.parentFile, baseName + '.err')
javaTask.configure { javaTask.configure {
ignoreExitValue = tags.validateByHand || tags.throwsException ignoreExitValue = tags.excludeFromGradle || tags.throwsException
doFirst { doFirst {
if(outFile.exists()) if(outFile.exists())
outFile.delete() outFile.delete()
@ -77,7 +77,7 @@ class TaggingPlugin implements Plugin<Project> {
} }
} }
if (!tags.validateByHand) { if (!tags.excludeFromGradle) {
// Only add tasks that we know we can run successfully to the task list // Only add tasks that we know we can run successfully to the task list
createdTasks.add(javaTask) createdTasks.add(javaTask)
} }

View File

@ -9,7 +9,7 @@ class Tags {
Boolean lowLevelAppendix = false Boolean lowLevelAppendix = false
Boolean throwsException = false Boolean throwsException = false
Boolean errorOutputExpected = false Boolean errorOutputExpected = false
Boolean validateByHand = false Boolean excludeFromGradle = false
Boolean ignoreOutput = false // This tag isn't used in the build... Boolean ignoreOutput = false // This tag isn't used in the build...
String fileRoot String fileRoot
String mainClass String mainClass
@ -44,7 +44,7 @@ class Tags {
lowLevelAppendix = firstLine.contains("// lowlevel/") lowLevelAppendix = firstLine.contains("// lowlevel/")
throwsException = hasTag('ThrowsException') throwsException = hasTag('ThrowsException')
errorOutputExpected = hasTag('ErrorOutputExpected') errorOutputExpected = hasTag('ErrorOutputExpected')
validateByHand = hasTag('ValidateByHand') excludeFromGradle = hasTag('ExcludeFromGradle')
ignoreOutput = hasTag('IgnoreOutput') ignoreOutput = hasTag('IgnoreOutput')
javap = extract('javap') // Includes only arguments to command javap = extract('javap') // Includes only arguments to command
runFirst = extract('RunFirst:') runFirst = extract('RunFirst:')
@ -82,7 +82,7 @@ class Tags {
excludeFromCI || excludeFromCI ||
throwsException || throwsException ||
errorOutputExpected || errorOutputExpected ||
validateByHand || excludeFromGradle ||
ignoreOutput || ignoreOutput ||
javaCmd || javaCmd ||
args || args ||
@ -104,7 +104,7 @@ class Tags {
excludeFromCI excludeFromCI
throwsException throwsException
errorOutputExpected errorOutputExpected
validateByHand excludeFromGradle
ignoreOutput ignoreOutput
fileRoot fileRoot
mainClass mainClass

View File

@ -2,7 +2,7 @@
// (c)2017 MindView LLC: see Copyright.txt // (c)2017 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose. // We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information. // Visit http://OnJava8.com for more book information.
// {ValidateByHand} // {VisuallyInspectOutput}
import java.util.*; import java.util.*;
public class EnvironmentVariables { public class EnvironmentVariables {

View File

@ -3,7 +3,7 @@
// We make no guarantees that this code is fit for any purpose. // We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information. // Visit http://OnJava8.com for more book information.
// {java GZIPcompress GZIPcompress.java} // {java GZIPcompress GZIPcompress.java}
// {ValidateByHand} // {VisuallyInspectOutput}
import java.util.zip.*; import java.util.zip.*;
import java.io.*; import java.io.*;

View File

@ -5,7 +5,7 @@
// Uses Zip compression to compress any // Uses Zip compression to compress any
// number of files given on the command line // number of files given on the command line
// {java ZipCompress ZipCompress.java} // {java ZipCompress ZipCompress.java}
// {ValidateByHand} // {VisuallyInspectOutput}
import java.util.zip.*; import java.util.zip.*;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;

View File

@ -2,7 +2,7 @@
// (c)2017 MindView LLC: see Copyright.txt // (c)2017 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose. // We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information. // Visit http://OnJava8.com for more book information.
// {ValidateByHand} // {VisuallyInspectOutput}
import java.util.*; import java.util.*;
import java.util.concurrent.*; import java.util.concurrent.*;
import java.util.stream.*; import java.util.stream.*;

View File

@ -3,7 +3,7 @@
// We make no guarantees that this code is fit for any purpose. // We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information. // Visit http://OnJava8.com for more book information.
// Hidden deadlock // Hidden deadlock
// {ValidateByHand} Gradle has trouble // {ExcludeFromGradle} Gradle has trouble
import java.util.*; import java.util.*;
import java.util.concurrent.*; import java.util.concurrent.*;
import onjava.Nap; import onjava.Nap;

View File

@ -2,7 +2,7 @@
// (c)2017 MindView LLC: see Copyright.txt // (c)2017 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose. // We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information. // Visit http://OnJava8.com for more book information.
// {ValidateByHand} // {VisuallyInspectOutput}
import java.util.*; import java.util.*;
import java.util.stream.*; import java.util.stream.*;

View File

@ -2,7 +2,7 @@
// (c)2017 MindView LLC: see Copyright.txt // (c)2017 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose. // We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information. // Visit http://OnJava8.com for more book information.
// {ValidateByHand} // {VisuallyInspectOutput}
import java.io.IOException; import java.io.IOException;
import java.nio.file.*; import java.nio.file.*;
import static java.nio.file.StandardWatchEventKinds.*; import static java.nio.file.StandardWatchEventKinds.*;

View File

@ -2,7 +2,7 @@
// (c)2017 MindView LLC: see Copyright.txt // (c)2017 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose. // We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information. // Visit http://OnJava8.com for more book information.
// {ValidateByHand} // {VisuallyInspectOutput}
import java.io.IOException; import java.io.IOException;
import java.nio.file.*; import java.nio.file.*;
import static java.nio.file.StandardWatchEventKinds.*; import static java.nio.file.StandardWatchEventKinds.*;

View File

@ -2,7 +2,7 @@
// (c)2017 MindView LLC: see Copyright.txt // (c)2017 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose. // We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information. // Visit http://OnJava8.com for more book information.
// {ValidateByHand} // {VisuallyInspectOutput}
import java.io.*; import java.io.*;
public class BasicFileOutput { public class BasicFileOutput {

View File

@ -2,7 +2,7 @@
// (c)2017 MindView LLC: see Copyright.txt // (c)2017 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose. // We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information. // Visit http://OnJava8.com for more book information.
// {ValidateByHand} // {VisuallyInspectOutput}
import java.io.*; import java.io.*;
import java.util.stream.*; import java.util.stream.*;

View File

@ -2,7 +2,7 @@
// (c)2017 MindView LLC: see Copyright.txt // (c)2017 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose. // We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information. // Visit http://OnJava8.com for more book information.
// {ValidateByHand} // {VisuallyInspectOutput}
import java.io.*; import java.io.*;
public class FileOutputShortcut { public class FileOutputShortcut {

View File

@ -2,7 +2,7 @@
// (c)2017 MindView LLC: see Copyright.txt // (c)2017 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose. // We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information. // Visit http://OnJava8.com for more book information.
// {ValidateByHand} // {VisuallyInspectOutput}
import java.io.*; import java.io.*;
public class FormattedMemoryInput { public class FormattedMemoryInput {

View File

@ -2,7 +2,7 @@
// (c)2017 MindView LLC: see Copyright.txt // (c)2017 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose. // We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information. // Visit http://OnJava8.com for more book information.
// {ValidateByHand} // {VisuallyInspectOutput}
import java.io.*; import java.io.*;
public class MemoryInput { public class MemoryInput {

View File

@ -3,7 +3,7 @@
// We make no guarantees that this code is fit for any purpose. // We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information. // Visit http://OnJava8.com for more book information.
// Testing for end of file // Testing for end of file
// {ValidateByHand} // {VisuallyInspectOutput}
import java.io.*; import java.io.*;
public class TestEOF { public class TestEOF {

View File

@ -3,7 +3,7 @@
// We make no guarantees that this code is fit for any purpose. // We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information. // Visit http://OnJava8.com for more book information.
// When threads collide // When threads collide
// {ValidateByHand} // {VisuallyInspectOutput}
public class EvenProducer extends IntGenerator { public class EvenProducer extends IntGenerator {
private int currentEvenValue = 0; private int currentEvenValue = 0;

View File

@ -2,7 +2,7 @@
// (c)2017 MindView LLC: see Copyright.txt // (c)2017 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose. // We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information. // Visit http://OnJava8.com for more book information.
// {ValidateByHand} Takes a long time or hangs // {ExcludeFromGradle} Takes a long time or hangs
import java.util.concurrent.*; import java.util.concurrent.*;
import onjava.Nap; import onjava.Nap;

View File

@ -3,14 +3,16 @@
// We make no guarantees that this code is fit for any purpose. // We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information. // Visit http://OnJava8.com for more book information.
// Accidental recursion // Accidental recursion
// {ValidateByHand} Throws very long exception // {ThrowsException}
// {VisuallyInspectOutput} Throws very long exception
import java.util.*; import java.util.*;
import java.util.stream.*; import java.util.stream.*;
public class InfiniteRecursion { public class InfiniteRecursion {
@Override @Override
public String toString() { public String toString() {
return " InfiniteRecursion address: " + this + "\n"; return
" InfiniteRecursion address: " + this + "\n";
} }
public static void main(String[] args) { public static void main(String[] args) {
Stream.generate(InfiniteRecursion::new) Stream.generate(InfiniteRecursion::new)