change afterClean to beforeBuild for removing the generated assests.json (#13736)

* change afterClean to beforeBuild for removing the generated assests.json

* fix merge conflict

* rename files
This commit is contained in:
Kim Santiago
2020-12-11 11:54:35 -08:00
committed by GitHub
parent d2a525bbbe
commit 496fe0afa5
16 changed files with 28 additions and 28 deletions

View File

@@ -201,7 +201,7 @@ export class Project {
await fs.copyFile(this.projectFilePath, this.projectFilePath + '_backup');
await this.updateImportToSupportRoundTrip();
await this.updatePackageReferenceInProjFile();
await this.updateAfterCleanTargetInProjFile();
await this.updateBeforeBuildTargetInProjFile();
await this.updateSystemDatabaseReferencesInProjFile();
}
} else if (this.containsSSDTOnlySystemDatabaseReferences()) {
@@ -232,21 +232,21 @@ export class Project {
await this.updateImportedTargetsToProjFile(constants.NetCoreCondition, constants.NetCoreTargets, undefined);
}
private async updateAfterCleanTargetInProjFile(): Promise<void> {
private async updateBeforeBuildTargetInProjFile(): Promise<void> {
// Search if clean target already present, update it
for (let i = 0; i < this.projFileXmlDoc.documentElement.getElementsByTagName(constants.Target).length; i++) {
const afterCleanNode = this.projFileXmlDoc.documentElement.getElementsByTagName(constants.Target)[i];
const name = afterCleanNode.getAttribute(constants.Name);
if (name === constants.AfterCleanTarget) {
return await this.createCleanFileNode(afterCleanNode);
const beforeBuildNode = this.projFileXmlDoc.documentElement.getElementsByTagName(constants.Target)[i];
const name = beforeBuildNode.getAttribute(constants.Name);
if (name === constants.BeforeBuildTarget) {
return await this.createCleanFileNode(beforeBuildNode);
}
}
// If clean target not found, create new
const afterCleanNode = this.projFileXmlDoc.createElement(constants.Target);
afterCleanNode.setAttribute(constants.Name, constants.AfterCleanTarget);
this.projFileXmlDoc.documentElement.appendChild(afterCleanNode);
await this.createCleanFileNode(afterCleanNode);
const beforeBuildNode = this.projFileXmlDoc.createElement(constants.Target);
beforeBuildNode.setAttribute(constants.Name, constants.BeforeBuildTarget);
this.projFileXmlDoc.documentElement.appendChild(beforeBuildNode);
await this.createCleanFileNode(beforeBuildNode);
}
private async createCleanFileNode(parentNode: any): Promise<void> {