- Java 21
sudo apt install openjdk-21-jdkgit clone [email protected]:vex-generation-toolset/java-callgraph.git
cd java-callgraph
./mvnw clean verify-
Launch Eclipse and create (or open) a workspace.
-
Go to File ▸ Import… ▸ Maven ▸ Existing Maven Projects.
-
Browse to the project root directory (
java-callgraph) and finish the import. -
In the Project Explorer, open
target-platform.target.- The Target Definition editor opens.
- Click Set as Active Target Platform (upper right corner).
To run java-callgraph on a java project, first create a config.json inside eclipse directory:
The structure of the config.json file should be like this:
{
"source" : "/path/to/source",
"result" : "/path/to/result",
"summaries" : "/path/to/java-callgraph/summaries",
"debug" : true
}Here
sourceis the path of the java project we want to analyze and build callgraph for.resultindicates the directory where the generated callgraph will be stored in json format.summariespath to the summaries directory inside the project (predefined).debugfield can be used to get additional logs.
After creating config.json, go to eclipse editor.
- In the
Package Explorerright click on the projectorg.openrafactory.callgraph. - From the menu,
Run as->Eclipse Application. - If any warning popup is shown, ignore and click
Continue. Then the run will start and logs will be shown in theconsoletab.
To run a particular test suite (like CallGraphTestSuite):
- Open the test suite class in eclipse editor.
- Right click on the file name from
Package Explorer. - From the menu, hover on
Run asand selectRun Configurations.... - A
Run Configurationswill open up and the test suite will be selected underJunit Plug-in Test. - From the
Testtab, selectJUnit 3asTest runnerand untickRun in UI thread. - Next in the
Maintab, selectRun an applicationand from the drop-down select[No Application] - Headless Mode. - Now click
Runbutton to run the test suite.
The above steps is only necessary for running a test suite for the first time. For subsequent run, you can just select the test suite configuration to run that test suite.
To build docker image, run (may require sudo):
cd java-callgraph
./build_image.sh -i java-cg:latestNext, run the docker container. The source code needs to be mounted at the /workspace/source directory.
The call-graph is generated at the /workspace/result directory. Mount a directory at /workspace/result for the call-graph to persist.
sudo docker run --rm -v <path/to/source>:/workspace/source \
-v <path/to/result>:/workspace/result \
java-cg:latest