Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove sqltoolsservice submodule #676

Merged
merged 3 commits into from
Jan 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "sqltoolsservice"]
path = sqltoolsservice
url = https://github.com/microsoft/sqltoolsservice.git
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning">
<Version>3.6.146</Version>
<Version>3.7.112</Version>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
1 change: 0 additions & 1 deletion sqltoolsservice
Submodule sqltoolsservice deleted from 54fe38
21 changes: 9 additions & 12 deletions src/DacpacTool/DacpacTool.csproj
Original file line number Diff line number Diff line change
@@ -10,27 +10,24 @@
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
</PropertyGroup>

<PropertyGroup>
<SqlToolsPath>../../sqltoolsservice/src</SqlToolsPath>
<ManagedBatchParserPath>$(SqlToolsPath)/Microsoft.SqlTools.ManagedBatchParser</ManagedBatchParserPath>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SqlServer.DacFx" Version="162.4.92" />
<PackageReference Include="Microsoft.SqlServer.DacFx" Version="162.5.57" />
<PackageReference Include="NuGet.Versioning" Version="6.12.1" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageReference Include="System.CommandLine.NamingConventionBinder" Version="2.0.0-beta4.22272.1" />
</ItemGroup>

<!-- References to Microsoft.SqlTools.ManagedBatchParser -->
<ItemGroup>
<PackageReference Include="Microsoft.SqlServer.SqlManagementObjects" Version="171.30.0" />
<ProjectReference Include="$(SqlToolsPath)/Microsoft.SqlTools.Hosting/Microsoft.SqlTools.Hosting.csproj" />
<Compile Include="$(ManagedBatchParserPath)/Localization/*.cs" Link="BatchParser/%(Filename)%(Extension)" />
<EmbeddedResource Include="$(ManagedBatchParserPath)/Localization/sr.resx" LogicalName="Microsoft.SqlTools.ManagedBatchParser.Localization.SR.resources" Link="BatchParser/%(Filename)%(Extension)" />
<None Include="$(ManagedBatchParserPath)/Localization/sr.strings" Link="BatchParser/%(Filename)%(Extension)" />
<Compile Include="$(ManagedBatchParserPath)/BatchParser/**/*.cs" Link="BatchParser/%(Filename)%(Extension)" />
<Compile Include="$(ManagedBatchParserPath)/ReliableConnection/**/*.cs" Link="BatchParser/%(Filename)%(Extension)" />
<Content Include="Microsoft.SqlTools.ManagedBatchParser.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<PackageReference Include="Microsoft.SqlServer.SqlManagementObjects" Version="172.52.0" />
<Reference Include="Microsoft.SqlTools.ManagedBatchParser">
<HintPath>Microsoft.SqlTools.ManagedBatchParser.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>

</Project>
Binary file not shown.
16 changes: 11 additions & 5 deletions src/DacpacTool/PackageDeployer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.Data.SqlClient;
@@ -172,8 +173,7 @@ private void RunDeploymentScriptFromReferences(FileInfo dacpacPackage, string ta
_console.WriteLine($"Running {scriptPrefix}-deployment script for referenced package '{referencedPackage.Name}' version '{referencedPackage.Version}'");
_currentSource = $"{referencedPackage.Name}/{scriptPrefix}deploy.sql";

var scriptExecutionArgs = new ScriptExecutionArgs(script, connection, 0, executionEngineConditions, this);
AddSqlCmdVariables(scriptExecutionArgs, targetDatabaseName);
var scriptExecutionArgs = new ScriptExecutionArgs(script, connection, 0, executionEngineConditions, this, 1, AddSqlCmdVariables(targetDatabaseName));

engine.BatchParserExecutionError += (sender, args) => _console.WriteLine(args.Format(_currentSource));
engine.ScriptExecutionFinished += (sender, args) => _console.WriteLine($"Executed {scriptPrefix}-deployment script for referenced package " +
@@ -182,13 +182,19 @@ private void RunDeploymentScriptFromReferences(FileInfo dacpacPackage, string ta
}
}

private void AddSqlCmdVariables(ScriptExecutionArgs args, string targetDatabaseName)
private Dictionary<string, string> AddSqlCmdVariables(string targetDatabaseName)
jmezach marked this conversation as resolved.
Show resolved Hide resolved
{
args.Variables.Add("DatabaseName", targetDatabaseName);
var result = new Dictionary<string, string>(StringComparer.CurrentCultureIgnoreCase)
{
{ "DatabaseName", targetDatabaseName }
};

foreach (var variable in DeployOptions.SqlCommandVariableValues)
{
args.Variables.Add(variable.Key, variable.Value);
result.Add(variable.Key, variable.Value);
}

return result;
}

private void HandleDacServicesMessage(object sender, DacMessageEventArgs args)
6 changes: 6 additions & 0 deletions test/DacpacTool.Tests/DacpacTool.Tests.csproj
Original file line number Diff line number Diff line change
@@ -45,6 +45,12 @@
<ProjectReference Include="..\..\src\DacpacTool\DacpacTool.csproj" />
</ItemGroup>

<ItemGroup>
<Reference Include="Microsoft.SqlTools.ManagedBatchParser">
<HintPath>..\..\src\DacpacTool\Microsoft.SqlTools.ManagedBatchParser.dll</HintPath>
</Reference>
</ItemGroup>

<ItemGroup>
<None Update="SqlServer.Dac.dll">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>