Difference between revisions of "BKCommonLib/ForDevelopers"

From BergerHealer Wiki
Jump to navigation Jump to search
m (1 revision imported)
m (Update outdated links, add additional links to section BKCommonLib project structure)
Line 5: Line 5:
  
 
==BKCommonLib project structure==
 
==BKCommonLib project structure==
BKCommonLib is a maven project - you need to support it to contribute to it. If you are using the Eclipse IDE, you can install [https://dev.bukkit.org/linkout?remoteUrl=http%253a%252f%252feclipse.org%252fm2e%252fdownload%252f m2e] so you can properly import maven projects. To install this software, go to the marketplace in the Eclipse GUI and install it from there. See also: [https://dev.bukkit.org/linkout?remoteUrl=http%253a%252f%252fmarketplace.eclipse.org%252fmarketplace-client-intro%253fmpc_install%253d252 installation instructions].
+
BKCommonLib is a maven project - you need to support it to contribute to it. If you are using the Eclipse IDE, you can install [https://projects.eclipse.org/projects/technology.m2e m2eclipse] so you can properly import maven projects. To install this software, go to the marketplace in the Eclipse GUI and install it from there. See also: [https://marketplace.eclipse.org/marketplace-client-intro installation instructions].
  
 
Upon first looking over all packages and classes it may seem overwhelming - and it is. BKCommonLib is extremely large, but it has a fixed structure.
 
Upon first looking over all packages and classes it may seem overwhelming - and it is. BKCommonLib is extremely large, but it has a fixed structure.
Line 12: Line 12:
 
* Reflection: here is where we put all fields and methods contained within CraftBukkit so others can access it safely
 
* Reflection: here is where we put all fields and methods contained within CraftBukkit so others can access it safely
 
* Proxies and Bases: here we store all base classes that can be extended or worked with. Includes math utility classes such as vectors
 
* Proxies and Bases: here we store all base classes that can be extended or worked with. Includes math utility classes such as vectors
* Conversion: here are all [http://dev.bukkit.org/bukkit-plugins/bkcommonlib/pages/services/conversion/ converters] meant for converting one datatype to the other
+
* [[BKCommonLib/Conversion|Conversion]]: here are all convertors meant for converting one datatype to the other
 
* Collections: here we store all special type of collections, such as those that convert one type to the other dynamically
 
* Collections: here we store all special type of collections, such as those that convert one type to the other dynamically
* Entity and Controller: all Entity-related utility classes which add new functionality, of which controllers
+
* [[BKCommonLib/CommonEntity|Entity]] and [[BKCommonLib/Controller|Controller]]: all Entity-related utility classes which add new functionality, of which controllers
* Events: Some events plugins can use, fired by BKCommonLib. See also: internal.
+
* [[BKCommonLib/EventsAndListeners|Events]]: Some events plugins can use, fired by BKCommonLib. See also: internal.
* Localization and Permissions: speaks for itself, base classes for name given
+
* [[BKCommonLib/Localization|Localization]] and [[BKCommonLib/PermissionDefaults|Permissions]]: speaks for itself, base classes for name given
* Config and NBT: speaks for itself, helper classes for dealing with configuration/file data storage/NBT tags
+
* [[BKCommonLib/ConfigurationAPI|Config]] and [[BKCommonLib/NBTTagAPI|NBT]]: speaks for itself, helper classes for dealing with configuration/file data storage/NBT tags
* Scoreboards: the Scoreboards API of BKCommonLib
+
* [[BKCommonLib/Scoreboards|Scoreboards]]: the Scoreboards API of BKCommonLib
* Tab: the Tab API of BKCommonLib
+
* [[BKCommonLib/TabView|Tab]]: the Tab API of BKCommonLib
 
* Wrappers: for working with internal classes through a secure and non-reflection ridden layer
 
* Wrappers: for working with internal classes through a secure and non-reflection ridden layer
* Utils: All classes contain static utility methods that can be used for whatever purpose you seek
+
* [[BKCommonLib/General|Utils]]: All classes contain static utility methods that can be used for whatever purpose you seek
 
If you need to fix a bug or want to have a new feature, your first step is looking at which packages are or could be affected. Please don't make new packages for already covered things, it works confusing. If you plan on moving a class around, be sure to keep a (deprecated) redirecting proxy class behind so depending plugins don't stop working all of a sudden.
 
If you need to fix a bug or want to have a new feature, your first step is looking at which packages are or could be affected. Please don't make new packages for already covered things, it works confusing. If you plan on moving a class around, be sure to keep a (deprecated) redirecting proxy class behind so depending plugins don't stop working all of a sudden.
  
Line 41: Line 41:
  
 
* GitHub project path is set and Sourcecode management is set on 'git' and configured fully
 
* GitHub project path is set and Sourcecode management is set on 'git' and configured fully
* Repository URL and GitHub project path is the same (http://github.com/etc/etc)
+
* Repository URL and GitHub project path is the same (<nowiki>http://github.com/etc/etc</nowiki>)
 
* 'Build when changes are sent' checked, nothing else by default
 
* 'Build when changes are sent' checked, nothing else by default
 
* JDK 6 or 7 is selected properly for building the project (usually 6)
 
* JDK 6 or 7 is selected properly for building the project (usually 6)
* Github plugin hook url (http://sitename.something/github-webhook/) is added to service hooks on the GitHub project
+
* Github plugin hook url (<nowiki>http://sitename.something/github-webhook/</nowiki>) is added to service hooks on the GitHub project
 
* Post-build step 'archive artifacts' is set (output: target/*.jar)
 
* Post-build step 'archive artifacts' is set (output: target/*.jar)
 
* Multiple branches? Be sure to specify 'origin/master' if needed!
 
* Multiple branches? Be sure to specify 'origin/master' if needed!
 
Common errors and issues:
 
Common errors and issues:
  
Dependency issues on the server and not locally: delete the .m2/repository/* contents locally and refresh
+
* Dependency issues on the server and not locally: delete the .m2/repository/* contents locally and refresh
Compilation failure: change between different compiler versions until it works
+
* Compilation failure: change between different compiler versions until it works
This is not what I wanted to build!: make sure it isn't building the wrong branch
+
* This is not what I wanted to build!: make sure it isn't building the wrong branch

Revision as of 23:57, 25 September 2023

« Go back

Introduction

This is a page where help is given for new and existing developers of BKCommonLib and everything related to it. If something needs to be redone or fixed, you can find information regarding it here.

BKCommonLib project structure

BKCommonLib is a maven project - you need to support it to contribute to it. If you are using the Eclipse IDE, you can install m2eclipse so you can properly import maven projects. To install this software, go to the marketplace in the Eclipse GUI and install it from there. See also: installation instructions.

Upon first looking over all packages and classes it may seem overwhelming - and it is. BKCommonLib is extremely large, but it has a fixed structure.

  • Internal and server packages: try not to touch these, here is where all our CraftBukkit-specific logic resides
  • Reflection: here is where we put all fields and methods contained within CraftBukkit so others can access it safely
  • Proxies and Bases: here we store all base classes that can be extended or worked with. Includes math utility classes such as vectors
  • Conversion: here are all convertors meant for converting one datatype to the other
  • Collections: here we store all special type of collections, such as those that convert one type to the other dynamically
  • Entity and Controller: all Entity-related utility classes which add new functionality, of which controllers
  • Events: Some events plugins can use, fired by BKCommonLib. See also: internal.
  • Localization and Permissions: speaks for itself, base classes for name given
  • Config and NBT: speaks for itself, helper classes for dealing with configuration/file data storage/NBT tags
  • Scoreboards: the Scoreboards API of BKCommonLib
  • Tab: the Tab API of BKCommonLib
  • Wrappers: for working with internal classes through a secure and non-reflection ridden layer
  • Utils: All classes contain static utility methods that can be used for whatever purpose you seek

If you need to fix a bug or want to have a new feature, your first step is looking at which packages are or could be affected. Please don't make new packages for already covered things, it works confusing. If you plan on moving a class around, be sure to keep a (deprecated) redirecting proxy class behind so depending plugins don't stop working all of a sudden.

BKCommonLib build process

When first starting to work with it, you may notice that there are no package versions in the net.minecraft.server and org.bukkit.craftbukkit imports. The resulting build, however, does. How come? Well, to skip the process of manually updating all versions, we do multiple things:

  • Use reflection where possible so we don't need these imports
  • Use Spinot instead of CraftBukkit/Spigot to build against
  • Use the 'maven-shade-plugin' to turn all imports to the proper versioned imports instead

In addition we have several other dependencies and respective repositories for per-plugin compatibility.

Jenkins build server and GitHub

We use GitHub to host our projects and have our own CI build server to build the GitHub projects on. Here is a checklist to see whether the Jenkins build server is ready to go:

  • GitHub, Git server, Git client and other Git-related plugins are installed and set active (manage/manage plugins)
  • JDK 6u38 and 7 are installed (manage/configure system)
  • Git account information including a valid SSH key is set and hooks are set on manual (manage/configure system)

Per job (configuration):

  • GitHub project path is set and Sourcecode management is set on 'git' and configured fully
  • Repository URL and GitHub project path is the same (http://github.com/etc/etc)
  • 'Build when changes are sent' checked, nothing else by default
  • JDK 6 or 7 is selected properly for building the project (usually 6)
  • Github plugin hook url (http://sitename.something/github-webhook/) is added to service hooks on the GitHub project
  • Post-build step 'archive artifacts' is set (output: target/*.jar)
  • Multiple branches? Be sure to specify 'origin/master' if needed!

Common errors and issues:

  • Dependency issues on the server and not locally: delete the .m2/repository/* contents locally and refresh
  • Compilation failure: change between different compiler versions until it works
  • This is not what I wanted to build!: make sure it isn't building the wrong branch