This commit is contained in:
锦恢 2024-10-09 12:55:04 +08:00
parent 2bf0d54f9b
commit 138e43dc4d
4 changed files with 68 additions and 6 deletions

View File

@ -0,0 +1,41 @@
import tarfile
import os
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--version', default='0.4.0')
args = parser.parse_args()
version_string = args.version
def compress_to_tar_gz(source_dir, output_filename):
with tarfile.open(output_filename, "w:gz") as tar:
if os.path.isdir(source_dir):
# 如果是目录,递归添加目录中的所有文件
for root, dirs, files in os.walk(source_dir):
for file in files:
file_path = os.path.join(root, file)
arcname = os.path.relpath(file_path, source_dir)
tar.add(file_path, arcname=arcname)
else:
# 如果是文件,直接添加文件
tar.add(source_dir, arcname=os.path.basename(source_dir))
os.system('scp -P 8024 dide@nc-ai.cn:/home/dide/project/digital-lsp-server/target/release/digital-lsp digital-lsp')
compress_to_tar_gz('digital-lsp', f'digital-lsp_{version_string}_linux_amd64.tar.gz')
os.system('scp -P 8024 dide@nc-ai.cn:/home/dide/project/digital-lsp-server/target/aarch64-unknown-linux-gnu/release/digital-lsp digital-lsp')
compress_to_tar_gz('digital-lsp', f'digital-lsp_{version_string}_linux_aarch64.tar.gz')
os.system('scp -P 8024 dide@nc-ai.cn:/home/dide/project/digital-lsp-server/target/x86_64-pc-windows-gnu/release/digital-lsp.exe digital-lsp.exe')
compress_to_tar_gz('digital-lsp.exe', f'digital-lsp_{version_string}_windows_amd64.tar.gz')
os.system('scp -P 8024 dide@nc-ai.cn:/home/dide/project/digital-lsp-server/target/aarch64-pc-windows-msvc/release/digital-lsp.exe digital-lsp.exe')
compress_to_tar_gz('digital-lsp.exe', f'digital-lsp_{version_string}_windows_aarch64.tar.gz')
os.system('scp -P 8024 dide@nc-ai.cn:/home/dide/project/digital-lsp-server/target/x86_64-apple-darwin/release/digital-lsp digital-lsp')
compress_to_tar_gz('digital-lsp', f'digital-lsp_{version_string}_darwin_amd64.tar.gz')
os.system('scp -P 8024 dide@nc-ai.cn:/home/dide/project/digital-lsp-server/target/aarch64-apple-darwin/release/digital-lsp digital-lsp')
compress_to_tar_gz('digital-lsp', f'digital-lsp_{version_string}_darwin_aarch64.tar.gz')

View File

@ -14,7 +14,7 @@ import { platform } from "os";
import { IProgress, LspClient } from '../../global'; import { IProgress, LspClient } from '../../global';
import axios, { AxiosResponse } from "axios"; import axios, { AxiosResponse } from "axios";
import { chooseBestDownloadSource, getGiteeDownloadLink, getGithubDownloadLink, getPlatformPlatformSignature } from "./cdn"; import { chooseBestDownloadSource, getGiteeDownloadLink, getGithubDownloadLink, getPlatformPlatformSignature } from "./cdn";
import { hdlDir } from "../../hdlFs"; import { hdlDir, hdlPath } from "../../hdlFs";
function getLspServerExecutionName() { function getLspServerExecutionName() {
const osname = platform(); const osname = platform();
@ -39,7 +39,13 @@ function extractTarGz(filePath: string, outputDir: string): Promise<void> {
inputStream.pipe(gunzip).pipe(extract); inputStream.pipe(gunzip).pipe(extract);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
extract.on('finish', resolve); extract.on('finish', () => {
for (const file of fs.readdirSync(outputDir)) {
const filePath = hdlPath.join(outputDir, file);
fs.chmodSync(filePath, '755');
}
resolve();
});
extract.on('error', reject); extract.on('error', reject);
}) })
} }
@ -104,7 +110,9 @@ export async function downloadLsp(context: vscode.ExtensionContext, version: str
}, reportInterval); }, reportInterval);
const signature = getPlatformPlatformSignature().toString(); const signature = getPlatformPlatformSignature().toString();
const downloadLink = await chooseBestDownloadSource(signature, version, timeout); const downloadLink = await chooseBestDownloadSource(signature, version, timeout);
console.log('choose download link: ' + downloadLink);
clearInterval(intervalHandler); clearInterval(intervalHandler);
return downloadLink return downloadLink
}); });

