mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-04-06 02:01:58 +02:00
im having so much fun
This commit is contained in:
@@ -1,21 +1,3 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.20.2")
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
kotlin("jvm") apply false
|
||||
id("org.ajoberstar.grgit") version "5.2.0"
|
||||
}
|
||||
|
||||
subprojects {
|
||||
plugins.apply("kotlinx-atomicfu")
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
* User Manual available at https://docs.gradle.org/6.3/userguide/java_library_plugin.html
|
||||
*/
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
import java.io.ByteArrayOutputStream
|
||||
|
||||
plugins {
|
||||
kotlin("android")
|
||||
kotlin("plugin.serialization")
|
||||
id("com.github.gmazzo.buildconfig")
|
||||
|
||||
id("com.android.application") version "8.0.2"
|
||||
id("org.jetbrains.kotlin.android")
|
||||
id("org.ajoberstar.grgit")
|
||||
}
|
||||
|
||||
kotlin {
|
||||
@@ -83,6 +83,10 @@ dependencies {
|
||||
* build options.
|
||||
*/
|
||||
|
||||
extra.apply {
|
||||
set("gitVersionCode", grgit.tag.list().size)
|
||||
set("gitVersionName", grgit.describe(mapOf("tags" to true, "always" to true)))
|
||||
}
|
||||
android {
|
||||
/**
|
||||
* The app's namespace. Used primarily to access app resources.
|
||||
@@ -121,10 +125,10 @@ android {
|
||||
targetSdk = 33
|
||||
|
||||
// Defines the version number of your app.
|
||||
versionCode = 8
|
||||
versionCode = extra["gitVersionCode"] as? Int
|
||||
|
||||
// Defines a user-friendly version name for your app.
|
||||
versionName = "0.8.0-rc.1"
|
||||
versionName = extra["gitVersionName"] as? String
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
@@ -161,25 +165,3 @@ android {
|
||||
jvmTarget = "17"
|
||||
}
|
||||
}
|
||||
|
||||
fun String.runCommand(currentWorkingDir: File = file("./")): String {
|
||||
val byteOut = ByteArrayOutputStream()
|
||||
project.exec {
|
||||
workingDir = currentWorkingDir
|
||||
commandLine = this@runCommand.split("\\s".toRegex())
|
||||
standardOutput = byteOut
|
||||
}
|
||||
return String(byteOut.toByteArray()).trim()
|
||||
}
|
||||
|
||||
buildConfig {
|
||||
val gitCommitHash = "git rev-parse --verify --short HEAD".runCommand().trim()
|
||||
val gitVersionTag = "git --no-pager tag --points-at HEAD".runCommand().trim()
|
||||
val gitClean = "git status --porcelain".runCommand().trim().isEmpty()
|
||||
useKotlinOutput { topLevelConstants = true }
|
||||
packageName("dev.slimevr.android")
|
||||
|
||||
buildConfigField("String", "GIT_COMMIT_HASH", "\"${gitCommitHash}\"")
|
||||
buildConfigField("String", "GIT_VERSION_TAG", "\"${gitVersionTag}\"")
|
||||
buildConfigField("boolean", "GIT_CLEAN", gitClean.toString())
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
package dev.slimevr.android
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import dev.slimevr.Keybinding
|
||||
import dev.slimevr.VRServer
|
||||
import io.eiren.util.logging.LogManager
|
||||
import io.ktor.http.CacheControl
|
||||
@@ -19,7 +20,6 @@ import java.time.ZonedDateTime
|
||||
import kotlin.concurrent.thread
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
val VERSION = "v0.8.0-rc.1/android"
|
||||
lateinit var vrServer: VRServer
|
||||
private set
|
||||
val vrServerInitialized: Boolean
|
||||
@@ -44,7 +44,6 @@ fun main(activity: AppCompatActivity) {
|
||||
} catch (e1: java.lang.Exception) {
|
||||
e1.printStackTrace()
|
||||
}
|
||||
LogManager.info("Running version $VERSION")
|
||||
try {
|
||||
vrServer = VRServer(File(activity.filesDir, "vrconfig.yml").absolutePath)
|
||||
vrServer.start()
|
||||
|
||||
@@ -13,6 +13,7 @@ plugins {
|
||||
application
|
||||
id("com.github.johnrengelman.shadow")
|
||||
id("com.github.gmazzo.buildconfig")
|
||||
id("org.ajoberstar.grgit")
|
||||
}
|
||||
|
||||
kotlin {
|
||||
@@ -93,15 +94,19 @@ fun String.runCommand(currentWorkingDir: File = file("./")): String {
|
||||
}
|
||||
|
||||
buildConfig {
|
||||
val gitCommitHash = "git rev-parse --verify --short HEAD".runCommand().trim()
|
||||
val gitVersionTag = "git --no-pager tag --points-at HEAD".runCommand().trim()
|
||||
val gitClean = "git status --porcelain".runCommand().trim().isEmpty()
|
||||
useKotlinOutput { topLevelConstants = true }
|
||||
packageName("dev.slimevr.desktop")
|
||||
|
||||
buildConfigField("String", "GIT_COMMIT_HASH", "\"${gitCommitHash}\"")
|
||||
buildConfigField("String", "GIT_VERSION_TAG", "\"${gitVersionTag}\"")
|
||||
buildConfigField("boolean", "GIT_CLEAN", gitClean.toString())
|
||||
val gitVersionTag = grgit.describe(mapOf(
|
||||
"tags" to true,
|
||||
"abbrev" to 0,
|
||||
))
|
||||
val latestCommitTag =
|
||||
grgit.tag.list().find { it.name == gitVersionTag }!!.commit.abbreviatedId == grgit.head().abbreviatedId
|
||||
val gitLatestVersionTag = if (latestCommitTag) { gitVersionTag} else { "" }
|
||||
buildConfigField("String", "GIT_COMMIT_HASH", "\"${grgit.head().abbreviatedId}\"")
|
||||
buildConfigField("String", "GIT_VERSION_TAG", "\"${gitLatestVersionTag}\"")
|
||||
buildConfigField("boolean", "GIT_CLEAN", grgit.status().isClean.toString())
|
||||
}
|
||||
|
||||
tasks.getByName("run", JavaExec::class) {
|
||||
|
||||
@@ -23,8 +23,7 @@ pluginManagement {
|
||||
plugins {
|
||||
kotlin("plugin.serialization") version kotlinVersion
|
||||
kotlin("jvm") version kotlinVersion
|
||||
id("org.jetbrains.kotlin.android") version kotlinVersion
|
||||
id("org.jetbrains.kotlin.jvm") version kotlinVersion
|
||||
kotlin("android") version kotlinVersion
|
||||
id("com.diffplug.spotless") version spotlessVersion
|
||||
id("com.github.johnrengelman.shadow") version shadowJarVersion
|
||||
id("com.github.gmazzo.buildconfig") version buildconfigVersion
|
||||
@@ -38,4 +37,4 @@ include(":server")
|
||||
project(":server").projectDir = File("server")
|
||||
include(":server:core")
|
||||
include(":server:desktop")
|
||||
//include(":server:android")
|
||||
include(":server:android")
|
||||
|
||||
Reference in New Issue
Block a user