Utilize jfmods scripts
This commit is contained in:
parent
b87889f5b4
commit
ab81759d4d
|
@ -1,31 +1,15 @@
|
|||
import org.ajoberstar.grgit.Grgit
|
||||
import org.gradle.internal.os.OperatingSystem
|
||||
|
||||
plugins {
|
||||
id("org.ajoberstar.grgit") version "5.0.0" apply false
|
||||
id("jf.autoversion")
|
||||
}
|
||||
|
||||
var currentVer = "0.0.0+nogit"
|
||||
if (File(".git").exists()) {
|
||||
val grgit: Grgit = Grgit.open(mapOf("dir" to rootProject.projectDir.toString()))
|
||||
currentVer = "0.0.0+notag"
|
||||
val tagList = grgit.tag.list()
|
||||
tagList.sortWith { left, right -> right.commit.dateTime.compareTo(left.commit.dateTime) }
|
||||
if (tagList.isNotEmpty()) {
|
||||
currentVer = tagList[0].name
|
||||
}
|
||||
}
|
||||
|
||||
val timestamp: Long = if (project.hasProperty("timestamp")) "${project.property("timestamp")}".toLong()
|
||||
else (System.currentTimeMillis() / 1000L)
|
||||
|
||||
allprojects {
|
||||
version = currentVer + if (project.hasProperty("release")) "" else "-$timestamp"
|
||||
version = rootProject.version
|
||||
group = "io.gitlab.jfronny.inceptum"
|
||||
}
|
||||
|
||||
println("Using Inceptum Build Script $version")
|
||||
|
||||
val lwjglVersion by extra("3.3.1")
|
||||
val imguiVersion by extra("1.86.4")
|
||||
val jfCommonsVersion by extra("2022.9.18+16-50-22")
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
src/main/java/io/gitlab/jfronny/inceptum/common/BuildMetadata.java
|
|
@ -1,5 +1,8 @@
|
|||
import io.gitlab.jfronny.scripts.*
|
||||
|
||||
plugins {
|
||||
id("inceptum.library-conventions")
|
||||
id("jf.codegen")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
@ -9,17 +12,19 @@ dependencies {
|
|||
|
||||
val javaVersion by extra(project.java.targetCompatibility)
|
||||
|
||||
projectDir.resolve("src/main/java/io/gitlab/jfronny/inceptum/common/BuildMetadata.java").writeText(
|
||||
"""
|
||||
package io.gitlab.jfronny.inceptum.common;
|
||||
sourceSets {
|
||||
main {
|
||||
generate(project) {
|
||||
`class`("io.gitlab.jfronny.inceptum.common", "BuildMetadata") {
|
||||
val modifiers = "public static final"
|
||||
import("io.gitlab.jfronny.commons.ComparableVersion")
|
||||
|
||||
import io.gitlab.jfronny.commons.ComparableVersion;
|
||||
|
||||
public class BuildMetadata {
|
||||
public static final ComparableVersion VERSION = new ComparableVersion("$version");
|
||||
public static final boolean IS_PUBLIC = ${rootProject.extra["isPublic"]};
|
||||
public static final boolean IS_RELEASE = ${rootProject.extra["isRelease"]};
|
||||
public static final int VM_VERSION = $javaVersion;
|
||||
public static final int WRAPPER_VERSION = ${rootProject.extra["wrapperVersion"]};
|
||||
fieldRaw("VERSION", "ComparableVersion", "new ComparableVersion(\"$version\")", modifiers)
|
||||
field("IS_PUBLIC", rootProject.extra["isPublic"] as Boolean, modifiers)
|
||||
field("IS_RELEASE", rootProject.extra["isRelease"] as Boolean, modifiers)
|
||||
field("VM_VERSION", javaVersion.majorVersion.toInt(), modifiers)
|
||||
field("WRAPPER_VERSION", rootProject.extra["wrapperVersion"] as Int, modifiers)
|
||||
}
|
||||
}
|
||||
}
|
||||
""".trimIndent())
|
||||
}
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
pluginManagement {
|
||||
repositories {
|
||||
maven("https://gitlab.com/api/v4/projects/31672498/packages/maven") // scripts
|
||||
gradlePluginPortal()
|
||||
}
|
||||
plugins {
|
||||
id("jf.codegen") version "1.0-SNAPSHOT"
|
||||
id("jf.autoversion") version "1.0-SNAPSHOT"
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "Inceptum"
|
||||
|
||||
include("common")
|
||||
|
|
Loading…
Reference in New Issue