Skip to content

Commit 5d989a3

Browse files
author
Manuel Benz
committed
Merge branch 'develop'
2 parents 64be2ca + 577d458 commit 5d989a3

File tree

160 files changed

+18288
-4614
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+18288
-4614
lines changed

Jenkinsfile

+227
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
pipeline {
2+
agent any
3+
4+
stages {
5+
6+
stage('Style'){
7+
parallel{
8+
stage('Stylecheck') {
9+
steps {
10+
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
11+
sh "mvn checkstyle:check -Dcheckstyle.failOnViolation=true"
12+
}
13+
}
14+
}
15+
16+
17+
stage('Licensecheck') {
18+
steps {
19+
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
20+
sh "mvn license:check-file-header -Dlicence-check.failOnMissingHeader=true"
21+
}
22+
}
23+
}
24+
}
25+
}
26+
27+
28+
stage('Build') {
29+
parallel{
30+
stage('Build with JDK8'){
31+
32+
agent {
33+
docker {
34+
image 'maven:3-jdk-8-alpine'
35+
args '-v $HOME/.m2:/root/.m2'
36+
}
37+
}
38+
39+
steps {
40+
sh 'mvn clean compile'
41+
}
42+
43+
}
44+
45+
46+
47+
stage('Build with JDK9'){
48+
49+
agent {
50+
docker {
51+
image 'maven:3-jdk-9-slim'
52+
args '-v $HOME/.m2:/root/.m2'
53+
}
54+
}
55+
56+
steps {
57+
sh 'mvn clean compile'
58+
}
59+
60+
}
61+
62+
stage('Build with JDK11'){
63+
64+
agent {
65+
docker {
66+
image 'maven:3-jdk-11-slim'
67+
args '-v $HOME/.m2:/root/.m2'
68+
}
69+
}
70+
71+
steps {
72+
sh 'mvn clean compile'
73+
}
74+
75+
}
76+
77+
78+
}
79+
}
80+
81+
82+
stage('Test') {
83+
parallel {
84+
85+
stage('Test JDK8'){
86+
87+
agent {
88+
docker {
89+
image 'maven:3-jdk-8-alpine'
90+
args '-v $HOME/.m2:/root/.m2'
91+
92+
}
93+
}
94+
95+
steps {
96+
sh 'mvn test -PJava8'
97+
98+
}
99+
100+
}
101+
102+
stage('Test JDK9'){
103+
104+
agent {
105+
docker {
106+
image 'maven:3-jdk-9-slim'
107+
args '-v $HOME/.m2:/root/.m2'
108+
}
109+
}
110+
111+
steps {
112+
sh 'mvn test -PJava9'
113+
114+
}
115+
116+
}
117+
118+
stage('Test JDK11'){
119+
120+
agent {
121+
docker {
122+
image 'maven:3-jdk-11-slim'
123+
args '-v $HOME/.m2:/root/.m2'
124+
}
125+
}
126+
127+
steps {
128+
sh 'mvn test -PJava11'
129+
130+
}
131+
132+
}
133+
}
134+
}
135+
136+
137+
stage ('Deploy to Maven Central') {
138+
when {
139+
anyOf {
140+
branch 'master'
141+
branch 'develop'
142+
}
143+
}
144+
145+
steps {
146+
withCredentials([string(
147+
credentialsId: 'artifact-signing-key-password',
148+
variable: 'SIGN_KEY')]) {
149+
configFileProvider(
150+
[configFile(fileId: '10647dc3-5621-463b-a290-85290f0ad119', variable: 'MAVEN_SETTINGS')]) {
151+
sh 'mvn -s $MAVEN_SETTINGS deploy -P deploy -DskipTests -Dcheckstyle.failOnViolation=true -Dgpg.passphrase=$SIGN_KEY'
152+
}
153+
}
154+
}
155+
}
156+
157+
stage('Deploy Artifacts to Directories') {
158+
when {
159+
anyOf {
160+
branch 'master'
161+
}
162+
}
163+
environment {
164+
POM_VERSION=sh(script: 'mvn -q -Dexec.executable="echo" -Dexec.args=\'${project.version}\' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.6.0:exec', , returnStdout: true).trim()
165+
}
166+
parallel {
167+
stage('Copy Jars'){
168+
steps {
169+
sh 'rm -r /data/out/origin/$BRANCH_NAME/soot/soot-$BRANCH_NAME/build || true'
170+
sh 'mkdir -p /data/out/origin/$BRANCH_NAME/soot/soot-$BRANCH_NAME/${POM_VERSION}/build'
171+
sh 'cp ./target/*.jar /data/out/origin/$BRANCH_NAME/soot/soot-$BRANCH_NAME/${POM_VERSION}/build'
172+
}
173+
}
174+
175+
stage('Copy JavaDoc'){
176+
steps {
177+
sh 'rm -r /data/out/origin/$BRANCH_NAME/soot/soot-$BRANCH_NAME/${POM_VERSION}/jdoc || true'
178+
sh 'mkdir -p /data/out/origin/$BRANCH_NAME/soot/soot-$BRANCH_NAME/${POM_VERSION}/jdoc'
179+
sh 'unzip ./target/sootclasses-trunk-javadoc.jar -d /data/out/origin/$BRANCH_NAME/soot/soot-$BRANCH_NAME/${POM_VERSION}/jdoc/'
180+
}
181+
}
182+
183+
stage('Copy Options'){
184+
steps {
185+
sh 'rm -r /data/out/origin/$BRANCH_NAME/soot/soot-$BRANCH_NAME/${POM_VERSION}/options || true'
186+
sh 'mkdir -p /data/out/origin/$BRANCH_NAME/soot/soot-$BRANCH_NAME/${POM_VERSION}/options'
187+
sh 'cp doc/soot_options.htm /data/out/origin/$BRANCH_NAME/soot/soot-$BRANCH_NAME/${POM_VERSION}/options'
188+
}
189+
}
190+
}
191+
}
192+
193+
stage('Deploy Snapshot Artifacts to Directories') {
194+
when {
195+
anyOf {
196+
branch 'develop'
197+
}
198+
}
199+
parallel {
200+
stage('Copy Jars'){
201+
steps {
202+
sh 'rm -r /data/out/origin/$BRANCH_NAME/soot/soot-$BRANCH_NAME/build || true'
203+
sh 'mkdir -p /data/out/origin/$BRANCH_NAME/soot/soot-$BRANCH_NAME/build'
204+
sh 'cp ./target/*.jar /data/out/origin/$BRANCH_NAME/soot/soot-$BRANCH_NAME/build'
205+
}
206+
}
207+
208+
stage('Copy JavaDoc'){
209+
steps {
210+
sh 'rm -r /data/out/origin/$BRANCH_NAME/soot/soot-$BRANCH_NAME/jdoc || true'
211+
sh 'mkdir -p /data/out/origin/$BRANCH_NAME/soot/soot-$BRANCH_NAME/jdoc'
212+
sh 'unzip ./target/sootclasses-trunk-javadoc.jar -d /data/out/origin/$BRANCH_NAME/soot/soot-$BRANCH_NAME/jdoc/'
213+
}
214+
}
215+
216+
stage('Copy Options'){
217+
steps {
218+
sh 'rm -r /data/out/origin/$BRANCH_NAME/soot/soot-$BRANCH_NAME/options || true'
219+
sh 'mkdir -p /data/out/origin/$BRANCH_NAME/soot/soot-$BRANCH_NAME/options'
220+
sh 'cp doc/soot_options.htm /data/out/origin/$BRANCH_NAME/soot/soot-$BRANCH_NAME/options'
221+
}
222+
}
223+
}
224+
}
225+
226+
}
227+
}

