Permalink
Browse files

First refactoring round to enable custom option (per visitor) to be used

  • Loading branch information...
1 parent 08f2e15 commit 6e077493830495cb88560abe1363b24249f59cf7 @gimmemoore gimmemoore committed May 18, 2012
@@ -75,7 +75,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
- <Compile Include="Options.cs" />
+ <Compile Include="MsBuilderificCoreOptions.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
@@ -9,7 +9,7 @@ namespace MsBuilderific.Console
/// <summary>
/// Command line switches which can be used by the program
/// </summary>
- internal class Options : IMsBuilderificOptions
+ internal class MsBuilderificCoreOptions : IMsBuilderificCoreOptions
{
#region Public Properties
@@ -12,7 +12,7 @@ class Program
{
static void Main(string[] args)
{
- var options = new Options();
+ var options = new MsBuilderificCoreOptions();
if (args != null && args.Length>0)
{
@@ -8,14 +8,14 @@ namespace MsBuilderific.Contracts.Extensions
/// </summary>
public static class VisualStudioProjectExtensions
{
- public static string GetRelativeFilePath(this VisualStudioProject project, IMsBuilderificOptions options)
+ public static string GetRelativeFilePath(this VisualStudioProject project, IMsBuilderificCoreOptions coreOptions)
{
if (project == null)
throw new ArgumentNullException("project", "The project cannot be null");
if (!String.IsNullOrEmpty(project.Path))
{
- var folder = GetRelativeFolderPath(project, options);
+ var folder = GetRelativeFolderPath(project, coreOptions);
if (!String.IsNullOrEmpty(folder))
return Path.Combine(folder, Path.GetFileName(project.Path));
@@ -25,19 +25,19 @@ public static string GetRelativeFilePath(this VisualStudioProject project, IMsBu
throw new ArgumentException("The project path is empty or null");
}
- public static string GetRelativeFolderPath(this VisualStudioProject project, IMsBuilderificOptions options)
+ public static string GetRelativeFolderPath(this VisualStudioProject project, IMsBuilderificCoreOptions coreOptions)
{
if (project == null)
throw new ArgumentNullException("project", "The project cannot be null");
- if (options == null)
- throw new ArgumentNullException("options", "The options are mandatory to get the relative file path");
+ if (coreOptions == null)
+ throw new ArgumentNullException("coreOptions", "The coreOptions are mandatory to get the relative file path");
var folder = Directory.GetParent(project.Path).FullName;
- if (!string.IsNullOrEmpty(options.RelativeToPath))
+ if (!string.IsNullOrEmpty(coreOptions.RelativeToPath))
{
- var relativePath = Directory.GetParent(project.Path).FullName.Replace(options.RelativeToPath, "");
+ var relativePath = Directory.GetParent(project.Path).FullName.Replace(coreOptions.RelativeToPath, "");
while (relativePath.StartsWith("\\"))
relativePath = relativePath.Substring(1);
folder = relativePath;
@@ -23,7 +23,7 @@ public interface IMsBuildFileCore
/// <param name="dependencyOrder">
/// The order in which the MsBuildScript shall be generated
/// </param>
- /// <param name="options">The options that will be passed to the visitors</param>
- void WriteBuildScript(List<VisualStudioProject> dependencyOrder, IMsBuilderificOptions options);
+ /// <param name="coreOptions">The coreOptions that will be passed to the visitors</param>
+ void WriteBuildScript(List<VisualStudioProject> dependencyOrder, IMsBuilderificCoreOptions coreOptions);
}
}
@@ -0,0 +1,83 @@
+using System;
+using System.Collections.Generic;
+
+namespace MsBuilderific.Contracts
+{
+ public interface IMsBuilderificCoreOptions : IMsBuilderificOptions
+ {
+ /// <summary>
+ /// Gets or sets the build output path
+ /// </summary>
+ String OutputPath { get; }
+
+ /// <summary>
+ /// Gets or sets the list of configuration that will be used to perform web.config transformations when building in release mode
+ /// </summary>
+ List<String> Transforms { get; }
+
+ /// <summary>
+ /// Gets or sets the list of file/folder exclusions that will be excluded from the dependency detection and build file generation process
+ /// </summary>
+ List<String> ExclusionPatterns { get; }
+
+ /// <summary>
+ /// Gets or sets the root folder from which the tool will scan for projects
+ /// </summary>
+ String RootFolder { get; }
+
+ /// <summary>
+ /// Gets or sets a filename where the dependecy graph of your projetcs will be saved or nothing if you do not which to generate the .graphml file
+ /// </summary>
+ String GraphFilename { get; }
+
+ /// <summary>
+ /// Gets or sets the path used by MsBuilderific to create relative build/copy paths
+ /// </summary>
+ String RelativeToPath { get; }
+
+ /// <summary>
+ /// Gets or sets the build output file
+ /// </summary>
+ String OutputFile { get; }
+
+ /// <summary>
+ /// Gets or sets the directory where projects output (.dll, .exe, .config, .pdb, .xml) will be copied, or nothing to ingnore this
+ /// </summary>
+ String CopyOutputTo { get; }
+
+ /// <summary>
+ /// Gets or sets a value indicating if we generate msbuild packages
+ /// </summary>
+ bool GeneratePackagesOnBuild { get; }
+
+ /// <summary>
+ /// Gets or sets a value indicating if we generate specific build/rebuild/clean targets for web projects
+ /// </summary>
+ bool GenerateSpecificTargetForWebProject { get; }
+
+ /// <summary>
+ /// Gets or sets a value indicating if MsBuilderific should look for .csproj
+ /// </summary>
+ bool CSharpSupport { get; }
+
+ /// <summary>
+ /// Gets or sets a value indicating if MsBuilderific should look for .vbproj
+ /// </summary>
+ bool VbNetSupport { get;}
+
+ /// <summary>
+ /// Gets or sets a value indicating if copy pdb to the output location
+ /// </summary>
+ bool CopyPdbs { get;}
+
+ /// <summary>
+ /// Gets or sets a value indicating if we add MsTest task in the resulting msbuild file
+ /// </summary>
+ bool GenerateMsTestTask { get; }
+
+ /// <summary>
+ /// Gets or sets the regex used to discover mstests assemblies
+ /// </summary>
+ String TestDiscoveryPattern { get; }
+ }
+}
@@ -1,83 +1,6 @@
-using System;
-using System.Collections.Generic;
-
-namespace MsBuilderific.Contracts
+namespace MsBuilderific.Contracts
{
public interface IMsBuilderificOptions
{
- /// <summary>
- /// Gets or sets the build output path
- /// </summary>
- String OutputPath { get; }
-
- /// <summary>
- /// Gets or sets the list of configuration that will be used to perform web.config transformations when building in release mode
- /// </summary>
- List<String> Transforms { get; }
-
- /// <summary>
- /// Gets or sets the list of file/folder exclusions that will be excluded from the dependency detection and build file generation process
- /// </summary>
- List<String> ExclusionPatterns { get; }
-
- /// <summary>
- /// Gets or sets the root folder from which the tool will scan for projects
- /// </summary>
- String RootFolder { get; }
-
- /// <summary>
- /// Gets or sets a filename where the dependecy graph of your projetcs will be saved or nothing if you do not which to generate the .graphml file
- /// </summary>
- String GraphFilename { get; }
-
- /// <summary>
- /// Gets or sets the path used by MsBuilderific to create relative build/copy paths
- /// </summary>
- String RelativeToPath { get; }
-
- /// <summary>
- /// Gets or sets the build output file
- /// </summary>
- String OutputFile { get; }
-
- /// <summary>
- /// Gets or sets the directory where projects output (.dll, .exe, .config, .pdb, .xml) will be copied, or nothing to ingnore this
- /// </summary>
- String CopyOutputTo { get; }
-
- /// <summary>
- /// Gets or sets a value indicating if we generate msbuild packages
- /// </summary>
- bool GeneratePackagesOnBuild { get; }
-
- /// <summary>
- /// Gets or sets a value indicating if we generate specific build/rebuild/clean targets for web projects
- /// </summary>
- bool GenerateSpecificTargetForWebProject { get; }
-
- /// <summary>
- /// Gets or sets a value indicating if MsBuilderific should look for .csproj
- /// </summary>
- bool CSharpSupport { get; }
-
- /// <summary>
- /// Gets or sets a value indicating if MsBuilderific should look for .vbproj
- /// </summary>
- bool VbNetSupport { get;}
-
- /// <summary>
- /// Gets or sets a value indicating if copy pdb to the output location
- /// </summary>
- bool CopyPdbs { get;}
-
- /// <summary>
- /// Gets or sets a value indicating if we add MsTest task in the resulting msbuild file
- /// </summary>
- bool GenerateMsTestTask { get; }
-
- /// <summary>
- /// Gets or sets the regex used to discover mstests assemblies
- /// </summary>
- String TestDiscoveryPattern { get; }
}
}
@@ -24,13 +24,13 @@ public interface IProjectDependencyFinder
/// <summary>
/// Build the dependency graph between the projects in the root folder and optionnaly save the graph in a GraphML file
/// </summary>
- /// <param name="options">
- /// The options used to get the dependency order of the projects
+ /// <param name="coreOptions">
+ /// The coreOptions used to get the dependency order of the projects
/// </param>
/// <returns>
/// The list of <see cref="VisualStudioProject"/> in the correct build order
/// </returns>
- List<VisualStudioProject> GetDependencyOrder(IMsBuilderificOptions options);
+ List<VisualStudioProject> GetDependencyOrder(IMsBuilderificCoreOptions coreOptions);
/// <summary>
/// Process the graph to generate the correct project build order
@@ -46,13 +46,13 @@ public interface IProjectDependencyFinder
/// <summary>
/// Build the dependency graph from the projects found in the root folder - the exlusion patterns
/// </summary>
- /// <param name="options">
- /// The options used to get the dependency order of the projects
+ /// <param name="coreOptions">
+ /// The coreOptions used to get the dependency order of the projects
/// </param>
/// <returns>
/// A graph representing the dependencies between the projects in the root folder
/// </returns>
- AdjacencyGraph<VisualStudioProject, Edge<VisualStudioProject>> GetDependencyGraph(IMsBuilderificOptions options);
+ AdjacencyGraph<VisualStudioProject, Edge<VisualStudioProject>> GetDependencyGraph(IMsBuilderificCoreOptions coreOptions);
/// <summary>
/// Saves the graph in the GraphML format in the specified filename
@@ -52,6 +52,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="IMsBuilderificCoreOptions.cs" />
<Compile Include="IMsBuilderificOptions.cs" />
<Compile Include="IMsBuildFileCore.cs" />
<Compile Include="IProjectDependencyFinder.cs" />
@@ -2,69 +2,69 @@
{
public abstract class BuildOrderVisitor : IBuildOrderVisitor
{
- public virtual string PreVisitBuildTarget(VisualStudioProject project, IMsBuilderificOptions options)
+ public virtual string PreVisitBuildTarget(VisualStudioProject project, IMsBuilderificCoreOptions coreOptions)
{
return null;
}
- public virtual string VisitBuildAllTypeTarget(VisualStudioProject project, IMsBuilderificOptions options)
+ public virtual string VisitBuildAllTypeTarget(VisualStudioProject project, IMsBuilderificCoreOptions coreOptions)
{
return null;
}
- public virtual string VisitBuildLibraryProjectTarget(VisualStudioProject project, IMsBuilderificOptions options)
+ public virtual string VisitBuildLibraryProjectTarget(VisualStudioProject project, IMsBuilderificCoreOptions coreOptions)
{
return null;
}
- public virtual string VisitBuildWebProjectTarget(VisualStudioProject project, IMsBuilderificOptions options)
+ public virtual string VisitBuildWebProjectTarget(VisualStudioProject project, IMsBuilderificCoreOptions coreOptions)
{
return null;
}
- public virtual string VisitBuildExeProjectTarget(VisualStudioProject project, IMsBuilderificOptions options)
+ public virtual string VisitBuildExeProjectTarget(VisualStudioProject project, IMsBuilderificCoreOptions coreOptions)
{
return null;
}
- public virtual string PostVisitBuildTarget(VisualStudioProject project, IMsBuilderificOptions options)
+ public virtual string PostVisitBuildTarget(VisualStudioProject project, IMsBuilderificCoreOptions coreOptions)
{
return null;
}
- public virtual string PreVisitServiceTarget(VisualStudioProject project, IMsBuilderificOptions options)
+ public virtual string PreVisitServiceTarget(VisualStudioProject project, IMsBuilderificCoreOptions coreOptions)
{
return null;
}
- public virtual string VisitServiceTarget(VisualStudioProject project, IMsBuilderificOptions options)
+ public virtual string VisitServiceTarget(VisualStudioProject project, IMsBuilderificCoreOptions coreOptions)
{
return null;
}
- public virtual string PostVisitServiceTarget(VisualStudioProject project, IMsBuilderificOptions options)
+ public virtual string PostVisitServiceTarget(VisualStudioProject project, IMsBuilderificCoreOptions coreOptions)
{
return null;
}
- public virtual string PreVisitCleanTarget(VisualStudioProject project, IMsBuilderificOptions options)
+ public virtual string PreVisitCleanTarget(VisualStudioProject project, IMsBuilderificCoreOptions coreOptions)
{
return null;
}
- public virtual string VisitCleanTarget(VisualStudioProject project, IMsBuilderificOptions options)
+ public virtual string VisitCleanTarget(VisualStudioProject project, IMsBuilderificCoreOptions coreOptions)
{
return null;
}
- public virtual string PostVisitCleanTarget(VisualStudioProject project, IMsBuilderificOptions options)
+ public virtual string PostVisitCleanTarget(VisualStudioProject project, IMsBuilderificCoreOptions coreOptions)
{
return null;
}
public int Order { get; set; }
- public virtual bool ShallExecute(IMsBuilderificOptions options)
+ public virtual bool ShallExecute(IMsBuilderificCoreOptions coreOptions)
{
return true;
}
Oops, something went wrong.

0 comments on commit 6e07749

Please sign in to comment.