Inceptum/build.gradle

127 lines
4.1 KiB
Groovy
Raw Normal View History

import org.gradle.internal.os.OperatingSystem
2021-10-27 22:00:08 +02:00
plugins {
id 'java'
id 'application'
id 'com.github.johnrengelman.shadow' version '7.0.0'
2021-10-31 13:37:07 +01:00
id "maven-publish"
2021-12-27 14:39:24 +01:00
id "org.ajoberstar.grgit" version "3.1.0"
2021-10-27 22:00:08 +02:00
}
application {
2021-10-29 22:50:42 +02:00
mainClass = 'io.gitlab.jfronny.inceptum.Inceptum'
2021-10-27 22:00:08 +02:00
}
repositories {
mavenCentral()
}
2021-12-27 14:39:24 +01:00
ext.currentVer = "0.0.0+nogit"
if (grgit != null) {
ext.currentVer = "0.0.0+notag"
grgit.open(dir: rootProject.projectDir.toString())
def tagList = grgit.tag.list()
tagList.sort((left, right) -> right.commit.dateTime.compareTo(left.commit.dateTime))
if (tagList.size() >= 1) {
ext.currentVer = tagList.get(0).getName()
}
}
println("Building Inceptum " + ext.currentVer)
allprojects {
2021-12-27 14:39:24 +01:00
version "$rootProject.ext.currentVer" + (project.hasProperty('release') ? "" : "-" + (project.hasProperty('timestamp') ? project.getProperty('timestamp') : Instant.now().getEpochSecond()))
group 'io.gitlab.jfronny.inceptum'
}
2021-10-27 22:00:08 +02:00
ext {
lwjglVersion = '3.3.0'
2022-01-04 23:32:05 +01:00
imguiVersion = '1.86.0'
2021-10-27 22:00:08 +02:00
log4jVersion = '2.14.1'
2021-10-31 13:37:07 +01:00
flavorProp = project.hasProperty('flavor') ? project.getProperty('flavor') : 'custom'
flavor = flavorProp
2021-11-02 13:43:18 +01:00
isPublic = project.hasProperty('public')
isRelease = project.hasProperty('release')
}
2021-10-31 13:37:07 +01:00
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
}
2021-10-27 22:00:08 +02:00
}
dependencies {
implementation 'com.google.code.gson:gson:2.8.9'
2021-10-30 19:26:59 +02:00
implementation 'org.slf4j:slf4j-api:1.7.32'
2022-01-04 23:32:05 +01:00
implementation 'ch.qos.logback:logback-classic:1.2.10'
implementation 'org.eclipse.jgit:org.eclipse.jgit:6.0.0.202111291000-r'
implementation project(":wrapper")
2021-10-27 22:00:08 +02:00
implementation platform("org.lwjgl:lwjgl-bom:$lwjglVersion")
['', '-opengl', '-glfw', '-tinyfd'].each {
2021-10-27 22:00:08 +02:00
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"
2021-10-27 22:00:08 +02:00
}
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"
2021-10-27 22:00:08 +02:00
}
2021-10-29 22:50:42 +02:00
processResources {
inputs.property "version", project.version
filesMatching("version.json") {
expand "version": project.version
2021-10-31 13:37:07 +01:00
filter { line -> line.replace("@flavor@", project.ext.flavorProp) }
2021-11-02 13:43:18 +01:00
filter { line -> line.replace("@public@", "$project.ext.isPublic") }
filter { line -> line.replace("@release@", "$project.ext.isRelease") }
filter { line -> line.replace("@jvm@", "$project.sourceCompatibility") }
2021-10-29 22:50:42 +02:00
}
}
shadowJar {
2021-10-31 13:37:07 +01:00
archiveClassifier.set(flavorProp)
2021-11-24 19:53:06 +01:00
exclude "about.html"
exclude "plugin.properties"
exclude "META-INF/**"
}
2021-10-31 13:37:07 +01:00
publishing {
publications {
mavenJava(MavenPublication) {
artifact(shadowJar) {
builtBy shadowJar
}
}
}
2021-11-02 13:43:18 +01:00
if (project.ext.isPublic) {
2021-10-31 13:37:07 +01:00
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()
}