mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Fixing smattering of issues regarding updating projects for cross-plat (#22575)
* Fixing smattering of issues regarding updating projects for cross-plat * Adding both options for modal * Removing quickpick
This commit is contained in:
@@ -377,8 +377,10 @@ export const invalidSqlConnectionString = localize('invalidSqlConnectionString',
|
|||||||
export const extractTargetRequired = localize('extractTargetRequired', "Target information for extract is required to create database project.");
|
export const extractTargetRequired = localize('extractTargetRequired', "Target information for extract is required to create database project.");
|
||||||
export const schemaCompareNotInstalled = localize('schemaCompareNotInstalled', "Schema compare extension installation is required to run schema compare");
|
export const schemaCompareNotInstalled = localize('schemaCompareNotInstalled', "Schema compare extension installation is required to run schema compare");
|
||||||
export const buildFailedCannotStartSchemaCompare = localize('buildFailedCannotStartSchemaCompare', "Schema compare could not start because build failed");
|
export const buildFailedCannotStartSchemaCompare = localize('buildFailedCannotStartSchemaCompare', "Schema compare could not start because build failed");
|
||||||
export function updateProjectForRoundTrip(projectName: string) { return localize('updateProjectForRoundTrip', "The targets, references, and system database references need to be updated to build the project '{0}'. If the project was created in SSDT, it will continue to work in both tools. Do you want to update the project?", projectName); }
|
export function projectNeedsUpdatingForCrossPlat(projectName: string) { return localize('projectNeedsUpdatingForCrossPlat', "The targets, references, and system database references need to be updated to build the project '{0}'.", projectName); }
|
||||||
export function updateProjectDatabaseReferencesForRoundTrip(projectName: string) { return localize('updateProjectDatabaseReferencesForRoundTrip', "The system database references need to be updated to build the project '{0}'. If the project was created in SSDT, it will continue to work in both tools. Do you want to update the project?", projectName); }
|
export function updateProjectForCrossPlatform(projectName: string) { return localize('updateProjectForCrossPlatform', "{0} If the project was created in SSDT, it will continue to work in both tools. Do you want to update the project?", projectNeedsUpdatingForCrossPlat(projectName)); }
|
||||||
|
export function updateProjectForCrossPlatformShort(projectName: string) { return localize('updateProjectForCrossPlatformShort', "Update {0} for cross-platform support?", projectName); }
|
||||||
|
export function updateProjectDatabaseReferencesForCrossPlatform(projectName: string) { return localize('updateProjectDatabaseReferencesForRoundTrip', "The system database references need to be updated to build the project '{0}'. If the project was created in SSDT, it will continue to work in both tools. Do you want to update the project?", projectName); }
|
||||||
export const databaseReferenceTypeRequired = localize('databaseReferenceTypeRequired', "Database reference type is required for adding a reference to a database");
|
export const databaseReferenceTypeRequired = localize('databaseReferenceTypeRequired', "Database reference type is required for adding a reference to a database");
|
||||||
export const systemDatabaseReferenceRequired = localize('systemDatabaseReferenceRequired', "System database selection is required for adding a reference to a system database");
|
export const systemDatabaseReferenceRequired = localize('systemDatabaseReferenceRequired', "System database selection is required for adding a reference to a system database");
|
||||||
export const dacpacFileLocationRequired = localize('dacpacFileLocationRequired', "Dacpac file location is required for adding a reference to a database");
|
export const dacpacFileLocationRequired = localize('dacpacFileLocationRequired', "Dacpac file location is required for adding a reference to a database");
|
||||||
|
|||||||
@@ -298,6 +298,14 @@ export class ProjectsController {
|
|||||||
argument: this.buildHelper.constructBuildArguments(project.projectFilePath, this.buildHelper.extensionBuildDirPath, project.sqlProjStyle)
|
argument: this.buildHelper.constructBuildArguments(project.projectFilePath, this.buildHelper.extensionBuildDirPath, project.sqlProjStyle)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const crossPlatCompatible: boolean = await Project.checkPromptCrossPlatStatus(project, true /* blocking prompt */);
|
||||||
|
|
||||||
|
if (!crossPlatCompatible) {
|
||||||
|
// user rejected updating for cross-plat
|
||||||
|
void vscode.window.showErrorMessage(constants.projectNeedsUpdatingForCrossPlat(project.projectFileName));
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await this.netCoreTool.runDotnetCommand(options);
|
await this.netCoreTool.runDotnetCommand(options);
|
||||||
const timeToBuild = new Date().getTime() - startTime.getTime();
|
const timeToBuild = new Date().getTime() - startTime.getTime();
|
||||||
|
|||||||
@@ -158,17 +158,42 @@ export class Project implements ISqlProject {
|
|||||||
|
|
||||||
await proj.readProjFile();
|
await proj.readProjFile();
|
||||||
|
|
||||||
if (!proj.isCrossPlatformCompatible && promptIfNeedsUpdating) {
|
if (promptIfNeedsUpdating) {
|
||||||
const result = await window.showWarningMessage(constants.updateProjectForRoundTrip(proj.projectFileName), constants.yesString, constants.noString);
|
await this.checkPromptCrossPlatStatus(proj, false /* don't block the thread until the prompt*/);
|
||||||
|
|
||||||
if (result === constants.yesString) {
|
|
||||||
await proj.updateProjectForRoundTrip();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return proj;
|
return proj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If project does not support cross-plat building, prompts the user for whether to update and updates if accepted
|
||||||
|
* @param project
|
||||||
|
* @param blockingPrompt whether to block the thread until the user updates, or to fire and forget
|
||||||
|
* @returns true if the project is updated after return, false if the user rejected the prompt
|
||||||
|
*/
|
||||||
|
public static async checkPromptCrossPlatStatus(project: Project, blockingPrompt: boolean): Promise<boolean> {
|
||||||
|
if (project.isCrossPlatformCompatible) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (blockingPrompt) {
|
||||||
|
const result = await window.showWarningMessage(constants.updateProjectForCrossPlatform(project.projectFileName), { modal: true }, constants.yesString, constants.noString);
|
||||||
|
|
||||||
|
if (result === constants.yesString) {
|
||||||
|
await project.updateProjectForCrossPlatform();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// use "void" with a .then() to not block the UI thread while prompting the user
|
||||||
|
void window.showErrorMessage(constants.updateProjectForCrossPlatform(project.projectFileName), constants.yesString, constants.noString).then(async (result) => {
|
||||||
|
if (result === constants.yesString) {
|
||||||
|
await project.updateProjectForCrossPlatform();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return project.isCrossPlatformCompatible;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads the project setting and contents from the file
|
* Reads the project setting and contents from the file
|
||||||
*/
|
*/
|
||||||
@@ -407,7 +432,7 @@ export class Project implements ISqlProject {
|
|||||||
this._configuration = Configuration.Debug;
|
this._configuration = Configuration.Debug;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async updateProjectForRoundTrip(): Promise<void> {
|
public async updateProjectForCrossPlatform(): Promise<void> {
|
||||||
if (this.isCrossPlatformCompatible) {
|
if (this.isCrossPlatformCompatible) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1108,7 +1108,7 @@ async function testUpdateInRoundTrip(test: Mocha.Runnable | undefined, fileBefor
|
|||||||
|
|
||||||
project.isCrossPlatformCompatible.should.be.false('Project should not be cross-plat compatible before conversion');
|
project.isCrossPlatformCompatible.should.be.false('Project should not be cross-plat compatible before conversion');
|
||||||
|
|
||||||
await project.updateProjectForRoundTrip();
|
await project.updateProjectForCrossPlatform();
|
||||||
|
|
||||||
(project.isCrossPlatformCompatible).should.be.true('Project should be cross-plat compatible after conversion');
|
(project.isCrossPlatformCompatible).should.be.true('Project should be cross-plat compatible after conversion');
|
||||||
(await exists(projFilePath + '_backup')).should.be.true('Backup file should have been generated before the project was updated');
|
(await exists(projFilePath + '_backup')).should.be.true('Backup file should have been generated before the project was updated');
|
||||||
|
|||||||
Reference in New Issue
Block a user