[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 https://github.com/flutter/flutter/issues/73652
This commit is contained in:
@@ -447,6 +447,11 @@ ERROR: No file or variants found for asset: images/a_dot_burr.jpeg
|
||||
expect(configLines, containsAll(<String>[
|
||||
'file(TO_CMAKE_PATH "$_kTestFlutterRoot" FLUTTER_ROOT)',
|
||||
'file(TO_CMAKE_PATH "${fileSystem.currentDirectory.path}" PROJECT_DIR)',
|
||||
'set(FLUTTER_VERSION "1.0.0" PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MAJOR 1 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MINOR 0 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_PATCH 0 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_BUILD 0 PARENT_SCOPE)',
|
||||
' "DART_DEFINES=Zm9vLmJhcj0y,Zml6ei5mYXI9Mw=="',
|
||||
' "DART_OBFUSCATION=true"',
|
||||
' "EXTRA_FRONT_END_OPTIONS=--enable-experiment=non-nullable"',
|
||||
|
||||
@@ -472,6 +472,11 @@ if %errorlevel% neq 0 goto :VCEnd</Command>
|
||||
expect(configLines, containsAll(<String>[
|
||||
r'file(TO_CMAKE_PATH "C:\\flutter" FLUTTER_ROOT)',
|
||||
r'file(TO_CMAKE_PATH "C:\\" PROJECT_DIR)',
|
||||
r'set(FLUTTER_VERSION "1.0.0" PARENT_SCOPE)',
|
||||
r'set(FLUTTER_VERSION_MAJOR 1 PARENT_SCOPE)',
|
||||
r'set(FLUTTER_VERSION_MINOR 0 PARENT_SCOPE)',
|
||||
r'set(FLUTTER_VERSION_PATCH 0 PARENT_SCOPE)',
|
||||
r'set(FLUTTER_VERSION_BUILD 0 PARENT_SCOPE)',
|
||||
r' "DART_DEFINES=Zm9vPWE=,YmFyPWI="',
|
||||
r' "DART_OBFUSCATION=true"',
|
||||
r' "EXTRA_FRONT_END_OPTIONS=--enable-experiment=non-nullable"',
|
||||
@@ -535,6 +540,338 @@ if %errorlevel% neq 0 goto :VCEnd</Command>
|
||||
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
|
||||
});
|
||||
|
||||
testUsingContext("Windows build uses pubspec's version", () async {
|
||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
||||
final BuildWindowsCommand command = BuildWindowsCommand()
|
||||
..visualStudioOverride = fakeVisualStudio;
|
||||
setUpMockProjectFilesForBuild();
|
||||
|
||||
fileSystem.file('pubspec.yaml')
|
||||
..createSync()
|
||||
..writeAsStringSync('version: 1.2.3+4');
|
||||
|
||||
processManager = FakeProcessManager.list(<FakeCommand>[
|
||||
cmakeGenerationCommand(),
|
||||
buildCommand('Release'),
|
||||
]);
|
||||
|
||||
await createTestCommandRunner(command).run(
|
||||
const <String>[
|
||||
'windows',
|
||||
'--no-pub',
|
||||
]
|
||||
);
|
||||
|
||||
final File cmakeConfig = fileSystem.currentDirectory
|
||||
.childDirectory('windows')
|
||||
.childDirectory('flutter')
|
||||
.childDirectory('ephemeral')
|
||||
.childFile('generated_config.cmake');
|
||||
|
||||
expect(cmakeConfig, exists);
|
||||
|
||||
final List<String> configLines = cmakeConfig.readAsLinesSync();
|
||||
|
||||
expect(configLines, containsAll(<String>[
|
||||
'set(FLUTTER_VERSION "1.2.3+4" PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MAJOR 1 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MINOR 2 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_PATCH 3 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_BUILD 4 PARENT_SCOPE)',
|
||||
]));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => processManager,
|
||||
Platform: () => windowsPlatform,
|
||||
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
|
||||
});
|
||||
|
||||
testUsingContext('Windows build uses build-name and build-number', () async {
|
||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
||||
final BuildWindowsCommand command = BuildWindowsCommand()
|
||||
..visualStudioOverride = fakeVisualStudio;
|
||||
setUpMockProjectFilesForBuild();
|
||||
|
||||
processManager = FakeProcessManager.list(<FakeCommand>[
|
||||
cmakeGenerationCommand(),
|
||||
buildCommand('Release'),
|
||||
]);
|
||||
|
||||
await createTestCommandRunner(command).run(
|
||||
const <String>[
|
||||
'windows',
|
||||
'--no-pub',
|
||||
'--build-name=1.2.3',
|
||||
'--build-number=4',
|
||||
]
|
||||
);
|
||||
|
||||
final File cmakeConfig = fileSystem.currentDirectory
|
||||
.childDirectory('windows')
|
||||
.childDirectory('flutter')
|
||||
.childDirectory('ephemeral')
|
||||
.childFile('generated_config.cmake');
|
||||
|
||||
expect(cmakeConfig, exists);
|
||||
|
||||
final List<String> configLines = cmakeConfig.readAsLinesSync();
|
||||
|
||||
expect(configLines, containsAll(<String>[
|
||||
'set(FLUTTER_VERSION "1.2.3+4" PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MAJOR 1 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MINOR 2 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_PATCH 3 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_BUILD 4 PARENT_SCOPE)',
|
||||
]));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => processManager,
|
||||
Platform: () => windowsPlatform,
|
||||
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
|
||||
});
|
||||
|
||||
testUsingContext('Windows build build-name overrides pubspec', () async {
|
||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
||||
final BuildWindowsCommand command = BuildWindowsCommand()
|
||||
..visualStudioOverride = fakeVisualStudio;
|
||||
setUpMockProjectFilesForBuild();
|
||||
|
||||
fileSystem.file('pubspec.yaml')
|
||||
..createSync()
|
||||
..writeAsStringSync('version: 9.9.9+9');
|
||||
|
||||
processManager = FakeProcessManager.list(<FakeCommand>[
|
||||
cmakeGenerationCommand(),
|
||||
buildCommand('Release'),
|
||||
]);
|
||||
|
||||
await createTestCommandRunner(command).run(
|
||||
const <String>[
|
||||
'windows',
|
||||
'--no-pub',
|
||||
'--build-name=1.2.3',
|
||||
]
|
||||
);
|
||||
|
||||
final File cmakeConfig = fileSystem.currentDirectory
|
||||
.childDirectory('windows')
|
||||
.childDirectory('flutter')
|
||||
.childDirectory('ephemeral')
|
||||
.childFile('generated_config.cmake');
|
||||
|
||||
expect(cmakeConfig, exists);
|
||||
|
||||
final List<String> configLines = cmakeConfig.readAsLinesSync();
|
||||
|
||||
expect(configLines, containsAll(<String>[
|
||||
'set(FLUTTER_VERSION "1.2.3" PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MAJOR 1 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MINOR 2 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_PATCH 3 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_BUILD 0 PARENT_SCOPE)',
|
||||
]));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => processManager,
|
||||
Platform: () => windowsPlatform,
|
||||
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
|
||||
});
|
||||
|
||||
testUsingContext('Windows build build-number overrides pubspec', () async {
|
||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
||||
final BuildWindowsCommand command = BuildWindowsCommand()
|
||||
..visualStudioOverride = fakeVisualStudio;
|
||||
setUpMockProjectFilesForBuild();
|
||||
|
||||
fileSystem.file('pubspec.yaml')
|
||||
..createSync()
|
||||
..writeAsStringSync('version: 1.2.3+9');
|
||||
|
||||
processManager = FakeProcessManager.list(<FakeCommand>[
|
||||
cmakeGenerationCommand(),
|
||||
buildCommand('Release'),
|
||||
]);
|
||||
|
||||
await createTestCommandRunner(command).run(
|
||||
const <String>[
|
||||
'windows',
|
||||
'--no-pub',
|
||||
'--build-number=4',
|
||||
]
|
||||
);
|
||||
|
||||
final File cmakeConfig = fileSystem.currentDirectory
|
||||
.childDirectory('windows')
|
||||
.childDirectory('flutter')
|
||||
.childDirectory('ephemeral')
|
||||
.childFile('generated_config.cmake');
|
||||
|
||||
expect(cmakeConfig, exists);
|
||||
|
||||
final List<String> configLines = cmakeConfig.readAsLinesSync();
|
||||
|
||||
expect(configLines, containsAll(<String>[
|
||||
'set(FLUTTER_VERSION "1.2.3+4" PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MAJOR 1 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MINOR 2 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_PATCH 3 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_BUILD 4 PARENT_SCOPE)',
|
||||
]));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => processManager,
|
||||
Platform: () => windowsPlatform,
|
||||
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
|
||||
});
|
||||
|
||||
testUsingContext('Windows build build-name and build-number override pubspec', () async {
|
||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
||||
final BuildWindowsCommand command = BuildWindowsCommand()
|
||||
..visualStudioOverride = fakeVisualStudio;
|
||||
setUpMockProjectFilesForBuild();
|
||||
|
||||
fileSystem.file('pubspec.yaml')
|
||||
..createSync()
|
||||
..writeAsStringSync('version: 9.9.9+9');
|
||||
|
||||
processManager = FakeProcessManager.list(<FakeCommand>[
|
||||
cmakeGenerationCommand(),
|
||||
buildCommand('Release'),
|
||||
]);
|
||||
|
||||
await createTestCommandRunner(command).run(
|
||||
const <String>[
|
||||
'windows',
|
||||
'--no-pub',
|
||||
'--build-name=1.2.3',
|
||||
'--build-number=4',
|
||||
]
|
||||
);
|
||||
|
||||
final File cmakeConfig = fileSystem.currentDirectory
|
||||
.childDirectory('windows')
|
||||
.childDirectory('flutter')
|
||||
.childDirectory('ephemeral')
|
||||
.childFile('generated_config.cmake');
|
||||
|
||||
expect(cmakeConfig, exists);
|
||||
|
||||
final List<String> configLines = cmakeConfig.readAsLinesSync();
|
||||
|
||||
expect(configLines, containsAll(<String>[
|
||||
'set(FLUTTER_VERSION "1.2.3+4" PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MAJOR 1 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MINOR 2 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_PATCH 3 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_BUILD 4 PARENT_SCOPE)',
|
||||
]));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => processManager,
|
||||
Platform: () => windowsPlatform,
|
||||
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
|
||||
});
|
||||
|
||||
testUsingContext('Windows build warns on non-numeric build-number', () async {
|
||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
||||
final BuildWindowsCommand command = BuildWindowsCommand()
|
||||
..visualStudioOverride = fakeVisualStudio;
|
||||
setUpMockProjectFilesForBuild();
|
||||
|
||||
processManager = FakeProcessManager.list(<FakeCommand>[
|
||||
cmakeGenerationCommand(),
|
||||
buildCommand('Release'),
|
||||
]);
|
||||
|
||||
await createTestCommandRunner(command).run(
|
||||
const <String>[
|
||||
'windows',
|
||||
'--no-pub',
|
||||
'--build-name=1.2.3',
|
||||
'--build-number=hello',
|
||||
]
|
||||
);
|
||||
|
||||
final File cmakeConfig = fileSystem.currentDirectory
|
||||
.childDirectory('windows')
|
||||
.childDirectory('flutter')
|
||||
.childDirectory('ephemeral')
|
||||
.childFile('generated_config.cmake');
|
||||
|
||||
expect(cmakeConfig, exists);
|
||||
|
||||
final List<String> configLines = cmakeConfig.readAsLinesSync();
|
||||
|
||||
expect(configLines, containsAll(<String>[
|
||||
'set(FLUTTER_VERSION "1.2.3+hello" PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MAJOR 1 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MINOR 2 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_PATCH 3 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_BUILD 0 PARENT_SCOPE)',
|
||||
]));
|
||||
|
||||
expect(testLogger.warningText, contains(
|
||||
'Warning: build identifier hello in version 1.2.3+hello is not numeric and '
|
||||
'cannot be converted into a Windows build version number. Defaulting to 0.\n'
|
||||
'This may cause issues with Windows installers.'
|
||||
));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => processManager,
|
||||
Platform: () => windowsPlatform,
|
||||
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
|
||||
});
|
||||
|
||||
testUsingContext('Windows build warns on complex build-number', () async {
|
||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
||||
final BuildWindowsCommand command = BuildWindowsCommand()
|
||||
..visualStudioOverride = fakeVisualStudio;
|
||||
setUpMockProjectFilesForBuild();
|
||||
|
||||
processManager = FakeProcessManager.list(<FakeCommand>[
|
||||
cmakeGenerationCommand(),
|
||||
buildCommand('Release'),
|
||||
]);
|
||||
|
||||
await createTestCommandRunner(command).run(
|
||||
const <String>[
|
||||
'windows',
|
||||
'--no-pub',
|
||||
'--build-name=1.2.3',
|
||||
'--build-number=4.5',
|
||||
]
|
||||
);
|
||||
|
||||
final File cmakeConfig = fileSystem.currentDirectory
|
||||
.childDirectory('windows')
|
||||
.childDirectory('flutter')
|
||||
.childDirectory('ephemeral')
|
||||
.childFile('generated_config.cmake');
|
||||
|
||||
expect(cmakeConfig, exists);
|
||||
|
||||
final List<String> configLines = cmakeConfig.readAsLinesSync();
|
||||
|
||||
expect(configLines, containsAll(<String>[
|
||||
'set(FLUTTER_VERSION "1.2.3+4.5" PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MAJOR 1 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MINOR 2 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_PATCH 3 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_BUILD 0 PARENT_SCOPE)',
|
||||
]));
|
||||
|
||||
expect(testLogger.warningText, contains(
|
||||
'Warning: build identifier 4.5 in version 1.2.3+4.5 is not numeric and '
|
||||
'cannot be converted into a Windows build version number. Defaulting to 0.\n'
|
||||
'This may cause issues with Windows installers.'
|
||||
));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => processManager,
|
||||
Platform: () => windowsPlatform,
|
||||
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
|
||||
});
|
||||
|
||||
testUsingContext('hidden when not enabled on Windows host', () {
|
||||
expect(BuildWindowsCommand().hidden, true);
|
||||
}, overrides: <Type, Generator>{
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
import 'package:file/memory.dart';
|
||||
import 'package:file_testing/file_testing.dart';
|
||||
import 'package:flutter_tools/src/base/file_system.dart';
|
||||
import 'package:flutter_tools/src/base/logger.dart';
|
||||
import 'package:flutter_tools/src/build_info.dart';
|
||||
import 'package:flutter_tools/src/cmake.dart';
|
||||
import 'package:flutter_tools/src/project.dart';
|
||||
|
||||
@@ -17,10 +19,12 @@ const String _kTestWindowsFlutterRoot = r'C:\flutter';
|
||||
void main() {
|
||||
late FileSystem fileSystem;
|
||||
late ProcessManager processManager;
|
||||
late BufferLogger logger;
|
||||
|
||||
setUp(() {
|
||||
processManager = FakeProcessManager.any();
|
||||
fileSystem = MemoryFileSystem.test();
|
||||
logger = BufferLogger.test();
|
||||
});
|
||||
|
||||
testUsingContext('parses executable name from cmake file', () async {
|
||||
@@ -54,11 +58,13 @@ void main() {
|
||||
testUsingContext('generates config', () async {
|
||||
final FlutterProject project = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
||||
final CmakeBasedProject cmakeProject = _FakeProject.fromFlutter(project);
|
||||
const BuildInfo buildInfo = BuildInfo(BuildMode.release, null, treeShakeIcons: false);
|
||||
final Map<String, String> environment = <String, String>{};
|
||||
|
||||
writeGeneratedCmakeConfig(
|
||||
_kTestFlutterRoot,
|
||||
cmakeProject,
|
||||
buildInfo,
|
||||
environment,
|
||||
);
|
||||
|
||||
@@ -73,6 +79,12 @@ void main() {
|
||||
r'file(TO_CMAKE_PATH "/flutter" FLUTTER_ROOT)',
|
||||
r'file(TO_CMAKE_PATH "/" PROJECT_DIR)',
|
||||
|
||||
r'set(FLUTTER_VERSION "1.0.0" PARENT_SCOPE)',
|
||||
r'set(FLUTTER_VERSION_MAJOR 1 PARENT_SCOPE)',
|
||||
r'set(FLUTTER_VERSION_MINOR 0 PARENT_SCOPE)',
|
||||
r'set(FLUTTER_VERSION_PATCH 0 PARENT_SCOPE)',
|
||||
r'set(FLUTTER_VERSION_BUILD 0 PARENT_SCOPE)',
|
||||
|
||||
r'# Environment variables to pass to tool_backend.sh',
|
||||
r'list(APPEND FLUTTER_TOOL_ENVIRONMENT',
|
||||
r' "FLUTTER_ROOT=/flutter"',
|
||||
@@ -89,6 +101,7 @@ void main() {
|
||||
|
||||
final FlutterProject project = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
||||
final CmakeBasedProject cmakeProject = _FakeProject.fromFlutter(project);
|
||||
const BuildInfo buildInfo = BuildInfo(BuildMode.release, null, treeShakeIcons: false);
|
||||
|
||||
final Map<String, String> environment = <String, String>{
|
||||
'TEST': r'hello\world',
|
||||
@@ -97,6 +110,7 @@ void main() {
|
||||
writeGeneratedCmakeConfig(
|
||||
_kTestWindowsFlutterRoot,
|
||||
cmakeProject,
|
||||
buildInfo,
|
||||
environment,
|
||||
);
|
||||
|
||||
@@ -111,6 +125,12 @@ void main() {
|
||||
r'file(TO_CMAKE_PATH "C:\\flutter" FLUTTER_ROOT)',
|
||||
r'file(TO_CMAKE_PATH "C:\\" PROJECT_DIR)',
|
||||
|
||||
r'set(FLUTTER_VERSION "1.0.0" PARENT_SCOPE)',
|
||||
r'set(FLUTTER_VERSION_MAJOR 1 PARENT_SCOPE)',
|
||||
r'set(FLUTTER_VERSION_MINOR 0 PARENT_SCOPE)',
|
||||
r'set(FLUTTER_VERSION_PATCH 0 PARENT_SCOPE)',
|
||||
r'set(FLUTTER_VERSION_BUILD 0 PARENT_SCOPE)',
|
||||
|
||||
r'# Environment variables to pass to tool_backend.sh',
|
||||
r'list(APPEND FLUTTER_TOOL_ENVIRONMENT',
|
||||
r' "FLUTTER_ROOT=C:\\flutter"',
|
||||
@@ -122,6 +142,518 @@ void main() {
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => processManager,
|
||||
});
|
||||
|
||||
testUsingContext('generated config uses pubspec version', () async {
|
||||
fileSystem.file('pubspec.yaml')
|
||||
..createSync()
|
||||
..writeAsStringSync('version: 1.2.3+4');
|
||||
|
||||
final FlutterProject project = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
||||
final CmakeBasedProject cmakeProject = _FakeProject.fromFlutter(project);
|
||||
const BuildInfo buildInfo = BuildInfo(BuildMode.release, null, treeShakeIcons: false);
|
||||
final Map<String, String> environment = <String, String>{};
|
||||
|
||||
writeGeneratedCmakeConfig(
|
||||
_kTestFlutterRoot,
|
||||
cmakeProject,
|
||||
buildInfo,
|
||||
environment,
|
||||
);
|
||||
|
||||
final File cmakeConfig = cmakeProject.generatedCmakeConfigFile;
|
||||
|
||||
expect(cmakeConfig, exists);
|
||||
|
||||
final List<String> configLines = cmakeConfig.readAsLinesSync();
|
||||
|
||||
expect(configLines, containsAll(<String>[
|
||||
'set(FLUTTER_VERSION "1.2.3+4" PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MAJOR 1 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MINOR 2 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_PATCH 3 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_BUILD 4 PARENT_SCOPE)',
|
||||
]));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => processManager,
|
||||
});
|
||||
|
||||
testUsingContext('generated config uses build name', () async {
|
||||
final FlutterProject project = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
||||
final CmakeBasedProject cmakeProject = _FakeProject.fromFlutter(project);
|
||||
const BuildInfo buildInfo = BuildInfo(
|
||||
BuildMode.release,
|
||||
null,
|
||||
buildName: '1.2.3',
|
||||
treeShakeIcons: false,
|
||||
);
|
||||
final Map<String, String> environment = <String, String>{};
|
||||
|
||||
writeGeneratedCmakeConfig(
|
||||
_kTestFlutterRoot,
|
||||
cmakeProject,
|
||||
buildInfo,
|
||||
environment,
|
||||
);
|
||||
|
||||
final File cmakeConfig = cmakeProject.generatedCmakeConfigFile;
|
||||
|
||||
expect(cmakeConfig, exists);
|
||||
|
||||
final List<String> configLines = cmakeConfig.readAsLinesSync();
|
||||
|
||||
expect(configLines, containsAll(<String>[
|
||||
'set(FLUTTER_VERSION "1.2.3" PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MAJOR 1 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MINOR 2 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_PATCH 3 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_BUILD 0 PARENT_SCOPE)',
|
||||
]));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => processManager,
|
||||
});
|
||||
|
||||
testUsingContext('generated config uses build number', () async {
|
||||
final FlutterProject project = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
||||
final CmakeBasedProject cmakeProject = _FakeProject.fromFlutter(project);
|
||||
const BuildInfo buildInfo = BuildInfo(
|
||||
BuildMode.release,
|
||||
null,
|
||||
buildNumber: '4',
|
||||
treeShakeIcons: false,
|
||||
);
|
||||
final Map<String, String> environment = <String, String>{};
|
||||
|
||||
writeGeneratedCmakeConfig(
|
||||
_kTestFlutterRoot,
|
||||
cmakeProject,
|
||||
buildInfo,
|
||||
environment,
|
||||
);
|
||||
|
||||
final File cmakeConfig = cmakeProject.generatedCmakeConfigFile;
|
||||
|
||||
expect(cmakeConfig, exists);
|
||||
|
||||
final List<String> configLines = cmakeConfig.readAsLinesSync();
|
||||
|
||||
expect(configLines, containsAll(<String>[
|
||||
'set(FLUTTER_VERSION "1.0.0+4" PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MAJOR 1 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MINOR 0 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_PATCH 0 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_BUILD 4 PARENT_SCOPE)',
|
||||
]));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => processManager,
|
||||
});
|
||||
|
||||
testUsingContext('generated config uses build name and build number', () async {
|
||||
final FlutterProject project = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
||||
final CmakeBasedProject cmakeProject = _FakeProject.fromFlutter(project);
|
||||
const BuildInfo buildInfo = BuildInfo(
|
||||
BuildMode.release,
|
||||
null,
|
||||
buildName: '1.2.3',
|
||||
buildNumber: '4',
|
||||
treeShakeIcons: false,
|
||||
);
|
||||
final Map<String, String> environment = <String, String>{};
|
||||
|
||||
writeGeneratedCmakeConfig(
|
||||
_kTestFlutterRoot,
|
||||
cmakeProject,
|
||||
buildInfo,
|
||||
environment,
|
||||
);
|
||||
|
||||
final File cmakeConfig = cmakeProject.generatedCmakeConfigFile;
|
||||
|
||||
expect(cmakeConfig, exists);
|
||||
|
||||
final List<String> configLines = cmakeConfig.readAsLinesSync();
|
||||
|
||||
expect(configLines, containsAll(<String>[
|
||||
'set(FLUTTER_VERSION "1.2.3+4" PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MAJOR 1 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MINOR 2 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_PATCH 3 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_BUILD 4 PARENT_SCOPE)',
|
||||
]));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => processManager,
|
||||
});
|
||||
|
||||
testUsingContext('generated config uses build name over pubspec version', () async {
|
||||
fileSystem.file('pubspec.yaml')
|
||||
..createSync()
|
||||
..writeAsStringSync('version: 9.9.9+9');
|
||||
|
||||
final FlutterProject project = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
||||
final CmakeBasedProject cmakeProject = _FakeProject.fromFlutter(project);
|
||||
const BuildInfo buildInfo = BuildInfo(
|
||||
BuildMode.release,
|
||||
null,
|
||||
buildName: '1.2.3',
|
||||
treeShakeIcons: false,
|
||||
);
|
||||
final Map<String, String> environment = <String, String>{};
|
||||
|
||||
writeGeneratedCmakeConfig(
|
||||
_kTestFlutterRoot,
|
||||
cmakeProject,
|
||||
buildInfo,
|
||||
environment,
|
||||
);
|
||||
|
||||
final File cmakeConfig = cmakeProject.generatedCmakeConfigFile;
|
||||
|
||||
expect(cmakeConfig, exists);
|
||||
|
||||
final List<String> configLines = cmakeConfig.readAsLinesSync();
|
||||
|
||||
expect(configLines, containsAll(<String>[
|
||||
'set(FLUTTER_VERSION "1.2.3" PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MAJOR 1 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MINOR 2 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_PATCH 3 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_BUILD 0 PARENT_SCOPE)',
|
||||
]));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => processManager,
|
||||
});
|
||||
|
||||
testUsingContext('generated config uses build number over pubspec version', () async {
|
||||
fileSystem.file('pubspec.yaml')
|
||||
..createSync()
|
||||
..writeAsStringSync('version: 1.2.3+4');
|
||||
|
||||
final FlutterProject project = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
||||
final CmakeBasedProject cmakeProject = _FakeProject.fromFlutter(project);
|
||||
const BuildInfo buildInfo = BuildInfo(
|
||||
BuildMode.release,
|
||||
null,
|
||||
buildNumber: '5',
|
||||
treeShakeIcons: false,
|
||||
);
|
||||
final Map<String, String> environment = <String, String>{};
|
||||
|
||||
writeGeneratedCmakeConfig(
|
||||
_kTestFlutterRoot,
|
||||
cmakeProject,
|
||||
buildInfo,
|
||||
environment,
|
||||
);
|
||||
|
||||
final File cmakeConfig = cmakeProject.generatedCmakeConfigFile;
|
||||
|
||||
expect(cmakeConfig, exists);
|
||||
|
||||
final List<String> configLines = cmakeConfig.readAsLinesSync();
|
||||
|
||||
expect(configLines, containsAll(<String>[
|
||||
'set(FLUTTER_VERSION "1.2.3+5" PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MAJOR 1 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MINOR 2 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_PATCH 3 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_BUILD 5 PARENT_SCOPE)',
|
||||
]));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => processManager,
|
||||
});
|
||||
|
||||
testUsingContext('generated config uses build name and build number over pubspec version', () async {
|
||||
fileSystem.file('pubspec.yaml')
|
||||
..createSync()
|
||||
..writeAsStringSync('version: 9.9.9+9');
|
||||
|
||||
final FlutterProject project = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
||||
final CmakeBasedProject cmakeProject = _FakeProject.fromFlutter(project);
|
||||
const BuildInfo buildInfo = BuildInfo(
|
||||
BuildMode.release,
|
||||
null,
|
||||
buildName: '1.2.3',
|
||||
buildNumber: '4',
|
||||
treeShakeIcons: false,
|
||||
);
|
||||
final Map<String, String> environment = <String, String>{};
|
||||
|
||||
writeGeneratedCmakeConfig(
|
||||
_kTestFlutterRoot,
|
||||
cmakeProject,
|
||||
buildInfo,
|
||||
environment,
|
||||
);
|
||||
|
||||
final File cmakeConfig = cmakeProject.generatedCmakeConfigFile;
|
||||
|
||||
expect(cmakeConfig, exists);
|
||||
|
||||
final List<String> configLines = cmakeConfig.readAsLinesSync();
|
||||
|
||||
expect(configLines, containsAll(<String>[
|
||||
'set(FLUTTER_VERSION "1.2.3+4" PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MAJOR 1 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MINOR 2 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_PATCH 3 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_BUILD 4 PARENT_SCOPE)',
|
||||
]));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => processManager,
|
||||
});
|
||||
|
||||
testUsingContext('generated config ignores invalid build name', () async {
|
||||
final FlutterProject project = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
||||
final CmakeBasedProject cmakeProject = _FakeProject.fromFlutter(project);
|
||||
const BuildInfo buildInfo = BuildInfo(
|
||||
BuildMode.release,
|
||||
null,
|
||||
buildName: 'hello.world',
|
||||
treeShakeIcons: false,
|
||||
);
|
||||
final Map<String, String> environment = <String, String>{};
|
||||
|
||||
writeGeneratedCmakeConfig(
|
||||
_kTestFlutterRoot,
|
||||
cmakeProject,
|
||||
buildInfo,
|
||||
environment,
|
||||
);
|
||||
|
||||
final File cmakeConfig = cmakeProject.generatedCmakeConfigFile;
|
||||
|
||||
expect(cmakeConfig, exists);
|
||||
|
||||
final List<String> configLines = cmakeConfig.readAsLinesSync();
|
||||
|
||||
expect(configLines, containsAll(<String>[
|
||||
'set(FLUTTER_VERSION "1.0.0" PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MAJOR 1 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MINOR 0 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_PATCH 0 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_BUILD 0 PARENT_SCOPE)',
|
||||
]));
|
||||
|
||||
expect(logger.warningText, contains('Warning: could not parse version hello.world, defaulting to 1.0.0.'));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => processManager,
|
||||
Logger: () => logger,
|
||||
});
|
||||
|
||||
testUsingContext('generated config ignores invalid build number', () async {
|
||||
final FlutterProject project = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
||||
final CmakeBasedProject cmakeProject = _FakeProject.fromFlutter(project);
|
||||
const BuildInfo buildInfo = BuildInfo(
|
||||
BuildMode.release,
|
||||
null,
|
||||
buildName: '1.2.3',
|
||||
buildNumber: 'foo_bar',
|
||||
treeShakeIcons: false,
|
||||
);
|
||||
final Map<String, String> environment = <String, String>{};
|
||||
|
||||
writeGeneratedCmakeConfig(
|
||||
_kTestFlutterRoot,
|
||||
cmakeProject,
|
||||
buildInfo,
|
||||
environment,
|
||||
);
|
||||
|
||||
final File cmakeConfig = cmakeProject.generatedCmakeConfigFile;
|
||||
|
||||
expect(cmakeConfig, exists);
|
||||
|
||||
final List<String> configLines = cmakeConfig.readAsLinesSync();
|
||||
|
||||
expect(configLines, containsAll(<String>[
|
||||
'set(FLUTTER_VERSION "1.0.0" PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MAJOR 1 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MINOR 0 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_PATCH 0 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_BUILD 0 PARENT_SCOPE)',
|
||||
]));
|
||||
|
||||
expect(logger.warningText, contains('Warning: could not parse version 1.2.3+foo_bar, defaulting to 1.0.0.'));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => processManager,
|
||||
Logger: () => logger,
|
||||
});
|
||||
|
||||
testUsingContext('generated config handles non-numeric build number', () async {
|
||||
final FlutterProject project = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
||||
final CmakeBasedProject cmakeProject = _FakeProject.fromFlutter(project);
|
||||
const BuildInfo buildInfo = BuildInfo(
|
||||
BuildMode.release,
|
||||
null,
|
||||
buildName: '1.2.3',
|
||||
buildNumber: 'hello',
|
||||
treeShakeIcons: false,
|
||||
);
|
||||
final Map<String, String> environment = <String, String>{};
|
||||
|
||||
writeGeneratedCmakeConfig(
|
||||
_kTestFlutterRoot,
|
||||
cmakeProject,
|
||||
buildInfo,
|
||||
environment,
|
||||
);
|
||||
|
||||
expect(logger.warningText, isEmpty);
|
||||
|
||||
final File cmakeConfig = cmakeProject.generatedCmakeConfigFile;
|
||||
|
||||
expect(cmakeConfig, exists);
|
||||
|
||||
final List<String> configLines = cmakeConfig.readAsLinesSync();
|
||||
|
||||
expect(configLines, containsAll(<String>[
|
||||
'set(FLUTTER_VERSION "1.2.3+hello" PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MAJOR 1 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MINOR 2 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_PATCH 3 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_BUILD 0 PARENT_SCOPE)',
|
||||
]));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => processManager,
|
||||
Logger: () => logger,
|
||||
});
|
||||
|
||||
testUsingContext('generated config handles complex build number', () async {
|
||||
final FlutterProject project = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
||||
final CmakeBasedProject cmakeProject = _FakeProject.fromFlutter(project);
|
||||
const BuildInfo buildInfo = BuildInfo(
|
||||
BuildMode.release,
|
||||
null,
|
||||
buildName: '1.2.3',
|
||||
buildNumber: '4.5',
|
||||
treeShakeIcons: false,
|
||||
);
|
||||
final Map<String, String> environment = <String, String>{};
|
||||
|
||||
writeGeneratedCmakeConfig(
|
||||
_kTestFlutterRoot,
|
||||
cmakeProject,
|
||||
buildInfo,
|
||||
environment,
|
||||
);
|
||||
|
||||
expect(logger.warningText, isEmpty);
|
||||
|
||||
final File cmakeConfig = cmakeProject.generatedCmakeConfigFile;
|
||||
|
||||
expect(cmakeConfig, exists);
|
||||
|
||||
final List<String> configLines = cmakeConfig.readAsLinesSync();
|
||||
|
||||
expect(configLines, containsAll(<String>[
|
||||
'set(FLUTTER_VERSION "1.2.3+4.5" PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MAJOR 1 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MINOR 2 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_PATCH 3 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_BUILD 0 PARENT_SCOPE)',
|
||||
]));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => processManager,
|
||||
Logger: () => logger,
|
||||
});
|
||||
|
||||
testUsingContext('generated config warns on Windows project with non-numeric build number', () async {
|
||||
final FlutterProject project = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
||||
final CmakeBasedProject cmakeProject = WindowsProject.fromFlutter(project);
|
||||
const BuildInfo buildInfo = BuildInfo(
|
||||
BuildMode.release,
|
||||
null,
|
||||
buildName: '1.2.3',
|
||||
buildNumber: 'hello',
|
||||
treeShakeIcons: false,
|
||||
);
|
||||
final Map<String, String> environment = <String, String>{};
|
||||
|
||||
writeGeneratedCmakeConfig(
|
||||
_kTestFlutterRoot,
|
||||
cmakeProject,
|
||||
buildInfo,
|
||||
environment,
|
||||
);
|
||||
|
||||
expect(logger.warningText, contains(
|
||||
'Warning: build identifier hello in version 1.2.3+hello is not numeric and '
|
||||
'cannot be converted into a Windows build version number. Defaulting to 0.\n'
|
||||
'This may cause issues with Windows installers.'
|
||||
));
|
||||
|
||||
final File cmakeConfig = cmakeProject.generatedCmakeConfigFile;
|
||||
|
||||
expect(cmakeConfig, exists);
|
||||
|
||||
final List<String> configLines = cmakeConfig.readAsLinesSync();
|
||||
|
||||
expect(configLines, containsAll(<String>[
|
||||
'set(FLUTTER_VERSION "1.2.3+hello" PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MAJOR 1 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MINOR 2 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_PATCH 3 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_BUILD 0 PARENT_SCOPE)',
|
||||
]));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => processManager,
|
||||
Logger: () => logger,
|
||||
});
|
||||
|
||||
testUsingContext('generated config warns on Windows project with complex build number', () async {
|
||||
final FlutterProject project = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
||||
final CmakeBasedProject cmakeProject = WindowsProject.fromFlutter(project);
|
||||
const BuildInfo buildInfo = BuildInfo(
|
||||
BuildMode.release,
|
||||
null,
|
||||
buildName: '1.2.3',
|
||||
buildNumber: '4.5',
|
||||
treeShakeIcons: false,
|
||||
);
|
||||
final Map<String, String> environment = <String, String>{};
|
||||
|
||||
writeGeneratedCmakeConfig(
|
||||
_kTestFlutterRoot,
|
||||
cmakeProject,
|
||||
buildInfo,
|
||||
environment,
|
||||
);
|
||||
|
||||
expect(logger.warningText, contains(
|
||||
'Warning: build identifier 4.5 in version 1.2.3+4.5 is not numeric and '
|
||||
'cannot be converted into a Windows build version number. Defaulting to 0.\n'
|
||||
'This may cause issues with Windows installers.'
|
||||
));
|
||||
|
||||
final File cmakeConfig = cmakeProject.generatedCmakeConfigFile;
|
||||
|
||||
expect(cmakeConfig, exists);
|
||||
|
||||
final List<String> configLines = cmakeConfig.readAsLinesSync();
|
||||
|
||||
expect(configLines, containsAll(<String>[
|
||||
'set(FLUTTER_VERSION "1.2.3+4.5" PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MAJOR 1 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_MINOR 2 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_PATCH 3 PARENT_SCOPE)',
|
||||
'set(FLUTTER_VERSION_BUILD 0 PARENT_SCOPE)',
|
||||
]));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => processManager,
|
||||
Logger: () => logger,
|
||||
});
|
||||
}
|
||||
|
||||
class _FakeProject implements CmakeBasedProject {
|
||||
|
||||
@@ -70,12 +70,50 @@ void main() {
|
||||
expect(releaseDir, exists);
|
||||
expect(exeFile, exists);
|
||||
|
||||
// Default exe has version 1.0.0
|
||||
// Default exe has build name 1.0.0 and build number 1.
|
||||
final String fileVersion = _getFileVersion(exeFile);
|
||||
final String productVersion = _getProductVersion(exeFile);
|
||||
|
||||
expect(fileVersion, equals('1.0.0.0'));
|
||||
expect(productVersion, equals('1.0.0'));
|
||||
expect(fileVersion, equals('1.0.0.1'));
|
||||
expect(productVersion, equals('1.0.0+1'));
|
||||
});
|
||||
|
||||
testWithoutContext('flutter build windows sets build name', () {
|
||||
processManager.runSync(<String>[
|
||||
flutterBin,
|
||||
...getLocalEngineArguments(),
|
||||
'build',
|
||||
'windows',
|
||||
'--no-pub',
|
||||
'--build-name',
|
||||
'1.2.3',
|
||||
], workingDirectory: projectRoot.path);
|
||||
|
||||
final String fileVersion = _getFileVersion(exeFile);
|
||||
final String productVersion = _getProductVersion(exeFile);
|
||||
|
||||
expect(fileVersion, equals('1.2.3.0'));
|
||||
expect(productVersion, equals('1.2.3'));
|
||||
});
|
||||
|
||||
testWithoutContext('flutter build windows sets build name and build number', () {
|
||||
processManager.runSync(<String>[
|
||||
flutterBin,
|
||||
...getLocalEngineArguments(),
|
||||
'build',
|
||||
'windows',
|
||||
'--no-pub',
|
||||
'--build-name',
|
||||
'1.2.3',
|
||||
'--build-number',
|
||||
'4',
|
||||
], workingDirectory: projectRoot.path);
|
||||
|
||||
final String fileVersion = _getFileVersion(exeFile);
|
||||
final String productVersion = _getProductVersion(exeFile);
|
||||
|
||||
expect(fileVersion, equals('1.2.3.4'));
|
||||
expect(productVersion, equals('1.2.3+4'));
|
||||
});
|
||||
}, skip: !io.Platform.isWindows); // [intended] Windows integration build.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user