Skip to content

Commit

Permalink
Merge pull request #116 from github0null/dev
Browse files Browse the repository at this point in the history
v3.5.0 update
  • Loading branch information
github0null authored Apr 27, 2022
2 parents e73226c + bdfff0b commit 5f62cf9
Show file tree
Hide file tree
Showing 10 changed files with 168 additions and 86 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,24 @@

***

### [v3.5.0]

**Fixed**:
- Source ref parser encoding bug for iar_stm8 compiler.

**Optimized**:
- Replace `arch` command by `uname -m` for `arch-linux`.
- Auto search executable path in system env when default tool path is invalid.
- Use monospaced font for `*.mapView`.
- Disable online tool installer for `linux` platform.

**Changed**:
- Remove `extensionDependencies` and built-in auto active extensionDependencies.
- Force use unix path for virtual source path to compat old project.
- Adjust default `project templates repo`, now it's: 'https://github.com/github0null/eide-templates'.

***

### [v3.4.0]

**Optimized**:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

## Summary 📑

> Supported Platforms: **Windows (Windows 7 SP1 and later)**, **Linux x86_64 (Ubuntu)**
> Supported Platforms: **Windows (Windows 7 SP1 and later)**, **Linux x86_64**
An embedded development environment for `8051/AVR/STM8/Cortex-M[0/0+/3/4/7]/RISC-V/Universal-Gcc` on VsCode.

Expand Down
2 changes: 1 addition & 1 deletion README_ZH-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

## 简述 📑

> 受支持的平台: **Windows (Windows 7 SP1 and later)**, **Linux x86_64 (Ubuntu)**
> 受支持的平台: **Windows (Windows 7 SP1 and later)**, **Linux x86_64**
一款适用于 8051/STM8/Cortex-M/RISC-V 的单片机开发环境。

