mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-19 01:25:36 -05:00
Don't show update project warning for new style sqlproj (#17490)
* don't show SSDT update warning for new style projects * update strings * add checks for the 2 other ways to specify msbuild sdk * add link to docs on how to use project sdk Co-authored-by: Kim Santiago <kisantia@Kims-MacBook-Pro.local>
This commit is contained in:
@@ -26,6 +26,9 @@ export let sqlProjectMissingVersionBaseline: string;
|
||||
export let sqlProjectInvalidVersionBaseline: string;
|
||||
export let sqlProjectCustomCollationBaseline: string;
|
||||
export let sqlProjectInvalidCollationBaseline: string;
|
||||
export let newStyleProjectSdkNodeBaseline: string;
|
||||
export let newStyleProjectSdkProjectAttributeBaseline: string;
|
||||
export let newStyleProjectSdkImportAttributeBaseline: string;
|
||||
|
||||
const baselineFolderPath = __dirname;
|
||||
|
||||
@@ -49,6 +52,9 @@ export async function loadBaselines() {
|
||||
sqlProjectInvalidVersionBaseline = await loadBaseline(baselineFolderPath, 'sqlProjectInvalidVersionBaseline.xml');
|
||||
sqlProjectCustomCollationBaseline = await loadBaseline(baselineFolderPath, 'sqlProjectCustomCollationBaseline.xml');
|
||||
sqlProjectInvalidCollationBaseline = await loadBaseline(baselineFolderPath, 'sqlProjectInvalidCollationBaseline.xml');
|
||||
newStyleProjectSdkNodeBaseline = await loadBaseline(baselineFolderPath, 'newStyleSqlProjectSdkNodeBaseline.xml');
|
||||
newStyleProjectSdkProjectAttributeBaseline = await loadBaseline(baselineFolderPath, 'newStyleSqlProjectSdkProjectAttributeBaseline.xml');
|
||||
newStyleProjectSdkImportAttributeBaseline = await loadBaseline(baselineFolderPath, 'newStyleSqlProjectSdkImportAttributeBaseline.xml');
|
||||
}
|
||||
|
||||
async function loadBaseline(baselineFolderPath: string, fileName: string): Promise<string> {
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build">
|
||||
<PropertyGroup>
|
||||
<Name>TestProjectName</Name>
|
||||
<ProjectGuid>{2C283C5D-9E4A-4313-8FF9-4E0CEE20B063}</ProjectGuid>
|
||||
<DSP>Microsoft.Data.Tools.Schema.Sql.Sql150DatabaseSchemaProvider</DSP>
|
||||
<ModelCollation>1033, CI</ModelCollation>
|
||||
</PropertyGroup>
|
||||
<Target Name="BeforeBuild">
|
||||
<Delete Files="$(BaseIntermediateOutputPath)\project.assets.json" />
|
||||
</Target>
|
||||
<Import Project="Sdk.props" Sdk="Microsoft.Build.Sql" Version="1.0.0" />
|
||||
<Import Project="Sdk.targets" Sdk="Microsoft.Build.Sql" Version="1.0.0" />
|
||||
</Project>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build">
|
||||
<Sdk Name="Microsoft.Build.Sql" Version="1.0.0" />
|
||||
<PropertyGroup>
|
||||
<Name>TestProjectName</Name>
|
||||
<ProjectGuid>{2C283C5D-9E4A-4313-8FF9-4E0CEE20B063}</ProjectGuid>
|
||||
<DSP>Microsoft.Data.Tools.Schema.Sql.Sql150DatabaseSchemaProvider</DSP>
|
||||
<ModelCollation>1033, CI</ModelCollation>
|
||||
</PropertyGroup>
|
||||
<Target Name="BeforeBuild">
|
||||
<Delete Files="$(BaseIntermediateOutputPath)\project.assets.json" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" Sdk="Microsoft.Build.Sql/1.0.0">
|
||||
<PropertyGroup>
|
||||
<Name>TestProjectName</Name>
|
||||
<ProjectGuid>{2C283C5D-9E4A-4313-8FF9-4E0CEE20B063}</ProjectGuid>
|
||||
<DSP>Microsoft.Data.Tools.Schema.Sql.Sql150DatabaseSchemaProvider</DSP>
|
||||
<ModelCollation>1033, CI</ModelCollation>
|
||||
</PropertyGroup>
|
||||
<Target Name="BeforeBuild">
|
||||
<Delete Files="$(BaseIntermediateOutputPath)\project.assets.json" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -906,6 +906,10 @@ describe('Project: round trip updates', function (): void {
|
||||
await baselines.loadBaselines();
|
||||
});
|
||||
|
||||
beforeEach(function (): void {
|
||||
sinon.restore();
|
||||
});
|
||||
|
||||
it('Should update SSDT project to work in ADS', async function (): Promise<void> {
|
||||
await testUpdateInRoundTrip(baselines.SSDTProjectFileBaseline, baselines.SSDTProjectAfterUpdateBaseline);
|
||||
});
|
||||
@@ -943,6 +947,29 @@ describe('Project: round trip updates', function (): void {
|
||||
|
||||
should(project.importedTargets.length).equal(3); // additional target should exist by default
|
||||
});
|
||||
|
||||
it('Should not show update project warning message when opening msbuild sdk style project using Sdk node', async function (): Promise<void> {
|
||||
await shouldNotShowUpdateWarning(baselines.newStyleProjectSdkNodeBaseline);
|
||||
});
|
||||
|
||||
it('Should not show update project warning message when opening msbuild sdk style project using Project node with Sdk attribute', async function (): Promise<void> {
|
||||
await shouldNotShowUpdateWarning(baselines.newStyleProjectSdkProjectAttributeBaseline);
|
||||
});
|
||||
|
||||
it('Should not show update project warning message when opening msbuild sdk style project using Import node with Sdk attribute', async function (): Promise<void> {
|
||||
await shouldNotShowUpdateWarning(baselines.newStyleProjectSdkImportAttributeBaseline);
|
||||
});
|
||||
|
||||
async function shouldNotShowUpdateWarning(baselineFile: string): Promise<void> {
|
||||
// setup test files
|
||||
const folderPath = await testUtils.generateTestFolderPath();
|
||||
const sqlProjPath = await testUtils.createTestSqlProjFile(baselineFile, folderPath);
|
||||
const spy = sinon.spy(window, 'showWarningMessage');
|
||||
|
||||
const project = await Project.openProject(Uri.file(sqlProjPath).fsPath);
|
||||
should(spy.notCalled).be.true();
|
||||
should(project.isMsbuildSdkStyleProject).be.true();
|
||||
}
|
||||
});
|
||||
|
||||
async function testUpdateInRoundTrip(fileBeforeupdate: string, fileAfterUpdate: string): Promise<void> {
|
||||
@@ -960,5 +987,3 @@ async function testUpdateInRoundTrip(fileBeforeupdate: string, fileAfterUpdate:
|
||||
should(stub.calledOnce).be.true('showWarningMessage should have been called exactly once');
|
||||
sinon.restore();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user