Inceptum/build.gradle
2021-10-31 16:59:25 +01:00

108 lines
3.3 KiB
Groovy

import org.gradle.internal.os.OperatingSystem
plugins {
id 'java'
id 'application'
id 'com.github.johnrengelman.shadow' version '7.0.0'
id "maven-publish"
}
application {
mainClass = 'io.gitlab.jfronny.inceptum.Inceptum'
}
repositories {
mavenCentral()
}
allprojects {
version "$project.ver" + (project.hasProperty('pipeline') ? "+" + project.getProperty('pipeline') : "")
group 'io.gitlab.jfronny.inceptum'
}
ext {
lwjglVersion = '3.2.3'
imguiVersion = '1.84.1.3'
log4jVersion = '2.14.1'
flavorProp = project.hasProperty('flavor') ? project.getProperty('flavor') : 'custom'
flavor = flavorProp
isPublicMaven = project.hasProperty('publicMaven')
}
if (flavor == 'custom') {
switch (OperatingSystem.current()) {
case OperatingSystem.WINDOWS:
project.ext.flavor = 'windows'
break
case OperatingSystem.LINUX:
project.ext.flavor = 'linux'
break
case OperatingSystem.MAC_OS:
project.ext.flavor = 'macos'
break
}
}
dependencies {
implementation 'com.google.code.gson:gson:2.8.8'
implementation 'org.slf4j:slf4j-api:1.7.32'
implementation 'ch.qos.logback:logback-classic:1.2.6'
implementation 'net.freeutils:jlhttp:2.6'
implementation 'org.eclipse.jgit:org.eclipse.jgit:5.13.0.202109080827-r'
implementation project(":wrapper")
implementation platform("org.lwjgl:lwjgl-bom:$lwjglVersion")
['', '-opengl', '-glfw'].each {
implementation "org.lwjgl:lwjgl$it:$lwjglVersion"
if (flavor == 'windows' || flavor == 'fat') implementation "org.lwjgl:lwjgl$it::natives-windows"
if (flavor == 'linux' || flavor == 'fat') implementation "org.lwjgl:lwjgl$it::natives-linux"
if (flavor == 'macos' || flavor == 'fat') implementation "org.lwjgl:lwjgl$it::natives-macos"
}
implementation "io.github.spair:imgui-java-binding:$imguiVersion" // https://github.com/SpaiR/imgui-java
implementation "io.github.spair:imgui-java-lwjgl3:$imguiVersion"
if (flavor == 'windows' || flavor == 'fat') implementation "io.github.spair:imgui-java-natives-windows:$imguiVersion"
if (flavor == 'linux' || flavor == 'fat') implementation "io.github.spair:imgui-java-natives-linux:$imguiVersion"
if (flavor == 'macos' || flavor == 'fat') implementation "io.github.spair:imgui-java-natives-macos:$imguiVersion"
}
processResources {
inputs.property "version", project.version
filesMatching("version.json") {
expand "version": project.version
filter { line -> line.replace("@flavor@", project.ext.flavorProp) }
}
}
shadowJar {
archiveClassifier.set(flavorProp)
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact(shadowJar) {
builtBy shadowJar
}
}
}
if (project.ext.isPublicMaven) {
repositories.maven {
url = "https://gitlab.com/api/v4/projects/30862253/packages/maven"
name = "gitlab"
credentials(HttpHeaderCredentials) {
name = "Job-Token"
value = System.getenv().CI_JOB_TOKEN
}
authentication {
header(HttpHeaderAuthentication)
}
}
}
repositories.mavenLocal()
}