Skip to content

Commit 9168cbc

Browse files
committed
Update README.md
1 parent 00b460f commit 9168cbc

File tree

1 file changed

+27
-9
lines changed

1 file changed

+27
-9
lines changed

README.md

+27-9
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,22 @@ For detailed information please also consider the Soot's [JavaDoc and Options](h
4646

4747
# Including Soot in your Project
4848

49+
A Soot release is currently built for each commit to the `master` branch. You can include Soot as
50+
a dependency via Maven, Gradle, SBT, etc using the following coordinates:
51+
52+
53+
```.xml
54+
<dependencies>
55+
<dependency>
56+
<groupId>org.soot-oss</groupId>
57+
<artifactId>soot</artifactId>
58+
<version>4.2.1</version>
59+
</dependency>
60+
</dependencies>
61+
```
62+
63+
You can also obtain older builds of the `master` branch. A complete listing of builds can be found on [Maven Central](https://repo.maven.apache.org/maven2/org/soot-oss/soot/).
64+
4965
A Soot SNAPSHOT is currently built for each commit to the `develop` branch. You can include Soot as
5066
a dependency via Maven, Gradle, SBT, etc using the following coordinates:
5167

@@ -73,7 +89,7 @@ You can also obtain older builds of the `develop` branch. A complete listing of
7389

7490
# How do I obtain Soot without Maven?
7591
**We recommend using Soot with Maven**
76-
92+
You can obtain the latest release build of Soot [directly](https://repo1.maven.org/maven2/org/soot-oss/soot/).
7793
You can obtain the latest SNAPSHOT build of Soot [directly](https://oss.sonatype.org/content/repositories/snapshots/org/soot-oss/soot/).
7894

7995
The `soot-<RELEASE>-jar-with-dependencies.jar` file is an all-in-one file that also contains all the required libraries.
@@ -111,17 +127,18 @@ If you want to execute Soot with Java 8 but analyze Java >8 Projects or vice ver
111127
## Use from Source Code
112128
To load modules in Soot's `ModuleScene` from java:
113129
```.java
114-
// configure Soot's options
130+
// configure Soot's options, refer to example configurations below
115131
Options.v().set_soot_modulepath(modulePath);
116132

117133

118134
// load classes from modules into Soot
135+
// Here, getClassUnderModulePath() expects the module path to be set using the Options class as seen above
119136
Map<String, List<String>> map = ModulePathSourceLocator.v().getClassUnderModulePath(modulePath);
120137
for (String module : map.keySet()) {
121138
for (String klass : map.get(module)) {
122139
logger.info("Loaded Class: " + klass + "\n");
123140
loadClass(klass, false, module);
124-
141+
// the loadClass() method is defined below
125142
}
126143
}
127144

@@ -139,31 +156,32 @@ public static SootClass loadClass(String name, boolean main, String module) {
139156
}
140157

141158
```
142-
159+
ModuleUtil.module_mode() helps you check whether you have modules enabled in Soot. This is done based on whether the module path is set using the Options class.
143160

144161
### Example Configurations: Java 8, Java >= 9 Classpath, Java >= 9 Modulepath
145162

146163
```.java
147164

148-
if(java < 9 ) {
165+
if(java < 9 ) { // when you have a target benchmark with Java < 9 and hence no modules
149166
Options.v().set_prepend_classpath(true);
150167
Options.v().set_process_dir(Arrays.asList(applicationClassPath().split(File.pathSeparator)));
151-
Options.v().set_claspath(sootClassPath();
168+
Options.v().set_soot_classpath(sootClassPath());
152169
}
153170

154-
if(java >= 9 && USE_CLASSPATH){
171+
if(java >= 9 && USE_CLASSPATH) { // when you have a target benchmark with Java >= 9 and do not want module support
155172
Options.v().set_soot_classpath("VIRTUAL_FS_FOR_JDK" + File.pathSeparator + sootClassPath());
156173
Options.v().set_process_dir(Arrays.asList(applicationClassPath().split(File.pathSeparator)));
157174
}
158175

159176

160-
if(java>=9 && USE_MODULEPATH){
177+
if(java>=9 && USE_MODULEPATH) { // when you have a target benchmark with Java >= 9 and want module support
161178
Options.v().set_prepend_classpath(true);
162-
Options.v().set_soot_modulepath(ootClassPath());
179+
Options.v().set_soot_modulepath(sootClassPath());
163180
Options.v().set_process_dir(Arrays.asList(applicationClassPath().split(File.pathSeparator)));
164181
}
165182

166183
```
184+
In the above examples, applicationClassPath() should be replaced with the path to the application classes for analysis by Soot and sootClassPath() should be replaced with the Soot classpath.
167185

168186
## Use from the Command Line
169187
To execute Soot using Java 1.9, but analyzing a classpath run, just as before:

0 commit comments

Comments
 (0)