Skip to content

Commit 024c0c6

Browse files
authored
Merge pull request #204 from github0null/dev
v3.10.10 revision
2 parents d4ee343 + 4232e8f commit 024c0c6

19 files changed

Lines changed: 429 additions & 154 deletions

.gitignore

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/node_modules
22
/out
33
/out.min
4-
src/Telemetry/
54
vsc-extension-quickstart.md
65
*.vsix
76
.EIDE
@@ -12,11 +11,18 @@ vsc-extension-quickstart.md
1211
pack.js
1312
test.js
1413
*.js.map
15-
**/data/config.json
16-
**/data/sln.record
1714
*.cpuprofile
1815
package-lock.json
1916

17+
# private
18+
/src/Telemetry
19+
/src/Private
20+
21+
# eide vars
22+
/res/data/config.json
23+
/res/data/sln.record
24+
/res/data/data.yaml
25+
2026
# internal template projects
2127
res/template/projects
2228

CHANGELOG.md

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

77
***
88

9+
### [v3.10.10] revision
10+
11+
**New**:
12+
- `Project Explorer`: Lock opened project.
13+
- `Environment Variables View`: Allow show all available variables.
14+
15+
**Fix**:
16+
- `Symbol View`: Not found elf path when use IAR ARM toolchain.
17+
18+
**Optimize**:
19+
- `Environment Variables`: Allow use 'K, M, G' in 'MCU_RAM_SIZE', 'MCU_ROM_SIZE' variables.
20+
- `CMSIS Config Wizard`: Use workspace encoding for cmsis config wizard.
21+
- `Github Proxy`: Optimize proxy, enable proxy for 'GMT+8:00' timezone by default.
22+
23+
***
24+
925
### [v3.10.9] update
1026

1127
**New**:

lib/node-utility

