MigrationMapper is an open-source tool that provides the developer with an easy-to-use and comprehensive way of extracting, from a given list of input projects, existing method mapping between two third-party libraries using program analysis based on Abstract Syntax Tree (AST) code representation. In a nutshell, MigrationMiner (i) detects, (ii) extracts, (iii) filters, and (iv) collects code changes related to any performed migration, and (v) generates mappings between APIs of two libraries. A demo video of MigrationMapper is available on [Youtube](https://www.youtube.com/watch?v=D-01g2GjuTg)
@inproceedings{alrubaye2019use, title={On the use of information retrieval to automate the detection of third-party java library migration at the method level}, author={Alrubaye, Hussein and Mkaouer, Mohamed Wiem and Ouni, Ali}, booktitle={2019 IEEE/ACM 27th International Conference on Program Comprehension (ICPC)}, pages={347--357}, year={2019}, organization={IEEE} }
mysql -u root -p
source ./MigrationMapperDBSQL.sql
After running the commands, the database should be created with all tables and views.
% pip3 install Django
% pip3 install jellyfish
% pip3 install --user -U nltk
% pip3 install numpy
% pip3 install pandas
% pip3 install sklearn
% python3
>>> import nltk
>>> nltk.download('punkt')
>>> nltk.download('stopwords')
>>> nltk.download('wordnet')
% python3 manage.py runserver
--|
|- MigrationMapper.jar
|- data
|- gitRepositories.csv
|- config.json
% java -jar MigrationMapper.jar
After running Main.java, the database Tables will be filled with any migration infomation found. For each potential migration, the following information can be found in database, whose schema is as follows:
There will be a generated HTML file named "MigrationMapperOutput.html" that has the summary of all migrations detected, and for each migration, all its corresponding method mapping along with their Library documentation. An illutrative example of this file is in the following picture:
After running Main.java, You could read the output as objects by writing the following code. or run TestClient.java. That could help you to integrate the tool with your code.
//Return list of migrations between two pairs of libraries( added/removed)
LinkedList<MigrationRule> migrationRules= new MigrationRuleDB().getMigrationRulesWithoutVersion(1);
for (MigrationRule migrationRule : migrationRules) {
System.out.println("== Migration Rule "+ migrationRule.FromLibrary +
" <==> "+ migrationRule.ToLibrary +"==");
/*
* For every migrations, retrieve list of detected Method mapping
* Between Two APIs
*/
ArrayList<Segment> segmentList = new MigrationMappingDB().getFunctionMapping(String.valueOf(migrationRule.ID), false, false);
for (Segment segment : segmentList) {
segment.print();
// Print all removed method signatures With Docs
printMethodWithDocs( migrationRule.FromLibrary,segment.removedCode);
// Print all added method signatures With Docs
printMethodWithDocs( migrationRule.ToLibrary,segment.addedCode);
} // End fragment for every migration
} // End library migration
/*
* This method takes list of methods signatures with library that methods belong to.
* It will print the signatures and Docs for every method
*/
void printMethodWithDocs(String libraryName,ArrayList<String> listOfMethods ) {
// For every add method print the Docs
for(String methodSignature: listOfMethods){
// Convert method signatures as String to Object
MethodObj methodFormObj= MethodObj.GenerateSignature(methodSignature);
//retrieve Docs from the library for method has that name
ArrayList<MethodDocs> toLibrary = new LibraryDocumentationDB()
.getDocs( libraryName,methodFormObj.methodName);
//Map method signatures to docs
MethodDocs methodFromDocs = MethodDocs.GetObjDocs(toLibrary, methodFormObj);
if(methodFromDocs.methodObj== null) {
System.err.println("Cannot find Docs for: "+ methodSignature);
continue;
}
methodFromDocs.print();
}
}
This software is licensed under the MIT license.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。