mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-18 01:25:37 -05:00
Add reference to another sql project (#12186)
* add projects to add database reference dialog * able to add project references * check for circular dependency * only allow adding reference to project in the same workspace * fix location dropdown when project reference is enabled * add tests * more tests * cleanup * fix flakey test * addressing comments
This commit is contained in:
@@ -99,6 +99,7 @@ export const defaultUser = localize('default', "default");
|
||||
export const addDatabaseReferenceDialogName = localize('addDatabaseReferencedialogName', "Add database reference");
|
||||
export const addDatabaseReferenceOkButtonText = localize('addDatabaseReferenceOkButtonText', "Add reference");
|
||||
export const referenceRadioButtonsGroupTitle = localize('referenceRadioButtonsGroupTitle', "Type");
|
||||
export const projectRadioButtonTitle = localize('projectRadioButtonTitle', "Database project in folder");
|
||||
export const systemDatabaseRadioButtonTitle = localize('systemDatabaseRadioButtonTitle', "System database");
|
||||
export const dacpacText = localize('dacpacText', "Data-tier application (.dacpac)");
|
||||
export const dacpacPlaceholder = localize('dacpacPlaceholder', "Select .dacpac");
|
||||
@@ -118,6 +119,7 @@ export const exampleUsage = localize('exampleUsage', "Example Usage");
|
||||
export const enterSystemDbName = localize('enterSystemDbName', "Enter a database name for this system database");
|
||||
export const databaseNameRequiredVariableOptional = localize('databaseNameRequiredVariableOptional', "A database name is required. The database variable is optional.");
|
||||
export const databaseNameServerNameVariableRequired = localize('databaseNameServerNameVariableRequired', "A database name, server name, and server variable are required. The database variable is optional");
|
||||
export const databaseProject = localize('databaseProject', "Database project");
|
||||
|
||||
// Error messages
|
||||
|
||||
@@ -164,6 +166,7 @@ export function unexpectedProjectContext(uri: string) { return localize('unexpec
|
||||
export function unableToPerformAction(action: string, uri: string) { return localize('unableToPerformAction', "Unable to locate '{0}' target: '{1}'", action, uri); }
|
||||
export function unableToFindObject(path: string, objType: string) { return localize('unableToFindFile', "Unable to find {1} with path '{0}'", path, objType); }
|
||||
export function deployScriptExists(scriptType: string) { return localize('deployScriptExists', "A {0} script already exists. The new script will not be included in build.", scriptType); }
|
||||
export function cantAddCircularProjectReference(project: string) { return localize('cantAddCircularProjectReference', "A reference to project '{0} cannot be added. Adding this project as a reference would cause a circular dependency", project); }
|
||||
|
||||
// Action types
|
||||
export const deleteAction = localize('deleteAction', 'Delete');
|
||||
@@ -217,6 +220,8 @@ export const PostDeploy = 'PostDeploy';
|
||||
export const None = 'None';
|
||||
export const True = 'True';
|
||||
export const False = 'False';
|
||||
export const Private = 'Private';
|
||||
export const ProjectGuid = 'ProjectGuid';
|
||||
|
||||
// SqlProj File targets
|
||||
export const NetCoreTargets = '$(NETCoreTargetsPath)\\Microsoft.Data.Tools.Schema.SqlTasks.targets';
|
||||
|
||||
@@ -6,8 +6,9 @@
|
||||
import * as vscode from 'vscode';
|
||||
import * as os from 'os';
|
||||
import * as constants from './constants';
|
||||
import { promises as fs } from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as glob from 'fast-glob';
|
||||
import { promises as fs } from 'fs';
|
||||
|
||||
/**
|
||||
* Consolidates on the error message string
|
||||
@@ -143,3 +144,16 @@ export function readSqlCmdVariables(xmlDoc: any): Record<string, string> {
|
||||
|
||||
return sqlCmdVariables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively gets all the sqlproj files at any depth in a folder
|
||||
* @param folderPath
|
||||
*/
|
||||
export async function getSqlProjectFilesInFolder(folderPath: string): Promise<string[]> {
|
||||
// path needs to use forward slashes for glob to work
|
||||
const escapedPath = glob.escapePath(folderPath.replace(/\\/g, '/'));
|
||||
const sqlprojFilter = path.posix.join(escapedPath, '**', '*.sqlproj');
|
||||
const results = await glob(sqlprojFilter);
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user