mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 15:24:35 +01:00
update build script
This commit is contained in:
16
make.dart
16
make.dart
@@ -5,17 +5,15 @@ import 'dart:convert';
|
|||||||
import 'dart:io';
|
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';
|
||||||
const appleXCConfigPath = '/Runner.xcodeproj/project.pbxproj';
|
const appleXCConfigPath = 'Runner.xcodeproj/project.pbxproj';
|
||||||
|
|
||||||
var regAppleProjectVer = RegExp(r'CURRENT_PROJECT_VERSION = .+;');
|
var regAppleProjectVer = RegExp(r'CURRENT_PROJECT_VERSION = .+;');
|
||||||
var regAppleMarketVer = RegExp(r'MARKETING_VERSION = .+');
|
var regAppleMarketVer = RegExp(r'MARKETING_VERSION = .+');
|
||||||
|
|
||||||
const skslFileSuffix = '.sksl.json';
|
|
||||||
|
|
||||||
const buildFuncs = {
|
const buildFuncs = {
|
||||||
'ios': flutterBuildIOS,
|
'ios': flutterBuildIOS,
|
||||||
'android': flutterBuildAndroid,
|
'android': flutterBuildAndroid,
|
||||||
@@ -62,7 +60,8 @@ Future<int> getGitModificationCount() async {
|
|||||||
|
|
||||||
Future<String> getFlutterVersion() async {
|
Future<String> getFlutterVersion() async {
|
||||||
final result = await fvmRun(['flutter', '--version']);
|
final result = await fvmRun(['flutter', '--version']);
|
||||||
return (result.stdout as String);
|
final stdout = result.stdout as String;
|
||||||
|
return stdout.split('\n')[0].split('•')[0].split(' ')[1].trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Map<String, dynamic>> getBuildData() async {
|
Future<Map<String, dynamic>> getBuildData() async {
|
||||||
@@ -109,8 +108,7 @@ Future<void> flutterBuild(
|
|||||||
'build',
|
'build',
|
||||||
buildType,
|
buildType,
|
||||||
];
|
];
|
||||||
// No sksl cache for macos
|
final skslPath = '$buildType.sksl.json';
|
||||||
final skslPath = '$buildType$skslFileSuffix';
|
|
||||||
if (await File(skslPath).exists()) {
|
if (await File(skslPath).exists()) {
|
||||||
args.add('--bundle-sksl-path=$skslPath');
|
args.add('--bundle-sksl-path=$skslPath');
|
||||||
}
|
}
|
||||||
@@ -164,7 +162,7 @@ Future<void> flutterBuildAndroid() async {
|
|||||||
|
|
||||||
Future<void> changeAppleVersion() async {
|
Future<void> changeAppleVersion() async {
|
||||||
for (final path in ['ios', 'macos']) {
|
for (final path in ['ios', 'macos']) {
|
||||||
final file = File(path + appleXCConfigPath);
|
final file = File('$path/$appleXCConfigPath');
|
||||||
final contents = await file.readAsString();
|
final contents = await file.readAsString();
|
||||||
final newContents = contents
|
final newContents = contents
|
||||||
.replaceAll(regAppleMarketVer, 'MARKETING_VERSION = 1.0.$build;')
|
.replaceAll(regAppleMarketVer, 'MARKETING_VERSION = 1.0.$build;')
|
||||||
|
|||||||
Reference in New Issue
Block a user