Skip to content

Commit 9114606

Browse files
authored
Merge pull request #157 from github0null/dev
v3.8.8 patch
2 parents 9146a9e + 4566936 commit 9114606

14 files changed

Lines changed: 2531 additions & 2497 deletions

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
***
66

7-
### [v3.8.7] revision (v3.8.4 patch)
7+
### [v3.8.8] revision (patch for v3.8.4)
88

99
**New**:
1010
- Add `Exclude/Include Child Sources` context menu for source folder
@@ -16,6 +16,7 @@
1616

1717
**Optimize**:
1818
- Format project name when import project from other IDE
19+
- Optimize source code structure
1920

2021
***
2122

lib/node-utility

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"author": {
66
"name": "cl",
77
"url": "https://github0null.io",
8-
"email": "2584456014@qq.com"
8+
"email": "me@github0null.io"
99
},
1010
"keywords": [
1111
"mcu",
@@ -30,10 +30,10 @@
3030
"cmsis",
3131
"eclipse"
3232
],
33-
"homepage": "https://github.com/github0null/eide/blob/master/README.md",
33+
"homepage": "https://em-ide.com",
3434
"license": "MIT",
3535
"description": "A mcu development environment for 8051/AVR/STM8/Cortex-M/RISC-V",
36-
"version": "3.8.7",
36+
"version": "3.8.8",
3737
"preview": false,
3838
"engines": {
3939
"vscode": "^1.63.0"

src/CodeBuilder.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@ import * as child_process from 'child_process';
3333
import { AbstractProject, VirtualSource } from "./EIDEProject";
3434
import { ResManager } from "./ResManager";
3535
import { File } from "../lib/node-utility/File";
36+
import { ProjectConfigData, ProjectConfiguration } from "./EIDETypeDefine";
3637
import {
37-
ProjectConfigData, ArmBaseCompileData,
38+
ArmBaseCompileData,
3839
Memory, ARMStorageLayout, ICompileOptions,
39-
FloatingHardwareOption, ProjectConfiguration, C51BaseCompileData, RiscvCompileData, AnyGccCompileData
40-
} from "./EIDETypeDefine";
40+
FloatingHardwareOption, C51BaseCompileData, RiscvCompileData, AnyGccCompileData
41+
} from './EIDEProjectModules';
4142
import { SettingManager } from "./SettingManager";
4243
import { GlobalEvent } from "./GlobalEvents";
4344
import { ExceptionToMessage, newMessage } from "./Message";
@@ -133,7 +134,7 @@ export abstract class CodeBuilder {
133134
for (const source of group.files) {
134135
if (source.disabled) continue; // skip disabled file
135136
if (!filter.some((reg) => reg.test(source.file.path))) continue; // skip non-source
136-
const rePath = this.project.ToRelativePath(source.file.path, false);
137+
const rePath = this.project.ToRelativePath(source.file.path);
137138
const fInfo: any = { path: rePath || source.file.path }
138139
if (AbstractProject.isVirtualSourceGroup(group)) {
139140
fInfo.virtualPath = `${group.name}/${source.file.name}`.replace(`${VirtualSource.rootName}/`, '');
@@ -403,8 +404,8 @@ export abstract class CodeBuilder {
403404
outDir: File.ToLocalPath(outDir),
404405
ram: memMaxSize?.ram,
405406
rom: memMaxSize?.rom,
406-
incDirs: this.getIncludeDirs().map((incPath) => { return this.project.ToRelativePath(incPath, false) || incPath; }),
407-
libDirs: this.getLibDirs().map((libPath) => { return this.project.ToRelativePath(libPath, false) || libPath; }),
407+
incDirs: this.getIncludeDirs().map((incPath) => { return this.project.ToRelativePath(incPath) || incPath; }),
408+
libDirs: this.getLibDirs().map((libPath) => { return this.project.ToRelativePath(libPath) || libPath; }),
408409
defines: this.getDefineList(),
409410
sourceList: sourceInfo.sources.sort(),
410411
sourceParams: sourceInfo.params,

src/DebugConfigGenerator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
import { AbstractProject } from "./EIDEProject";
2626
import { File } from "../lib/node-utility/File";
27-
import { ArmBaseCompileData, C51BaseCompileData } from "./EIDETypeDefine";
27+
import { ArmBaseCompileData } from "./EIDEProjectModules";
2828
import { ResManager } from "./ResManager";
2929
import { GlobalEvent } from "./GlobalEvents";
3030
import { newMessage } from "./Message";

src/DependenceManager.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ import * as NodePath from 'path';
2929
import { File } from '../lib/node-utility/File';
3030
import { DeleteDir, DeleteAllChildren } from './Platform';
3131
import {
32-
ProjectConfiguration, Component, Dependence,
33-
DependenceGroup, ProjectType, ManagerInterface, ComponentFileItem
32+
ProjectConfiguration, Dependence,
33+
DependenceGroup, ProjectType, ManagerInterface
3434
} from './EIDETypeDefine';
35+
import { Component, ComponentFileItem } from './EIDEProjectModules';
3536
import { GlobalEvent } from './GlobalEvents';
3637
import { SettingManager } from './SettingManager';
3738
import { ExceptionToMessage } from './Message';

src/EIDEProject.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ import { KeilParser } from './KeilXmlParser';
4040
import { ResManager } from './ResManager';
4141
import { SevenZipper } from './Compress';
4242
import {
43-
CurrentDevice, ConfigMap, FileGroup,
43+
ConfigMap, FileGroup,
4444
ProjectConfiguration, ProjectConfigData, WorkspaceConfiguration,
4545
CreateOptions,
46-
ProjectConfigEvent, ProjectFileGroup, EventData, FileItem, EIDE_CONF_VERSION, ProjectTargetInfo, VirtualFolder, VirtualFile, CompileConfigModel, ArmBaseCompileData, ArmBaseCompileConfigModel, Dependence, CppConfigItem, ICompileOptions
46+
ProjectConfigEvent, ProjectFileGroup, FileItem, EIDE_CONF_VERSION, ProjectTargetInfo, VirtualFolder, VirtualFile, CppConfigItem
4747
} from './EIDETypeDefine';
4848
import { ToolchainName, IToolchian, ToolchainManager } from './ToolchainManager';
4949
import { GlobalEvent } from './GlobalEvents';
@@ -66,6 +66,7 @@ import { ExeCmd } from '../lib/node-utility/Executable';
6666
import { jsonc } from 'jsonc';
6767
import * as iconv from 'iconv-lite';
6868
import * as globmatch from 'micromatch'
69+
import { ICompileOptions, EventData, CurrentDevice, ArmBaseCompileConfigModel } from './EIDEProjectModules';
6970

7071
export class CheckError extends Error {
7172
}
@@ -553,7 +554,7 @@ class SourceRootList implements SourceProvider {
553554
}
554555

555556
private getRelativePath(abspath: string): string {
556-
return this.project.ToRelativePath(abspath, false) || abspath;
557+
return this.project.ToRelativePath(abspath) || abspath;
557558
}
558559

559560
private newSourceInfo(displayName: string, watcher: FileWatcher): SourceRootInfo {
@@ -599,7 +600,7 @@ class SourceRootList implements SourceProvider {
599600

600601
// exclude some root folder when add files to custom include paths
601602
const disableInclude: boolean = AbstractProject.excludeIncSearchList.includes(
602-
this.project.ToRelativePath(rootFolder.path, false) || rootFolder.path
603+
this.project.ToRelativePath(rootFolder.path) || rootFolder.path
603604
);
604605

605606
const sourceFilter = this.isAutoSearchObjFile ?
@@ -1089,9 +1090,9 @@ export abstract class AbstractProject implements CustomConfigurationProvider {
10891090
* Relative path root folder: `<Project_Root_Folder>`
10901091
*
10911092
* @param path absolute path
1092-
* @param hasPrefix Whether add a './' prefix before relative path, default is 'true'
1093+
*
10931094
*/
1094-
ToRelativePath(path: string, hasPrefix: boolean = true): string | undefined {
1095+
ToRelativePath(path: string): string | undefined {
10951096
return this.GetRootDir().ToRelativePath(path.trim());
10961097
}
10971098

@@ -2073,7 +2074,7 @@ class EIDEProject extends AbstractProject {
20732074

20742075
// filesystem files
20752076
if (typeof this.srcExtraCompilerConfig?.files == 'object') {
2076-
matcher(this.srcExtraCompilerConfig?.files, this.ToRelativePath(srcPath, false) || srcPath);
2077+
matcher(this.srcExtraCompilerConfig?.files, this.ToRelativePath(srcPath) || srcPath);
20772078
}
20782079

20792080
// virtual files
@@ -2220,7 +2221,7 @@ class EIDEProject extends AbstractProject {
22202221
File.fromArray([wsFile.dir, AbstractProject.EIDE_DIR, AbstractProject.prjConfigName]), option.type);
22212222

22222223
// set project name
2223-
prjConfig.config.name = AbstractProject.formatProjectName(option.name);
2224+
prjConfig.config.name = option.projectName || AbstractProject.formatProjectName(option.name);
22242225

22252226
return {
22262227
rootFolder: rootDir,
@@ -2231,7 +2232,7 @@ class EIDEProject extends AbstractProject {
22312232

22322233
protected create(option: CreateOptions): File {
22332234
const baseInfo = this.createBase(option);
2234-
baseInfo.prjConfig.config.name = AbstractProject.formatProjectName(option.name);
2235+
baseInfo.prjConfig.config.name = option.projectName || AbstractProject.formatProjectName(option.name);
22352236
baseInfo.prjConfig.config.outDir = 'build';
22362237
baseInfo.prjConfig.config.srcDirs = [];
22372238
baseInfo.prjConfig.Save();
@@ -2279,7 +2280,7 @@ class EIDEProject extends AbstractProject {
22792280
// is filesystem source
22802281
if (!AbstractProject.isVirtualSourceGroup(_group)) {
22812282
const group = <ProjectFileGroup>_group;
2282-
const rePath = this.ToRelativePath(group.dir.path, false);
2283+
const rePath = this.ToRelativePath(group.dir.path);
22832284
// combine HAL folder
22842285
if (rePath && rePath.startsWith(DependenceManager.DEPENDENCE_DIR)) {
22852286
halFiles = halFiles.concat(group.files);

src/EIDEProjectExplorer.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ import { ResManager } from './ResManager';
3535
import { GlobalEvent } from './GlobalEvents';
3636
import { AbstractProject, CheckError, DataChangeType, VirtualSource } from './EIDEProject';
3737
import { ToolchainName, ToolchainManager } from './ToolchainManager';
38-
import { CreateOptions, PackInfo, ComponentFileItem, DeviceInfo, getComponentKeyDescription, VirtualFolder, VirtualFile, ImportOptions, ProjectTargetInfo, ArmBaseCompileData, ProjectConfigData, ProjectType, ArmBaseCompileConfigModel, RiscvCompileData, AnyGccCompileData } from './EIDETypeDefine';
38+
import { CreateOptions, VirtualFolder, VirtualFile, ImportOptions, ProjectTargetInfo, ProjectConfigData, ProjectType } from './EIDETypeDefine';
39+
import { PackInfo, ComponentFileItem, DeviceInfo, getComponentKeyDescription, ArmBaseCompileData, ArmBaseCompileConfigModel, RiscvCompileData, AnyGccCompileData } from "./EIDEProjectModules";
3940
import { WorkspaceManager } from './WorkspaceManager';
4041
import {
4142
can_not_close_project, project_is_opened, project_load_failed,
@@ -1448,6 +1449,7 @@ class ProjectDataProvider implements vscode.TreeDataProvider<ProjTreeItem> {
14481449

14491450
const basePrj = AbstractProject.NewProject().createBase({
14501451
name: ePrjInfo.name,
1452+
projectName: ePrjInfo.name,
14511453
type: nPrjType,
14521454
outDir: ePrjRoot
14531455
}, false);
@@ -1459,7 +1461,7 @@ class ProjectDataProvider implements vscode.TreeDataProvider<ProjTreeItem> {
14591461
nPrjConfig.outDir = 'build';
14601462
nPrjConfig.srcDirs = File.NotMatchFilter(ePrjRoot.GetList(File.EMPTY_FILTER), File.EMPTY_FILTER,
14611463
[/^\./, /^(build|dist|out|bin|obj|exe|debug|release|log[s]?|ipch|docs|doc|img|image[s]?)$/i])
1462-
.map(d => ePrjRoot.ToRelativePath(d.path, false) || d.path);
1464+
.map(d => ePrjRoot.ToRelativePath(d.path) || d.path);
14631465

14641466
// init all target
14651467
for (const eTarget of ePrjInfo.targets) {
@@ -1752,6 +1754,7 @@ class ProjectDataProvider implements vscode.TreeDataProvider<ProjTreeItem> {
17521754

17531755
const baseInfo = AbstractProject.NewProject().createBase({
17541756
name: nPrjOutDir.name,
1757+
projectName: keilPrjFile.noSuffixName,
17551758
type: targets[0].type,
17561759
outDir: nPrjOutDir
17571760
}, false);
@@ -1835,7 +1838,7 @@ class ProjectDataProvider implements vscode.TreeDataProvider<ProjTreeItem> {
18351838
if (!srcFile.IsFile()) { continue; }
18361839
if (dep.category == 'source' && !vFolder) { continue; }
18371840

1838-
let srcRePath: string | undefined = baseInfo.rootFolder.ToRelativePath(srcFile.path, false);
1841+
let srcRePath: string | undefined = baseInfo.rootFolder.ToRelativePath(srcFile.path);
18391842

18401843
/* if it's not in workspace, copy it */
18411844
if (srcRePath == undefined) {
@@ -1887,7 +1890,7 @@ class ProjectDataProvider implements vscode.TreeDataProvider<ProjTreeItem> {
18871890
let locate = dep.packPath;
18881891
if (dep.instance) {
18891892
locate = baseInfo.rootFolder
1890-
.ToRelativePath(dep.instance[0], false) || dep.instance[0]
1893+
.ToRelativePath(dep.instance[0]) || dep.instance[0]
18911894
}
18921895

18931896
const nLine: string[] = [
@@ -3328,7 +3331,7 @@ export class ProjectExplorer implements CustomConfigurationProvider {
33283331
for (const folderUri of folderList) {
33293332

33303333
const folderPath = folderUri.fsPath;
3331-
const rePath = prj.ToRelativePath(folderPath, false);
3334+
const rePath = prj.ToRelativePath(folderPath);
33323335

33333336
// if can't calculate repath, skip
33343337
if (rePath === undefined || rePath.trim() === '') {
@@ -3841,7 +3844,7 @@ export class ProjectExplorer implements CustomConfigurationProvider {
38413844
if (source.disabled) continue;
38423845
// skip non-source and asm file
38433846
if (!srcFilter.test(source.file.path)) continue;
3844-
const rePath = confRootDir.ToRelativePath(source.file.path, false);
3847+
const rePath = confRootDir.ToRelativePath(source.file.path);
38453848
srcList.push(rePath || source.file.path);
38463849
}
38473850
}
@@ -4388,7 +4391,7 @@ export class ProjectExplorer implements CustomConfigurationProvider {
43884391
if (uris && uris.length > 0) {
43894392
const dupLi = prj
43904393
.addIncludePaths(uris.map(uri => { return uri.fsPath; }))
4391-
.map(path => prj.ToRelativePath(path, false) || path);
4394+
.map(path => prj.ToRelativePath(path) || path);
43924395
if (dupLi.length > 0) {
43934396
const msg = `${dupLi.length} redundant include paths (ignored): ${JSON.stringify(dupLi)}`;
43944397
GlobalEvent.emit('msg', newMessage('Warning', msg));
@@ -4445,14 +4448,14 @@ export class ProjectExplorer implements CustomConfigurationProvider {
44454448
prj.GetConfiguration().getAllDepGroup().forEach((group) => {
44464449
for (const dep of group.depList) {
44474450
for (const incPath of dep.incList) {
4448-
includesMap.set(prj.ToRelativePath(incPath, false) || incPath, group.groupName);
4451+
includesMap.set(prj.ToRelativePath(incPath) || incPath, group.groupName);
44494452
}
44504453
}
44514454
});
44524455

44534456
// add source include paths
44544457
prj.getSourceIncludeList().forEach((incPath) => {
4455-
includesMap.set(prj.ToRelativePath(incPath, false) || incPath, 'source');
4458+
includesMap.set(prj.ToRelativePath(incPath) || incPath, 'source');
44564459
});
44574460

44584461
for (const keyVal of includesMap) {
@@ -4489,7 +4492,7 @@ export class ProjectExplorer implements CustomConfigurationProvider {
44894492
prj.GetConfiguration().getAllDepGroup().forEach((group) => {
44904493
for (const dep of group.depList) {
44914494
for (const libPath of dep.libList) {
4492-
libMaps.set(prj.ToRelativePath(libPath, false) || libPath, group.groupName);
4495+
libMaps.set(prj.ToRelativePath(libPath) || libPath, group.groupName);
44934496
}
44944497
}
44954498
});

0 commit comments

Comments
 (0)