Skip to content

Commit a7871a2

Browse files
authored
Support spaces in pre- post and refactor log paths (#704)
* Support spaces in pre- post and refactor log paths * fix up
1 parent 577a0c4 commit a7871a2

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

src/MSBuild.Sdk.SqlProj/Sdk/Sdk.targets

+5-5
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@
163163
<Target Name="GetIncludedFiles" DependsOnTargets="ValidateEnvironment">
164164
<!-- Build arguments for the command line tool -->
165165
<PropertyGroup>
166-
<PreDeploymentScriptArgument>@(PreDeploy->'--predeploy %(Identity)', ' ')</PreDeploymentScriptArgument>
167-
<PostDeploymentScriptArgument>@(PostDeploy->'--postdeploy %(Identity)', ' ')</PostDeploymentScriptArgument>
166+
<PreDeploymentScriptArgument>@(PreDeploy->'--predeploy &quot;%(Identity)&quot;', ' ')</PreDeploymentScriptArgument>
167+
<PostDeploymentScriptArgument>@(PostDeploy->'--postdeploy &quot;%(Identity)&quot;', ' ')</PostDeploymentScriptArgument>
168168
<DebugArgument Condition="'$(MSBuildSdkSqlProjDebug)' == 'True'">--debug</DebugArgument>
169169
<DacpacToolCommand>dotnet &quot;$(DacpacToolExe)&quot; collect-includes $(PreDeploymentScriptArgument) $(PostDeploymentScriptArgument) $(DebugArgument)</DacpacToolCommand>
170170
</PropertyGroup>
@@ -225,9 +225,9 @@
225225
<BuildPropertyArguments>@(BuildPropertyNames->'-bp %(Identity)=%(PropertyValue)', ' ')</BuildPropertyArguments>
226226
<DeployPropertyArguments>@(DeployPropertyNames->'-dp %(Identity)=%(PropertyValue)', ' ')</DeployPropertyArguments>
227227
<SqlCmdVariableArguments>@(SqlCmdVariable->'-sc %(Identity)=&quot;%(DefaultValue)&quot;', ' ')</SqlCmdVariableArguments>
228-
<PreDeploymentScriptArgument>@(PreDeploy->'--predeploy %(Identity)', ' ')</PreDeploymentScriptArgument>
229-
<PostDeploymentScriptArgument>@(PostDeploy->'--postdeploy %(Identity)', ' ')</PostDeploymentScriptArgument>
230-
<RefactorLogScriptArgument>@(RefactorLog->'--refactorlog %(Identity)', ' ')</RefactorLogScriptArgument>
228+
<PreDeploymentScriptArgument>@(PreDeploy->'--predeploy &quot;%(Identity)&quot;', ' ')</PreDeploymentScriptArgument>
229+
<PostDeploymentScriptArgument>@(PostDeploy->'--postdeploy &quot;%(Identity)&quot;', ' ')</PostDeploymentScriptArgument>
230+
<RefactorLogScriptArgument>@(RefactorLog->'--refactorlog &quot;%(Identity)&quot;', ' ')</RefactorLogScriptArgument>
231231
<RunSqlCodeAnalysisArgument Condition="'$(RunSqlCodeAnalysis)' == 'True'">-an</RunSqlCodeAnalysisArgument>
232232
<CodeAnalysisAssemblyLookupPathsArgument Condition="'$(RunSqlCodeAnalysis)' == 'True'">@(Analyzer->'-aa &quot;%(Identity)&quot;', ' ')</CodeAnalysisAssemblyLookupPathsArgument>
233233
<CodeAnalysisRulesArgument Condition="'$(CodeAnalysisRules)'!=''">-ar &quot;$(CodeAnalysisRules)&quot;</CodeAnalysisRulesArgument>

test/DacpacTool.Tests/PackageBuilderTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ public void AddPreDeployment_FilesExist()
299299
tempFile);
300300

301301
packageBuilder.AddPostDeploymentScript(
302-
new FileInfo("../../../../TestProjectWithPrePost/Post-Deployment/Script.PostDeployment.sql"),
302+
new FileInfo("../../../../TestProjectWithPrePost/Post-Deployment/Script.Post Deployment.sql"),
303303
tempFile);
304304

305305
// Assert

test/DacpacTool.Tests/ScriptParserTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class ScriptParserTests
1717
public void CanParseFileWithoutIncludes()
1818
{
1919
// Arrange
20-
var collector = new ScriptParser($"{TEST_PROJECT_PATH}/Post-Deployment/Script.PostDeployment.sql", _variableResolver);
20+
var collector = new ScriptParser($"{TEST_PROJECT_PATH}/Post-Deployment/Script.Post Deployment.sql", _variableResolver);
2121

2222
// Act
2323
var result = collector.CollectFileNames();

test/TestProjectWithPrePost/TestProjectWithPrePost.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project>
1+
<Project>
22
<Import Project="$(MSBuildThisFileDirectory)..\..\src\MSBuild.Sdk.SqlProj\Sdk\Sdk.props" />
33

44
<PropertyGroup>
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PostDeploy Include="Post-Deployment\Script.PostDeployment.sql" />
15+
<PostDeploy Include="Post-Deployment\Script.Post Deployment.sql" />
1616
<PreDeploy Include="Pre-Deployment\Script.PreDeployment.SimpleInclude.sql" />
1717
<RefactorLog Include="RefactorLog\TestProjectWithPrePost.refactorlog" />
1818
</ItemGroup>

0 commit comments

Comments
 (0)