Static Analysis of ROS2
Sometimes, LiSA4ROS2 will refer to a snapshot release of LiSA to exploit unreleased features. If, when building, you get the following error message:
> Could not resolve io.github.lisa-analyzer:lisa-project:ver-SNAPSHOT.
> Could not get resource 'https://maven.pkg.github.com/lisa-analyzer/lisa/io/github/lisa-analyzer/lisa-project/ver-SNAPSHOT/maven-metadata.xml'.
> Could not GET 'https://maven.pkg.github.com/lisa-analyzer/lisa/io/github/lisa-analyzer/lisa-project/ver-SNAPSHOT/maven-metadata.xml'. Received status code 401 from server: Unauthorized
Then you have to perform the following:
- Create a GitHub PAT following this guide and grant
read:packages
permission - Create a
gradle.properties
file in the project root folder (where thegradlew
scripts are located) with the following content:
gpr.user=your-github-username
gpr.key=github-access-token
git clone git@github.com:lisa-analyzer/lisa4ros2.git # clone the repository
cd lisa4ros2 # move to the main folder of the project (where the Dockerfile is located)
docker build -t lisa4ros2 . # build the image
# Crete a folder outside the project (for example, lisa-workdir):
cd ..
cd ..
mkdir lisa-workdir # create the directory
cd lisa-workdir # move to the directory
# Move the file(s) that you want to analyze inside this folder and then run the container. Assuming that your current folder is the lisa-workdir folder:
docker run -v ${PWD}:/lisa4ros2/workspace -it lisa4ros2 ./lisa4ros2 workspace/file1.py workspace/output
# If you want to analyze multiple files of the same project at once:
docker run -v ${PWD}:/lisa4ros2/workspace -it lisa4ros2 ./lisa4ros2 workspace/file1.py workspace/file2.py workspace/fileN.py workspace/output
# You can see the files generated by lisa4ros2 inside the lisa-workdir/output folder.
./gradlew build
./gradlew run --args="path/to/file1.py path/to/fileN.py path/to/output/directory"