Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ All notable version changes will be recorded in this file.

***

### [v3.20.0] update

**New**:
- `Export GNU Makefile`: Support export GNU Makefile for help users customize the automatic build process.

**Change**:
- `unify_builder`: Update unify_builder to v3.8.0

**Fix**:
- `OpenOCD`: Can't get interface/target list for xpack openocd v12.

***

### [v3.19.9] revision

**New**:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,4 @@ You can build this project by your self.

## Sponsor 👍

[Github Sponsor](https://github.com/sponsors/github0null)
[Sponsor The Author](https://em-ide.com/sponsor)
15 changes: 12 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"homepage": "https://em-ide.com",
"license": "MIT",
"description": "A mcu development environment for 8051/AVR/STM8/Cortex-M/MIPS/RISC-V",
"version": "3.19.9",
"version": "3.20.0",
"preview": false,
"engines": {
"vscode": "^1.67.0"
Expand Down Expand Up @@ -633,6 +633,10 @@
"command": "eide.operation.open_project",
"title": "Open an eide project"
},
{
"command": "_cl.eide.project.exportMakefile",
"title": "%eide.project.export.makefile%"
},
{
"command": "_cl.eide.project.show_proj_vars",
"title": "%eide.project.show_project_vars%"
Expand Down Expand Up @@ -1572,12 +1576,17 @@
{
"command": "_cl.eide.project.exportAsTemplate",
"when": "viewItem == SOLUTION && view == cl.eide.view.projects",
"group": "9_group"
"group": "0_group@1"
},
{
"command": "_cl.eide.project.exportXml",
"when": "viewItem == SOLUTION && view == cl.eide.view.projects",
"group": "9_group"
"group": "0_group@2"
},
{
"command": "_cl.eide.project.exportMakefile",
"when": "viewItem == SOLUTION && view == cl.eide.view.projects",
"group": "0_group@3"
}
],
"_cl.eide.menu/ui/project/static-check": [
Expand Down
6 changes: 4 additions & 2 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
"eide.project.save.all": "Save All Projects",
"eide.project.active": "Active Project",
"eide.project.close": "Close Project",
"eide.project.export.template": "Eide Project Template",
"eide.project.export.keil": "Keil Project",
"eide.project.show.commands": "Show Compiler CommandLine",
"eide.project.switch.target": "Switch Target",
"eide.project.build": "Build",
Expand All @@ -39,6 +37,9 @@
"eide.prj.menus.sub.static-check.clear": "Clear Diagnostic Informations",

"eide.prj.menus.main.export": "Export As ...",
"eide.project.export.template": "Eide Project Template",
"eide.project.export.keil": "Keil Project",
"eide.project.export.makefile": "GNU Makefile",

"eide.workspace.build": "Build All",
"eide.workspace.rebuild": "Rebuild All",
Expand Down Expand Up @@ -103,6 +104,7 @@
"settings.builder.extraCommandLine": "Append additional commandline when invoke unify_builder",
"settings.builder.presetEnvVars": "Preset Global Environment Variables when build project",

"settings.enable.ccache": "Determine whether to enable [ccache](https://ccache.dev/) used to speed up compilation of large projects",
"settings.option.show.toolbar.in.editer.title": "Displays some toolbars in the editor title",
"settings.option.show.statusbar": "Displays toolbar icons in the status bar",
"settings.option.print.relative.path": "Print relative path when compile source file",
Expand Down
6 changes: 4 additions & 2 deletions package.nls.zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
"eide.project.save.all": "保存所有项目",
"eide.project.active": "设为活动",
"eide.project.close": "关闭项目",
"eide.project.export.template": "EIDE 模板",
"eide.project.export.keil": "Keil 项目",
"eide.project.show.commands": "查看生成的编译器命令行",
"eide.project.switch.target": "切换目标",
"eide.project.build": "构建",
Expand All @@ -39,6 +37,9 @@
"eide.prj.menus.sub.static-check.clear": "清除诊断结果",

"eide.prj.menus.main.export": "导出为 ...",
"eide.project.export.template": "EIDE 模板",
"eide.project.export.keil": "Keil 项目",
"eide.project.export.makefile": "GNU Makefile",

"eide.workspace.build": "构建所有项目",
"eide.workspace.rebuild": "重新构建所有项目",
Expand Down Expand Up @@ -103,6 +104,7 @@
"settings.builder.extraCommandLine": "构建时 unify_builder 的附加命令行参数",
"settings.builder.presetEnvVars": "构建时预设的全局环境变量",

"settings.enable.ccache": "决定是否启用 [ccache](https://ccache.dev/) 用于加速大型项目的编译速度",
"settings.option.show.toolbar.in.editer.title": "在编辑器的标题栏显示工具栏图标",
"settings.option.show.statusbar": "在状态栏显示工具栏图标",
"settings.option.print.relative.path": "编译时打印源文件的相对路径",
Expand Down
4 changes: 2 additions & 2 deletions res/tools/darwin/unify_builder/arm64/unify_builder.deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"targets": {
".NETCoreApp,Version=v6.0": {},
".NETCoreApp,Version=v6.0/osx-arm64": {
"unify_builder/3.7.5": {
"unify_builder/3.8.0": {
"dependencies": {
"CommandLineParser": "2.9.1",
"ConsoleTableExt": "3.1.9",
Expand Down Expand Up @@ -60,7 +60,7 @@
}
},
"libraries": {
"unify_builder/3.7.5": {
"unify_builder/3.8.0": {
"type": "project",
"serviceable": false,
"sha512": ""
Expand Down
Binary file modified res/tools/darwin/unify_builder/arm64/unify_builder.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions res/tools/darwin/unify_builder/x86_64/unify_builder.deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"targets": {
".NETCoreApp,Version=v6.0": {},
".NETCoreApp,Version=v6.0/osx-x64": {
"unify_builder/3.7.5": {
"unify_builder/3.8.0": {
"dependencies": {
"CommandLineParser": "2.9.1",
"ConsoleTableExt": "3.1.9",
Expand Down Expand Up @@ -60,7 +60,7 @@
}
},
"libraries": {
"unify_builder/3.7.5": {
"unify_builder/3.8.0": {
"type": "project",
"serviceable": false,
"sha512": ""
Expand Down
Binary file modified res/tools/darwin/unify_builder/x86_64/unify_builder.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions res/tools/linux/unify_builder/unify_builder.deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"targets": {
".NETCoreApp,Version=v6.0": {},
".NETCoreApp,Version=v6.0/linux-x64": {
"unify_builder/3.7.5": {
"unify_builder/3.8.0": {
"dependencies": {
"CommandLineParser": "2.9.1",
"ConsoleTableExt": "3.1.9",
Expand Down Expand Up @@ -60,7 +60,7 @@
}
},
"libraries": {
"unify_builder/3.7.5": {
"unify_builder/3.8.0": {
"type": "project",
"serviceable": false,
"sha512": ""
Expand Down
Binary file modified res/tools/linux/unify_builder/unify_builder.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions res/tools/win32/unify_builder/unify_builder.deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"targets": {
".NETCoreApp,Version=v6.0": {},
".NETCoreApp,Version=v6.0/win-x64": {
"unify_builder/3.7.5": {
"unify_builder/3.8.0": {
"dependencies": {
"CommandLineParser": "2.9.1",
"ConsoleTableExt": "3.1.9",
Expand Down Expand Up @@ -60,7 +60,7 @@
}
},
"libraries": {
"unify_builder/3.7.5": {
"unify_builder/3.8.0": {
"type": "project",
"serviceable": false,
"sha512": ""
Expand Down
Binary file modified res/tools/win32/unify_builder/unify_builder.dll
Binary file not shown.
Binary file modified res/tools/win32/unify_builder/unify_builder.exe
Binary file not shown.
50 changes: 32 additions & 18 deletions src/CodeBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,15 @@ import * as ArmCpuUtils from './ArmCpuUtils';

export interface BuildOptions {

dry_run?: boolean; // true: 仅输出编译命令及版本信息

not_rebuild?: boolean; // true: 增量编译,false: 重新编译所有

flashAfterBuild?: boolean;

onlyGenParams?: boolean;
onlyDumpCompilerInfo?: boolean; // true: 仅输出编译命令及版本信息

onlyDumpBuilderParams?: boolean;

otherArgs?: string[];
}

export interface BuilderParams {
Expand All @@ -90,6 +92,7 @@ export interface BuilderParams {
options: BuilderOptions;
sha?: { [options_name: string]: string };
env?: { [name: string]: any };
sysPaths?: string[];
}

export interface CompilerCommandsDatabaseItem {
Expand All @@ -104,7 +107,8 @@ export abstract class CodeBuilder {

protected project: AbstractProject;
protected useFastCompile?: boolean;
protected useShowParamsMode?: boolean;
protected onlyDumpCompilerInfo?: boolean;
protected otherArgs?: string[];
protected _event: events.EventEmitter;
protected logWatcher: FileWatcher | undefined;

Expand Down Expand Up @@ -240,9 +244,10 @@ export abstract class CodeBuilder {
build(options?: BuildOptions): void {

let commandLine = this.genBuildCommand(options);
if (options?.onlyDumpBuilderParams) return; // if only generate params, exit
if (!commandLine) return;

const title = (options?.dry_run ? 'compiler params' : 'build') + `:${this.project.getCurrentTarget()}`;
const title = (options?.onlyDumpCompilerInfo ? 'compiler params' : 'build') + `:${this.project.getCurrentTarget()}`;

// watch log, to emit done event
try {
Expand Down Expand Up @@ -310,9 +315,10 @@ export abstract class CodeBuilder {

genBuildCommand(options?: BuildOptions, disPowershell?: boolean): string | undefined {

// reinit build mode
// setup build mode
this.useFastCompile = options?.not_rebuild;
this.useShowParamsMode = options?.dry_run;
this.onlyDumpCompilerInfo = options?.onlyDumpCompilerInfo;
this.otherArgs = options?.otherArgs;

/* if not found toolchain, exit ! */
if (!this.project.checkAndNotifyInstallToolchain()) { return; }
Expand All @@ -325,9 +331,6 @@ export abstract class CodeBuilder {
const commandLine = generateDotnetProgramCmd(
ResManager.instance().getUnifyBuilderExe(), this.getCommands());

// if only generate params, exit
if (options?.onlyGenParams) return;

return commandLine;
}

Expand Down Expand Up @@ -404,7 +407,8 @@ export abstract class CodeBuilder {
sourceParams: sourceInfo.params,
sourceParamsMtime: sourceInfo.paramsModTime,
options: JSON.parse(JSON.stringify(compileOptions)),
env: this.project.getProjectVariables()
env: this.project.getProjectVariables(),
sysPaths: []
};

// set ram size from env
Expand Down Expand Up @@ -541,26 +545,36 @@ export abstract class CodeBuilder {
builderOptions.buildMode = builderModeList.map(str => str.toLowerCase()).join('|');
}

// write project build params
fs.writeFileSync(paramsPath, JSON.stringify(builderOptions, undefined, 4));

let cmds = [
'-p', paramsPath,
];
let cmds = ['-p', paramsPath];

if (this.isRebuild()) {
cmds.push('--rebuild');
} else {
if (settingManager.isEnableCcache(builderOptions.sourceList.length)) {
cmds.push('--use-ccache');
const dir = File.from(ResManager.instance().getBuiltInToolsDir().path, 'ccache');
if (dir.IsDir()) {
builderOptions.sysPaths?.push(dir.path);
}
}
}

if (this.useShowParamsMode) {
if (this.onlyDumpCompilerInfo) {
cmds.push('--only-dump-args');
}

if (this.otherArgs && this.otherArgs.length > 0) {
this.otherArgs.forEach(arg => cmds.push(arg));
}

const extraCmd = settingManager.getBuilderAdditionalCommandLine()?.trim();
if (extraCmd) {
cmds = cmds.concat(extraCmd.split(/\s+/));
}

// write project build params
fs.writeFileSync(paramsPath, JSON.stringify(builderOptions, undefined, 4));

return cmds;
}

Expand Down
3 changes: 3 additions & 0 deletions src/EIDEProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,9 @@ export abstract class AbstractProject implements CustomConfigurationProvider, Pr
return this.getProjectFile();
}

/**
* get project root dir, which contains *.code-workspace file
*/
public getProjectRoot(): File {
return this.getRootDir();
}
Expand Down
Loading