From ba44649ce114cec720ec39e10578d9cbc69aa1ab Mon Sep 17 00:00:00 2001 From: lollipopkit Date: Mon, 13 Feb 2023 14:49:02 +0800 Subject: [PATCH] fix: #8 --- ios/Runner.xcodeproj/project.pbxproj | 12 +++++------ lib/data/provider/server.dart | 2 +- lib/data/res/build_data.dart | 8 +++---- make.dart | 32 ++++++++++++++++++---------- 4 files changed, 32 insertions(+), 22 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 920e11c4..5d6d23d8 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -356,7 +356,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 215; + CURRENT_PROJECT_VERSION = 216; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -364,7 +364,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.215; + MARKETING_VERSION = 1.0.216; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -486,7 +486,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 215; + CURRENT_PROJECT_VERSION = 216; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -494,7 +494,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.215; + MARKETING_VERSION = 1.0.216; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -510,7 +510,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 215; + CURRENT_PROJECT_VERSION = 216; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -518,7 +518,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.215; + MARKETING_VERSION = 1.0.216; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; diff --git a/lib/data/provider/server.dart b/lib/data/provider/server.dart index b5832458..1f5a5882 100644 --- a/lib/data/provider/server.dart +++ b/lib/data/provider/server.dart @@ -112,9 +112,9 @@ class ServerProvider extends BusyProvider { throw RangeError.index(idx, _servers); } _servers[idx].spi = newSpi; + locator().update(old, newSpi); _servers[idx].client = await genClient(newSpi); notifyListeners(); - locator().update(old, newSpi); refreshData(spi: newSpi); } diff --git a/lib/data/res/build_data.dart b/lib/data/res/build_data.dart index b6021b87..151638b4 100644 --- a/lib/data/res/build_data.dart +++ b/lib/data/res/build_data.dart @@ -2,9 +2,9 @@ class BuildData { static const String name = "ServerBox"; - static const int build = 215; + static const int build = 216; static const String engine = - "Flutter 3.7.0 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision b06b8b2710 (13 days ago) • 2023-01-23 16:55:55 -0800\nEngine • revision b24591ed32\nTools • Dart 2.19.0 • DevTools 2.20.1\n"; - static const String buildAt = "2023-02-05 22:11:13.992594"; - static const int modifications = 9; + "Flutter 3.7.1 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 7048ed95a5 (5 days ago) • 2023-02-01 09:07:31 -0800\nEngine • revision 800594f1f4\nTools • Dart 2.19.1 • DevTools 2.20.1\n"; + static const String buildAt = "2023-02-06 18:02:57.320716"; + static const int modifications = 1; } diff --git a/make.dart b/make.dart index 1cb9dd4e..1450f19f 100755 --- a/make.dart +++ b/make.dart @@ -6,16 +6,20 @@ import 'dart:io'; const appName = 'ServerBox'; const buildDataFilePath = 'lib/data/res/build_data.dart'; + const apkPath = 'build/app/outputs/flutter-apk/app-release.apk'; + const xcarchivePath = 'build/ios/archive/Runner.xcarchive'; -var regiOSProjectVer = RegExp(r'CURRENT_PROJECT_VERSION = .+;'); -var regiOSMarketVer = RegExp(r'MARKETING_VERSION = .+'); -const iOSInfoPlistPath = 'ios/Runner.xcodeproj/project.pbxproj'; +const appleXCConfigPath = '/Runner.xcodeproj/project.pbxproj'; +var regAppleProjectVer = RegExp(r'CURRENT_PROJECT_VERSION = .+;'); +var regAppleMarketVer = RegExp(r'MARKETING_VERSION = .+'); + const skslFileSuffix = '.sksl.json'; const buildFuncs = { 'ios': flutterBuildIOS, 'android': flutterBuildAndroid, + 'macos': flutterBuildMacOS, }; int? build; @@ -146,22 +150,26 @@ Future flutterBuild( } Future flutterBuildIOS() async { - await changeInfoPlistVersion(); await flutterBuild( xcarchivePath, './release/${appName}_ios_build.xcarchive', 'ipa'); } +Future flutterBuildMacOS() async { + await flutterBuild( + xcarchivePath, './release/${appName}_macos_build.xcarchive', 'macos'); +} + Future flutterBuildAndroid() async { await flutterBuild(apkPath, './release/${appName}_build_Arm64.apk', 'apk'); } -Future changeInfoPlistVersion() async { - for (final path in [iOSInfoPlistPath]) { - final file = File(path); +Future changeAppleVersion() async { + for (final path in ['ios', 'macos']) { + final file = File(path + appleXCConfigPath); final contents = await file.readAsString(); final newContents = contents - .replaceAll(regiOSMarketVer, 'MARKETING_VERSION = 1.0.$build;') - .replaceAll(regiOSProjectVer, 'CURRENT_PROJECT_VERSION = $build;'); + .replaceAll(regAppleMarketVer, 'MARKETING_VERSION = 1.0.$build;') + .replaceAll(regAppleProjectVer, 'CURRENT_PROJECT_VERSION = $build;'); await file.writeAsString(newContents); } } @@ -175,17 +183,19 @@ void main(List args) async { final command = args[0]; switch (command) { - case 'run': - return flutterRun(args.length == 2 ? args[1] : null); case 'build': final stopwatch = Stopwatch()..start(); build = await getGitCommitCount(); await updateBuildData(); await dartFormat(); + await changeAppleVersion(); if (args.length > 1) { final platform = args[1]; if (buildFuncs.keys.contains(platform)) { await buildFuncs[platform]!(); + print('Build finished in ${stopwatch.elapsed}'); + stopwatch.reset(); + stopwatch.start(); } else { print('Unknown platform: $platform'); }