mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-17 01:25:36 -05:00
Add target platform as an option in create project api (#16035)
* add target platform as an option in create project api * add test * move constant
This commit is contained in:
@@ -16,6 +16,7 @@ import { Project, EntryType, SystemDatabase, SystemDatabaseReferenceProjectEntry
|
||||
import { exists, convertSlashesForSqlProj, trimChars, trimUri } from '../common/utils';
|
||||
import { Uri, window } from 'vscode';
|
||||
import { IDacpacReferenceSettings, IProjectReferenceSettings, ISystemDatabaseReferenceSettings } from '../models/IDatabaseReferenceSettings';
|
||||
import { SqlTargetPlatform } from 'sqldbproj';
|
||||
|
||||
let projFilePath: string;
|
||||
|
||||
@@ -155,19 +156,19 @@ describe('Project: sqlproj content operations', function (): void {
|
||||
should.equal(uri.fsPath, Uri.parse(path.join('$(NETCoreTargetsPath)', 'SystemDacpacs', '150', constants.masterDacpac)).fsPath);
|
||||
should.equal(ssdtUri.fsPath, Uri.parse(path.join('$(DacPacRootPath)', 'Extensions', 'Microsoft', 'SQLDB', 'Extensions', 'SqlServer', '150', 'SqlSchemas', constants.masterDacpac)).fsPath);
|
||||
|
||||
await project.changeTargetPlatform(constants.targetPlatformToVersion.get(constants.sqlServer2016)!);
|
||||
await project.changeTargetPlatform(constants.targetPlatformToVersion.get(SqlTargetPlatform.sqlServer2016)!);
|
||||
uri = project.getSystemDacpacUri(constants.masterDacpac);
|
||||
ssdtUri = project.getSystemDacpacSsdtUri(constants.masterDacpac);
|
||||
should.equal(uri.fsPath, Uri.parse(path.join('$(NETCoreTargetsPath)', 'SystemDacpacs', '130', constants.masterDacpac)).fsPath);
|
||||
should.equal(ssdtUri.fsPath, Uri.parse(path.join('$(DacPacRootPath)', 'Extensions', 'Microsoft', 'SQLDB', 'Extensions', 'SqlServer', '130', 'SqlSchemas', constants.masterDacpac)).fsPath);
|
||||
|
||||
await project.changeTargetPlatform(constants.targetPlatformToVersion.get(constants.sqlAzure)!);
|
||||
await project.changeTargetPlatform(constants.targetPlatformToVersion.get(SqlTargetPlatform.sqlAzure)!);
|
||||
uri = project.getSystemDacpacUri(constants.masterDacpac);
|
||||
ssdtUri = project.getSystemDacpacSsdtUri(constants.masterDacpac);
|
||||
should.equal(uri.fsPath, Uri.parse(path.join('$(NETCoreTargetsPath)', 'SystemDacpacs', 'AzureV12', constants.masterDacpac)).fsPath);
|
||||
should.equal(ssdtUri.fsPath, Uri.parse(path.join('$(DacPacRootPath)', 'Extensions', 'Microsoft', 'SQLDB', 'Extensions', 'SqlServer', 'AzureV12', 'SqlSchemas', constants.masterDacpac)).fsPath);
|
||||
|
||||
await project.changeTargetPlatform(constants.targetPlatformToVersion.get(constants.sqlDW)!);
|
||||
await project.changeTargetPlatform(constants.targetPlatformToVersion.get(SqlTargetPlatform.sqlDW)!);
|
||||
uri = project.getSystemDacpacUri(constants.masterDacpac);
|
||||
ssdtUri = project.getSystemDacpacSsdtUri(constants.masterDacpac);
|
||||
should.equal(uri.fsPath, Uri.parse(path.join('$(NETCoreTargetsPath)', 'SystemDacpacs', 'AzureDw', constants.masterDacpac)).fsPath);
|
||||
@@ -189,17 +190,17 @@ describe('Project: sqlproj content operations', function (): void {
|
||||
should(projFileText.includes(convertSlashesForSqlProj(Uri.file(path.join('$(NETCoreTargetsPath)', 'SystemDacpacs', '150', constants.masterDacpac)).fsPath.substring(1)))).be.true('System db reference path should be 150');
|
||||
should(projFileText.includes(convertSlashesForSqlProj(Uri.file(path.join('$(DacPacRootPath)', 'Extensions', 'Microsoft', 'SQLDB', 'Extensions', 'SqlServer', '150', 'SqlSchemas', constants.masterDacpac)).fsPath.substring(1)))).be.true('System db SSDT reference path should be 150');
|
||||
|
||||
await project.changeTargetPlatform(constants.targetPlatformToVersion.get(constants.sqlServer2016)!);
|
||||
await project.changeTargetPlatform(constants.targetPlatformToVersion.get(SqlTargetPlatform.sqlServer2016)!);
|
||||
projFileText = await fs.readFile(projFilePath);
|
||||
should(projFileText.includes(convertSlashesForSqlProj(Uri.file(path.join('$(NETCoreTargetsPath)', 'SystemDacpacs', '130', constants.masterDacpac)).fsPath.substring(1)))).be.true('System db reference path should have been updated to 130');
|
||||
should(projFileText.includes(convertSlashesForSqlProj(Uri.file(path.join('$(DacPacRootPath)', 'Extensions', 'Microsoft', 'SQLDB', 'Extensions', 'SqlServer', '130', 'SqlSchemas', constants.masterDacpac)).fsPath.substring(1)))).be.true('System db SSDT reference path should be 130');
|
||||
|
||||
await project.changeTargetPlatform(constants.targetPlatformToVersion.get(constants.sqlAzure)!);
|
||||
await project.changeTargetPlatform(constants.targetPlatformToVersion.get(SqlTargetPlatform.sqlAzure)!);
|
||||
projFileText = await fs.readFile(projFilePath);
|
||||
should(projFileText.includes(convertSlashesForSqlProj(Uri.file(path.join('$(NETCoreTargetsPath)', 'SystemDacpacs', 'AzureV12', constants.masterDacpac)).fsPath.substring(1)))).be.true('System db reference path should have been updated to AzureV12');
|
||||
should(projFileText.includes(convertSlashesForSqlProj(Uri.file(path.join('$(DacPacRootPath)', 'Extensions', 'Microsoft', 'SQLDB', 'Extensions', 'SqlServer', 'AzureV12', 'SqlSchemas', constants.masterDacpac)).fsPath.substring(1)))).be.true('System db SSDT reference path should be AzureV12');
|
||||
|
||||
await project.changeTargetPlatform(constants.targetPlatformToVersion.get(constants.sqlDW)!);
|
||||
await project.changeTargetPlatform(constants.targetPlatformToVersion.get(SqlTargetPlatform.sqlDW)!);
|
||||
projFileText = await fs.readFile(projFilePath);
|
||||
should(projFileText.includes(convertSlashesForSqlProj(Uri.file(path.join('$(NETCoreTargetsPath)', 'SystemDacpacs', 'AzureDw', constants.masterDacpac)).fsPath.substring(1)))).be.true('System db reference path should have been updated to AzureDw');
|
||||
should(projFileText.includes(convertSlashesForSqlProj(Uri.file(path.join('$(DacPacRootPath)', 'Extensions', 'Microsoft', 'SQLDB', 'Extensions', 'SqlServer', 'AzureDw', 'SqlSchemas', constants.masterDacpac)).fsPath.substring(1)))).be.true('System db SSDT reference path should be AzureDw');
|
||||
@@ -214,7 +215,7 @@ describe('Project: sqlproj content operations', function (): void {
|
||||
should.equal(uri.fsPath, Uri.parse(path.join('$(NETCoreTargetsPath)', 'SystemDacpacs', '150', constants.msdbDacpac)).fsPath);
|
||||
should.equal(ssdtUri.fsPath, Uri.parse(path.join('$(DacPacRootPath)', 'Extensions', 'Microsoft', 'SQLDB', 'Extensions', 'SqlServer', '150', 'SqlSchemas', constants.msdbDacpac)).fsPath);
|
||||
|
||||
await project.changeTargetPlatform(constants.targetPlatformToVersion.get(constants.sqlServer2016)!);
|
||||
await project.changeTargetPlatform(constants.targetPlatformToVersion.get(SqlTargetPlatform.sqlServer2016)!);
|
||||
uri = project.getSystemDacpacUri(constants.msdbDacpac);
|
||||
ssdtUri = project.getSystemDacpacSsdtUri(constants.msdbDacpac);
|
||||
should.equal(uri.fsPath, Uri.parse(path.join('$(NETCoreTargetsPath)', 'SystemDacpacs', '130', constants.msdbDacpac)).fsPath);
|
||||
|
||||
Reference in New Issue
Block a user