Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions client.diff/p
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
p=$(pwd -P)
function compile() {
gradle build -x checkstyleMain
}
compile
cp build/libs/client.diff-2.1.0-SNAPSHOT.jar ../gumtree-20170805-2.1.0-SNAPSHOT/lib/
cd ..
gumtree-20170805-2.1.0-SNAPSHOT/bin/gumtree webdiff Hello1.pb Hello2.pb
cd -
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,16 @@ public DiffView(File fSrc, File fDst) throws IOException {
TreeContext dst = Generators.getInstance().getTree(fDst.getAbsolutePath());
Matcher matcher = Matchers.getInstance().getMatcher(src.getRoot(), dst.getRoot());
matcher.match();
diffs = new HtmlDiffs(fSrc, fDst, src, dst, matcher);
if (fSrc.getAbsolutePath().endsWith(".pb")) {
String pathSrc = fSrc.getAbsolutePath();
pathSrc = pathSrc.substring(0, pathSrc.lastIndexOf(".pb")) + ".java";
String pathDst = fDst.getAbsolutePath();
pathDst = pathDst.substring(0, pathDst.lastIndexOf(".pb")) + ".java";
// System.out.println("ends with .pb " + pathSrc + " dst = " + pathDst);
diffs = new HtmlDiffs(new File(pathSrc), new File(pathDst), src, dst, matcher);
} else {
diffs = new HtmlDiffs(fSrc, fDst, src, dst, matcher);
}
diffs.produce();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ protected void process(String name, String[] args) {

public static void initGenerators() {
Reflections reflections = new Reflections("com.github.gumtreediff.gen");

reflections.getSubTypesOf(TreeGenerator.class).forEach(
gen -> {
com.github.gumtreediff.gen.Register a =
Expand Down
4 changes: 3 additions & 1 deletion core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ dependencies {
compile 'com.github.mpkorstanje:simmetrics-core:3.2.3'
compile 'net.sf.trove4j:trove4j:3.0.3'
compile 'com.google.code.gson:gson:2.4'
compile files('lib/protobuf-java-3.3.1.jar')
runtime files('lib/protobuf-java-3.3.1.jar')
}
allprojects {
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
}
}
18 changes: 18 additions & 0 deletions core/p
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
function compile() {
gradle build -x checkstyleMain -x test
}
compile
cd .. > /dev/null
gumtree=gumtree-$(date '+%Y%m%d')-2.1.0-SNAPSHOT
gumtree=gumtree-20170806-2.1.0-SNAPSHOT
if [ ! -d $gumtree/lib/ ]; then
gradle build -x checkstyleMain -x test
unzip dist/build/distributions/$gumtree.zip
fi
cp core/build/libs/core-2.1.0-SNAPSHOT.jar $gumtree/lib/
fast Hello1.java Hello1.pb
fast Hello2.java Hello2.pb
$gumtree/bin/gumtree diff Hello1.pb Hello2.pb
#$gumtree/bin/gumtree webdiff Hello1.pb Hello2.pb
cd - > /dev/null
17 changes: 14 additions & 3 deletions core/src/main/java/com/github/gumtreediff/gen/Registry.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,26 @@ public class Priority {

public C get(K key, Object... args) {
Factory<? extends C> factory = getFactory(key);
if (factory != null)
return factory.instantiate(args);
if (factory != null) {
C c = factory.instantiate(args);
if (c == null) {
System.err.println("can't instantiate for key = " + key);
System.err.println("can't instantiate for factory = " + factory.getClass().getName());
System.err.println("can't instantiate for n args = " + args.length);
for (int i = 0; i < args.length; i++) {
System.err.println("can't instantiate for arg " + i + " = " + args[i].getClass().getName());
}
}
return c;
}
return null;
}

public Factory<? extends C> getFactory(K key) {
Entry entry = find(key);
if (entry != null)
if (entry != null) {
return entry.factory;
}
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public abstract class TreeGenerator {

public TreeContext generateFromReader(Reader r) throws IOException {
TreeContext ctx = generate(r);
ctx.validate();
ctx.validate();
return ctx;
}

Expand Down
Loading