|
| 1 | +--- |
| 2 | +title: "Simulator Version Control: Phase 1 (GSoC 2024)" |
| 3 | +date: 2024-07-11T16:43:15+05:30 |
| 4 | +draft: false |
| 5 | +author: Aryann Dwivedi |
| 6 | +type: post |
| 7 | +--- |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | +This report consolidates the progress made during the first phase of Google Summer of Code 2024 coding period for the Simulator Version Control project with [CircuitVerse](https://github.com/circuitverse). |
| 14 | + |
| 15 | +### About my Project |
| 16 | + |
| 17 | +[My Project](https://github.com/CircuitVerse/CircuitVerse/wiki/GSoC'24-Project-List#project-5---simulator-version-control) aims to implement a version control system for the CircuitVerse Vue simulator to maintain compatibility of circuits while allowing for independent simulator updates and version switching. |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | +### Community Bonding Period @Circuitverse |
| 22 | + |
| 23 | +We had our first meeting with all the mentors and contributors, and it was a pleasure to meet everyone. The meeting was very productive, allowing us to learn more about CircuitVerse's culture and its mission to provide free digital logic circuit simulators to over half a million people. These exchanges promoted understanding and laid the groundwork for effective teamwork through shared experiences and technological discussions. |
| 24 | + |
| 25 | +### Milestones Achieved |
| 26 | + |
| 27 | +Tasks Completed So Far: |
| 28 | + |
| 29 | +- Versioning directories |
| 30 | +- Modifying the build script |
| 31 | +- Adding a version column to the projects schema. |
| 32 | +- Creating a bash script to build different versions for Vite |
| 33 | +- Implementing hot-swapping of the Vue simulator from the main CircuitVerse repository by taking query parameter (simver). |
| 34 | + |
| 35 | + |
| 36 | +#### Versioning Directory |
| 37 | + |
| 38 | +The foundational task for the simulator versioning was to create separate directories for different versions of Vue simulator. I moved the src directory of the vue simulator to different versions (v0 and v1) and adjusted the required imports in the files. |
| 39 | + |
| 40 | +**Vue Simulator Architecture** |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | +**Pull Requests** |
| 47 | + |
| 48 | +- [Adding Versioned Directory (v0 and v1)](https://github.com/CircuitVerse/cv-frontend-vue/pull/319) |
| 49 | + |
| 50 | +#### Modifying the Build script |
| 51 | + |
| 52 | +With the directories restructured for different simulator versions, the build configurations needed to be changed to serve the correct version when required. |
| 53 | + |
| 54 | +- A `version.json` file was created to store the description, date, and name of each version. |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | +- The build script in the Vue simulator was modified to build different versions based on the version variable, iterating through the version.json file. |
| 59 | + |
| 60 | +- Separate files were created for the two versions and built using a bash script. |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | +- The script was updated to save builds in separate directories for each version as `public/simulatorvue/v0` and `public/simulatorvue/v1` in the Main CircuitVerse repository. |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | +**Pull Request** |
| 69 | + |
| 70 | +- [Build Script Modification](https://github.com/CircuitVerse/cv-frontend-vue/pull/327) |
| 71 | + |
| 72 | +#### Adding a version column to the projects schema. |
| 73 | + |
| 74 | +To store the version of the circuit in the database, a new column named `version` was added. |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | +**Pull Request** |
| 79 | + |
| 80 | +- [Adding version column to Projects table](https://github.com/CircuitVerse/CircuitVerse/pull/4999) |
| 81 | + |
| 82 | +#### Hot-Swapping Implementation |
| 83 | + |
| 84 | +To swap versions of the simulator, I used a query parameter (simver) in the URL to serve the appropriate version. If `simver=v0`, version v0 is served; if `simver=v1`, version v1 is served. |
| 85 | + |
| 86 | +- The path of the entry point in index.html was changed from `src/main.ts` to `version/main.ts` to modify the serving file accordingly. |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | +- The logic to change the simulator version variable based on the version was added to another file and imported into version/main.ts. |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | + |
| 95 | +- The correct version was imported according to the specified `simver` variable. |
| 96 | + |
| 97 | + |
| 98 | + |
| 99 | + |
| 100 | + |
| 101 | +**Pull Request** |
| 102 | + |
| 103 | +- [Enable Main simulator to load Vue simulator](https://github.com/CircuitVerse/cv-frontend-vue/pull/332) |
| 104 | + |
| 105 | +#### FINAL RESULT |
| 106 | + |
| 107 | +In this video, the version is specified on the navbar soleley for representation purposes. It is not included in the actual project or code. |
| 108 | + |
| 109 | +{{< video src="/images/Aryann_Dwivedi_GSoC24/version-hostswapping.webm" type="video/webm" preload="auto" >}} |
| 110 | + |
| 111 | + |
| 112 | + |
| 113 | +### Learnings |
| 114 | + |
| 115 | +- Gained an understanding of how the Vue simulator works, particularly the query parameters and imports. |
| 116 | +- Learned more about version control systems. |
| 117 | +- Acquired knowledge of best practices to follow while writing code. |
| 118 | + |
| 119 | +### Conclusion |
| 120 | + |
| 121 | +Phase 1 of GSoC 2024 at CircuitVerse focused on implementing a simulator version control system, enhancing technical skills in Vue.js and scripting, and reinforcing best coding practices. |
| 122 | + |
0 commit comments