Skip to content

Commit ab38c15

Browse files
authored
Merge pull request #315 from github0null/dev
v3.15.1 update
2 parents cbcfc9d + 011b7b1 commit ab38c15

File tree

8 files changed

+88
-15
lines changed

8 files changed

+88
-15
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ All notable version changes will be recorded in this file.
66

77
***
88

9+
### [v3.15.1] update
10+
11+
**Optimize**:
12+
- `GCC Compiler Driver`: Auto select gcc/g++ for c/c++ source files; Support new linker option `Linker Driver`.
13+
- `MDK Project Import`: Support import keil project's User Commands (BeforeMake and AfterMake commands).
14+
- `RightClick Menu`: Optimize menu item order.
15+
16+
***
17+
918
### [v3.15.0] update
1019

1120
**New**:

lang/arm.gcc.verify.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@
286286
"description.zh-cn": "链接器选项",
287287
"type": "object",
288288
"properties": {
289-
"linker-driver": {
289+
"$toolName": {
290290
"type": "string",
291291
"default": "auto",
292292
"description": "Linker Driver",

lang/mips.mti.gcc.verify.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@
301301
"description.zh-cn": "链接器选项",
302302
"type": "object",
303303
"properties": {
304-
"linker-driver": {
304+
"$toolName": {
305305
"type": "string",
306306
"default": "auto",
307307
"description": "Linker Driver",

lang/riscv.gcc.verify.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@
298298
"description.zh-cn": "链接器选项",
299299
"type": "object",
300300
"properties": {
301-
"linker-driver": {
301+
"$toolName": {
302302
"type": "string",
303303
"default": "auto",
304304
"description": "Linker Driver",

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"homepage": "https://em-ide.com",
3939
"license": "MIT",
4040
"description": "A mcu development environment for 8051/AVR/STM8/Cortex-M/MIPS/RISC-V",
41-
"version": "3.15.0",
41+
"version": "3.15.1",
4242
"preview": false,
4343
"engines": {
4444
"vscode": "^1.67.0"
@@ -1272,12 +1272,12 @@
12721272
{
12731273
"command": "_cl.eide.project.cppcheck.check_all",
12741274
"when": "viewItem == SOLUTION && view == cl.eide.view.projects",
1275-
"group": "z_group@0"
1275+
"group": "z_group0@0"
12761276
},
12771277
{
12781278
"command": "_cl.eide.project.cppcheck.clear_all",
12791279
"when": "viewItem == SOLUTION && view == cl.eide.view.projects",
1280-
"group": "z_group@1"
1280+
"group": "z_group0@1"
12811281
},
12821282

12831283

@@ -1304,17 +1304,17 @@
13041304
{
13051305
"command": "_cl.eide.project.source.modify.path",
13061306
"when": "viewItem == PROJECT || viewItem == V_FOLDER || viewItem == V_FOLDER_ROOT || viewItem == V_FILE_ITEM || viewItem == V_EXCFILE_ITEM && view == cl.eide.view.projects",
1307-
"group": "2_modify"
1307+
"group": "z_group0@1"
13081308
},
13091309
{
13101310
"command": "_cl.eide.project.source.modify.exclude_list",
13111311
"when": "viewItem == PROJECT && view == cl.eide.view.projects",
1312-
"group": "2_modify"
1312+
"group": "z_group0@1"
13131313
},
13141314
{
13151315
"command": "_cl.eide.project.modify.files.options",
13161316
"when": "viewItem == PROJECT && view == cl.eide.view.projects",
1317-
"group": "z_group@1"
1317+
"group": "z_group0@1"
13181318
},
13191319

13201320

@@ -1391,17 +1391,17 @@
13911391
{
13921392
"command": "_cl.eide.project.source.file.modify.extraArgs",
13931393
"when": "viewItem == FILE_ITEM || viewItem == V_FILE_ITEM && view == cl.eide.view.projects",
1394-
"group": "z_group@1"
1394+
"group": "z_group0@1"
13951395
},
13961396
{
13971397
"command": "_cl.eide.project.source.folder.modify.extraArgs",
13981398
"when": "viewItem == FOLDER || viewItem == FOLDER_ROOT || viewItem == V_FOLDER || viewItem == V_FOLDER_ROOT && view == cl.eide.view.projects",
1399-
"group": "z_group@1"
1399+
"group": "z_group0@1"
14001400
},
14011401
{
14021402
"command": "_cl.eide.project.source.file.show.dir",
14031403
"when": "viewItem == OUTPUT_FILE_ITEM || viewItem == FILE_ITEM || viewItem == EXCFILE_ITEM || viewItem == V_FILE_ITEM || viewItem == V_EXCFILE_ITEM && view == cl.eide.view.projects",
1404-
"group": "z_group@1"
1404+
"group": "z_group1@1"
14051405
},
14061406

14071407

src/CodeBuilder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ export abstract class CodeBuilder {
459459
// select linker driver for gcc family toolchain
460460
if (toolchain.categoryName.toLowerCase() == 'gcc' &&
461461
toolchain.name != 'ANY_GCC') {
462-
let tool = builderOptions.options?.linker['linker-driver'];
462+
let tool = builderOptions.options?.linker['$toolName'];
463463
// we need to detect source files type ?
464464
if (tool == 'auto' || tool == undefined || tool == null) {
465465
let hascpp = builderOptions.sourceList

src/EIDEProjectExplorer.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3045,6 +3045,11 @@ class ProjectDataProvider implements vscode.TreeDataProvider<ProjTreeItem>, vsco
30453045
return baseOpts;
30463046
}
30473047

3048+
const replaceUserTaskTmpVar = (t: any) => {
3049+
const reKeilPrjDir = baseInfo.rootFolder.ToRelativeLocalPath(keilPrjFile.dir) || keilPrjFile.dir;
3050+
t.command = t.command.replace('$<cd:mdk-proj-dir>', `cd .\\${reKeilPrjDir}`);
3051+
}
3052+
30483053
// init all targets
30493054
for (const keilTarget of targets) {
30503055

@@ -3072,7 +3077,8 @@ class ProjectDataProvider implements vscode.TreeDataProvider<ProjTreeItem>, vsco
30723077
defIncList.push(baseInfo.rootFolder.ToRelativePath(absPath) || absPath);
30733078
}
30743079
// import builder options
3075-
const opts = mergeBuilderOpts(toolchain.getDefaultConfig(), keilCompileConf.optionsGroup[keilCompileConf.toolchain]);
3080+
const opts: ICompileOptions = mergeBuilderOpts(toolchain.getDefaultConfig(), keilCompileConf.optionsGroup[keilCompileConf.toolchain]);
3081+
// write to file
30763082
const cfgFile = File.fromArray([baseInfo.rootFolder.path, AbstractProject.EIDE_DIR, `${keilTarget.name.toLowerCase()}.${toolchain.configName}`]);
30773083
cfgFile.Write(JSON.stringify(opts, undefined, 4));
30783084
}
@@ -3097,7 +3103,11 @@ class ProjectDataProvider implements vscode.TreeDataProvider<ProjTreeItem>, vsco
30973103

30983104
// import builder options
30993105
const toolchain = ToolchainManager.getInstance().getToolchain('ARM', keilCompileConf.toolchain);
3100-
const opts = mergeBuilderOpts(toolchain.getDefaultConfig(), keilCompileConf.optionsGroup[keilCompileConf.toolchain]);
3106+
const opts: ICompileOptions = mergeBuilderOpts(toolchain.getDefaultConfig(), keilCompileConf.optionsGroup[keilCompileConf.toolchain]);
3107+
opts.beforeBuildTasks?.forEach((t) => replaceUserTaskTmpVar(t));
3108+
opts.afterBuildTasks?.forEach((t) => replaceUserTaskTmpVar(t));
3109+
3110+
// write to file
31013111
const cfgFile = File.fromArray([baseInfo.rootFolder.path, AbstractProject.EIDE_DIR, `${keilTarget.name.toLowerCase()}.${toolchain.configName}`]);
31023112
cfgFile.Write(JSON.stringify(opts, undefined, 4));
31033113
}

src/KeilXmlParser.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,60 @@ class ARMParser extends KeilParser<KeilARMOption> {
699699
}
700700
}
701701

702+
// parse builder tasks
703+
{
704+
const commonOption = targetOptionObj.TargetCommonOption;
705+
const eideOption = option.optionsGroup[option.toolchain];
706+
707+
if (eideOption.beforeBuildTasks == undefined)
708+
eideOption.beforeBuildTasks = [];
709+
if (eideOption.afterBuildTasks == undefined)
710+
eideOption.afterBuildTasks = [];
711+
712+
// (%|#|@|\!|\$)
713+
const replaceMdkEnv = (cmd: string) => cmd
714+
.replace(/\$(H|L)\b/g, '${OutDir}\\')
715+
.replace(/@(H|L)\b/g, '${ProjectName}')
716+
.replace(/#H\b/g, '${ExecutableName}.hex')
717+
.replace(/%H\b/g, '${ProjectName}.hex')
718+
.replace(/\!H\b/g, '.\\${OutDirBase}\\${ProjectName}.hex')
719+
.replace(/#L\b/g, '${ExecutableName}.axf')
720+
.replace(/%L\b/g, '${ProjectName}.axf')
721+
.replace(/\!L\b/g, '.\\${OutDirBase}\\${ProjectName}.axf');
722+
723+
// BeforeMake
724+
const beforeMake = commonOption.BeforeMake;
725+
if (beforeMake) {
726+
for (let idx = 1; idx < 3; idx++) {
727+
let cmd = beforeMake[`UserProg${idx}Name`];
728+
if (cmd) {
729+
eideOption.beforeBuildTasks.push({
730+
"name": cmd,
731+
"command": `$<cd:mdk-proj-dir> && ${replaceMdkEnv(cmd)}`,
732+
"disable": beforeMake[`RunUserProg${idx}`] != '1',
733+
"abortAfterFailed": true,
734+
"stopBuildAfterFailed": true
735+
});
736+
}
737+
}
738+
}
739+
// AfterMake
740+
const afterMake = commonOption.AfterMake;
741+
if (afterMake) {
742+
for (let idx = 1; idx < 3; idx++) {
743+
let cmd = afterMake[`UserProg${idx}Name`];
744+
if (cmd) {
745+
eideOption.afterBuildTasks.push({
746+
"name": cmd,
747+
"command": `$<cd:mdk-proj-dir> && ${replaceMdkEnv(cmd)}`,
748+
"disable": afterMake[`RunUserProg${idx}`] != '1',
749+
"abortAfterFailed": true
750+
});
751+
}
752+
}
753+
}
754+
}
755+
702756
// parse misc options
703757
{
704758
const ccMiscOpts = armAdsObj.Cads.VariousControls.MiscControls;

0 commit comments

Comments
 (0)