Skip to content

Commit 0d57982

Browse files
authored
Merge pull request #375 from github0null/dev
v3.19.9 revision
2 parents c340dbc + 989df42 commit 0d57982

7 files changed

Lines changed: 50 additions & 17 deletions

File tree

CHANGELOG.md

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

77
***
88

9+
### [v3.19.9] revision
10+
11+
**New**:
12+
- `Plug-in Settings`: New plug-in settings: `Win32.Msys.Enable`, to determine whether to enable the built-in MSYS tools.
13+
- `Project Variables`: Export `EIDE_xxx` variables into project variables.
14+
15+
**Change**:
16+
- ~~`Other`: Append msys path to the tail of system PATH, not head.~~
17+
18+
***
19+
920
### [v3.19.8] update
1021

1122
**Fix**:

package.json

Lines changed: 8 additions & 2 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.19.8",
41+
"version": "3.19.9",
4242
"preview": false,
4343
"engines": {
4444
"vscode": "^1.67.0"
@@ -188,6 +188,12 @@
188188
{
189189
"title": "Embedded IDE",
190190
"properties": {
191+
"EIDE.Win32.Msys.Enable": {
192+
"type": "boolean",
193+
"scope": "resource",
194+
"markdownDescription": "%settings.msys.enable%",
195+
"default": true
196+
},
191197
"EIDE.DisplayLanguage": {
192198
"type": "string",
193199
"scope": "resource",
@@ -207,7 +213,7 @@
207213
"EIDE.ExternalTools.IndexUrl": {
208214
"type": "string",
209215
"scope": "machine",
210-
"markdownDescription": "external tools **index.json** url, ref: https://github.com/github0null/eide_default_external_tools_index"
216+
"markdownDescription": "External tools **index.json** url, ref: https://github.com/github0null/eide_default_external_tools_index"
211217
},
212218
"EIDE.SourceTree.AutoSearchIncludePath": {
213219
"type": "boolean",

package.nls.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@
9595
"eide.deps.macro.show": "Display All Macros",
9696
"eide.deps.macro.add": "Add Macro",
9797

98+
"settings.msys.enable": "Determine whether to enable the built-in **MSYS environment and tools** on Win32 platform",
99+
98100
"settings.enable.telemetry": "Enable telemetry for extension. We will collect information from the logs to help improve the functionality of this extension.",
99101

100102
"settings.builder.jobs": "The number of threads when build",

package.nls.zh-CN.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@
9595
"eide.deps.macro.show": "显示所有宏定义",
9696
"eide.deps.macro.add": "添加宏定义",
9797

98+
"settings.msys.enable": "确定是否在Windows平台上启用内置的 **MSYS环境和工具**",
99+
98100
"settings.enable.telemetry": "启用遥测功能。我们将收集日志中的信息,帮助改进该扩展的功能",
99101

100102
"settings.builder.jobs": "构建时使用的线程数",

src/EIDEProject.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2512,7 +2512,12 @@ $(OUT_DIR):
25122512
this.registerBuiltinVar('SYS_EOL', () => os.EOL);
25132513

25142514
// eide vars
2515-
this.registerBuiltinVar('UnifyBuilderDir', () => ResManager.instance().getUnifyBuilderExe().dir);
2515+
this.registerBuiltinVar('EIDE_BUILDER_DIR', () => ResManager.instance().getUnifyBuilderExe().dir);
2516+
for (const key in process.env) {
2517+
if (key.startsWith('EIDE_')) {
2518+
this.registerBuiltinVar(key, () => process.env[key] || '');
2519+
}
2520+
}
25162521
}
25172522

25182523
private RegisterEvent(): void {

src/SettingManager.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import * as Utility from './utility';
3535
import { find, exeSuffix, userhome } from './Platform';
3636
import { WorkspaceManager } from './WorkspaceManager';
3737
import { ToolchainName } from './ToolchainManager';
38+
import { view_str$prompt$needReloadToUpdateEnv } from './StringTable';
3839

3940
export enum CheckStatus {
4041
All_Verified,
@@ -117,6 +118,10 @@ export class SettingManager {
117118
this.syncGlobalEnvVariablesToNodeEnv();
118119
}
119120

121+
if (e.affectsConfiguration('EIDE.Win32.Msys.Enable')) {
122+
Utility.notifyReloadWindow(view_str$prompt$needReloadToUpdateEnv);
123+
}
124+
120125
} catch (error) {
121126
GlobalEvent.log_warn(error);
122127
}
@@ -289,6 +294,12 @@ export class SettingManager {
289294
return this.getConfiguration().get<string[]>('Cpptools.ForceInclude') || [];
290295
}
291296

297+
isEnableMsys(): boolean {
298+
if (os.platform() != 'win32')
299+
return false; //! not support non-win32 platform
300+
return this.getConfiguration().get<boolean>('Win32.Msys.Enable') || false;
301+
}
302+
292303
isEnableTelemetry(): boolean {
293304
return this.getConfiguration().get<boolean>('Option.EnableTelemetry') || false;
294305
}

src/extension.ts

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,6 @@ function exportEnvToSysPath(context?: vscode.ExtensionContext) {
768768
File.normalize(`${resManager.Get7zDir().path}`), // builtin 7za tool
769769
File.normalize(`${resManager.getBuiltInToolsDir().path}/utils`) // builtin util tools
770770
];
771-
const appendSystemPaths: string[] = [];
772771

773772
//
774773
const eideToolsFolder = new File(File.normalize(`${platform.userhome()}/.eide/tools`));
@@ -846,8 +845,12 @@ function exportEnvToSysPath(context?: vscode.ExtensionContext) {
846845
legacyBuilderDir.GetList(File.EXCLUDE_ALL_FILTER).forEach((subDir) => {
847846
const binFolder = File.normalize(`${subDir.path}/bin`);
848847
if (File.IsDir(binFolder)) {
848+
const key_name = `EIDE_${subDir.name.toUpperCase()}`;
849+
// check msys is enabled
850+
if (key_name == 'EIDE_MSYS' && !settingManager.isEnableMsys())
851+
return;
849852
pathList.push({
850-
key: `EIDE_${subDir.name.toUpperCase()}`,
853+
key: key_name,
851854
path: binFolder
852855
});
853856
}
@@ -857,24 +860,16 @@ function exportEnvToSysPath(context?: vscode.ExtensionContext) {
857860
pathList
858861
.filter((env) => File.IsDir(env.path))
859862
.forEach(envInfo => {
860-
if (['EIDE_MSYS'].includes(envInfo.key)) {
861-
appendSystemPaths.push(envInfo.path);
862-
if (envInfo.extraPath) {
863-
envInfo.extraPath.forEach(p => appendSystemPaths.push(p));
864-
}
865-
} else {
866-
prependSystemPaths.push(envInfo.path);
867-
if (envInfo.extraPath) {
868-
envInfo.extraPath.forEach(p => prependSystemPaths.push(p));
869-
}
863+
prependSystemPaths.push(envInfo.path);
864+
if (envInfo.extraPath) {
865+
envInfo.extraPath.forEach(p => prependSystemPaths.push(p));
870866
}
871867
});
872868

873869
/* append to System Path if we not */
874870
if (isEnvSetuped == false) {
875871
isEnvSetuped = true;
876872
platform.prependToSysEnv(process.env, prependSystemPaths);
877-
platform.appendToSysEnv(process.env, appendSystemPaths);
878873
}
879874

880875
/* update env key value */
@@ -1234,7 +1229,8 @@ class EideTaskProvider implements vscode.TaskProvider {
12341229

12351230
const workspaceManager = WorkspaceManager.getInstance();
12361231

1237-
if (task_.definition.type == EideTaskProvider.TASK_TYPE_MSYS) {
1232+
if (task_.definition.type == EideTaskProvider.TASK_TYPE_MSYS &&
1233+
SettingManager.GetInstance().isEnableMsys()) {
12381234

12391235
const definition: EideShellTaskDef = <any>task_.definition;
12401236

0 commit comments

Comments
 (0)