Skip to content

Commit db20b8e

Browse files
authored
Merge pull request #143 from Vodorok/refactor_scheduler
Scheduler refactoration
2 parents 032852a + b77750e commit db20b8e

25 files changed

+656
-603
lines changed

eclipse-plugin/eclipse-depcopy/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
<artifactId>gson</artifactId>
1212
<version>2.3.1</version>
1313
</dependency>
14+
<dependency>
15+
<groupId>com.google.code.findbugs</groupId>
16+
<artifactId>jsr305</artifactId>
17+
<version>3.0.2</version>
18+
</dependency>
1419
<dependency>
1520
<groupId>com.google.guava</groupId>
1621
<artifactId>guava</artifactId>

eclipse-plugin/eclipse/cc.codechecker.eclipse.plugin/META-INF/MANIFEST.MF

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,30 @@ Require-Bundle: org.eclipse.ui,
1818
org.eclipse.cdt.core,
1919
org.eclipse.ui.console,
2020
org.apache.log4j
21-
Bundle-ClassPath: .,lib/cc-api.jar,lib/commons-codec.jar,lib/commons-lang3.jar,lib/compiler.jar,lib/hamcrest-all.jar,lib/httpclient.jar,lib/joda-time.jar,lib/libthrift.jar,lib/scl-thrift.jar,lib/cc-thrift.jar,lib/commons-exec.jar,lib/commons-logging.jar,lib/guava.jar,lib/hamcrest-core.jar,lib/httpcore.jar,lib/junit.jar,lib/scl.jar,lib/slf4j-api.jar,lib/gson.jar,lib/dd-plist.jar
21+
Bundle-ClassPath: .,
22+
lib/commons-codec.jar,
23+
lib/commons-lang3.jar,
24+
lib/compiler.jar,
25+
lib/hamcrest-all.jar,
26+
lib/httpclient.jar,
27+
lib/joda-time.jar,
28+
lib/libthrift.jar,
29+
lib/scl-thrift.jar,
30+
lib/cc-thrift.jar,
31+
lib/commons-exec.jar,
32+
lib/commons-logging.jar,
33+
lib/guava.jar,
34+
lib/hamcrest-core.jar,
35+
lib/httpcore.jar,
36+
lib/junit.jar,
37+
lib/scl.jar,
38+
lib/slf4j-api.jar,
39+
lib/gson.jar,
40+
lib/dd-plist.jar,
41+
lib/jsr305.jar
2242
ClassPath: lib/cc-api.jar lib/commons-codec.jar lib/commons-lang3.jar lib/compiler.jar lib/hamcrest-all.jar lib/httpclient.jar lib/joda-time.jar lib/libthrift.jar lib/scl-thrift.jar lib/cc-thrift.jar lib/commons-exec.jar lib/commons-logging.jar lib/guava.jar lib/hamcrest-core.jar lib/httpcore.jar lib/junit.jar lib/scl.jar lib/slf4j-api.jar lib/gson.jar lib/dd-plist.jar
2343
Class-Path: lib/cc-api.jar lib/commons-codec.jar lib/commons-lang3.jar lib/compiler.jar lib/hamcrest-all.jar lib/httpclient.jar lib/joda-time.jar lib/libthrift.jar lib/scl-thrift.jar lib/cc-thrift.jar lib/commons-exec.jar lib/commons-logging.jar lib/guava.jar lib/hamcrest-core.jar lib/httpcore.jar lib/junit.jar lib/scl.jar lib/slf4j-api.jar lib/gson.jar lib/dd-plist.jar
24-
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
44+
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
2545
Bundle-ActivationPolicy: lazy
2646
Export-Package: cc.codechecker.plugin,
2747
cc.codechecker.plugin.runtime

eclipse-plugin/eclipse/cc.codechecker.eclipse.plugin/build.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ bin.includes = plugin.xml,\
66
icons/,\
77
contexts.xml,\
88
lib/*.jar,\
9-
log4j.properties
9+
log4j.properties,\
10+
lib/jsr305.jar
1011

eclipse-plugin/eclipse/cc.codechecker.eclipse.plugin/src/cc/codechecker/plugin/Activator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public void start(BundleContext context) throws Exception {
8383
*/
8484
public void stop(BundleContext context) throws Exception {
8585
plugin = null;
86-
CodeCheckerContext.getInstance().stopServers();
86+
ConsoleFactory.consoleWrite("CodeChecker Plugin Stopped");
8787
super.stop(context);
8888
}
8989

eclipse-plugin/eclipse/cc.codechecker.eclipse.plugin/src/cc/codechecker/plugin/CodeCheckerNature.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
import cc.codechecker.plugin.config.CcConfiguration;
88
import cc.codechecker.plugin.config.CodeCheckerContext;
99