View File

@ -231,7 +231,7 @@ class IcarusSimulate extends Simulate {
const simLibPaths = this.getSimLibArr(this.toolChain); const simLibPaths = this.getSimLibArr(this.toolChain);
const macroIncludeArgs = this.makeMacroIncludeArguments(iverilogCompileOptions.includes); const macroIncludeArgs = this.makeMacroIncludeArguments(iverilogCompileOptions.includes);
const dependenceArgs = this.makeDependenceArguments(dependences); const dependenceArgs = this.makeDependenceArguments(dependences);
const thirdLibraryArgs = this.makeThirdLibraryArguments(simLibPaths); const thirdLibraryArgs = this.makeThirdLibraryArguments(simLibPaths);
@ -244,6 +244,11 @@ class IcarusSimulate extends Simulate {
const outVvpPath = makeSafeArgPath(hdlPath.join(simConfig.simulationHome, 'out.vvp')); const outVvpPath = makeSafeArgPath(hdlPath.join(simConfig.simulationHome, 'out.vvp'));
const mainPath = makeSafeArgPath(path); const mainPath = makeSafeArgPath(path);
// console.log(macroIncludeArgs);
// console.log(thirdLibraryDirArgs);
// console.log(dependenceArgs);
// console.log(thirdLibraryFileArgs);
const cmd = `${iverilogPath} ${argu} -o ${outVvpPath} -s ${name} ${macroIncludeArgs} ${thirdLibraryDirArgs} ${mainPath} ${dependenceArgs} ${thirdLibraryFileArgs}`; const cmd = `${iverilogPath} ${argu} -o ${outVvpPath} -s ${name} ${macroIncludeArgs} ${thirdLibraryDirArgs} ${mainPath} ${dependenceArgs} ${thirdLibraryFileArgs}`;
MainOutput.report(cmd, ReportType.Run); MainOutput.report(cmd, ReportType.Run);
return cmd; return cmd;

View File

@ -179,7 +179,7 @@ class HdlParam {
} else if (status === common.InstModPathStatus.Others && inst.instModPath) { } else if (status === common.InstModPathStatus.Others && inst.instModPath) {
dependencies.others.push(inst.instModPath); dependencies.others.push(inst.instModPath);
} }
const instDependencies = this.getAllDependences(inst.module.path, inst.module.name); const instDependencies = this.getAllDependences(inst.module.path, inst.module.name);
if (instDependencies) { if (instDependencies) {
dependencies.current.push(...instDependencies.current); dependencies.current.push(...instDependencies.current);
dependencies.include.push(...instDependencies.include); dependencies.include.push(...instDependencies.include);
@ -561,7 +561,7 @@ class HdlModule {
const instModName = rawHdlInstance.type; const instModName = rawHdlInstance.type;
if (this.languageId === HdlLangID.Verilog || this.languageId === HdlLangID.SystemVerilog) { if (this.languageId === HdlLangID.Verilog || this.languageId === HdlLangID.SystemVerilog) {
const searchResult = this.searchInstModPath(instModName); const searchResult = this.searchInstModPath(instModName);
const hdlInstance = new HdlInstance(rawHdlInstance.name, const hdlInstance = new HdlInstance(rawHdlInstance.name,
rawHdlInstance.type, rawHdlInstance.type,
searchResult.path, searchResult.path,
@ -643,6 +643,11 @@ class HdlModule {
} }
} }
/**
* @description instance
* @param instModName instance
* @returns InstModPathSearchResult
*/
private searchInstModPath(instModName: string): common.InstModPathSearchResult { private searchInstModPath(instModName: string): common.InstModPathSearchResult {
// search path of instance // search path of instance
// priority: "current file" -> "included files" -> "other hdls in the project" // priority: "current file" -> "included files" -> "other hdls in the project"
@ -661,7 +666,10 @@ class HdlModule {
// search included file // search included file
for (const include of this.file.macro.includes) { for (const include of this.file.macro.includes) {
const absIncludePath = hdlPath.rel2abs(this.path, include.path); const absIncludePath = hdlPath.rel2abs(this.path, include.path);
console.log(absIncludePath);
const includeFile = hdlParam.getHdlFile(absIncludePath); const includeFile = hdlParam.getHdlFile(absIncludePath);
console.log(includeFile);
if (includeFile) { if (includeFile) {
excludeFile.add(includeFile); excludeFile.add(includeFile);
if (includeFile.hasHdlModule(instModName)) { if (includeFile.hasHdlModule(instModName)) {