Skip to content

An extension tool for GumTree to detect moves across files

Notifications You must be signed in to change notification settings

kusumotolab/Graftast

Repository files navigation

EN JP

Graftast

Graftast is an extension tool of GumTree. Comparing targets are expanded from single file to multiple files.


Installation

Download Binary

You can download zip here.

Build with Gradle

Clone this project.

$ git clone [email protected]:kusumotolab/Graftast.git

Create gradle.properties in project root with the following contents.

GITHUB_USER = XXXXXX
GUTHUB_TOKEN = YYYYYY

Add GitHub authentication in gradle.properties because GumTree is published in Github Package. If you want to know detail about GitHub authentication, see this page.

Next, execute the following command.

$ cd Graftast
$ ./gradlew build

A Zip file will be generated under build/distributions.


Usage

Unzip downloaded or builded file, and execute a file in bin folder.

Graftast (diff|webdiff) dir1 dir2 fileType
  • Calculate differencing of files which are containeddir1,dir2directory, and whose extetnsion matches fileType.
  • Example of fileType: .java, .c, .py

Options

  • diff: Output differencing in a textual format.
  • webdiff:Display differencing visually with web browser. But, this webdiff is not supported MergelyView that is implemented in original GumTree.

API Usage

You can use a part of Graftast directly from the Java code. JDK11 is necessary.

Construction of project AST

Run.initGenerators();
String srcDir = "";
String dstDir = "";
Pair<Tree, Tree> projectTrees = new ProjectTreeGenerator(srcDir, dstDir, ".java");
Tree srcTree = projectTrees.first;
Tree dstTree = projectTrees.second;

Getting mappings

GraftastMain graftastMain = new GraftastMain();
String srcDir = "";
String dstDir = "";
Pair<Tree, Tree> projectTrees = new ProjectTreeGenerator(srcDir, dstDir, ".java");
MappingStore mappingStore = graftastMain.getMappings(projectTrees);

or

Run.initGenerators();
String srcDir = "";
String dstDir = "";
Pair<Tree, Tree> projectTrees = new ProjectTreeGenerator(srcDir, dstDir, ".java");
Tree srcTree = projectTrees.first;
Tree dstTree = projectTrees.second;
MappingStore mappingStore = new ProjectMatcher().match(srcTree, dstTree);

Calculating difference

GraftastMain graftastMain = new GraftastMain();
String srcDir = "";
String dstDir = "";
Pair<Tree, Tree> projectTrees = new ProjectTreeGenerator(srcDir, dstDir, ".java");
EditScript editScript = graftastMain.calcurateEditScript(projectTrees);

or

Run.initGenerators();
String srcDir = "";
String dstDir = "";
Pair<ITree, ITree> projectTrees = new ProjectTreeGenerator(srcDir, dstDir, ".java");
Tree srcTree = projectTrees.first;
Tree dstTree = projectTrees.second;
MappingStore mappingStore = new ProjectMatcher().match(srcTree, dstTree);
EditScriptGenerator editScriptGenerator = new ChawatheScriptGenerator();
EditScript editScript = editScriptGenerator.computeActions(mappingStore);

About

An extension tool for GumTree to detect moves across files

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published