- Before submitting a bug report, verify that it is not caused by the libGDX framework itself.
- Feel free to create issues or start discussions with feature requests and questions about the libraries. Issues and discussions are among the fastest way to contact the developers.
- The latest changes are always in the
developbranch.masterbranch always matches the latest stable release. Make sure to checkoutdevelopbranch before starting your work and setdevelopas the target branch before creating a pull request. - Include issue or pull request IDs in related commit messages. This makes it easier to locate more information about the changes. For example:
Kotlin version update. #250
- Format your code changes with the
gradle formattask. We are relying on automatic formatting performed with ktlint. Rungradle linterIdeSetupto apply formatter changes to your IntelliJ project. - Follow our file naming convention:
- Files with a single class: file name should match class name. E.g.
FileLoader.kt. - Others: files with extension methods, top-level functions, utilities or multiple classes should use camel case
nouns starting with a lower-cased letter. Should generally be in plural form. E.g.
fileLoaders.kt.
- Files with a single class: file name should match class name. E.g.
- Make sure to include unit tests of your code. Test names should use the
`backtick method name`syntax. JUnit and Spek can be used to write tests, although JUnit is encouraged for its commonness. Use Mockito-Kotlin for mocking. - In case of a larger pull request, make sure to link it to an existing issue or create a corresponding issue first. Major API changes or new modules should be discussed with the maintainers. Skipping the issue will not get your pull request rejected outright, but note that major changes without approval might require a rewrite.
- All notable changes should be added to the changelog with an appropriate label:
- [FEATURE] - a new functionality.
- [CHANGE] - an API breaking change.
- [UPDATE] - an update of one of the major dependencies.
- [FIX] - a bug fix.
- [MISC] - other changes (e.g. related to documentation or the project itself).
- Most libraries list all features in the
README.mdfiles to ease their usage. When adding a new feature, please check theREADME.mdfile of the module, and add description of your change when appropriate. Any major feature should include a usage example in the module guide. Make sure to add all the necessary imports in the usage examples inREADME.mdfiles to make it easier to try them out.
git clone https://github.com/libktx/ktx.git
cd ktx
git checkout developThe project itself is managed by Gradle. Gradle wrapper is included, but you can use a local
Gradle installation - scripts should be compatible with Gradle 7.+. Gradle projects are handled out of the box by
IntelliJ, so KTX should be easy to import.
Some useful Gradle tasks include:
build install- builds the libraries archives and pushes them to Maven Local. Useful for local tests.format- formats all Kotlin source files.linterIdeSetup- modifies local IntelliJ project setup for consistency withktlintformatting.check- runs all tests in all projects.clean- removes thebuilddirectories, which forces rebuilds of the modules.distZip- prepares a zip archive with all jars inbuild/distributionsfolder. Useful for releases.publish- pushes the archives to Maven Central or the snapshot repository, depending on the version. Requires completegradle.propertieswith archive signing and Sonatype logging data.closeAndReleaseRepository- closes and releases the Nexus repository. Should be run afterpublishin case of a non-snapshot upload to Maven Central. Might fail at times on the release task; runningreleaseRepositoryseparately should fix the issue.
- Create a folder matching module name in root of the repository. Modules should generally be named with a single word.
When multiple words are necessary, use a single dash (
-) as the word separator. - Add folder name to
settings.gradle.ktsfile. This will also serve as the project identifier that you use inbuild.gradlescripts and to run individual Gradle tasks (e.g.gradle actors:test). - Create
src/main/kotlinandsrc/test/kotlindirectories in your module folder. They will be automatically marked as source thanks to Gradle. You should also create package structure matchingktx/your/modulein each source folder. - Add
gradle.propertiesfile with the following properties:
projectName=ktx-your-module
projectDesc=Description of your module as it will appear in Maven Central.- Add a
build.gradle.ktsfile. It should contain dependencies specific to your module. If there are none, you can leave it empty. By addingimport ktx.*at the top of this file, you will be able to access the versions of major dependencies of the modules as defined in thebuildSrcdirectory. - Add a
README.mdfile describing your module. Refer to otherREADME.mdfiles for examples.README.mdfiles can consist of the following sections:- General description - in a single sentence, what problem does the module solve?
- Motivation - why was the module created?
- Guide - what features does the module provide? Does it require additional setup?
- Usage examples - how to use the module?
- Synergy - is the module complemented by any other KTX libraries?
- Alternatives - are there any other libraries or modules that can be used instead?
- Additional documentation - are there any other guides or articles on the topic?
- Add Maven Central badge to the top of the
README.mdto ease inclusion of the library:
[](https://search.maven.org/artifact/io.github.libktx/ktx-your-module)- Your final module structure should roughly match this schema:
> your-module/
> src/
> main/kotlin/ktx/your/module/
- yourModule.kt
> test/kotlin/ktx/your/module/
- yourModuleTest.kt
- build.gradle.kts
- gradle.properties
- README.md
- Include the module in the listing in the main
README.mdfile.
The following sections are for the maintainers of the repository.
Kotlin and plugin versions are stored in the gradle.properties file, while module dependencies
versions are stored with the Versions.kt file. Snapshot releases
should keep all the dependencies (outside of testing scope) up-to-date. Major dependencies include:
- libGDX: update
gdxVersionin the versions file and libGDX version in the tag on the top of the README.md file. Note that updating libGDX also affects the KTX version and milestones, so make sure to update the version.txt and milestones as well. After the release, update GitHub project'sCustom properties. - Kotlin: update the
kotlinVersionin the properties file and the Kotlin tag in the README.md. After the release, update GitHub project'sCustom properties. - Kotlin Coroutines: update
kotlinCoroutinesVersionin the versions file and the tag in thektx-asyncREADME.md. - Gradle: run
gradle wrapper --distribution-type allin the root project folder. Make sure that the Gradle wrapper properties file points theallGradle release underdistributionUrlrather than just the binaries (bin). Note that you do not have to install the corresponding Gradle version locally: instead, you can update the version ingradle-wrapper.propertiesfirst, and then run./gradlew wrapperto update the Gradle wrapper scripts and configuration files. - VisUI: update
visUiVersionin the versions file and VisUI version in the tag on the top of the vis/README.md file. - Ashley: update
ashleyVersionin the versions file and Ashley version in the tag on the top of the ashley/README.md file. - Artemis-odb: update
artemisOdbVersionin the versions file and Artemis-odb version in the tag on the top of the artemis/README.md file. - gdxAI: update
gdxAiVersionin the versions file and gdxAI version in the tag on the top of the ai/README.md file.
All the major dependencies updates should be added to the changelog.
- Create a new issue on GitHub. Include the number of the issue in commit messages of all commits related to the release.
Apply
devlabel and milestone corresponding to the libGDX version. An example can be found here. - Change
libVersionsetting in theversion.txt. KTX uses the same versioning schema as libGDX (mimicking the libGDX version that it was compiled against) with a suffix depending on the version status. - Create a pull request from the
developbranch to themasterbranch. Review and merge the changes to themasterbranch. - Checkout the
masterbranch. Fetch the latest changes. - Run
gradle build publish closeAndReleaseRepositoryto push artifacts to Maven Central. Note that the Maven plugin has its issues and might fail with an error, but usually the release will be successful. You can check if the staging repository was properly close, promoted and released at Nexus Repository Manager. - Run
gradle distZipto prepare an archive with KTX sources, compiled binary and documentation. - Upload the archive to releases section. The tag should be made from the
masterbranch and its name should match the released version. Name of the release should matchKTX $libVersion. Add a short release summary and copy the latest changelog entries to the release description. - If there are any known issues with the previous or current versions, please attach additional Known issues: section
with the following labels:
- [BUG] - a known bug in the release that is or will be fixed in the following versions.
- [INCOMPATIBILITY] - incompatibility with one of the previously supported or currently released versions of one of the major dependencies.
- [REMOVAL] - temporary or permanent removal of a major feature (e.g. disabling a module for a single release).
- Checkout the
developbranch. - Change
libVersionsetting in theversion.txtto the next snapshot release. The name should match the used libGDX version followed by the-SNAPSHOTsuffix.
- Make sure the
version.txtends with the-SNAPSHOTsuffix and matches the libGDX version that the library was compiled against. - Run
gradle build uploadSnapshotto push artifacts to Sonatype snapshots repository. This task will do nothing if the current version is not a snapshot to avoid accidentally pushing a stable release.
Note that snapshots are automatically uploaded to Maven Central (OSS Sonatype)
snapshots repository after pushing
to the develop branch.
Tasks automated with GitHub actions:
- build - compiles and tests all KTX modules. Triggered by pushing and setting up pull requests
to
masteranddevelopbranches. - upload-snapshot - compiles all KTX modules and uploads a new snapshot release.
Triggered by pushing to the
developbranch. - publish-documentation - builds and replaces the Dokka documentation published
to the official website. Triggered by pushing to the
masterbranch, which is generally only done before stable releases.
- publish-project-samples - generates sample projects with
gdx-liftoff based on the latest KTX version from the
masterbranch, and pushes them to the ktx-sample-project and ktx-sample-web-project repositories. Triggered by creating new release tags.