Skip to content

Commit

Permalink
return expandedPreset, not preset (#4008)
Browse files Browse the repository at this point in the history
* return expandedPreset, not preset

* make sure user presets are considered
  • Loading branch information
gcampbell-msft authored Aug 27, 2024
1 parent 34ca947 commit 5820bc5
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1613,7 +1613,10 @@ async function getBuildPresetInheritsHelper(folder: string, preset: BuildPreset,

// Expand configure preset. Evaluate this after inherits since it may come from parents
if (preset.configurePreset) {
const expandedConfigurePreset = getPresetByName(configurePresets(folder), preset.configurePreset);
let expandedConfigurePreset = getPresetByName(configurePresets(folder), preset.configurePreset);
if (!expandedConfigurePreset && allowUserPreset) {
expandedConfigurePreset = getPresetByName(userConfigurePresets(folder), preset.configurePreset);
}

if (!expandedConfigurePreset) {
log.error(localize('configure.preset.not.found.full', 'Could not find configure preset with name {0}', preset.configurePreset));
Expand Down Expand Up @@ -1685,7 +1688,7 @@ export async function expandBuildPresetVariables(preset: BuildPreset, name: stri
// Other fields can be copied by reference for simplicity
merge(expandedPreset, preset);

return preset;
return expandedPreset;
}

// Map<fsPath, Set<referencedPresets>>
Expand Down Expand Up @@ -1786,7 +1789,11 @@ async function getTestPresetInheritsHelper(folder: string, preset: TestPreset, w

// Expand configure preset. Evaluate this after inherits since it may come from parents
if (preset.configurePreset) {
const expandedConfigurePreset = getPresetByName(configurePresets(folder), preset.configurePreset);
let expandedConfigurePreset = getPresetByName(configurePresets(folder), preset.configurePreset);
if (!expandedConfigurePreset && allowUserPreset) {
expandedConfigurePreset = getPresetByName(userConfigurePresets(folder), preset.configurePreset);
}

if (!expandedConfigurePreset) {
log.error(localize('configure.preset.not.found.full', 'Could not find configure preset with name {0}', preset.configurePreset));
errorHandler?.tempErrorList.push([localize('configure.preset.not.found', 'Could not find configure preset'), preset.configurePreset]);
Expand Down Expand Up @@ -1996,7 +2003,11 @@ async function getPackagePresetInheritsHelper(folder: string, preset: PackagePre

// Expand configure preset. Evaluate this after inherits since it may come from parents
if (preset.configurePreset) {
const expandedConfigurePreset = getPresetByName(configurePresets(folder), preset.configurePreset);
let expandedConfigurePreset = getPresetByName(configurePresets(folder), preset.configurePreset);
if (!expandedConfigurePreset && allowUserPreset) {
expandedConfigurePreset = getPresetByName(userConfigurePresets(folder), preset.configurePreset);
}

if (!expandedConfigurePreset) {
log.error(localize('configure.preset.not.found.full', 'Could not find configure preset with name {0}', preset.configurePreset));
errorHandler?.tempErrorList.push([localize('configure.preset.not.found', 'Could not find configure preset'), preset.configurePreset]);
Expand Down

0 comments on commit 5820bc5

Please sign in to comment.