Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't overwrite .vscode config if it already exists #2182

Merged
merged 1 commit into from
May 21, 2024

Conversation

trupples
Copy link
Contributor

@trupples trupples commented May 14, 2024

Pull Request Description

(Referencing issue #2181, the following content is copied from there)

Behaviour

The $(PROJECT_TARGET)_configure targets in tools/scripts/stm32.mk and tools/scripts/maxim.mk use the GNU Make file function to set up a default VS Code configuration for projects, with no regard to the contents of those files.

$(PROJECT_TARGET)_configure:
$(file > $(CPP_PROP_JSON),$(CPP_FINAL_CONTENT))
$(file > $(SETTINGSJSON),$(VSC_SET_CONTENT))
$(file > $(LAUNCHJSON),$(VSC_LAUNCH_CONTENT))
$(file > $(TASKSJSON),$(VSC_TASKS_CONTENT))

For context, the content of the files is generated in vsc_intellisense.mk, vsc_openocd_debug.mk, and vsc_tasks.mk.

Impact

With the current makefiles, one may not change their VS Code config without it being reset to the no-OS defaults during the next build, which greatly hinders development. For instance, my WSL dev setup requires changing the gdb options in launch.json, but doing so is futile because the makefile resets my changes when building.

Options

I suggest (this PR) adding a condition to only write to these files if they are empty or don't exist (i.e., during project setup), but keep their current content otherwise, to allow for customization of the config.

Despite some effort, I didn't manage to do it using just GNU Make syntax, but rather by changing the file call from filename.json to filename.json.default, and having some shell commands conditionally copy filename.json.default to filename.json if the latter doesn't exist. Finally, shell commands remove the .default files to keep the directory tidy.

PR Type

  • Bug fix (change that fixes an issue)
  • New feature (change that adds new functionality)
  • Breaking change (has dependencies in other repos or will cause CI to fail)

PR Checklist

  • I have followed the Coding style guidelines
  • I have performed a self-review of the changes
  • I have commented my code, at least hard-to-understand parts
  • I have build all projects affected by the changes in this PR
  • I have tested in hardware affected projects, at the relevant boards
  • I have signed off all commits from this PR
  • I have updated the documentation (wiki pages, ReadMe etc), if applies

Referencing issue analogdevicesinc#2181. $(PROJECT_TARGET)_configure targets in maxim.mk and stm32.mk
don't check if .vscode config files already exist and forcefully overwrite them with
the defaults during every build.

This adds some shell commands to only write the defaults if the files don't exist or
are empty = when setting up the project = when we actually need those defaults.

Signed-off-by: Ioan Dragomir <ioan.dragomir@analog.com>
@rbolboac
Copy link
Contributor

/AzurePipeline run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@rbolboac
Copy link
Contributor

@EoghanMonahan can you please take a look at this since you might be familiar with the topic?

@dbogdan dbogdan merged commit 86d407b into analogdevicesinc:main May 21, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants