Подготовить автономную сборку и запуск перед разделением проектов
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
const path = require('path');
|
||||
const vscode = require('vscode');
|
||||
const {resolvePython, pyenvEnvironment} = require('./runtime');
|
||||
const {resolvePython, pyenvEnvironment, resolveSdkRoot} = require('./runtime');
|
||||
const {projectForLaunch, isSprinterMakefile, taskLabel, makeCommand} =
|
||||
require('./build');
|
||||
|
||||
@@ -13,10 +13,9 @@ class SprinterAdapterFactory {
|
||||
const settings = vscode.workspace.getConfiguration('sprinterDebugger');
|
||||
const folder = session.workspaceFolder || vscode.workspace.workspaceFolders?.[0];
|
||||
const configured = session.configuration.adapterPath;
|
||||
if (!configured && !folder) {
|
||||
throw new Error('Откройте workspace C-Compiler или задайте adapterPath');
|
||||
}
|
||||
const adapter = configured || path.join(folder.uri.fsPath, 'toolchain', 'sdbg_dap.py');
|
||||
const sdk = configured ? null : resolveSdkRoot(
|
||||
settings.get('sdkRoot'), folder?.uri.fsPath);
|
||||
const adapter = configured || path.join(sdk, 'toolchain', 'sdbg_dap.py');
|
||||
const runtime = resolvePython({
|
||||
command: settings.get('pythonCommand', 'auto'),
|
||||
args: settings.get('pythonArguments', []),
|
||||
@@ -45,8 +44,10 @@ class SprinterTaskProvider {
|
||||
const definition = definitionOverride ||
|
||||
{type: 'sprinter', project: relative || '.'};
|
||||
const options = {cwd: project};
|
||||
const env = pyenvEnvironment(runtime.command, project) ||
|
||||
pyenvEnvironment(runtime.command, folder.uri.fsPath);
|
||||
const sdk = resolveSdkRoot(settings.get('sdkRoot'), folder.uri.fsPath);
|
||||
const env = {SPRINTER_ROOT: sdk, ...(
|
||||
pyenvEnvironment(runtime.command, project) ||
|
||||
pyenvEnvironment(runtime.command, folder.uri.fsPath) || {})};
|
||||
if (env) options.env = env;
|
||||
const task = new vscode.Task(
|
||||
definition, folder, taskLabel(project, folder.uri.fsPath), 'sprinter',
|
||||
@@ -134,6 +135,9 @@ class SprinterConfigurationProvider {
|
||||
const workspace = folder?.uri.fsPath ||
|
||||
vscode.workspace.workspaceFolders?.[0]?.uri.fsPath;
|
||||
if (!workspace) return configuration;
|
||||
const mameHome = vscode.workspace.getConfiguration('sprinterDebugger')
|
||||
.get('mameHome');
|
||||
if (!configuration.mameHome && mameHome) configuration.mameHome = mameHome;
|
||||
try {
|
||||
const project = projectForLaunch(configuration, workspace);
|
||||
if (project && isSprinterMakefile(path.join(project, 'Makefile'))) {
|
||||
|
||||
Reference in New Issue
Block a user