125 lines
4.0 KiB
Groovy
125 lines
4.0 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"
|
|
id "org.ajoberstar.grgit" version "3.1.0"
|
|
}
|
|
|
|
application {
|
|
mainClass = 'io.gitlab.jfronny.inceptum.Inceptum'
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
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 {
|
|
version "$rootProject.ext.currentVer" + (project.hasProperty('release') ? "" : "-" + (project.hasProperty('timestamp') ? project.getProperty('timestamp') : Instant.now().getEpochSecond()))
|
|
group 'io.gitlab.jfronny.inceptum'
|
|
}
|
|
|
|
ext {
|
|
lwjglVersion = '3.2.3'
|
|
imguiVersion = '1.84.1.4'
|
|
log4jVersion = '2.14.1'
|
|
flavorProp = project.hasProperty('flavor') ? project.getProperty('flavor') : 'custom'
|
|
flavor = flavorProp
|
|
isPublic = project.hasProperty('public')
|
|
}
|
|
|
|
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.9'
|
|
implementation 'org.slf4j:slf4j-api:1.7.32'
|
|
implementation 'ch.qos.logback:logback-classic:1.2.8'
|
|
implementation 'org.eclipse.jgit:org.eclipse.jgit:6.0.0.202111291000-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) }
|
|
filter { line -> line.replace("@public@", "$project.ext.isPublic") }
|
|
filter { line -> line.replace("@jvm@", "$project.sourceCompatibility") }
|
|
}
|
|
}
|
|
|
|
shadowJar {
|
|
archiveClassifier.set(flavorProp)
|
|
exclude "about.html"
|
|
exclude "plugin.properties"
|
|
exclude "META-INF/**"
|
|
}
|
|
|
|
publishing {
|
|
publications {
|
|
mavenJava(MavenPublication) {
|
|
artifact(shadowJar) {
|
|
builtBy shadowJar
|
|
}
|
|
}
|
|
}
|
|
if (project.ext.isPublic) {
|
|
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()
|
|
} |