Page 1 of 1

ESP-IDF Extension, Project Version Management

Posted: Wed Jan 13, 2021 2:14 am
by OllieK
I am still a very new user of ESP-IDF Extension on Visual Studio Code, and there has been surprises and disappointments in the learning process. In my past IDEs, there has always been a save as command for files and projects. I am fully aware that in VSC the GIT based Source Control is the recommended solution for the related issues, but I need something simpler.

Certainly, there are several alternative workarounds. I would like to hear your comments for the following.
  • In your OS explorer (Windows, Mac, Linux), find the folder where your VSC project is stores, such as MySuperProject.
  • Copy the folder and give it a new name, such as MySuperProject_V0_1
  • Open the build subfolder and delete all the subfolders and files
  • Start VSC and open folder MySuperProject_V0_1
  • Select the command ESP-IDF: Configure ESP-IDF extension (Use existing setup).
  • Build the project. If you get an error message related to file compile_commands.json then you have skipped the ESP-IDF: Configure ESP-IDF extension command.
This is quite quick procedure and should have been automated in ESP-IDF Extension.

Re: ESP-IDF Extension, Project Version Management

Posted: Thu Jan 21, 2021 9:30 am
by ESP_bignacio
So you are basically asking why do you need to configure the extension every time you open a project. You don't.

The ESP-IDF: Configure ESP-IDF extension will configure the extension and save the settings in your configured save scope. By default your settings are saved in User Settings, but they can be saved in your workspace or workspace folder based on the idf.saveScope configuration setting.

More information ESP-IDF extension setup doc and VSCode Settings strategy

Re: ESP-IDF Extension, Project Version Management

Posted: Thu Jan 21, 2021 10:22 pm
by OllieK
Perhaps, I didn't describe the use case clearly.

It can be assumed that all new projects start from an existing IDF example project. The core question is how to keep multiple versions of the project without github or similar version management tool. In the other IDE tools that I have used, the internal data structures are relative. This allows a simple recursive folder level copy of the old version into a folder for a new version.

In a typical case, the current project version is working more or less and you want to save it before starting a new development phase. If that development fails, you can start again from the old working version.

The simple procedure (delete build folder content) in the new version is not working in all cases. Sometimes, you need to modify the content of the make files.

Proposal:
- Either remove all absolute paths with references to current project
- Or make a command that allows saving of the current project in a new folder


I am still quite new IDF user and for that reason I am totally unfamiliar with the idf.saveScope configuration settings. In many cases, I have been able to save new project versions without seeing the idf.saveScope.

Re: ESP-IDF Extension, Project Version Management

Posted: Fri Jan 22, 2021 2:32 am
by OllieK
I did check my versioning procedure with IDF 4.1/0.6.1

This is an example of the project version management based on the hello_world template

1. Prepare for ESP Projects
- Create a folder for your ESP Projects, such as C:\Users\name\Documents\ESP_Projects
- Create a folder for hello_world project, such as C:\Users\name\Documents\ESP_Projects\HelloWorldProject

2. Select a Template
- Open Command Palette (F1 or Ctrl-Shift-P), select ESP-IDF: Show Examples Projects
- In get-started, select hello_world, select Create project using example hello_world
- Save the project folder in C:\Users\name\Documents\ESP_Projects\HelloWorldProject
- Observe how the initial version is stored in C:\Users\name\Documents\ESP_Projects\HelloWorldProject\hello_world

3. Build, Flash, and Monitor that hello_world works OK

4. Create a folder for the new version
- Open C:\Users\name\Documents\ESP_Projects\HelloWorldProject
- Select hello_world folder and copy it
- Paste it in HelloWorldProject
- Change the folder name from hello_world - Copy to hello_world_V0_1

5. Prepare the new folder for VSC
- Open hello_world_V0_1\build
- Delete all folders and files in build folder
- Open C:\Users\name\Documents\ESP_Projects\HelloWorldProject\hello_world_V0_1\MakeFile with a text editor
- Change the PROJECT NAME from hello-world to hello_world_V0_1, save the file
- Open C:\Users\name\Documents\ESP_Projects\HelloWorldProject\hello_world_V0_1\CMakeLists.txt with a text editor
- Change the project from hello-world to hello_world_V0_1, save the file

6. Open the new version in VSC
- In File Menu, select open folder, select C:\Users\name\Documents\ESP_Projects\HelloWorldProject\hello_world_V0_1
- Notice that the project name is shown as HELLO_WORLD_V0_1

7. Build, Flash, and Monitor that hello_world_V0_1 works OK

8. Repeat the steps 4 - 6 for additional versions

After this, all the different versions of the project are in the same folder (HelloWorldProject). Let me know if you have any questions or comments.

PS. Sorry for my rambling about the absolute paths in the previous post. I didn't find any in the current VSC environment.