Skip to content

Commit 6026eea

Browse files
authored
[Windows] Flow version information to the build output (#106145)
Previously developers had to edit their `Runner.rc` file to update their executable's version information. Now, version information will automatically be set from `flutter build`'s arguments or the `pubspec.yaml` file for new projects. Addresses flutter/flutter#73652
1 parent 55011c7 commit 6026eea

File tree

20 files changed

+1090
-33
lines changed

20 files changed

+1090
-33
lines changed

dev/integration_tests/flutter_gallery/windows/runner/CMakeLists.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
cmake_minimum_required(VERSION 3.14)
22
project(runner LANGUAGES CXX)
33

4+
# Define the application target. To change its name, change BINARY_NAME in the
5+
# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer
6+
# work.
7+
#
8+
# Any new source files that you add to the application should be added here.
49
add_executable(${BINARY_NAME} WIN32
510
"flutter_window.cpp"
611
"main.cpp"
@@ -10,8 +15,25 @@ add_executable(${BINARY_NAME} WIN32
1015
"Runner.rc"
1116
"runner.exe.manifest"
1217
)
18+
19+
# Apply the standard set of build settings. This can be removed for applications
20+
# that need different build settings.
1321
apply_standard_settings(${BINARY_NAME})
22+
23+
# Add preprocessor definitions for the build version.
24+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"")
25+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}")
26+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}")
27+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}")
28+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}")
29+
30+
# Disable Windows macros that collide with C++ standard library functions.
1431
target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
32+
33+
# Add dependency libraries and include directories. Add any application-specific
34+
# dependencies here.
1535
target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
1636
target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
37+
38+
# Run the Flutter tool portions of the build. This must not be removed.
1739
add_dependencies(${BINARY_NAME} flutter_assemble)

dev/integration_tests/flutter_gallery/windows/runner/Runner.rc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ END
6060
// Version
6161
//
6262

63-
#ifdef FLUTTER_BUILD_NUMBER
64-
#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER
63+
#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD)
64+
#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD
6565
#else
66-
#define VERSION_AS_NUMBER 1,0,0
66+
#define VERSION_AS_NUMBER 1,0,0,0
6767
#endif
6868

69-
#ifdef FLUTTER_BUILD_NAME
70-
#define VERSION_AS_STRING #FLUTTER_BUILD_NAME
69+
#if defined(FLUTTER_VERSION)
70+
#define VERSION_AS_STRING FLUTTER_VERSION
7171
#else
7272
#define VERSION_AS_STRING "1.0.0"
7373
#endif

dev/manual_tests/windows/runner/CMakeLists.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
cmake_minimum_required(VERSION 3.14)
22
project(runner LANGUAGES CXX)
33

4+
# Define the application target. To change its name, change BINARY_NAME in the
5+
# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer
6+
# work.
7+
#
8+
# Any new source files that you add to the application should be added here.
49
add_executable(${BINARY_NAME} WIN32
510
"flutter_window.cpp"
611
"main.cpp"
@@ -10,8 +15,25 @@ add_executable(${BINARY_NAME} WIN32
1015
"Runner.rc"
1116
"runner.exe.manifest"
1217
)
18+
19+
# Apply the standard set of build settings. This can be removed for applications
20+
# that need different build settings.
1321
apply_standard_settings(${BINARY_NAME})
22+
23+
# Add preprocessor definitions for the build version.
24+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"")
25+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}")
26+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}")
27+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}")
28+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}")
29+
30+
# Disable Windows macros that collide with C++ standard library functions.
1431
target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
32+
33+
# Add dependency libraries and include directories. Add any application-specific
34+
# dependencies here.
1535
target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
1636
target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
37+
38+
# Run the Flutter tool portions of the build. This must not be removed.
1739
add_dependencies(${BINARY_NAME} flutter_assemble)

dev/manual_tests/windows/runner/Runner.rc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ IDI_APP_ICON ICON "resources\\app_icon.ico"
6060
// Version
6161
//
6262

63-
#ifdef FLUTTER_BUILD_NUMBER
64-
#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER
63+
#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD)
64+
#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD
6565
#else
66-
#define VERSION_AS_NUMBER 1,0,0
66+
#define VERSION_AS_NUMBER 1,0,0,0
6767
#endif
6868

69-
#ifdef FLUTTER_BUILD_NAME
70-
#define VERSION_AS_STRING #FLUTTER_BUILD_NAME
69+
#if defined(FLUTTER_VERSION)
70+
#define VERSION_AS_STRING FLUTTER_VERSION
7171
#else
7272
#define VERSION_AS_STRING "1.0.0"
7373
#endif

