Hi all,
I draft one enhancenment to recompile-needed feature in CompilerBase. I'm heading to
compile mono classes by nant. This is lot of subprojects/namespaces and files and this
feature is desirable.
1/ Added support for changed .build projects
2/ Bugfix/enhance subprojects recompilation
I'll be glad if you merge this into CVS
Martin
PS: Why ALTask is not derived from CompilerBase? It _IS_ compiler, isn't it?
[ this line should be changed in ALTask becouse of it:
string fileName =
Sources.FindMoreRecentLastWriteTime(outputFileInfo.LastWriteTime);
]
Here it is:
-=-=-=-=-=-=-=-=
--- /home/alik/mono/nant/exist/FileSet.cs Thu Jul 11 19:53:14 2002
+++ FileSet.cs Tue Oct 8 07:31:18 2002
@@ -29,23 +29,24 @@
public class FileSet : Element {
+
+
+ public static bool IsMoreRecentLastWriteTime(string fileName, DateTime
+targetLastWriteTime) {
+ FileInfo fileInfo = new FileInfo(fileName);
+ if (!fileInfo.Exists) return true;
+ if (fileInfo.LastWriteTime > targetLastWriteTime) return true;
+ return false;
+ }
+
/// <summary>Determines if a file has a more recent last write time than the
given time.</summary>
- /// <param name="fileNames">A collection of filenames to check last write
times against.</param>
/// <param name="targetLastWriteTime">The datetime to compare against.</param>
/// <returns>The name of the first file that has a last write time greater
than <c>targetLastWriteTime</c>; otherwise null.</returns>
- public static string FindMoreRecentLastWriteTime(StringCollection fileNames,
DateTime targetLastWriteTime) {
- foreach (string fileName in fileNames) {
- // only check fully file names that have a full path
- if (Path.IsPathRooted(fileName)) {
- FileInfo fileInfo = new FileInfo(fileName);
- if (!fileInfo.Exists) {
- return fileName;
- }
- if (fileInfo.LastWriteTime > targetLastWriteTime) {
+ public string FindMoreRecentLastWriteTime(DateTime targetLastWriteTime) {
+ foreach (string fn in FileNames) {
+ string fileName=Path.Combine(BaseDirectory,fn);
+ if(IsMoreRecentLastWriteTime(fileName,targetLastWriteTime))
return fileName;
}
- }
- }
return null;
}
--- /home/alik/mono/nant/exist/Tasks/CompilerBase.cs Thu Jul 11 19:53:14 2002
+++ CompilerBase.cs Tue Oct 8 07:39:43 2002
@@ -114,36 +114,41 @@
return true;
}
+ Uri testURI = new Uri(Project.Doc.BaseURI);
+ if(testURI.IsFile &&
+FileSet.IsMoreRecentLastWriteTime(testURI.LocalPath,outputFileInfo.LastWriteTime)) {
+ Log.WriteLineIf(Verbose, LogPrefix + "Buildfile {0} is out of date,
+recompiling.", testURI.LocalPath);
+ return true;
+ }
+
//Sources Updated?
- string fileName = FileSet.FindMoreRecentLastWriteTime(Sources.FileNames,
outputFileInfo.LastWriteTime);
+ string fileName =
+Sources.FindMoreRecentLastWriteTime(outputFileInfo.LastWriteTime);
if (fileName != null) {
Log.WriteLineIf(Verbose, LogPrefix + "{0} is out of date,
recompiling.", fileName);
return true;
}
//References Updated?
- fileName = FileSet.FindMoreRecentLastWriteTime(References.FileNames,
outputFileInfo.LastWriteTime);
+ fileName =
+References.FindMoreRecentLastWriteTime(outputFileInfo.LastWriteTime);
if (fileName != null) {
Log.WriteLineIf(Verbose, LogPrefix + "{0} is out of date,
recompiling.", fileName);
return true;
}
//Modules Updated?
- fileName = FileSet.FindMoreRecentLastWriteTime(Modules.FileNames,
outputFileInfo.LastWriteTime);
+ fileName =
+Modules.FindMoreRecentLastWriteTime(outputFileInfo.LastWriteTime);
if (fileName != null) {
Log.WriteLineIf(Verbose, LogPrefix + "{0} is out of date,
recompiling.", fileName);
return true;
}
//Resources Updated?
- fileName = FileSet.FindMoreRecentLastWriteTime(Resources.FileNames,
outputFileInfo.LastWriteTime);
+ fileName =
+Resources.FindMoreRecentLastWriteTime(outputFileInfo.LastWriteTime);
if (fileName != null) {
Log.WriteLineIf(Verbose, LogPrefix + "{0} is out of date,
recompiling.", fileName);
return true;
}
// check the args for /res or /resource options.
- StringCollection resourceFileNames = new StringCollection();
foreach (string arg in Args) {
if (arg.StartsWith("/res:") || arg.StartsWith("/resource:")) {
string path = arg.Substring(arg.IndexOf(':') + 1);
int indexOfComma = path.IndexOf(',');
if (indexOfComma != -1) {
path = path.Substring(0, indexOfComma);
}
- resourceFileNames.Add(path);
+ path=Path.Combine(BaseDirectory,path);
+ if
+(FileSet.IsMoreRecentLastWriteTime(path,outputFileInfo.LastWriteTime)) {
+ Log.WriteLineIf(Verbose, LogPrefix + "{0} is out of date,
+recompiling.", path);
+ return true;
}
}
- fileName = FileSet.FindMoreRecentLastWriteTime(resourceFileNames,
outputFileInfo.LastWriteTime);
- if (fileName != null) {
- Log.WriteLineIf(Verbose, LogPrefix + "{0} is out of date,
recompiling.", fileName);
- return true;
}
// if we made it here then we don't have to recompile
______________________________________________________________________________
Nová vůně HUGO BOSS a další světové kosmetické značky v největší české internetové
parfumerii.
http://www.email.cz/fann
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers