Don't break on an equals sign (#2296)
This commit is contained in:
Родитель
984dc64a13
Коммит
df0c3a8774
|
@ -1259,8 +1259,7 @@ export class CMakeTools implements vscode.Disposable, api.CMakeToolsAPI {
|
|||
if (drv) {
|
||||
let old_prog = 0;
|
||||
const prog_sub = drv.onProgress(pr => {
|
||||
const new_prog
|
||||
= 100 * (pr.progressCurrent - pr.progressMinimum) / (pr.progressMaximum - pr.progressMinimum);
|
||||
const new_prog = 100 * (pr.progressCurrent - pr.progressMinimum) / (pr.progressMaximum - pr.progressMinimum);
|
||||
const increment = new_prog - old_prog;
|
||||
if (increment >= 1) {
|
||||
old_prog += increment;
|
||||
|
|
|
@ -428,10 +428,7 @@ export class CTestDriver implements vscode.Disposable {
|
|||
} else {
|
||||
buildConfigArgs.push('-C', driver.currentBuildType);
|
||||
}
|
||||
const result
|
||||
= await driver
|
||||
.executeCommand(ctestpath, ['-N', ...buildConfigArgs], undefined, { cwd: driver.binaryDir, silent: true })
|
||||
.result;
|
||||
const result = await driver.executeCommand(ctestpath, ['-N', ...buildConfigArgs], undefined, { cwd: driver.binaryDir, silent: true }).result;
|
||||
if (result.retc !== 0) {
|
||||
// There was an error running CTest. Odd...
|
||||
log.error(localize('ctest.error', 'There was an error running ctest to determine available test executables'));
|
||||
|
|
|
@ -6,8 +6,7 @@ import * as vscode from 'vscode';
|
|||
|
||||
import { oneLess, RawDiagnosticParser, FeedLineResult } from './util';
|
||||
|
||||
export const REGEX
|
||||
= /^\"(.*)\",\s+(?:line\s+(\d+):\s+)?(info|warning|(?:|fatal |catastrophic )error)\s+\((.*)\):\s+(.*)$/;
|
||||
export const REGEX = /^\"(.*)\",\s+(?:line\s+(\d+):\s+)?(info|warning|(?:|fatal |catastrophic )error)\s+\((.*)\):\s+(.*)$/;
|
||||
|
||||
export class Parser extends RawDiagnosticParser {
|
||||
doHandleLine(line: string) {
|
||||
|
|
|
@ -6,8 +6,7 @@ import * as vscode from 'vscode';
|
|||
|
||||
import { oneLess, RawDiagnosticParser, FeedLineResult } from './util';
|
||||
|
||||
export const REGEX
|
||||
= /^\"(.*)\",\s+(?:(?:line\s+(\d+)\s+\(col\.\s+(\d+)\))|(?:At end of source)):\s+(?:fatal )?(remark|warning|error)\s+(.*)/;
|
||||
export const REGEX = /^\"(.*)\",\s+(?:(?:line\s+(\d+)\s+\(col\.\s+(\d+)\))|(?:At end of source)):\s+(?:fatal )?(remark|warning|error)\s+(.*)/;
|
||||
|
||||
export class Parser extends RawDiagnosticParser {
|
||||
doHandleLine(line: string) {
|
||||
|
|
|
@ -6,8 +6,7 @@ import * as vscode from 'vscode';
|
|||
|
||||
import { oneLess, RawDiagnosticParser, FeedLineResult, RawDiagnostic } from './util';
|
||||
|
||||
const CODE_REGEX
|
||||
= /^\"(?<file>.*)\",(?<line>\d+)\s+(?<severity>[A-Za-z ]+)\[(?<code>[A-Za-z]+[0-9]+)\]:(?<message_start>.*)$/;
|
||||
const CODE_REGEX = /^\"(?<file>.*)\",(?<line>\d+)\s+(?<severity>[A-Za-z ]+)\[(?<code>[A-Za-z]+[0-9]+)\]:(?<message_start>.*)$/;
|
||||
|
||||
const POINTER_REGEX = /^( +)\^$/;
|
||||
|
||||
|
|
|
@ -6,8 +6,7 @@ import * as vscode from 'vscode';
|
|||
|
||||
import { oneLess, RawDiagnosticParser, FeedLineResult } from './util';
|
||||
|
||||
export const REGEX
|
||||
= /^\s*(\d+>)?\s*([^\s>].*)\((\d+|\d+,\d+|\d+,\d+,\d+,\d+)\):\s+((?:fatal )?error|warning|info)\s*(\w{1,2}\d+)?\s*:\s*(.*)$/;
|
||||
export const REGEX = /^\s*(\d+>)?\s*([^\s>].*)\((\d+|\d+,\d+|\d+,\d+,\d+,\d+)\):\s+((?:fatal )?error|warning|info)\s*(\w{1,2}\d+)?\s*:\s*(.*)$/;
|
||||
|
||||
export class Parser extends RawDiagnosticParser {
|
||||
doHandleLine(line: string) {
|
||||
|
|
15
src/dirty.ts
15
src/dirty.ts
|
@ -49,14 +49,13 @@ export class InputFileSet {
|
|||
}
|
||||
|
||||
static async create(cmake_inputs: CMakeInputsContent): Promise<InputFileSet> {
|
||||
const input_files
|
||||
= await Promise.all(util.map(util.flatMap(cmake_inputs.buildFiles, entry => entry.sources), src => {
|
||||
// Map input file paths to files relative to the source directory
|
||||
if (!path.isAbsolute(src)) {
|
||||
src = util.platformNormalizePath(path.join(cmake_inputs.sourceDirectory, src));
|
||||
}
|
||||
return InputFile.create(src);
|
||||
}));
|
||||
const input_files = await Promise.all(util.map(util.flatMap(cmake_inputs.buildFiles, entry => entry.sources), src => {
|
||||
// Map input file paths to files relative to the source directory
|
||||
if (!path.isAbsolute(src)) {
|
||||
src = util.platformNormalizePath(path.join(cmake_inputs.sourceDirectory, src));
|
||||
}
|
||||
return InputFile.create(src);
|
||||
}));
|
||||
return new InputFileSet(input_files);
|
||||
}
|
||||
|
||||
|
|
|
@ -182,8 +182,7 @@ function convertToAbsolutePath(input_path: string, base_path: string) {
|
|||
function convertToExtCodeModelFileGroup(targetObject: index_api.CodeModelKind.TargetObject,
|
||||
root_paths: index_api.CodeModelKind.PathInfo): CodeModelFileGroup[] {
|
||||
const fileGroup: CodeModelFileGroup[] = !targetObject.compileGroups ? [] : targetObject.compileGroups.map(group => {
|
||||
const compileFlags
|
||||
= group.compileCommandFragments ? group.compileCommandFragments.map(frag => frag.fragment).join(' ') : '';
|
||||
const compileFlags = group.compileCommandFragments ? group.compileCommandFragments.map(frag => frag.fragment).join(' ') : '';
|
||||
|
||||
return {
|
||||
isGenerated: false,
|
||||
|
@ -223,8 +222,7 @@ async function loadCodeModelTarget(root_paths: index_api.CodeModelKind.PathInfo,
|
|||
// each compileGroup has its separate sysroot.
|
||||
let sysroot;
|
||||
if (targetObject.compileGroups) {
|
||||
const all_sysroots
|
||||
= targetObject.compileGroups.map(x => !!x.sysroot ? x.sysroot.path : undefined).filter(x => x !== undefined);
|
||||
const all_sysroots = targetObject.compileGroups.map(x => !!x.sysroot ? x.sysroot.path : undefined).filter(x => x !== undefined);
|
||||
sysroot = all_sysroots.length !== 0 ? all_sysroots[0] : undefined;
|
||||
}
|
||||
|
||||
|
@ -269,9 +267,7 @@ export async function loadConfig(paths: index_api.CodeModelKind.PathInfo,
|
|||
export async function loadExtCodeModelContent(reply_path: string, codeModel_filename: string) {
|
||||
const codeModelContent = await loadCodeModelContent(path.join(reply_path, codeModel_filename));
|
||||
|
||||
const configurations
|
||||
= await Promise.all((codeModelContent.configurations)
|
||||
.map(config_element => loadConfig(codeModelContent.paths, reply_path, config_element)));
|
||||
const configurations = await Promise.all(codeModelContent.configurations.map(config_element => loadConfig(codeModelContent.paths, reply_path, config_element)));
|
||||
|
||||
return { configurations } as CodeModelContent;
|
||||
}
|
||||
|
|
|
@ -349,8 +349,7 @@ export class CMakeFileApiDriver extends CMakeDriver {
|
|||
filepath: 'A special target to build all available targets',
|
||||
targetType: 'META'
|
||||
}];
|
||||
return [...metaTargets, ...targets].filter((value, idx, self) => self.findIndex(e => value.name === e.name)
|
||||
=== idx);
|
||||
return [...metaTargets, ...targets].filter((value, idx, self) => self.findIndex(e => value.name === e.name) === idx);
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
|
|
|
@ -302,15 +302,12 @@ export interface CMakeCacheEntry {
|
|||
export interface CacheReply extends ReplyMessage, CacheContent { inReplyTo: 'cache' }
|
||||
|
||||
// Union type that represents any of the request types.
|
||||
export type SomeRequestMessage
|
||||
= (HandshakeRequest | GlobalSettingsRequest | SetGlobalSettingsRequest | ConfigureRequest | ComputeRequest | CodeModelRequest | CacheRequest);
|
||||
export type SomeRequestMessage = (HandshakeRequest | GlobalSettingsRequest | SetGlobalSettingsRequest | ConfigureRequest | ComputeRequest | CodeModelRequest | CacheRequest);
|
||||
|
||||
// Union type that represents a response type
|
||||
export type SomeReplyMessage
|
||||
= (HandshakeReply | GlobalSettingsReply | SetGlobalSettingsReply | ConfigureReply | ComputeReply | CodeModelReply | CacheReply);
|
||||
export type SomeReplyMessage = (HandshakeReply | GlobalSettingsReply | SetGlobalSettingsReply | ConfigureReply | ComputeReply | CodeModelReply | CacheReply);
|
||||
|
||||
export type SomeMessage
|
||||
= (SomeReplyMessage | SomeRequestMessage | ProgressMessage | ErrorMessage | MessageMessage | HelloMessage | SignalMessage);
|
||||
export type SomeMessage = (SomeReplyMessage | SomeRequestMessage | ProgressMessage | ErrorMessage | MessageMessage | HelloMessage | SignalMessage);
|
||||
|
||||
/**
|
||||
* The initial parameters when setting up the CMake client. The client init
|
||||
|
@ -558,10 +555,10 @@ export class CMakeServerClient {
|
|||
this._pipeFilePath = pipe_file;
|
||||
const final_env = util.mergeEnvironment(process.env as proc.EnvironmentVariables,
|
||||
params.environment as proc.EnvironmentVariables);
|
||||
const child
|
||||
= child_proc.spawn(params.cmakePath, ['-E', 'server', '--experimental', `--pipe=${pipe_file}`], {
|
||||
env: final_env, cwd: params.binaryDir
|
||||
});
|
||||
const child = child_proc.spawn(params.cmakePath, ['-E', 'server', '--experimental', `--pipe=${pipe_file}`], {
|
||||
env: final_env,
|
||||
cwd: params.binaryDir
|
||||
});
|
||||
log.debug(localize('started.new.cmake.server.instance', 'Started new CMake Server instance with PID {0}', child.pid));
|
||||
child.stdout.on('data', data => this._params.onOtherOutput(data.toLocaleString()));
|
||||
child.stderr.on('data', data => this._params.onOtherOutput(data.toLocaleString()));
|
||||
|
@ -631,8 +628,7 @@ export class CMakeServerClient {
|
|||
onHello: async (msg: HelloMessage) => {
|
||||
// We've gotten the hello message. We need to commense handshake
|
||||
try {
|
||||
const hsparams: HandshakeParams
|
||||
= { buildDirectory: params.binaryDir, protocolVersion: msg.supportedProtocolVersions[0] };
|
||||
const hsparams: HandshakeParams = { buildDirectory: params.binaryDir, protocolVersion: msg.supportedProtocolVersions[0] };
|
||||
|
||||
const cache_path = path.join(params.binaryDir, 'CMakeCache.txt');
|
||||
const have_cache = await fs.exists(cache_path);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { CMakeCache } from "@cmt/cache";
|
||||
|
||||
export type TargetTypeString
|
||||
= ('STATIC_LIBRARY' | 'MODULE_LIBRARY' | 'SHARED_LIBRARY' | 'OBJECT_LIBRARY' | 'EXECUTABLE' | 'UTILITY' | 'INTERFACE_LIBRARY');
|
||||
export type TargetTypeString = 'STATIC_LIBRARY' | 'MODULE_LIBRARY' | 'SHARED_LIBRARY' | 'OBJECT_LIBRARY' | 'EXECUTABLE' | 'UTILITY' | 'INTERFACE_LIBRARY';
|
||||
|
||||
/** Describes a cmake target */
|
||||
export interface CodeModelTarget {
|
||||
|
|
|
@ -1650,8 +1650,7 @@ export abstract class CMakeDriver implements vscode.Disposable {
|
|||
const args = ['--build', this.binaryDir, '--config', this.currentBuildType, '--target', ...targets]
|
||||
.concat(buildArgs, buildToolArgs);
|
||||
const opts = this.expansionOptions;
|
||||
const expanded_args_promises
|
||||
= args.map(async (value: string) => expand.expandString(value, { ...opts, envOverride: build_env }));
|
||||
const expanded_args_promises = args.map(async (value: string) => expand.expandString(value, { ...opts, envOverride: build_env }));
|
||||
const expanded_args = await Promise.all(expanded_args_promises) as string[];
|
||||
|
||||
log.trace(localize('cmake.build.args.are', 'CMake build args are: {0}', JSON.stringify(expanded_args)));
|
||||
|
@ -1671,8 +1670,7 @@ export abstract class CMakeDriver implements vscode.Disposable {
|
|||
outputEnc = 'utf8';
|
||||
}
|
||||
}
|
||||
const exeOpt: proc.ExecutionOptions
|
||||
= { environment: buildcmd.build_env, outputEncoding: outputEnc, useTask: this.config.buildTask };
|
||||
const exeOpt: proc.ExecutionOptions = { environment: buildcmd.build_env, outputEncoding: outputEnc, useTask: this.config.buildTask };
|
||||
const child = this.executeCommand(buildcmd.command, buildcmd.args, consumer, exeOpt);
|
||||
this._currentBuildProcess = child;
|
||||
await child.result;
|
||||
|
|
|
@ -61,11 +61,8 @@ export async function vsInstallations(): Promise<VSInstallation[]> {
|
|||
const vswhere_exe = path.join(thisExtensionPath(), 'res', 'vswhere.exe');
|
||||
const sys32_path = path.join(process.env.WINDIR as string, 'System32');
|
||||
|
||||
const vswhere_args =
|
||||
['/c', `${sys32_path}\\chcp 65001>nul && "${vswhere_exe}" -all -format json -utf8 -products * -legacy -prerelease`];
|
||||
const vswhere_res
|
||||
= await proc.execute(`${sys32_path}\\cmd.exe`, vswhere_args, null, { silent: true, encoding: 'utf8', shell: true })
|
||||
.result;
|
||||
const vswhere_args = ['/c', `${sys32_path}\\chcp 65001>nul && "${vswhere_exe}" -all -format json -utf8 -products * -legacy -prerelease`];
|
||||
const vswhere_res = await proc.execute(`${sys32_path}\\cmd.exe`, vswhere_args, null, { silent: true, encoding: 'utf8', shell: true }).result;
|
||||
|
||||
if (vswhere_res.retc !== 0) {
|
||||
log.error(localize('failed.to.execute', 'Failed to execute {0}: {1}', "vswhere.exe", vswhere_res.stderr));
|
||||
|
|
41
src/kit.ts
41
src/kit.ts
|
@ -48,8 +48,7 @@ export const USER_KITS_FILEPATH = path.join(paths.dataDir, 'cmake-tools-kits.jso
|
|||
/**
|
||||
* The old path where kits were stored. Upgraded in 1.1.3
|
||||
*/
|
||||
export const OLD_USER_KITS_FILEPATH
|
||||
= path.join(process.platform === 'win32' ? paths.roamingDataDir : paths.dataDir, 'cmake-tools.json');
|
||||
export const OLD_USER_KITS_FILEPATH = path.join(process.platform === 'win32' ? paths.roamingDataDir : paths.dataDir, 'cmake-tools.json');
|
||||
|
||||
/**
|
||||
* Representation of a CMake generator, along with a toolset and platform
|
||||
|
@ -765,16 +764,15 @@ async function collectDevBatVars(hostArch: string, devbat: string, args: string[
|
|||
env = '';
|
||||
}
|
||||
|
||||
const vars
|
||||
= env.split('\n').map(l => l.trim()).filter(l => l.length !== 0).reduce<Map<string, string>>((acc, line) => {
|
||||
const mat = /(\w+) := ?(.*)/.exec(line);
|
||||
if (mat) {
|
||||
acc.set(mat[1], mat[2]);
|
||||
} else {
|
||||
log.error(localize('error.parsing.environment', 'Error parsing environment variable: {0}', line));
|
||||
}
|
||||
return acc;
|
||||
}, new Map());
|
||||
const vars = env.split('\n').map(l => l.trim()).filter(l => l.length !== 0).reduce<Map<string, string>>((acc, line) => {
|
||||
const mat = /(\w+) := ?(.*)/.exec(line);
|
||||
if (mat) {
|
||||
acc.set(mat[1], mat[2]);
|
||||
} else {
|
||||
log.error(localize('error.parsing.environment', 'Error parsing environment variable: {0}', line));
|
||||
}
|
||||
return acc;
|
||||
}, new Map());
|
||||
const include_env = vars.get('INCLUDE') ?? '';
|
||||
if (include_env === '') {
|
||||
log.error(localize('script.run.error.check',
|
||||
|
@ -882,16 +880,15 @@ export async function getShellScriptEnvironment(kit: Kit, opts?: expand.Expansio
|
|||
}
|
||||
|
||||
// split and trim env vars
|
||||
const vars
|
||||
= env.split('\n').map(l => l.trim()).filter(l => l.length !== 0).reduce<Map<string, string>>((acc, line) => {
|
||||
const match = /(\w+)=?(.*)/.exec(line);
|
||||
if (match) {
|
||||
acc.set(match[1], match[2]);
|
||||
} else {
|
||||
log.error(localize('error.parsing.environment', 'Error parsing environment variable: {0}', line));
|
||||
}
|
||||
return acc;
|
||||
}, new Map());
|
||||
const vars = env.split('\n').map(l => l.trim()).filter(l => l.length !== 0).reduce<Map<string, string>>((acc, line) => {
|
||||
const match = /(\w+)=?(.*)/.exec(line);
|
||||
if (match) {
|
||||
acc.set(match[1], match[2]);
|
||||
} else {
|
||||
log.error(localize('error.parsing.environment', 'Error parsing environment variable: {0}', line));
|
||||
}
|
||||
return acc;
|
||||
}, new Map());
|
||||
log.debug(localize('ok.running', 'OK running {0}, env vars: {1}', kit.environmentSetupScript, JSON.stringify([...vars])));
|
||||
return vars;
|
||||
}
|
||||
|
|
|
@ -153,8 +153,7 @@ export class DirectoryNode<Node extends BaseNode> extends BaseNode {
|
|||
const ret: BaseNode[] = [];
|
||||
const subdirs = [...this._subdirs.values()].sort((a, b) => a.pathPart.localeCompare(b.pathPart));
|
||||
ret.push(...subdirs);
|
||||
const leaves =
|
||||
[...this._leaves.values()].sort((a, b) => lexicographicalCompare(a.getOrderTuple(), b.getOrderTuple()));
|
||||
const leaves = [...this._leaves.values()].sort((a, b) => lexicographicalCompare(a.getOrderTuple(), b.getOrderTuple()));
|
||||
ret.push(...leaves);
|
||||
return ret;
|
||||
}
|
||||
|
@ -310,8 +309,7 @@ export class TargetNode extends BaseNode {
|
|||
dark: path.join(thisExtension().extensionPath, "res/dark", icon)
|
||||
};
|
||||
item.id = this.id;
|
||||
const canBuild
|
||||
= this._type !== 'INTERFACE_LIBRARY' && this._type !== 'UTILITY' && this._type !== 'OBJECT_LIBRARY';
|
||||
const canBuild = this._type !== 'INTERFACE_LIBRARY' && this._type !== 'UTILITY' && this._type !== 'OBJECT_LIBRARY';
|
||||
const canRun = this._type === 'UTILITY';
|
||||
item.contextValue = [
|
||||
`nodeType=target`,
|
||||
|
|
Загрузка…
Ссылка в новой задаче