ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet CSharp.java Ilasm.java
Date Thu, 11 Apr 2002 06:47:41 GMT
stevel      02/04/10 23:47:41

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional/dotnet
                        CSharp.java Ilasm.java
  Log:
  comment fixup
  
  Revision  Changes    Path
  1.18      +41 -10    jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java
  
  Index: CSharp.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- CSharp.java	10 Apr 2002 00:39:20 -0000	1.17
  +++ CSharp.java	11 Apr 2002 06:47:41 -0000	1.18
  @@ -1,7 +1,7 @@
   /*
    *  The Apache Software License, Version 1.1
    *
  - *  Copyright (c) 2000-2002 The Apache Software Foundation.  All rights
  + *  Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
    *  reserved.
    *
    *  Redistribution and use in source and binary forms, with or without
  @@ -51,13 +51,11 @@
    *  information on the Apache Software Foundation, please see
    *  <http://www.apache.org/>.
    */
  +
   /*
    *  build notes
    *  -The reference CD to listen to while editing this file is
    *  nap: Underworld  - Everything, Everything
  - *  -variable naming policy from Fowler's refactoring book.
  - *  -tested against the PDC pre-beta of csc.exe; future versions will
  - *  inevitably change things
    */
   // ====================================================================
   // place in the optional ant tasks package
  @@ -941,7 +939,7 @@
   
   
       /**
  -     *  Set the definitions
  +     *  Set the output file
        *
        *@param  params  The new outputFile value
        */
  @@ -949,6 +947,15 @@
           outputFile = params;
       }
   
  +    /**
  +     *  Set the output file
  +     *
  +     *@param  params  The new outputFile value
  +     */
  +    public void setDestFile(File file) {
  +        outputFile = file;
  +    }
  +    
   
       /**
        *  get the argument or null for no argument needed
  @@ -1040,17 +1047,28 @@
           return s != null && s.length() != 0;
       }
   
  +    /**
  +     * validation code
  +     * @throws  BuildException  if validation failed
  +     */ 
  +    protected void validate() 
  +            throws BuildException {
  +        if(outputFile==null) {
  +            throw new BuildException("destination file must be specified");
  +        }
  +    }
   
       /**
        *  do the work by building the command line and then calling it
        *
  -     *@exception  BuildException  Description of the Exception
  +     *@throws  BuildException  if validation or execution failed
        */
       public void execute()
                throws BuildException {
           if (srcDir == null) {
               srcDir = project.resolveFile(".");
           }
  +        validate();
   
           NetCommand command = new NetCommand(this, "CSC", csc_exe_name);
           command.setFailOnError(getFailOnError());
  @@ -1080,20 +1098,33 @@
           command.addArgument(getExtraOptionsParameter());
           command.addArgument(getFileAlignParameter());
   
  +        long outputTimestamp;
  +        if(outputFile.exists()) {
  +            outputTimestamp = outputFile.lastModified();
  +        } else {
  +            outputTimestamp = 0;
  +        }
  +        int filesOutOfDate=0;
           //get dependencies list.
           DirectoryScanner scanner = super.getDirectoryScanner(srcDir);
           String[] dependencies = scanner.getIncludedFiles();
           log("compiling " + dependencies.length + " file" + ((dependencies.length == 1)
? "" : "s"));
           String baseDir = scanner.getBasedir().toString();
  +        File base=scanner.getBasedir();
           //add to the command
           for (int i = 0; i < dependencies.length; i++) {
  -            String targetFile = dependencies[i];
  -            targetFile = baseDir + File.separator + targetFile;
  -            command.addArgument(targetFile);
  +            File targetFile = new File(base,dependencies[i]);
  +            command.addArgument(targetFile.toString());
  +            if(targetFile.lastModified()>outputTimestamp) {
  +                filesOutOfDate++;
  +                log("Source file "+targetFile.toString()+" is out of date");
  +            }
           }
   
           //now run the command of exe + settings + files
  -        command.runCommand();
  +        if(filesOutOfDate>0) {
  +            command.runCommand();
  +        }
       }
       // end execute
   
  
  
  
  1.15      +1 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java
  
  Index: Ilasm.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Ilasm.java	10 Apr 2002 00:39:20 -0000	1.14
  +++ Ilasm.java	11 Apr 2002 06:47:41 -0000	1.15
  @@ -1,7 +1,7 @@
   /*
    *  The Apache Software License, Version 1.1
    *
  - *  Copyright (c) 2000-2002 The Apache Software Foundation.  All rights
  + *  Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
    *  reserved.
    *
    *  Redistribution and use in source and binary forms, with or without
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message