Browse Source

Improved performance of UpdateAssemblyInfo.

Code-completion debug output: use Debug.WriteLine instead of Console.WriteLine.
Custom Tool project template: fixed compile error.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3963 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 17 years ago
parent
commit
2f86318fd8
  1. 4
      data/templates/project/CSharp/SharpDevelopCustomTool.xpt
  2. 3
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/MemberLookupHelper.cs
  3. 25
      src/Tools/UpdateAssemblyInfo/Main.cs
  4. BIN
      src/Tools/UpdateAssemblyInfo/bin/Debug/UpdateAssemblyInfo.exe
  5. 24
      src/Tools/UpdateSetupInfo/Main.cs

4
data/templates/project/CSharp/SharpDevelopCustomTool.xpt

@ -125,8 +125,8 @@ namespace ${StandardNamespace}
// This makes the generation code much more concise. // This makes the generation code much more concise.
// EasyCodeDom classes derive from the System.CodeDom types or have an implicit conversion operator, so // EasyCodeDom classes derive from the System.CodeDom types or have an implicit conversion operator, so
// use can use EasyCodeDom objects whereever CodeDom is expected. // use can use EasyCodeDom objects whereever CodeDom is expected.
EasyCompileUnit ccu = new EasyCompileUnit(); CodeCompileUnit ccu = new CodeCompileUnit();
EasyTypeDeclaration generatedClass = ccu.AddNamespace(targetNamespace).AddType(className); CodeTypeDeclaration generatedClass = ccu.AddNamespace(targetNamespace).AddType(className);
EasyMethod m = generatedClass.AddMethod("Create"); EasyMethod m = generatedClass.AddMethod("Create");
m.ReturnType = Easy.TypeRef(doc.DocumentElement.Name); m.ReturnType = Easy.TypeRef(doc.DocumentElement.Name);
m.Attributes = MemberAttributes.Static | MemberAttributes.Public; m.Attributes = MemberAttributes.Static | MemberAttributes.Public;

3
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/MemberLookupHelper.cs

@ -7,6 +7,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
namespace ICSharpCode.SharpDevelop.Dom namespace ICSharpCode.SharpDevelop.Dom
@ -873,7 +874,7 @@ namespace ICSharpCode.SharpDevelop.Dom
[System.Diagnostics.ConditionalAttribute("DEBUG")] [System.Diagnostics.ConditionalAttribute("DEBUG")]
internal static void Log(string text) internal static void Log(string text)
{ {
Console.WriteLine(text); Debug.WriteLine(text);
} }
[System.Diagnostics.ConditionalAttribute("DEBUG")] [System.Diagnostics.ConditionalAttribute("DEBUG")]

25
src/Tools/UpdateAssemblyInfo/Main.cs

