How to Keep Two Code Bases in Sync

Discuss anything in general about the IceBlink Engine + Toolset project (or anything else) here.

How to Keep Two Code Bases in Sync

Postby slowdive » Sun Jan 14, 2018 7:27 pm

This is a tutorial on how to keep two code bases in sync. Please add any suggestions or other tricks you may come up with.

This is how I have done it in the past and will continue to do for keeping IBbasic PC and Xamarin in sync with each other.

PC code - this is the project code that is used for Windows 7, 8, and 10. It uses WinForms and SharpDX (for graphics).
Xamarin code - this is the project code that is used for building apps for Android, iOS, UWP (win10, Xbox One, Surface Hub, basically any win10 device), and eventually MacOS and Linux. Using Xamarin.Forms and SkiaSharp.

Step 1: After I have made a number of changes to the PC code and have come to a good stop point (aka finished a few features or fixed some bugs), I then push a commit and sync with GitHub.

Step 2: After finished with sync, click on the down arrow next to "Actions" to bring up a context menu then select "view History".
Screenshot 2018-01-14 10.06.40_2.png
Screenshot 2018-01-14 10.06.40_2.png (181.18 KiB) Viewed 168 times

Step 3: In the history tab, select the last commit and double click on it. This will populate the "Team Explorer - Commit Details" with a summary of the classes that were changed in this commit.
Screenshot 2018-01-14 10.06.52_2.png
Screenshot 2018-01-14 10.06.52_2.png (221.7 KiB) Viewed 168 times

Step 4: Work your way through each class that is in the "Commit Details" list one at a time and copy the changes from the PC code base to the Xamarin code base. To see the changes, right click on a class and select "Compare with Previous" from the context menu.
Screenshot 2018-01-14 10.07.13_2.png
Screenshot 2018-01-14 10.07.13_2.png (226.85 KiB) Viewed 166 times

Step 5: This will now bring up the class in the editor with two panels. The one on the left is the previous code and the one on the right is the changed code. There is also a scroll bar on the right that shows green and red for location of changes for easily moving through all the class and making sure not to miss any updated code. Select all the new code chuncks one at a time and copy and paste them into the Xamarin code base.
Screenshot 2018-01-14 10.08.34_2.png
Screenshot 2018-01-14 10.08.34_2.png (191.87 KiB) Viewed 166 times

EDIT: Somethings to keep in mind:
There are differences in the way SharpDX and SkiaSharp handle Bitmaps so be aware that some code may need to be changed when copied over such as below example:
SharpDx (directX graphics wrapper used in PC version of IB):
int width3 ="ui_bg_fullscreen_3d.png").PixelSize.Width;
int height3 ="ui_bg_fullscreen_3d.png").PixelSize.Height;
SkiaSharp (cross-platform graphics wrapper used in Xamarin.Forms version of IB):
int width3 ="ui_bg_fullscreen_3d.png").Width;
int height3 ="ui_bg_fullscreen_3d.png").Height;

I use this process to make sure I copy all the new code changes from one code base into the other. It is an easy way to make sure that I do not miss any of the changes. Super easy :lol:
User avatar
Site Admin
Site Admin
Posts: 2826
Joined: Wed Nov 21, 2012 11:58 pm

Re: How to Keep Two Code Bases in Sync

Postby youngneil1 » Sun Jan 14, 2018 7:56 pm

This will come very handy later on - your explanations are very clear and good to follow. Many thanks for sharing :) .
User avatar
Posts: 4358
Joined: Sat Dec 08, 2012 7:51 am

Return to General IceBlink Project Discussions

Who is online

Users browsing this forum: Bing [Bot] and 1 guest