mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
opt & fix
- update make script (taget mac) - only set system overlay once
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -49,4 +49,4 @@ SPEC CHECKSUMS:
|
||||
|
||||
PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c
|
||||
|
||||
COCOAPODS: 1.11.2
|
||||
COCOAPODS: 1.11.3
|
||||
|
||||
@@ -354,7 +354,7 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = 135;
|
||||
CURRENT_PROJECT_VERSION = 136;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
@@ -362,7 +362,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.135;
|
||||
MARKETING_VERSION = 1.0.136;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
@@ -484,7 +484,7 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = 135;
|
||||
CURRENT_PROJECT_VERSION = 136;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
@@ -492,7 +492,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.135;
|
||||
MARKETING_VERSION = 1.0.136;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
@@ -508,7 +508,7 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = 135;
|
||||
CURRENT_PROJECT_VERSION = 136;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
@@ -516,7 +516,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.135;
|
||||
MARKETING_VERSION = 1.0.136;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:toolbox/core/utils.dart';
|
||||
import 'package:toolbox/data/res/build_data.dart';
|
||||
import 'package:toolbox/data/store/setting.dart';
|
||||
import 'package:toolbox/generated/l10n.dart';
|
||||
@@ -26,6 +27,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
setTransparentNavigationBar(context);
|
||||
return ValueListenableBuilder<int>(
|
||||
valueListenable: locator<SettingStore>().primaryColor.listenable(),
|
||||
builder: (_, value, __) {
|
||||
|
||||
@@ -75,13 +75,9 @@ Widget buildSwitch(BuildContext context, StoreProperty<bool> prop,
|
||||
void setTransparentNavigationBar(BuildContext context) {
|
||||
if (Platform.isAndroid) {
|
||||
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
|
||||
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
|
||||
statusBarColor: Colors.transparent,
|
||||
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
|
||||
systemNavigationBarColor: Colors.transparent,
|
||||
systemNavigationBarContrastEnforced: true,
|
||||
systemNavigationBarIconBrightness:
|
||||
isDarkMode(context) ? Brightness.light : Brightness.dark,
|
||||
));
|
||||
systemNavigationBarContrastEnforced: true));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ServerBox";
|
||||
static const int build = 135;
|
||||
static const int build = 136;
|
||||
static const String engine =
|
||||
"Flutter 3.0.0 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision ee4e09cce0 (3 days ago) • 2022-05-09 16:45:18 -0700\nEngine • revision d1b9a6938a\nTools • Dart 2.17.0 • DevTools 2.12.2\n";
|
||||
static const String buildAt = "2022-05-13 09:32:15.654170";
|
||||
"Flutter 3.0.0 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision ee4e09cce0 (9 days ago) • 2022-05-09 16:45:18 -0700\nEngine • revision d1b9a6938a\nTools • Dart 2.17.0 • DevTools 2.12.2\n";
|
||||
static const String buildAt = "2022-05-19 15:59:10.728748";
|
||||
static const int modifications = 15;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,6 @@ class _MyHomePageState extends State<MyHomePage>
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
setTransparentNavigationBar(context);
|
||||
super.build(context);
|
||||
return WillPopScope(
|
||||
child: _buildMain(context),
|
||||
|
||||
@@ -31,4 +31,4 @@ SPEC CHECKSUMS:
|
||||
|
||||
PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c
|
||||
|
||||
COCOAPODS: 1.11.2
|
||||
COCOAPODS: 1.11.3
|
||||
|
||||
@@ -420,14 +420,14 @@
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 79;
|
||||
CURRENT_PROJECT_VERSION = 136;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.79;
|
||||
MARKETING_VERSION = 1.0.136;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_VERSION = 5.0;
|
||||
@@ -550,14 +550,14 @@
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 79;
|
||||
CURRENT_PROJECT_VERSION = 136;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.79;
|
||||
MARKETING_VERSION = 1.0.136;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
@@ -574,14 +574,14 @@
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 79;
|
||||
CURRENT_PROJECT_VERSION = 136;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.79;
|
||||
MARKETING_VERSION = 1.0.136;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_VERSION = 5.0;
|
||||
|
||||
64
make.dart
64
make.dart
@@ -6,11 +6,21 @@ 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';
|
||||
const macosAppPath = 'build/macos/Build/Products/Release/$appName.app';
|
||||
var regiOSProjectVer = RegExp(r'CURRENT_PROJECT_VERSION = .+;');
|
||||
var regiOSMarketVer = RegExp(r'MARKETING_VERSION = .+');
|
||||
const iOSInfoPlistPath = 'ios/Runner.xcodeproj/project.pbxproj';
|
||||
const macOSInfoPlistPath = 'macos/Runner.xcodeproj/project.pbxproj';
|
||||
const skslFileSuffix = '.sksl.json';
|
||||
|
||||
const buildFuncs = {
|
||||
'ios': flutterBuildIOS,
|
||||
'macos': flutterBuildMacOS,
|
||||
'android': flutterBuildAndroid,
|
||||
};
|
||||
|
||||
int? build;
|
||||
|
||||
Future<int> getGitCommitCount() async {
|
||||
@@ -87,16 +97,25 @@ void flutterRun(String? mode) {
|
||||
mode: ProcessStartMode.inheritStdio, runInShell: true);
|
||||
}
|
||||
|
||||
Future<void> flutterBuild(String source, String target, bool isAndroid) async {
|
||||
Future<void> flutterBuild(
|
||||
String source, String target, String buildType) async {
|
||||
final args = [
|
||||
'build',
|
||||
isAndroid ? 'apk' : 'ipa',
|
||||
buildType,
|
||||
];
|
||||
// No sksl cache for macos
|
||||
if ('macos' != buildType) {
|
||||
args.add('--bundle-sksl-path=$buildType$skslFileSuffix');
|
||||
}
|
||||
final isAndroid = 'apk' == buildType;
|
||||
// [--target-platform] only for Android
|
||||
if (isAndroid) {
|
||||
args.addAll([
|
||||
'--target-platform=android-arm64',
|
||||
'--build-number=$build',
|
||||
'--build-name=1.0.$build',
|
||||
'--bundle-sksl-path=${isAndroid ? 'android' : 'ios'}$skslFileSuffix',
|
||||
];
|
||||
if (!isAndroid) args.removeAt(2);
|
||||
]);
|
||||
}
|
||||
print('Building with args: ${args.join(' ')}');
|
||||
final buildResult = await Process.run('flutter', args, runInShell: true);
|
||||
final exitCode = buildResult.exitCode;
|
||||
@@ -123,23 +142,30 @@ Future<void> flutterBuild(String source, String target, bool isAndroid) async {
|
||||
}
|
||||
|
||||
Future<void> flutterBuildIOS() async {
|
||||
await changeiOSVersion();
|
||||
await changeInfoPlistVersion();
|
||||
await flutterBuild(
|
||||
xcarchivePath, './release/${appName}_build.xcarchive', false);
|
||||
xcarchivePath, './release/${appName}_ios_build.xcarchive', 'ipa');
|
||||
}
|
||||
|
||||
Future<void> flutterBuildMacOS() async {
|
||||
await changeInfoPlistVersion();
|
||||
await flutterBuild(
|
||||
macosAppPath, './release/${appName}_macos_build.app', 'macos');
|
||||
}
|
||||
|
||||
Future<void> flutterBuildAndroid() async {
|
||||
await flutterBuild('./build/app/outputs/flutter-apk/app-release.apk',
|
||||
'./release/${appName}_build_Arm64.apk', true);
|
||||
await flutterBuild(apkPath, './release/${appName}_build_Arm64.apk', 'apk');
|
||||
}
|
||||
|
||||
Future<void> changeiOSVersion() async {
|
||||
final file = File('ios/Runner.xcodeproj/project.pbxproj');
|
||||
Future<void> changeInfoPlistVersion() async {
|
||||
for (final path in [iOSInfoPlistPath, macOSInfoPlistPath]) {
|
||||
final file = File(path);
|
||||
final contents = await file.readAsString();
|
||||
final newContents = contents
|
||||
.replaceAll(regiOSMarketVer, 'MARKETING_VERSION = 1.0.$build;')
|
||||
.replaceAll(regiOSProjectVer, 'CURRENT_PROJECT_VERSION = $build;');
|
||||
await file.writeAsString(newContents);
|
||||
}
|
||||
}
|
||||
|
||||
void main(List<String> args) async {
|
||||
@@ -155,25 +181,19 @@ void main(List<String> args) async {
|
||||
return flutterRun(args.length == 2 ? args[1] : null);
|
||||
case 'build':
|
||||
final stopwatch = Stopwatch()..start();
|
||||
final buildFunc = [flutterBuildIOS, flutterBuildAndroid];
|
||||
build = await getGitCommitCount();
|
||||
await updateBuildData();
|
||||
await dartFormat();
|
||||
if (args.length > 1) {
|
||||
final platform = args[1];
|
||||
switch (platform) {
|
||||
case 'ios':
|
||||
buildFunc.remove(flutterBuildAndroid);
|
||||
break;
|
||||
case 'android':
|
||||
buildFunc.remove(flutterBuildIOS);
|
||||
break;
|
||||
default:
|
||||
if (buildFuncs.keys.contains(platform)) {
|
||||
await buildFuncs[platform]!();
|
||||
} else {
|
||||
print('Unknown platform: $platform');
|
||||
exit(1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (final func in buildFunc) {
|
||||
for (final func in buildFuncs.values) {
|
||||
await func();
|
||||
}
|
||||
print('Build finished in ${stopwatch.elapsed}');
|
||||
|
||||
Reference in New Issue
Block a user