Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 39ffe7d

Browse files
vashworthGitHub Actions Bot
authored andcommitted
Remove build configuration mismatch warning (flutter#174715)
A build configuration mismatch warning was introduced in flutter#169395 to help handle dev_dependencies relying on the build configuration. However, we disabled dev_dependencies from being excluded per configuration in flutter#171015. This warning therefore can also be removed. Fixes flutter#174015. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
1 parent efc14d1 commit 39ffe7d

5 files changed

Lines changed: 0 additions & 793 deletions

File tree

packages/flutter_tools/bin/xcode_backend.dart

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -540,8 +540,6 @@ class Context {
540540

541541
final String buildMode = parseFlutterBuildMode();
542542

543-
_validateBuildMode(platform, buildMode);
544-
545543
final List<String> flutterArgs = _generateFlutterArgsForAssemble(
546544
command: 'build',
547545
buildMode: buildMode,
@@ -570,53 +568,6 @@ class Context {
570568
echo('Project $projectPath built and packaged successfully.');
571569
}
572570

573-
/// Validate that the build mode targeted matches the build mode set by the
574-
/// Flutter CLI.
575-
/// If it doesn't match, print a warning unless the Xcode action is `install`,
576-
/// which means the app is being archived for distribution. In that case, print
577-
/// an error and fail the build.
578-
///
579-
/// The targeted build mode might not match the one set by Flutter CLI when it
580-
/// is changed and ran directly through Xcode.
581-
///
582-
/// Flutter may change settings or files depending on the build mode. For
583-
/// example, dev dependencies are excluded from release builds and requires
584-
/// the Flutter CLI to update certain files.
585-
void _validateBuildMode(TargetPlatform platform, String currentBuildMode) {
586-
final String? buildModeCLILastUsed = environment['FLUTTER_CLI_BUILD_MODE'];
587-
588-
// Also fail the build if ACTION=install, which indicates the app is being
589-
// built for distribution.
590-
final String? action = environment['ACTION'];
591-
final fatal = action == 'install';
592-
593-
if (buildModeCLILastUsed == null) {
594-
final message =
595-
'Your Flutter build settings are outdated. Please run '
596-
'"flutter build ${platform.name} --config-only --$currentBuildMode" in your Flutter '
597-
'project and try again.\n';
598-
if (fatal) {
599-
echoXcodeError(message);
600-
exitApp(-1);
601-
} else {
602-
echoXcodeWarning(message);
603-
return;
604-
}
605-
}
606-
if (currentBuildMode != buildModeCLILastUsed) {
607-
final message =
608-
'Your Flutter project is currently configured for $buildModeCLILastUsed mode. '
609-
'Please run `flutter build ${platform.name} --config-only --$currentBuildMode` '
610-
'in your Flutter project to update your settings.\n';
611-
if (fatal) {
612-
echoXcodeError(message);
613-
exitApp(-1);
614-
} else {
615-
echoXcodeWarning(message);
616-
}
617-
}
618-
}
619-
620571
List<String> _generateFlutterArgsForAssemble({
621572
required String command,
622573
required String buildMode,

packages/flutter_tools/lib/src/ios/xcode_build_settings.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,6 @@ Future<List<String>> _xcodeBuildSettingsLines({
180180
parsedBuildNumber(manifest: project.manifest, buildInfo: buildInfo) ?? '1';
181181
xcodeBuildSettings.add('FLUTTER_BUILD_NUMBER=$buildNumber');
182182

183-
// The current build mode being targeted.
184-
xcodeBuildSettings.add('FLUTTER_CLI_BUILD_MODE=${buildInfo.mode.cliName}');
185-
186183
// CoreDevices in debug and profile mode are launched, but not built, via Xcode.
187184
// Set the CONFIGURATION_BUILD_DIR so Xcode knows where to find the app
188185
// bundle to launch.

packages/flutter_tools/test/general.shard/xcode_backend_test.dart

Lines changed: 0 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ void main() {
103103
'CONFIGURATION': buildMode,
104104
'FLUTTER_ROOT': flutterRoot.path,
105105
'INFOPLIST_PATH': 'Info.plist',
106-
'FLUTTER_CLI_BUILD_MODE': buildMode.toLowerCase(),
107106
},
108107
commands: <FakeCommand>[
109108
FakeCommand(
@@ -191,7 +190,6 @@ void main() {
191190
'TREE_SHAKE_ICONS': treeShake,
192191
'SRCROOT': srcRoot,
193192
'TARGET_DEVICE_OS_VERSION': iOSVersion,
194-
'FLUTTER_CLI_BUILD_MODE': buildMode.toLowerCase(),
195193
},
196194
commands: <FakeCommand>[
197195
FakeCommand(
@@ -234,137 +232,6 @@ void main() {
234232
expect(context.stdout, contains('built and packaged successfully.'));
235233
expect(context.stderr, isEmpty);
236234
});
237-
238-
test(
239-
'exits with useful error message when missing FLUTTER_CLI_BUILD_MODE during archive',
240-
() {
241-
final Directory buildDir = fileSystem.directory('/path/to/builds')
242-
..createSync(recursive: true);
243-
final Directory flutterRoot = fileSystem.directory('/path/to/flutter')
244-
..createSync(recursive: true);
245-
246-
const buildMode = 'Release';
247-
248-
final context = TestContext(
249-
<String>['build', platformName],
250-
<String, String>{
251-
'ACTION': 'install',
252-
'CONFIGURATION': buildMode,
253-
'BUILT_PRODUCTS_DIR': buildDir.path,
254-
'FLUTTER_ROOT': flutterRoot.path,
255-
'INFOPLIST_PATH': 'Info.plist',
256-
},
257-
commands: <FakeCommand>[],
258-
fileSystem: fileSystem,
259-
);
260-
expect(() => context.run(), throwsException);
261-
expect(
262-
context.stderr,
263-
contains(
264-
'error: Your Flutter build settings are outdated. '
265-
'Please run "flutter build ${platform.name} --config-only --release" '
266-
'in your Flutter project and try again.',
267-
),
268-
);
269-
},
270-
);
271-
272-
test('exits with useful error message when build mode mismatches during archive', () {
273-
final Directory buildDir = fileSystem.directory('/path/to/builds')
274-
..createSync(recursive: true);
275-
final Directory flutterRoot = fileSystem.directory('/path/to/flutter')
276-
..createSync(recursive: true);
277-
278-
const buildMode = 'Release';
279-
280-
final context = TestContext(
281-
<String>['build', platformName],
282-
<String, String>{
283-
'ACTION': 'install',
284-
'CONFIGURATION': buildMode,
285-
'BUILT_PRODUCTS_DIR': buildDir.path,
286-
'FLUTTER_ROOT': flutterRoot.path,
287-
'INFOPLIST_PATH': 'Info.plist',
288-
'FLUTTER_CLI_BUILD_MODE': 'debug',
289-
},
290-
commands: <FakeCommand>[],
291-
fileSystem: fileSystem,
292-
);
293-
expect(() => context.run(), throwsException);
294-
expect(
295-
context.stderr,
296-
contains(
297-
'error: Your Flutter project is currently configured for debug mode. '
298-
'Please run `flutter build ${platform.name} --config-only --release` '
299-
'in your Flutter project to update your settings.',
300-
),
301-
);
302-
});
303-
304-
test('prints useful warning message when missing FLUTTER_CLI_BUILD_MODE', () {
305-
final Directory buildDir = fileSystem.directory('/path/to/builds')
306-
..createSync(recursive: true);
307-
final Directory flutterRoot = fileSystem.directory('/path/to/flutter')
308-
..createSync(recursive: true);
309-
310-
const buildMode = 'Release';
311-
312-
final context = TestContext(
313-
<String>['build', platformName],
314-
<String, String>{
315-
'ACTION': 'build',
316-
'CONFIGURATION': buildMode,
317-
'BUILT_PRODUCTS_DIR': buildDir.path,
318-
'FLUTTER_ROOT': flutterRoot.path,
319-
'INFOPLIST_PATH': 'Info.plist',
320-
},
321-
commands: <FakeCommand>[],
322-
fileSystem: fileSystem,
323-
fakeProcessManager: FakeProcessManager.any(),
324-
);
325-
context.run();
326-
expect(
327-
context.stderr,
328-
contains(
329-
'warning: Your Flutter build settings are outdated. '
330-
'Please run "flutter build ${platform.name} --config-only --release" '
331-
'in your Flutter project and try again.',
332-
),
333-
);
334-
});
335-
336-
test('prints useful warning message when build mode mismatches', () {
337-
final Directory buildDir = fileSystem.directory('/path/to/builds')
338-
..createSync(recursive: true);
339-
final Directory flutterRoot = fileSystem.directory('/path/to/flutter')
340-
..createSync(recursive: true);
341-
342-
const buildMode = 'Release';
343-
344-
final context = TestContext(
345-
<String>['build', platformName],
346-
<String, String>{
347-
'ACTION': 'debug',
348-
'CONFIGURATION': buildMode,
349-
'BUILT_PRODUCTS_DIR': buildDir.path,
350-
'FLUTTER_ROOT': flutterRoot.path,
351-
'INFOPLIST_PATH': 'Info.plist',
352-
'FLUTTER_CLI_BUILD_MODE': 'debug',
353-
},
354-
commands: <FakeCommand>[],
355-
fileSystem: fileSystem,
356-
fakeProcessManager: FakeProcessManager.any(),
357-
);
358-
context.run();
359-
expect(
360-
context.stderr,
361-
contains(
362-
'warning: Your Flutter project is currently configured for debug mode. '
363-
'Please run `flutter build ${platform.name} --config-only --release` '
364-
'in your Flutter project to update your settings.',
365-
),
366-
);
367-
});
368235
});
369236
}
370237

@@ -557,7 +424,6 @@ void main() {
557424
'BUILT_PRODUCTS_DIR': buildDir.path,
558425
'FLUTTER_ROOT': flutterRoot.path,
559426
'INFOPLIST_PATH': 'Info.plist',
560-
'FLUTTER_CLI_BUILD_MODE': buildMode.toLowerCase(),
561427
},
562428
commands: <FakeCommand>[
563429
FakeCommand(
@@ -609,7 +475,6 @@ void main() {
609475
'CONFIGURATION': buildMode,
610476
'FLUTTER_ROOT': flutterRoot.path,
611477
'INFOPLIST_PATH': 'Info.plist',
612-
'FLUTTER_CLI_BUILD_MODE': buildMode.toLowerCase(),
613478
},
614479
commands: <FakeCommand>[
615480
FakeCommand(
@@ -689,7 +554,6 @@ void main() {
689554
'TREE_SHAKE_ICONS': treeShake,
690555
'SRCROOT': srcRoot,
691556
'TARGET_DEVICE_OS_VERSION': iOSVersion,
692-
'FLUTTER_CLI_BUILD_MODE': buildMode.toLowerCase(),
693557
},
694558
commands: <FakeCommand>[
695559
FakeCommand(
@@ -747,7 +611,6 @@ void main() {
747611
'ARCHS': 'arm64 x86_64',
748612
'ONLY_ACTIVE_ARCH': 'YES',
749613
'NATIVE_ARCH': 'arm64e',
750-
'FLUTTER_CLI_BUILD_MODE': buildMode.toLowerCase(),
751614
},
752615
commands: <FakeCommand>[
753616
FakeCommand(
@@ -802,7 +665,6 @@ void main() {
802665
'ARCHS': 'arm64',
803666
'ONLY_ACTIVE_ARCH': 'YES',
804667
'NATIVE_ARCH': 'x86_64',
805-
'FLUTTER_CLI_BUILD_MODE': buildMode.toLowerCase(),
806668
},
807669
commands: <FakeCommand>[
808670
FakeCommand(
@@ -856,7 +718,6 @@ void main() {
856718
'INFOPLIST_PATH': 'Info.plist',
857719
'ARCHS': 'arm64 x86_64',
858720
'NATIVE_ARCH': 'arm64e',
859-
'FLUTTER_CLI_BUILD_MODE': buildMode.toLowerCase(),
860721
},
861722
commands: <FakeCommand>[
862723
FakeCommand(

packages/flutter_tools/test/integration.shard/xcode_backend_test.dart

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,6 @@ void main() {
5454
await expectXcodeBackendFails(unknownFlutterBuildMode);
5555
}, skip: !io.Platform.isMacOS); // [intended] requires macos toolchain.
5656

57-
test('Xcode backend warns archiving a non-release build.', () async {
58-
final ProcessResult result = await Process.run(
59-
xcodeBackendPath,
60-
<String>['build'],
61-
environment: <String, String>{
62-
'CONFIGURATION': 'Debug',
63-
'ACTION': 'install',
64-
'FLUTTER_CLI_BUILD_MODE': 'debug',
65-
},
66-
);
67-
expect(result.stderr, contains('warning: Flutter archive not built in Release mode.'));
68-
expect(result.exitCode, isNot(0));
69-
}, skip: !io.Platform.isMacOS); // [intended] requires macos toolchain.
70-
7157
test('Xcode backend warns when unable to determine platform', () async {
7258
final ProcessResult result = await Process.run(
7359
xcodeBackendPath,

0 commit comments

Comments
 (0)