#fix bug of libPick
This commit is contained in:
parent
bf91a08b17
commit
554897eb0b
@ -60,6 +60,9 @@ async function launch(context: vscode.ExtensionContext) {
|
||||
// await vlogFast("e:/Project/Digial-IDE/TestWs/simulate/user/sim/tb_file/scc018ug_hd_rvt.v");
|
||||
|
||||
console.log(hdlParam);
|
||||
console.log(opeParam.prjInfo.library.hardware.common);
|
||||
console.log(opeParam.prjInfo.library.hardware.custom);
|
||||
|
||||
|
||||
MainOutput.report('Digital-IDE has launched, Version: 0.3.0');
|
||||
MainOutput.report('OS: ' + opeParam.os);
|
||||
|
@ -166,6 +166,7 @@ class OpeParam {
|
||||
*/
|
||||
public getUserPrjInfo(): PrjInfo {
|
||||
const userPrjInfo = new PrjInfo();
|
||||
userPrjInfo.initContextPath(this.extensionPath, this.workspacePath);
|
||||
const rawPrjInfo = this.getRawUserPrjInfo();
|
||||
userPrjInfo.merge(rawPrjInfo);
|
||||
return userPrjInfo;
|
||||
|
@ -24,44 +24,61 @@ type PrjInfoMeta = Record<keyof PrjInfoSchema, any>;
|
||||
type RawPrjInfoMeta = OptionalPickType<PrjInfoMeta>;
|
||||
|
||||
const PrjInfoDefaults: PrjInfoMeta = {
|
||||
toolChain: ToolChainType.Xilinx,
|
||||
|
||||
prjName: {
|
||||
PL: 'template',
|
||||
PS: 'template'
|
||||
get toolChain() {
|
||||
return ToolChainType.Xilinx;
|
||||
},
|
||||
|
||||
IP_REPO: [],
|
||||
|
||||
soc: {
|
||||
core: '',
|
||||
bd: '',
|
||||
os: '',
|
||||
app: ''
|
||||
get prjName() {
|
||||
return {
|
||||
PL: 'template',
|
||||
PS: 'template'
|
||||
};
|
||||
},
|
||||
|
||||
enableShowLog: false,
|
||||
device: 'none',
|
||||
|
||||
arch: {
|
||||
prjPath: '',
|
||||
hardware: {
|
||||
src: '',
|
||||
sim: '',
|
||||
data: ''
|
||||
},
|
||||
software: {
|
||||
src: '',
|
||||
data: ''
|
||||
}
|
||||
get IP_REPO() {
|
||||
return [];
|
||||
},
|
||||
|
||||
library: {
|
||||
state: LibraryState.Unknown,
|
||||
hardware: {
|
||||
common: [],
|
||||
custom: []
|
||||
}
|
||||
get soc() {
|
||||
return {
|
||||
core: '',
|
||||
bd: '',
|
||||
os: '',
|
||||
app: ''
|
||||
};
|
||||
},
|
||||
|
||||
get enableShowLog() {
|
||||
return false;
|
||||
}
|
||||
|
||||
get device() {
|
||||
return 'none';
|
||||
},
|
||||
|
||||
get arch() {
|
||||
return {
|
||||
prjPath: '',
|
||||
hardware: {
|
||||
src: '',
|
||||
sim: '',
|
||||
data: ''
|
||||
},
|
||||
software: {
|
||||
src: '',
|
||||
data: ''
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
get library() {
|
||||
return {
|
||||
state: LibraryState.Unknown,
|
||||
hardware: {
|
||||
common: [],
|
||||
custom: []
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
@ -250,7 +267,8 @@ class PrjInfo implements PrjInfoMeta {
|
||||
public updatePathWisely<T extends string>(obj: Record<T, AbsPath | AbsPath[]>,
|
||||
attr: T,
|
||||
path?: Path | Path[],
|
||||
root?: AbsPath) {
|
||||
root?: AbsPath,
|
||||
defaultPath: Path | Path[] = '') {
|
||||
if (path) {
|
||||
if (path instanceof Array) {
|
||||
const actualPaths = [];
|
||||
@ -268,7 +286,7 @@ class PrjInfo implements PrjInfoMeta {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
obj[attr] = '';
|
||||
obj[attr] = defaultPath;
|
||||
}
|
||||
}
|
||||
|
||||
@ -409,14 +427,22 @@ class PrjInfo implements PrjInfoMeta {
|
||||
} else {
|
||||
this._library.state = library.state;
|
||||
}
|
||||
} else {
|
||||
this._library.state = library.state;
|
||||
}
|
||||
if (library.hardware) {
|
||||
// TODO : finish this when you can acquire root of common and custom
|
||||
const commonPath = this.libCommonPath;
|
||||
const customPath = this.libCustomPath;
|
||||
this.updatePathWisely(this.library.hardware, 'common', library.hardware.common, commonPath);
|
||||
this.updatePathWisely(this.library.hardware, 'custom', library.hardware.custom, customPath);
|
||||
this.library.hardware.common = library.hardware.common ? library.hardware.common : [];
|
||||
// this.updatePathWisely(this.library.hardware, 'common', library.hardware.common, commonPath, []);
|
||||
this.updatePathWisely(this.library.hardware, 'custom', library.hardware.custom, customPath, []);
|
||||
|
||||
} else {
|
||||
this._library.hardware = library.hardware;
|
||||
}
|
||||
} else {
|
||||
this._library.hardware = PrjInfoDefaults.library.hardware;
|
||||
this._library.state = PrjInfoDefaults.library.state;
|
||||
}
|
||||
}
|
||||
|
||||
@ -479,7 +505,7 @@ class PrjInfo implements PrjInfoMeta {
|
||||
public get libCommonPath(): AbsPath {
|
||||
const libPath = join(this._extensionPath, 'lib', 'common');
|
||||
if (!fs.existsSync(libPath)) {
|
||||
vscode.window.showErrorMessage('common lib path in extension is invalid, maybe extension has been corrupted, reinstall the extension');
|
||||
vscode.window.showErrorMessage('common lib path: "' + libPath + '" in extension is invalid, maybe extension has been corrupted, reinstall the extension');
|
||||
}
|
||||
return libPath;
|
||||
}
|
||||
|
@ -24,6 +24,9 @@ class LibPick {
|
||||
constructor () {
|
||||
this.commonPath = opeParam.prjInfo.libCommonPath;
|
||||
this.customPath = opeParam.prjInfo.libCustomPath;
|
||||
if (!this.customPath) {
|
||||
this.customPath = 'no custom path is defined, see Prj->Lib->Custom->Path';
|
||||
}
|
||||
|
||||
this.commonQuickPickItem = {
|
||||
label: "$(libpick-common) common",
|
||||
@ -177,9 +180,9 @@ class LibPick {
|
||||
}
|
||||
}
|
||||
|
||||
function pickLibrary() {
|
||||
async function pickLibrary() {
|
||||
const picker = new LibPick();
|
||||
picker.pickItems();
|
||||
await picker.pickItems();
|
||||
}
|
||||
|
||||
export {
|
||||
|
@ -107,7 +107,6 @@ class PrjManage {
|
||||
searchPathSet.checkAdd(prjInfo.getLibraryCommonPaths());
|
||||
searchPathSet.checkAdd(prjInfo.getLibraryCustomPaths());
|
||||
|
||||
|
||||
MainOutput.report('<getPrjHardwareFiles> search folders: ', ReportType.Debug);
|
||||
searchPathSet.files.forEach(p => MainOutput.report(p, ReportType.Debug));
|
||||
|
||||
|
@ -167,10 +167,14 @@ class PpyAction extends BaseAction {
|
||||
// get path set from opeParam that used to tell if need to remake HdlMonitor
|
||||
private getImportantPathSet(): Set<AbsPath | RelPath> {
|
||||
const pathSet = new Set<AbsPath | RelPath>();
|
||||
pathSet.add(opeParam.prjInfo.arch.hardware.sim);
|
||||
pathSet.add(opeParam.prjInfo.arch.hardware.src);
|
||||
pathSet.add(opeParam.prjInfo.libCommonPath);
|
||||
pathSet.add(opeParam.prjInfo.libCustomPath);
|
||||
pathSet.add(opeParam.prjInfo.hardwareSimPath);
|
||||
pathSet.add(opeParam.prjInfo.hardwareSrcPath);
|
||||
for (const path of opeParam.prjInfo.getLibraryCommonPaths()) {
|
||||
pathSet.add(path);
|
||||
}
|
||||
for (const path of opeParam.prjInfo.getLibraryCustomPaths()) {
|
||||
pathSet.add(path);
|
||||
}
|
||||
return pathSet;
|
||||
}
|
||||
|
||||
@ -182,6 +186,8 @@ class PpyAction extends BaseAction {
|
||||
opeParam.mergePrjInfo(rawPrjInfo);
|
||||
|
||||
const currentPathSet = this.getImportantPathSet();
|
||||
console.log(originalPathSet, currentPathSet);
|
||||
|
||||
if (isSameSet(originalPathSet, currentPathSet)) {
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user