package.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"homepage": "https://em-ide.com",
3636
"license": "MIT",
3737
"description": "A mcu development environment for 8051/AVR/STM8/Cortex-M/RISC-V",
38-
"version": "3.10.9",
38+
"version": "3.10.10",
3939
"preview": false,
4040
"engines": {
4141
"vscode": "^1.67.0"
@@ -97,8 +97,10 @@
9797
"iconv-lite": "^0.5.0",
9898
"ini": "^2.0.0",
9999
"jsonc": "^2.0.0",
100+
"mathjs": "^11.5.0",
100101
"micromatch": "^4.0.4",
101102
"node-7z": "^3.0.0",
103+
"table": "^6.8.1",
102104
"vscode-cpptools": "^5.0.0",
103105
"x2js": "3.4.1",
104106
"xml-formatter": "^2.6.1",
@@ -559,6 +561,10 @@
559561
"category": "eide",
560562
"title": "Create a new .clang-format template file"
561563
},
564+
{
565+
"command": "_cl.eide.project.show_proj_vars",
566+
"title": "%eide.project.show_project_vars%"
567+
},
562568
{
563569
"command": "_cl.eide.workspace.build",
564570
"title": "%eide.workspace.build%",
@@ -1324,6 +1330,10 @@
13241330
"command": "_cl.eide.project.close",
13251331
"when": "viewItem == SOLUTION && view == cl.eide.view.projects"
13261332
},
1333+
{
1334+
"command": "_cl.eide.project.show_proj_vars",
1335+
"when": "viewItem == SOLUTION && view == cl.eide.view.projects"
1336+
},
13271337
{
13281338
"command": "_cl.eide.project.excludeSource",
13291339
"group": "inline",

package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"eide.function.reload.stm8.dev.list": "Reload STM8 Devices List",
1313
"eide.function.reinstall.binaries": "Reinstall eide binaries",
1414

15+
"eide.project.show_project_vars": "Show All Project Variables",
1516
"eide.project.save": "Save Project",
1617
"eide.project.refresh": "Refresh",
1718
"eide.project.save.all": "Save All Projects",

package.nls.zh-CN.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"eide.function.reload.stm8.dev.list": "重新加载 STM8 芯片信息列表",
1313
"eide.function.reinstall.binaries": "重新安装 eide binaries",
1414

15+
"eide.project.show_project_vars": "显示所有可用的项目变量",
1516
"eide.project.save": "保存项目",
1617
"eide.project.refresh": "刷新",
1718
"eide.project.save.all": "保存所有项目",

src/CodeBuilder.ts

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import * as events from 'events';
2929
import * as globmatch from 'micromatch'
3030
import * as os from 'os';
3131
import * as child_process from 'child_process';
32+
import * as mathjs from 'mathjs';
3233

3334
import { AbstractProject, VirtualSource } from "./EIDEProject";
3435
import { ResManager } from "./ResManager";
@@ -425,14 +426,46 @@ export abstract class CodeBuilder {
425426
if (builderOptions.ram == undefined &&
426427
builderOptions.env &&
427428
builderOptions.env['MCU_RAM_SIZE']) {
428-
builderOptions.ram = parseInt(builderOptions.env['MCU_RAM_SIZE']) || undefined;
429+
430+
const expr = (<string>builderOptions.env['MCU_RAM_SIZE']);
431+
const expr_args = {
432+
B: 1,
433+
K: 1024,
434+
M: 1024 * 1024,
435+
G: 1024 * 1024 * 1024
436+
};
437+
438+
try {
439+
builderOptions.ram = mathjs.evaluate(expr, expr_args) as number || undefined;
440+
} catch (error) {
441+
// nothing todo
442+
}
443+
444+
if (builderOptions.ram && builderOptions.ram <= 0)
445+
builderOptions.ram = undefined;
429446
}
430447

431448
// set rom size from env
432449
if (builderOptions.rom == undefined &&
433450
builderOptions.env &&
434451
builderOptions.env['MCU_ROM_SIZE']) {
435-
builderOptions.rom = parseInt(builderOptions.env['MCU_ROM_SIZE']) || undefined;
452+
453+
const expr = (<string>builderOptions.env['MCU_ROM_SIZE']);
454+
const expr_args = {
455+
B: 1,
456+
K: 1024,
457+
M: 1024 * 1024,
458+
G: 1024 * 1024 * 1024
459+
};
460+
461+
try {
462+
builderOptions.rom = mathjs.evaluate(expr, expr_args) as number || undefined;
463+
} catch (error) {
464+
// nothing todo
465+
}
466+
467+
if (builderOptions.rom && builderOptions.rom <= 0)
468+
builderOptions.rom = undefined;
436469
}
437470

438471
// handle options by toolchain

src/EIDEProject.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,16 @@ import { md5, copyObject, compareVersion } from './utility';
5959
import { ResInstaller } from './ResInstaller';
6060
import {
6161
view_str$prompt$not_found_compiler, view_str$operation$name_can_not_be_blank,
62-
view_str$operation$name_can_not_have_invalid_char
62+
view_str$operation$name_can_not_have_invalid_char,
63+
view_str$prompt$project_is_opened_by_another,
6364
} from './StringTable';
6465
import { SettingManager } from './SettingManager';
6566
import { ExeCmd } from '../lib/node-utility/Executable';
6667
import { jsonc } from 'jsonc';
6768
import * as iconv from 'iconv-lite';
6869
import * as globmatch from 'micromatch'
6970
import { ICompileOptions, EventData, CurrentDevice, ArmBaseCompileConfigModel } from './EIDEProjectModules';
71+
import * as FileLock from '../lib/node-utility/FileLock';
7072

7173
export class CheckError extends Error {
7274
}
@@ -807,6 +809,8 @@ export abstract class AbstractProject implements CustomConfigurationProvider, Pr
807809

808810
private builtinEnvVars: { [key: string]: () => string } = {};
809811

812+
private lock_handle: number | undefined;
813+
810814
////////////////////////////////// cpptools provider interface ///////////////////////////////////
811815

812816
name: string = 'eide';
@@ -1177,7 +1181,7 @@ export abstract class AbstractProject implements CustomConfigurationProvider, Pr
11771181
/**
11781182
* get output dir top root name. like: `build`
11791183
*/
1180-
getOutputRoot(): string {
1184+
getOutputRoot(): string {
11811185
return this.GetConfiguration().getOutDirRoot();
11821186
}
11831187

@@ -1265,6 +1269,12 @@ export abstract class AbstractProject implements CustomConfigurationProvider, Pr
12651269
}
12661270

12671271
async Load(wsFile: File) {
1272+
1273+
this.lock_handle = FileLock.lock([os.tmpdir(), `${md5(wsFile.path)}.lock`].join(NodePath.sep));
1274+
if (this.lock_handle == undefined) {
1275+
throw new Error(view_str$prompt$project_is_opened_by_another.replace('{path}', wsFile.path));
1276+
}
1277+
12681278
await this.BeforeLoad(wsFile);
12691279
this.LoadConfigurations(wsFile);
12701280
this.loadProjectDirectory();
@@ -1278,6 +1288,7 @@ export abstract class AbstractProject implements CustomConfigurationProvider, Pr
12781288
}
12791289

12801290
Close() {
1291+
if (this.lock_handle) FileLock.unlock(this.lock_handle);
12811292
this.sourceRoots.DisposeAll();
12821293
this.configMap.Dispose();
12831294
this.eideDirWatcher?.Close();

0 commit comments

Comments
 (0)