-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Another attempt at #23 * Generate pre- and post-deploy scripts using SqlTools BatchParser (#23) * Use reflection to accurately set _currentFilePath (#23) * Check included files for incremental builds (#23) * Checkout submodules in the CI pipeline * Remove ugly hack * Remove _currentFilePath entirely * Test post-deployment script includes * Resolve comments from PR review * Resolve comments from PR review * Compile individual files from ManagedBatchParser * Refactor ModelValidationError and add an overload constructor * Fix LogicalName for ManagedBatchParser localization resources * Resolve comments from PR review Co-authored-by: Jonathan Mezach <jonathan.mezach@rr-wfm.com> Co-authored-by: Rosenberg, Jeff <jeff.rosenberg@icfnext.com>
- Loading branch information
1 parent
53ef3fb
commit 01929bd
Showing
37 changed files
with
615 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "sqltoolsservice"] | ||
path = sqltoolsservice | ||
url = https://github.com/microsoft/sqltoolsservice.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System.IO; | ||
using Microsoft.SqlServer.Dac.Model; | ||
|
||
namespace MSBuild.Sdk.SqlProj.DacpacTool | ||
{ | ||
public abstract class BaseOptions | ||
{ | ||
public bool Debug { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using Microsoft.SqlTools.ServiceLayer.BatchParser; | ||
using Microsoft.SqlTools.ServiceLayer.BatchParser.ExecutionEngineCode; | ||
|
||
namespace MSBuild.Sdk.SqlProj.DacpacTool | ||
{ | ||
// This was just copied from Microsoft.SqlTools.ManagedBatchParser.UnitTests.BatchParser.TestVariableResolver | ||
// No special functionality needed for our project | ||
internal sealed class IncludeVariableResolver : IVariableResolver | ||
{ | ||
private StringBuilder outputString; | ||
private BatchParserSqlCmd batchParserSqlCmd; | ||
|
||
public IncludeVariableResolver() | ||
{ | ||
this.outputString = new StringBuilder(); | ||
batchParserSqlCmd = new BatchParserSqlCmd(); | ||
} | ||
|
||
public string GetVariable(PositionStruct pos, string name) | ||
{ | ||
return batchParserSqlCmd.GetVariable(pos, name); | ||
} | ||
|
||
public void SetVariable(PositionStruct pos, string name, string value) | ||
{ | ||
outputString.AppendFormat("Setting variable {0} to [{1}]\n", name, value); | ||
batchParserSqlCmd.SetVariable(pos, name, value); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System.IO; | ||
|
||
namespace MSBuild.Sdk.SqlProj.DacpacTool | ||
{ | ||
public class InspectOptions : BaseOptions | ||
{ | ||
public FileInfo PreDeploy { get; set; } | ||
public FileInfo PostDeploy { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using System.IO; | ||
using System.Collections.Generic; | ||
|
||
namespace MSBuild.Sdk.SqlProj.DacpacTool | ||
{ | ||
public sealed class ScriptInspector | ||
{ | ||
private readonly List<string> _includedFiles = new List<string>(); | ||
public IEnumerable<string> IncludedFiles | ||
{ | ||
get => _includedFiles; | ||
} | ||
|
||
public void AddPreDeploymentScript(FileInfo script) | ||
{ | ||
AddIncludedFiles(script); | ||
} | ||
|
||
public void AddPostDeploymentScript(FileInfo script) | ||
{ | ||
AddIncludedFiles(script); | ||
} | ||
|
||
private void AddIncludedFiles(FileInfo file) | ||
{ | ||
var parser = new ScriptParser(file.FullName, new IncludeVariableResolver()); | ||
_includedFiles.AddRange(parser.CollectFileNames()); | ||
} | ||
} | ||
} |
Oops, something went wrong.