1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Copyright 2018 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/base/platform.dart';
import '../src/common.dart';
const String xcodeBackendPath = 'bin/xcode_backend.sh';
const String xcodeBackendErrorHeader = '========================================================================';
// Acceptable $CONFIGURATION/$FLUTTER_BUILD_MODE values should be debug, profile, or release
const Map<String, String> unknownConfiguration = <String, String>{
'CONFIGURATION': 'Custom',
};
// $FLUTTER_BUILD_MODE will override $CONFIGURATION
const Map<String, String> unknownFlutterBuildMode = <String, String>{
'FLUTTER_BUILD_MODE': 'Custom',
'CONFIGURATION': 'Debug',
};
// Can't archive a non-release build.
const Map<String, String> installWithoutRelease = <String, String>{
'CONFIGURATION': 'Debug',
'ACTION': 'install',
};
// Can't use a debug engine build with a release build.
const Map<String, String> localEngineDebugBuildModeRelease = <String, String>{
'SOURCE_ROOT': '../../examples/hello_world',
'FLUTTER_ROOT': '../..',
'LOCAL_ENGINE': '/engine/src/out/ios_debug_unopt',
'CONFIGURATION': 'Release'
};
// Can't use a debug build with a profile engine.
const Map<String, String> localEngineProfileBuildeModeRelease =
<String, String>{
'SOURCE_ROOT': '../../examples/hello_world',
'FLUTTER_ROOT': '../..',
'LOCAL_ENGINE': '/engine/src/out/ios_profile',
'CONFIGURATION': 'Debug',
'FLUTTER_BUILD_MODE': 'Debug',
};
void main() {
Future<void> expectXcodeBackendFails(Map<String, String> environment) async {
final ProcessResult result = await Process.run(
xcodeBackendPath,
<String>['build'],
environment: environment,
);
expect(result.stderr, startsWith(xcodeBackendErrorHeader));
expect(result.exitCode, isNot(0));
}
test('Xcode backend fails for on unsupported configuration combinations', () async {
await expectXcodeBackendFails(unknownConfiguration);
await expectXcodeBackendFails(unknownFlutterBuildMode);
await expectXcodeBackendFails(installWithoutRelease);
await expectXcodeBackendFails(localEngineDebugBuildModeRelease);
await expectXcodeBackendFails(localEngineProfileBuildeModeRelease);
}, skip: !platform.isMacOS);
}