fix cmake.cacheInit absolute path expansion (#3749)

This commit is contained in:
Garrett Campbell 2024-05-10 09:15:20 -04:00 коммит произвёл GitHub
Родитель a5b3992e19
Коммит 1c4a7f511b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -38,6 +38,7 @@ Bug Fixes:
- Fix issue where correcting `cmake.cmakePath` is still broken. [#3570](https://github.com/microsoft/vscode-cmake-tools/issues/3570)
- Fix CMakePresets.json schema validation. [#3651](https://github.com/microsoft/vscode-cmake-tools/issues/3651)
- Update what we use to create the workspace browse configuration to pass to cpp tools by filtering out extra file groups that are generated. [#3729](https://github.com/microsoft/vscode-cmake-tools/issues/3729)
- Fix issue where `cmake.cacheInit` isn't supporting absolute path in environment variables. [#2777](https://github.com/microsoft/vscode-cmake-tools/issues/2777)
## 1.17.17

Просмотреть файл

@ -1387,14 +1387,14 @@ export abstract class CMakeDriver implements vscode.Disposable {
public async generateConfigArgsFromPreset(configPreset: preset.ConfigurePreset): Promise<string[]> {
// Cache flags will construct the command line for cmake.
const init_cache_flags = this.generateInitCacheFlags();
const init_cache_flags = await this.generateInitCacheFlags();
// Make sure that we expand the config.configureArgs. Right now, preset args are expanded upon switching to the preset.
return init_cache_flags.concat(preset.configureArgs(configPreset), await Promise.all(this.config.configureArgs.map(async (value) => expand.expandString(value, { ...this.expansionOptions, envOverride: await this.getConfigureEnvironment()}))));
}
public async generateConfigArgsFromSettings(extra_args: string[] = [], withoutCmakeSettings: boolean = false): Promise<string[]> {
// Cache flags will construct the command line for cmake.
const init_cache_flags = this.generateInitCacheFlags();
const init_cache_flags = await this.generateInitCacheFlags();
const initial_common_flags = extra_args.concat(this.config.configureArgs);
const common_flags = initial_common_flags.includes("--warn-unused-cli") ? initial_common_flags : initial_common_flags.concat("--no-warn-unused-cli");
const define_flags = withoutCmakeSettings ? [] : this.generateCMakeSettingsFlags();
@ -1614,7 +1614,7 @@ export abstract class CMakeDriver implements vscode.Disposable {
}
}
private generateInitCacheFlags(): string[] {
private async generateInitCacheFlags(): Promise<string[]> {
const cache_init_conf = this.config.cacheInit;
let cache_init: string[] = [];
if (cache_init_conf === null) {
@ -1626,7 +1626,9 @@ export abstract class CMakeDriver implements vscode.Disposable {
}
const flags: string[] = [];
const envOverride = await this.getConfigureEnvironment();
for (let init of cache_init) {
init = await expand.expandString(init, { ...this.expansionOptions, envOverride });
if (!path.isAbsolute(init)) {
init = path.join(this.sourceDir, init);
}