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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// Copyright 2015 The Chromium 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 'dart:io';
import 'base/utils.dart';
import 'globals.dart';
enum BuildType {
prebuilt,
release,
debug,
}
/// The type of build - `debug`, `profile`, or `release`.
enum BuildMode {
debug,
profile,
release
}
String getModeName(BuildMode mode) => getEnumName(mode);
// Returns true if the selected build mode uses ahead-of-time compilation.
bool isAotBuildMode(BuildMode mode) {
return mode == BuildMode.profile || mode == BuildMode.release;
}
enum HostPlatform {
darwin_x64,
linux_x64,
}
String getNameForHostPlatform(HostPlatform platform) {
switch (platform) {
case HostPlatform.darwin_x64:
return 'darwin-x64';
case HostPlatform.linux_x64:
return 'linux-x64';
}
assert(false);
}
enum TargetPlatform {
android_arm,
android_x64,
android_x86,
ios,
darwin_x64,
linux_x64
}
String getNameForTargetPlatform(TargetPlatform platform) {
switch (platform) {
case TargetPlatform.android_arm:
return 'android-arm';
case TargetPlatform.android_x64:
return 'android-x64';
case TargetPlatform.android_x86:
return 'android-x86';
case TargetPlatform.ios:
return 'ios';
case TargetPlatform.darwin_x64:
return 'darwin-x64';
case TargetPlatform.linux_x64:
return 'linux-x64';
}
assert(false);
}
TargetPlatform getTargetPlatformForName(String platform) {
switch (platform) {
case 'android-arm':
return TargetPlatform.android_arm;
case 'android-x64':
return TargetPlatform.android_x64;
case 'android-x86':
return TargetPlatform.android_x86;
case 'ios':
return TargetPlatform.ios;
case 'darwin-x64':
return TargetPlatform.darwin_x64;
case 'linux-x64':
return TargetPlatform.linux_x64;
}
return null;
}
HostPlatform getCurrentHostPlatform() {
if (Platform.isMacOS)
return HostPlatform.darwin_x64;
if (Platform.isLinux)
return HostPlatform.linux_x64;
printError('Unsupported host platform, defaulting to Linux');
return HostPlatform.linux_x64;
}