Feature/project build (#10332)

* initial build command execution

* adding tests

* Clean up test names

* update SqltoolsService release in ADS for Build

* Updating as per PR comments

* updating yarn lock

* Adding one more test for command run

* Test fixes
This commit is contained in:
Udeesha Gautam
2020-05-12 20:17:37 -07:00
committed by GitHub
parent ab374e362a
commit ddb9a806cc
13 changed files with 319 additions and 22 deletions

View File

@@ -52,7 +52,7 @@ export const projectNameRequired = localize('projectNameRequired', "Name is requ
export const projectLocationRequired = localize('projectLocationRequired', "Location is required to create a new database project.");
export function projectAlreadyOpened(path: string) { return localize('projectAlreadyOpened', "Project '{0}' is already opened.", path); }
export function projectAlreadyExists(name: string, path: string) { return localize('projectAlreadyExists', "A project named {0} already exists in {1}.", name, path); }
export function mssqlNotFound(mssqlConfigDir: string) { return localize('mssqlNotFound', "Could not get mssql extension's install location at {0}", mssqlConfigDir); }
// Project script types

View File

@@ -4,11 +4,14 @@
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import * as os from 'os';
/**
* Consolidates on the error message string
*/
export function getErrorMessage(error: Error | string): string {
return (error instanceof Error) ? error.message : error;
export function getErrorMessage(error: any): string {
return (error instanceof Error)
? (typeof error.message === 'string' ? error.message : '')
: typeof error === 'string' ? error : `${JSON.stringify(error, undefined, '\t')}`;
}
/**
@@ -45,3 +48,29 @@ export function trimChars(input: string, chars: string): string {
return output;
}
/**
* get quoted path to be used in any commandline argument
* @param filePath
*/
export function getSafePath(filePath: string): string {
return (os.platform() === 'win32') ?
getSafeWindowsPath(filePath) :
getSafeNonWindowsPath(filePath);
}
/**
* ensure that path with spaces are handles correctly
*/
export function getSafeWindowsPath(filePath: string): string {
filePath = filePath.split('\\').join('\\\\').split('"').join('');
return '"' + filePath + '"';
}
/**
* ensure that path with spaces are handles correctly
*/
export function getSafeNonWindowsPath(filePath: string): string {
filePath = filePath.split('\\').join('/').split('"').join('');
return '"' + filePath + '"';
}