104 lines
4.2 KiB
C#
104 lines
4.2 KiB
C#
using System.ComponentModel;
|
|
using System.IO;
|
|
using TeaBox.Code;
|
|
using TeaBox.Macros;
|
|
|
|
|
|
namespace TeaBox.Build.Code
|
|
{
|
|
[Module(Icon = "build")]
|
|
[DisplayName("Build (Code)")]
|
|
public static class SwitchToSourceMacros
|
|
{
|
|
[Macro(Icon = "build"), DisplayName("Switch packages in solution...")]
|
|
public static void SwitchPackagesInSolution(IExecutionContext context,
|
|
[Description("Path of the solution to switch")]
|
|
string solutionFile,
|
|
[Description("Name of packages to switch, separated with commas.")]
|
|
string packages
|
|
)
|
|
{
|
|
if (!File.Exists(solutionFile))
|
|
{
|
|
context.LogError("Please provide a valid solution file");
|
|
return;
|
|
}
|
|
|
|
if (string.IsNullOrEmpty(packages))
|
|
{
|
|
context.LogError("Please provide valid package names");
|
|
return;
|
|
}
|
|
|
|
var command = new SwitchToSourceCommand
|
|
{
|
|
Solution = solutionFile,
|
|
Packages = packages.Split(',')
|
|
};
|
|
command.Execute(context);
|
|
}
|
|
|
|
[Macro(Icon = "build"), DisplayName("Switch packages in tools solution")]
|
|
public static void SwitchPackagesInToolsSolution(IExecutionContext context,
|
|
[DefaultValue(SwitchToSourceCommand.GitFolderStructure.Nested), Category("Advanced"), Description("folder structure of the git cloned projects")]
|
|
SwitchToSourceCommand.GitFolderStructure folderStructure,
|
|
[DefaultValue(true), Description("Do not checkout the tag that match the version of the NuGet package after cloning a repository")] bool noCheckout,
|
|
[Description("Location of the cloned project references")] string clonePath,
|
|
[DefaultValue(true), Category("Advanced"), Description("Switch package only even if another package has a dependency on it")] bool doNotSearchDependentPackages,
|
|
[DefaultValue(true), Category("Advanced"), Description("Switch package and dependencies only")] bool requiredProjectsOnly,
|
|
[DefaultValue(true), Category("Advanced"), Description("Add projects to the solution even if there are no dependencies")] bool skipDependencyCheck,
|
|
[DefaultValue(true), Category("Advanced"), Description("Clean .suo file")] bool cleanSolutionUserFile
|
|
)
|
|
{
|
|
var command = new SwitchToSourceCommand
|
|
{
|
|
Solution = UAFConstants.GetToolsSolution(VisualStudioVersion.vs2017),
|
|
Packages = new []
|
|
{
|
|
// framework
|
|
"Plume.Core",
|
|
"Plume.Icons",
|
|
"Plume.WPF",
|
|
"Plume.Interfaces",
|
|
"Plume.Interfaces.Console",
|
|
"Plume.Interfaces.WPF",
|
|
"Plume.Application",
|
|
"Plume.Application.Console",
|
|
"Plume.Application.Wpf",
|
|
|
|
// services
|
|
"Plume.Bloomberg.Service",
|
|
"Plume.Perforce.Service",
|
|
|
|
// modules
|
|
"Plume.CrashReporter",
|
|
"Plume.ErrorList",
|
|
"Plume.Feedback",
|
|
"Plume.ImageViewer",
|
|
"Plume.Output",
|
|
"Plume.Perforce",
|
|
"Plume.Properties",
|
|
"Plume.TextEditor",
|
|
},
|
|
|
|
FolderStructure = folderStructure,
|
|
DoNotSearchDependentPackages = doNotSearchDependentPackages,
|
|
RequiredProjectsOnly = requiredProjectsOnly,
|
|
SkipDependencyCheck = skipDependencyCheck,
|
|
NoCheckout = noCheckout,
|
|
};
|
|
if (!string.IsNullOrEmpty(clonePath))
|
|
{
|
|
command.ClonePath = clonePath;
|
|
}
|
|
|
|
command.Execute(context);
|
|
|
|
var suoFile = Path.Combine(UAFConstants.ToolsFolder, ".vs", "Tools.main.2017", "v15", ".suo");
|
|
if (File.Exists(suoFile) && cleanSolutionUserFile)
|
|
{
|
|
File.Delete(suoFile);
|
|
}
|
|
}
|
|
}
|
|
}
|