Fix/startup jvm error after installation update via msi (#1229)

* Remove existing installations with msi installer

* Remove unused x86 wxs file

* Uninstall old msi versions with different upgrade code

* Progress but error 2721 happens on install

* Remove added uninstall previous version wxs stuff

* Use revision as patch number

MSI only uninstalls previous versions in case the version number changed (it only checks the first three numbers (major, minor, patch)).
Thus, to prevent each preview install to result in it getting registered as a new "app" and for it to uninstall the old versions, we have to change the version on each release.

* Deprecate "BuildConfig.REVISION"

* Remove outdated env vars

---------

Co-authored-by: Syer10 <syer10@users.noreply.github.com>
This commit is contained in:
schroda
2025-04-06 21:09:56 +02:00
committed by GitHub
parent 78fd09c728
commit 3167d8aa15
11 changed files with 46 additions and 86 deletions
+9 -7
View File
@@ -10,14 +10,13 @@ import java.io.BufferedReader
const val MainClass = "suwayomi.tachidesk.MainKt" const val MainClass = "suwayomi.tachidesk.MainKt"
// should be bumped with each stable release // should be bumped with each stable release
val tachideskVersion = System.getenv("ProductVersion") ?: "v1.1.1" val getTachideskVersion = { "v1.1.${getCommitCount()}" }
val webUIRevisionTag = System.getenv("WebUIRevision") ?: "r1689" val webUIRevisionTag = "r1689"
// counts commits on the current checked out branch private val getCommitCount = {
val getTachideskRevision = {
runCatching { runCatching {
System.getenv("ProductRevision") ?: ProcessBuilder() ProcessBuilder()
.command("git", "rev-list", "HEAD", "--count") .command("git", "rev-list", "HEAD", "--count")
.start() .start()
.let { process -> .let { process ->
@@ -26,8 +25,11 @@ val getTachideskRevision = {
it.bufferedReader().use(BufferedReader::readText) it.bufferedReader().use(BufferedReader::readText)
} }
process.destroy() process.destroy()
"r" + output.trim() output.trim()
} }
}.getOrDefault("r0") }.getOrDefault("0")
} }
// counts commits on the current checked out branch
val getTachideskRevision = { "r${getCommitCount()}" }
+9 -9
View File
@@ -151,16 +151,16 @@ setup_jre() {
mv "jre" "$RELEASE_NAME/jre" mv "jre" "$RELEASE_NAME/jre"
else else
if [ ! -f "$JRE" ]; then if [ ! -f "$JRE" ]; then
curl -L "$JRE_URL" -o "$JRE" curl -L "$JRE_URL" -o "$JRE"
fi fi
local ext="${JRE##*.}" local ext="${JRE##*.}"
if [ "$ext" = "zip" ]; then if [ "$ext" = "zip" ]; then
unzip "$JRE" unzip "$JRE"
else else
tar xvf "$JRE" tar xvf "$JRE"
fi fi
mv "$JRE_DIR" "$RELEASE_NAME/jre" mv "$JRE_DIR" "$RELEASE_NAME/jre"
fi fi
} }
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" UpgradeCode="*" <Product Id="*" UpgradeCode="174c8f36-0bec-4585-9ddd-469c3d889dc1"
Version="$(var.ProductVersion)" Language="1033" Name="Suwayomi Server" Manufacturer="Suwayomi"> Version="$(var.ProductVersion)" Language="1033" Name="Suwayomi Server" Manufacturer="Suwayomi">
<Package InstallerVersion="300" Compressed="yes" /> <Package InstallerVersion="300" Compressed="yes" />
<Media Id="1" Cabinet="Suwayomi_Server.cab" EmbedCab="yes" /> <Media Id="1" Cabinet="Suwayomi_Server.cab" EmbedCab="yes" />
@@ -9,6 +9,8 @@
VersionNT64 VersionNT64
</Condition> </Condition>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<!-- Directory --> <!-- Directory -->
<Directory Id="TARGETDIR" Name="SourceDir"> <Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder"> <Directory Id="ProgramFiles64Folder">
@@ -48,6 +50,10 @@
</Component> </Component>
</DirectoryRef> </DirectoryRef>
<InstallExecuteSequence>
<RemoveExistingProducts After="InstallValidate" />
</InstallExecuteSequence>
<!-- Feature --> <!-- Feature -->
<Feature Id="Suwayomi_Server" Title="Suwayomi-Server" Level="1"> <Feature Id="Suwayomi_Server" Title="Suwayomi-Server" Level="1">
<ComponentGroupRef Id="jre" /> <ComponentGroupRef Id="jre" />
@@ -1,60 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" UpgradeCode="*"
Version="$(var.ProductVersion)" Language="1033" Name="Suwayomi Server" Manufacturer="Suwayomi">
<Package InstallerVersion="300" Compressed="yes" />
<Media Id="1" Cabinet="Suwayomi_Server.cab" EmbedCab="yes" />
<!-- Directory -->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLDIR" Name="Suwayomi-Server" >
<Directory Id="jre"/>
<Directory Id="electron"/>
<Directory Id="bin"/>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ProgramMenuDir" Name="Suwayomi-Server">
<Component Id="ProgramMenuDir" Guid="*">
<RemoveFolder Id="ProgramMenuDir" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Type="string" Value="" KeyPath="yes"/>
</Component>
</Directory>
</Directory>
<Directory Id="DesktopFolder" />
</Directory>
<!-- Component -->
<DirectoryRef Id="INSTALLDIR">
<Component Id="SuwayomiJAR" Guid="*">
<File Id="Suwayomi-Launcher.jar" Source="$(var.SourceDir)/Suwayomi-Launcher.jar" KeyPath="yes" />
</Component>
<Component Id="SuwayomiLauncherBAT" Guid="*" Win64="yes">
<File Id="SuwayomiLauncher.bat" Source="$(var.SourceDir)/Suwayomi Launcher.bat" KeyPath="yes" >
<Shortcut Id="SuwayomiLauncher.lnk" Name="Suwayomi Launcher" Directory="INSTALLDIR"
WorkingDirectory="INSTALLDIR" Icon="Suwayomi.ico" IconIndex="0" Advertise="yes" />
<Shortcut Id="DesktopSuwayomiLauncher.lnk" Name="Suwayomi Launcher" Directory="DesktopFolder"
WorkingDirectory="INSTALLDIR" Icon="Suwayomi.ico" IconIndex="0" Advertise="yes" />
<Shortcut Id="ProgramMenuSuwayomiLauncher.lnk" Name="Suwayomi Launcher" Directory="ProgramMenuDir"
WorkingDirectory="INSTALLDIR" Icon="Suwayomi.ico" IconIndex="0" Advertise="yes"
Description="A free and open source manga reader that runs extensions built for Tachiyomi." />
</File>
</Component>
</DirectoryRef>
<!-- Feature -->
<Feature Id="Suwayomi_Server" Title="Suwayomi-Server" Level="1">
<ComponentGroupRef Id="jre" />
<ComponentGroupRef Id="bin" />
<ComponentRef Id="SuwayomiJAR" />
<ComponentRef Id="SuwayomiLauncherBAT" />
<ComponentRef Id="ProgramMenuDir" />
<ComponentGroupRef Id="electron" />
</Feature>
<Icon Id="Suwayomi.ico" SourceFile="$(var.Icon)" />
<Property Id="ARPPRODUCTICON" Value="Suwayomi.ico" /> <!-- Icon in Add/Remove Programs -->
</Product>
</Wix>
+4 -4
View File
@@ -121,7 +121,7 @@ buildConfig {
fun quoteWrap(obj: Any): String = """"$obj"""" fun quoteWrap(obj: Any): String = """"$obj""""
buildConfigField("String", "NAME", quoteWrap(rootProject.name)) buildConfigField("String", "NAME", quoteWrap(rootProject.name))
buildConfigField("String", "VERSION", quoteWrap(tachideskVersion)) buildConfigField("String", "VERSION", quoteWrap(getTachideskVersion()))
buildConfigField("String", "REVISION", quoteWrap(getTachideskRevision())) buildConfigField("String", "REVISION", quoteWrap(getTachideskRevision()))
buildConfigField("String", "BUILD_TYPE", quoteWrap(if (System.getenv("ProductBuildType") == "Stable") "Stable" else "Preview")) buildConfigField("String", "BUILD_TYPE", quoteWrap(if (System.getenv("ProductBuildType") == "Stable") "Stable" else "Preview"))
buildConfigField("long", "BUILD_TIME", Instant.now().epochSecond.toString()) buildConfigField("long", "BUILD_TIME", Instant.now().epochSecond.toString())
@@ -140,13 +140,13 @@ tasks {
"Main-Class" to MainClass, "Main-Class" to MainClass,
"Implementation-Title" to rootProject.name, "Implementation-Title" to rootProject.name,
"Implementation-Vendor" to "The Suwayomi Project", "Implementation-Vendor" to "The Suwayomi Project",
"Specification-Version" to tachideskVersion, "Specification-Version" to getTachideskVersion(),
"Implementation-Version" to getTachideskRevision(), "Implementation-Version" to getTachideskRevision(),
) )
} }
archiveBaseName.set(rootProject.name) archiveBaseName.set(rootProject.name)
archiveVersion.set(tachideskVersion) archiveVersion.set(getTachideskVersion())
archiveClassifier.set(getTachideskRevision()) archiveClassifier.set("")
destinationDirectory.set(File("$rootDir/server/build")) destinationDirectory.set(File("$rootDir/server/build"))
mergeServiceFiles() mergeServiceFiles()
} }
@@ -15,7 +15,12 @@ object AppInfo {
* *
* @since extension-lib 1.3 * @since extension-lib 1.3
*/ */
fun getVersionCode() = BuildConfig.REVISION.substring(1).toInt() fun getVersionCode() =
BuildConfig.VERSION
.replace("v", "")
.split('.')
.joinToString("")
.toInt()
/** /**
* should be something like "0.13.1" * should be something like "0.13.1"
@@ -12,6 +12,7 @@ import suwayomi.tachidesk.server.generated.BuildConfig
data class AboutDataClass( data class AboutDataClass(
val name: String, val name: String,
val version: String, val version: String,
@Deprecated("The version includes the revision as the patch number")
val revision: String, val revision: String,
val buildType: String, val buildType: String,
val buildTime: Long, val buildTime: Long,
@@ -1,5 +1,6 @@
package suwayomi.tachidesk.graphql.queries package suwayomi.tachidesk.graphql.queries
import com.expediagroup.graphql.generator.annotations.GraphQLDeprecated
import suwayomi.tachidesk.global.impl.AppUpdate import suwayomi.tachidesk.global.impl.AppUpdate
import suwayomi.tachidesk.graphql.types.AboutWebUI import suwayomi.tachidesk.graphql.types.AboutWebUI
import suwayomi.tachidesk.graphql.types.WebUIUpdateCheck import suwayomi.tachidesk.graphql.types.WebUIUpdateCheck
@@ -15,6 +16,7 @@ class InfoQuery {
data class AboutServerPayload( data class AboutServerPayload(
val name: String, val name: String,
val version: String, val version: String,
@GraphQLDeprecated("The version includes the revision as the patch number")
val revision: String, val revision: String,
val buildType: String, val buildType: String,
val buildTime: Long, val buildTime: Long,
@@ -20,7 +20,7 @@ class MangaUpdatesInterceptor(
originalRequest originalRequest
.newBuilder() .newBuilder()
.addHeader("Authorization", "Bearer $token") .addHeader("Authorization", "Bearer $token")
.header("User-Agent", "Suwayomi ${BuildConfig.VERSION} (${BuildConfig.REVISION})") .header("User-Agent", "Suwayomi ${BuildConfig.VERSION}")
.build() .build()
return chain.proceed(authRequest) return chain.proceed(authRequest)
@@ -137,7 +137,7 @@ fun applicationSetup() {
setupLogLevelUpdating(serverConfig.debugLogsEnabled, listOf(BASE_LOGGER_NAME)) setupLogLevelUpdating(serverConfig.debugLogsEnabled, listOf(BASE_LOGGER_NAME))
logger.info { "Running Suwayomi-Server ${BuildConfig.VERSION} revision ${BuildConfig.REVISION}" } logger.info { "Running Suwayomi-Server ${BuildConfig.VERSION}" }
logger.debug { logger.debug {
"Loaded config:\n" + "Loaded config:\n" +
@@ -591,14 +591,18 @@ object WebInterfaceManager {
return BuildConfig.WEBUI_TAG return BuildConfig.WEBUI_TAG
} }
val currentServerVersionNumber = extractVersion(BuildConfig.REVISION) val currentServerVersionNumber =
BuildConfig.VERSION
.split(".")
.last()
.toInt()
val webUIToServerVersionMappings = fetchServerMappingFile(flavor) val webUIToServerVersionMappings = fetchServerMappingFile(flavor)
logger.debug { logger.debug {
"getLatestCompatibleVersion: " + "getLatestCompatibleVersion: " +
"flavor= ${flavor.uiName}, " + "flavor= ${flavor.uiName}, " +
"webUIChannel= ${serverConfig.webUIChannel.value}, " + "webUIChannel= ${serverConfig.webUIChannel.value}, " +
"currentServerVersion= ${BuildConfig.REVISION}, " + "currentServerVersion= ${BuildConfig.VERSION}, " +
"mappingFile= $webUIToServerVersionMappings" "mappingFile= $webUIToServerVersionMappings"
} }