Permalink
Browse files

.NET 2.0

darcs-hash:20090223102658-f251f-1262d8860623ed18544243d09c4e79606680a490.gz
  • Loading branch information...
1 parent 8ac28d7 commit f07e48d7c7d738eab923c507d34c818dd371d29f @bodewig committed Feb 23, 2009
Showing with 16 additions and 20 deletions.
  1. +14 −16 AntTask/AntTask.cs
  2. +2 −4 AntTask/Properties/AssemblyInfo.cs
View
@@ -30,8 +30,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
-using System.Collections;
-using System.Collections.Specialized;
+using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
@@ -43,7 +42,6 @@
#if NANT
using NAnt.Core;
using NAnt.Core.Attributes;
-using NAnt.Core.Tasks;
#endif
namespace de.samaflost.AntTask {
@@ -73,7 +71,7 @@ public BaseAnt()
#region task attributes
#region the build file
- private static readonly string DEFAULT_BUILD_FILE = "build.xml";
+ private const string DEFAULT_BUILD_FILE = "build.xml";
private string buildFile = DEFAULT_BUILD_FILE;
@@ -94,15 +92,15 @@ public BaseAnt()
#endregion
#region targets to execute
- private ArrayList targetNames = new ArrayList();
+ private readonly List<string> targetNames = new List<string>();
/// <summary>
/// The target(s) to execute
/// </summary>
/// <remarks>This setter will only be used by MSBuild</remarks>
public string AntTargets {
get {
- return string.Join(",", (string[]) targetNames.ToArray(typeof(string)));
+ return string.Join(",", targetNames.ToArray());
}
set {
foreach (string t in value.Split(',')) {
@@ -126,7 +124,7 @@ public BaseAnt()
AntTarget[] r = new AntTarget[targetNames.Count];
for (int i = 0; i < r.Length; i++) {
r[i] = new AntTarget();
- r[i].TargetName = targetNames[i] as string;
+ r[i].TargetName = targetNames[i];
}
return r;
}
@@ -135,7 +133,7 @@ public BaseAnt()
#endregion
#region properties to set
- private StringDictionary propertyTable = new StringDictionary();
+ private readonly IDictionary<string, string> propertyTable = new Dictionary<string, string>();
/// <summary>
/// The properties(s) to define
@@ -221,7 +219,7 @@ public BaseAnt()
#endif
public string AntHome {
get {
- return antHome == null ? Environment.GetEnvironmentVariable("ANT_HOME") : antHome;
+ return antHome ?? Environment.GetEnvironmentVariable("ANT_HOME");
}
set {
antHome = value;
@@ -240,7 +238,7 @@ public BaseAnt()
#endif
public string JavaHome {
get {
- return javaHome == null ? Environment.GetEnvironmentVariable("JAVA_HOME") : javaHome;
+ return javaHome ?? Environment.GetEnvironmentVariable("JAVA_HOME");
}
set {
javaHome = value;
@@ -251,7 +249,7 @@ public BaseAnt()
#endregion
#region personality checks
- private BuildTool currentBuildTool;
+ private readonly BuildTool currentBuildTool;
protected bool RunningInMSBuild {
get {
return currentBuildTool == BuildTool.MSBuild;
@@ -333,7 +331,7 @@ public BaseAnt()
#region support stuff
private static readonly string HELP_KEYWORD = string.Empty;
- private static readonly string MESSAGE_SENDER = "ant task";
+ private const string MESSAGE_SENDER = "ant task";
private void GenericMSBuildLog(string message, MessageImportance i) {
BuildEngine.LogMessageEvent(new BuildMessageEventArgs(message, HELP_KEYWORD, MESSAGE_SENDER, i));
@@ -368,7 +366,7 @@ public BaseAnt()
Warn(string.Format("Can't determine ANT_HOME, please set the {0} attribute or the ANT_HOME environment variable", RunningInMSBuild ? "AntHome" : "antHome"));
return false;
}
- FileInfo antLauncherJar = new FileInfo(Path.Combine(AntHome, "lib" + Path.DirectorySeparatorChar + "ant-launcher.jar"));
+ FileInfo antLauncherJar = new FileInfo(Path.Combine(Path.Combine(AntHome, "lib"), "ant-launcher.jar"));
if (!antLauncherJar.Exists) {
Warn(string.Format("'{0}' calculated from ANT_HOME '{1}' doesn't exist", antLauncherJar.FullName, AntHome));
return false;
@@ -387,19 +385,19 @@ public BaseAnt()
if (JavaHome != null) {
if (!isDos) {
// AIX likes to hide IBM's JDK in strange places
- FileInfo fi = new FileInfo(Path.Combine(JavaHome, "jre" + Path.DirectorySeparatorChar + "sh" + Path.DirectorySeparatorChar + "java"));
+ FileInfo fi = new FileInfo(Path.Combine(Path.Combine(Path.Combine(JavaHome, "jre"), "sh"), "java"));
if (fi.Exists) {
java = fi.FullName;
}
else {
- fi = new FileInfo(Path.Combine(JavaHome, "bin" + Path.DirectorySeparatorChar + "java"));
+ fi = new FileInfo(Path.Combine(Path.Combine(JavaHome, "bin"), "java"));
if (fi.Exists) {
java = fi.FullName;
}
}
}
else {
- FileInfo fi = new FileInfo(Path.Combine(JavaHome, "bin" + Path.DirectorySeparatorChar + "java.exe"));
+ FileInfo fi = new FileInfo(Path.Combine(Path.Combine(JavaHome, "bin"), "java.exe"));
if (fi.Exists) {
java = fi.FullName;
}
@@ -1,5 +1,4 @@
using System.Reflection;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
@@ -27,6 +26,5 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyFileVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.1.*")]
+[assembly: AssemblyFileVersion("1.0.1.0")]

0 comments on commit f07e48d

Please sign in to comment.