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