@ -54,9 +54,8 @@ namespace UpdateAssemblyInfo
Console.WriteLine("Working directory must be SharpDevelop\\src!"); Console.WriteLine("Working directory must be SharpDevelop\\src!");
return 2; return 2;
} }
File.Copy(Path.Combine(subversionLibraryDir, "SharpSvn.dll"), FileCopy(Path.Combine(subversionLibraryDir, "SharpSvn.dll"),
Path.Combine(exeDir, "SharpSvn.dll"), Path.Combine(exeDir, "SharpSvn.dll"));
true);
RetrieveRevisionNumber(); RetrieveRevisionNumber();
string versionNumber = GetMajorVersion() + "." + revisionNumber; string versionNumber = GetMajorVersion() + "." + revisionNumber;
UpdateStartup(); UpdateStartup();
@ -69,6 +68,16 @@ namespace UpdateAssemblyInfo
} }
} }
static void FileCopy(string source, string target)
{
if (File.Exists(target)) {
// don't copy file if it is up-to-date: repeatedly copying a 3 MB file slows down the build
if (File.GetLastWriteTimeUtc(source) == File.GetLastWriteTimeUtc(target))
return;
}
File.Copy(source, target, true);
}
static void UpdateStartup() static void UpdateStartup()
{ {
string content; string content;
@ -189,10 +198,12 @@ namespace UpdateAssemblyInfo
// Change working dir so that the subversion libraries can be found // Change working dir so that the subversion libraries can be found
Environment.CurrentDirectory = Path.Combine(Environment.CurrentDirectory, subversionLibraryDir); Environment.CurrentDirectory = Path.Combine(Environment.CurrentDirectory, subversionLibraryDir);
SvnWorkingCopyClient client = new SvnWorkingCopyClient(); using (SvnClient client = new SvnClient()) {
SvnWorkingCopyVersion version; client.Info(
if (client.GetVersion(oldWorkingDir, out version)) { oldWorkingDir,
revisionNumber = version.Start.ToString(CultureInfo.InvariantCulture); (sender, info) => {
revisionNumber = info.Revision.ToString(CultureInfo.InvariantCulture);
});
} }
} catch (Exception e) { } catch (Exception e) {
Console.WriteLine("Reading revision number with SharpSvn failed: " + e.ToString()); Console.WriteLine("Reading revision number with SharpSvn failed: " + e.ToString());

BIN
src/Tools/UpdateAssemblyInfo/bin/Debug/UpdateAssemblyInfo.exe

Binary file not shown.

24
src/Tools/UpdateSetupInfo/Main.cs

@ -78,13 +78,23 @@ namespace UpdateSetupInfo
previousRevisionFolder = Path.Combine(setupProjectFolder, @"bin"); previousRevisionFolder = Path.Combine(setupProjectFolder, @"bin");
previousRevisionFileName = Path.Combine(previousRevisionFolder, "REVISION"); previousRevisionFileName = Path.Combine(previousRevisionFolder, "REVISION");
File.Copy(Path.Combine(Path.Combine(applicationFolder, subversionLibraryDir), "SharpSvn.dll"), FileCopy(Path.Combine(Path.Combine(applicationFolder, subversionLibraryDir), "SharpSvn.dll"),
Path.Combine(applicationFolder, "SharpSvn.dll"), true); Path.Combine(applicationFolder, "SharpSvn.dll"));
// Set current directory to a folder that is in the repository. // Set current directory to a folder that is in the repository.
Environment.CurrentDirectory = setupProjectFolder; Environment.CurrentDirectory = setupProjectFolder;
} }
static void FileCopy(string source, string target)
{
if (File.Exists(target)) {
// don't copy file if it is up-to-date: repeatedly copying a 3 MB file slows down the build
if (File.GetLastWriteTimeUtc(source) == File.GetLastWriteTimeUtc(target))
return;
}
File.Copy(source, target, true);
}
public static int Main(string[] args) public static int Main(string[] args)
{ {
try { try {
@ -164,10 +174,12 @@ namespace UpdateSetupInfo
// Set working directory so msvcp70.dll and msvcr70.dll can be found // Set working directory so msvcp70.dll and msvcr70.dll can be found
Environment.CurrentDirectory = Path.Combine(applicationFolder, subversionLibraryDir); Environment.CurrentDirectory = Path.Combine(applicationFolder, subversionLibraryDir);
SvnWorkingCopyClient client = new SvnWorkingCopyClient(); using (SvnClient client = new SvnClient()) {
SvnWorkingCopyVersion version; client.Info(
if (client.GetVersion(oldWorkingDir, out version)) { oldWorkingDir,
revisionNumber = version.Start.ToString(CultureInfo.InvariantCulture); (sender, info) => {
revisionNumber = info.Revision.ToString(CultureInfo.InvariantCulture);
});
} }
} catch (Exception e) { } catch (Exception e) {
Console.WriteLine("Reading revision number with Svn.Net failed: " + e.ToString()); Console.WriteLine("Reading revision number with Svn.Net failed: " + e.ToString());

Loading…
Cancel
Save