This commit is contained in:
lollipopkit
2023-02-13 14:49:02 +08:00
parent e7b1773e5c
commit ba44649ce1
4 changed files with 32 additions and 22 deletions

View File

@@ -356,7 +356,7 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 215; CURRENT_PROJECT_VERSION = 216;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
@@ -364,7 +364,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.215; MARKETING_VERSION = 1.0.216;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -486,7 +486,7 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 215; CURRENT_PROJECT_VERSION = 216;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
@@ -494,7 +494,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.215; MARKETING_VERSION = 1.0.216;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -510,7 +510,7 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 215; CURRENT_PROJECT_VERSION = 216;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
@@ -518,7 +518,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.215; MARKETING_VERSION = 1.0.216;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";

View File

@@ -112,9 +112,9 @@ class ServerProvider extends BusyProvider {
throw RangeError.index(idx, _servers); throw RangeError.index(idx, _servers);
} }
_servers[idx].spi = newSpi; _servers[idx].spi = newSpi;
locator<ServerStore>().update(old, newSpi);
_servers[idx].client = await genClient(newSpi); _servers[idx].client = await genClient(newSpi);
notifyListeners(); notifyListeners();
locator<ServerStore>().update(old, newSpi);
refreshData(spi: newSpi); refreshData(spi: newSpi);
} }

View File

@@ -2,9 +2,9 @@
class BuildData { class BuildData {
static const String name = "ServerBox"; static const String name = "ServerBox";
static const int build = 215; static const int build = 216;
static const String engine = 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"; "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-05 22:11:13.992594"; static const String buildAt = "2023-02-06 18:02:57.320716";
static const int modifications = 9; static const int modifications = 1;
} }

View File

@@ -6,16 +6,20 @@ import 'dart:io';
const appName = 'ServerBox'; const appName = 'ServerBox';
const buildDataFilePath = 'lib/data/res/build_data.dart'; const buildDataFilePath = 'lib/data/res/build_data.dart';
const apkPath = 'build/app/outputs/flutter-apk/app-release.apk'; const apkPath = 'build/app/outputs/flutter-apk/app-release.apk';
const xcarchivePath = 'build/ios/archive/Runner.xcarchive'; const xcarchivePath = 'build/ios/archive/Runner.xcarchive';
var regiOSProjectVer = RegExp(r'CURRENT_PROJECT_VERSION = .+;'); const appleXCConfigPath = '/Runner.xcodeproj/project.pbxproj';
var regiOSMarketVer = RegExp(r'MARKETING_VERSION = .+'); var regAppleProjectVer = RegExp(r'CURRENT_PROJECT_VERSION = .+;');
const iOSInfoPlistPath = 'ios/Runner.xcodeproj/project.pbxproj'; var regAppleMarketVer = RegExp(r'MARKETING_VERSION = .+');
const skslFileSuffix = '.sksl.json'; const skslFileSuffix = '.sksl.json';
const buildFuncs = { const buildFuncs = {
'ios': flutterBuildIOS, 'ios': flutterBuildIOS,
'android': flutterBuildAndroid, 'android': flutterBuildAndroid,
'macos': flutterBuildMacOS,
}; };
int? build; int? build;
@@ -146,22 +150,26 @@ Future<void> flutterBuild(
} }
Future<void> flutterBuildIOS() async { Future<void> flutterBuildIOS() async {
await changeInfoPlistVersion();
await flutterBuild( await flutterBuild(
xcarchivePath, './release/${appName}_ios_build.xcarchive', 'ipa'); xcarchivePath, './release/${appName}_ios_build.xcarchive', 'ipa');
} }
Future<void> flutterBuildMacOS() async {
await flutterBuild(
xcarchivePath, './release/${appName}_macos_build.xcarchive', 'macos');
}
Future<void> flutterBuildAndroid() async { Future<void> flutterBuildAndroid() async {
await flutterBuild(apkPath, './release/${appName}_build_Arm64.apk', 'apk'); await flutterBuild(apkPath, './release/${appName}_build_Arm64.apk', 'apk');
} }
Future<void> changeInfoPlistVersion() async { Future<void> changeAppleVersion() async {
for (final path in [iOSInfoPlistPath]) { for (final path in ['ios', 'macos']) {
final file = File(path); final file = File(path + appleXCConfigPath);
final contents = await file.readAsString(); final contents = await file.readAsString();
final newContents = contents final newContents = contents
.replaceAll(regiOSMarketVer, 'MARKETING_VERSION = 1.0.$build;') .replaceAll(regAppleMarketVer, 'MARKETING_VERSION = 1.0.$build;')
.replaceAll(regiOSProjectVer, 'CURRENT_PROJECT_VERSION = $build;'); .replaceAll(regAppleProjectVer, 'CURRENT_PROJECT_VERSION = $build;');
await file.writeAsString(newContents); await file.writeAsString(newContents);
} }
} }
@@ -175,17 +183,19 @@ void main(List<String> args) async {
final command = args[0]; final command = args[0];
switch (command) { switch (command) {
case 'run':
return flutterRun(args.length == 2 ? args[1] : null);
case 'build': case 'build':
final stopwatch = Stopwatch()..start(); final stopwatch = Stopwatch()..start();
build = await getGitCommitCount(); build = await getGitCommitCount();
await updateBuildData(); await updateBuildData();
await dartFormat(); await dartFormat();
await changeAppleVersion();
if (args.length > 1) { if (args.length > 1) {
final platform = args[1]; final platform = args[1];
if (buildFuncs.keys.contains(platform)) { if (buildFuncs.keys.contains(platform)) {
await buildFuncs[platform]!(); await buildFuncs[platform]!();
print('Build finished in ${stopwatch.elapsed}');
stopwatch.reset();
stopwatch.start();
} else { } else {
print('Unknown platform: $platform'); print('Unknown platform: $platform');
} }