Google Summer of Code 2020 Work Product Submission
This is the summary of my GSoC Project - "Move Gallery Code to use ZIP Files" with LibreOffice.
Table of Contents
- Phase 1 - Unit Testing
- Phase 2 - Code Refactoring
- Phase 3 - Implement XML ZIP Engine
Hi, I'm Aditya Sahu and I have been working towards the project for 3 months under the mentorship of Tomaž Vajngerl and Michael Meeks. The objective of the project was to get rid of the custom old binary file formats that LibreOffice used to store its gallery themes. These binary files were not human friendly and it was difficult to read what's inside of them by a user. As a replacement, use ZIP Files to store the theme as a whole and inside it, use XML file to store the contents of the metadata of the theme. This will make the gallery storage system user friendly as XML and ZIP files can be easily accessed by the user.
First phase was to write unit tests of the gallery functions. This constitutes of the whole process starting from creation of gallery theme to renaming of the theme to deleting the theme. I started working on it in the middle of community bonding period itself to get a head start on my project. The month of may and the first week of June was spent completing this phase.
I wrote 10 unit tests for gallery module contributing ~500 lines of code in the first phase of the project. Previously, there were no tests available for the same. Now each time Jenkins will run the build, it will test if there is any inconsistency or any failed tests, which reduced risk of failure and improved quality of code.
The second phase was to refactor the gallery code. Previously, the classes on the backend were dealing with the main gallery code as well as the reading and writing part. The objective of this part was to separate the classes dealing with reading/writing part from the ones dealing with the actual back-end code. This would allow us to separate out the code dealing with binary files, and in future we can simply generate an alternate version of this code dealing with XML-ZIP files.
Changed the gallery structure by introducing new classes and putting the reading/writing part of the code there.
Final phase of the project is to implement the XML ZIP Engine. This is the part where the ZIP File is created and inside it, contents are added to it. The contents are mimetype, xml file and binary files (images, audio).
Created a class for XML Engine and taught the engine how to read from a ZIP file, write to a ZIP file, insert XML file inside the ZIP file, read XML file and write mimetype of the ZIP file.
But there are some major things left from the phase, that are yet to be done. Firstly, I have to add a switch to Gallery class that would determine if the type is Binary or XML ZIP file. Then, implement alternate some functions of Gallery Binary Engine into Gallery XML Engine. After this is done, if we turn on the XML ZIP switch, we can use the project easily. I will do this bit post GSoC.
It has really been a great summer for me, full of learning things and contributing to open source community has been a real pleasure for me. During the period of three months, I have improved the code structure of the gallery module in LibreOffice software. I have written unit tests which will always be helpful to other LO developers in future.
I am very grateful to my mentor Tomaž Vajngerl, who supported me throughout the entire journey of GSoC and never left me stranded. It is because of him I have come this close to finishing the project. I will finish up the project keep contributing to open source community even after GSoC ends.
Links to my blog posts about the project