Skip to content

Commit

Permalink
[MavenV3] [MavenV2 ]Added logic for avoid copying settings file to it…
Browse files Browse the repository at this point in the history
…self (#14377)

* [MavenV3] Added logic for avoid copying settings file to itself

* [MavenV2] Added logic for avoid copying settings file to itself
  • Loading branch information
Sergey Dobrodeev authored Feb 12, 2021
1 parent 7ee4c5d commit ac62063
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 11 deletions.
9 changes: 7 additions & 2 deletions Tasks/MavenV2/maventask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,13 @@ async function execBuild() {
for (let i = 0; i < options.length; ++i) {
if ((options[i] === '--settings' || options[i] === '-s') && (i + 1) < options.length) {
i++; // increment to the file name
let suppliedSettingsXml: string = options[i];
tl.cp(path.resolve(tl.cwd(), suppliedSettingsXml), settingsXmlFile, '-f');
let suppliedSettingsXml: string = path.resolve(tl.cwd(), options[i]);
// Avoid copying settings file to itself
if (path.relative(suppliedSettingsXml, settingsXmlFile) !== '') {
tl.cp(suppliedSettingsXml, settingsXmlFile, '-f');
} else {
tl.debug('Settings file is already in the correct location. Copying skipped.');
}
tl.debug('using settings file: ' + settingsXmlFile);
} else {
if (mavenOptions) {
Expand Down
2 changes: 1 addition & 1 deletion Tasks/MavenV2/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 181,
"Minor": 183,
"Patch": 0
},
"releaseNotes": "Configuration of the SonarQube analysis was moved to the [SonarQube](https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarqube) or [SonarCloud](https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarcloud) extensions, in task `Prepare Analysis Configuration`",
Expand Down
2 changes: 1 addition & 1 deletion Tasks/MavenV2/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 181,
"Minor": 183,
"Patch": 0
},
"releaseNotes": "ms-resource:loc.releaseNotes",
Expand Down
9 changes: 7 additions & 2 deletions Tasks/MavenV3/maventask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,13 @@ async function execBuild() {
for (let i = 0; i < options.length; ++i) {
if ((options[i] === '--settings' || options[i] === '-s') && (i + 1) < options.length) {
i++; // increment to the file name
let suppliedSettingsXml: string = options[i];
tl.cp(path.resolve(tl.cwd(), suppliedSettingsXml), settingsXmlFile, '-f');
let suppliedSettingsXml: string = path.resolve(tl.cwd(), options[i]);
// Avoid copying settings file to itself
if (path.relative(suppliedSettingsXml, settingsXmlFile) !== '') {
tl.cp(suppliedSettingsXml, settingsXmlFile, '-f');
} else {
tl.debug('Settings file is already in the correct location. Copying skipped.');
}
tl.debug('using settings file: ' + settingsXmlFile);
} else {
if (mavenOptions) {
Expand Down
2 changes: 1 addition & 1 deletion Tasks/MavenV3/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Tasks/MavenV3/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"author": "Microsoft Corporation",
"version": {
"Major": 3,
"Minor": 181,
"Patch": 1
"Minor": 183,
"Patch": 0
},
"releaseNotes": "Configuration of the SonarQube analysis was moved to the [SonarQube](https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarqube) or [SonarCloud](https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarcloud) extensions, in task `Prepare Analysis Configuration`",
"demands": [
Expand Down
4 changes: 2 additions & 2 deletions Tasks/MavenV3/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"author": "Microsoft Corporation",
"version": {
"Major": 3,
"Minor": 181,
"Patch": 1
"Minor": 183,
"Patch": 0
},
"releaseNotes": "ms-resource:loc.releaseNotes",
"demands": [
Expand Down

0 comments on commit ac62063

Please sign in to comment.