Expand Down
7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"homepage": "https://github.com/github0null/eide/blob/master/README.md",
"license": "MIT",
"description": "An embedded development environment for 8051/AVR/STM8/Cortex-M/RISC-V",
"version": "3.4.0",
"version": "3.5.0",
"preview": false,
"engines": {
"vscode": "^1.63.0"
Expand Down Expand Up @@ -97,9 +97,6 @@
"x2js": "3.4.1",
"yaml": "^1.10.2"
},
"extensionDependencies": [
"ms-vscode.cpptools"
],
"contributes": {
"terminal": {
"profiles": [
Expand Down Expand Up @@ -293,7 +290,7 @@
"type": "string",
"scope": "machine",
"markdownDescription": "%settings.template.repo.url%",
"default": "github0null/eide-resource/contents/eide-template-list"
"default": "github0null/eide-templates/contents"
},
"EIDE.Repository.Template.GithubPersonalToken": {
"type": "string",
Expand Down
149 changes: 88 additions & 61 deletions src/EIDEProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import {
import { SettingManager } from './SettingManager';
import { ExeCmd } from '../lib/node-utility/Executable';
import { jsonc } from 'jsonc';
import * as iconv from 'iconv-lite';

export class CheckError extends Error {
}
Expand Down Expand Up @@ -772,67 +773,71 @@ export abstract class AbstractProject implements CustomConfigurationProvider {
// create log folder
this.getLogDir().CreateDir();

// rename old 'deps' folder name for old eide version
const depsFolder = new File(this.rootDirWatcher.file.path + File.sep + DependenceManager.DEPENDENCE_DIR);
if (!depsFolder.IsDir()) { // if 'deps' folder is not exist

// these folder is for old eide version
const oldDepsFolders = [
new File(this.rootDirWatcher.file.path + File.sep + 'deps'),
new File(this.rootDirWatcher.file.path + File.sep + 'dependence')
];

// create new 'deps' folder
// fs.mkdirSync(depsFolder.path);

// copy dependence data from old version deps folder
for (const folder of oldDepsFolders) {
if (folder.IsDir()) {

// copy dependence data
fs.renameSync(folder.path, depsFolder.path);

// reset exclude info
const excludeList = this.GetConfiguration().config.excludeList;
const pathMatcher = `.${File.sep}${folder.name}${File.sep}`;
const pathReplacer = `${DependenceManager.DEPENDENCE_DIR}/`;
for (let index = 0; index < excludeList.length; index++) {
const element = excludeList[index];
if (element.startsWith(pathMatcher)) {
excludeList[index] = element.replace(pathMatcher, pathReplacer);
// compat old project
if (this.isOldVersionProject) {

// rename old 'deps' folder name for old eide version
const depsFolder = new File(this.rootDirWatcher.file.path + File.sep + DependenceManager.DEPENDENCE_DIR);
if (!depsFolder.IsDir()) { // if 'deps' folder is not exist

// these folder is for old eide version
const oldDepsFolders = [
new File(this.rootDirWatcher.file.path + File.sep + 'deps'),
new File(this.rootDirWatcher.file.path + File.sep + 'dependence')
];

// create new 'deps' folder
// fs.mkdirSync(depsFolder.path);

// copy dependence data from old version deps folder
for (const folder of oldDepsFolders) {
if (folder.IsDir()) {

// copy dependence data
fs.renameSync(folder.path, depsFolder.path);

// reset exclude info
const excludeList = this.GetConfiguration().config.excludeList;
const pathMatcher = `.${File.sep}${folder.name}${File.sep}`;
const pathReplacer = `${DependenceManager.DEPENDENCE_DIR}/`;
for (let index = 0; index < excludeList.length; index++) {
const element = excludeList[index];
if (element.startsWith(pathMatcher)) {
excludeList[index] = element.replace(pathMatcher, pathReplacer);
}
}
}

break; // exit, when copy done
break; // exit, when copy done
}
}
}
}

// merge old 'env.ini' files for v2.15.3^
const envFile: File = this.getEnvFile(true);
if (!envFile.IsFile()) { // if 'env.ini' file is not existed, we try to merge it
const oldEnv: string[] = [];
this.eideDir.GetList([/[^\.]+\.env\.ini$/], File.EMPTY_FILTER)
.forEach((file) => {
const tName = NodePath.basename(file.path, '.env.ini');
if (tName) {
try {
const cfg = ini.parse(file.Read());
if (cfg['workspace']) { // merge old prj order cfg
cfg['EIDE_BUILD_ORDER'] = cfg['workspace']['order'];
delete cfg['workspace'];
// merge old 'env.ini' files for v2.15.3^
const envFile: File = this.getEnvFile(true);
if (!envFile.IsFile()) { // if 'env.ini' file is not existed, we try to merge it
const oldEnv: string[] = [];
this.eideDir.GetList([/[^\.]+\.env\.ini$/], File.EMPTY_FILTER)
.forEach((file) => {
const tName = NodePath.basename(file.path, '.env.ini');
if (tName) {
try {
const cfg = ini.parse(file.Read());
if (cfg['workspace']) { // merge old prj order cfg
cfg['EIDE_BUILD_ORDER'] = cfg['workspace']['order'];
delete cfg['workspace'];
}
const cfg_str = ini.stringify(cfg);
fs.unlinkSync(file.path); // delete file before
oldEnv.push(`[${tName}]`, `${cfg_str}`);
} catch (error) {
// nothing todo
}
const cfg_str = ini.stringify(cfg);
fs.unlinkSync(file.path); // delete file before
oldEnv.push(`[${tName}]`, `${cfg_str}`);
} catch (error) {
// nothing todo
}
}
});
if (oldEnv.length > 0) {
const cont = this.getEnvFileDefCont().concat(oldEnv);
envFile.Write(cont.join(os.EOL));
});
if (oldEnv.length > 0) {
const cont = this.getEnvFileDefCont().concat(oldEnv);
envFile.Write(cont.join(os.EOL));
}
}
}
}
Expand All @@ -858,6 +863,16 @@ export abstract class AbstractProject implements CustomConfigurationProvider {
&& !(new File(this.ToAbsolutePath(prjConfig.config.packDir))).IsDir()) {
prjConfig.config.packDir = null;
}

// use unix path for source path
if (this.isNewProject || this.isOldVersionProject) {
const dStack = [prjConfig.config.virtualFolder];
while (dStack.length > 0) {
const vFolder = <VirtualFolder>dStack.pop();
vFolder.files.forEach(vFile => vFile.path = File.ToUnixPath(vFile.path));
vFolder.folders.forEach(d => dStack.push(d));
}
}
}

private initProjectComponents() {
Expand Down Expand Up @@ -1657,7 +1672,8 @@ export abstract class AbstractProject implements CustomConfigurationProvider {

//---

protected isAnNewProject?: boolean | undefined;
protected isNewProject?: boolean | undefined;
protected isOldVersionProject?: boolean | undefined;

protected async BeforeLoad(wsFile: File): Promise<void> {

Expand All @@ -1673,13 +1689,14 @@ export abstract class AbstractProject implements CustomConfigurationProvider {
} else if (prjv_vs_eidev < 0) { // prj version < eide, update it
conf.version = EIDE_CONF_VERSION;
eideFile.Write(JSON.stringify(conf));
this.isOldVersionProject = true;
}
}

// check is an new project ?
if (conf.miscInfo == undefined ||
conf.miscInfo.uid == undefined) {
this.isAnNewProject = true;
this.isNewProject = true;
}
}

Expand Down Expand Up @@ -2023,7 +2040,9 @@ class EIDEProject extends AbstractProject {
for (let i = startIndex; i < lines.length; i++) {
const sepIndex = lines[i].indexOf(": ");
if (sepIndex > 0) {
const line = lines[i].substring(sepIndex + 1).trim();
const line = lines[i].substring(sepIndex + 1)
.replace(/\\ /g, " ")
.replace(/\\:/g, ":").trim();
resultList.push(this.ToAbsolutePath(line));
}
}
Expand All @@ -2033,7 +2052,15 @@ class EIDEProject extends AbstractProject {

private parseRefFile(dFile: File, toolchain: ToolchainName): string[] {

const lines: string[] = dFile.Read()
let cont: string | undefined;

if (platform.osType() == 'win32' && ResManager.getLocalCodePage() == '936') { // win32 gbk
cont = iconv.decode(fs.readFileSync(dFile.path), '936');
} else {
cont = fs.readFileSync(dFile.path, 'utf8');
}

const lines: string[] = cont
.split(/\r\n|\n/)
.filter((line) => line.trim() != '');

Expand Down Expand Up @@ -2237,7 +2264,7 @@ class EIDEProject extends AbstractProject {
await super.BeforeLoad(wsFile);

// run pre-install.sh
if (this.isAnNewProject) {
if (this.isNewProject) {
const name = 'pre-install.sh';
const prjRoot = new File(wsFile.dir);
const ok = await this.runInstallScript(prjRoot, name, `Running 'post-install' ...`);
Expand All @@ -2250,7 +2277,7 @@ class EIDEProject extends AbstractProject {
await super.AfterLoad();

/* update workspace settings */
if (this.isAnNewProject) {
if (this.isNewProject) {

const workspaceConfig = this.GetWorkspaceConfig();
const settings = workspaceConfig.config.settings;
Expand Down Expand Up @@ -2451,7 +2478,7 @@ class EIDEProject extends AbstractProject {
}

// run post-install.sh
if (this.isAnNewProject) {
if (this.isNewProject) {
this.runInstallScript(this.GetRootDir(), 'post-install.sh', `Running 'post-install' ...`)
.then((done) => {
if (!done) {
Expand Down
2 changes: 1 addition & 1 deletion src/EIDETypeDefine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ import * as utility from './utility';
////////////////////////////////////////////////////////

// eide project config file version
export const EIDE_CONF_VERSION = '3.0';
export const EIDE_CONF_VERSION = '3.1';

////////////////////////////////////////////////////////

Expand Down
7 changes: 4 additions & 3 deletions src/OperationExplorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,8 @@ export class OperationExplorer {
/* select install mode */

const resInstaller = ResInstaller.instance();
if (resInstaller.hasTool(item.type)) { /* have online package */
const tool = resInstaller.getTool(item.type);
if (tool && !tool.no_binaries) { /* have online package */

const pickItems: vscode.QuickPickItem[] = [
{
Expand Down Expand Up @@ -832,7 +833,7 @@ export class OperationExplorer {

const res = await vscode.window.withProgress({
location: vscode.ProgressLocation.Notification,
title: 'Searching from ' + hostName + ' ...',
title: `Connect repo '${rawUrl}' ...`,
cancellable: true
}, (_, token): Thenable<NetResponse<any>> => {
return new Promise(async (resolve) => {
Expand Down Expand Up @@ -895,7 +896,7 @@ export class OperationExplorer {
// load index.json
const indexFileBuf = await vscode.window.withProgress({
location: vscode.ProgressLocation.Notification,
title: 'Downloading "index.json" ...',
title: 'Fetching templates index ...',
cancellable: false
}, (_, __): Thenable<Buffer | Error | undefined> => {
return new Promise(async (resolve) => {
Expand Down
2 changes: 1 addition & 1 deletion src/ResInstaller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export class ResInstaller {
this.toolsMap.set(name.toLowerCase(), info);
}

private getTool(name: ExternalToolName): ExternalToolInfo | undefined {
getTool(name: ExternalToolName): ExternalToolInfo | undefined {
return this.toolsMap.get(name.toLowerCase());
}

Expand Down
Loading

0 comments on commit 5f62cf9

Please sign in to comment.