mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 16:05:18 +00:00

* feat: add build dart script for windows * feat: add android build support * feat: add linux build support * feat: add macos build support * feat: add ios build support * feat: add deps install command and workflow file * cd: what? * cd: what? * cd: what? * cd: update workflow inputs * cd: replace release binary * cd: run flutter pub get * cd: use dpkg zstd instead of xz, windows disable innoInstall, fix channel enum.name and reset pubspec after changing build no for nightly * cd: fix tar copy path * cd: fix copy linux command * cd: fix windows inno depend and fix android aab path * cd: idk * cd: linux why??? * cd: windows choco copy failed * cd: use dart tar archive for creating tar file * cd: fix linux file copy error * cd: use tar command directly * feat: add linux_arm platform * cd: add linux_arm platform * cd: don't know what? * feat: notification about nightly channel update * chore: fix some errors parsing nightly version info
91 lines
2.1 KiB
Dart
91 lines
2.1 KiB
Dart
import 'dart:async';
|
|
import 'dart:io';
|
|
|
|
import 'package:args/command_runner.dart';
|
|
import 'package:collection/collection.dart';
|
|
import 'package:path/path.dart';
|
|
import 'package:xml/xml.dart';
|
|
|
|
import '../../core/env.dart';
|
|
import 'common.dart';
|
|
|
|
class AndroidBuildCommand extends Command with BuildCommandCommonSteps {
|
|
@override
|
|
String get description => "Build for android";
|
|
|
|
@override
|
|
String get name => "android";
|
|
|
|
@override
|
|
FutureOr? run() async {
|
|
await bootstrap();
|
|
|
|
await shell.run(
|
|
"flutter build apk --flavor ${CliEnv.channel.name}",
|
|
);
|
|
|
|
await dotEnvFile.writeAsString(
|
|
"\nENABLE_UPDATE_CHECK=0",
|
|
mode: FileMode.append,
|
|
);
|
|
|
|
final androidManifestFile = File(
|
|
join(cwd.path, "android", "app", "src", "main", "AndroidManifest.xml"));
|
|
|
|
final androidManifestXml =
|
|
XmlDocument.parse(await androidManifestFile.readAsString());
|
|
|
|
final deletingElement =
|
|
androidManifestXml.findAllElements("meta-data").firstWhereOrNull(
|
|
(el) =>
|
|
el.getAttribute("android:name") ==
|
|
"com.google.android.gms.car.application",
|
|
);
|
|
|
|
deletingElement?.parent?.children.remove(deletingElement);
|
|
|
|
await androidManifestFile.writeAsString(
|
|
androidManifestXml.toXmlString(pretty: true),
|
|
);
|
|
|
|
await shell.run(
|
|
"""
|
|
dart run build_runner build --delete-conflicting-outputs
|
|
flutter build appbundle --flavor ${CliEnv.channel.name}
|
|
""",
|
|
);
|
|
|
|
final ogApkFile = File(
|
|
join(
|
|
"build",
|
|
"app",
|
|
"outputs",
|
|
"flutter-apk",
|
|
"app-${CliEnv.channel.name}-release.apk",
|
|
),
|
|
);
|
|
|
|
await ogApkFile.copy(
|
|
join(cwd.path, "build", "Spotube-android-all-arch.apk"),
|
|
);
|
|
|
|
final ogAppbundleFile = File(
|
|
join(
|
|
cwd.path,
|
|
"build",
|
|
"app",
|
|
"outputs",
|
|
"bundle",
|
|
"${CliEnv.channel.name}Release",
|
|
"app-${CliEnv.channel.name}-release.aab",
|
|
),
|
|
);
|
|
|
|
await ogAppbundleFile.copy(
|
|
join(cwd.path, "build", "Spotube-playstore-all-arch.aab"),
|
|
);
|
|
|
|
stdout.writeln("✅ Built Android Apk and Appbundle");
|
|
}
|
|
}
|