From 500fd7f4544fc3807646d1d87d9d40e7d36ffcf5 Mon Sep 17 00:00:00 2001 From: My-Responsitories <107370289+My-Responsitories@users.noreply.github.com> Date: Sat, 10 Jan 2026 20:20:45 +0800 Subject: [PATCH] mod: fvmrc [skip ci] --- .fvmrc | 3 --- .gitignore | 4 +++- lib/scripts/build.ps1 | 21 +++++++++++++++------ 3 files changed, 18 insertions(+), 10 deletions(-) delete mode 100644 .fvmrc diff --git a/.fvmrc b/.fvmrc deleted file mode 100644 index 45c21240a..000000000 --- a/.fvmrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "flutter": "3.38.6" -} \ No newline at end of file diff --git a/.gitignore b/.gitignore index cb615fd75..5d3b4192a 100644 --- a/.gitignore +++ b/.gitignore @@ -146,4 +146,6 @@ pili_release.json dist -test.dart \ No newline at end of file +test.dart + +.fvmrc \ No newline at end of file diff --git a/lib/scripts/build.ps1 b/lib/scripts/build.ps1 index c37c91012..036b317bc 100644 --- a/lib/scripts/build.ps1 +++ b/lib/scripts/build.ps1 @@ -5,27 +5,36 @@ param( try { $versionName = $null + $flutterVersion = $null + $versionCode = [int](git rev-list --count HEAD).Trim() $commitHash = (git rev-parse HEAD).Trim() $updatedContent = foreach ($line in (Get-Content -Path 'pubspec.yaml' -Encoding UTF8)) { - if ($line -match '^\s*version:\s*([\d\.]+)') { - $versionName = $matches[1] - if ($Arg -eq 'android') { - $versionName += '-' + $commitHash.Substring(0, 9) + if ($line -match '^\s*(version|flutter):\s*([\d\.]+)') { + if ('version' -eq $matches[1]) { + $versionName = $matches[2] + if ('android' -eq $Arg) { + $versionName += '-' + $commitHash.Substring(0, 9) + } + "version: $versionName+$versionCode" + } else { + $flutterVersion = $matches[2] + $line } - "version: $versionName+$versionCode" } else { $line } } - if ($null -eq $versionName) { + if ($null -eq $versionName -or $null -eq $flutterVersion) { throw 'version not found' } + Set-Content -Path '.fvmrc' -Value "{`"flutter`":`"$flutterVersion`"}" + $updatedContent | Set-Content -Path 'pubspec.yaml' -Encoding UTF8 $buildTime = [int]([DateTimeOffset]::Now.ToUnixTimeSeconds())