diff --git a/packages/build_flutter/lib/src/app_builder.dart b/packages/build_flutter/lib/src/app_builder.dart index 02c5a16..633a681 100644 --- a/packages/build_flutter/lib/src/app_builder.dart +++ b/packages/build_flutter/lib/src/app_builder.dart @@ -137,6 +137,10 @@ class FlutterAppFlavorBuilder { await build('appbundle'); } + Future buildIosIpa() async { + await build('ipa'); + } + Future buildAndroidAndCopy() async { await buildAndroidApk(); await buildAndroidAab(); @@ -244,13 +248,15 @@ class FlutterAppBuilder { return FlutterAppFlavorBuilder(appBuilder: this, flavor: flavor); }).toList(); } else { - return [defaultFlavorBuild]; + return [defaultFlavorBuilder]; } } - FlutterAppFlavorBuilder get defaultFlavorBuild => + FlutterAppFlavorBuilder get defaultFlavorBuilder => FlutterAppFlavorBuilder(appBuilder: this, flavor: null); + @Deprecated('Use defaultFlavorBuilder') + FlutterAppFlavorBuilder get defaultFlavorBuild => defaultFlavorBuilder; String get apkDeployPath => join(deployPath, 'apk'); String get aabDeployPath => join(deployPath, 'aab'); } diff --git a/packages/build_menu_flutter/lib/src/app_build_menu.dart b/packages/build_menu_flutter/lib/src/app_build_menu.dart index 1efcc40..3d476db 100644 --- a/packages/build_menu_flutter/lib/src/app_build_menu.dart +++ b/packages/build_menu_flutter/lib/src/app_build_menu.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:dev_test/build_support.dart'; import 'package:dev_test/package.dart'; import 'package:path/path.dart'; @@ -38,39 +40,50 @@ void menuFlutterAppFlavorContent( item('clean', () async { await flavorBuilder.clean(); }); - item('build aab', () async { - await androidReady; - await flavorBuilder.buildAndroidAab(); - }); - item('build apk', () async { - await androidReady; - await flavorBuilder.buildAndroidApk(); - }); - item('sha1', () async { - await androidReady; - await printApkSha1(); + menu('ios', () { + item('build ipa', () async { + await flavorBuilder.buildIosIpa(); + }); + item('clean, build ipa', () async { + await flavorBuilder.clean(); + await flavorBuilder.buildIosIpa(); + }); }); - item('apkinfo', () async { - await androidReady; + menu('android', () { + item('build aab', () async { + await androidReady; + await flavorBuilder.buildAndroidAab(); + }); + item('build apk', () async { + await androidReady; + await flavorBuilder.buildAndroidApk(); + }); + item('sha1', () async { + await androidReady; + await printApkSha1(); + }); + item('apkinfo', () async { + await androidReady; - write('apkinfo: ${await flavorBuilder.getApkInfo()}'); - write( - 'apkinfo: ${jsonEncode((await flavorBuilder.getApkInfo()).toMap())}'); - }); - item('build aab & apk and copy', () async { - await androidReady; - await flavorBuilder.buildAndroidAndCopy(); - }); - item('clean, build aab & apk and copy', () async { - await androidReady; - await flavorBuilder.clean(); - await flavorBuilder.buildAndroidAndCopy(); - }); + write('apkinfo: ${await flavorBuilder.getApkInfo()}'); + write( + 'apkinfo: ${jsonEncode((await flavorBuilder.getApkInfo()).toMap())}'); + }); + item('build aab & apk and copy', () async { + await androidReady; + await flavorBuilder.buildAndroidAndCopy(); + }); + item('clean, build aab & apk and copy', () async { + await androidReady; + await flavorBuilder.clean(); + await flavorBuilder.buildAndroidAndCopy(); + }); - item('copy aab & apk', () async { - await androidReady; - await flavorBuilder.copyAndroid(); - await printApkSha1(); + item('copy aab & apk', () async { + await androidReady; + await flavorBuilder.copyAndroid(); + await printApkSha1(); + }); }); }); } @@ -140,6 +153,27 @@ void menuFlutterAppContent({required FlutterAppBuilder builder}) { } }); } + if (Platform.isMacOS) { + menu('ios pod', () { + var iosPath = normalize(absolute(join(appPath, 'ios'))); + item('Delete podfile.lock && Pods', () async { + await File(join(iosPath, 'Podfile.lock')).delete(recursive: true); + await Directory(join(iosPath, 'Pods')).delete(recursive: true); + }); + item('pod install', () async { + var shell = Shell().cd(iosPath); + await shell.run('pod install'); + }); + item('pod install --repo-update', () async { + var shell = Shell().cd(iosPath); + await shell.run('pod install --repo-update'); + }); + item('pod repo update', () async { + var shell = Shell().cd(iosPath); + await shell.run('pod repo update'); + }); + }); + } }); if (builder.context.buildOptions?.flavors?.isNotEmpty ?? false) { menu('flavors', () {