EN JP
Graftast is an extension tool of GumTree. Comparing targets are expanded from single file to multiple files.
You can download zip here.
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
.
Unzip downloaded or builded file, and execute a file in bin folder.
Graftast (diff|webdiff) dir1 dir2 fileType
- Calculate differencing of files which are contained
dir1
,dir2
directory, and whose extetnsion matchesfileType
. - Example of
fileType
:.java
,.c
,.py
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.
You can use a part of Graftast directly from the Java code. JDK11 is necessary.
Run.initGenerators();
String srcDir = "";
String dstDir = "";
Pair<Tree, Tree> projectTrees = new ProjectTreeGenerator(srcDir, dstDir, ".java");
Tree srcTree = projectTrees.first;
Tree dstTree = projectTrees.second;
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);
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);