mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-20 09:35:38 -05:00
Sql Proj: Adding a new sqlproj template for SQL dbs (#18636)
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as path from 'path';
|
||||
|
||||
export interface ProjectAssets {
|
||||
readmeFolder?: string
|
||||
}
|
||||
|
||||
export let targetPlatformToAssets: Map<string, ProjectAssets>;
|
||||
|
||||
export function loadAssets(assetsFolderPath: string) {
|
||||
targetPlatformToAssets = new Map<string, ProjectAssets>([
|
||||
['AzureV12', {
|
||||
readmeFolder: path.join(assetsFolderPath, 'AzureV12')
|
||||
}],
|
||||
]);
|
||||
}
|
||||
@@ -35,26 +35,38 @@ export class SqlDatabaseProjectProvider implements dataworkspace.IProjectProvide
|
||||
* Gets the supported project types
|
||||
*/
|
||||
get supportedProjectTypes(): dataworkspace.IProjectType[] {
|
||||
return [{
|
||||
id: constants.emptySqlDatabaseProjectTypeId,
|
||||
projectFileExtension: constants.sqlprojExtension.replace(/\./g, ''),
|
||||
displayName: constants.emptyProjectTypeDisplayName,
|
||||
description: constants.emptyProjectTypeDescription,
|
||||
icon: IconPathHelper.colorfulSqlProject,
|
||||
targetPlatforms: Array.from(constants.targetPlatformToVersion.keys()),
|
||||
defaultTargetPlatform: constants.defaultTargetPlatform,
|
||||
sdkStyleOption: true,
|
||||
sdkStyleLearnMoreUrl: constants.sdkLearnMoreUrl
|
||||
},
|
||||
{
|
||||
id: constants.edgeSqlDatabaseProjectTypeId,
|
||||
projectFileExtension: constants.sqlprojExtension.replace(/\./g, ''),
|
||||
displayName: constants.edgeProjectTypeDisplayName,
|
||||
description: constants.edgeProjectTypeDescription,
|
||||
icon: IconPathHelper.sqlEdgeProject,
|
||||
sdkStyleOption: true,
|
||||
sdkStyleLearnMoreUrl: constants.sdkLearnMoreUrl
|
||||
}];
|
||||
return [
|
||||
{
|
||||
id: constants.emptyAzureDbSqlDatabaseProjectTypeId,
|
||||
projectFileExtension: constants.sqlprojExtension.replace(/\./g, ''),
|
||||
displayName: constants.emptyAzureDbProjectTypeDisplayName,
|
||||
description: constants.emptyAzureDbProjectTypeDescription,
|
||||
defaultTargetPlatform: sqldbproj.SqlTargetPlatform.sqlAzure,
|
||||
icon: IconPathHelper.azureSqlDbProject,
|
||||
sdkStyleOption: true,
|
||||
sdkStyleLearnMoreUrl: constants.sdkLearnMoreUrl
|
||||
},
|
||||
{
|
||||
id: constants.emptySqlDatabaseProjectTypeId,
|
||||
projectFileExtension: constants.sqlprojExtension.replace(/\./g, ''),
|
||||
displayName: constants.emptyProjectTypeDisplayName,
|
||||
description: constants.emptyProjectTypeDescription,
|
||||
icon: IconPathHelper.colorfulSqlProject,
|
||||
targetPlatforms: Array.from(constants.targetPlatformToVersion.keys()),
|
||||
defaultTargetPlatform: constants.defaultTargetPlatform,
|
||||
sdkStyleOption: true,
|
||||
sdkStyleLearnMoreUrl: constants.sdkLearnMoreUrl
|
||||
},
|
||||
{
|
||||
id: constants.edgeSqlDatabaseProjectTypeId,
|
||||
projectFileExtension: constants.sqlprojExtension.replace(/\./g, ''),
|
||||
displayName: constants.edgeProjectTypeDisplayName,
|
||||
description: constants.edgeProjectTypeDescription,
|
||||
icon: IconPathHelper.sqlEdgeProject,
|
||||
sdkStyleOption: true,
|
||||
sdkStyleLearnMoreUrl: constants.sdkLearnMoreUrl
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,6 +77,13 @@ export class SqlDatabaseProjectProvider implements dataworkspace.IProjectProvide
|
||||
* @returns Uri of the newly created project file
|
||||
*/
|
||||
async createProject(name: string, location: vscode.Uri, projectTypeId: string, targetPlatform?: sqldbproj.SqlTargetPlatform, sdkStyle: boolean = true): Promise<vscode.Uri> {
|
||||
|
||||
if (!targetPlatform) {
|
||||
const projectType = this.supportedProjectTypes.find(x => x.id === projectTypeId);
|
||||
if (projectType && projectType.defaultTargetPlatform) {
|
||||
targetPlatform = projectType.defaultTargetPlatform as sqldbproj.SqlTargetPlatform;
|
||||
}
|
||||
}
|
||||
const projectFile = await this.projectController.createNewProject({
|
||||
newProjName: name,
|
||||
folderUri: location,
|
||||
|
||||
Reference in New Issue
Block a user