From a7dbf11bc0c3f86db213d199bf7df85a5404ab8a Mon Sep 17 00:00:00 2001 From: drok Date: Wed, 6 Sep 2023 15:09:06 -0500 Subject: [PATCH 1/9] Assume the default build target is 'all' 'all' is a well-known name The default target must be explicitly named on the dry-run command line, because of [Remaking Makefiles](https://www.gnu.org/software/make/manual/html_node/Remaking-Makefiles.html) rule of GNU Make. In order to avoid remaking makefiles during a dry-run, the makefile must also be given as an explicit target. If the makefile were given as the only target, the dry-run would not mean 'dry-run the default target', but 'dry-run nothing'. Thus, if the makefile must be given as a target, the default target must be made explicit, and thus is must be defined. Also, previously 'all' was added to the make invokation for listing targets. This would prevent the .DEFAULT_GOAL to be correctly set as the Makefile declared, and instead be set to the value given on the command line. An explicit target is no longer given on the --print-data-base invocation, so the output .DEFAULT_GOAL will be the genuine default goal. This commit makes currentTarget always defined, with the default value 'all'; this is a reasonable, well-known default. --- src/configuration.ts | 18 ++++++++---------- src/make.ts | 14 +++----------- src/test/fakeSuite/extension.test.ts | 8 -------- 3 files changed, 11 insertions(+), 29 deletions(-) diff --git a/src/configuration.ts b/src/configuration.ts index ed5b23f7..ae2208b4 100644 --- a/src/configuration.ts +++ b/src/configuration.ts @@ -936,24 +936,22 @@ export async function readMakefileConfigurations(): Promise { // Last target picked from the set of targets that are run by the makefiles // when building for the current configuration. // Saved into the settings storage. Also reflected in the configuration status bar button -let currentTarget: string | undefined; -export function getCurrentTarget(): string | undefined { return currentTarget; } -export function setCurrentTarget(target: string | undefined): void { currentTarget = target; } +// Assume the well-known "all" target for the default goal +let currentTarget: string = "all"; +export function getCurrentTarget(): string { return currentTarget; } +// Set the current target, or 'all' if none was given +export function setCurrentTarget(target: string = "all"): void { currentTarget = target; } // Read current target from workspace state, update status bar item function readCurrentTarget(): void { let buildTarget : string | undefined = extension.getState().buildTarget; + setCurrentTarget(buildTarget); if (!buildTarget) { - logger.message("No target defined in the workspace state. Assuming 'Default'."); - statusBar.setTarget("Default"); - // If no particular target is defined in settings, use 'Default' for the button - // but keep the variable empty, to not append it to the make command. - currentTarget = ""; + logger.message(`No target defined in the workspace state. Assuming '${currentTarget}'.`); } else { - currentTarget = buildTarget; logger.message(`Reading current build target "${currentTarget}" from the workspace state.`); - statusBar.setTarget(currentTarget); } + statusBar.setTarget(currentTarget); } let configureOnOpen: boolean | undefined; diff --git a/src/make.ts b/src/make.ts index 21e5a403..7bccb43c 100644 --- a/src/make.ts +++ b/src/make.ts @@ -446,17 +446,6 @@ export async function generateParseContent(progress: vscode.Progress<{}>, // Continue with the make dryrun invocation let makeArgs: string[] = []; - // Prepend the target to the arguments given in the makefile.configurations object, - // unless we want to parse for the full set of available targets. - if (forTargets) { - makeArgs.push("all"); - } else { - let currentTarget: string | undefined = configuration.getCurrentTarget(); - if (currentTarget) { - makeArgs.push(currentTarget); - } - } - // Include all the make arguments defined in makefile.configurations.makeArgs makeArgs = makeArgs.concat(configuration.getConfigurationMakeArgs()); @@ -492,6 +481,9 @@ export async function generateParseContent(progress: vscode.Progress<{}>, } }); + // Append the target to the arguments given in the makefile.configurations object + makeArgs.push(configuration.getCurrentTarget()); + logger.messageNoCR(`Generating ${getConfigureIsInBackground() ? "in the background a new " : ""}configuration cache with command: `); } diff --git a/src/test/fakeSuite/extension.test.ts b/src/test/fakeSuite/extension.test.ts index 10e7f8bb..b0bf089c 100644 --- a/src/test/fakeSuite/extension.test.ts +++ b/src/test/fakeSuite/extension.test.ts @@ -64,7 +64,6 @@ suite('Fake dryrun parsing', /*async*/() => { await vscode.workspace.getConfiguration("makefile").update("launchConfigurations", undefined); configuration.setCurrentLaunchConfiguration(undefined); configuration.setCurrentMakefileConfiguration("Default"); - configuration.setCurrentTarget(undefined); configuration.initFromState(); await configuration.initFromSettings(); @@ -118,7 +117,6 @@ suite('Fake dryrun parsing', /*async*/() => { await vscode.workspace.getConfiguration("makefile").update("launchConfigurations", undefined); configuration.setCurrentLaunchConfiguration(undefined); configuration.setCurrentMakefileConfiguration("Default"); - configuration.setCurrentTarget(undefined); configuration.initFromState(); await configuration.initFromSettings(); @@ -173,7 +171,6 @@ suite('Fake dryrun parsing', /*async*/() => { await vscode.workspace.getConfiguration("makefile").update("launchConfigurations", undefined); configuration.setCurrentLaunchConfiguration(undefined); configuration.setCurrentMakefileConfiguration("Default"); - configuration.setCurrentTarget(undefined); configuration.initFromState(); await configuration.initFromSettings(); @@ -250,7 +247,6 @@ suite('Fake dryrun parsing', /*async*/() => { await vscode.workspace.getConfiguration("makefile").update("launchConfigurations", undefined); configuration.setCurrentLaunchConfiguration(undefined); configuration.setCurrentMakefileConfiguration("Default"); - configuration.setCurrentTarget(undefined); configuration.initFromState(); await configuration.initFromSettings(); @@ -312,7 +308,6 @@ suite('Fake dryrun parsing', /*async*/() => { await vscode.workspace.getConfiguration("makefile").update("launchConfigurations", undefined); configuration.setCurrentLaunchConfiguration(undefined); configuration.setCurrentMakefileConfiguration("Default"); - configuration.setCurrentTarget(undefined); configuration.initFromState(); await configuration.initFromSettings(); @@ -374,7 +369,6 @@ suite('Fake dryrun parsing', /*async*/() => { await vscode.workspace.getConfiguration("makefile").update("launchConfigurations", undefined); configuration.setCurrentLaunchConfiguration(undefined); configuration.setCurrentMakefileConfiguration("Default"); - configuration.setCurrentTarget(undefined); configuration.initFromState(); await configuration.initFromSettings(); @@ -434,7 +428,6 @@ suite('Fake dryrun parsing', /*async*/() => { await vscode.workspace.getConfiguration("makefile").update("launchConfigurations", undefined); configuration.setCurrentLaunchConfiguration(undefined); configuration.setCurrentMakefileConfiguration("Default"); - configuration.setCurrentTarget(undefined); configuration.initFromState(); await configuration.initFromSettings(); @@ -476,7 +469,6 @@ suite('Fake dryrun parsing', /*async*/() => { await vscode.workspace.getConfiguration("makefile").update("launchConfigurations", undefined); configuration.setCurrentLaunchConfiguration(undefined); configuration.setCurrentMakefileConfiguration("Default"); - configuration.setCurrentTarget(undefined); configuration.initFromState(); await configuration.initFromSettings(); From ba6955518d39370a23d4af5293e33ae909d612e4 Mon Sep 17 00:00:00 2001 From: Radu Hociung Date: Fri, 13 Oct 2023 01:33:03 -0400 Subject: [PATCH 2/9] Avoid infinite dry-run loop with automake projects The top makefile in projects that use autotools and automake contains a rule to remake the makefile itself when the configuration changes (configure.ac). Even when dry-running, GNU make regenerates the makefile, in a bid to generate a 'correct' dry-run output. VScode needs to add --always-make in order to get a complete view of the dry-run. Without it, it would only get the commands needed for outdated targets. These two behaviours combined cause a naive 'make --dry-run --always-make' to continuously remake the Makefile. In order to avoid this infinite loop, make must be instructed as in the "Remaking Makefiles" man page, to avoid remaking the makefile. This is done by adding two options: --assume-old=Makefile, and Makefile (ie, target). Make requires the Makefile to be explicitly specified as target, otherwise it ignores the --assume-old=Makefile option. Furthermore, Makefiles generated by automake cause the top invocation to be a recursive sub-make invocation. On recursive makes, make itself calls submake without passing the --assume-old option, thus breaking the combo required for the sub-make to avoid remaking the makefile. As a result, automake Makefiles need one more workaround. The --assume-old option must be manually passed to sub-make via the AM_MAKEFLAGS, which is always appended to sub-make's command line. This commit implements the above incantation to enable automake Makefiles to be dry-run without an infinite loop. Additionally, the makefilePath, makeDirectory, updatedMakefilePath and updatedMakeDirectory variables are made to store the respective setting, rather then re-purposing them to store the corresponding resolved, absolute paths. makefilePath cannot be undefined because for dry-running the name of the makefile must always be supplied on the make commandline. --- package.nls.json | 2 +- src/configuration.ts | 30 +++++++++++++----------------- src/make.ts | 4 ++++ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/package.nls.json b/package.nls.json index 70aa16cf..ab07361d 100644 --- a/package.nls.json +++ b/package.nls.json @@ -23,7 +23,7 @@ "makefile-tools.configuration.makefile.makePath.description": "The path to the make tool", "makefile-tools.configuration.makefile.configurations.description": "The user defined makefile configurations", "makefile-tools.configuration.makefile.configurations.name.description": "The name of the makefile configuration", - "makefile-tools.configuration.makefile.configurations.makefilePath.description": "File path to the makefile", + "makefile-tools.configuration.makefile.configurations.makefilePath.description": "File path to the makefile. Defaults to 'Makefile'", "makefile-tools.configuration.makefile.configurations.makePath.description": "File path to the make command", "makefile-tools.configuration.makefile.configurations.makeDirectory.description": "Folder path passed to make via the -C switch", "makefile-tools.configuration.makefile.configurations.makeArgs.description": "Arguments to pass to the make command", diff --git a/src/configuration.ts b/src/configuration.ts index ae2208b4..0f93e1b8 100644 --- a/src/configuration.ts +++ b/src/configuration.ts @@ -194,35 +194,37 @@ async function readMakePath(): Promise { } } -let makefilePath: string | undefined; -export function getMakefilePath(): string | undefined { return makefilePath; } -export function setMakefilePath(path: string): void { makefilePath = path; } +let makefilePath: string = "Makefile"; +export function getMakefilePath(): string { return makefilePath; } +export function setMakefilePath(path: string = "Makefile"): void { makefilePath = path; } // Read the full path to the makefile if defined in settings. // It represents a default to look for if no other makefile is already provided // in makefile.configurations.makefilePath. // TODO: validate and integrate with "-f [Makefile]" passed in makefile.configurations.makeArgs. async function readMakefilePath(): Promise { - makefilePath = await util.getExpandedSetting("makefilePath"); - if (!makefilePath) { + let makefilePathSetting: string | undefined = await util.getExpandedSetting("makefilePath"); + if (!makefilePathSetting) { logger.message("No path to the makefile is defined in the settings file."); + setMakefilePath(); } else { - makefilePath = util.resolvePathToRoot(makefilePath); + setMakefilePath(makefilePathSetting); } } let makeDirectory: string | undefined; export function getMakeDirectory(): string | undefined { return makeDirectory; } -export function setMakeDirectory(dir: string): void { makeDirectory = dir; } +export function setMakeDirectory(dir: string = ''): void { makeDirectory = dir; } // Read the make working directory path if defined in settings. // It represents a default to look for if no other makeDirectory is already provided // in makefile.configurations.makeDirectory. // TODO: validate and integrate with "-C [DIR_PATH]" passed in makefile.configurations.makeArgs. async function readMakeDirectory(): Promise { - makeDirectory = await util.getExpandedSetting("makeDirectory"); - if (!makeDirectory) { + let makeDirectorySetting: string | undefined = await util.getExpandedSetting("makeDirectory"); + if (!makeDirectorySetting) { logger.message("No folder path to the makefile is defined in the settings file."); + setMakeDirectory(); } else { - makeDirectory = util.resolvePathToRoot(makeDirectory); + setMakeDirectory(makeDirectorySetting); } } @@ -806,7 +808,7 @@ export async function getCommandForConfiguration(configuration: string | undefin } } - if (!util.checkFileExistsSync(configurationMakefile)) { + if (!util.checkFileExistsSync(util.resolvePathToRoot(configurationMakefile))) { logger.message("The makefile entry point was not found. " + "Make sure it exists at the location defined by makefile.makefilePath, makefile.configurations[].makefilePath, " + "makefile.makeDirectory, makefile.configurations[].makeDirectory" + @@ -1305,9 +1307,6 @@ export async function initFromSettings(activation: boolean = false): Promise(subKey); - if (updatedMakefilePath) { - updatedMakefilePath = util.resolvePathToRoot(updatedMakefilePath); - } if (updatedMakefilePath !== makefilePath) { // A change in makefile.makefilePath should trigger an IntelliSense update // only if the extension is not currently reading from a build log. @@ -1319,9 +1318,6 @@ export async function initFromSettings(activation: boolean = false): Promise(subKey); - if (updatedMakeDirectory) { - updatedMakeDirectory = util.resolvePathToRoot(updatedMakeDirectory); - } if (updatedMakeDirectory !== makeDirectory) { // A change in makefile.makeDirectory should trigger an IntelliSense update // only if the extension is not currently reading from a build log. diff --git a/src/make.ts b/src/make.ts index 7bccb43c..93348320 100644 --- a/src/make.ts +++ b/src/make.ts @@ -467,7 +467,11 @@ export async function generateParseContent(progress: vscode.Progress<{}>, makeArgs.push("--question"); logger.messageNoCR("Generating targets information with command: "); } else { + const makefilePath :string = configuration.getMakefilePath(); makeArgs.push("--dry-run"); + makeArgs.push(`--assume-old=${makefilePath}`); + makeArgs.push(makefilePath); + makeArgs.push("AM_MAKEFLAGS=--assume-old=Makefile Makefile"); // If this is not a clean configure, remove --always-make from the arguments list. // We need to have --always-make in makefile.dryrunSwitches and remove it for not clean configure From 3ecd35ab8465065e839d4de2ab3b2c1e9d4a1b81 Mon Sep 17 00:00:00 2001 From: Radu Hociung Date: Fri, 13 Oct 2023 05:03:46 -0400 Subject: [PATCH 3/9] Fix out-of-tree builds out-of-tree builds allow multiple configurations to be built simultaneously from one source tree. Each build configuration exists in a separate builddir, and the srcdir contains no configuration, object files or build artifacts. The builddir need not be a subdirectory of srcdir, and typically it is on another filesystem than the sources. In an autotools project which uses automake, the Makefiles are object files, ie they are generated specifically for a particular configuration, therefore they reside in the builddir. When building an autotools project out-of-tree, the workspace is the srcdir, and does not contain a Makefile. instead, the Makefile is in $makeDirectory which is the builddir. This commit cleans up the detection of makefile location that is done in the extension so that the correct makefile is found, even if it lives out-of-tree/out-of-workspace, has a name other than Makefile/makefile, an whether or not a file named Makefile also exists in the srcdir. The activationEvent is changed to "*" because when building out of tree, there are no makefiles in the workspace. "*" is the better activation because it means activate whenever the user enabled the extension; don't second guess. OTOH, the extension does nothing if a makefile is not found and not configured, so it's safe to have it activated on workspaces without makefiles, because of the cleaned-up detection/configuration of makefiles. --- package.json | 39 +---------------- src/configuration.ts | 101 +++++++++++++++++++++++++++---------------- 2 files changed, 65 insertions(+), 75 deletions(-) diff --git a/package.json b/package.json index 9b5d9acd..59489943 100644 --- a/package.json +++ b/package.json @@ -37,44 +37,7 @@ "Other" ], "activationEvents": [ - "onCommand:makefile.setBuildConfiguration", - "onCommand:makefile.getConfiguration", - "onCommand:makefile.setBuildTarget", - "onCommand:makefile.getBuildTarget", - "onCommand:makefile.buildTarget", - "onCommand:makefile.buildCleanTarget", - "onCommand:makefile.buildAll", - "onCommand:makefile.buildCleanAll", - "onCommand:makefile.setLaunchConfiguration", - "onCommand:makefile.launchDebug", - "onCommand:makefile.launchRun", - "onCommand:makefile.launchTargetPath", - "onCommand:makefile.getLaunchTargetPath", - "onCommand:makefile.launchTargetFileName", - "onCommand:makefile.getLaunchTargetFileName", - "onCommand:makefile.getLaunchTargetDirectory", - "onCommand:makefile.getLaunchTargetArgs", - "onCommand:makefile.getLaunchTargetArgsConcat", - "onCommand:makefile.makeBaseDirectory", - "onCommand:makefile.configure", - "onCommand:makefile.cleanConfigure", - "onCommand:makefile.preConfigure", - "onCommand:makefile.postConfigure", - "onCommand:makefile.outline.setBuildConfiguration", - "onCommand:makefile.outline.setBuildTarget", - "onCommand:makefile.outline.buildTarget", - "onCommand:makefile.outline.buildCleanTarget", - "onCommand:makefile.outline.setLaunchConfiguration", - "onCommand:makefile.outline.launchDebug", - "onCommand:makefile.outline.launchRun", - "onCommand:makefile.outline.configure", - "onCommand:makefile.outline.cleanConfigure", - "onCommand:makefile.outline.preConfigure", - "onCommand:makefile.outline.postConfigure", - "onCommand:makefile.resetState", - "workspaceContains:**/makefile", - "workspaceContains:**/Makefile", - "workspaceContains:**/GNUmakefile" + "*" ], "main": "./out/src/extension.js", "contributes": { diff --git a/src/configuration.ts b/src/configuration.ts index 0f93e1b8..656dc069 100644 --- a/src/configuration.ts +++ b/src/configuration.ts @@ -699,39 +699,82 @@ export async function getCommandForConfiguration(configuration: string | undefin configurationMakeCommand += ".exe"; } + // Add the working directory path via the -C switch. + // makefile.configurations.makeDirectory overwrites makefile.makeDirectory. + let makeDirectoryUsed: string | undefined = makefileConfiguration?.makeDirectory ? util.resolvePathToRoot(makefileConfiguration?.makeDirectory) : makeDirectory; + if (makeDirectoryUsed) { + configurationMakeArgs.push("-C"); + configurationMakeArgs.push(`${makeDirectoryUsed}`); + configurationMakefile = makeDirectoryUsed; + } + // Add the makefile path via the -f make switch. + // The make file is in makeDirectory or in the workspace directory, + // and is named "Makefile" or "makefile". // makefile.configurations.makefilePath overwrites makefile.makefilePath. - configurationMakefile = makefileConfiguration?.makefilePath ? util.resolvePathToRoot(makefileConfiguration?.makefilePath) : makefilePath; - if (configurationMakefile) { - // check if the makefile path is a directory. If so, try adding `Makefile` or `makefile` - if (util.checkDirectoryExistsSync(configurationMakefile)) { - let makeFileTest: string = path.join(configurationMakefile, "Makefile"); - if (!util.checkFileExistsSync(makeFileTest)) { - makeFileTest = path.join(configurationMakefile, "makefile"); + let makeFileTest: string | undefined; + // filename of makefile relative to makeDirectory + let relativeMakefile: string | undefined; + let makefileExists : boolean = false; + if (makeDirectoryUsed) { + // check if the makefile path is a directory. If so, try adding + // the configuration makefilePath, then the makefilePath, then `Makefile` or `makefile` + if (util.checkDirectoryExistsSync(makeDirectoryUsed)) { + if (makefileConfiguration?.makefilePath) { + makeFileTest = path.join(makeDirectoryUsed, makefileConfiguration?.makefilePath); + relativeMakefile = makefileConfiguration?.makefilePath; + makefileExists = util.checkFileExistsSync(util.resolvePathToRoot(makeFileTest)); + if (!makefileExists) { + makeFileTest = makefilePath; + relativeMakefile = util.resolvePathToRoot(makeFileTest); + makefileExists = util.checkFileExistsSync(util.resolvePathToRoot(makeFileTest)); + } } - - // if we found the makefile in the directory, set the `configurationMakefile` to the found file path. - if (util.checkFileExistsSync(makeFileTest)) { - configurationMakefile = makeFileTest; + if (!makefileExists) { + makeFileTest = path.join(makeDirectoryUsed, makefilePath); + relativeMakefile = makefilePath; + makefileExists = util.checkFileExistsSync(util.resolvePathToRoot(makeFileTest)); + if (!makefileExists) { + if (makefilePath != "Makefile") { + relativeMakefile = "Makefile"; + makeFileTest = path.join(makeDirectoryUsed, relativeMakefile); + makefileExists = util.checkFileExistsSync(util.resolvePathToRoot(makeFileTest)); + } + if (!makefileExists) { + relativeMakefile = "makefile"; + makeFileTest = path.join(makeDirectoryUsed, relativeMakefile); + makefileExists = util.checkFileExistsSync(util.resolvePathToRoot(makeFileTest)); + } + } } } + } + if (!makefileExists) { + if (!makeDirectoryUsed && makefileConfiguration?.makefilePath) { + relativeMakefile = makefileConfiguration?.makefilePath; + makeFileTest = makefileConfiguration?.makefilePath; + makefileExists = util.checkFileExistsSync(util.resolvePathToRoot(makeFileTest)); + } + } + if (!makefileExists) { + makeFileTest = makefilePath; + relativeMakefile = makefilePath; + makefileExists = util.checkFileExistsSync(util.resolvePathToRoot(makeFileTest)); + } + // if we found the makefile in the directory, set the `configurationMakefile` to the found file path. + if (makefileExists) { + configurationMakefile = relativeMakefile; configurationMakeArgs.push("-f"); - configurationMakeArgs.push(`${configurationMakefile}`); + configurationMakeArgs.push(`${relativeMakefile}`); + setMakefilePath(relativeMakefile); + setConfigurationMakefile(makeFileTest); // Need to rethink this (GitHub 59). // Some repos don't work when we automatically add -C, others don't work when we don't. // configurationMakeArgs.push("-C"); // configurationMakeArgs.push(path.parse(configurationMakefile).dir); } - // Add the working directory path via the -C switch. - // makefile.configurations.makeDirectory overwrites makefile.makeDirectory. - let makeDirectoryUsed: string | undefined = makefileConfiguration?.makeDirectory ? util.resolvePathToRoot(makefileConfiguration?.makeDirectory) : makeDirectory; - if (makeDirectoryUsed) { - configurationMakeArgs.push("-C"); - configurationMakeArgs.push(`${makeDirectoryUsed}`); - } - // Make sure we append "makefile.configurations[].makeArgs" last, in case the developer wants to overwrite any arguments that the extension // deduces from the settings. Additionally, for -f/-C, resolve path to root. if (makefileConfiguration?.makeArgs) { @@ -755,22 +798,6 @@ export async function getCommandForConfiguration(configuration: string | undefin logger.message(`Deduced command '${configurationMakeCommand} ${configurationMakeArgs.join(" ")}' for configuration "${configuration}"`); } - // Check for makefile path on disk: we search first for any makefile specified via the makefilePath setting, - // then via the makeDirectory setting and then in the root of the workspace. On linux/mac, it often is 'Makefile', so verify that we default to the right filename. - if (!configurationMakefile) { - if (makeDirectoryUsed) { - configurationMakefile = util.resolvePathToRoot(path.join(makeDirectoryUsed, "Makefile")); - if (!util.checkFileExistsSync(configurationMakefile)) { - configurationMakefile = util.resolvePathToRoot(path.join(makeDirectoryUsed, "makefile")); - } - } else { - configurationMakefile = util.resolvePathToRoot("./Makefile"); - if (!util.checkFileExistsSync(configurationMakefile)) { - configurationMakefile = util.resolvePathToRoot("./makefile"); - } - } - } - // Validation and warnings about properly defining the makefile and make tool. // These are not needed if the current configuration reads from a build log instead of dry-run output. let buildLog: string | undefined = getConfigurationBuildLog(); @@ -808,7 +835,7 @@ export async function getCommandForConfiguration(configuration: string | undefin } } - if (!util.checkFileExistsSync(util.resolvePathToRoot(configurationMakefile))) { + if (!makefileExists) { logger.message("The makefile entry point was not found. " + "Make sure it exists at the location defined by makefile.makefilePath, makefile.configurations[].makefilePath, " + "makefile.makeDirectory, makefile.configurations[].makeDirectory" + From 5dca75f157b28787b3f7220d312ea70dd72c1997 Mon Sep 17 00:00:00 2001 From: Radu Hociung Date: Sat, 14 Oct 2023 21:56:04 -0400 Subject: [PATCH 4/9] Always show "Set Current Build Configuration" in pallete When building out of tree, whether the extension is in fullFeatureSet or not depends on which build configuration is chosen. The workspace does not have a Makefile, but one of the builddirs in a configuration does. Allow that configuration to be selected, unconditionally on the currently selected configuration. --- package.json | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/package.json b/package.json index 59489943..6b9b3abd 100644 --- a/package.json +++ b/package.json @@ -569,10 +569,6 @@ "command": "makefile.launchRun", "when": "makefile:localRunFeature" }, - { - "command": "makefile.setBuildConfiguration", - "when": "makefile:fullFeatureSet" - }, { "command": "makefile.setBuildTarget", "when": "makefile:fullFeatureSet" @@ -681,7 +677,7 @@ }, { "command": "makefile.outline.setBuildConfiguration", - "when": "makefile:fullFeatureSet && view == makefile.outline && viewItem =~ /nodeType=configuration/", + "when": "view == makefile.outline && viewItem =~ /nodeType=configuration/", "group": "inline@1" }, { From 38ba2fcbe032c94d41c50b24fec805fe07b46ad6 Mon Sep 17 00:00:00 2001 From: Radu Hociung Date: Sun, 15 Oct 2023 03:27:02 -0400 Subject: [PATCH 5/9] Make buildLog per-configuration Previously, one buildLog was used for all configurations, which is wrong, because the build is subject to configuration. When a (non-Default) configuration is active, its buildLog will be used. If not set, no buildLog will be used. The Default configuration buildLog will not be used for a specific configuration. When the apropriate buildLog (either Default or specific) is not set, the make --dry-run process will be followed to obtain a fresh build configuration. --- src/configuration.ts | 145 ++++++++++++++------------- src/extension.ts | 2 +- src/make.ts | 5 +- src/telemetry.ts | 2 +- src/test/fakeSuite/extension.test.ts | 1 + src/util.ts | 2 +- 6 files changed, 85 insertions(+), 72 deletions(-) diff --git a/src/configuration.ts b/src/configuration.ts index 656dc069..f33b527e 100644 --- a/src/configuration.ts +++ b/src/configuration.ts @@ -57,21 +57,36 @@ export interface MakefileConfiguration { // instead of the dry-run output of the make tool buildLog?: string; + // is this a default configuration? + isDefault: boolean; + // TODO: investigate how flexible this is to integrate with other build systems than the MAKE family // (basically anything that can produce a dry-run output is sufficient) // Implement set-able dry-run, verbose, change-directory and always-make switches // since different tools may use different arguments for the same behavior } +let currentMakefileConfigurationName: string | "Default"; +export async function setCurrentMakefileConfigurationName(configuration: string | undefined): Promise { + currentMakefileConfigurationName = configuration || "Default"; +} + // Last configuration name picked from the set defined in makefile.configurations setting. // Saved into the workspace state. Also reflected in the configuration status bar button. // If no particular current configuration is defined in settings, set to 'Default'. -let currentMakefileConfiguration: string; -export function getCurrentMakefileConfiguration(): string { return currentMakefileConfiguration; } -export async function setCurrentMakefileConfiguration(configuration: string): Promise { - currentMakefileConfiguration = configuration; - statusBar.setConfiguration(currentMakefileConfiguration); - await analyzeConfigureParams(); +let currentMakefileConfiguration: MakefileConfiguration; +export function getCurrentMakefileConfiguration(): MakefileConfiguration { return currentMakefileConfiguration; } +export async function setCurrentMakefileConfiguration(configuration: string | undefined): Promise { + currentMakefileConfiguration = (configuration && getMakefileConfiguration(configuration)) || { + name: "Default", + makefilePath: makefilePath, + makePath: makePath, + makeDirectory: makeDirectory, + buildLog: buildLog, + isDefault: true + }; + statusBar.setConfiguration(currentMakefileConfiguration.name); + await extension.updateBuildLogPresent(currentMakefileConfiguration.buildLog ? true : false); } // Read the current configuration from workspace state, update status bar item @@ -79,13 +94,10 @@ export function readCurrentMakefileConfiguration(): void { let buildConfiguration : string | undefined = extension.getState().buildConfiguration; if (!buildConfiguration) { logger.message("No current configuration is defined in the workspace state. Assuming 'Default'."); - currentMakefileConfiguration = "Default"; } else { logger.message(`Reading current configuration "${buildConfiguration}" from the workspace state.`); - currentMakefileConfiguration = buildConfiguration; } - - statusBar.setConfiguration(currentMakefileConfiguration); + setCurrentMakefileConfigurationName(buildConfiguration); } // as described in makefile.panel.visibility @@ -656,12 +668,12 @@ export function setConfigurationBuildLog(name: string): void { configurationBuil // according to various merging rules and decide what make command and build log // apply to the current makefile configuration. async function analyzeConfigureParams(): Promise { - getBuildLogForConfiguration(currentMakefileConfiguration); - await getCommandForConfiguration(currentMakefileConfiguration); - getProblemMatchersForConfiguration(currentMakefileConfiguration); + getBuildLogForConfiguration(); + await getCommandForConfiguration(); + getProblemMatchersForConfiguration(); } -function getMakefileConfiguration(configuration: string | undefined): MakefileConfiguration | undefined { +function getMakefileConfiguration(configuration: string): MakefileConfiguration | undefined { return makefileConfigurations.find(k => { if (k.name === configuration) { return k; @@ -672,11 +684,9 @@ function getMakefileConfiguration(configuration: string | undefined): MakefileCo // Helper to find in the array of MakefileConfiguration which command/args correspond to a configuration name. // Higher level settings (like makefile.makePath, makefile.makefilePath or makefile.makeDirectory) // also have an additional effect on the final command. -export async function getCommandForConfiguration(configuration: string | undefined): Promise { - let makefileConfiguration: MakefileConfiguration | undefined = getMakefileConfiguration(configuration); - +export async function getCommandForConfiguration(): Promise { let makeParsedPathSettings: path.ParsedPath | undefined = makePath ? path.parse(makePath) : undefined; - let makeParsedPathConfigurations: path.ParsedPath | undefined = makefileConfiguration?.makePath ? path.parse(makefileConfiguration?.makePath) : undefined; + let makeParsedPathConfigurations: path.ParsedPath | undefined = currentMakefileConfiguration.makePath ? path.parse(currentMakefileConfiguration.makePath) : undefined; configurationMakeArgs = []; @@ -701,7 +711,7 @@ export async function getCommandForConfiguration(configuration: string | undefin // Add the working directory path via the -C switch. // makefile.configurations.makeDirectory overwrites makefile.makeDirectory. - let makeDirectoryUsed: string | undefined = makefileConfiguration?.makeDirectory ? util.resolvePathToRoot(makefileConfiguration?.makeDirectory) : makeDirectory; + let makeDirectoryUsed: string | undefined = currentMakefileConfiguration.makeDirectory ? util.resolvePathToRoot(currentMakefileConfiguration.makeDirectory) : makeDirectory; if (makeDirectoryUsed) { configurationMakeArgs.push("-C"); configurationMakeArgs.push(`${makeDirectoryUsed}`); @@ -720,9 +730,9 @@ export async function getCommandForConfiguration(configuration: string | undefin // check if the makefile path is a directory. If so, try adding // the configuration makefilePath, then the makefilePath, then `Makefile` or `makefile` if (util.checkDirectoryExistsSync(makeDirectoryUsed)) { - if (makefileConfiguration?.makefilePath) { - makeFileTest = path.join(makeDirectoryUsed, makefileConfiguration?.makefilePath); - relativeMakefile = makefileConfiguration?.makefilePath; + if (currentMakefileConfiguration.makefilePath) { + makeFileTest = path.join(makeDirectoryUsed, currentMakefileConfiguration.makefilePath); + relativeMakefile = currentMakefileConfiguration.makefilePath; makefileExists = util.checkFileExistsSync(util.resolvePathToRoot(makeFileTest)); if (!makefileExists) { makeFileTest = makefilePath; @@ -750,9 +760,9 @@ export async function getCommandForConfiguration(configuration: string | undefin } } if (!makefileExists) { - if (!makeDirectoryUsed && makefileConfiguration?.makefilePath) { - relativeMakefile = makefileConfiguration?.makefilePath; - makeFileTest = makefileConfiguration?.makefilePath; + if (!makeDirectoryUsed && currentMakefileConfiguration.makefilePath) { + relativeMakefile = currentMakefileConfiguration.makefilePath; + makeFileTest = currentMakefileConfiguration.makefilePath; makefileExists = util.checkFileExistsSync(util.resolvePathToRoot(makeFileTest)); } } @@ -777,9 +787,9 @@ export async function getCommandForConfiguration(configuration: string | undefin // Make sure we append "makefile.configurations[].makeArgs" last, in case the developer wants to overwrite any arguments that the extension // deduces from the settings. Additionally, for -f/-C, resolve path to root. - if (makefileConfiguration?.makeArgs) { + if (currentMakefileConfiguration.makeArgs) { let prevArg: string = ""; - makefileConfiguration.makeArgs.forEach(arg => { + currentMakefileConfiguration.makeArgs.forEach(arg => { if (prevArg === "-C") { configurationMakeArgs.push(util.resolvePathToRoot(arg)); } else if (arg.startsWith("--directory")) { @@ -795,12 +805,12 @@ export async function getCommandForConfiguration(configuration: string | undefin } if (configurationMakeCommand) { - logger.message(`Deduced command '${configurationMakeCommand} ${configurationMakeArgs.join(" ")}' for configuration "${configuration}"`); + logger.message(`Deduced command '${configurationMakeCommand} ${configurationMakeArgs.join(" ")}' for configuration "${currentMakefileConfiguration.name}"`); } // Validation and warnings about properly defining the makefile and make tool. // These are not needed if the current configuration reads from a build log instead of dry-run output. - let buildLog: string | undefined = getConfigurationBuildLog(); + let buildLog: string | undefined = currentMakefileConfiguration.buildLog; let buildLogContent: string | undefined = buildLog ? util.readFile(buildLog) : undefined; if (!buildLogContent) { if ((!makeParsedPathSettings || makeParsedPathSettings.name === "") && @@ -844,7 +854,7 @@ export async function getCommandForConfiguration(configuration: string | undefin // we may need more advanced ability to process settings // insight into different project structures const telemetryProperties: telemetry.Properties = { - reason: makefileConfiguration?.makefilePath || makefilePath ? + reason: currentMakefileConfiguration.makefilePath || makefilePath ? "not found at path given in settings" : (makeDirectoryUsed ? "not found in -C provided make directory" : "not found in workspace root") @@ -865,20 +875,16 @@ export async function getCommandForConfiguration(configuration: string | undefin } // Helper to find in the array of MakefileConfiguration which problemMatchers correspond to a configuration name -export function getProblemMatchersForConfiguration(configuration: string | undefined): void { - let makefileConfiguration: MakefileConfiguration | undefined = getMakefileConfiguration(configuration); - - configurationProblemMatchers = makefileConfiguration?.problemMatchers || []; +export function getProblemMatchersForConfiguration(): void { + configurationProblemMatchers = currentMakefileConfiguration.problemMatchers || []; } // Helper to find in the array of MakefileConfiguration which buildLog correspond to a configuration name -export function getBuildLogForConfiguration(configuration: string | undefined): void { - let makefileConfiguration: MakefileConfiguration | undefined = getMakefileConfiguration(configuration); - - configurationBuildLog = makefileConfiguration?.buildLog; +export function getBuildLogForConfiguration(): void { + configurationBuildLog = currentMakefileConfiguration.buildLog; if (configurationBuildLog) { - logger.message(`Found build log path setting "${configurationBuildLog}" defined for configuration "${configuration}"`); + logger.message(`Found build log path setting "${configurationBuildLog}" defined for configuration "${currentMakefileConfiguration.name}"`); if (!path.isAbsolute(configurationBuildLog)) { configurationBuildLog = path.join(util.getWorkspaceRoot(), configurationBuildLog); @@ -888,10 +894,6 @@ export function getBuildLogForConfiguration(configuration: string | undefined): if (!util.checkFileExistsSync(configurationBuildLog)) { logger.message("Build log not found. Remove the build log setting or provide a build log file on disk at the given location."); } - } else { - // Default to an eventual build log defined in settings - // If that one is not found on disk, the setting reader already warned about it. - configurationBuildLog = buildLog; } } @@ -900,7 +902,7 @@ export function getMakefileConfigurations(): MakefileConfiguration[] { return ma export function setMakefileConfigurations(configurations: MakefileConfiguration[]): void { makefileConfigurations = configurations; } // Read make configurations optionally defined by the user in settings: makefile.configurations. -export async function readMakefileConfigurations(): Promise { +export async function readMakefileConfigurations(currentConfigurationName : string): Promise { // We need to read "makefile.configurations" unexpanded first, because we may write back into these settings // in case we indentify "name" missing. We'll expand later, see end of function. let workspaceConfiguration: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration("makefile"); @@ -955,10 +957,10 @@ export async function readMakefileConfigurations(): Promise { // Exception: "Default" which means the user didn't set it and relies on whatever default // the current set of makefiles support. "Default" is not going to be part of the list // but we shouldn't log about it. - if (currentMakefileConfiguration !== "Default" && !makefileConfigurationNames.includes(currentMakefileConfiguration)) { - logger.message(`Current makefile configuration ${currentMakefileConfiguration} is no longer present in the available list.` + + if (currentConfigurationName !== "Default" && !makefileConfigurationNames.includes(currentConfigurationName)) { + logger.message(`Current makefile configuration ${currentConfigurationName} is no longer present in the available list.` + ` Re-setting the current makefile configuration to default.`); - await setConfigurationByName("Default"); + await setConfigurationByName(undefined); } } @@ -1090,7 +1092,7 @@ export async function initFromSettings(activation: boolean = false): Promise { - if (k.name === getCurrentMakefileConfiguration()) { - return k; - } - }); - - extension.getState().configureDirty = extension.getState().configureDirty || - !currentMakefileConfiguration || !currentMakefileConfiguration.buildLog; + // Configuration is dirty if the Default buildLog changes + // when the Default configuration ia active + if (currentMakefileConfiguration.isDefault && updatedBuildLog !== buildLog) { + currentMakefileConfiguration.buildLog = updatedBuildLog; + extension.getState().configureDirty = true; extension.updateBuildLogPresent(await readBuildLog()); updatedSettingsSubkeys.push(subKey); } @@ -1360,8 +1356,23 @@ export async function initFromSettings(activation: boolean = false): Promise { + if (k.name === currentMakefileConfiguration.name) { + return k; + } + }); + // TODO: should call an onConfigurationUpdate(updatedConfiguration); + // so that not only build log, but other updated members can be handled + let buildLogUpdated: boolean = !currentMakefileConfiguration.isDefault && + updatedConfiguration !== undefined && + updatedConfiguration.buildLog !== currentMakefileConfiguration.buildLog; + await readMakefileConfigurations(currentMakefileConfigurationName); + if (buildLogUpdated) { + extension.getState().configureDirty = true; + // extension.updateBuildLogPresent(await readBuildLog()); + updatedSettingsSubkeys.push(subKey); + } } subKey = "dryrunSwitches"; @@ -1512,14 +1523,14 @@ export async function initFromSettings(activation: boolean = false): Promise { +export async function setConfigurationByName(configurationName: string | undefined): Promise { + setCurrentMakefileConfigurationName(configurationName); extension.getState().buildConfiguration = configurationName; - logger.message(`Setting configuration - ${configurationName}`); + logger.message(`Setting configuration - ${currentMakefileConfigurationName}`); logger.message("Re-reading settings after configuration change."); - await setCurrentMakefileConfiguration(configurationName); // Refresh settings, they may reference variables or commands reading state configuration var (${configuration}). await initFromSettings(); - extension._projectOutlineProvider.updateConfiguration(configurationName); + extension._projectOutlineProvider.updateConfiguration(currentMakefileConfigurationName); } export function prepareConfigurationsQuickPick(): string[] { @@ -1548,7 +1559,7 @@ export async function setNewConfiguration(): Promise { let options: vscode.QuickPickOptions = {}; options.ignoreFocusOut = true; // so that the logger and the quick pick don't compete over focus const chosen: string | undefined = await vscode.window.showQuickPick(items, options); - if (chosen && chosen !== getCurrentMakefileConfiguration()) { + if (chosen && chosen !== currentMakefileConfiguration.name) { let telemetryProperties: telemetry.Properties | null = { state: "makefileConfiguration" }; diff --git a/src/extension.ts b/src/extension.ts index 4bef3508..99813631 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -406,7 +406,7 @@ export async function activate(context: vscode.ExtensionContext): Promise })); context.subscriptions.push(vscode.commands.registerCommand('makefile.outline.openBuildLogSetting', async () => { - await openSettings("makefile.buildLog"); + await vscode.commands.executeCommand('workbench.action.openWorkspaceSettingsFile', { revealSetting: { key: 'makefile.configurations', edit: true }}); })); context.subscriptions.push(vscode.commands.registerCommand('makefile.outline.openBuildLogFile', async () => { diff --git a/src/make.ts b/src/make.ts index 93348320..9f1ba11e 100644 --- a/src/make.ts +++ b/src/make.ts @@ -241,7 +241,7 @@ export async function buildTarget(triggeredBy: TriggeredBy, target: string, clea } // Prepare a notification popup - let config: string | undefined = configuration.getCurrentMakefileConfiguration(); + let config: string | undefined = configuration.getCurrentMakefileConfiguration().name; let configAndTarget: string = config; if (target) { target = target.trimLeft(); @@ -422,7 +422,8 @@ export async function generateParseContent(progress: vscode.Progress<{}>, // we can afford to invoke make -pRrq (very quick even on large projects). // We make sure to give the regression tests suite a build log that already contains // targets information because we want to avoid invoking make for now. - let buildLog: string | undefined = configuration.getConfigurationBuildLog(); + let buildLog: string | undefined = configuration.getCurrentMakefileConfiguration().buildLog; + if (buildLog && (!forTargets || process.env['MAKEFILE_TOOLS_TESTING'] === '1')) { parseContent = util.readFile(buildLog); if (parseContent) { diff --git a/src/telemetry.ts b/src/telemetry.ts index ce0551ec..8aea1dfc 100644 --- a/src/telemetry.ts +++ b/src/telemetry.ts @@ -117,7 +117,7 @@ function filterSetting(value: any, key: string, defaultValue: string) : string { function activeArrayItem(setting: string, key: string): number { if (key === "makefile.configurations") { let makefileConfigurations: configuration.MakefileConfiguration[] = configuration.getMakefileConfigurations(); - let currentMakefileConfigurationName: string | undefined = configuration.getCurrentMakefileConfiguration(); + let currentMakefileConfigurationName: string | undefined = configuration.getCurrentMakefileConfiguration().name; if (!currentMakefileConfigurationName) { return -1; } diff --git a/src/test/fakeSuite/extension.test.ts b/src/test/fakeSuite/extension.test.ts index b0bf089c..831dba33 100644 --- a/src/test/fakeSuite/extension.test.ts +++ b/src/test/fakeSuite/extension.test.ts @@ -494,6 +494,7 @@ suite('Fake dryrun parsing', /*async*/() => { let tmpConfigurations: configuration.MakefileConfiguration[] = [{ name: "MyTmpName", + isDefault: false, makePath: "${env:ProgramFiles(x86)}/${workspaceFolderBasename}/make", makeArgs: ["${command:makefile.getLaunchTargetPath}", "${SomeUnsupportedVar}", diff --git a/src/util.ts b/src/util.ts index 69887d7c..135e9f97 100644 --- a/src/util.ts +++ b/src/util.ts @@ -781,7 +781,7 @@ export async function expandVariablesInSetting(settingId: string, settingVal: st toStr = userHome(); telemetryProperties.pattern = result[2]; } else if (result[2] === "configuration") { - toStr = configuration.getCurrentMakefileConfiguration(); + toStr = configuration.getCurrentMakefileConfiguration().name; telemetryProperties.pattern = result[2]; } else if (result[2] === "buildTarget") { toStr = configuration.getCurrentTarget() || ""; From ed26f27d7de5e0d0fda321a7f71139861e675af9 Mon Sep 17 00:00:00 2001 From: Radu Hociung Date: Sun, 15 Oct 2023 21:45:07 -0400 Subject: [PATCH 6/9] Make configurationCache per configuration+target A cached configuration makes sense only when associated with a configuration, and the build target that was dry-run scanned. The previous approach of a global configuration cache that lived in the extensionOutputFolder with a hardcoded filename did not scale to multiple configurations and targets. Even though it could be configured to another directory, it was still not scaleable. This commit removes the user configuration for configurationCachePath, and instead calculates the filename used for cache using the format ${makeDirectory}/.vscode/${targetName}.cache The unfortunate name "makeDirectory" is semantically the configuration directory, when it differs from the source directory. The configured Makefile typically lives there. Configurability of this item is now removed. --- i18n/chs/package.i18n.json | 1 - i18n/cht/package.i18n.json | 1 - i18n/csy/package.i18n.json | 1 - i18n/deu/package.i18n.json | 1 - i18n/esn/package.i18n.json | 1 - i18n/fra/package.i18n.json | 1 - i18n/ita/package.i18n.json | 1 - i18n/jpn/package.i18n.json | 1 - i18n/kor/package.i18n.json | 1 - i18n/plk/package.i18n.json | 1 - i18n/ptb/package.i18n.json | 1 - i18n/rus/package.i18n.json | 1 - i18n/trk/package.i18n.json | 1 - package.json | 6 ----- package.nls.json | 1 - src/configuration.ts | 52 +++++++++----------------------------- src/make.ts | 21 ++++++++------- 17 files changed, 22 insertions(+), 71 deletions(-) diff --git a/i18n/chs/package.i18n.json b/i18n/chs/package.i18n.json index 0c6eeb9e..953bf4ab 100644 --- a/i18n/chs/package.i18n.json +++ b/i18n/chs/package.i18n.json @@ -53,7 +53,6 @@ "makefile-tools.configuration.makefile.buildLog.description": "为绕过试运行而读取的生成日志的路径", "makefile-tools.configuration.makefile.extensionOutputFolder.description": "扩展生成的各种输出文件的路径。默认为 VS Code 工作区存储位置。", "makefile-tools.configuration.makefile.extensionLog.description": "存储生成文件输出通道中所有内容的输出文件的路径。默认为“makefile.extensionOutputFolder”设置的值。", - "makefile-tools.configuration.makefile.configurationCachePath.description": "存储最后一个试运行生成命令输出的缓存文件的路径。取消设置时,名为“configurationCache.log”的文件存储在“makefile.extensionOutputFolder”设置指定的路径中。", "makefile-tools.configuration.makefile.dryrunSwitches.description": "要传递给干运行 make 调用的参数", "makefile-tools.configuration.makefile.additionalCompilerNames.description": "要添加到扩展已知列表的编译器工具的名称", "makefile-tools.configuration.makefile.excludeCompilerNames.description": "要从扩展已知列表中排除的编译器工具的名称", diff --git a/i18n/cht/package.i18n.json b/i18n/cht/package.i18n.json index 005f3016..978e4c70 100644 --- a/i18n/cht/package.i18n.json +++ b/i18n/cht/package.i18n.json @@ -53,7 +53,6 @@ "makefile-tools.configuration.makefile.buildLog.description": "要讀取以略過試執行之組建記錄檔的路徑", "makefile-tools.configuration.makefile.extensionOutputFolder.description": "延伸模組所產生之各種輸出檔案的路徑。預設為 VS Code 工作區儲存位置。", "makefile-tools.configuration.makefile.extensionLog.description": "從 Makefile 輸出通道儲存所有內容的輸出檔案路徑。預設為 'makefile.extensionOutputFolder' 設定的值。", - "makefile-tools.configuration.makefile.configurationCachePath.description": "儲存最後試執行 Make 命令之輸出的快取檔案路徑。取消設定時,名為 'configurationCache.log' 的檔案會儲存在 'makefile.extensionOutputFolder' 設定所指定的路徑中。", "makefile-tools.configuration.makefile.dryrunSwitches.description": "要傳遞至試執行 Make 引動過程的引數", "makefile-tools.configuration.makefile.additionalCompilerNames.description": "要新增至延伸模組已知清單的編譯器工具名稱", "makefile-tools.configuration.makefile.excludeCompilerNames.description": "要從延伸模組已知清單中排除的編譯器工具名稱", diff --git a/i18n/csy/package.i18n.json b/i18n/csy/package.i18n.json index a2b4b25e..f3fd5126 100644 --- a/i18n/csy/package.i18n.json +++ b/i18n/csy/package.i18n.json @@ -53,7 +53,6 @@ "makefile-tools.configuration.makefile.buildLog.description": "Cesta k protokolu o sestavení, která se přečte, aby se obešlo zkušební spuštění", "makefile-tools.configuration.makefile.extensionOutputFolder.description": "Cesta k různým výstupním souborům vytvořeným rozšířením. Výchozí nastavení je umístění úložiště pracovního prostoru VS Code.", "makefile-tools.configuration.makefile.extensionLog.description": "Cesta k výstupnímu souboru, do které se ukládá veškerý obsah z výstupního kanálu Souboru pravidel. Výchozí hodnota je nastavení makefile.extensionOutputFolder.", - "makefile-tools.configuration.makefile.configurationCachePath.description": "Cesta k souboru mezipaměti, do které se ukládá výstup posledního make příkazu dry-run Při zrušení nastavení se soubor s názvem configurationCache.log uloží na cestu určenou nastavením makefile.extensionOutputFolder.", "makefile-tools.configuration.makefile.dryrunSwitches.description": "Argumenty, které se mají předat při zkušebním volání maku", "makefile-tools.configuration.makefile.additionalCompilerNames.description": "Názvy kompilačních nástrojů, které se mají přidat na seznam známých rozšíření", "makefile-tools.configuration.makefile.excludeCompilerNames.description": "Názvy kompilačních nástrojů, které se mají vyloučit ze seznamu známých rozšíření", diff --git a/i18n/deu/package.i18n.json b/i18n/deu/package.i18n.json index 231a566b..19e308d0 100644 --- a/i18n/deu/package.i18n.json +++ b/i18n/deu/package.i18n.json @@ -53,7 +53,6 @@ "makefile-tools.configuration.makefile.buildLog.description": "Der Pfad zum Buildprotokoll, das gelesen wird, um einen Probelauf zu umgehen", "makefile-tools.configuration.makefile.extensionOutputFolder.description": "Der Pfad zu verschiedenen Ausgabedateien, die von der Erweiterung erstellt werden. Standardmäßig wird der Speicherort des VS Code-Arbeitsbereichs verwendet.", "makefile-tools.configuration.makefile.extensionLog.description": "Der Pfad zu einer Ausgabedatei, in der der gesamte Inhalt aus dem Makefile-Ausgabekanal gespeichert wird. Standardmäßig wird der Wert der Einstellung \"makefile.extensionOutputFolder\" verwendet.", - "makefile-tools.configuration.makefile.configurationCachePath.description": "Der Pfad zu einer Cachedatei, in der die Ausgabe des letzten \"dry-run make\"-Befehls gespeichert wird. Ist er nicht festgelegt, wird eine Datei mit dem Namen \"configurationCache.log\" in dem Pfad gespeichert, der durch die Einstellung \"makefile.extensionOutputFolder\" angegeben wird.", "makefile-tools.configuration.makefile.dryrunSwitches.description": "Argumente, die an den Aufruf „dry-run make“ übergeben werden sollen", "makefile-tools.configuration.makefile.additionalCompilerNames.description": "Namen von Compiler-Tools, die zur Liste bekannter Erweiterungen hinzugefügt werden sollen", "makefile-tools.configuration.makefile.excludeCompilerNames.description": "Namen von Compiler-Tools, die aus der Liste bekannter Erweiterungen ausgeschlossen werden sollen", diff --git a/i18n/esn/package.i18n.json b/i18n/esn/package.i18n.json index 97e2ffae..16f58d94 100644 --- a/i18n/esn/package.i18n.json +++ b/i18n/esn/package.i18n.json @@ -53,7 +53,6 @@ "makefile-tools.configuration.makefile.buildLog.description": "Ruta de acceso al registro de compilación que se lee para omitir un simulacro", "makefile-tools.configuration.makefile.extensionOutputFolder.description": "La ruta a varios archivos de salida producidos por la extensión. Por defecto es la ubicación de almacenamiento del área de trabajo de VS Code.", "makefile-tools.configuration.makefile.extensionLog.description": "La ruta a un archivo de salida que almacena todo el contenido del canal de salida Makefile. Por defecto es el valor del parámetro 'makefile.extensionOutputFolder'.", - "makefile-tools.configuration.makefile.configurationCachePath.description": "La ruta a un archivo de caché que almacena la salida del último comando make de ejecución en seco. Si no se establece, se almacena un archivo llamado 'configurationCache.log' en la ruta especificada por el parámetro 'makefile.extensionOutputFolder'.", "makefile-tools.configuration.makefile.dryrunSwitches.description": "Argumentos que se van a pasar a la invocación de simulacro de make", "makefile-tools.configuration.makefile.additionalCompilerNames.description": "Nombres de las herramientas del compilador que se van a agregar a la lista conocida de extensiones", "makefile-tools.configuration.makefile.excludeCompilerNames.description": "Nombres de las herramientas del compilador que se excluirán de la lista conocida de extensiones", diff --git a/i18n/fra/package.i18n.json b/i18n/fra/package.i18n.json index 77b05895..91e8b795 100644 --- a/i18n/fra/package.i18n.json +++ b/i18n/fra/package.i18n.json @@ -53,7 +53,6 @@ "makefile-tools.configuration.makefile.buildLog.description": "Le chemin d’accès au journal de génération qui est lu pour contourner un essai à blanc", "makefile-tools.configuration.makefile.extensionOutputFolder.description": "Le chemin d'accès aux différents fichiers de sortie produits par l'extension. Par défaut, l'emplacement de stockage de l'espace de travail VS Code.", "makefile-tools.configuration.makefile.extensionLog.description": "Le chemin d'accès à un fichier de sortie stockant tout le contenu du canal de sortie Makefile. Par défaut, la valeur du paramètre 'makefile.extensionOutputFolder'.", - "makefile-tools.configuration.makefile.configurationCachePath.description": "Le chemin d'accès à un fichier cache stockant la sortie de la dernière commande de fabrication à sec. Lorsqu'il n'est pas défini, un fichier nommé 'configurationCache.log' est stocké dans le chemin spécifié par le paramètre 'makefile.extensionOutputFolder'.", "makefile-tools.configuration.makefile.dryrunSwitches.description": "Les arguments à passer à l’épreuve font invocation", "makefile-tools.configuration.makefile.additionalCompilerNames.description": "Noms des outils de compilation à ajouter à la liste des extensions connues", "makefile-tools.configuration.makefile.excludeCompilerNames.description": "Noms des outils de compilation à exclure de la liste des extensions connues", diff --git a/i18n/ita/package.i18n.json b/i18n/ita/package.i18n.json index a80ed761..2ad985fc 100644 --- a/i18n/ita/package.i18n.json +++ b/i18n/ita/package.i18n.json @@ -53,7 +53,6 @@ "makefile-tools.configuration.makefile.buildLog.description": "Il percorso del log di compilazione è letto per ignorare un dry-run", "makefile-tools.configuration.makefile.extensionOutputFolder.description": "Il percorso di vari file di output prodotti dall'estensione. Predefinito alla posizione di archiviazione dell’area di lavoro di VS Code.", "makefile-tools.configuration.makefile.extensionLog.description": "Il percorso di un file di output che archivia tutto il contenuto dal canale di output Makefile. Predefinito al valore dell'impostazione 'makefile.extensionOutputFolder'.", - "makefile-tools.configuration.makefile.configurationCachePath.description": "Il percorso di un file di cache che archivia l'output dell'ultimo comando di prova. Se non è impostato, un file denominato 'configurationCache.log' viene archiviato nel percorso specificato dall'impostazione 'makefile.extensionOutputFolder'.", "makefile-tools.configuration.makefile.dryrunSwitches.description": "Argomenti da passare alla chiamata di dry-run make", "makefile-tools.configuration.makefile.additionalCompilerNames.description": "Nomi degli strumenti del compilatore da aggiungere all'elenco noto dell'estensione", "makefile-tools.configuration.makefile.excludeCompilerNames.description": "Nomi degli strumenti del compilatore da escludere dall'elenco noto dell'estensione", diff --git a/i18n/jpn/package.i18n.json b/i18n/jpn/package.i18n.json index 4a58bd53..b70c2008 100644 --- a/i18n/jpn/package.i18n.json +++ b/i18n/jpn/package.i18n.json @@ -53,7 +53,6 @@ "makefile-tools.configuration.makefile.buildLog.description": "ドライランをバイパスするために読み取られたビルド ログへのパス", "makefile-tools.configuration.makefile.extensionOutputFolder.description": "拡張機能によって生成されるさまざまな出力ファイルへのパス。既定値は、VS Code ワークスペースの保存場所です。", "makefile-tools.configuration.makefile.extensionLog.description": "メイクファイル出力チャネルのすべてのコンテンツを格納する出力ファイルへのパス。既定値は 'makefile.extensionOutputFolder' 設定の値です。", - "makefile-tools.configuration.makefile.configurationCachePath.description": "最後の dry-run make コマンドの出力を格納するキャッシュ ファイルへのパス。設定を解除すると、'configurationCache.log' という名前のファイルが 'makefile.extensionOutputFolder' 設定で指定されたパスに格納されます。", "makefile-tools.configuration.makefile.dryrunSwitches.description": "ドライラン make 呼び出しに渡す引数", "makefile-tools.configuration.makefile.additionalCompilerNames.description": "拡張機能の既知のリストに追加するコンパイラ ツールの名前", "makefile-tools.configuration.makefile.excludeCompilerNames.description": "拡張機能の既知のリストから除外するコンパイラ ツールの名前", diff --git a/i18n/kor/package.i18n.json b/i18n/kor/package.i18n.json index c05085d0..65908baf 100644 --- a/i18n/kor/package.i18n.json +++ b/i18n/kor/package.i18n.json @@ -53,7 +53,6 @@ "makefile-tools.configuration.makefile.buildLog.description": "시험 실행을 바이패스하기 위해 읽은 빌드 로그의 경로", "makefile-tools.configuration.makefile.extensionOutputFolder.description": "확장에서 생성된 다양한 출력 파일의 경로입니다. 기본값은 VS Code 작업 영역 저장소 위치입니다.", "makefile-tools.configuration.makefile.extensionLog.description": "메이크파일 출력 채널의 모든 콘텐츠를 저장하는 출력 파일의 경로입니다. 기본값은 'makefile.extensionOutputFolder' 설정의 값입니다.", - "makefile-tools.configuration.makefile.configurationCachePath.description": "마지막 시험 실행 make 명령의 출력을 저장하는 캐시 파일의 경로입니다. 설정을 해제하면 이름이 'configurationCache.log'인 파일이 'makefile.extensionOutputFolder' 설정에서 지정한 경로에 저장됩니다.", "makefile-tools.configuration.makefile.dryrunSwitches.description": "시험 실행 make 호출에 전달할 인수", "makefile-tools.configuration.makefile.additionalCompilerNames.description": "알려진 확장 목록에서 추가할 컴파일러 도구의 이름", "makefile-tools.configuration.makefile.excludeCompilerNames.description": "알려진 확장 목록에서 제외할 컴파일러 도구의 이름", diff --git a/i18n/plk/package.i18n.json b/i18n/plk/package.i18n.json index 7d0332ba..141384fa 100644 --- a/i18n/plk/package.i18n.json +++ b/i18n/plk/package.i18n.json @@ -53,7 +53,6 @@ "makefile-tools.configuration.makefile.buildLog.description": "Ścieżka do dziennika kompilacji, który jest odczytywany, aby obejść przebieg próbny", "makefile-tools.configuration.makefile.extensionOutputFolder.description": "Ścieżka do różnych plików wyjściowych utworzonych przez rozszerzenie. Domyślnie jest to lokalizacja magazynu obszaru roboczego programu VS Code.", "makefile-tools.configuration.makefile.extensionLog.description": "Ścieżka do pliku wyjściowego przechowującego całą zawartość z kanału wyjściowego pliku reguł programu make. Domyślnie przyjmuje wartość ustawienia „makefile.extensionOutputFolder”.", - "makefile-tools.configuration.makefile.configurationCachePath.description": "Ścieżka do pliku pamięci podręcznej przechowującego dane wyjściowe ostatniego polecenia programu make dotyczącego testowego uruchomienia. Gdy ta opcja jest nieskonfigurowana, plik o nazwie „configurationCache.log” jest przechowywany w ścieżce określonej przez ustawienie „makefile.extensionOutputFolder”.", "makefile-tools.configuration.makefile.dryrunSwitches.description": "Argumenty do przekazania do przywołania przebiegu próbnego make", "makefile-tools.configuration.makefile.additionalCompilerNames.description": "Nazwy narzędzi kompilatora do dodania do listy znanych rozszerzeń", "makefile-tools.configuration.makefile.excludeCompilerNames.description": "Nazwy narzędzi kompilatora do wykluczenia z listy znanych rozszerzeń", diff --git a/i18n/ptb/package.i18n.json b/i18n/ptb/package.i18n.json index 2ccdcc86..0de66249 100644 --- a/i18n/ptb/package.i18n.json +++ b/i18n/ptb/package.i18n.json @@ -53,7 +53,6 @@ "makefile-tools.configuration.makefile.buildLog.description": "O caminho para o log de build que está pronto para ignorar uma simulação", "makefile-tools.configuration.makefile.extensionOutputFolder.description": "O caminho para vários arquivos de saída produzidos pela extensão. O padrão é o local VS Code de armazenamento do workspace.", "makefile-tools.configuration.makefile.extensionLog.description": "O caminho para um arquivo de saída que armazena todo o conteúdo do canal de saída makefile. O padrão é o valor da configuração 'makefile.extensionOutputFolder'.", - "makefile-tools.configuration.makefile.configurationCachePath.description": "O caminho para um arquivo de cache que armazena a saída do último comando make de simulação. Quando não definido, um arquivo chamado 'configurationCache.log' é armazenado no caminho especificado pela configuração 'makefile.extensionOutputFolder'.", "makefile-tools.configuration.makefile.dryrunSwitches.description": "Argumentos a serem passados para a invocação do make de simulação", "makefile-tools.configuration.makefile.additionalCompilerNames.description": "Nomes de ferramentas do compilador a serem adicionados na lista de extensões conhecidas", "makefile-tools.configuration.makefile.excludeCompilerNames.description": "Nomes de ferramentas do compilador a serem excluídas da lista de extensões conhecidas", diff --git a/i18n/rus/package.i18n.json b/i18n/rus/package.i18n.json index 825b02df..c6ffc85e 100644 --- a/i18n/rus/package.i18n.json +++ b/i18n/rus/package.i18n.json @@ -53,7 +53,6 @@ "makefile-tools.configuration.makefile.buildLog.description": "Путь к журналу сборки, который считывается для обхода пробного запуска", "makefile-tools.configuration.makefile.extensionOutputFolder.description": "Путь к различным выходным файлам, созданным расширением. По умолчанию используется расположение хранилища рабочей области VS Code.", "makefile-tools.configuration.makefile.extensionLog.description": "Путь к выходному файлу, в котором будет храниться все содержимое из выходного канала файла makefile. По умолчанию используется значение параметра \"makefile.extensionOutputFolder\".", - "makefile-tools.configuration.makefile.configurationCachePath.description": "Путь к файлу кэша, в котором будут храниться выходные данные последней пробной команды make. Если этот параметр не задан, файл с именем \"configurationCache.log\" хранится по пути, указанному параметром \"makefile.extensionOutputFolder\".", "makefile-tools.configuration.makefile.dryrunSwitches.description": "Аргументы для перехода к пробному вызову make", "makefile-tools.configuration.makefile.additionalCompilerNames.description": "Имена средств компилятора, которые будут добавлены в список известных расширений", "makefile-tools.configuration.makefile.excludeCompilerNames.description": "Имена средств компилятора, исключаемых из списка известных расширений", diff --git a/i18n/trk/package.i18n.json b/i18n/trk/package.i18n.json index 1083efbd..fe1fc3b9 100644 --- a/i18n/trk/package.i18n.json +++ b/i18n/trk/package.i18n.json @@ -53,7 +53,6 @@ "makefile-tools.configuration.makefile.buildLog.description": "Provayı atlamak için okunan derleme günlüğüne giden yol", "makefile-tools.configuration.makefile.extensionOutputFolder.description": "Uzantı tarafından üretilen çeşitli çıkış dosyalarının yolu. Varsayılan olarak VS Code çalışma alanı depolama konumunu alır.", "makefile-tools.configuration.makefile.extensionLog.description": "Derleme Görevleri Dosyası çıkış kanalından tüm içeriği depolayan bir çıkış dosyasının yolu. Varsayılan olarak 'makefile.extensionOutputFolder' ayarının değerini alır.", - "makefile-tools.configuration.makefile.configurationCachePath.description": "Son prova make komutunun çıkışını depolayan önbellek dosyasının yolu. Ayar kaldırıldığında, 'makefile.extensionOutputFolder' ayarı tarafından belirtilen yolda 'configurationCache.log' adlı bir dosya depolanır.", "makefile-tools.configuration.makefile.dryrunSwitches.description": "Prova make çağrısına geçirilecek bağımsız değişkenler", "makefile-tools.configuration.makefile.additionalCompilerNames.description": "Bilinen uzantı listesine eklenecek derleyici araçlarının adları", "makefile-tools.configuration.makefile.excludeCompilerNames.description": "Bilinen uzantı listesinden çıkarılacak derleyici araçlarının adları", diff --git a/package.json b/package.json index 6b9b3abd..2c594f50 100644 --- a/package.json +++ b/package.json @@ -384,12 +384,6 @@ "default": "", "scope": "resource" }, - "makefile.configurationCachePath": { - "type": "string", - "description": "%makefile-tools.configuration.makefile.configurationCachePath.description%", - "default": "", - "scope": "resource" - }, "makefile.dryrunSwitches": { "type": "array", "default": [ diff --git a/package.nls.json b/package.nls.json index ab07361d..5cdc693d 100644 --- a/package.nls.json +++ b/package.nls.json @@ -48,7 +48,6 @@ "makefile-tools.configuration.makefile.buildLog.description": "The path to the build log that is read to bypass a dry-run", "makefile-tools.configuration.makefile.extensionOutputFolder.description": "The path to various output files produced by the extension. Defaults to the VS Code workspace storage location.", "makefile-tools.configuration.makefile.extensionLog.description": "The path to an output file storing all content from the Makefile output channel. Defaults to the value of the 'makefile.extensionOutputFolder' setting.", - "makefile-tools.configuration.makefile.configurationCachePath.description": "The path to a cache file storing the output of the last dry-run make command. When unset, a file named 'configurationCache.log' is stored at the path specified by the 'makefile.extensionOutputFolder' setting.", "makefile-tools.configuration.makefile.dryrunSwitches.description": "Arguments to pass to the dry-run make invocation", "makefile-tools.configuration.makefile.additionalCompilerNames.description": "Names of compiler tools to be added to the extension known list", "makefile-tools.configuration.makefile.excludeCompilerNames.description": "Names of compiler tools to be excluded from the extension known list", diff --git a/src/configuration.ts b/src/configuration.ts index f33b527e..b6c95bbd 100644 --- a/src/configuration.ts +++ b/src/configuration.ts @@ -85,6 +85,9 @@ export async function setCurrentMakefileConfiguration(configuration: string | un buildLog: buildLog, isDefault: true }; + let cachePath : string | undefined = getConfigurationCachePath(); + if (cachePath) + util.createDirectorySync(cachePath); statusBar.setConfiguration(currentMakefileConfiguration.name); await extension.updateBuildLogPresent(currentMakefileConfiguration.buildLog ? true : false); } @@ -422,34 +425,15 @@ export async function readAlwaysPostConfigure(): Promise { logger.message(`Always post-configure: ${alwaysPostConfigure}`); } -let configurationCachePath: string | undefined; -export function getConfigurationCachePath(): string | undefined { return configurationCachePath; } -export function setConfigurationCachePath(path: string): void { configurationCachePath = path; } - -// Read from settings the path to a cache file containing the output of the last dry-run make command. -// This file is recreated when opening a project, when changing the build configuration or the build target -// and when the settings watcher detects a change of any properties that may impact the dryrun output. -export async function readConfigurationCachePath(): Promise { - let oldConfigurationCachePath = configurationCachePath; - configurationCachePath = await util.getExpandedSetting("configurationCachePath"); - if (!configurationCachePath && extensionOutputFolder) { - configurationCachePath = path.join(extensionOutputFolder, 'configurationCache.log'); - } - - if (configurationCachePath) { - // If there is a directory defined within the configuration cache path, - // honor it and don't append to extensionOutputFolder. - let parsePath: path.ParsedPath = path.parse(configurationCachePath); - if (extensionOutputFolder && !parsePath.dir) { - configurationCachePath = path.join(extensionOutputFolder, configurationCachePath); - } else { - configurationCachePath = util.resolvePathToRoot(configurationCachePath); - } - - if (oldConfigurationCachePath !== configurationCachePath) { - logger.message(`Configurations cached at ${configurationCachePath}`); - } - } +// The configuration cache is stored in ${makeDirectory}/.vscode/${currentTarget}.cache +// Ie, each config is keyed to the configuration and target +// TODO: The user should have the option to turn off the cache because it may become decoherent with the +// workspace when the source is changed (eg, diff branch checked out) between vscode reloads. +export function getConfigurationCachePath(): string | undefined { + if (currentMakefileConfiguration.makeDirectory) + return path.join(currentMakefileConfiguration.makeDirectory, ".vscode"); + else + return undefined; } let compileCommandsPath: string | undefined; @@ -1088,7 +1072,6 @@ export async function initFromSettings(activation: boolean = false): Promise(subKey); if (updatedMakePath !== makePath) { diff --git a/src/make.ts b/src/make.ts index 9f1ba11e..841d1433 100644 --- a/src/make.ts +++ b/src/make.ts @@ -1016,15 +1016,13 @@ export async function configure(triggeredBy: TriggeredBy, updateTargets: boolean } // Identify for telemetry whether this configure will read configuration constructs from cache. - let readCache: boolean = false; let configurationCachePath: string | undefined = configuration.getConfigurationCachePath(); - if ( - configurationCachePath && - util.checkFileExistsSync(configurationCachePath) - ) { - readCache = true; - } + let configurationCache: string | undefined = + configurationCachePath ? + path.join(configurationCachePath, configuration.getCurrentTarget() + ".cache") : undefined; + let readCache: boolean = configurationCache ? + util.checkFileExistsSync(configurationCache) : false; let compileCommandsPath: string | undefined = configuration.getCompileCommandsPath(); @@ -1134,12 +1132,12 @@ export async function configure(triggeredBy: TriggeredBy, updateTargets: boolean // Rewrite the configuration cache according to the last updates of the internal arrays, // but not if the configure was cancelled and not while running regression tests. if ( - configurationCachePath && + configurationCache && retc !== ConfigureBuildReturnCodeTypes.cancelled && process.env["MAKEFILE_TOOLS_TESTING"] !== "1" ) { util.writeFile( - configurationCachePath, + configurationCache, JSON.stringify(ConfigurationCache) ); } @@ -1446,11 +1444,12 @@ export async function loadConfigurationFromCache(progress: vscode.Progress<{}>, await util.scheduleAsyncTask(async () => {await extension.registerCppToolsProvider(); }); let cachePath: string | undefined = configuration.getConfigurationCachePath(); if (cachePath) { - let content: string | undefined = util.readFile(cachePath); + let cacheFile: string = path.join(cachePath, configuration.getCurrentTarget() + ".cache"); + let content: string | undefined = util.readFile(cacheFile); if (content) { try { progress.report({ increment: 1, message: localize("make.configure.cache", "Configuring from cache") }); - logger.message(`Configuring from cache: ${cachePath}`); + logger.message(`Configuring from cache: ${cacheFile}`); let configurationCache: ConfigurationCache = { buildTargets: [], launchTargets: [], From 7553a928de8ee1606ea85857a82d01b483438231 Mon Sep 17 00:00:00 2001 From: Radu Hociung Date: Mon, 16 Oct 2023 02:57:58 -0400 Subject: [PATCH 7/9] Move dryrun.log to builddir - optionally saved Saving the dryrun.log to the extension output directory doesn't extract much value from it, especially as it is overriden per configuration. This commit makes saving it to the disk optional (default = not saved), configurable with a new makefile.keepDryRuns option, and moves the save location to ${makeDirectory}/.vscode/${targetName}.dryrun.log This location allows changes to the configuration to be easily tracked. For example, it could be added to git for easy review of configuration changes. If the build directory is out of tree, you could create a git repo specifically for tracking configurations of builds. If the srcdir and builddir are the same (in-tree building), you could use the source repo to also track builds; mixing source and diagnostic files can be messy; a separate repo initialized in the .vscode directory can help. Otherwise, worktrees or hard links can be useful to track the dry-run output in a separate repo. --- package.json | 6 ++++++ package.nls.json | 1 + src/configuration.ts | 21 ++++++++++++++++++++- src/make.ts | 39 +++++++++++++++++++++------------------ 4 files changed, 48 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index 2c594f50..a051cdc2 100644 --- a/package.json +++ b/package.json @@ -397,6 +397,12 @@ }, "scope": "resource" }, + "makefile.keepDryRuns": { + "type": "boolean", + "markdownDescription": "%makefile-tools.configuration.makefile.keepDryRuns.markdownDescription%", + "default": false, + "scope": "resource" + }, "makefile.additionalCompilerNames": { "type": "array", "default": [], diff --git a/package.nls.json b/package.nls.json index 5cdc693d..39d9689c 100644 --- a/package.nls.json +++ b/package.nls.json @@ -49,6 +49,7 @@ "makefile-tools.configuration.makefile.extensionOutputFolder.description": "The path to various output files produced by the extension. Defaults to the VS Code workspace storage location.", "makefile-tools.configuration.makefile.extensionLog.description": "The path to an output file storing all content from the Makefile output channel. Defaults to the value of the 'makefile.extensionOutputFolder' setting.", "makefile-tools.configuration.makefile.dryrunSwitches.description": "Arguments to pass to the dry-run make invocation", + "makefile-tools.configuration.makefile.keepDryRuns.markdownDescription": "Keep the output of the dry-run in `${makeDirectory}/.vscode/${currentTarget}.dryrun.log`", "makefile-tools.configuration.makefile.additionalCompilerNames.description": "Names of compiler tools to be added to the extension known list", "makefile-tools.configuration.makefile.excludeCompilerNames.description": "Names of compiler tools to be excluded from the extension known list", "makefile-tools.configuration.makefile.configureOnOpen.description": "Automatically configure Makefile project directories when they are opened", diff --git a/src/configuration.ts b/src/configuration.ts index b6c95bbd..ed9c9653 100644 --- a/src/configuration.ts +++ b/src/configuration.ts @@ -86,7 +86,9 @@ export async function setCurrentMakefileConfiguration(configuration: string | un isDefault: true }; let cachePath : string | undefined = getConfigurationCachePath(); - if (cachePath) + if (cachePath && ( + keepDryRuns + )) util.createDirectorySync(cachePath); statusBar.setConfiguration(currentMakefileConfiguration.name); await extension.updateBuildLogPresent(currentMakefileConfiguration.buildLog ? true : false); @@ -487,6 +489,15 @@ export async function readDryrunSwitches(): Promise { } } +// Keep the dry-run output in the configuration directory? +// true : file will be saved as ${makeDirectory}/.vscode/${currentTarget}.dryrun.log +// false: file will be not be saved +let keepDryRuns: boolean; +export function getKeepDryRuns(): boolean { return keepDryRuns; } +export async function readkeepDryRuns() : Promise { + keepDryRuns = await util.getExpandedSetting("keepDryRuns") || false; +} + // Currently, the makefile extension supports debugging only an executable. // TODO: Parse for symbol search paths // TODO: support dll debugging. @@ -1081,6 +1092,7 @@ export async function initFromSettings(activation: boolean = false): Promise(subKey); + if (updatedkeepDryRuns !== keepDryRuns) { + await readkeepDryRuns(); + updatedSettingsSubkeys.push(subKey); + } + subKey = "additionalCompilerNames"; let updatedAdditionalCompilerNames : string[] | undefined = await util.getExpandedSetting(subKey); if (!util.areEqual(updatedAdditionalCompilerNames, additionalCompilerNames)) { diff --git a/src/make.ts b/src/make.ts index 841d1433..6c0f2a3d 100644 --- a/src/make.ts +++ b/src/make.ts @@ -389,13 +389,9 @@ export async function doBuildTarget(progress: vscode.Progress<{}>, target: strin // Represents the content of the provided makefile.buildLog or a fresh output of make --dry-run // (which is also written into makefile.configurationCachePath). let parseContent: string | undefined; -export function getParseContent(): string | undefined { return parseContent; } -export function setParseContent(content: string): void { parseContent = content; } // The source file of parseContent (build log or configuration dryrun cache). let parseFile: string | undefined; -export function getParseFile(): string | undefined { return parseFile; } -export function setParseFile(file: string): void { parseFile = file; } // Targets need to parse a dryrun make invocation that does not include a target name // (other than default empty "" or the standard "all"), otherwise it would produce @@ -495,18 +491,19 @@ export async function generateParseContent(progress: vscode.Progress<{}>, logger.message(`'${configuration.getConfigurationMakeCommand()} ${makeArgs.join(" ")}'`); try { - let dryrunFile : string = forTargets ? "./targets.log" : "./dryrun.log"; - let extensionOutputFolder: string | undefined = configuration.getExtensionOutputFolder(); - if (extensionOutputFolder) { - dryrunFile = path.join(extensionOutputFolder, dryrunFile); - } - dryrunFile = util.resolvePathToRoot(dryrunFile); - logger.message(`Writing the dry-run output: ${dryrunFile}`); - const lineEnding: string = (process.platform === "win32" && process.env.MSYSTEM === undefined) ? "\r\n" : "\n"; + let keepDryRuns: boolean = configuration.getKeepDryRuns(); + let dryrunFile : string = forTargets ? "./targets.log" : configuration.getCurrentTarget() + ".dryrun.log"; + if (keepDryRuns) { + let cachePath: string | undefined = configuration.getConfigurationCachePath(); + if (cachePath) { + dryrunFile = path.join(cachePath, dryrunFile); + } + dryrunFile = util.resolvePathToRoot(dryrunFile); + logger.message(`Writing the dry-run output: ${dryrunFile}`); - util.writeFile(dryrunFile, `${configuration.getConfigurationMakeCommand()} ${makeArgs.join(" ")}${lineEnding}`); - + util.writeFile(dryrunFile, `${configuration.getConfigurationMakeCommand()} ${makeArgs.join(" ")}${lineEnding}`); + } let completeOutput: string = ""; let stderrStr: string = ""; let heartBeat: number = Date.now(); @@ -514,7 +511,9 @@ export async function generateParseContent(progress: vscode.Progress<{}>, let stdout: any = (result: string): void => { const appendStr: string = `${result} ${lineEnding}`; completeOutput += appendStr; - fs.appendFileSync(dryrunFile, appendStr); + if (keepDryRuns) { + fs.appendFileSync(dryrunFile, appendStr); + } progress.report({ increment: 1, @@ -537,7 +536,9 @@ export async function generateParseContent(progress: vscode.Progress<{}>, if (process.env['MAKEFILE_TOOLS_TESTING'] !== '1') { appendStr += lineEnding; } - fs.appendFileSync(dryrunFile, appendStr); + if (keepDryRuns) { + fs.appendFileSync(dryrunFile, appendStr); + } stderrStr += appendStr; // Sometimes there is useful information coming via the stderr @@ -553,7 +554,9 @@ export async function generateParseContent(progress: vscode.Progress<{}>, vscode.window.showWarningMessage("Dryrun timeout. See Makefile Tools Output Channel for details."); logger.message("Dryrun timeout. Verify that the make command works properly " + "in your development terminal (it could wait for stdin)."); - logger.message(`Double check the dryrun output log: ${dryrunFile}`); + if (keepDryRuns) { + logger.message(`Double check the dryrun output log: ${dryrunFile}`); + } // It's enough to show this warning popup once. clearInterval(timeout); @@ -566,7 +569,7 @@ export async function generateParseContent(progress: vscode.Progress<{}>, let elapsedTime: number = util.elapsedTimeSince(startTime); logger.message(`Generating dry-run elapsed time: ${elapsedTime}`); - parseFile = dryrunFile; + parseFile = keepDryRuns ? dryrunFile : (dryrunFile + " (not saved)"); parseContent = completeOutput; // The error codes returned by the targets invocation (make -pRrq) mean something else From d8479a3da4062b758ef7dd308cc742875a653c74 Mon Sep 17 00:00:00 2001 From: Radu Hociung Date: Mon, 16 Oct 2023 05:16:00 -0400 Subject: [PATCH 8/9] Make saving configurationCache optional A new setting is added named makefile.keepConfigurationCache (default=false) which when enable causes the configuration cache to be saved to disk and loaded on reload. --- package.json | 6 ++++++ package.nls.json | 1 + src/configuration.ts | 19 +++++++++++++++++++ src/make.ts | 3 ++- 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index a051cdc2..f1690463 100644 --- a/package.json +++ b/package.json @@ -403,6 +403,12 @@ "default": false, "scope": "resource" }, + "makefile.keepConfigurationCache": { + "type": "boolean", + "markdownDescription": "%makefile-tools.configuration.makefile.keepConfigurationCache.markdownDescription%", + "default": false, + "scope": "resource" + }, "makefile.additionalCompilerNames": { "type": "array", "default": [], diff --git a/package.nls.json b/package.nls.json index 39d9689c..64d06fb6 100644 --- a/package.nls.json +++ b/package.nls.json @@ -50,6 +50,7 @@ "makefile-tools.configuration.makefile.extensionLog.description": "The path to an output file storing all content from the Makefile output channel. Defaults to the value of the 'makefile.extensionOutputFolder' setting.", "makefile-tools.configuration.makefile.dryrunSwitches.description": "Arguments to pass to the dry-run make invocation", "makefile-tools.configuration.makefile.keepDryRuns.markdownDescription": "Keep the output of the dry-run in `${makeDirectory}/.vscode/${currentTarget}.dryrun.log`", + "makefile-tools.configuration.makefile.keepConfigurationCache.markdownDescription": "Keep the Intellisense configuration parsed from the makefile as `${makeDirectory}/.vscode/${currentTarget}.cache`.\n\n If this file exists when starting vscode, it will be loaded before dry-running. This can be used to **speed up** Intellisense initialization in very large projects where dry-running is slow.", "makefile-tools.configuration.makefile.additionalCompilerNames.description": "Names of compiler tools to be added to the extension known list", "makefile-tools.configuration.makefile.excludeCompilerNames.description": "Names of compiler tools to be excluded from the extension known list", "makefile-tools.configuration.makefile.configureOnOpen.description": "Automatically configure Makefile project directories when they are opened", diff --git a/src/configuration.ts b/src/configuration.ts index ed9c9653..ed80fc7e 100644 --- a/src/configuration.ts +++ b/src/configuration.ts @@ -87,6 +87,7 @@ export async function setCurrentMakefileConfiguration(configuration: string | un }; let cachePath : string | undefined = getConfigurationCachePath(); if (cachePath && ( + keepConfigurationCache || keepDryRuns )) util.createDirectorySync(cachePath); @@ -498,6 +499,16 @@ export async function readkeepDryRuns() : Promise { keepDryRuns = await util.getExpandedSetting("keepDryRuns") || false; } +// Keep the configurationCache in the configuration directory? +// true : file will be saved as ${makeDirectory}/.vscode/${currentTarget}.cache, +// and loaded at next reload, before dry-running +// false: file will be not be saved +let keepConfigurationCache: boolean; +export function getKeepConfigurationCache(): boolean { return keepConfigurationCache; } +export async function readkeepConfigurationCache() : Promise { + keepConfigurationCache = await util.getExpandedSetting("keepConfigurationCache") || false; +} + // Currently, the makefile extension supports debugging only an executable. // TODO: Parse for symbol search paths // TODO: support dll debugging. @@ -1093,6 +1104,7 @@ export async function initFromSettings(activation: boolean = false): Promise(subKey); + if (keepConfigurationCache !== keepConfigurationCache) { + await readkeepConfigurationCache(); + updatedSettingsSubkeys.push(subKey); + } + subKey = "additionalCompilerNames"; let updatedAdditionalCompilerNames : string[] | undefined = await util.getExpandedSetting(subKey); if (!util.areEqual(updatedAdditionalCompilerNames, additionalCompilerNames)) { diff --git a/src/make.ts b/src/make.ts index 6c0f2a3d..4c43e0c1 100644 --- a/src/make.ts +++ b/src/make.ts @@ -1135,6 +1135,7 @@ export async function configure(triggeredBy: TriggeredBy, updateTargets: boolean // Rewrite the configuration cache according to the last updates of the internal arrays, // but not if the configure was cancelled and not while running regression tests. if ( + configuration.getKeepConfigurationCache() && configurationCache && retc !== ConfigureBuildReturnCodeTypes.cancelled && process.env["MAKEFILE_TOOLS_TESTING"] !== "1" @@ -1446,7 +1447,7 @@ export async function loadConfigurationFromCache(progress: vscode.Progress<{}>, await util.scheduleAsyncTask(async () => {await extension.registerCppToolsProvider(); }); let cachePath: string | undefined = configuration.getConfigurationCachePath(); - if (cachePath) { + if (configuration.getKeepConfigurationCache() && cachePath) { let cacheFile: string = path.join(cachePath, configuration.getCurrentTarget() + ".cache"); let content: string | undefined = util.readFile(cacheFile); if (content) { From e6bfc539f7bc8b480609a6fc98261ab3d074f0a4 Mon Sep 17 00:00:00 2001 From: Radu Hociung Date: Mon, 16 Oct 2023 05:37:25 -0400 Subject: [PATCH 9/9] Remove extensionOutputFolder setting This folder is no longer needed. dry-run and configurationCache are saved to a configuration-specific directory ($makeDirectory/.vscode) The extensionLog no longer defaults to this value, it must be specified explicitly. --- i18n/chs/package.i18n.json | 3 +- i18n/cht/package.i18n.json | 3 +- i18n/csy/package.i18n.json | 3 +- i18n/deu/package.i18n.json | 3 +- i18n/esn/package.i18n.json | 3 +- i18n/fra/package.i18n.json | 3 +- i18n/ita/package.i18n.json | 3 +- i18n/jpn/package.i18n.json | 3 +- i18n/kor/package.i18n.json | 3 +- i18n/plk/package.i18n.json | 3 +- i18n/ptb/package.i18n.json | 3 +- i18n/rus/package.i18n.json | 3 +- i18n/trk/package.i18n.json | 3 +- package.nls.json | 3 +- src/configuration.ts | 67 ++------------------------------------ 15 files changed, 17 insertions(+), 92 deletions(-) diff --git a/i18n/chs/package.i18n.json b/i18n/chs/package.i18n.json index 953bf4ab..5d8883be 100644 --- a/i18n/chs/package.i18n.json +++ b/i18n/chs/package.i18n.json @@ -51,8 +51,7 @@ "makefile-tools.configuration.makefile.makeDirectory.description": "要通过开关 -C 传递的文件夹路径", "makefile-tools.configuration.makefile.makefilePath.description": "项目的生成文件的路径", "makefile-tools.configuration.makefile.buildLog.description": "为绕过试运行而读取的生成日志的路径", - "makefile-tools.configuration.makefile.extensionOutputFolder.description": "扩展生成的各种输出文件的路径。默认为 VS Code 工作区存储位置。", - "makefile-tools.configuration.makefile.extensionLog.description": "存储生成文件输出通道中所有内容的输出文件的路径。默认为“makefile.extensionOutputFolder”设置的值。", + "makefile-tools.configuration.makefile.extensionLog.description": "存储生成文件输出通道中所有内容的输出文件的路径。", "makefile-tools.configuration.makefile.dryrunSwitches.description": "要传递给干运行 make 调用的参数", "makefile-tools.configuration.makefile.additionalCompilerNames.description": "要添加到扩展已知列表的编译器工具的名称", "makefile-tools.configuration.makefile.excludeCompilerNames.description": "要从扩展已知列表中排除的编译器工具的名称", diff --git a/i18n/cht/package.i18n.json b/i18n/cht/package.i18n.json index 978e4c70..ff8163c0 100644 --- a/i18n/cht/package.i18n.json +++ b/i18n/cht/package.i18n.json @@ -51,8 +51,7 @@ "makefile-tools.configuration.makefile.makeDirectory.description": "要透過切換 -C Make 通過的資料夾路徑", "makefile-tools.configuration.makefile.makefilePath.description": "專案之 Makefile 的路徑", "makefile-tools.configuration.makefile.buildLog.description": "要讀取以略過試執行之組建記錄檔的路徑", - "makefile-tools.configuration.makefile.extensionOutputFolder.description": "延伸模組所產生之各種輸出檔案的路徑。預設為 VS Code 工作區儲存位置。", - "makefile-tools.configuration.makefile.extensionLog.description": "從 Makefile 輸出通道儲存所有內容的輸出檔案路徑。預設為 'makefile.extensionOutputFolder' 設定的值。", + "makefile-tools.configuration.makefile.extensionLog.description": "從 Makefile 輸出通道儲存所有內容的輸出檔案路徑。", "makefile-tools.configuration.makefile.dryrunSwitches.description": "要傳遞至試執行 Make 引動過程的引數", "makefile-tools.configuration.makefile.additionalCompilerNames.description": "要新增至延伸模組已知清單的編譯器工具名稱", "makefile-tools.configuration.makefile.excludeCompilerNames.description": "要從延伸模組已知清單中排除的編譯器工具名稱", diff --git a/i18n/csy/package.i18n.json b/i18n/csy/package.i18n.json index f3fd5126..253abd17 100644 --- a/i18n/csy/package.i18n.json +++ b/i18n/csy/package.i18n.json @@ -51,8 +51,7 @@ "makefile-tools.configuration.makefile.makeDirectory.description": "Cesta ke složce, která se má předat maku přepínačem -C", "makefile-tools.configuration.makefile.makefilePath.description": "Cesta k souboru pravidel projektu", "makefile-tools.configuration.makefile.buildLog.description": "Cesta k protokolu o sestavení, která se přečte, aby se obešlo zkušební spuštění", - "makefile-tools.configuration.makefile.extensionOutputFolder.description": "Cesta k různým výstupním souborům vytvořeným rozšířením. Výchozí nastavení je umístění úložiště pracovního prostoru VS Code.", - "makefile-tools.configuration.makefile.extensionLog.description": "Cesta k výstupnímu souboru, do které se ukládá veškerý obsah z výstupního kanálu Souboru pravidel. Výchozí hodnota je nastavení makefile.extensionOutputFolder.", + "makefile-tools.configuration.makefile.extensionLog.description": "Cesta k výstupnímu souboru, do které se ukládá veškerý obsah z výstupního kanálu Souboru pravidel.", "makefile-tools.configuration.makefile.dryrunSwitches.description": "Argumenty, které se mají předat při zkušebním volání maku", "makefile-tools.configuration.makefile.additionalCompilerNames.description": "Názvy kompilačních nástrojů, které se mají přidat na seznam známých rozšíření", "makefile-tools.configuration.makefile.excludeCompilerNames.description": "Názvy kompilačních nástrojů, které se mají vyloučit ze seznamu známých rozšíření", diff --git a/i18n/deu/package.i18n.json b/i18n/deu/package.i18n.json index 19e308d0..82662f2c 100644 --- a/i18n/deu/package.i18n.json +++ b/i18n/deu/package.i18n.json @@ -51,8 +51,7 @@ "makefile-tools.configuration.makefile.makeDirectory.description": "Der Ordnerpfad, der über den Schalter „-C“ an „Make“ übergeben werden soll", "makefile-tools.configuration.makefile.makefilePath.description": "Der Pfad zum „Makefile“ des Projekts", "makefile-tools.configuration.makefile.buildLog.description": "Der Pfad zum Buildprotokoll, das gelesen wird, um einen Probelauf zu umgehen", - "makefile-tools.configuration.makefile.extensionOutputFolder.description": "Der Pfad zu verschiedenen Ausgabedateien, die von der Erweiterung erstellt werden. Standardmäßig wird der Speicherort des VS Code-Arbeitsbereichs verwendet.", - "makefile-tools.configuration.makefile.extensionLog.description": "Der Pfad zu einer Ausgabedatei, in der der gesamte Inhalt aus dem Makefile-Ausgabekanal gespeichert wird. Standardmäßig wird der Wert der Einstellung \"makefile.extensionOutputFolder\" verwendet.", + "makefile-tools.configuration.makefile.extensionLog.description": "Der Pfad zu einer Ausgabedatei, in der der gesamte Inhalt aus dem Makefile-Ausgabekanal gespeichert wird.", "makefile-tools.configuration.makefile.dryrunSwitches.description": "Argumente, die an den Aufruf „dry-run make“ übergeben werden sollen", "makefile-tools.configuration.makefile.additionalCompilerNames.description": "Namen von Compiler-Tools, die zur Liste bekannter Erweiterungen hinzugefügt werden sollen", "makefile-tools.configuration.makefile.excludeCompilerNames.description": "Namen von Compiler-Tools, die aus der Liste bekannter Erweiterungen ausgeschlossen werden sollen", diff --git a/i18n/esn/package.i18n.json b/i18n/esn/package.i18n.json index 16f58d94..3d820aa7 100644 --- a/i18n/esn/package.i18n.json +++ b/i18n/esn/package.i18n.json @@ -51,8 +51,7 @@ "makefile-tools.configuration.makefile.makeDirectory.description": "Ruta de acceso a la carpeta que se va a pasar a través del modificador -C", "makefile-tools.configuration.makefile.makefilePath.description": "Ruta de acceso al archivo Make del proyecto", "makefile-tools.configuration.makefile.buildLog.description": "Ruta de acceso al registro de compilación que se lee para omitir un simulacro", - "makefile-tools.configuration.makefile.extensionOutputFolder.description": "La ruta a varios archivos de salida producidos por la extensión. Por defecto es la ubicación de almacenamiento del área de trabajo de VS Code.", - "makefile-tools.configuration.makefile.extensionLog.description": "La ruta a un archivo de salida que almacena todo el contenido del canal de salida Makefile. Por defecto es el valor del parámetro 'makefile.extensionOutputFolder'.", + "makefile-tools.configuration.makefile.extensionLog.description": "La ruta a un archivo de salida que almacena todo el contenido del canal de salida Makefile.", "makefile-tools.configuration.makefile.dryrunSwitches.description": "Argumentos que se van a pasar a la invocación de simulacro de make", "makefile-tools.configuration.makefile.additionalCompilerNames.description": "Nombres de las herramientas del compilador que se van a agregar a la lista conocida de extensiones", "makefile-tools.configuration.makefile.excludeCompilerNames.description": "Nombres de las herramientas del compilador que se excluirán de la lista conocida de extensiones", diff --git a/i18n/fra/package.i18n.json b/i18n/fra/package.i18n.json index 91e8b795..1293b4be 100644 --- a/i18n/fra/package.i18n.json +++ b/i18n/fra/package.i18n.json @@ -51,8 +51,7 @@ "makefile-tools.configuration.makefile.makeDirectory.description": "Le chemin du dossier à passer à make via le switch -C", "makefile-tools.configuration.makefile.makefilePath.description": "Le chemin vers le makefile du projet", "makefile-tools.configuration.makefile.buildLog.description": "Le chemin d’accès au journal de génération qui est lu pour contourner un essai à blanc", - "makefile-tools.configuration.makefile.extensionOutputFolder.description": "Le chemin d'accès aux différents fichiers de sortie produits par l'extension. Par défaut, l'emplacement de stockage de l'espace de travail VS Code.", - "makefile-tools.configuration.makefile.extensionLog.description": "Le chemin d'accès à un fichier de sortie stockant tout le contenu du canal de sortie Makefile. Par défaut, la valeur du paramètre 'makefile.extensionOutputFolder'.", + "makefile-tools.configuration.makefile.extensionLog.description": "Le chemin d'accès à un fichier de sortie stockant tout le contenu du canal de sortie Makefile.", "makefile-tools.configuration.makefile.dryrunSwitches.description": "Les arguments à passer à l’épreuve font invocation", "makefile-tools.configuration.makefile.additionalCompilerNames.description": "Noms des outils de compilation à ajouter à la liste des extensions connues", "makefile-tools.configuration.makefile.excludeCompilerNames.description": "Noms des outils de compilation à exclure de la liste des extensions connues", diff --git a/i18n/ita/package.i18n.json b/i18n/ita/package.i18n.json index 2ad985fc..ec1011e5 100644 --- a/i18n/ita/package.i18n.json +++ b/i18n/ita/package.i18n.json @@ -51,8 +51,7 @@ "makefile-tools.configuration.makefile.makeDirectory.description": "Percorso della cartella da passare tramite l'opzione -C", "makefile-tools.configuration.makefile.makefilePath.description": "Percorso del makefile del progetto", "makefile-tools.configuration.makefile.buildLog.description": "Il percorso del log di compilazione è letto per ignorare un dry-run", - "makefile-tools.configuration.makefile.extensionOutputFolder.description": "Il percorso di vari file di output prodotti dall'estensione. Predefinito alla posizione di archiviazione dell’area di lavoro di VS Code.", - "makefile-tools.configuration.makefile.extensionLog.description": "Il percorso di un file di output che archivia tutto il contenuto dal canale di output Makefile. Predefinito al valore dell'impostazione 'makefile.extensionOutputFolder'.", + "makefile-tools.configuration.makefile.extensionLog.description": "Il percorso di un file di output che archivia tutto il contenuto dal canale di output Makefile.", "makefile-tools.configuration.makefile.dryrunSwitches.description": "Argomenti da passare alla chiamata di dry-run make", "makefile-tools.configuration.makefile.additionalCompilerNames.description": "Nomi degli strumenti del compilatore da aggiungere all'elenco noto dell'estensione", "makefile-tools.configuration.makefile.excludeCompilerNames.description": "Nomi degli strumenti del compilatore da escludere dall'elenco noto dell'estensione", diff --git a/i18n/jpn/package.i18n.json b/i18n/jpn/package.i18n.json index b70c2008..abd8b3fe 100644 --- a/i18n/jpn/package.i18n.json +++ b/i18n/jpn/package.i18n.json @@ -51,8 +51,7 @@ "makefile-tools.configuration.makefile.makeDirectory.description": "スイッチ -C を介して作成するために渡されるフォルダー パス", "makefile-tools.configuration.makefile.makefilePath.description": "プロジェクトのメイクファイルへのパス", "makefile-tools.configuration.makefile.buildLog.description": "ドライランをバイパスするために読み取られたビルド ログへのパス", - "makefile-tools.configuration.makefile.extensionOutputFolder.description": "拡張機能によって生成されるさまざまな出力ファイルへのパス。既定値は、VS Code ワークスペースの保存場所です。", - "makefile-tools.configuration.makefile.extensionLog.description": "メイクファイル出力チャネルのすべてのコンテンツを格納する出力ファイルへのパス。既定値は 'makefile.extensionOutputFolder' 設定の値です。", + "makefile-tools.configuration.makefile.extensionLog.description": "メイクファイル出力チャネルのすべてのコンテンツを格納する出力ファイルへのパス。", "makefile-tools.configuration.makefile.dryrunSwitches.description": "ドライラン make 呼び出しに渡す引数", "makefile-tools.configuration.makefile.additionalCompilerNames.description": "拡張機能の既知のリストに追加するコンパイラ ツールの名前", "makefile-tools.configuration.makefile.excludeCompilerNames.description": "拡張機能の既知のリストから除外するコンパイラ ツールの名前", diff --git a/i18n/kor/package.i18n.json b/i18n/kor/package.i18n.json index 65908baf..7fd16977 100644 --- a/i18n/kor/package.i18n.json +++ b/i18n/kor/package.i18n.json @@ -51,8 +51,7 @@ "makefile-tools.configuration.makefile.makeDirectory.description": "스위치를 통해 make에 전달할 폴더 경로 -C", "makefile-tools.configuration.makefile.makefilePath.description": "프로젝트의 메이크파일 경로", "makefile-tools.configuration.makefile.buildLog.description": "시험 실행을 바이패스하기 위해 읽은 빌드 로그의 경로", - "makefile-tools.configuration.makefile.extensionOutputFolder.description": "확장에서 생성된 다양한 출력 파일의 경로입니다. 기본값은 VS Code 작업 영역 저장소 위치입니다.", - "makefile-tools.configuration.makefile.extensionLog.description": "메이크파일 출력 채널의 모든 콘텐츠를 저장하는 출력 파일의 경로입니다. 기본값은 'makefile.extensionOutputFolder' 설정의 값입니다.", + "makefile-tools.configuration.makefile.extensionLog.description": "메이크파일 출력 채널의 모든 콘텐츠를 저장하는 출력 파일의 경로입니다.", "makefile-tools.configuration.makefile.dryrunSwitches.description": "시험 실행 make 호출에 전달할 인수", "makefile-tools.configuration.makefile.additionalCompilerNames.description": "알려진 확장 목록에서 추가할 컴파일러 도구의 이름", "makefile-tools.configuration.makefile.excludeCompilerNames.description": "알려진 확장 목록에서 제외할 컴파일러 도구의 이름", diff --git a/i18n/plk/package.i18n.json b/i18n/plk/package.i18n.json index 141384fa..c560f247 100644 --- a/i18n/plk/package.i18n.json +++ b/i18n/plk/package.i18n.json @@ -51,8 +51,7 @@ "makefile-tools.configuration.makefile.makeDirectory.description": "Ścieżka folderu do przekazania za pomocą przełącznika -C", "makefile-tools.configuration.makefile.makefilePath.description": "Ścieżka do pliku reguł programu make projektu", "makefile-tools.configuration.makefile.buildLog.description": "Ścieżka do dziennika kompilacji, który jest odczytywany, aby obejść przebieg próbny", - "makefile-tools.configuration.makefile.extensionOutputFolder.description": "Ścieżka do różnych plików wyjściowych utworzonych przez rozszerzenie. Domyślnie jest to lokalizacja magazynu obszaru roboczego programu VS Code.", - "makefile-tools.configuration.makefile.extensionLog.description": "Ścieżka do pliku wyjściowego przechowującego całą zawartość z kanału wyjściowego pliku reguł programu make. Domyślnie przyjmuje wartość ustawienia „makefile.extensionOutputFolder”.", + "makefile-tools.configuration.makefile.extensionLog.description": "Ścieżka do pliku wyjściowego przechowującego całą zawartość z kanału wyjściowego pliku reguł programu make.", "makefile-tools.configuration.makefile.dryrunSwitches.description": "Argumenty do przekazania do przywołania przebiegu próbnego make", "makefile-tools.configuration.makefile.additionalCompilerNames.description": "Nazwy narzędzi kompilatora do dodania do listy znanych rozszerzeń", "makefile-tools.configuration.makefile.excludeCompilerNames.description": "Nazwy narzędzi kompilatora do wykluczenia z listy znanych rozszerzeń", diff --git a/i18n/ptb/package.i18n.json b/i18n/ptb/package.i18n.json index 0de66249..c062a796 100644 --- a/i18n/ptb/package.i18n.json +++ b/i18n/ptb/package.i18n.json @@ -51,8 +51,7 @@ "makefile-tools.configuration.makefile.makeDirectory.description": "O caminho da pasta a ser passado para o make por meio do comutador -C", "makefile-tools.configuration.makefile.makefilePath.description": "O caminho para o makefile do projeto", "makefile-tools.configuration.makefile.buildLog.description": "O caminho para o log de build que está pronto para ignorar uma simulação", - "makefile-tools.configuration.makefile.extensionOutputFolder.description": "O caminho para vários arquivos de saída produzidos pela extensão. O padrão é o local VS Code de armazenamento do workspace.", - "makefile-tools.configuration.makefile.extensionLog.description": "O caminho para um arquivo de saída que armazena todo o conteúdo do canal de saída makefile. O padrão é o valor da configuração 'makefile.extensionOutputFolder'.", + "makefile-tools.configuration.makefile.extensionLog.description": "O caminho para um arquivo de saída que armazena todo o conteúdo do canal de saída makefile.", "makefile-tools.configuration.makefile.dryrunSwitches.description": "Argumentos a serem passados para a invocação do make de simulação", "makefile-tools.configuration.makefile.additionalCompilerNames.description": "Nomes de ferramentas do compilador a serem adicionados na lista de extensões conhecidas", "makefile-tools.configuration.makefile.excludeCompilerNames.description": "Nomes de ferramentas do compilador a serem excluídas da lista de extensões conhecidas", diff --git a/i18n/rus/package.i18n.json b/i18n/rus/package.i18n.json index c6ffc85e..3bff7365 100644 --- a/i18n/rus/package.i18n.json +++ b/i18n/rus/package.i18n.json @@ -51,8 +51,7 @@ "makefile-tools.configuration.makefile.makeDirectory.description": "Путь к папке, передаваемый для создания с помощью переключателя -C", "makefile-tools.configuration.makefile.makefilePath.description": "Путь к файлу makefile проекта", "makefile-tools.configuration.makefile.buildLog.description": "Путь к журналу сборки, который считывается для обхода пробного запуска", - "makefile-tools.configuration.makefile.extensionOutputFolder.description": "Путь к различным выходным файлам, созданным расширением. По умолчанию используется расположение хранилища рабочей области VS Code.", - "makefile-tools.configuration.makefile.extensionLog.description": "Путь к выходному файлу, в котором будет храниться все содержимое из выходного канала файла makefile. По умолчанию используется значение параметра \"makefile.extensionOutputFolder\".", + "makefile-tools.configuration.makefile.extensionLog.description": "Путь к выходному файлу, в котором будет храниться все содержимое из выходного канала файла makefile.", "makefile-tools.configuration.makefile.dryrunSwitches.description": "Аргументы для перехода к пробному вызову make", "makefile-tools.configuration.makefile.additionalCompilerNames.description": "Имена средств компилятора, которые будут добавлены в список известных расширений", "makefile-tools.configuration.makefile.excludeCompilerNames.description": "Имена средств компилятора, исключаемых из списка известных расширений", diff --git a/i18n/trk/package.i18n.json b/i18n/trk/package.i18n.json index fe1fc3b9..9704c361 100644 --- a/i18n/trk/package.i18n.json +++ b/i18n/trk/package.i18n.json @@ -51,8 +51,7 @@ "makefile-tools.configuration.makefile.makeDirectory.description": "-C anahtarı aracılığıyla geçirilecek klasör yolu", "makefile-tools.configuration.makefile.makefilePath.description": "Projenin derleme görevleri dosyasına giden yolu", "makefile-tools.configuration.makefile.buildLog.description": "Provayı atlamak için okunan derleme günlüğüne giden yol", - "makefile-tools.configuration.makefile.extensionOutputFolder.description": "Uzantı tarafından üretilen çeşitli çıkış dosyalarının yolu. Varsayılan olarak VS Code çalışma alanı depolama konumunu alır.", - "makefile-tools.configuration.makefile.extensionLog.description": "Derleme Görevleri Dosyası çıkış kanalından tüm içeriği depolayan bir çıkış dosyasının yolu. Varsayılan olarak 'makefile.extensionOutputFolder' ayarının değerini alır.", + "makefile-tools.configuration.makefile.extensionLog.description": "Derleme Görevleri Dosyası çıkış kanalından tüm içeriği depolayan bir çıkış dosyasının yolu.", "makefile-tools.configuration.makefile.dryrunSwitches.description": "Prova make çağrısına geçirilecek bağımsız değişkenler", "makefile-tools.configuration.makefile.additionalCompilerNames.description": "Bilinen uzantı listesine eklenecek derleyici araçlarının adları", "makefile-tools.configuration.makefile.excludeCompilerNames.description": "Bilinen uzantı listesinden çıkarılacak derleyici araçlarının adları", diff --git a/package.nls.json b/package.nls.json index 64d06fb6..8be9bb38 100644 --- a/package.nls.json +++ b/package.nls.json @@ -46,8 +46,7 @@ "makefile-tools.configuration.makefile.makeDirectory.description": "The folder path to be passed to make via the switch -C", "makefile-tools.configuration.makefile.makefilePath.description": "The path to the makefile of the project", "makefile-tools.configuration.makefile.buildLog.description": "The path to the build log that is read to bypass a dry-run", - "makefile-tools.configuration.makefile.extensionOutputFolder.description": "The path to various output files produced by the extension. Defaults to the VS Code workspace storage location.", - "makefile-tools.configuration.makefile.extensionLog.description": "The path to an output file storing all content from the Makefile output channel. Defaults to the value of the 'makefile.extensionOutputFolder' setting.", + "makefile-tools.configuration.makefile.extensionLog.description": "The path to an output file storing all content from the Makefile output channel.", "makefile-tools.configuration.makefile.dryrunSwitches.description": "Arguments to pass to the dry-run make invocation", "makefile-tools.configuration.makefile.keepDryRuns.markdownDescription": "Keep the output of the dry-run in `${makeDirectory}/.vscode/${currentTarget}.dryrun.log`", "makefile-tools.configuration.makefile.keepConfigurationCache.markdownDescription": "Keep the Intellisense configuration parsed from the makefile as `${makeDirectory}/.vscode/${currentTarget}.cache`.\n\n If this file exists when starting vscode, it will be loaded before dry-running. This can be used to **speed up** Intellisense initialization in very large projects where dry-running is slow.", diff --git a/src/configuration.ts b/src/configuration.ts index ed80fc7e..138ad3be 100644 --- a/src/configuration.ts +++ b/src/configuration.ts @@ -319,35 +319,6 @@ export async function readLoggingLevel(): Promise { logger.message(`Logging level: ${loggingLevel}`); } -let extensionOutputFolder: string | undefined; -export function getExtensionOutputFolder(): string | undefined { return extensionOutputFolder; } -export function setExtensionOutputFolder(folder: string): void { extensionOutputFolder = folder; } - -// Read from settings the path to a folder where the extension is dropping various output files -// (like extension.log, dry-run.log, targets.log). -// Useful to control where such potentially large files should reside. -export async function readExtensionOutputFolder(): Promise { - extensionOutputFolder = await util.getExpandedSetting("extensionOutputFolder"); - if (extensionOutputFolder) { - extensionOutputFolder = util.resolvePathToRoot(extensionOutputFolder); - } else { - extensionOutputFolder = extension.extensionContext.storagePath; - } - - // Check one more time because the value can still be undefined if no folder was opened. - if (extensionOutputFolder) { - if (!util.checkDirectoryExistsSync(extensionOutputFolder)) { - if (!util.createDirectorySync(extensionOutputFolder)) { - extensionOutputFolder = extension.extensionContext.storagePath; - logger.message(`Extension output folder does not exist and could not be created: ${extensionOutputFolder}.`); - logger.message(`Reverting to '${extensionOutputFolder}' default for extension output folder.`); - return; - } - } - logger.message(`Dropping various extension output files at ${extensionOutputFolder}`); - } -} - let extensionLog: string | undefined; export function getExtensionLog(): string | undefined { return extensionLog; } export function setExtensionLog(path: string): void { extensionLog = path; } @@ -363,14 +334,7 @@ export function setExtensionLog(path: string): void { extensionLog = path; } export async function readExtensionLog(): Promise { extensionLog = await util.getExpandedSetting("extensionLog"); if (extensionLog) { - // If there is a directory defined within the extension log path, - // honor it and don't append to extensionOutputFolder. - let parsePath: path.ParsedPath = path.parse(extensionLog); - if (extensionOutputFolder && !parsePath.dir) { - extensionLog = path.join(extensionOutputFolder, extensionLog); - } else { - extensionLog = util.resolvePathToRoot(extensionLog); - } + extensionLog = util.resolvePathToRoot(extensionLog); logger.message(`Writing extension log at ${extensionLog}`); } @@ -1078,9 +1042,8 @@ export function initFromState(): void { // or after any change in the configuration/build-target workspace state variables, in which case // we need a refresh of all settings expanding ${configuration} or ${buildTarget}. export async function initFromSettings(activation: boolean = false): Promise { - // Read first anything related to the output folder and the extension log, + // Read first anything related to the extension log, // to be able to document any upcoming reads. - await readExtensionOutputFolder(); await readExtensionLog(); // Delete the extension log file, if exists, even if we lose what we logged earlier @@ -1241,34 +1204,10 @@ export async function initFromSettings(activation: boolean = false): Promise(subKey); - if (updatedExtensionOutputFolder) { - updatedExtensionOutputFolder = util.resolvePathToRoot(updatedExtensionOutputFolder); - if (!util.checkDirectoryExistsSync(updatedExtensionOutputFolder) && - !util.createDirectorySync(updatedExtensionOutputFolder)) { - // No logging necessary about not being able to create the directory, - // readExtensionOutputFolder called below will complain if it's the case. - updatedExtensionOutputFolder = undefined; - } - } - if (updatedExtensionOutputFolder !== extensionOutputFolder) { - // No IntelliSense update needed. - await readExtensionOutputFolder(); - updatedSettingsSubkeys.push(subKey); - } - subKey = "extensionLog"; let updatedExtensionLog : string | undefined = await util.getExpandedSetting(subKey); if (updatedExtensionLog) { - // If there is a directory defined within the extension log path, - // honor it and don't append to extensionOutputFolder. - let parsePath: path.ParsedPath = path.parse(updatedExtensionLog); - if (extensionOutputFolder && !parsePath.dir) { - updatedExtensionLog = path.join(extensionOutputFolder, updatedExtensionLog); - } else { - updatedExtensionLog = util.resolvePathToRoot(updatedExtensionLog); - } + updatedExtensionLog = util.resolvePathToRoot(updatedExtensionLog); } if (updatedExtensionLog !== extensionLog) { // No IntelliSense update needed.