Skip to content

Commit

Permalink
⚡ Optimizations Changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
omegaui committed Oct 14, 2024
1 parent 68e2ccc commit da724ee
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 11 additions & 4 deletions lib/io/build_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ class BuildManager {
if (await intermediatesDir.exists()) {
await intermediatesDir.delete(recursive: true);
}
updateState(activeModel!, 'Removing previous builds');
final previousBuilds =
'$repository${Platform.pathSeparator}build${Platform.pathSeparator}app${Platform.pathSeparator}outputs${Platform.pathSeparator}flutter-apk';
final previousBuildsDir = Directory(previousBuilds);
if (await previousBuildsDir.exists()) {
await previousBuildsDir.delete(recursive: true);
}
updateState(activeModel!, 'Generating App Icons');
final flutter =
"$flutterSDKPath${Platform.pathSeparator}bin${Platform.pathSeparator}flutter${Platform.isWindows ? '.bat' : ''}";
Expand Down Expand Up @@ -136,7 +143,10 @@ class BuildManager {
],
workingDirectory: repository,
);
if (result.exitCode != 0) {
final output =
'$repository${Platform.pathSeparator}build${Platform.pathSeparator}app${Platform.pathSeparator}outputs${Platform.pathSeparator}flutter-apk${Platform.pathSeparator}app-release.apk';
final releaseAPK = File(output);
if (!(await releaseAPK.exists())) {
updateState(activeModel!, "Failed to generate application");
waitingModels.clear();
print(result.stdout);
Expand All @@ -149,9 +159,6 @@ class BuildManager {
if (!(await FileSystemEntity.isDirectory(appDir))) {
await Directory(appDir).create(recursive: true);
}
final output =
'$repository${Platform.pathSeparator}build${Platform.pathSeparator}app${Platform.pathSeparator}outputs${Platform.pathSeparator}flutter-apk${Platform.pathSeparator}app-release.apk';
final releaseAPK = File(output);
final secureLocation =
'$appDir${Platform.pathSeparator}${activeModel!.shopName}.apk';
await releaseAPK.rename(secureLocation);
Expand Down
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ packages:
source: hosted
version: "2.4.2"
build_runner:
dependency: "direct main"
dependency: "direct dev"
description:
name: build_runner
sha256: "3ac61a79bfb6f6cc11f693591063a7f19a7af628dc52f141743edac5c16e8c22"
Expand Down

0 comments on commit da724ee

Please sign in to comment.