update windows build script

This commit is contained in:
2024-12-14 21:38:34 +08:00
parent 8364b56178
commit 513e716608
2 changed files with 17 additions and 9 deletions

View File

@@ -24,8 +24,8 @@ DisableProgramGroupPage=yes
; Uncomment the following line to run in non administrative install mode (install for current user only.) ; Uncomment the following line to run in non administrative install mode (install for current user only.)
;PrivilegesRequired=lowest ;PrivilegesRequired=lowest
PrivilegesRequiredOverridesAllowed=dialog PrivilegesRequiredOverridesAllowed=dialog
OutputDir=C:\Users\wgh19\IdeaProjects\pixes\build\windows OutputDir={#RootPath}\build\windows
OutputBaseFilename=pixes-windows-installer OutputBaseFilename=pixes-{#MyAppVersion}-windows-installer
SetupIconFile={#RootPath}\windows\runner\resources\app_icon.ico SetupIconFile={#RootPath}\windows\runner\resources\app_icon.ico
Compression=lzma Compression=lzma
SolidCompression=yes SolidCompression=yes
@@ -35,7 +35,7 @@ ArchitecturesAllowed=x64 arm64
[Languages] [Languages]
Name: "english"; MessagesFile: "compiler:Default.isl" Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "chinesesimplified"; MessagesFile: "compiler:Languages\ChineseSimplified.isl" Name: "chinesesimplified"; MessagesFile: "{#RootPath}\windows\ChineseSimplified.isl"
[Tasks] [Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

View File

@@ -1,17 +1,18 @@
import subprocess import subprocess
import os import os
import httpx
os.chdir(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) file = open('pubspec.yaml', 'r')
content = file.read()
file.close()
subprocess.run(["flutter", "build", "windows"], shell=True) subprocess.run(["flutter", "build", "windows"], shell=True)
if os.path.exists("build/app-windows.zip"): version = str.split(str.split(content, 'version: ')[1], '+')[0]
os.remove("build/app-windows.zip")
subprocess.run(["tar", "-a", "-c", "-f", "build/windows/x64/app-windows.zip", "-C", "build/windows/x64/runner/Release", "."] subprocess.run(["tar", "-a", "-c", "-f", f"build/windows/pixes-{version}-windows.zip", "-C", "build/windows/x64/runner/Release", "*"]
, shell=True) , shell=True)
version = str.split(str.split(content, 'version: ')[1], '+')[0]
issContent = "" issContent = ""
file = open('windows/build.iss', 'r') file = open('windows/build.iss', 'r')
issContent = file.read() issContent = file.read()
@@ -23,6 +24,13 @@ file = open('windows/build.iss', 'w')
file.write(newContent) file.write(newContent)
file.close() file.close()
if not os.path.exists("windows/ChineseSimplified.isl"):
# download ChineseSimplified.isl
url = "https://raw.githubusercontent.com/kira-96/Inno-Setup-Chinese-Simplified-Translation/refs/heads/main/ChineseSimplified.isl"
response = httpx.get(url)
with open('windows/ChineseSimplified.isl', 'wb') as file:
file.write(response.content)
subprocess.run(["iscc", "windows/build.iss"], shell=True) subprocess.run(["iscc", "windows/build.iss"], shell=True)
with open('windows/build.iss', 'w') as file: with open('windows/build.iss', 'w') as file: