diff options
Diffstat (limited to 'Software/Visual_Studio/VSIX/Tango.BuildExtensions/TangoBuildCommand.cs')
| -rw-r--r-- | Software/Visual_Studio/VSIX/Tango.BuildExtensions/TangoBuildCommand.cs | 83 |
1 files changed, 56 insertions, 27 deletions
diff --git a/Software/Visual_Studio/VSIX/Tango.BuildExtensions/TangoBuildCommand.cs b/Software/Visual_Studio/VSIX/Tango.BuildExtensions/TangoBuildCommand.cs index 9de557117..624124ef2 100644 --- a/Software/Visual_Studio/VSIX/Tango.BuildExtensions/TangoBuildCommand.cs +++ b/Software/Visual_Studio/VSIX/Tango.BuildExtensions/TangoBuildCommand.cs @@ -41,6 +41,7 @@ namespace Tango.BuildExtensions private const String pmrGeneratorProjectName = "Tango.PMRGenerator.CLI"; private const String pmrProjectName = "Tango.PMR"; private const String protoCliProjectName = "Tango.Protobuf.CLI"; + private const String sqliteProjectName = "Tango.SQLiteGenerator.CLI"; #region Redundant @@ -143,7 +144,7 @@ namespace Tango.BuildExtensions _application = TestStack.White.Application.Attach(_vsProcess); _window = _application.GetWindow(vsWindowTitle); - OpenProgressForm(); + OpenVSProgress("Tango Build Engine", "Initializing...", true); try { @@ -163,18 +164,22 @@ namespace Tango.BuildExtensions { UpdateAndBuildPmrMessages(); } + if (buildForm.GenerateSQLite) + { + GenerateSQLite(); + } if (buildForm.BuildSolution) { BuildSolution(); } - SetProgressText("Done!"); + SetVSProgress("Done!"); Wait(1000); - CloseProgressForm(); + CloseVSProgress(); } catch (Exception ex) { - CloseProgressForm(); + CloseVSProgress(); ShowMessage(ex.Message); } }); @@ -191,7 +196,7 @@ namespace Tango.BuildExtensions var projectItems = project.ProjectItems.OfType<ProjectItem>().ToList(); - SetProgressText("Locating " + edmxModelName + " scheme..."); + SetVSProgress("Locating " + edmxModelName + " scheme..."); var items = GetProjectItems(project); @@ -202,20 +207,20 @@ namespace Tango.BuildExtensions throw new NullReferenceException("Could not locate " + edmxModelName + "!"); } - SetProgressText("Expanding diagram..."); + SetVSProgress("Expanding diagram..."); edmx.ExpandView(); - SetProgressText("Opening edmx diagram window..."); + SetVSProgress("Opening EDMX diagram window..."); Window win = edmx.Open(EnvDTE.Constants.vsViewKindPrimary); win.Visible = true; - SetProgressText("Waiting for edmx diagram window..."); + SetVSProgress("Waiting for EDMX diagram window..."); _window.WaitTill(() => _window.Get(SearchCriteria.ByText(edmxModelName + " [Diagram1]")) != null); - SetProgressText("Cleaning up edmx scheme..."); + SetVSProgress("Cleaning up EDMX scheme..."); DTE.MainWindow.Activate(); DTE.ExecuteCommand("Edit.SelectAll"); @@ -225,7 +230,7 @@ namespace Tango.BuildExtensions _window.WaitWhileBusy(); - SetProgressText("Reinitializing edmx scheme..."); + SetVSProgress("Reinitializing EDMX scheme..."); var window = WindowInfo.GetWindow(edmxModelName + " [Diagram1]*"); window.SetActive(); @@ -256,13 +261,13 @@ namespace Tango.BuildExtensions updateWindow.PressKey(KeyboardInput.SpecialKeys.RETURN); - SetProgressText("Generating edmx scheme..."); + SetVSProgress("Generating EDMX scheme..."); WaitForWindowClose("Update Wizard"); _window.WaitWhileBusy(); - SetProgressText("Saving changes..."); + SetVSProgress("Saving changes..."); win.Close(vsSaveChanges.vsSaveChangesYes); @@ -270,14 +275,14 @@ namespace Tango.BuildExtensions foreach (var template in edmx.ProjectItems.OfType<ProjectItem>().Where(x => x.Name.EndsWith(".tt"))) { - SetProgressText("Running custom tool for " + template.Name + "..."); + SetVSProgress("Running custom tool for " + template.Name + "..."); (template.Object as VSProjectItem).RunCustomTool(); _window.WaitWhileBusy(); } _window.WaitWhileBusy(); - SetProgressText("Building project " + dalProjectName + "..."); + SetVSProgress("Building project " + dalProjectName + "..."); DTE.Solution.SolutionBuild.BuildProject("Debug", project.FullName, true); @@ -296,13 +301,13 @@ namespace Tango.BuildExtensions throw new NullReferenceException("Could not locate project " + observablesGeneratorProjectName); } - SetProgressText("Building project " + observablesGeneratorProjectName + "..."); + SetVSProgress("Building project " + observablesGeneratorProjectName + "..."); DTE.Solution.SolutionBuild.BuildProject("Debug", project.FullName, true); DTE.Solution.Properties.Item("StartupProject").Value = observablesGeneratorProjectName; - SetProgressText("Executing observables generator..."); + SetVSProgress("Executing observables generator..."); DTE.ExecuteCommand("Debug.Start"); @@ -317,7 +322,7 @@ namespace Tango.BuildExtensions throw new NullReferenceException("Could not locate project " + observablesProjectName); } - SetProgressText("Updating " + observablesProjectName + "..."); + SetVSProgress("Updating " + observablesProjectName + "..."); foreach (var file in Directory.GetFiles(Path.GetDirectoryName(observablesProject.FileName), "*.cs", SearchOption.AllDirectories)) { @@ -325,13 +330,13 @@ namespace Tango.BuildExtensions if (parentFolderName != "Debug" && parentFolderName != "Release" && parentFolderName != "obj") { - SetProgressText("Adding/Updating file " + Path.GetFileName(file) + "..."); + SetVSProgress("Adding/Updating file " + Path.GetFileName(file) + "..."); observablesProject.ProjectItems.AddFromFile(file); Wait(10); } } - SetProgressText("Building project " + observablesProjectName + "..."); + SetVSProgress("Building project " + observablesProjectName + "..."); DTE.Solution.SolutionBuild.BuildProject("Debug", observablesProject.FullName, true); @@ -350,13 +355,13 @@ namespace Tango.BuildExtensions throw new NullReferenceException("Could not locate project " + pmrGeneratorProjectName); } - SetProgressText("Building project " + pmrGeneratorProjectName + "..."); + SetVSProgress("Building project " + pmrGeneratorProjectName + "..."); DTE.Solution.SolutionBuild.BuildProject("Debug", project.FullName, true); DTE.Solution.Properties.Item("StartupProject").Value = pmrGeneratorProjectName; - SetProgressText("Executing PMR generator..."); + SetVSProgress("Executing PMR generator..."); DTE.ExecuteCommand("Debug.Start"); @@ -374,7 +379,7 @@ namespace Tango.BuildExtensions throw new NullReferenceException("Could not locate project " + protoCliProjectName); } - SetProgressText("Building project " + protoCliProjectName + "..."); + SetVSProgress("Building project " + protoCliProjectName + "..."); DTE.Solution.SolutionBuild.BuildProject("Debug", protoProject.FullName, true); @@ -385,7 +390,7 @@ namespace Tango.BuildExtensions DTE.Solution.Properties.Item("StartupProject").Value = protoCliProjectName; - SetProgressText("Executing Tango Proto Compiler..."); + SetVSProgress("Executing Tango Proto Compiler..."); DTE.ExecuteCommand("Debug.Start"); @@ -401,7 +406,7 @@ namespace Tango.BuildExtensions throw new NullReferenceException("Could not locate project " + pmrProjectName); } - SetProgressText("Updating " + pmrProjectName + "..."); + SetVSProgress("Updating " + pmrProjectName + "..."); foreach (var file in Directory.GetFiles(Path.GetDirectoryName(project.FileName), "*.cs", SearchOption.AllDirectories)) { @@ -409,13 +414,13 @@ namespace Tango.BuildExtensions if (parentFolderName != "Debug" && parentFolderName != "Release" && parentFolderName != "obj") { - SetProgressText("Adding/Updating file " + Path.GetFileName(file) + "..."); + SetVSProgress("Adding/Updating file " + Path.GetFileName(file) + "..."); project.ProjectItems.AddFromFile(file); Wait(10); } } - SetProgressText("Building project " + pmrProjectName + "..."); + SetVSProgress("Building project " + pmrProjectName + "..."); DTE.Solution.SolutionBuild.BuildProject("Debug", project.FullName, true); @@ -425,9 +430,33 @@ namespace Tango.BuildExtensions } } + private void GenerateSQLite() + { + var project = _projects.SingleOrDefault(x => x.Name == sqliteProjectName); + + if (project == null) + { + throw new NullReferenceException("Could not locate project " + sqliteProjectName); + } + + SetVSProgress("Building project " + sqliteProjectName + "..."); + + DTE.Solution.SolutionBuild.BuildProject("Debug", project.FullName, true); + + DTE.Solution.Properties.Item("StartupProject").Value = sqliteProjectName; + + SetVSProgress("Executing SQLite generator..."); + + DTE.ExecuteCommand("Debug.Start"); + + WaitForWindowOpen("Tango SQLite Generator"); + + WaitForWindowClose("Tango SQLite Generator"); + } + private void BuildSolution() { - SetProgressText("Building solution..."); + SetVSProgress("Building solution..."); DTE.Solution.SolutionBuild.Build(true); if (DTE.Solution.SolutionBuild.LastBuildInfo > 0) |
