@@ -36,7 +36,27 @@ public static NopolContext nopolConfigFor(String bug_id) throws Exception {
36
36
}
37
37
public static NopolContext nopolConfigFor (String bug_id , String mvn_option ) throws Exception {
38
38
String folder = "unknown" ;
39
- if (!new File (bug_id ).exists ()) {
39
+
40
+ // for Chart, we use ant
41
+ if (bug_id .startsWith ("Chart" ) && !new File (bug_id ).exists ()) {
42
+ // here we use maven to compile
43
+ String command = "mkdir " + bug_id +";\n cd " + bug_id + ";\n git init;\n git fetch https://github.com/Spirals-Team/defects4j-repair " + bug_id + ":" + bug_id + ";\n git checkout " +bug_id +";\n "
44
+ +"sed -i -e '/delete dir/ d' ant/build.xml;\n "
45
+ +"ant -f ant/build.xml compile compile-tests;\n "
46
+ +"echo -n `pwd`/lib/iText-2.1.4.jar:`pwd`/lib/junit.jar:`pwd`/lib/servlet.jar > cp.txt;\n "
47
+
48
+
49
+ ;
50
+ System .out .println (command );
51
+ Process p = Runtime .getRuntime ().exec (new String []{"sh" , "-c" , command });
52
+ p .waitFor ();
53
+ String output = IOUtils .toString (p .getInputStream ());
54
+ String errorOutput = IOUtils .toString (p .getErrorStream ());
55
+ System .out .println (output );
56
+ System .err .println (errorOutput );
57
+
58
+ } else if (!new File (bug_id ).exists ()) {
59
+ // for the rest we use Maven
40
60
String command = "mkdir " + bug_id +";\n cd " + bug_id + ";\n git init;\n git fetch https://github.com/Spirals-Team/defects4j-repair " + bug_id + ":" + bug_id + ";\n git checkout " +bug_id +";\n mvn -q test -DskipTests " +mvn_option +";\n mvn -q dependency:build-classpath -Dmdep.outputFile=cp.txt" ;
41
61
System .out .println (command );
42
62
Process p = Runtime .getRuntime ().exec (new String []{"sh" , "-c" , command });
@@ -60,8 +80,23 @@ public static NopolContext nopolConfigFor(String bug_id, String mvn_option) thro
60
80
for (String entry : FileUtils .readFileToString (new File (bug_id +"/cp.txt" )).split (new String (new char []{File .pathSeparatorChar }))) {
61
81
cp .add (new File (entry ).toURL ());
62
82
}
63
- cp .add (new File (bug_id +"/target/classes" ).toURL ());
64
- cp .add (new File (bug_id +"/target/test-classes" ).toURL ());
83
+
84
+ File maven_app = new File (bug_id + "/target/classes" );
85
+ if (maven_app .exists ()) {
86
+ cp .add (maven_app .toURL ());
87
+ }
88
+ File maven_test = new File (bug_id + "/target/test-classes" );
89
+ if (maven_test .exists ()) {
90
+ cp .add (maven_test .toURL ());
91
+ }
92
+ File ant_app = new File (bug_id + "/build" );
93
+ if (ant_app .exists ()) {
94
+ cp .add (ant_app .toURL ());
95
+ }
96
+ File ant_test = new File (bug_id + "/build-tests" );
97
+ if (ant_test .exists ()) {
98
+ cp .add (ant_test .toURL ());
99
+ }
65
100
System .out .println (cp );
66
101
//
67
102
nopolContext .setProjectClasspath (cp .toArray (new URL [0 ]));
0 commit comments