How to use environnement variables inside Polyspace project configuration ?
6 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Anirban
on 21 Jan 2020
Edited: Anirban
on 21 Jan 2020
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 Comments
More Answers (1)
Judy Zouaoui
on 22 Jan 2020
2 Comments
Anirban
on 22 Jan 2020
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
See Also
Categories
Find more on Run Settings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!