Exit Full View

Glok / glok-core / build.gradle.kts

// glok root project

plugins {
    kotlin("multiplatform")
    id("maven-publish")
    id("org.jetbrains.dokka")
}

repositories {
    mavenCentral()
}

val glokVersion: String by project
group = "uk.co.nickthecoder"
version = glokVersion

kotlin {

    // Not supported in earlier versions of Kotlin plugin.
    //withSourcesJar(publish = false)

    jvm {
        jvmToolchain(11)
    }

    js(IR) {
        browser()
    }
    sourceSets {

        val commonMain by getting {
            dependencies {
                implementation(project(":glok-model"))
            }
        }

        val jsMain by getting {
            dependencies {
                implementation(project(":glok-model"))
            }
        }

        val jvmMain by getting {
            val lwjglVersion: String by project
            val jomlVersion: String by project
            dependencies {
                implementation(project(":glok-model"))

                implementation(kotlin("reflect"))
                implementation(kotlin("stdlib-jdk8"))

                implementation("org.lwjgl:lwjgl:$lwjglVersion")
                implementation("org.lwjgl:lwjgl-glfw:$lwjglVersion")
                implementation("org.lwjgl:lwjgl-jemalloc:$lwjglVersion")
                implementation("org.lwjgl:lwjgl-opengl:$lwjglVersion")
                implementation("org.lwjgl:lwjgl-stb:$lwjglVersion")
                implementation("org.lwjgl:lwjgl-glfw:$lwjglVersion")
                implementation("org.lwjgl:lwjgl-nfd:$lwjglVersion")

                // I've chosen to bundle the natives for linux, windows and macOS, so that 3rd parties
                // don't need to worry about it.
                // This makes the final product cross-platform, at the expense of wasted space/download times.

                implementation("org.lwjgl:lwjgl:$lwjglVersion:natives-linux")
                implementation("org.lwjgl:lwjgl-glfw:$lwjglVersion:natives-linux")
                implementation("org.lwjgl:lwjgl-jemalloc:$lwjglVersion:natives-linux")
                implementation("org.lwjgl:lwjgl-opengl:$lwjglVersion:natives-linux")
                implementation("org.lwjgl:lwjgl-stb:$lwjglVersion:natives-linux")
                implementation("org.lwjgl:lwjgl-nfd:$lwjglVersion:natives-linux")

                implementation("org.lwjgl:lwjgl:$lwjglVersion:natives-windows")
                implementation("org.lwjgl:lwjgl-glfw:$lwjglVersion:natives-windows")
                implementation("org.lwjgl:lwjgl-jemalloc:$lwjglVersion:natives-windows")
                implementation("org.lwjgl:lwjgl-opengl:$lwjglVersion:natives-windows")
                implementation("org.lwjgl:lwjgl-stb:$lwjglVersion:natives-windows")
                implementation("org.lwjgl:lwjgl-nfd:$lwjglVersion:natives-windows")

                implementation("org.lwjgl:lwjgl:$lwjglVersion:natives-macos")
                implementation("org.lwjgl:lwjgl-glfw:$lwjglVersion:natives-macos")
                implementation("org.lwjgl:lwjgl-jemalloc:$lwjglVersion:natives-macos")
                implementation("org.lwjgl:lwjgl-opengl:$lwjglVersion:natives-macos")
                implementation("org.lwjgl:lwjgl-stb:$lwjglVersion:natives-macos")
                implementation("org.lwjgl:lwjgl-nfd:$lwjglVersion:natives-macos")

                // OpenGL Math library - primarily for matrix multiplications.
                implementation("org.joml:joml:$jomlVersion")

                //testImplementation("junit:junit:4.13.2")
            }

        }
    }
}


tasks.dokkaHtmlPartial {
    dokkaSourceSets {
        configureEach {
            includeNonPublic.set(false)
            suppressInheritedMembers.set(true)
        }
    }
}

publishing {
    repositories {

        maven {
            // 46354938 is the GitLab project ID of project nickthecoder/glok
            url = uri("https://gitlab.com/api/v4/projects/46354938/packages/maven")
            credentials(HttpHeaderCredentials::class) {
                name = "Private-Token"
                value = providers.gradleProperty("gitLabPrivateToken").get()
                // The password is stored in ~/.gradle/gradle.properties
            }
            authentication {
                create<HttpHeaderAuthentication>("header")
            }
        }
    }
}