diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..adbe5336 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,68 @@ +name: Flutter Release + +on: + push: + tags: + - "v*" + +permissions: + contents: write + +jobs: + releaseAL: + name: Release android and linux + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install Flutter + uses: subosito/flutter-action@v2 + - name: Build + run: dart run fl_build -p android,linux + - name: Create Release + uses: softprops/action-gh-release@v1 + with: + files: | + build/app/outputs/flutter-apk/${{ env.APP_NAME }}_arm64.apk + build/app/outputs/flutter-apk/${{ env.APP_NAME }}_arm.apk + build/app/outputs/flutter-apk/${{ env.APP_NAME }}_amd64.apk + ${{ env.APP_NAME }}_amd64.AppImage + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # releaseWin: + # name: Release windows + # runs-on: windows-latest + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # - name: Install Flutter + # uses: subosito/flutter-action@v2 + # - name: Build + # run: dart run fl_build -p windows + # - name: Create Release + # uses: softprops/action-gh-release@v1 + # with: + # files: | + # ${{ env.APP_NAME }}_amd64_windows.zip + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # releaseApple: + # name: Release ios and macos + # runs-on: macos-latest + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # - name: Install Flutter + # uses: subosito/flutter-action@v2 + # - name: Build + # run: dart run fl_build -p ios,mac + # - name: Create Release + # uses: softprops/action-gh-release@v1 + # with: + # files: | + # ${{ env.APP_NAME }}_universal_macos.zip + # ${{ env.APP_NAME }}_universal.ipa + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 1915e25c..acdbea48 100644 --- a/.gitignore +++ b/.gitignore @@ -62,3 +62,4 @@ ServerBox-x86_64.AppImage untranlated.json .vscode/settings.json +more_build_data.json diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 9cf61178..938240f1 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -690,7 +690,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 912; + CURRENT_PROJECT_VERSION = 918; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; @@ -700,7 +700,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.912; + MARKETING_VERSION = 1.0.918; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -826,7 +826,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 912; + CURRENT_PROJECT_VERSION = 918; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; @@ -836,7 +836,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.912; + MARKETING_VERSION = 1.0.918; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -854,7 +854,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 912; + CURRENT_PROJECT_VERSION = 918; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; @@ -864,7 +864,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.912; + MARKETING_VERSION = 1.0.918; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -885,7 +885,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 912; + CURRENT_PROJECT_VERSION = 918; DEVELOPMENT_TEAM = BA88US33G6; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; @@ -898,7 +898,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.912; + MARKETING_VERSION = 1.0.918; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; @@ -924,7 +924,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 912; + CURRENT_PROJECT_VERSION = 918; DEVELOPMENT_TEAM = BA88US33G6; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; @@ -937,7 +937,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.912; + MARKETING_VERSION = 1.0.918; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -960,7 +960,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 912; + CURRENT_PROJECT_VERSION = 918; DEVELOPMENT_TEAM = BA88US33G6; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; @@ -973,7 +973,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.912; + MARKETING_VERSION = 1.0.918; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -996,7 +996,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 912; + CURRENT_PROJECT_VERSION = 918; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_PREVIEWS = YES; @@ -1008,7 +1008,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.912; + MARKETING_VERSION = 1.0.918; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd; @@ -1037,7 +1037,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 912; + CURRENT_PROJECT_VERSION = 918; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_PREVIEWS = YES; @@ -1049,7 +1049,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.912; + MARKETING_VERSION = 1.0.918; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd; PRODUCT_NAME = ServerBox; @@ -1075,7 +1075,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 912; + CURRENT_PROJECT_VERSION = 918; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_PREVIEWS = YES; @@ -1087,7 +1087,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.912; + MARKETING_VERSION = 1.0.918; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd; PRODUCT_NAME = ServerBox; diff --git a/lib/data/res/build_data.dart b/lib/data/res/build_data.dart index ab87f35e..bb92098c 100644 --- a/lib/data/res/build_data.dart +++ b/lib/data/res/build_data.dart @@ -1,10 +1,10 @@ -// This file is generated by ./make.dart +// This file is generated by make script. Do not edit. class BuildData { static const String name = "ServerBox"; - static const int build = 912; - static const String engine = "3.22.0"; - static const String buildAt = "2024-05-24 16:29:39"; - static const int modifications = 3; + static const int build = 918; + static const String engine = "3.22.1"; + static const String buildAt = "2024-05-25 19:17:18"; + static const int modifications = 2; static const int script = 48; } diff --git a/lib/data/res/github_id.dart b/lib/data/res/github_id.dart index c54cd7b1..73df0fed 100644 --- a/lib/data/res/github_id.dart +++ b/lib/data/res/github_id.dart @@ -72,5 +72,6 @@ abstract final class GithubIds { 'pgs666', 'FHU-yezi', 'ZRY233', + 'Jasonzhu1207', }; } diff --git a/lib/view/page/backup.dart b/lib/view/page/backup.dart index 7b6d7e7a..7e94b3c2 100644 --- a/lib/view/page/backup.dart +++ b/lib/view/page/backup.dart @@ -70,8 +70,8 @@ class BackupPage extends StatelessWidget { /// Issue #188 switch (Pfs.type) { case Pfs.windows: - final backslashPath = path.replaceAll('/', '\\'); - await Process.run('explorer', ['/select,$backslashPath']); + final backslashPath = path.replaceAll('/', '\\'); + await Process.run('explorer', ['/select,$backslashPath']); case Pfs.linux: await Process.run('xdg-open', [path]); default: diff --git a/lib/view/page/home/appbar.dart b/lib/view/page/home/appbar.dart index 340a487b..79e853b9 100644 --- a/lib/view/page/home/appbar.dart +++ b/lib/view/page/home/appbar.dart @@ -25,7 +25,9 @@ final class _AppBar extends CustomAppBar { return ValBuilder( listenable: selectIndex, builder: (idx) { - if (idx == AppTab.ssh.index && !isWindows && !isLinux) return placeholder; + if (idx == AppTab.ssh.index && !isWindows && !isLinux) { + return placeholder; + } return super.build(context); }, ); diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj index b30d3a98..22ab4192 100644 --- a/macos/Runner.xcodeproj/project.pbxproj +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -471,7 +471,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 912; + CURRENT_PROJECT_VERSION = 918; DEVELOPMENT_TEAM = BA88US33G6; INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = "Server Box"; @@ -481,7 +481,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 1.0.912; + MARKETING_VERSION = 1.0.918; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "Server Box"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -608,7 +608,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 912; + CURRENT_PROJECT_VERSION = 918; DEVELOPMENT_TEAM = BA88US33G6; INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = "Server Box"; @@ -618,7 +618,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 1.0.912; + MARKETING_VERSION = 1.0.918; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "Server Box"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -638,7 +638,7 @@ "CODE_SIGN_IDENTITY[sdk=macosx*]" = "3rd Party Mac Developer Application"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 912; + CURRENT_PROJECT_VERSION = 918; DEVELOPMENT_TEAM = ""; "DEVELOPMENT_TEAM[sdk=macosx*]" = BA88US33G6; INFOPLIST_FILE = Runner/Info.plist; @@ -649,7 +649,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 1.0.912; + MARKETING_VERSION = 1.0.918; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "Server Box"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/make.dart b/make.dart index 8c8e4e96..023fa3f5 100755 --- a/make.dart +++ b/make.dart @@ -4,37 +4,23 @@ import 'dart:convert'; import 'dart:io'; -const appName = 'ServerBox'; -final appNameLower = appName.toLowerCase(); - -const buildDataFilePath = 'lib/data/res/build_data.dart'; -const apkPath = 'build/app/outputs/flutter-apk/app-release.apk'; -const appleXCConfigPath = 'Runner.xcodeproj/project.pbxproj'; -const macOSArchievePath = 'build/macos/Build/Products/Release/server_box.app'; -const releaseDir = '/Volumes/pm981/release/serverbox'; const shellScriptPath = 'lib/data/model/app/shell_func.dart'; -const uploadPathPrefix = 'cda:/var/www/res/'; +const moreBuildDataPath = 'more_build_data.json'; -var regAppleProjectVer = RegExp(r'CURRENT_PROJECT_VERSION = .+;'); -var regAppleMarketVer = RegExp(r'MARKETING_VERSION = .+'); - -const buildFuncs = { - 'ios': flutterBuildIOS, - 'android': flutterBuildAndroid, - 'apk': flutterBuildAndroid, - 'mac': flutterBuildMacOS, - 'linux': flutterBuildLinux, - 'win': flutterBuildWin, -}; - -int? build; - -Future getGitCommitCount() async { - final result = await Process.run('git', ['log', '--format=format:%h']); - build = (result.stdout as String) - .split('\n') - .where((line) => line.isNotEmpty) - .length; +void main(List args) async { + final cmd = args.firstOrNull; + switch (cmd) { + case 'before': + final data = { + 'script': await getScriptCommitCount(), + }; + await File(moreBuildDataPath).writeAsString(json.encode(data)); + break; + case 'after': + // Pass + default: + throw 'Invalid argument: $cmd'; + } } Future getScriptCommitCount() async { @@ -49,276 +35,3 @@ Future getScriptCommitCount() async { .where((line) => line.isNotEmpty) .length; } - -Future writeStaicConfigFile( - Map data, String className, String path) async { - final buffer = StringBuffer(); - buffer.writeln('// This file is generated by ./make.dart'); - buffer.writeln(''); - buffer.writeln('class $className {'); - for (var entry in data.entries) { - final type = entry.value.runtimeType; - final value = json.encode(entry.value); - buffer.writeln(' static const $type ${entry.key} = $value;'); - } - buffer.writeln('}'); - await File(path).writeAsString(buffer.toString()); -} - -Future getGitModificationCount() async { - final result = - await Process.run('git', ['ls-files', '-mo', '--exclude-standard']); - return (result.stdout as String) - .split('\n') - .where((line) => line.isNotEmpty) - .length; -} - -Future getFlutterVersion() async { - final result = await Process.run('flutter', ['--version'], runInShell: true); - final stdout = result.stdout as String; - return stdout.split('\n')[0].split('•')[0].split(' ')[1].trim(); -} - -Future> getBuildData() async { - final data = { - 'name': appName, - 'build': build, - 'engine': await getFlutterVersion(), - 'buildAt': DateTime.now().toString().split('.').firstOrNull, - 'modifications': await getGitModificationCount(), - 'script': await getScriptCommitCount(), - }; - return data; -} - -String jsonEncodeWithIndent(Map json) { - const encoder = JsonEncoder.withIndent(' '); - return encoder.convert(json); -} - -Future updateBuildData() async { - print('Updating BuildData...'); - final data = await getBuildData(); - print(jsonEncodeWithIndent(data)); - await writeStaicConfigFile(data, 'BuildData', buildDataFilePath); -} - -Future dartFormat() async { - final result = await Process.run('dart', ['format', '.'], runInShell: true); - print(result.stdout); - if (result.exitCode != 0) { - print(result.stderr); - exit(1); - } -} - -Future getFileSha256(String path) async { - final result = await Process.run('shasum', ['-a', '256', path]); - final stdout = result.stdout as String; - return stdout.split(' ')[0]; -} - -Future flutterBuild(String buildType) async { - final args = [ - 'build', - buildType, - '--build-number=$build', - '--build-name=1.0.$build', - ]; - final skslPath = '$buildType.sksl.json'; - if (await File(skslPath).exists()) { - args.add('--bundle-sksl-path=$skslPath'); - } - final isAndroid = 'apk' == buildType; - if (isAndroid) { - // Only arm64 - args.add('--target-platform=android-arm64'); - } - print('\n[$buildType]\nBuilding with args: ${args.join(' ')}'); - final buildResult = await Process.run('flutter', args, runInShell: true); - final exitCode = buildResult.exitCode; - - if (exitCode != 0) { - print(buildResult.stdout); - print(buildResult.stderr); - exit(exitCode); - } -} - -Future flutterBuildIOS() async { - await flutterBuild('ipa'); -} - -Future flutterBuildMacOS() async { - await flutterBuild('macos'); -} - -Future flutterBuildAndroid() async { - await flutterBuild('apk'); - await killJava(); - await scpApk2CDN(); -} - -Future flutterBuildLinux() async { - await flutterBuild('linux'); - const appDirName = 'linux.AppDir'; - // cp -r build/linux/x64/release/bundle/* appName.AppDir - await Process.run('cp', [ - '-r', - 'build/linux/x64/release/bundle', - appDirName, - ]); - // cp -r assets/app_icon.png ServerBox.AppDir - await Process.run('cp', [ - '-r', - './assets/app_icon.png', - appDirName, - ]); - // Create AppRun - const appRun = ''' -#!/bin/sh -cd "\$(dirname "\$0")" -exec ./$appName -'''; - const appRunName = '$appDirName/AppRun'; - await File(appRunName).writeAsString(appRun); - // chmod +x AppRun - await Process.run('chmod', ['+x', appRunName]); - // Create .desktop - const desktop = ''' -[Desktop Entry] -Name=$appName -Exec=$appName -Icon=app_icon -Type=Application -Categories=Utility; -'''; - await File('$appDirName/default.desktop').writeAsString(desktop); - // Run appimagetool - await Process.run('sh', ['-c', 'ARCH=x86_64 appimagetool $appDirName']); - - await scpLinux2CDN(); -} - -Future flutterBuildWin() async { - await flutterBuild('windows'); - //await scpWindows2CDN(); -} - -Future scpApk2CDN() async { - final result = await Process.run( - 'scp', - [apkPath, '$uploadPathPrefix$appNameLower/$appName-$build.apk'], - runInShell: true, - ); - if (result.exitCode != 0) { - print(result.stderr); - exit(1); - } - print('Upload $build.apk finished.'); -} - -Future scpLinux2CDN() async { - final result = await Process.run( - 'scp', - [ - '$appName-x86_64.AppImage', - '$uploadPathPrefix$appNameLower/$appName-$build.AppImage', - ], - runInShell: true, - ); - if (result.exitCode != 0) { - print(result.stderr); - exit(1); - } - print('Upload $build.AppImage finished.'); -} - -Future scpWindows2CDN() async { - final result = await Process.run( - 'scp', - [ - './build/windows/runner/Release/$appName.zip', - '$uploadPathPrefix$appNameLower/$appName-$build.zip', - ], - runInShell: true, - ); - if (result.exitCode != 0) { - print(result.stderr); - exit(1); - } - print('Upload $build.zip finished.'); -} - -Future changeAppleVersion() async { - for (final path in ['ios', 'macos']) { - final file = File('$path/$appleXCConfigPath'); - final contents = await file.readAsString(); - final newContents = contents - .replaceAll(regAppleMarketVer, 'MARKETING_VERSION = 1.0.$build;') - .replaceAll(regAppleProjectVer, 'CURRENT_PROJECT_VERSION = $build;'); - await file.writeAsString(newContents); - } -} - -Future killJava() async { - /// Due to the high cost of Mac memory, - /// terminate Java processes to free up memory. - /// :) - if (!Platform.isMacOS) return; - final result = await Process.run('ps', ['-A']); - final lines = (result.stdout as String).split('\n'); - for (final line in lines) { - if (line.contains('java')) { - final pid = line.split(' ')[0]; - print('Killing java process: $pid'); - await Process.run('kill', [pid]); - } - } -} - -void main(List args) async { - if (args.isEmpty) { - print('No action. Exit.'); - return; - } - - final command = args[0]; - switch (command) { - case 'build': - await dartFormat(); - await getGitCommitCount(); - // always change version to avoid dismatch version between different - // platforms - await changeAppleVersion(); - await updateBuildData(); - - final funcs = Function()>[]; - - if (args.length > 1) { - final platforms = args[1]; - for (final platform in platforms.split(',')) { - if (buildFuncs.keys.contains(platform)) { - funcs.add(buildFuncs[platform]!); - } else { - print('Unknown platform: $platform'); - } - } - } else { - funcs.addAll(buildFuncs.values); - } - - final stopwatch = Stopwatch(); - for (final func in funcs) { - stopwatch.start(); - await func(); - print('Build finished in ${stopwatch.elapsed}'); - stopwatch.reset(); - } - break; - default: - print('Unsupported command: $command'); - break; - } -} diff --git a/make.json b/make.json new file mode 100644 index 00000000..96f39413 --- /dev/null +++ b/make.json @@ -0,0 +1,4 @@ +{ + "appName": "ServerBox", + "beforeBuild": "./make.dart before" +} \ No newline at end of file diff --git a/pubspec.lock b/pubspec.lock index 8e14a403..0276a31a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -388,6 +388,15 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.0" + fl_build: + dependency: "direct dev" + description: + path: "." + ref: "8e1e3500fac2a39a43bed68aeb3cbdf792a1bd35" + resolved-ref: "8e1e3500fac2a39a43bed68aeb3cbdf792a1bd35" + url: "https://github.com/lollipopkit/fl_build.git" + source: git + version: "1.0.0" fl_chart: dependency: "direct main" description: @@ -650,7 +659,7 @@ packages: source: hosted version: "2.2.0" icons_plus: - dependency: "direct main" + dependency: transitive description: name: icons_plus sha256: "8e2f601b8605d45dd55b106a0da084a1809125077a49574ca22e8bcd5b6e86f0" diff --git a/pubspec.yaml b/pubspec.yaml index 052bea56..a6dca24d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -47,7 +47,6 @@ dependencies: ref: master url: https://github.com/lollipopkit/dart_computer flutter_background_service: ^5.0.5 - icons_plus: ^5.0.0 fl_chart: ^0.67.0 wakelock_plus: ^1.2.4 extended_image: ^8.2.0 @@ -74,6 +73,11 @@ dev_dependencies: flutter_lints: ^3.0.0 flutter_test: sdk: flutter + fl_build: + # path: ../fl_build + git: + url: https://github.com/lollipopkit/fl_build.git + ref: 8e1e3500fac2a39a43bed68aeb3cbdf792a1bd35 flutter: generate: true