examples/api/windows/runner/CMakeLists.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
cmake_minimum_required(VERSION 3.14)
22
project(runner LANGUAGES CXX)
33

4+
# Define the application target. To change its name, change BINARY_NAME in the
5+
# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer
6+
# work.
7+
#
8+
# Any new source files that you add to the application should be added here.
49
add_executable(${BINARY_NAME} WIN32
510
"flutter_window.cpp"
611
"main.cpp"
@@ -10,8 +15,25 @@ add_executable(${BINARY_NAME} WIN32
1015
"Runner.rc"
1116
"runner.exe.manifest"
1217
)
18+
19+
# Apply the standard set of build settings. This can be removed for applications
20+
# that need different build settings.
1321
apply_standard_settings(${BINARY_NAME})
22+
23+
# Add preprocessor definitions for the build version.
24+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"")
25+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}")
26+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}")
27+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}")
28+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}")
29+
30+
# Disable Windows macros that collide with C++ standard library functions.
1431
target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
32+
33+
# Add dependency libraries and include directories. Add any application-specific
34+
# dependencies here.
1535
target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
1636
target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
37+
38+
# Run the Flutter tool portions of the build. This must not be removed.
1739
add_dependencies(${BINARY_NAME} flutter_assemble)

examples/api/windows/runner/Runner.rc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ END
6060
// Version
6161
//
6262

63-
#ifdef FLUTTER_BUILD_NUMBER
64-
#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER
63+
#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD)
64+
#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD
6565
#else
66-
#define VERSION_AS_NUMBER 1,0,0
66+
#define VERSION_AS_NUMBER 1,0,0,0
6767
#endif
6868

69-
#ifdef FLUTTER_BUILD_NAME
70-
#define VERSION_AS_STRING #FLUTTER_BUILD_NAME
69+
#if defined(FLUTTER_VERSION)
70+
#define VERSION_AS_STRING FLUTTER_VERSION
7171
#else
7272
#define VERSION_AS_STRING "1.0.0"
7373
#endif

