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