10+
/**
11+
* Eclipse uses natures as project feature indicators.
12+
* This class adds CodeChecker related nature.
13+
*
14+
*/
1015
public class CodeCheckerNature implements IProjectNature {
1116

1217
public static final String NATURE_ID = "cc.codechecker.plugin.CodeCheckerNature";
@@ -20,10 +25,7 @@ public void configure() throws CoreException {
2025
}
2126

2227
@Override
23-
public void deconfigure() throws CoreException {
24-
// TODO Auto-generated method stub
25-
26-
}
28+
public void deconfigure() throws CoreException {}
2729

2830
@Override
2931
public IProject getProject() {

eclipse-plugin/eclipse/cc.codechecker.eclipse.plugin/src/cc/codechecker/plugin/Logger.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package cc.codechecker.plugin;
22

3+
import java.io.PrintWriter;
4+
import java.io.StringWriter;
5+
36
import org.eclipse.core.runtime.ILog;
47
import org.eclipse.core.runtime.Status;
58

@@ -28,4 +31,16 @@ public static void extLog(int level,String message){
2831
public static void consoleLog(String message){
2932
ConsoleFactory.consoleWrite(message);
3033
}
34+
35+
/**
36+
* Returns Stack Trace as String.
37+
* @param throwable The exception in question.
38+
* @return The Stack Trace as String.
39+
*/
40+
public static String getStackTrace(final Throwable throwable) {
41+
final StringWriter sw = new StringWriter();
42+
final PrintWriter pw = new PrintWriter(sw, true);
43+
throwable.printStackTrace(pw);
44+
return sw.getBuffer().toString();
45+
}
3146
}

eclipse-plugin/eclipse/cc.codechecker.eclipse.plugin/src/cc/codechecker/plugin/config/CcConfiguration.java

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import java.util.Map;
88
import java.util.Set;
99
import java.util.concurrent.ConcurrentHashMap;
10+
import javax.annotation.Nullable;
1011

1112
import org.eclipse.cdt.core.CCorePlugin;
1213
import org.eclipse.cdt.core.envvar.IContributedEnvironment;
@@ -31,7 +32,6 @@
3132
import cc.codechecker.plugin.config.Config.ConfigLogger;
3233
import cc.codechecker.plugin.config.Config.ConfigTypes;
3334
import cc.codechecker.plugin.runtime.CodeCheckEnvironmentChecker;
34-
import cc.codechecker.plugin.runtime.CodecheckerServerThread;
3535

3636
/**
3737
* Stores and manages configurations related to projects and the plug-in.
@@ -160,7 +160,7 @@ private void storeLoadedPreferences(){
160160
* @param global If null the projects internal boolean decides which to return.
161161
* @return The configuration which has chosen.
162162
*/
163-
public Map<ConfigTypes, String> getProjectConfig(Boolean global) {
163+
public Map<ConfigTypes, String> getProjectConfig(@Nullable Boolean global) {
164164
Map<ConfigTypes, String> retConfig = new HashMap<>();
165165
retConfig.putAll(projectOnlyConfig);
166166
if (global == null) {
@@ -211,19 +211,18 @@ public void updateProjectConfig(Map<ConfigTypes,String> config){
211211
try {
212212
projectPreferences.flush();
213213
storeLoadedPreferences();
214-
updateServer(CodeCheckerContext.getInstance().getServerObject(project));
215214
} catch (BackingStoreException e) {
216215
Logger.log(IStatus.ERROR, e.getMessage());
217216
e.printStackTrace();
218217
}
219218
}
220219

221220
/**
222-
* Return File location relative to project location.
221+
* Return File location relative to project location.
223222
* @param projectRelativeFile The file in question.
224223
* @return The location.
225224
*/
226-
public String convertFilenameToServer(String projectRelativeFile) {
225+
public String getAsProjectRelativePath(String projectRelativeFile) {
227226
return getLocationPrefix() + projectRelativeFile;
228227
}
229228

@@ -237,14 +236,14 @@ public String getLocationPrefix() {
237236

238237
/**
239238
* Strips path from file location.
240-
* @param serverFile Only the filename needed from this.
239+
* @param path Only the filename needed from this.
241240
* @return Filename stripped of it's path prefix.
242241
*/
243-
public String convertFilenameFromServer(String serverFile) {
242+
public String stripProjectPathFromFilePath(String path) {
244243
if (getLocationPrefix().equals(STR_EMPTY)) {
245-
return serverFile;
244+
return path;
246245
}
247-
return serverFile.replace(getLocationPrefix(), STR_EMPTY);
246+
return path.replace(getLocationPrefix(), STR_EMPTY);
248247
}
249248

250249
/**
@@ -263,18 +262,6 @@ public void checkCodeCheckerReportDir() {
263262
}
264263
}
265264

266-
/**
267-
* TODO Will be deleted in next patch.
268-
* @param server .
269-
*/
270-
public void updateServer(CodecheckerServerThread server) {
271-
if (project!=null){
272-
Logger.log(IStatus.INFO, "Updating Server" + project.getName());
273-
CodeCheckEnvironmentChecker ccec = new CodeCheckEnvironmentChecker(getProjectConfig(null));
274-
server.setCodecheckerEnvironment(ccec);
275-
}
276-
}
277-
278265
/**
279266
* Adds to build environment variables, to be able to log the compilation commands with lldb.
280267
* @param environmentAdd
@@ -309,6 +296,17 @@ public void modifyProjectEnvironmentVariables() {
309296
}
310297
}
311298

299+
/**
300+
*
301+
* @return Returns the newly generated analyze log location.
302+
*/
303+
public String getLogFileLocation() {
304+
CodeCheckEnvironmentChecker ccec = new CodeCheckEnvironmentChecker(getProjectConfig(null));
305+
String logFile = ccec.getLogFileLocation();
306+
Logger.log(IStatus.INFO,"Logfile being used is: " + logFile);
307+
return logFile;
308+
}
309+
312310
/**
313311
* @return The global configuration.
314312
*/

0 commit comments

Comments
 (0)