修改启动子进程工作区 | 添加 digital-ide.tool.clean 指令
This commit is contained in:
parent
f1b79b92d3
commit
55d3d8c915
@ -59,5 +59,6 @@
|
||||
"info.dide-doc.no-port-info": "Keine Portinformationen",
|
||||
"info.dide-doc.no-dep-info": "Keine Abhängigkeitsinformationen",
|
||||
"info.dide-doc.source.cannot-find": "Nicht gefunden",
|
||||
"info.command.instantiation.pick-title": "Select a Module"
|
||||
"info.command.instantiation.pick-title": "Select a Module",
|
||||
"warn.command.clean.prjPath-is-workspace": "arch.prjPath is the same as the workspace path, the clean will delete the project, please check your arch.prjPath!"
|
||||
}
|
@ -59,5 +59,6 @@
|
||||
"info.dide-doc.no-port-info": "No port information",
|
||||
"info.dide-doc.no-dep-info": "No dependency information",
|
||||
"info.dide-doc.source.cannot-find": "Cannot find",
|
||||
"info.command.instantiation.pick-title": "Select a Module"
|
||||
"info.command.instantiation.pick-title": "Select a Module",
|
||||
"warn.command.clean.prjPath-is-workspace": "arch.prjPath is the same as the workspace path, the clean will delete the project, please check your arch.prjPath!"
|
||||
}
|
@ -59,5 +59,6 @@
|
||||
"info.dide-doc.no-port-info": "ポート情報がありません",
|
||||
"info.dide-doc.no-dep-info": "依存情報がありません",
|
||||
"info.dide-doc.source.cannot-find": "見つかりません",
|
||||
"info.command.instantiation.pick-title": "Select a Module"
|
||||
"info.command.instantiation.pick-title": "Select a Module",
|
||||
"warn.command.clean.prjPath-is-workspace": "arch.prjPath is the same as the workspace path, the clean will delete the project, please check your arch.prjPath!"
|
||||
}
|
@ -59,5 +59,6 @@
|
||||
"info.dide-doc.no-port-info": "没有端口信息",
|
||||
"info.dide-doc.no-dep-info": "没有依赖信息",
|
||||
"info.dide-doc.source.cannot-find": "无法找到",
|
||||
"info.command.instantiation.pick-title": "选择一个模块"
|
||||
"info.command.instantiation.pick-title": "选择一个模块",
|
||||
"warn.command.clean.prjPath-is-workspace": "arch.prjPath 和当前的工作区目录相同, clean 功能可能会删除整个项目,请检查你的 arch.prjPath !"
|
||||
}
|
@ -59,5 +59,6 @@
|
||||
"info.dide-doc.no-port-info": "沒有端口信息",
|
||||
"info.dide-doc.no-dep-info": "沒有依賴信息",
|
||||
"info.dide-doc.source.cannot-find": "無法找到",
|
||||
"info.command.instantiation.pick-title": "Select a Module"
|
||||
"info.command.instantiation.pick-title": "Select a Module",
|
||||
"warn.command.clean.prjPath-is-workspace": "arch.prjPath is the same as the workspace path, the clean will delete the project, please check your arch.prjPath!"
|
||||
}
|
@ -592,6 +592,11 @@
|
||||
},
|
||||
"category": "Digital-IDE",
|
||||
"title": "%digital-ide.waveviewer.show.title%"
|
||||
},
|
||||
{
|
||||
"command": "digital-ide.tool.clean",
|
||||
"category": "Digital-IDE",
|
||||
"title": "%digital-ide.tool.clean.title%"
|
||||
}
|
||||
],
|
||||
"menus": {
|
||||
|
@ -22,7 +22,6 @@ import { hdlPath } from '../hdlFs';
|
||||
import { LspClient, opeParam } from '../global';
|
||||
import { DoFastToolChainType, SyncFastRequestType } from '../global/lsp';
|
||||
import { makeDocBody } from './hdlDoc/html';
|
||||
import { State } from 'vscode-languageclient';
|
||||
|
||||
function registerDocumentation(context: vscode.ExtensionContext) {
|
||||
vscode.commands.registerCommand('digital-ide.hdlDoc.showWebview', async (uri: vscode.Uri) => {
|
||||
@ -92,6 +91,7 @@ function registerTreeView(context: vscode.ExtensionContext) {
|
||||
vscode.commands.registerCommand('digital-ide.treeView.arch.collapse', treeView.collapseTreeView);
|
||||
vscode.commands.registerCommand('digital-ide.treeView.arch.refresh', treeView.refreshArchTree);
|
||||
vscode.commands.registerCommand('digital-ide.treeView.arch.openFile', treeView.openFileByUri);
|
||||
vscode.commands.registerCommand('digital-ide.tool.clean', treeView.clean);
|
||||
}
|
||||
|
||||
function registerLsp(context: vscode.ExtensionContext, version: string) {
|
||||
|
@ -6,6 +6,7 @@ import { MainOutput, opeParam } from '../../global';
|
||||
import { hdlDir, hdlFile, hdlPath } from '../../hdlFs';
|
||||
import { getIconConfig } from '../../hdlFs/icons';
|
||||
import { hdlIgnore } from '../../manager/ignore';
|
||||
import { t } from '../../i18n';
|
||||
|
||||
interface CommandDataItem {
|
||||
name: string,
|
||||
@ -191,18 +192,16 @@ class ToolTreeProvider extends BaseCommandTreeProvider {
|
||||
}
|
||||
};
|
||||
super(config, 'TOOL');
|
||||
|
||||
vscode.commands.registerCommand('digital-ide.tool.clean', this.clean);
|
||||
}
|
||||
|
||||
public async clean() {
|
||||
const workspacePath = opeParam.workspacePath;
|
||||
const prjPath = opeParam.prjStructure.prjPath;
|
||||
|
||||
// move bd * ip
|
||||
const plName = opeParam.prjInfo.prjName.PL;
|
||||
const targetPath = fspath.dirname(opeParam.prjInfo.arch.hardware.src);
|
||||
|
||||
// TODO: 适配更多的 toolChain
|
||||
const sourceIpPath = `${workspacePath}/prj/xilinx/${plName}.srcs/sources_1/ip`;
|
||||
const sourceBdPath = `${workspacePath}/prj/xilinx/${plName}.srcs/sources_1/bd`;
|
||||
|
||||
@ -212,32 +211,75 @@ class ToolTreeProvider extends BaseCommandTreeProvider {
|
||||
hdlDir.mvdir(sourceBdPath, targetPath, true);
|
||||
MainOutput.report("move dir from " + sourceBdPath + " to " + targetPath);
|
||||
|
||||
// if (prjPath !== opeParam.workspacePath) {
|
||||
// hdlDir.rmdir(prjPath);
|
||||
// hdlDir.rmdir(xilFolder);
|
||||
// MainOutput.report("remove dir : " + prjPath);
|
||||
// MainOutput.report("remove dir : " + xilFolder);
|
||||
// } else {
|
||||
// vscode.window.showWarningMessage("arch.prjPath is the same as the workspace path, the clean will delete the project, please check your arch.prjPath!");
|
||||
// }
|
||||
if (prjPath !== opeParam.workspacePath) {
|
||||
hdlDir.rmdir(prjPath);
|
||||
const xilFolder = hdlPath.join(opeParam.workspacePath, '.Xil');
|
||||
hdlDir.rmdir(xilFolder);
|
||||
MainOutput.report("remove dir : " + prjPath);
|
||||
MainOutput.report("remove dir : " + xilFolder);
|
||||
} else {
|
||||
vscode.window.showWarningMessage(t('warn.command.clean.prjPath-is-workspace'));
|
||||
}
|
||||
|
||||
// const ignores = hdlIgnore.getIgnoreFiles();
|
||||
// const strFiles = hdlFile.pickFileRecursive(workspacePath, ignores, p => p.endsWith('.str'));
|
||||
// for (const path of strFiles) {
|
||||
// hdlFile.removeFile(path);
|
||||
// MainOutput.report("remove file " + path);
|
||||
// }
|
||||
const ignores = hdlIgnore.getIgnoreFiles();
|
||||
const strFiles = hdlFile.pickFileRecursive(workspacePath, ignores, p => p.endsWith('.str'));
|
||||
for (const path of strFiles) {
|
||||
hdlFile.removeFile(path);
|
||||
MainOutput.report("remove file " + path);
|
||||
}
|
||||
|
||||
// const logFiles = hdlFile.pickFileRecursive(workspacePath, ignores, p => p.endsWith('.log'));
|
||||
// for (const path of logFiles) {
|
||||
// hdlFile.readFile(path);
|
||||
// }
|
||||
const logFiles = hdlFile.pickFileRecursive(workspacePath, ignores, p => p.endsWith('.log'));
|
||||
for (const path of logFiles) {
|
||||
hdlFile.readFile(path);
|
||||
}
|
||||
|
||||
MainOutput.report('finish digital-ide.tool.clean');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export async function clean() {
|
||||
const workspacePath = opeParam.workspacePath;
|
||||
const prjPath = opeParam.prjStructure.prjPath;
|
||||
|
||||
// move bd * ip
|
||||
const plName = opeParam.prjInfo.prjName.PL;
|
||||
const targetPath = fspath.dirname(opeParam.prjInfo.arch.hardware.src);
|
||||
|
||||
const sourceIpPath = `${workspacePath}/prj/xilinx/${plName}.srcs/sources_1/ip`;
|
||||
const sourceBdPath = `${workspacePath}/prj/xilinx/${plName}.srcs/sources_1/bd`;
|
||||
|
||||
hdlDir.mvdir(sourceIpPath, targetPath, true);
|
||||
MainOutput.report("move dir from " + sourceIpPath + " to " + targetPath);
|
||||
|
||||
hdlDir.mvdir(sourceBdPath, targetPath, true);
|
||||
MainOutput.report("move dir from " + sourceBdPath + " to " + targetPath);
|
||||
|
||||
if (prjPath !== opeParam.workspacePath) {
|
||||
hdlDir.rmdir(prjPath);
|
||||
const xilFolder = hdlPath.join(opeParam.workspacePath, '.Xil');
|
||||
hdlDir.rmdir(xilFolder);
|
||||
MainOutput.report("remove dir : " + prjPath);
|
||||
MainOutput.report("remove dir : " + xilFolder);
|
||||
} else {
|
||||
vscode.window.showWarningMessage(t('warn.command.clean.prjPath-is-workspace'));
|
||||
}
|
||||
|
||||
const ignores = hdlIgnore.getIgnoreFiles();
|
||||
const strFiles = hdlFile.pickFileRecursive(workspacePath, ignores, p => p.endsWith('.str'));
|
||||
for (const path of strFiles) {
|
||||
hdlFile.removeFile(path);
|
||||
MainOutput.report("remove file " + path);
|
||||
}
|
||||
|
||||
const logFiles = hdlFile.pickFileRecursive(workspacePath, ignores, p => p.endsWith('.log'));
|
||||
for (const path of logFiles) {
|
||||
hdlFile.readFile(path);
|
||||
}
|
||||
|
||||
MainOutput.report('finish digital-ide.tool.clean');
|
||||
}
|
||||
|
||||
|
||||
const hardwareTreeProvider = new HardwareTreeProvider();
|
||||
const softwareTreeProvider = new SoftwareTreeProvider();
|
||||
|
@ -3,7 +3,7 @@ import * as fs from 'fs';
|
||||
import * as fspath from 'path';
|
||||
import { hdlFile, hdlPath } from '../../hdlFs';
|
||||
|
||||
import { hardwareTreeProvider, softwareTreeProvider, toolTreeProvider } from './command';
|
||||
import { clean, hardwareTreeProvider, softwareTreeProvider, toolTreeProvider } from './command';
|
||||
import { moduleTreeProvider, ModuleDataItem } from './tree';
|
||||
import { Range } from '../../hdlParser/common';
|
||||
import { MainOutput, opeParam, ReportType } from '../../global';
|
||||
@ -90,5 +90,6 @@ export {
|
||||
expandTreeView,
|
||||
collapseTreeView,
|
||||
openFileByUri,
|
||||
refreshArchTree
|
||||
refreshArchTree,
|
||||
clean
|
||||
};
|
@ -187,9 +187,13 @@ class XilinxOperation {
|
||||
_this.onVivadoClose();
|
||||
}, 100);
|
||||
|
||||
function launchScript(): Promise<ChildProcessWithoutNullStreams> {
|
||||
function launchScript(): Promise<ChildProcessWithoutNullStreams | undefined> {
|
||||
if (!opeParam.workspacePath) {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
// 执行 cmd 启动
|
||||
const vivadoProcess = spawn(cmd, [], { shell: true, stdio: 'pipe' });
|
||||
console.log('spawn process in ', opeParam.workspacePath);
|
||||
const vivadoProcess = spawn(cmd, [], { shell: true, stdio: 'pipe', cwd: opeParam.workspacePath });
|
||||
|
||||
vivadoProcess.on('close', () => {
|
||||
onVivadoClose();
|
||||
|
Loading…
x
Reference in New Issue
Block a user