espressif / idf-component-manager

Tool for installing ESP-IDF components
https://components.espressif.com/
Apache License 2.0
44 stars 16 forks source link

Download from esp_registry if overwrite_path invalid (PACMAN-537) #14

Closed leeebo closed 8 months ago

leeebo commented 1 year ago

Related area

overwrite_path

Is your feature request related to a problem?

overwrite_path has higher priority than the downloaded registry, which is a helpful strategy for a repository that has multiple components and examples. In the repo, examples can use Local components instead of downloading new ones.

But when out of the repo, like delivering the solo examples to users, during CMake process will failed with ERROR: Invalid source path, should be a directory: ../../.../components

Describe the solution you'd like

I think it's better to give the INFO/Warning instead of ERROR, and alternatively download from the esp_registry to ensure the build process..

Download from the esp_registry will happen when:

  1. overwrite_path is not a folder
  2. overwrite_path is not the request component

Describe alternatives you've considered

No response

Additional context

No response

I have checked existing list of Feature requests and I have provided enough information.

kumekay commented 1 year ago

Hi @leeebo, and thank you for the issue!

While developing the component manager we are trying to achieve less surprise in behavior and bring less "magic" while keeping dependency management convenient.

When a project is started from an example using the CLI command idf.py create-project-from-example, an example won't contain an override path, and dependency will always be downloaded from the registry. If a repository with an example were cloned from a git repo, it wouldn't try to download anything as long as it is at its original location. However, if a user moves it out, it should be a conscious decision whether to update or remove override_path.

We can add a more verbose error message explaining which file should be modified to achieve the desired behavior.

If your use case is different, could you please describe your workflow in more detail?

xcguang commented 1 year ago

I think it's better to give the INFO/Warning instead of ERROR, and alternatively download from the esp_registry to ensure the build process..

I also agree with this action, and sometime it will be useful in some case. If so, we can set one same component path in all examples, the first example will clone component, and others can use the local one, and if we modify the code of component, it will be valid for all examples.

leeebo commented 1 year ago

If a repository with an example were cloned from a git repo, it wouldn't try to download anything as long as it is at its original location. However, if a user moves it out, it should be a conscious decision whether to update or remove override_path.

Yes, in some cases, customers will move the example out of the git repository and do their own development. But most of them (especially beginners) do not realize they should delete override_path before the build process.

kumekay commented 1 year ago

Yes, in some cases, customers will move the example out of the git repository and do their own development. But most of them (especially beginners) do not realize they should delete override_path before the build process.

@leeebo thank you for the explanation. As I mentioned I still lean towards error, however, we will add detailed information for a user on what to do in this case.

kumekay commented 1 year ago

I also agree with this action, and sometime it will be useful in some case. If so, we can set one same component path in all examples, the first example will clone component, and others can use the local one, and if we modify the code of component, it will be valid for all examples.

@xcguang one of the key goals of the component manager is not only to make it easy to download components but also to make sure that builds can be easily reproducible on other machines. This is why the component manager is strict about modifications of components under its control. If you want to manually modify the component and use it in multiple projects locally, you need to perform a few more steps. Move a component from a project's managed_components directory to a shared location and then refer to it as a local component, only specifying the path of the dependency, or by putting it to EXTRA_COMPONENT_DIRS.

kumekay commented 8 months ago

We added a message with explanation in https://github.com/espressif/idf-component-manager/commit/3edde4f8ac2e28e9e370b371cdc7fa9375a1e9bd