README.md

+98-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
1-
[![Build Status](https://soot-build.cs.uni-paderborn.de/jenkins/buildStatus/icon?job=soot%2Fsoot-master)](https://soot-build.cs.uni-paderborn.de/jenkins/job/soot/job/soot-master/)
1+
[![Build Status](https://soot-build.cs.uni-paderborn.de/jenkins/job/soot/job/soot-pipeline/job/master/badge/icon)](https://soot-build.cs.uni-paderborn.de/jenkins/job/soot/job/soot-pipeline/job/master/)
22

33
# Using Soot? Let us know about it!
44
We are regularly applying for funding to help us maintain Soot. You can help us immensely by letting us know about [**projects that use Soot**](https://github.com/Sable/soot/wiki/Users-of-Soot), both commercially or in the form of research tools.
55

66
# Soot supports Java 9 modules now!
7-
Try and get involved in Soot's Java 9 bleeding edge developement. Check out the [Soot-j9](https://github.com/sable/soot/tree/java9) branch.
7+
Try and get involved in Soot's Java 9 bleeding edge developement.
8+
## What works and is tested?
9+
* Automatic modules (modules automatically created from jars in the module-path)
10+
* Named modules
11+
* Exploded modules
12+
* Modular jar files
13+
* Resolving modules in Soot's `ModuleScene`
14+
* Spark
15+
16+
## What does not work yet?
17+
* Anonymous modules (mixing module- and class-path)
18+
* Multi-module jar files
819

920
# What is Soot?
1021

@@ -19,7 +30,9 @@ See http://www.sable.mcgill.ca/soot/ for details.
1930

2031
# How do I get started with Soot?
2132

22-
We have some documentation on Soot in the [wiki](https://github.com/Sable/soot/wiki) and also a large range of [tutorials](http://www.sable.mcgill.ca/soot/tutorial/index.html) on Soot.
33+
We have some documentation on Soot in the [wiki](https://github.com/Sable/soot/wiki) and also a large range of [tutorials](http://www.sable.mcgill.ca/soot/tutorial/index.html) on Soot.
34+
35+
For detailed information please also consider the Soot's [JavaDoc and Options](https://github.com/Sable/soot/wiki/Options-and-JavaDoc) Documentations.
2336

2437
# Including Soot in your Project
2538

@@ -32,7 +45,7 @@ a dependency via Maven, Gradle, SBT, etc using the following coordinates:
3245
<dependency>
3346
<groupId>ca.mcgill.sable</groupId>
3447
<artifactId>soot</artifactId>
35-
<version>3.3.0</version>
48+
<version>4.0.0</version>
3649
</dependency>
3750
</dependencies>
3851
```
@@ -67,3 +80,84 @@ That way you can help us in two ways:
6780
* By letting us know how we can improve Soot you can directly help us prioritize newly planned features.
6881
* By stating your name and affiliation you help us showcasing Soot’s large user base.
6982
Thanks!
83+
84+
# How to use Soot's Java 9 Features?
85+
86+
If you want to run Soot with Java > 8, you are done. Just run it as usal.
87+
If you want to execute Soot with Java 8 but analyze Java >8 Projects or vice versa, see below.
88+
89+
## Use from Source Code
90+
To load modules in Soot's `ModuleScene` from java:
91+
```.java
92+
// configure Soot's options
93+
Options.v().set_soot_modulepath(modulePath);
94+
95+
96+
// load classes from modules into Soot
97+
Map<String, List<String>> map = ModulePathSourceLocator.v().getClassUnderModulePath(modulePath);
98+
for (String module : map.keySet()) {
99+
for (String klass : map.get(module)) {
100+
logger.info("Loaded Class: " + klass + "\n");
101+
loadClass(klass, false, module);
102+
103+
}
104+
}
105+
106+
107+
//this must be called after all classes are loaded
108+
Scene.v().loadNecessaryClasses();
109+
110+
111+
public static SootClass loadClass(String name, boolean main, String module) {
112+
SootClass c = ModuleScene.v().loadClassAndSupport(name, Optional.of(module));
113+
c.setApplicationClass();
114+
if (main)
115+
Scene.v().setMainClass(c);
116+
return c;
117+
}
118+
119+
```
120+
121+
122+
### Example Configurations: Java 8, Java >= 9 Classpath, Java >= 9 Modulepath
123+
124+
```.java
125+
126+
if(java < 9 ) {
127+
Options.v().set_prepend_classpath(true);
128+
Options.v().set_process_dir(Arrays.asList(applicationClassPath().split(File.pathSeparator)));
129+
Options.v().set_claspath(sootClassPath();
130+
}
131+
132+
if(java >= 9 && USE_CLASSPATH){
133+
Options.v().set_soot_classpath("VIRTUAL_FS_FOR_JDK" + File.pathSeparator + sootClassPath());
134+
Options.v().set_process_dir(Arrays.asList(applicationClassPath().split(File.pathSeparator)));
135+
}
136+
137+
138+
if(java>=9 && USE_MODULEPATH){
139+
Options.v().set_prepend_classpath(true);
140+
Options.v().set_soot_modulepath(ootClassPath());
141+
Options.v().set_process_dir(Arrays.asList(applicationClassPath().split(File.pathSeparator)));
142+
}
143+
144+
```
145+
146+
## Use from the Command Line
147+
To execute Soot using Java 1.9, but analyzing a classpath run, just as before:
148+
`java -cp soot-trunk-j9.jar soot.Main --process-dir directoryToAnalyse`
149+
150+
151+
if you want to specify the classpath explicitly run:
152+
`java -cp soot-trunk-j9.jar soot.Main -cp VIRTUAL_FS_FOR_JDK --process-dir directoryToAnalyse`
153+
154+
the value `VIRTUAL_FS_FOR_JDK` indicates that Soot should search Java's (>9) virtual filesystem `jrt:/` for classes, too, although Soot is not executed in module mode.
155+
156+
157+
To load modules and classes in Soot using java 1.8 run:
158+
159+
` java -cp PATH_TO_JAVA9/jrt-fs.jar:soot-trunk-j9.jar soot.Main -pp -soot-modulepath modules/ `
160+
161+
162+
Please replace `PATH_TO_JAVA9` with the path to your local installation of java 9.
163+
The `jrt-fs.jar` is a built-in NIO FileSystem provider for the jrt:// filesystem java 9 uses that replaces `rt.jar`.

doc/soot_options.htm

+9
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,10 @@ <H2><A name="section_1">General Options</A></H2>
508508
<td><tt>-ignore-resolving-levels </tt><br></td>
509509
<td colspan="2">Ignore mismatching resolving levels</td>
510510
</tr>
511+
<tr>
512+
<td><tt>-weak-map-structures </tt><br></td>
513+
<td colspan="2">Use weak references in Scene to prevent memory leakage when removing many classes/methods/locals</td>
514+
</tr>
511515
</table>
512516
<H2><A name="section_2">Input Options</A></H2>
513517
<table border="3">
@@ -519,6 +523,11 @@ <H2><A name="section_2">Input Options</A></H2>
519523

520524
</td>
521525
</tr>
526+
<tr>
527+
<td><tt>-soot-modulepath <var>modulepath</var></tt><br></td>
528+
<td colspan="2">Use <var>modulepath</var> as the modulepath for finding classes.
529+
</td>
530+
</tr>
522531
<tr>
523532
<td><tt>-pp </tt><br><tt>-prepend-classpath </tt><br></td>
524533
<td colspan="2">Prepend the given soot classpath to the default classpath.</td>
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/bin/

0 commit comments

Comments
 (0)