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

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

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

25
src/Tools/UpdateAssemblyInfo/Main.cs

@ -54,9 +54,8 @@ namespace UpdateAssemblyInfo @@ -54,9 +54,8 @@ namespace UpdateAssemblyInfo
Console.WriteLine("Working directory must be SharpDevelop\\src!");
return 2;
}
File.Copy(Path.Combine(subversionLibraryDir, "SharpSvn.dll"),
Path.Combine(exeDir, "SharpSvn.dll"),
true);
FileCopy(Path.Combine(subversionLibraryDir, "SharpSvn.dll"),
Path.Combine(exeDir, "SharpSvn.dll"));
RetrieveRevisionNumber();
string versionNumber = GetMajorVersion() + "." + revisionNumber;
UpdateStartup();
@ -69,6 +68,16 @@ namespace UpdateAssemblyInfo @@ -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()
{
string content;
@ -189,10 +198,12 @@ namespace UpdateAssemblyInfo @@ -189,10 +198,12 @@ namespace UpdateAssemblyInfo
// Change working dir so that the subversion libraries can be found
Environment.CurrentDirectory = Path.Combine(Environment.CurrentDirectory, subversionLibraryDir);
SvnWorkingCopyClient client = new SvnWorkingCopyClient();
SvnWorkingCopyVersion version;
if (client.GetVersion(oldWorkingDir, out version)) {
revisionNumber = version.Start.ToString(CultureInfo.InvariantCulture);
using (SvnClient client = new SvnClient()) {
client.Info(
oldWorkingDir,
(sender, info) => {
revisionNumber = info.Revision.ToString(CultureInfo.InvariantCulture);
});
}
} catch (Exception e) {
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 @@ -78,13 +78,23 @@ namespace UpdateSetupInfo
previousRevisionFolder = Path.Combine(setupProjectFolder, @"bin");
previousRevisionFileName = Path.Combine(previousRevisionFolder, "REVISION");
File.Copy(Path.Combine(Path.Combine(applicationFolder, subversionLibraryDir), "SharpSvn.dll"),
Path.Combine(applicationFolder, "SharpSvn.dll"), true);
FileCopy(Path.Combine(Path.Combine(applicationFolder, subversionLibraryDir), "SharpSvn.dll"),
Path.Combine(applicationFolder, "SharpSvn.dll"));
// Set current directory to a folder that is in the repository.
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)
{
try {
@ -164,10 +174,12 @@ namespace UpdateSetupInfo @@ -164,10 +174,12 @@ namespace UpdateSetupInfo
// Set working directory so msvcp70.dll and msvcr70.dll can be found
Environment.CurrentDirectory = Path.Combine(applicationFolder, subversionLibraryDir);
SvnWorkingCopyClient client = new SvnWorkingCopyClient();
SvnWorkingCopyVersion version;
if (client.GetVersion(oldWorkingDir, out version)) {
revisionNumber = version.Start.ToString(CultureInfo.InvariantCulture);
using (SvnClient client = new SvnClient()) {
client.Info(
oldWorkingDir,
(sender, info) => {
revisionNumber = info.Revision.ToString(CultureInfo.InvariantCulture);
});
}
} catch (Exception e) {
Console.WriteLine("Reading revision number with Svn.Net failed: " + e.ToString());

Loading…
Cancel
Save