Changeset 16691 for release-kits


Ignore:
Timestamp:
2008-08-09T12:00:33+12:00 (16 years ago)
Author:
oranfry
Message:

some changes in the execute logic

Location:
release-kits/shared/ant/src/main/org/apache/tools/ant
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release-kits/shared/ant/src/main/org/apache/tools/ant/Task.java

    r16685 r16691  
    359359
    360360        //if in sim mode, dont execute tasks except antcall and tasks outside of any target
    361         boolean dontExecute =
    362             project.getProperty("execute") != null && project.getProperty("execute").equals( "false" ) &&
    363             getOwningTarget() != null && !getOwningTarget().getName().equals("") &&
    364             !getTaskName().equals("antcall");
    365 
    366 
    367         if ( dontExecute ) {
     361        boolean execute =
     362            project.getProperty("execute") == null ||
     363                !project.getProperty("execute").equals( "false" ) ||
     364            getOwningTarget() == null ||
     365                getOwningTarget().getName().equals("") ||
     366            getTaskName().equals("antcall");
     367
     368
     369        if ( !execute ) {
    368370            return;
    369371        }
  • release-kits/shared/ant/src/main/org/apache/tools/ant/taskdefs/CallTarget.java

    r16685 r16691  
    131131            //check that all are true
    132132            boolean execute = shouldExecOnFrom && shouldExecuteOnDescend && shouldExecOnTo;
     133            //log( "oran: address: " + address );
     134            //log( "oran: execute: " + execute);
    133135
    134136            if ( !execute ) {
     
    286288        }
    287289
     290
     291        //everything is after root
     292        if ( y.equals("root") ) {
     293            return true;
     294        }
     295
     296        //root is after nothing
     297        //(except itself, but that's already caught)
     298        if ( x.equals("root") ) {
     299            return false;
     300        }
     301
     302        //infinity is after everything
     303        if ( x.equals("infinity") )
     304            return true;
     305
     306        //nothing is after infinity
     307        // (except itself, but that's already caught)
     308        if ( y.equals("infinity") )
     309            return false;
     310
    288311        //check that both are in the form int.int.int
    289312
     
    327350        }
    328351
     352
     353        //everything decends from root
     354        if ( y.equals("root") )
     355            return true;
     356
     357        //root descends from nothing
     358        //(except itself but that's already caught)
     359        if ( x.equals("root") )
     360            return false;
     361
     362        //infinity descends from itself
     363        if ( x.equals("infinity") && y.equals("infinity") ) {
     364            return true;
     365        }
     366
     367        //nothing descends from infinity
     368        //(except itself but that's already caught)
     369        if ( y.equals("infinity") ) {
     370            return false;
     371        }
     372
     373        //infinity descends only from nothing
     374        //(except root and itself, but that's already caught)
     375        if ( x.equals("infinity") ) {
     376            return false;
     377        }
     378
     379
     380
     381
    329382        //check that both are in the form int.int.int
    330383
     
    359412    }
    360413
    361     public static boolean isEqualTo(String x, String y) {
    362 
    363         System.out.println( "x: " + x );
    364         System.out.println( "y: " + y );
    365 
    366         if ( x.equals("") || y.equals("") ) {
    367             throw new BuildException("Error - x or y not specified !!");
    368         }
    369 
    370         //check that both are in the form int.int.int
    371 
    372         //break into chambers
    373         String[] xs = x.split("\\.");
    374         String[] ys = y.split("\\.");
    375 
    376         //make sure x is exactly as deep as y
    377         if ( xs.length != ys.length ) {
    378             System.out.println("x not equal to y");
    379             return false;
    380         }
    381 
    382         //figure out n
    383         int n = xs.length;
    384 
    385         //step through, making sure x values are equal to y values
    386         for ( int i=0; i<n; i++ ) {
    387             int xValue = Integer.parseInt( xs[i] );
    388             int yValue = Integer.parseInt( ys[i] );
    389 
    390             System.out.println( xValue + " " + yValue );
    391             if(  xValue != yValue ) {
    392                 System.out.println("x not equal to y");
    393                 return false;
    394             }
    395         }
    396 
    397         // if execution reaches here, first all places
    398         System.out.println("x is equal to y");
    399         return true;
    400     }
    401 
    402 
    403414}
Note: See TracChangeset for help on using the changeset viewer.