46 Development workflow
MagicBot edited this page 3 years ago

This guide assumes completion of Project Setup and a running MagicBox.

You have identified a bug and it's fix. What if minos could fly? You found something not following 24.3 rules. Perhaps you want to try and morph your MagicBox into a League of Legends clone.

This document will describe the workflow involved in turning your ideas into reality; intended either for the Magicbane production server or on your personal Magicbox. With Magicbane technology effecting change has never been easier.

Branch or Fork?

A branch should be made for a small group of related changes.

One Bug == One Branch.
One Feature == One Branch.

A fork is a complete copy of the codebase. If your desire is to morph Magicbane into a LOL clone it would require dozens of separate branches. Fork the repo when you want to perform major surgery.

Fork == Major changes consisting of many branches.

A new branch

For the purpose of this tutorial let us create a new branch.

In the lower right hand corner of the IDE will be displayed the current branch that is checked out from the repository. The branch master reflects the current codebase running in production. All new branches should be sourced from origin/master.

currentbranch

Click on the branch name and checkout origin/master from the repository.

CheckoutMAWE

Pull any changes from the repository not in your local copy.

PullMaster changesseen

With master updated you can now create a new branch to make your changes into.

newBranch

Give an approriate name for your branch. bugfix-xyz or feature-xyz won't work so we will chose a name that fits.

BranchCreate

The IDE will notify you of the branch being created and checked out.

checkedout

This new branch exists only on your local machine at this time. Only once you commit and push to the repo will the branch be available to compile on MagicBox.

Inside the IDE we will now perform the time honored developer test; displaying a debug message in the console on bootstrap. Notice the color of the filename has changed to cyan. This indicates modification.

CodeEdited

Make sure your changes actually compile. (Good form!)

buildtime
compiledok

Time to commit your changes to the repo. The IDE will allow you to inspect the changes.
Select commit and push.

Always supply a descriptive commit message. (Good form!)

commitrepo
commitfiles
pushconfirm

Now that your branch is on the repository it is available for MagicBox to compile and run.

docker exec -it magicbox /bin/bash
magicbox~/magicbane$./mbbuild.sh test-workflowguide

Fetching origin
remote: Enumerating objects: 13, done.
remote: Counting objects: 100% (13/13), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 7 (delta 3), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (7/7), 687 bytes | 171.00 KiB/s, done.
From 63.141.251.154:MagicBane/Server
 * [new branch]      test-workflowguide -> origin/test-workflowguide
Branch 'test-workflowguide' set up to track remote branch 'test-workflowguide' from 'origin'.
Switched to a new branch 'test-workflowguide'
Already up to date.
Buildfile: /home/mbbox/magicbane/build/build.xml

clean:
   [delete] Deleting directory /home/mbbox/magicbane/build/bin
    [mkdir] Created dir: /home/mbbox/magicbane/build/bin

compile:
    [javac] Compiling 835 source files to /home/mbbox/magicbane/build/classes
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.

createjar:
      [jar] Building jar: /home/mbbox/magicbane/build/bin/magicbane.jar

BUILD SUCCESSFUL
Total time: 11 seconds

Now let us validate the code changes by looking for our debug message in the login_console.

magicbox~/magicbane$./mbrestart.sh
nano console_login

INFO 2022-05-02 06:33:58.926 [main] engine.gameManager.ConfigManager.init(99) : MB_MAGICBOT_BOTVERSION:0.47Alpha
INFO 2022-05-02 06:33:58.926 [main] engine.gameManager.ConfigManager.init(99) : MB_MAGICBOT_GAMEVERSION:0.62Beta
ERROR 2022-05-02 06:33:58.926 [main] engine.server.login.LoginServer.main(92) : Development workflow guide testings
INFO 2022-05-02 06:33:58.927 [main] engine.server.login.LoginServer.init(177) : Initializing Database Pool
[main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
[main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed.

Next Steps

Explore how to have your fixes and features included in the Magicbane production codebase.

Submitting Pull Requests

Learn how to connect your IDE deugger to a running MagicBox.

Debugging with MagicBox