JJ_MKVMaker/tool/check_windows_build.ps1

37 lines
3.3 KiB
PowerShell
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# Windows 빌드 판 번호 검사 (관리자 지시 10/17): 시험판이 정식 판과 같은 "v년.월.일_001" 로 보이지 않게.
# - 앱은 Lib\jj_mkvmaker.exe 의 ProductVersion ("2026.10.12+번호") 의 끝 세 자리를 순번으로 보인다 (app_update.dart formatVersion).
# - 시험판: flutter build windows --build-number <년월일 6자리><순번 3자리> (예: 261012972 → "v2026.10.12_972", APK versionCode 와 같은 번호).
# 번호가 1000 보다 작으면 (정식 판 번호, 예: +1) 실패 - 972 Windows 가 +1 로 나가 정식 판 v2026.10.12_001 과 구별되지 않았다.
# - 정식 판 (-Release): 번호가 1000 보다 작아야 한다 (시험 번호가 정식 zip 에 들어가지 않게).
# - 정식 판 (-Release) 의 순번이 900 이상이면 실패 (900 이상은 시험판 순번 - check_apk.ps1 과 같은 규칙, 관리자 지시 10/19).
# 이 검사는 git 태그를 보지 않으므로 시험판 태그를 단 뒤 다시 검사해도 거짓 실패가 없다.
# - 시험판 번호의 날짜는 판 이름 (pubspec) 의 날짜 (관리자 지시 10/20, d3 판단): 2026.10.18+261018987 은 맞고 +261020985 (빌드한 날) 는 실패.
# 근거: ① APK versionCode (판 이름 날짜 × 1000 + 순번) 와 같은 번호가 되어 두 판을 같은 이름으로 견줄 수 있다.
# ② 앱의 판 견주기 (compareVersions) 는 + 뒤 번호 전체를 견준다 - 날짜가 섞이면 같은 판 이름에서 985 (261020985) 가
# 987 (261018987) 보다 새것으로 보인다. 순번은 900 이상 (시험판).
# 사용: powershell -ExecutionPolicy Bypass -File tool\check_windows_build.ps1 -Dir <배포 폴더 (Lib 가 있는 곳)> [-Release]
param(
[Parameter(Mandatory = $true)][string]$Dir,
[switch]$Release
)
$ErrorActionPreference = 'Stop'
$exe = Join-Path (Resolve-Path $Dir).Path 'Lib\jj_mkvmaker.exe'
if (-not (Test-Path $exe)) { throw "앱 실행 파일이 없습니다: $exe" }
$ver = (Get-Item $exe).VersionInfo.ProductVersion
if ($ver -notmatch '^(\d+)\.(\d+)\.(\d+)\+(\d+)$') { throw "판 번호를 읽을 수 없습니다: '$ver' ($exe)" }
$build = [long]$Matches[4]
$shown = '{0}.{1:00}.{2:00}_{3:000}' -f [int]$Matches[1], [int]$Matches[2], [int]$Matches[3], ($build % 1000)
if ($Release) {
if ($build -ge 900) { throw "정식 판인데 시험 번호입니다: $ver (화면 v$shown). --build-number 없이 (pubspec 의 +순번) 빌드하세요" }
} elseif ($build -lt 1000) {
throw ("시험판인데 정식 판 번호입니다: $ver (화면 v$shown - 정식 판과 같게 보임).`n" +
"flutter build windows --release --build-number <판 이름 날짜 6자리><순번 3자리> (예: 261012972) 로 다시 빌드하세요")
} else {
$day = ([long]$Matches[1] % 100) * 10000 + [long]$Matches[2] * 100 + [long]$Matches[3]
if ([math]::Floor($build / 1000) -ne $day -or ($build % 1000) -lt 900) {
throw ("시험판 번호가 판 이름과 맞지 않습니다: $ver - 번호는 판 이름의 날짜 ($day) + 순번 900~999 여야 합니다 (빌드한 날이 아님).`n" +
"flutter build windows --release --build-number $day<순번 3자리> (예: ${day}987) 로 다시 빌드하세요")
}
}
"통과: $ver (화면 v$shown) · $(if ($Release) { '정식 판' } else { '시험판 - 정식 판 번호와 다름' })"