First of all, we would like to thank you for your time and efforts on this project, we appreciate it
You can see tutorials online on how to contribute to any open-source project, it's a simple process, and you can do it even if you are not Git expert, simply start by forking the repository, cloning it, creating a new branch, make your changes and commit them, then push the branch to your fork, and you will get a link to send a PR to the upstream repository
If you don't have anything specific in mind to improve or fix, you can take a look at
the issues or take a look at
the todos of the project, they all start with TODO:
so you can search in your IDE or use the todos tab of the IDE
Important
We highly recommend contacting us if you're planning to make big changes.
Make sure you installed the following:
-
JDK (Java Development Kit) 11 you can use your favorite distro, we suggest Adoptium or Amazon Corretto.
Adding Java to your system path would be useful to run Gradle tasks directly in the command line.
The IDE needs to be configured to use JDK 11 for this project
-
Your favorite IDE, we suggest IntelliJ IDEA Community Edition you can get it directly from the installer or by Jetbrains Toolbox
-
KtLint Intellij IDEA Plugin (optional) which is an anti-bike-shedding linter/formatter for Kotlin code based on the Kotlin Coding Conventions, Kotlin Style guide, and other best practices.
Make sure you have the Development Prerequisites installed and configured correctly
To set up your IDE for this project, so you can test the changes:
- Run
./gradlew build
or the build task for the first time - To run the script:
IntelliJ IDEA Community Edition
Use one of the shared run configurations of IntelliJ IDEA in `.idea` which will be available in:Or if you want to add custom run configurations
- Edit the Run/Debug configurations of IntelliJ IDEA, click on the add plus
- Choose the JAR Application, name it, and choose the JAR file path which is usually located under
the dist,
also, change the working directory to a directory other than the current or somewhere that is in
.gitignore
like liketestScript
- In before launch add two Gradle tasks, first
clean
and thenshadowJar
(in order) or onlyshadowJar
. You can create multiple tasks depending on the use-case - You can now use the new run configuration. You can also create and test other configurations for the GUI and non-GUI modes.
Others
If you're not using any of the supported IDEs, text editor or something like vim
and you want to test the changes,
and you want to test the code changes, you can use the following Gradle tasks:
./gradlew build
to build the project, running checks, lints, tests and build JAR files./gradlew run
to run the application./gradlew shadowJar
to build the uber JAR file./gradlew runJar
to run the application using the uber JAR file in GUI mode./gradlew runJarCli
to run the application using the uber JAR file in non-GUI mode./gradlew minimizedJar
to build the minimized JAR file../gradlew runMinimizedJar
to run the application using the minimized JAR file in GUI mode./gradlew runMinimizedJarCli
to run the application using the minimized JAR file in non-GUI mode./gradlew obfuscatedJar
to build the obfuscated JAR file../gradlew runObfuscatedJar
to run the application using the obfuscated JAR file in GUI mode./gradlew runObfuscatedJarCli
to run the application using the obfuscated JAR file in non-GUI mode
If you need to change the working directory for the script, for example, when testing a feature that is specific to a launcher, then you will need to manually create a run configuration like we discussed above
Tip
The sync script might ask you the url for the sync info where it will send the GET request.
Consider uploading the file on your local machine on localhost
server
to speed up the development and lower the resource cost.
The same applies for the mods, resource-packs, etc...
Use dev-local-server module.
Note
If you're on Microsoft Windows, replace gradlew
with gradlew.bat
.
-
Code Style and Formatting:
Adhere to the Kotlin Coding Conventions (https://kotlinlang.org/docs/coding-conventions.html). Use consistent naming conventions for variables, functions, classes, etc. Follow a consistent code formatting style throughout the project.
We use KtLint by using KtLint Gradle to make the process easier.
-
Documentation:
Document public APIs using KotlinDoc comments. Provide comprehensive documentation for any complex algorithms, data structures, or significant functionality. Write clear and concise commit messages and pull request descriptions.
-
Performance:
Write efficient code and avoid unnecessary overhead. Profile the application for performance bottlenecks and optimize critical sections if needed.
-
Bundle size:
Try to make the JAR file size as less as possible and as much as needed
-
Code Review:
Encourage code reviews for all changes to maintain code quality and catch potential issues early. Use pull requests and code reviews to discuss proposed changes and improvements.
-
Versioning and Releases:
The project uses standard practices for versioning and releases:
- Versioning: Semantic Versioning which use
MAJOR.MINOR.PATCH
format to indicate changes. - Commit messages: Conventional Commits for clear and consistent commit messages.
- Pull Request Titles: PR title using conventional commits style for clarity and consistency.
- Changelog: Keep a Changelog to document release notes and changes.
Clearly document release notes and changes for each version.
We might introduce breaking changes even in non-major versions. We plan to avoid doing this someday.
- Versioning: Semantic Versioning which use
-
Consistency:
Adhere to a consistent coding style throughout the project to improve readability and maintainability
-
Meaningful Names:
Use descriptive variable, class, and function names that clearly convey their purpose.
-
Testing:
This project does not prioritize testing rigorously, typically featuring unit tests.
- If you add a new dependency, update existing one, add assets in the resources or do anything that increase or decrease
the size of the bundle, make sure to update the badges in
README.md
(at the start) to update the size - The changes of
CHANGELOG.md
and the version will usually be automated. - The version of the libraries and the tools are usually in gradle/libs.versions.toml,
except some tools like Gradle wrapper which is in
gradle/wrapper/gradle-wrapper.properties and can be updated using
./gradlew wrapper --gradle-version=<new-version-here>
- Run the following command:
./gradlew ktCheck
or./gradlew build
which will usually runktlint
tasks. If possible, try to resolve any warnings that appear. This helps ensure that the codebase stays clean and consistent - When doing any code changes, use the Kotlin Run configuration to test them, if possible, also try to run the JAR
using the run configurations that are provided as in
.idea
and as a Gradle task to make it work with other IDEs and text editor, as a bonus, you could also test the minimized JAR and modify the Proguard rules and configurations if necessary. - Usually when we add a new fields or modify existing ones in the data classes, like, for example, adding
description
field in theMod
data class, we will try to update the Admin module too to convert the new data from other launchers to make the process easier for administrations - The project generate
BuildConfig
object using a Gradle task once you start the application or building it, you might getUnresolved reference: BuildConfig
which can be solved by either start the application or building it.
-
If you work on different modules,
// module1/Utils.kt fun onePlusOne() = 1 + 1
// module2/Utils.kt fun onePlusTwo() = 1 + 2
Assuming
module1
depends onmodule2
and use classes and functions frommodule2
Then this would cause runtime exception:Exception in thread "main" java.lang.NoSuchMethodError
When calling
onePlusTwo()
frommodule2
inmodule1
this is not necessarily a bug, and it's related to how Java 9 modules work; the Kotlin compiler won't give you compile error instead it will cause runtime errorjava.lang.NoSuchMethodError
, a workaround would be to double-check to use different package or file name, for more details.The issue will be caused once running the application, which is a good thing to catch the error earlier rather than having it affecting some functionalities.