Skip to content

Commit dfb8509

Browse files
committed
miscellaneous update
1 parent 2621fe7 commit dfb8509

5 files changed

Lines changed: 66 additions & 19 deletions

File tree

src/EIDEProject.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2141,20 +2141,18 @@ $(OUT_DIR):
21412141
private getEnvFileDefCont(): string[] {
21422142
return [
21432143
`###########################################################`,
2144-
`# project environment variables`,
2144+
`# Project Environment Variables`,
21452145
`###########################################################`,
21462146
``,
2147+
`## Global Variables`,
2148+
``,
21472149
`# append command prefix for toolchain`,
21482150
`#COMPILER_CMD_PREFIX=`,
2149-
``,
21502151
`# mcu ram size (used to print memory usage)`,
21512152
`#MCU_RAM_SIZE=0x00`,
2152-
``,
21532153
`# mcu rom size (used to print memory usage)`,
21542154
`#MCU_ROM_SIZE=0x00`,
21552155
``,
2156-
`# put your global variables ...`,
2157-
`#GLOBAL_VAR=`,
21582156
``,
21592157
].map((line) => line);
21602158
}
@@ -2639,6 +2637,7 @@ $(OUT_DIR):
26392637
this.registerBuiltinVar(key, () => process.env[key] || '');
26402638
}
26412639
}
2640+
this.registerBuiltinVar('EIDE_PY3_CMD', () => ResManager.instance().getPython3());
26422641
}
26432642

26442643
private RegisterEvent(): void {

src/ResManager.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import { File } from "../lib/node-utility/File";
2626
import { WorkspaceManager } from "./WorkspaceManager";
2727
import { GlobalEvent } from "./GlobalEvents";
28-
import { exeSuffix, GetLocalCodePage, osType, getArchId, userhome } from "./Platform";
28+
import { exeSuffix, GetLocalCodePage, osType, getArchId, userhome, find } from "./Platform";
2929
import { ExceptionToMessage } from "./Message";
3030

3131
import * as ChildProcess from 'child_process';
@@ -274,13 +274,6 @@ export class ResManager extends events.EventEmitter {
274274
}
275275
}
276276