packages/flutter_tools/lib/src/build_info.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,14 @@ class BuildInfo {
9090
/// It is used to determine whether one build is more recent than another, with higher numbers indicating more recent build.
9191
/// On Android it is used as versionCode.
9292
/// On Xcode builds it is used as CFBundleVersion.
93+
/// On Windows it is used as the build suffix for the product and file versions.
9394
final String? buildNumber;
9495

9596
/// A "x.y.z" string used as the version number shown to users.
9697
/// For each new version of your app, you will provide a version number to differentiate it from previous versions.
9798
/// On Android it is used as versionName.
9899
/// On Xcode builds it is used as CFBundleShortVersionString.
100+
/// On Windows it is used as the major, minor, and patch parts of the product and file versions.
99101
final String? buildName;
100102

101103
/// An optional directory path to save debugging information from dwarf stack

packages/flutter_tools/lib/src/cmake.dart

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5+
import 'package:pub_semver/pub_semver.dart';
6+
7+
import 'build_info.dart';
58
import 'cmake_project.dart';
9+
import 'globals.dart' as globals;
610

711
/// Extracts the `BINARY_NAME` from a project's CMake file.
812
///
@@ -25,19 +29,83 @@ String _escapeBackslashes(String s) {
2529
return s.replaceAll(r'\', r'\\');
2630
}
2731

32+
String _determineVersionString(CmakeBasedProject project, BuildInfo buildInfo) {
33+
// Prefer the build arguments for version information.
34+
final String buildName = buildInfo.buildName ?? project.parent.manifest.buildName ?? '1.0.0';
35+
final String? buildNumber = buildInfo.buildName != null
36+
? buildInfo.buildNumber
37+
: (buildInfo.buildNumber ?? project.parent.manifest.buildNumber);
38+
39+
return buildNumber != null
40+
? '$buildName+$buildNumber'
41+
: buildName;
42+
}
43+
44+
Version _determineVersion(CmakeBasedProject project, BuildInfo buildInfo) {
45+
final String version = _determineVersionString(project, buildInfo);
46+
try {
47+
return Version.parse(version);
48+
} on FormatException {
49+
globals.printWarning('Warning: could not parse version $version, defaulting to 1.0.0.');
50+
51+
return Version(1, 0, 0);
52+
}
53+
}
54+
55+
/// Attempts to map a Dart version's build identifier (the part after a +) into
56+
/// a single integer. Returns null for complex build identifiers like `foo` or `1.2`.
57+
int? _tryDetermineBuildVersion(Version version) {
58+
if (version.build.isEmpty) {
59+
return 0;
60+
}
61+
62+
if (version.build.length != 1) {
63+
return null;
64+
}
65+
66+
final Object buildIdentifier = version.build.first as Object;
67+
return buildIdentifier is int ? buildIdentifier : null;
68+
}
69+
2870
/// Writes a generated CMake configuration file for [project], including
2971
/// variables expected by the build template and an environment variable list
3072
/// for calling back into Flutter.
31-
void writeGeneratedCmakeConfig(String flutterRoot, CmakeBasedProject project, Map<String, String> environment) {
73+
void writeGeneratedCmakeConfig(
74+
String flutterRoot,
75+
CmakeBasedProject project,
76+
BuildInfo buildInfo,
77+
Map<String, String> environment) {
3278
// Only a limited set of variables are needed by the CMake files themselves,
3379
// the rest are put into a list to pass to the re-entrant build step.
3480
final String escapedFlutterRoot = _escapeBackslashes(flutterRoot);
3581
final String escapedProjectDir = _escapeBackslashes(project.parent.directory.path);
82+
83+
final Version version = _determineVersion(project, buildInfo);
84+
final int? buildVersion = _tryDetermineBuildVersion(version);
85+
86+
// Since complex Dart build identifiers cannot be converted into integers,
87+
// different Dart versions may be converted into the same Windows numeric version.
88+
// Warn the user as some Windows installers, like MSI, don't update files if their versions are equal.
89+
if (buildVersion == null && project is WindowsProject) {
90+
final String buildIdentifier = version.build.join('.');
91+
globals.printWarning(
92+
'Warning: build identifier $buildIdentifier in version $version is not numeric '
93+
'and cannot be converted into a Windows build version number. Defaulting to 0.\n'
94+
'This may cause issues with Windows installers.'
95+
);
96+
}
97+
3698
final StringBuffer buffer = StringBuffer('''
3799
# Generated code do not commit.
38100
file(TO_CMAKE_PATH "$escapedFlutterRoot" FLUTTER_ROOT)
39101
file(TO_CMAKE_PATH "$escapedProjectDir" PROJECT_DIR)
40102
103+
set(FLUTTER_VERSION "$version" PARENT_SCOPE)
104+
set(FLUTTER_VERSION_MAJOR ${version.major} PARENT_SCOPE)
105+
set(FLUTTER_VERSION_MINOR ${version.minor} PARENT_SCOPE)
106+
set(FLUTTER_VERSION_PATCH ${version.patch} PARENT_SCOPE)
107+
set(FLUTTER_VERSION_BUILD ${buildVersion ?? 0} PARENT_SCOPE)
108+
41109
# Environment variables to pass to tool_backend.sh
42110
list(APPEND FLUTTER_TOOL_ENVIRONMENT
43111
"FLUTTER_ROOT=$escapedFlutterRoot"

packages/flutter_tools/lib/src/commands/build_linux.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ class BuildLinuxCommand extends BuildSubCommand {
2222
}) : _operatingSystemUtils = operatingSystemUtils,
2323
super(verboseHelp: verboseHelp) {
2424
addCommonDesktopBuildOptions(verboseHelp: verboseHelp);
25-
usesBuildNumberOption();
26-
usesBuildNameOption();
2725
final String defaultTargetPlatform =
2826
(_operatingSystemUtils.hostPlatform == HostPlatform.linux_arm64) ?
2927
'linux-arm64' : 'linux-x64';

packages/flutter_tools/lib/src/commands/build_macos.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ class BuildMacosCommand extends BuildSubCommand {
1919
required bool verboseHelp,
2020
}) : super(verboseHelp: verboseHelp) {
2121
addCommonDesktopBuildOptions(verboseHelp: verboseHelp);
22-
usesBuildNumberOption();
23-
usesBuildNameOption();
2422
}
2523

2624
@override

packages/flutter_tools/lib/src/linux/build_linux.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Future<void> buildLinux(
6262
environmentConfig['FLUTTER_ENGINE'] = globals.fs.path.dirname(globals.fs.path.dirname(engineOutPath));
6363
environmentConfig['LOCAL_ENGINE'] = globals.fs.path.basename(engineOutPath);
6464
}
65-
writeGeneratedCmakeConfig(Cache.flutterRoot!, linuxProject, environmentConfig);
65+
writeGeneratedCmakeConfig(Cache.flutterRoot!, linuxProject, buildInfo, environmentConfig);
6666

6767
createPluginSymlinks(linuxProject.parent);
6868

packages/flutter_tools/lib/src/runner/flutter_command.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,8 @@ abstract class FlutterCommand extends Command<void> {
565565
'Each build must have a unique identifier to differentiate it from previous builds.\n'
566566
'It is used to determine whether one build is more recent than another, with higher numbers indicating more recent build.\n'
567567
'On Android it is used as "versionCode".\n'
568-
'On Xcode builds it is used as "CFBundleVersion".',
568+
'On Xcode builds it is used as "CFBundleVersion".\n'
569+
'On Windows it is used as the build suffix for the product and file versions.',
569570
);
570571
}
571572

@@ -574,7 +575,8 @@ abstract class FlutterCommand extends Command<void> {
574575
help: 'A "x.y.z" string used as the version number shown to users.\n'
575576
'For each new version of your app, you will provide a version number to differentiate it from previous versions.\n'
576577
'On Android it is used as "versionName".\n'
577-
'On Xcode builds it is used as "CFBundleShortVersionString".',
578+
'On Xcode builds it is used as "CFBundleShortVersionString".\n'
579+
'On Windows it is used as the major, minor, and patch parts of the product and file versions.',
578580
valueHelp: 'x.y.z');
579581
}
580582

@@ -893,6 +895,8 @@ abstract class FlutterCommand extends Command<void> {
893895
usesPubOption();
894896
usesTargetOption();
895897
usesTrackWidgetCreation(verboseHelp: verboseHelp);
898+
usesBuildNumberOption();
899+
usesBuildNameOption();
896900
}
897901

898902
/// The build mode that this command will use if no build mode is

packages/flutter_tools/lib/src/windows/build_windows.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ void _writeGeneratedFlutterConfig(
206206
environment['FLUTTER_ENGINE'] = globals.fs.path.dirname(globals.fs.path.dirname(engineOutPath));
207207
environment['LOCAL_ENGINE'] = globals.fs.path.basename(engineOutPath);
208208
}
209-
writeGeneratedCmakeConfig(Cache.flutterRoot!, windowsProject, environment);
209+
writeGeneratedCmakeConfig(Cache.flutterRoot!, windowsProject, buildInfo, environment);
210210
}
211211

212212
// Works around the Visual Studio 17.1.0 CMake bug described in

packages/flutter_tools/templates/app/pubspec.yaml.tmpl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
1313
# build by specifying --build-name and --build-number, respectively.
1414
# In Android, build-name is used as versionName while build-number used as versionCode.
1515
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
16-
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
16+
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
1717
# Read more about iOS versioning at
1818
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
19+
# In Windows, build-name is used as the major, minor, and patch parts
20+
# of the product and file versions while build-number is used as the build suffix.
1921
version: 1.0.0+1
2022
{{/withPlatformChannelPluginHook}}
2123

packages/flutter_tools/templates/app_shared/windows.tmpl/runner/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ add_executable(${BINARY_NAME} WIN32
2020
# that need different build settings.
2121
apply_standard_settings(${BINARY_NAME})
2222

23+
# Add preprocessor definitions for the build version.
24+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"")
25+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}")
26+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}")
27+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}")
28+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}")
29+
2330
# Disable Windows macros that collide with C++ standard library functions.
2431
target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
2532

packages/flutter_tools/templates/app_shared/windows.tmpl/runner/Runner.rc.tmpl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ IDI_APP_ICON ICON "resources\\app_icon.ico"
6060
// Version
6161
//
6262

63-
#ifdef FLUTTER_BUILD_NUMBER
64-
#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER
63+
#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD)
64+
#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD
6565
#else
66-
#define VERSION_AS_NUMBER 1,0,0
66+
#define VERSION_AS_NUMBER 1,0,0,0
6767
#endif
6868

69-
#ifdef FLUTTER_BUILD_NAME
70-
#define VERSION_AS_STRING #FLUTTER_BUILD_NAME
69+
#if defined(FLUTTER_VERSION)
70+
#define VERSION_AS_STRING FLUTTER_VERSION
7171
#else
7272
#define VERSION_AS_STRING "1.0.0"
7373
#endif

0 commit comments

Comments
 (0)