improve Flutter build commands (#15788)
add --buildNumber and --buildName to flutter build like
flutter build apk --buildNumber=42 --buildName=1.0.42
diff --git a/packages/flutter_tools/lib/src/build_info.dart b/packages/flutter_tools/lib/src/build_info.dart
index 2f9cabf..f0ecb7e 100644
--- a/packages/flutter_tools/lib/src/build_info.dart
+++ b/packages/flutter_tools/lib/src/build_info.dart
@@ -19,6 +19,8 @@
this.targetPlatform,
this.fileSystemRoots,
this.fileSystemScheme,
+ this.buildNumber,
+ this.buildName,
});
final BuildMode mode;
@@ -52,6 +54,19 @@
/// Target platform for the build (e.g. android_arm versus android_arm64).
final TargetPlatform targetPlatform;
+ /// Internal version number (not displayed to users).
+ /// Each build must have a unique number to differentiate it from previous builds.
+ /// It is used to determine whether one build is more recent than another, with higher numbers indicating more recent build.
+ /// On Android it is used as versionCode.
+ /// On Xcode builds it is used as CFBundleVersion.
+ final int buildNumber;
+
+ /// A "x.y.z" string used as the version number shown to users.
+ /// For each new version of your app, you will provide a version number to differentiate it from previous versions.
+ /// On Android it is used as versionName.
+ /// On Xcode builds it is used as CFBundleShortVersionString,
+ final String buildName;
+
static const BuildInfo debug = const BuildInfo(BuildMode.debug, null);
static const BuildInfo profile = const BuildInfo(BuildMode.profile, null);
static const BuildInfo release = const BuildInfo(BuildMode.release, null);