277-
GetHostInfo(): HostInfo {
278-
return {
279-
host: "47.240.52.92",
280-
port: 50000
281-
};
282-
}
283-
284277
GetIconByName(name: string): File {
285278
let f = this.iconMap.get(name);
286279

@@ -325,6 +318,14 @@ export class ResManager extends events.EventEmitter {
325318
return process.env['ComSpec'];
326319
}
327320

321+
getPython3(): string {
322+
if (osType() == 'win32') {
323+
return File.from(userhome(), '.eide', 'bin', 'python36', 'python3.exe').path;
324+
} else {
325+
return find('python3') || 'python';
326+
}
327+
}
328+
328329
//-----------------------------------------------------------------
329330

330331
getAppRootFolder(): File {

src/StringTable.ts

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,15 +413,45 @@ export const view_str$env_desc$toolchain_root = [
413413
][langIndex];
414414

415415
export const view_str$env_desc$compiler_prefix = [
416-
`编译器前缀,例如:arm-none-eabi-`,
417-
`Compiler prefix, like: arm-none-eabi-`
416+
`GCC编译器前缀 (非GCC则没有前缀,为空),例如:arm-none-eabi-`,
417+
`GCC Compiler Prefix (empty if it's not gcc). e.g. arm-none-eabi-`
418418
][langIndex];
419419

420420
export const view_str$env_desc$compiler_folder = [
421421
`编译器可执行文件目录`,
422422
`Compiler executable file's folder`
423423
][langIndex];
424424

425+
export const view_str$env_desc$compiler_ver = [
426+
`编译器版本号,如:'8.3.1'`,
427+
`Compiler Version. e.g. 8.3.1`
428+
][langIndex];
429+
430+
export const view_str$env_desc$compiler_full_name = [
431+
`编译器全名 (可读名称)`,
432+
`Compiler Full Name (Human-readable Name)`
433+
][langIndex];
434+
435+
export const view_str$env_desc$cc_base_args = [
436+
`C 编译器的基本参数 (CFLAGS)`,
437+
`Base C Compiler Flags (CFLAGS)`
438+
][langIndex];
439+
440+
export const view_str$env_desc$cxx_base_args = [
441+
`C++ 编译器的基本参数 (CXXFLAGS)`,
442+
`Base C++ Compiler Flags (CXXFLAGS)`
443+
][langIndex];
444+
445+
export const view_str$env_desc$asm_base_args = [
446+
`汇编器的基本参数 (ASMFLAGS)`,
447+
`Base Assembler Flags (ASMFLAGS)`
448+
][langIndex];
449+
450+
export const view_str$env_desc$py3_cmd = [
451+
`插件内置的 python3 命令 (非windows平台则使用系统自带命令)`,
452+
`The built-in python3 commands of the plugin (for non-Windows platforms, use the system's built-in commands)`
453+
][langIndex];
454+
425455
//---------------Other---------------
426456

427457
export const view_str$gen_sct_failed = [

src/WebPanelManager.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,16 @@ import { ResManager } from "./ResManager";
2828
import { AbstractProject } from "./EIDEProject";
2929
import { ArmBaseCompileConfigModel } from "./EIDEProjectModules";
3030
import { GlobalEvent } from "./GlobalEvents";
31-
import { view_str$compile$options, view_str$compile$storageLayout, view_str$env_desc$builer_folder, view_str$env_desc$compiler_folder, view_str$env_desc$compiler_prefix, view_str$env_desc$output_dir, view_str$env_desc$project_name, view_str$env_desc$project_root, view_str$env_desc$toolchain_root, view_str$operation$done, view_str$project$cmsis_config_wizard } from "./StringTable";
31+
import { view_str$compile$options, view_str$compile$storageLayout,
32+
view_str$env_desc$builer_folder, view_str$env_desc$compiler_folder,
33+
view_str$env_desc$compiler_prefix, view_str$env_desc$output_dir,
34+
view_str$env_desc$project_name, view_str$env_desc$project_root,
35+
view_str$env_desc$toolchain_root, view_str$operation$done,
36+
view_str$project$cmsis_config_wizard, view_str$env_desc$py3_cmd,
37+
view_str$env_desc$cc_base_args, view_str$env_desc$cxx_base_args,
38+
view_str$env_desc$asm_base_args, view_str$env_desc$compiler_ver,
39+
view_str$env_desc$compiler_full_name
40+
} from "./StringTable";
3241
import * as NodePath from 'path';
3342
import * as CmsisConfigParser from './CmsisConfigParser'
3443
import * as os from 'os'
@@ -232,18 +241,23 @@ export class WebPanelManager {
232241

233242
const envList: any[] = [
234243
// unify_builder specific variables
235-
{ name: '${BuilderFolder}', desc: view_str$env_desc$builer_folder },
236244
{ name: '${CompilerPrefix}', desc: view_str$env_desc$compiler_prefix },
237-
{ name: '${CompilerFolder}', desc: view_str$env_desc$compiler_folder }
245+
{ name: '${CompilerFullName}', desc: view_str$env_desc$compiler_full_name },
246+
{ name: '${CompilerVersion}', desc: view_str$env_desc$compiler_ver }
238247
];
239-
240248
const prjEnv = project.getProjectVariables();
241249
for (const key in prjEnv) {
242250
envList.push({
243251
name: `\$\{${key}\}`,
244252
desc: `${prjEnv[key]}`
245253
})
246254
}
255+
// other EIDE_xx variables
256+
[
257+
{ name: '${EIDE_CUR_COMPILER_CC_BASE_ARGS}', desc: view_str$env_desc$cc_base_args },
258+
{ name: '${EIDE_CUR_COMPILER_CXX_BASE_ARGS}', desc: view_str$env_desc$cxx_base_args },
259+
{ name: '${EIDE_CUR_COMPILER_AS_BASE_ARGS}', desc: view_str$env_desc$asm_base_args }
260+
].forEach(item => envList.push(item))
247261

248262
const toolchain = project.getToolchain();
249263

src/extension.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -919,6 +919,9 @@ function exportEnvToSysPath(context?: vscode.ExtensionContext) {
919919
}
920920
}
921921

922+
/* setup python3 cmd */
923+
process.env['EIDE_PY3_CMD'] = resManager.getPython3();
924+
922925
// .NET 工具会收集用法数据,帮助我们改善你的体验。它由 Microsoft 收集并与社区共享。
923926
// 你可通过使用喜欢的 shell 将 DOTNET_CLI_TELEMETRY_OPTOUT 环境变量设置为 "1" 或 "true" 来选择退出遥测。
924927
// 阅读有关 .NET CLI 工具遥测的更多信息: https://aka.ms/dotnet-cli-telemetry

0 commit comments

Comments
 (0)