Skip to content

Commit

Permalink
Add OS to the installer's name
Browse files Browse the repository at this point in the history
Issue: #428
  • Loading branch information
mlopatkin committed Jan 26, 2025
1 parent 416ec7b commit e17971b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
3 changes: 1 addition & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,7 @@ installers {
from(fileTree("assets") {
include("andlogview.*.png")
include("andlogview.svg")
exclude("andlogview.32.png") // This one is added by the JPackage as "andlogview.png".
// See imageOptions above.
exclude("andlogview.32.png") // This one is added by the JPackage as "andlogview.png", see `icon` above.
})
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ import org.gradle.kotlin.dsl.assign
import org.gradle.platform.Architecture
import org.gradle.platform.BuildPlatform
import org.gradle.platform.OperatingSystem
import java.lang.IllegalArgumentException
import java.time.Instant
import java.time.ZoneId
import java.time.format.DateTimeFormatter
import javax.inject.Inject

/**
Expand Down Expand Up @@ -85,11 +81,27 @@ abstract class BuildEnvironment(project: Project) {
val isWindows
get() = platform.operatingSystem == OperatingSystem.WINDOWS

/**
* A string representation of the current's machine architecture. Can be `null` if building architecture-specific
* packages for it isn't supported.
*/
val architecture
get() = when (platform.architecture) {
Architecture.X86 -> "x86"
Architecture.X86_64 -> "x64"
Architecture.AARCH64 -> "arm64"
else -> throw IllegalArgumentException("Unknown platform architecture ${platform.architecture}")
else -> null
}

/**
* A string representation of the current's machine OS. Can be `null` if building OS-specific packages for it isn't
* supported.
*/
val platformName
get() = when (platform.operatingSystem) {
OperatingSystem.LINUX -> "linux"
OperatingSystem.WINDOWS -> "win"
OperatingSystem.MAC_OS -> "mac"
else -> null
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package name.mlopatkin.andlogview.building

import org.beryx.runtime.JPackageImageTask
import org.gradle.kotlin.dsl.support.serviceOf
import java.util.Locale

plugins {
id("name.mlopatkin.andlogview.building.build-environment")
Expand Down Expand Up @@ -292,6 +291,9 @@ abstract class CopyInstallers : DefaultTask() {
@get:Input
abstract val version: Property<String>

@get:Input
abstract val platform: Property<String>

@get:Input
abstract val platformArchitecture: Property<String>

Expand Down Expand Up @@ -327,14 +329,16 @@ abstract class CopyInstallers : DefaultTask() {
val extension = originalName.extension
val version = this.version.get()
val appName = this.appName.get()
val platform = this.platform.get()
val qualifier = this.platformArchitecture.get()

return "$appName-$version-$qualifier.$extension"
return "$appName-$version-$platform-$qualifier.$extension"
}
}

tasks.withType<CopyInstallers> {
platformArchitecture = buildEnvironment.architecture
platform = buildEnvironment.platformName
}

// Register entry points for distributions.
Expand Down

0 comments on commit e17971b

Please sign in to comment.