fix convert xilinx to std
This commit is contained in:
parent
f372aa4db0
commit
9fe382446b
@ -14,8 +14,8 @@ import { hdlIgnore } from './ignore';
|
|||||||
import { hdlMonitor } from '../monitor';
|
import { hdlMonitor } from '../monitor';
|
||||||
import { t } from '../i18n';
|
import { t } from '../i18n';
|
||||||
import { PpyAction } from '../monitor/propery';
|
import { PpyAction } from '../monitor/propery';
|
||||||
import { checkJson, readJSON } from '../hdlFs/file';
|
import { checkJson, readJSON, writeJSON } from '../hdlFs/file';
|
||||||
|
import { PropertySchema } from '../global/propertySchema';
|
||||||
|
|
||||||
interface RefreshPrjConfig {
|
interface RefreshPrjConfig {
|
||||||
mkdir: boolean
|
mkdir: boolean
|
||||||
@ -36,7 +36,7 @@ class PrjManage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const cachePPy = hdlPath.join(opeParam.dideHome, 'property-init.json');
|
const cachePPy = hdlPath.join(opeParam.dideHome, 'property-init.json');
|
||||||
const propertyInitPath = fs.existsSync(cachePPy) ? cachePPy: opeParam.propertyInitPath;
|
const propertyInitPath = fs.existsSync(cachePPy) ? cachePPy : opeParam.propertyInitPath;
|
||||||
|
|
||||||
const template = hdlFile.readJSON(propertyInitPath) as RawPrjInfo;
|
const template = hdlFile.readJSON(propertyInitPath) as RawPrjInfo;
|
||||||
hdlFile.writeJSON(opeParam.propertyJsonPath, template);
|
hdlFile.writeJSON(opeParam.propertyJsonPath, template);
|
||||||
@ -88,14 +88,14 @@ class PrjManage {
|
|||||||
const propertyInitPath = hdlPath.join(extensionPath, 'project', 'property-init.json');
|
const propertyInitPath = hdlPath.join(extensionPath, 'project', 'property-init.json');
|
||||||
|
|
||||||
opeParam.setBasicInfo(os,
|
opeParam.setBasicInfo(os,
|
||||||
extensionPath,
|
extensionPath,
|
||||||
workspacePath,
|
workspacePath,
|
||||||
propertyJsonPath,
|
propertyJsonPath,
|
||||||
propertySchemaPath,
|
propertySchemaPath,
|
||||||
propertyInitPath);
|
propertyInitPath);
|
||||||
|
|
||||||
opeParam.prjInfo.initContextPath(extensionPath, workspacePath);
|
opeParam.prjInfo.initContextPath(extensionPath, workspacePath);
|
||||||
const refreshPrjConfig: RefreshPrjConfig = {mkdir: true};
|
const refreshPrjConfig: RefreshPrjConfig = { mkdir: true };
|
||||||
if (fs.existsSync(propertyJsonPath)) {
|
if (fs.existsSync(propertyJsonPath)) {
|
||||||
const rawPrjInfo = hdlFile.readJSON(propertyJsonPath) as RawPrjInfo;
|
const rawPrjInfo = hdlFile.readJSON(propertyJsonPath) as RawPrjInfo;
|
||||||
opeParam.mergePrjInfo(rawPrjInfo);
|
opeParam.mergePrjInfo(rawPrjInfo);
|
||||||
@ -145,7 +145,7 @@ class PrjManage {
|
|||||||
searchPathSet.checkAdd(prjInfo.getLibraryCustomPaths());
|
searchPathSet.checkAdd(prjInfo.getLibraryCustomPaths());
|
||||||
}
|
}
|
||||||
|
|
||||||
const reportMsg = ['', ... searchPathSet.files].join('\n\t');
|
const reportMsg = ['', ...searchPathSet.files].join('\n\t');
|
||||||
MainOutput.report(t('info.launch.search-and-parse') + reportMsg, {
|
MainOutput.report(t('info.launch.search-and-parse') + reportMsg, {
|
||||||
level: ReportType.Run
|
level: ReportType.Run
|
||||||
});
|
});
|
||||||
@ -331,9 +331,9 @@ class PrjManage {
|
|||||||
workspace: string,
|
workspace: string,
|
||||||
plname: string
|
plname: string
|
||||||
) {
|
) {
|
||||||
const xilinxPL = plname + '.srcs';
|
const xilinxPL = [plname + '.srcs', plname + '.gen'];
|
||||||
const xilinxPS = plname + '.sdk';
|
const xilinxPS = [plname + '.sdk'];
|
||||||
const ignores = ['user', 'prj', '.vscode', xilinxPL, xilinxPS];
|
const ignores = ['user', 'prj', '.vscode'].concat(xilinxPL, xilinxPS);
|
||||||
hdlDir.rmdir(hdlPath.join(workspace, '.Xil'));
|
hdlDir.rmdir(hdlPath.join(workspace, '.Xil'));
|
||||||
for (const file of fs.readdirSync(workspace)) {
|
for (const file of fs.readdirSync(workspace)) {
|
||||||
// 排除标准文件夹
|
// 排除标准文件夹
|
||||||
@ -387,7 +387,6 @@ class PrjManage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 搬移 Xilinx 项目中的 IP
|
* @description 搬移 Xilinx 项目中的 IP
|
||||||
*
|
*
|
||||||
@ -529,6 +528,19 @@ class PrjManage {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const xprContext = hdlFile.readFile(hdlPath.join(opeParam.workspacePath, xprfile)) || '';
|
||||||
|
const deviceRegExp = new RegExp([
|
||||||
|
/<Option\s+Name=\"Part\"\s+/,
|
||||||
|
/Val=\"(?<name>.+)\"\/>/
|
||||||
|
].map(x => (typeof x === 'string') ? x : x.source).join(''), 'mg');
|
||||||
|
|
||||||
|
const deviceMatch = deviceRegExp.exec(xprContext);
|
||||||
|
if (deviceMatch == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const deviceInfo = deviceMatch.groups?.name || '';
|
||||||
|
|
||||||
const plname = xprfile.slice(0, -4);
|
const plname = xprfile.slice(0, -4);
|
||||||
const workspacePath = opeParam.workspacePath;
|
const workspacePath = opeParam.workspacePath;
|
||||||
|
|
||||||
@ -569,6 +581,7 @@ class PrjManage {
|
|||||||
|
|
||||||
// 删除原本的项目文件夹 ${workspace}/${plname}.srcs 和 ${workspace}/${plname}.sdk
|
// 删除原本的项目文件夹 ${workspace}/${plname}.srcs 和 ${workspace}/${plname}.sdk
|
||||||
hdlDir.rmdir(hdlPath.join(workspacePath, plname + '.srcs'));
|
hdlDir.rmdir(hdlPath.join(workspacePath, plname + '.srcs'));
|
||||||
|
hdlDir.rmdir(hdlPath.join(workspacePath, plname + '.gen'));
|
||||||
hdlDir.rmdir(hdlPath.join(workspacePath, plname + '.sdk'));
|
hdlDir.rmdir(hdlPath.join(workspacePath, plname + '.sdk'));
|
||||||
|
|
||||||
// 创建 property.json
|
// 创建 property.json
|
||||||
@ -577,33 +590,23 @@ class PrjManage {
|
|||||||
PL: plname
|
PL: plname
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ppyTemplate.device = deviceInfo;
|
||||||
hdlFile.writeJSON(opeParam.propertyJsonPath, ppyTemplate);
|
hdlFile.writeJSON(opeParam.propertyJsonPath, ppyTemplate);
|
||||||
|
|
||||||
|
const propertyParam = hdlFile.readJSON(opeParam.propertySchemaPath) as PropertySchema;
|
||||||
|
|
||||||
|
// 同步到缓存中
|
||||||
|
if (!propertyParam.properties.device.enum.includes(deviceInfo)) {
|
||||||
|
const dideHome = opeParam.dideHome;
|
||||||
|
const cachePPy = hdlPath.join(dideHome, 'property-schema.json');
|
||||||
|
propertyParam.properties.device.enum.push(deviceInfo);
|
||||||
|
hdlFile.writeJSON(opeParam.propertySchemaPath, propertyParam);
|
||||||
|
hdlFile.writeJSON(cachePPy, propertyParam);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const res = await vscode.window.showInformationMessage(
|
// 直接重启vscode
|
||||||
t('info.command.structure.reload-vscode'),
|
await vscode.commands.executeCommand('workbench.action.reloadWindow');
|
||||||
{ title: t('info.common.confirm'), value: true }
|
|
||||||
);
|
|
||||||
|
|
||||||
if (res?.value) {
|
|
||||||
await vscode.commands.executeCommand('workbench.action.reloadWindow');
|
|
||||||
}
|
|
||||||
|
|
||||||
// await vscode.window.withProgress({
|
|
||||||
// location: vscode.ProgressLocation.Window,
|
|
||||||
// title: t('info.progress.initialization')
|
|
||||||
// }, async (progress: vscode.Progress<IProgress>, token: vscode.CancellationToken) => {
|
|
||||||
// hdlParam.clear();
|
|
||||||
|
|
||||||
// // 初始化解析
|
|
||||||
// await this.initialise(context, progress, false);
|
|
||||||
|
|
||||||
// // 刷新结构树
|
|
||||||
// refreshArchTree();
|
|
||||||
|
|
||||||
// // 启动监视器
|
|
||||||
// hdlMonitor.start();
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user