Skip to content

Project Setup

Risto Lahtela edited this page Jul 24, 2021 · 35 revisions

Plan Header

Project Set-Up

Page version: 5.4 build 1390

  1. Install JDK for Java 16 so that you can compile the project. Note that the plugin is compiled to Java 8 despite this, so newer language features are unavailable.

  2. Fork the Plan repository & Clone that repository to your workstation.
    Here is a Tutorial.

  3. Open /Plan/ project folder inside the repository you just downloaded in your favorite IDE.
    Most IDEs will sync the workspace and you can start working on the project.

If you're having issues join Discord or open an issue and I'll help you out.

Building

The project is split into 8 modules.

Module Description
api Easily available API that is distributed via a maven repository
extension Module for registering built in extensions that use DataExtension API
common System related abstractions and main logic is in this package. Most work is done here.
bukkit Bukkit/Spigot/Paper related classes
bungee BungeeCord related classes
sponge Sponge related classes
velocity Velocity related classes
plugin Module for shading all other modules into a single jar
fabric Fabric related classes, independent jar from other platforms

Plan uses Dagger for dependency injection.

Your IDE may be complaining about DaggerPlanBukkitComponent or another Dagger###Component class not being available.
Make sure that /<module>/build/generated/ is included as a Generated Sources root.

Building and testing

To build a new plugin artifact to use on servers, use

./gradlew build

The artifact will be placed in /repo_root/Plan/builds/

To run tests, use

./gradlew test

To run CheckStyle checks run

./gradlew checkstyleMain checkstyleTest

Maven Local Dependencies
mavenLocal() is not included in the repositories of main build.gradle.
If you need locally installed dependencies, add it to the main build.gradle for test builds.

More

If you would like to know a bit more how the project is put together before diving in, you can check out Project Architecture

The following sections are documentation for different one-time set-up steps for the project, written down in case I need to do it again years after I forgot about it.

CI set-up

Some tests need additional resources to be run, such as MySQL test or Selenium tests. It is not expected for devs to set these up on their own machines, but they should run on the CI.

The resource information is set using environmental variables. Those can be found from https://github.com/plan-player-analytics/Plan/blob/master/Plan/common/src/test/java/utilities/CIProperties.java

Bintray publish set-up (Bintray has shut down)

In order to publish artifacts to Bintray, following environmental variables need to be set

build gradle config for bintray (At the time of writing this is in the API module)

bintray {
    user = System.getenv('BINTRAY_USER')
    key = System.getenv('BINTRAY_KEY')
    pkg {
        repo = 'Plan-repository'
        name = 'Plan-API'
        licenses = ['LGPL-v3.0']
        vcsUrl = 'https://github.com/plan-player-analytics/Plan'
        issueTrackerUrl = 'https://github.com/plan-player-analytics/Plan/issues'
        version {
            name = "$apiVersion"
            desc = "Plan API version $apiVersion"
        }
        publications = ['BintrayPublication']
    }
}

publishing {
    publications {
        BintrayPublication(MavenPublication) {
            groupId = 'com.djrapitops'
            artifactId = 'Plan-api'
            version = "$apiVersion"

            artifact jar
        }
        mavenJava(MavenPublication) {
            groupId = 'com.djrapitops'
            artifactId = 'Plan-api'
            version = "$apiVersion"

            artifact jar
        }
    }
}
Clone this wiki locally