]> source.dussan.org Git - aspectj.git/commitdiff
fixed test to fail on license check failure
authorwisberg <wisberg>
Fri, 8 Aug 2003 23:08:37 +0000 (23:08 +0000)
committerwisberg <wisberg>
Fri, 8 Aug 2003 23:08:37 +0000 (23:08 +0000)
build/src/org/aspectj/internal/tools/ant/taskdefs/Checklics.java

index d7a206a6ab6a7628fb3f142fea0a9ceb021dae71..7b8b61425d6299317b9aed400e1219b3bd2f2535 100644 (file)
@@ -151,8 +151,8 @@ public class Checklics extends MatchingTask {
     private boolean failOnError;
     private boolean getYears;
     private boolean replaceHeaders;
-    private int passed;
     private int failed;
+    private int passed;
 
        private boolean printDirectories;
 
@@ -308,6 +308,8 @@ public class Checklics extends MatchingTask {
         }
         Visitor visitor = new Visitor();
         visitAll(visitor);
+        this.failed = visitor.failed;
+        this.passed = visitor.passed;
         getOut().println(
             "Total passed: "
                 + visitor.passed
@@ -318,60 +320,60 @@ public class Checklics extends MatchingTask {
         }
     }
     
-    private void oldrun() throws BuildException {
-       if (list) {
-                       list();
-                       return;
-               }
-               if (null == license) {
-                       setLicense(DEFAULT);
-               }
-               final License license = this.license; // being paranoid...
-               if (null == license) {
-                       throw new BuildException("no license");
-               }
-               final PrintStream out = getOut();
-
-               List filelist = new ArrayList();
-               String[] dirs = sourcepath.list();
-        failed = 0;
-        passed = 0;
-               for (int i = 0; i < dirs.length; i++) {
-                       int dirFailed = 0;
-                       int dirPassed = 0;
-                       File dir = project.resolveFile(dirs[i]);
-                       String[] files = getDirectoryScanner(dir).getIncludedFiles();
-                       for (int j = 0; j < files.length; j++) {
-                               File file = new File(dir, files[j]);
-                               String path = file.getPath();
-                               if (path.endsWith(".java")) {
-                                       if (license.checkFile(file)) {
-                        dirPassed++;
-                    } else {
-                                               dirFailed++;
-                                               if (!license.foundLicense()) {
-                                                       out.println(
-                                                               license.tag + "   LICENSE FAIL: " + path);
-                                               }
-                                               if (!license.foundCopyright()) {
-                                                       out.println(
-                                                               license.tag + " COPYRIGHT FAIL: " + path);
-                                               }
-                                       }
-                               }
-                       }
-            if (printDirectories) {
-                       out.println(
-                               "dir: "
-                                       + dirs[i]
-                                       + " passed: "
-                                       + dirPassed
-                                       + (dirFailed == 0 ? "" : " failed: " + dirFailed));
-            }
-                       failed += dirFailed;
-                       passed += dirPassed;
-               }
-       }
+//    private void oldrun() throws BuildException {
+//     if (list) {
+//                     list();
+//                     return;
+//             }
+//             if (null == license) {
+//                     setLicense(DEFAULT);
+//             }
+//             final License license = this.license; // being paranoid...
+//             if (null == license) {
+//                     throw new BuildException("no license");
+//             }
+//             final PrintStream out = getOut();
+//
+//             List filelist = new ArrayList();
+//             String[] dirs = sourcepath.list();
+//        failed = 0;
+//        passed = 0;
+//             for (int i = 0; i < dirs.length; i++) {
+//                     int dirFailed = 0;
+//                     int dirPassed = 0;
+//                     File dir = project.resolveFile(dirs[i]);
+//                     String[] files = getDirectoryScanner(dir).getIncludedFiles();
+//                     for (int j = 0; j < files.length; j++) {
+//                             File file = new File(dir, files[j]);
+//                             String path = file.getPath();
+//                             if (path.endsWith(".java")) {
+//                                     if (license.checkFile(file)) {
+//                        dirPassed++;
+//                    } else {
+//                                             dirFailed++;
+//                                             if (!license.foundLicense()) {
+//                                                     out.println(
+//                                                             license.tag + "   LICENSE FAIL: " + path);
+//                                             }
+//                                             if (!license.foundCopyright()) {
+//                                                     out.println(
+//                                                             license.tag + " COPYRIGHT FAIL: " + path);
+//                                             }
+//                                     }
+//                             }
+//                     }
+//            if (printDirectories) {
+//                     out.println(
+//                             "dir: "
+//                                     + dirs[i]
+//                                     + " passed: "
+//                                     + dirPassed
+//                                     + (dirFailed == 0 ? "" : " failed: " + dirFailed));
+//            }
+//                     failed += dirFailed;
+//                     passed += dirPassed;
+//             }
+//     }
 
        private void list() {
                Enumeration enum = LICENSES.keys();