Browse Source

comment fixup

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@272356 13f79535-47bb-0310-9956-ffa450edef68
master
Steve Loughran 23 years ago
parent
commit
826cc88ca9
2 changed files with 42 additions and 11 deletions
  1. +41
    -10
      src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java
  2. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java

+ 41
- 10
src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java View File

@@ -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 @@ public class CSharp


/**
* Set the definitions
* Set the output file
*
*@param params The new outputFile value
*/
@@ -949,6 +947,15 @@ public class CSharp
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 @@ public class CSharp
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 @@ public class CSharp
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
- 1
src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java View File

@@ -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


Loading…
Cancel
Save