Maintain the Litium Accelerator solution

This guide will help you to manage your Litium solution with easy upgrade of the Litium Accelerator to the latest version even if you started to modify the code in your solution.

Source control system to your rescue

Maintain the source files of your Litium project can be hard and we recommend that you use a source control system. The most adapted source control system today is Git, and you have several services that you can use if you do not want to install and maintain the source control system inside your organization. GitHub, Azure DevOps, Bitbucket and Gitlab are all online services that provide the source control possibility. Without any source control system, you are out on deep water and will have trouble to maintain the source of the Litium solution.

This guide is written in a general purpose and using the Git terminology, but the concept should work with any source control system.

Solution maintenance

To maintain the Litium Accelerator solution with the source control, and making it easy to update to a later version is done with a branching strategy. When using a branching strategy, you get a solution where it is easy to apply the changes made between the Litium Accelerator versions. In this guide the branch name main is used as the default branch that all developers are working towards.

  • Create your source control repository and name the branch as main.

From the main branch you should do a new branch. Doing this branch as early as possibly from the main branch will make it easier for applying new versions of Litium Accelerator.

  • Create and switch to a new accelerator-vanilla branch.
    git checkout -b accelerator-vanilla
    

The accelerator-vanilla branch will be the truth of Litium Accelerator and this branch should only contain the changes that are from the Litium provided package for Litium Accelerator.

  • Add the Litium Accelerator source into the branch.
  • Commit with a message “Accelerator X.Y.Z”.
    git add -A
    git commit -m “Accelerator X.Y.Z”
    

Note: If other changes are done in this branch, the later update steps will not work.

  • Switch back to your main branch and merge the changes from the accelerator-vanilla branch.
    git checkout main
    git merge accelerator-vanilla
    

Now the main branch is ready for your project changes.

Upgrade Litium Accelerator

When a new version of the Litium Accelerator has been released it is time for the solution to get the changes in the Litium Accelerator package.

  • Switch branch to your accelerator-vanilla branch
    git checkout accelerator-vanilla
    

Now the solution is reverted to how everything was from the beginning.

  • Delete all files that were added by the Litium Accelerator package. If this branch was created with a nearly empty version of files, it is easy to clear files out from directory.
  • Add all files from the new Litium Accelerator package.
    git add -A
    
  • Commit with a message “Accelerator X.Z.Z”.
    git commit -m “Accelerator X.Z.Z”
    

The commit that is created contains the difference between Litium Accelerator X.Y.Z and X.Z.Z.

  • Switch back to main branch.
    git checkout main
    
  • Create and switch to a new branch merge-accelerator-x-z-z.
    git checkout -b merge-accelerator-x-z-z
    

The source control system is now ready to apply the changes that have been made between the Litium Accelerator versions. Let's do the merge of Litium Accelerator changes into the current version of the solution.

  • Merge the accelerator-vanilla branch into the current merge-accelerator-x-z-z branch.
    git merge accelerator-vanilla
    

The merge of the Litium Accelerator changes can end in two different situations and we prefer the second, but it is common that it ends up in the first also.

  1. Merge conflict.
    • Resolve merge conflicts.
    • Make a merge commit “Merge Accelerator X.Z.Z”.
      git commit -m “Merge Accelerator X.Z.Z”
      
  2. Everything can be merged automatically, and a new merge-commit will be created.

If changes have been made in the same rows of code in both the Litium Accelerator default version and in the project solution, the merge can’t successfully complete, and a conflict is created. In this case you need to solve the merge conflicts manually and due to the nature of source control system you only need to solve the changes that have happen in the solution after the initial accelerator version and the upgraded accelerator version. If the changes are in the accelerator and the solution have not changed the same lines the source control system will manage to merge the changes automatic.

Ensure that the merge-accelerator-x-z-z branch is building and working as expected before merging branch back to main to avoid that solution is broken and can’t be delivered to the test and production environment.

  • Switch branch to main and merge the merge-accelerator-x-z-z
    git checkout main
    git merge merge-accelerator-x-z-z