AntelopeIO / antler-proj

MIT License
1 stars 0 forks source link

Incorrect work of "init" command #24

Closed jolly-fellow closed 1 year ago

jolly-fellow commented 1 year ago
  1. New code in #22 creates a project file with extension "yml" but other parts of the code still work with extension "yaml" too. It leads to the following bug: When we have two project files with different extensions in the same directory antler-proj works with the file with "yaml" extension and ignore "yml" file. User may have the following problems because of this. Example:

We successfully created a project file. root@c1742fb0fdb3:/app# antler-proj init /host/home/alex/dev/projects/AntelopeIO/Clion_DUNE/test test_proj 0.1 [info_log] :: project.version 0.1 [info_log] :: Wrote project manifest to /host/home/alex/dev/projects/AntelopeIO/Clion_DUNE/test.

It calls project.yml. But we already have a project.yaml file in the same directory. Then we trying to add a new app to our new project:

root@c1742fb0fdb3:/app# antler-proj add /host/home/alex/dev/projects/AntelopeIO/Clion_DUNE/test app test_app c++
[error_log] :: Object test_app already exists in project. [error_log] :: failed to add app

and getting error because this app is exists in project.yaml file. It is impossible to understand what is the problem until the user don't check the "test" directory and content of project.yaml file.

I recommend to use only one extension everywhere in the code to avoid such kind of problems.

  1. antler-proj overwrites an existing project file without warnings or prompt to choose what to do. It may lead to unexpected loosing of information.

root@c1742fb0fdb3:/app# antler-proj init /host/home/alex/dev/projects/AntelopeIO/Clion_DUNE/test test_proj [info_log] :: project.version 0.0.0 [info_log] :: Wrote project manifest to /host/home/alex/dev/projects/AntelopeIO/Clion_DUNE/test. PROJ "/host/home/alex/dev/projects/AntelopeIO/Clion_DUNE/test" [info_log] :: Created project test_proj at location /host/home/alex/dev/projects/AntelopeIO/Clion_DUNE/test

root@c1742fb0fdb3:/app# antler-proj init /host/home/alex/dev/projects/AntelopeIO/Clion_DUNE/test test_proj [info_log] :: project.version 0.0.0 [info_log] :: Wrote project manifest to /host/home/alex/dev/projects/AntelopeIO/Clion_DUNE/test. PROJ "/host/home/alex/dev/projects/AntelopeIO/Clion_DUNE/test" [info_log] :: Created project test_proj at location /host/home/alex/dev/projects/AntelopeIO/Clion_DUNE/test

ScottBailey commented 1 year ago

I think antler-proj should prefer the yaml extension. It's a bit friendlier on posix systems, I believe. Rather than ONLY work with one extension, it seems friendlier to provide a warning if both exist. The user should be free to point antler-proj directly to the full path of the project file. i.e. antler-proj ./my_project/project.yaml or antler-proj ./my_other_proj/project.yml. In these full path cases I would NOT expect antler-proj to look for the other extension.

I concur with part #2. antler proj init should not overwrite any files. But antler-proj init --force should.

dimas1185 commented 1 year ago

I chime in with Scott, https://yaml.org/faq.html suggests official extension to be *.yaml. This issue looks fixed and no more reproducible but I think we should change project file extension to the common and officially suggested one.

dimas1185 commented 1 year ago

fixed in one of previous updates. current main behaves like that:

antler-proj init . test_proj 0.1
[info_log] :: project.version 0.1
[info_log] :: Wrote project manifest to ..
PROJ "."
[info_log] :: Created project test_proj at location .
2023-04-1821:41:24dimadima-XPS-17-9720 ~/work/issues/24 
tree .
.
├── apps
├── include
├── libs
├── project.yml
├── ricardian
└── tests
antler-proj add . app test_app c++
[info_log] :: 
name: test_app
language: CXX
compile options: 
link options: 
[info_log] :: Wrote project manifest to /home/dima/work/issues/24.
2023-04-1821:42:20dimadima-XPS-17-9720 ~/work/issues/24 
tree .
.
├── apps
│   └── test_app
│       └── test_app.cpp
├── include
│   └── test_app
│       └── test_app.hpp
├── libs
├── project.yml
├── ricardian
└── tests

7 directories, 3 files
stephenpdeos commented 1 year ago

We should update all documentation to observe .yaml format and default project.yaml generated should use the same format. We will still support both .yaml and yml.