Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
xfqwdsj committed Apr 26, 2024
1 parent 7d39031 commit 8ae3ca8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
24 changes: 12 additions & 12 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ tasks.register("releaseDesktopAppUberJar") {
?.filter { it.name.contains("$projectDevVer.$projectReversion") && it.name.endsWith(".jar") }?.forEach {
val arch = Regex(".+?-.+?-(.+?)-.+").find(it.name)?.groupValues?.get(1) ?: return@forEach
it.copyTo(
outputDir.resolve("fhraise-${SystemEnvironment.type}-$projectVersion.$projectBuildNumber-${arch}.jar"),
outputDir.resolve("fhraise-${operatingSystem.familyName}-$projectVersion.$projectBuildNumber-${arch}.jar"),
overwrite = true
)
logger.lifecycle("output directory: ${outputDir.absolutePath}")
Expand All @@ -154,7 +154,7 @@ tasks.register<Tar>("releaseLinuxAppAndTar") {
group = "project build"
description = "Build the Linux release and create a tar archive"

if (!SystemEnvironment.isLinux) {
if (!operatingSystem.isLinux) {
enabled = false
}

Expand All @@ -174,7 +174,7 @@ tasks.register<Zip>("releaseWindowsAppAndZip") {
group = "project build"
description = "Build the Windows release and create a zip archive"

if (!SystemEnvironment.isWindows) {
if (!operatingSystem.isWindows) {
enabled = false
}

Expand All @@ -193,9 +193,9 @@ tasks.register("releaseDesktopAppAndArchive") {
group = "project build"
description = "Build the desktop release and create an archive"

if (SystemEnvironment.isLinux) {
if (operatingSystem.isLinux) {
dependsOn("releaseLinuxAppAndTar")
} else if (SystemEnvironment.isWindows) {
} else if (operatingSystem.isWindows) {
dependsOn("releaseWindowsAppAndZip")
}
}
Expand All @@ -206,9 +206,9 @@ tasks.register("releaseDesktopApp") {

dependsOn("releaseDesktopAppAndArchive", "releaseDesktopAppUberJar")

if (SystemEnvironment.isLinux) {
dependsOn("compose-app:packageReleaseDeb", "compose-app:packageReleaseRpm", "releaseDesktopUberJarApp")
} else if (SystemEnvironment.isWindows) {
if (operatingSystem.isLinux) {
dependsOn("compose-app:packageReleaseDeb", "compose-app:packageReleaseRpm")
} else if (operatingSystem.isWindows) {
dependsOn("compose-app:packageReleaseMsi")
}
}
Expand Down Expand Up @@ -270,7 +270,7 @@ tasks.register("ciReleaseLinuxApp") {
group = "ci"
description = "Build on the Linux platform"

if (!SystemEnvironment.isLinux) {
if (!operatingSystem.isLinux) {
enabled = false
}

Expand Down Expand Up @@ -303,7 +303,7 @@ tasks.register("ciReleaseWindowsApp") {
group = "ci"
description = "Build on the Windows platform"

if (!SystemEnvironment.isWindows) {
if (!operatingSystem.isWindows) {
enabled = false
}

Expand All @@ -323,9 +323,9 @@ tasks.register("ciReleaseApp") {
group = "ci"
description = "Build the release app"

if (SystemEnvironment.isLinux) {
if (operatingSystem.isLinux) {
dependsOn("ciReleaseLinuxApp")
} else if (SystemEnvironment.isWindows) {
} else if (operatingSystem.isWindows) {
dependsOn("ciReleaseWindowsApp")
}

Expand Down
9 changes: 2 additions & 7 deletions buildSrc/src/main/kotlin/SystemEnvironment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,8 @@ package xyz.xfqlittlefan.fhraise.buildsrc

import org.gradle.internal.os.OperatingSystem

val operatingSystem: OperatingSystem = OperatingSystem.current()

object SystemEnvironment {
val isLinux = OperatingSystem.current().isLinux
val isWindows = OperatingSystem.current().isWindows
val type = when {
isLinux -> "linux"
isWindows -> "windows"
else -> "unknown"
}
val arch: String = System.getProperty("os.arch")
}

0 comments on commit 8ae3ca8

Please sign in to comment.