From 22591d2b427c11231b151878ec5c34ff02975f71 Mon Sep 17 00:00:00 2001 From: null Date: Mon, 16 May 2022 20:14:00 +0800 Subject: [PATCH] update --- CHANGELOG.md | 11 +++++++ package.json | 2 +- src/CodeBuilder.ts | 72 +++++++++++++++++++++++++--------------------- src/extension.ts | 4 ++- 4 files changed, 54 insertions(+), 35 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 157ef91..c6be0e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,17 @@ *** +### [v3.6.4] + +**Fixed**: + - Can not throw exception when extension can not get an available binaries version. + - Can not switch to rebuild mode after user changed global builder options. + +**Changed**: + - Allow mult-thread build for `Keil_C51` project. + +*** + ### [v3.6.3] **Fixed**: diff --git a/package.json b/package.json index 656111a..307e129 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "homepage": "https://github.com/github0null/eide/blob/master/README.md", "license": "MIT", "description": "A mcu development environment for 8051/AVR/STM8/Cortex-M/RISC-V", - "version": "3.6.3", + "version": "3.6.4", "preview": false, "engines": { "vscode": "^1.63.0" diff --git a/src/CodeBuilder.ts b/src/CodeBuilder.ts index bf6ae98..6db93ef 100644 --- a/src/CodeBuilder.ts +++ b/src/CodeBuilder.ts @@ -378,21 +378,7 @@ export abstract class CodeBuilder { const oldParamsPath = `${paramsPath}.old`; const prevParams: BuilderParams | undefined = File.IsFile(oldParamsPath) ? JSON.parse(fs.readFileSync(oldParamsPath, 'utf8')) : undefined; const sourceInfo = this.genSourceInfo(prevParams); - - // set build mode - const builderModeList: string[] = []; - - if (config.toolchain === 'Keil_C51') { - // disable increment compile for Keil C51 - builderModeList.push('Normal'); - } else { - builderModeList.push(this.isRebuild() ? 'Normal' : 'Fast'); - if (settingManager.isUseMultithreadMode()) { builderModeList.push('MULTHREAD'); } - } - - if (this.useShowParamsMode) { - builderModeList.push('Debug'); - } + const builderModeList: string[] = []; // build mode const builderOptions: BuilderParams = { name: config.name, @@ -400,7 +386,7 @@ export abstract class CodeBuilder { toolchain: toolchain.name, toolchainLocation: toolchain.getToolchainDir().path, toolchainCfgFile: toolchain.modelName, - buildMode: builderModeList.map(str => str.toLowerCase()).join('|'), + buildMode: 'fast|multhread', showRepathOnLog: settingManager.isPrintRelativePathWhenBuild(), threadNum: settingManager.getThreadNumber(), rootDir: this.project.GetRootDir().path, @@ -445,28 +431,48 @@ export abstract class CodeBuilder { // generate hash for compiler options builderOptions.sha = this.genHashFromCompilerOptions(builderOptions); - // check whether need rebuild project - if (this.isRebuild() == false && prevParams) { - try { - // not found hash from old params file - if (prevParams.sha == undefined) { - this.enableRebuild(); - } + // set build mode + { + // check whether need rebuild project + if (this.isRebuild() == false && prevParams) { + try { + // not found hash from old params file + if (prevParams.sha == undefined) { + this.enableRebuild(); + } - // check hash obj by specifies keys - else { - const keyList = ['global', 'c/cpp-defines', 'c/cpp-compiler', 'asm-compiler']; - for (const key of keyList) { - if (!this.compareHashObj(key, prevParams.sha, builderOptions.sha)) { - this.enableRebuild(); - break; + // check hash obj by specifies keys + else { + const keyList = ['global', 'c/cpp-defines', 'c/cpp-compiler', 'asm-compiler']; + for (const key of keyList) { + if (!this.compareHashObj(key, prevParams.sha, builderOptions.sha)) { + this.enableRebuild(); + break; + } } } + } catch (error) { + this.enableRebuild(); // make rebuild + GlobalEvent.emit('msg', ExceptionToMessage(error, 'Hidden')); } - } catch (error) { - this.enableRebuild(); // make rebuild - GlobalEvent.emit('msg', ExceptionToMessage(error, 'Hidden')); } + + if (config.toolchain === 'Keil_C51') { // disable increment compile for Keil C51 + builderModeList.push('normal'); + } else { + builderModeList.push(this.isRebuild() ? 'normal' : 'fast'); + } + + if (settingManager.isUseMultithreadMode()) { + builderModeList.push('multhread'); + } + + if (this.useShowParamsMode) { + builderModeList.push('debug'); + } + + // set build mode + builderOptions.buildMode = builderModeList.map(str => str.toLowerCase()).join('|'); } // write project build params diff --git a/src/extension.ts b/src/extension.ts index 3a87d01..322719d 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -504,7 +504,9 @@ async function tryUpdateBinaries(binFolder: File, localVer?: string, notConfirm? } } else { // binaries is not installed if (preinstallVersion == undefined) { - throw new Error(`Can not fetch binaries version from remote github repo, Check your network and retry !`); + const err = new Error(`Can not fetch binaries version from remote github repo (binaries minimum version required: '${minReqVersion}'), Check your network and retry !`); + GlobalEvent.emit('error', err); + return false; } }