How to use environnement variables inside Polyspace project configuration ?
4 次查看(过去 30 天)
显示 更早的评论
Hi,
I'm using Polyspace BugFinder in my company to do static analysis compliance with MISRA rules. I'm starting to use this software with the desktop version (no command line for now).
I wanted to create one project definition for all the developpers that will need to use a static analysis of their code. Since each of us have the source code repository at different location on our computer, we set an environment variable to retrieve those sources.
I tried to use this environment variable inside Polyspace but it doesn't work. My question is : is there a way to include sources/includes files path with an environment variable inside Polyspace BugFinder ?
Thanks
0 个评论
采纳的回答
Anirban
2020-1-21
编辑:Anirban
2020-1-21
Each time you open a project in the Polyspace user interface, the path to source files in the project is recomputed with respect to the project location. So, if you submit your Polyspace project to a version control system, each developer creating a local copy of the project will see the project pointing to a local copy of his/her source files.
To give an example, say that the project file (.psprj file) is in a network repository with the path:
//networkLocation/polyspaceProjects/
Say, this project points to a source file:
//networkLocation/src/file.c
If you make a local copy of this repository and the project file is now in:
//usr/local/polyspaceProjects/
When you open this project in the Polyspace user interface, it will recompute the path to the source file as (and try to find the source file there):
//usr/local/src/file.c
In effect, you should not need the environment variable that you are speaking of (as long as the developers' copy of the project can point to their copy of source files).
0 个评论
更多回答(1 个)
Judy Zouaoui
2020-1-22
2 个评论
Anirban
2020-1-22
Hi Judy,
The path is indeed absolute, but the absolute path is recomputed when you open the project in the Polyspace user interface (based on the current location of the project).
This means that in practice, you will see the following if you move the project (possibly along with sources) to a new location like you did:
- If you open the psprj file in a text editor, it still has the old path.
- If you open the project in the Polyspace user interface instead and navigate to the 'Source' folder and the sources inside on the Project Browser pane, you should see the paths to the new files. However, the .psprj file when opened in a text editor still shows the old path.
- Only when you start a new analysis from the user interface are these new locations written to the psprj file. So, now if you open the psprj file in a text editor, you should see the new paths.
The idea was that opening the psprj file directly in a text editor is something that is not recommended. So, all these things happen "behind the scenes" and if the user interacts with the project through the user interface only, the right things should happen.
Note that the recomputing of paths works in most cases but there are some corner cases where it might not work. If you don't see the change I am stating above, please contact MathWorks Technical Support: https://www.mathworks.com/support/contact_us.html
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Coding Standards and Code Metrics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!