Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
f1331486
Commit
f1331486
authored
Mar 12, 2016
by
Devon Carew
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2645 from devoncarew/platform_constants
rename the platform constants
parents
bb0d11be
3ce1685d
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
76 additions
and
78 deletions
+76
-78
android_device.dart
packages/flutter_tools/lib/src/android/android_device.dart
+15
-5
application_package.dart
packages/flutter_tools/lib/src/application_package.dart
+11
-11
artifacts.dart
packages/flutter_tools/lib/src/artifacts.dart
+13
-13
process.dart
packages/flutter_tools/lib/src/base/process.dart
+1
-1
build_configuration.dart
packages/flutter_tools/lib/src/build_configuration.dart
+8
-11
apk.dart
packages/flutter_tools/lib/src/commands/apk.dart
+2
-2
run_mojo.dart
packages/flutter_tools/lib/src/commands/run_mojo.dart
+2
-2
test.dart
packages/flutter_tools/lib/src/commands/test.dart
+2
-2
devices.dart
packages/flutter_tools/lib/src/ios/devices.dart
+1
-1
simulators.dart
packages/flutter_tools/lib/src/ios/simulators.dart
+1
-1
flutter_command.dart
packages/flutter_tools/lib/src/runner/flutter_command.dart
+1
-1
flutter_command_runner.dart
.../flutter_tools/lib/src/runner/flutter_command_runner.dart
+16
-25
mocks.dart
packages/flutter_tools/test/src/mocks.dart
+3
-3
No files found.
packages/flutter_tools/lib/src/android/android_device.dart
View file @
f1331486
...
...
@@ -48,7 +48,17 @@ class AndroidDevice extends Device {
final
String
modelID
;
final
String
deviceCodeName
;
bool
get
isLocalEmulator
=>
false
;
bool
_isLocalEmulator
;
bool
get
isLocalEmulator
{
if
(
_isLocalEmulator
==
null
)
{
// http://developer.android.com/ndk/guides/abis.html (x86, armeabi-v7a, ...)
String
value
=
runCheckedSync
(
adbCommandForDevice
([
'shell'
,
'getprop'
,
'ro.product.cpu.abi'
]));
_isLocalEmulator
=
value
.
startsWith
(
'x86'
);
}
return
_isLocalEmulator
;
}
_AdbLogReader
_logReader
;
_AndroidDevicePortForwarder
_portForwarder
;
...
...
@@ -59,8 +69,7 @@ class AndroidDevice extends Device {
bool
_isValidAdbVersion
(
String
adbVersion
)
{
// Sample output: 'Android Debug Bridge version 1.0.31'
Match
versionFields
=
new
RegExp
(
r'(\d+)\.(\d+)\.(\d+)'
).
firstMatch
(
adbVersion
);
Match
versionFields
=
new
RegExp
(
r'(\d+)\.(\d+)\.(\d+)'
).
firstMatch
(
adbVersion
);
if
(
versionFields
!=
null
)
{
int
majorVersion
=
int
.
parse
(
versionFields
[
1
]);
int
minorVersion
=
int
.
parse
(
versionFields
[
2
]);
...
...
@@ -275,8 +284,9 @@ class AndroidDevice extends Device {
return
runCommandAndStreamOutput
(
command
).
then
((
int
exitCode
)
=>
exitCode
==
0
);
}
// TODO(devoncarew): Return android_arm or android_x64 based on [isLocalEmulator].
@override
TargetPlatform
get
platform
=>
TargetPlatform
.
android
;
TargetPlatform
get
platform
=>
TargetPlatform
.
android
_arm
;
void
clearLogs
()
{
runSync
(
adbCommandForDevice
(<
String
>[
'logcat'
,
'-c'
]));
...
...
@@ -581,7 +591,7 @@ class _AndroidDevicePortForwarder extends DevicePortForwarder {
return
ports
;
}
Future
<
int
>
forward
(
int
devicePort
,
{
int
hostPort:
null
})
async
{
Future
<
int
>
forward
(
int
devicePort
,
{
int
hostPort
})
async
{
if
((
hostPort
==
null
)
||
(
hostPort
==
0
))
{
// Auto select host port.
hostPort
=
await
findAvailablePort
();
...
...
packages/flutter_tools/lib/src/application_package.dart
View file @
f1331486
...
...
@@ -115,13 +115,13 @@ class ApplicationPackageStore {
ApplicationPackage
getPackageForPlatform
(
TargetPlatform
platform
)
{
switch
(
platform
)
{
case
TargetPlatform
.
android
:
case
TargetPlatform
.
android
_arm
:
return
android
;
case
TargetPlatform
.
i
OS
:
case
TargetPlatform
.
i
OSSimulator
:
case
TargetPlatform
.
i
os_arm
:
case
TargetPlatform
.
i
os_x64
:
return
iOS
;
case
TargetPlatform
.
mac
:
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
darwin_x64
:
case
TargetPlatform
.
linux
_x64
:
return
null
;
}
}
...
...
@@ -132,7 +132,7 @@ class ApplicationPackageStore {
for
(
BuildConfiguration
config
in
configs
)
{
switch
(
config
.
targetPlatform
)
{
case
TargetPlatform
.
android
:
case
TargetPlatform
.
android
_arm
:
assert
(
android
==
null
);
android
=
AndroidApk
.
getCustomApk
();
// Fall back to the prebuilt or engine-provided apk if we can't build
...
...
@@ -145,18 +145,18 @@ class ApplicationPackageStore {
android
=
new
AndroidApk
(
localPath:
localPath
);
}
else
{
Artifact
artifact
=
ArtifactStore
.
getArtifact
(
type:
ArtifactType
.
shell
,
targetPlatform:
TargetPlatform
.
android
);
type:
ArtifactType
.
shell
,
targetPlatform:
TargetPlatform
.
android
_arm
);
android
=
new
AndroidApk
(
localPath:
await
ArtifactStore
.
getPath
(
artifact
));
}
break
;
case
TargetPlatform
.
i
OS
:
case
TargetPlatform
.
i
OSSimulator
:
case
TargetPlatform
.
i
os_arm
:
case
TargetPlatform
.
i
os_x64
:
iOS
??=
new
IOSApp
.
fromBuildConfiguration
(
config
);
break
;
case
TargetPlatform
.
mac
:
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
darwin_x64
:
case
TargetPlatform
.
linux
_x64
:
break
;
}
}
...
...
packages/flutter_tools/lib/src/artifacts.dart
View file @
f1331486
...
...
@@ -23,15 +23,15 @@ String _getNameForHostPlatform(HostPlatform platform) {
String
_getNameForTargetPlatform
(
TargetPlatform
platform
)
{
switch
(
platform
)
{
case
TargetPlatform
.
android
:
case
TargetPlatform
.
android
_arm
:
return
'android-arm'
;
case
TargetPlatform
.
i
OS
:
case
TargetPlatform
.
i
os_arm
:
return
'ios-arm'
;
case
TargetPlatform
.
i
OSSimulator
:
case
TargetPlatform
.
i
os_x64
:
return
'ios-x64'
;
case
TargetPlatform
.
mac
:
case
TargetPlatform
.
darwin_x64
:
return
'darwin-x64'
;
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
linux
_x64
:
return
'linux-x64'
;
}
}
...
...
@@ -77,13 +77,13 @@ class ArtifactStore {
name:
'Sky Shell'
,
fileName:
'SkyShell.apk'
,
type:
ArtifactType
.
shell
,
targetPlatform:
TargetPlatform
.
android
targetPlatform:
TargetPlatform
.
android
_arm
),
const
Artifact
.
_
(
name:
'Sky Shell'
,
fileName:
'sky_shell'
,
type:
ArtifactType
.
shell
,
targetPlatform:
TargetPlatform
.
linux
targetPlatform:
TargetPlatform
.
linux
_x64
),
const
Artifact
.
_
(
name:
'Sky Snapshot'
,
...
...
@@ -101,37 +101,37 @@ class ArtifactStore {
name:
'Flutter for Mojo'
,
fileName:
'flutter.mojo'
,
type:
ArtifactType
.
mojo
,
targetPlatform:
TargetPlatform
.
android
targetPlatform:
TargetPlatform
.
android
_arm
),
const
Artifact
.
_
(
name:
'Flutter for Mojo'
,
fileName:
'flutter.mojo'
,
type:
ArtifactType
.
mojo
,
targetPlatform:
TargetPlatform
.
linux
targetPlatform:
TargetPlatform
.
linux
_x64
),
const
Artifact
.
_
(
name:
'Compiled Java code'
,
fileName:
'classes.dex.jar'
,
type:
ArtifactType
.
androidClassesJar
,
targetPlatform:
TargetPlatform
.
android
targetPlatform:
TargetPlatform
.
android
_arm
),
const
Artifact
.
_
(
name:
'ICU data table'
,
fileName:
'icudtl.dat'
,
type:
ArtifactType
.
androidIcuData
,
targetPlatform:
TargetPlatform
.
android
targetPlatform:
TargetPlatform
.
android
_arm
),
const
Artifact
.
_
(
name:
'Key Store'
,
fileName:
'chromium-debug.keystore'
,
type:
ArtifactType
.
androidKeystore
,
targetPlatform:
TargetPlatform
.
android
targetPlatform:
TargetPlatform
.
android
_arm
),
const
Artifact
.
_
(
name:
'Compiled C++ code'
,
fileName:
'libsky_shell.so'
,
type:
ArtifactType
.
androidLibSkyShell
,
targetPlatform:
TargetPlatform
.
android
targetPlatform:
TargetPlatform
.
android
_arm
),
];
...
...
packages/flutter_tools/lib/src/base/process.dart
View file @
f1331486
...
...
@@ -132,7 +132,7 @@ String _runWithLoggingSync(List<String> cmd, {
}
if
(
results
.
stdout
.
trim
().
isNotEmpty
)
printTrace
(
results
.
stdout
.
trim
());
return
results
.
stdout
;
return
results
.
stdout
.
trim
()
;
}
class
ProcessExit
implements
Exception
{
...
...
packages/flutter_tools/lib/src/build_configuration.dart
View file @
f1331486
...
...
@@ -20,11 +20,11 @@ enum HostPlatform {
}
enum
TargetPlatform
{
android
,
i
OS
,
i
OSSimulator
,
mac
,
linux
,
android
_arm
,
i
os_arm
,
i
os_x64
,
darwin_x64
,
linux
_x64
}
HostPlatform
getCurrentHostPlatform
(
)
{
...
...
@@ -38,18 +38,17 @@ HostPlatform getCurrentHostPlatform() {
TargetPlatform
getCurrentHostPlatformAsTarget
(
)
{
if
(
Platform
.
isMacOS
)
return
TargetPlatform
.
mac
;
return
TargetPlatform
.
darwin_x64
;
if
(
Platform
.
isLinux
)
return
TargetPlatform
.
linux
;
return
TargetPlatform
.
linux
_x64
;
printError
(
'Unsupported host platform, defaulting to Linux'
);
return
TargetPlatform
.
linux
;
return
TargetPlatform
.
linux
_x64
;
}
class
BuildConfiguration
{
BuildConfiguration
.
prebuilt
({
this
.
hostPlatform
,
this
.
targetPlatform
,
this
.
deviceId
,
this
.
testable
:
false
})
:
type
=
BuildType
.
prebuilt
,
buildDir
=
null
;
...
...
@@ -59,7 +58,6 @@ class BuildConfiguration {
this
.
targetPlatform
,
String
enginePath
,
String
buildPath
,
this
.
deviceId
,
this
.
testable
:
false
})
:
buildDir
=
path
.
normalize
(
path
.
join
(
enginePath
,
buildPath
))
{
assert
(
type
==
BuildType
.
debug
||
type
==
BuildType
.
release
);
...
...
@@ -69,6 +67,5 @@ class BuildConfiguration {
final
HostPlatform
hostPlatform
;
final
TargetPlatform
targetPlatform
;
final
String
buildDir
;
final
String
deviceId
;
final
bool
testable
;
}
packages/flutter_tools/lib/src/commands/apk.dart
View file @
f1331486
...
...
@@ -226,7 +226,7 @@ Future<_ApkComponents> _findApkComponents(
];
Iterable
<
Future
<
String
>>
pathFutures
=
artifactTypes
.
map
(
(
ArtifactType
type
)
=>
ArtifactStore
.
getPath
(
ArtifactStore
.
getArtifact
(
type:
type
,
targetPlatform:
TargetPlatform
.
android
)));
type:
type
,
targetPlatform:
TargetPlatform
.
android
_arm
)));
artifactPaths
=
await
Future
.
wait
(
pathFutures
);
}
...
...
@@ -392,7 +392,7 @@ Future<int> buildAndroid({
}
BuildConfiguration
config
=
configs
.
firstWhere
(
(
BuildConfiguration
bc
)
=>
bc
.
targetPlatform
==
TargetPlatform
.
android
(
BuildConfiguration
bc
)
=>
bc
.
targetPlatform
==
TargetPlatform
.
android
_arm
);
_ApkComponents
components
=
await
_findApkComponents
(
config
,
enginePath
,
manifest
,
resources
);
if
(
components
==
null
)
{
...
...
packages/flutter_tools/lib/src/commands/run_mojo.dart
View file @
f1331486
...
...
@@ -71,7 +71,7 @@ class RunMojoCommand extends FlutterCommand {
BuildConfiguration
_getCurrentHostConfig
()
{
BuildConfiguration
result
;
TargetPlatform
target
=
argResults
[
'android'
]
?
TargetPlatform
.
android
:
getCurrentHostPlatformAsTarget
();
TargetPlatform
.
android
_arm
:
getCurrentHostPlatformAsTarget
();
for
(
BuildConfiguration
config
in
buildConfigurations
)
{
if
(
config
.
targetPlatform
==
target
)
{
result
=
config
;
...
...
@@ -93,7 +93,7 @@ class RunMojoCommand extends FlutterCommand {
String
flutterPath
;
if
(
config
==
null
||
config
.
type
==
BuildType
.
prebuilt
)
{
TargetPlatform
targetPlatform
=
argResults
[
'android'
]
?
TargetPlatform
.
android
:
TargetPlatform
.
linux
;
TargetPlatform
targetPlatform
=
argResults
[
'android'
]
?
TargetPlatform
.
android
_arm
:
TargetPlatform
.
linux_x64
;
Artifact
artifact
=
ArtifactStore
.
getArtifact
(
type:
ArtifactType
.
mojo
,
targetPlatform:
targetPlatform
);
flutterPath
=
_makePathAbsolute
(
await
ArtifactStore
.
getPath
(
artifact
));
}
else
{
...
...
packages/flutter_tools/lib/src/commands/test.dart
View file @
f1331486
...
...
@@ -47,9 +47,9 @@ class TestCommand extends FlutterCommand {
return
await
ArtifactStore
.
getPath
(
artifact
);
}
else
{
switch
(
config
.
targetPlatform
)
{
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
linux
_x64
:
return
path
.
join
(
config
.
buildDir
,
'sky_shell'
);
case
TargetPlatform
.
mac
:
case
TargetPlatform
.
darwin_x64
:
return
path
.
join
(
config
.
buildDir
,
'SkyShell.app'
,
'Contents'
,
'MacOS'
,
'SkyShell'
);
default
:
throw
new
Exception
(
'Unsupported platform.'
);
...
...
packages/flutter_tools/lib/src/ios/devices.dart
View file @
f1331486
...
...
@@ -224,7 +224,7 @@ class IOSDevice extends Device {
}
@override
TargetPlatform
get
platform
=>
TargetPlatform
.
i
OS
;
TargetPlatform
get
platform
=>
TargetPlatform
.
i
os_arm
;
DeviceLogReader
get
logReader
{
if
(
_logReader
==
null
)
...
...
packages/flutter_tools/lib/src/ios/simulators.dart
View file @
f1331486
...
...
@@ -536,7 +536,7 @@ class IOSSimulator extends Device {
}
@override
TargetPlatform
get
platform
=>
TargetPlatform
.
i
OSSimulator
;
TargetPlatform
get
platform
=>
TargetPlatform
.
i
os_x64
;
DeviceLogReader
get
logReader
{
if
(
_logReader
==
null
)
...
...
packages/flutter_tools/lib/src/runner/flutter_command.dart
View file @
f1331486
...
...
@@ -80,7 +80,7 @@ abstract class FlutterCommand extends Command {
devices
=
devices
.
where
((
Device
device
)
=>
device
.
isSupported
()).
toList
();
if
(
androidOnly
)
devices
=
devices
.
where
((
Device
device
)
=>
device
.
platform
==
TargetPlatform
.
android
).
toList
();
devices
=
devices
.
where
((
Device
device
)
=>
device
.
platform
==
TargetPlatform
.
android
_arm
).
toList
();
if
(
devices
.
isEmpty
)
{
printStatus
(
'No supported devices connected.'
);
...
...
packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
View file @
f1331486
...
...
@@ -269,14 +269,13 @@ class FlutterCommandRunner extends CommandRunner {
if
(
enginePath
==
null
)
{
configs
.
add
(
new
BuildConfiguration
.
prebuilt
(
hostPlatform:
hostPlatform
,
targetPlatform:
TargetPlatform
.
android
,
deviceId:
globalResults
[
'device-id'
]
targetPlatform:
TargetPlatform
.
android_arm
));
if
(
hostPlatform
==
HostPlatform
.
linux
)
{
configs
.
add
(
new
BuildConfiguration
.
prebuilt
(
hostPlatform:
HostPlatform
.
linux
,
targetPlatform:
TargetPlatform
.
linux
,
targetPlatform:
TargetPlatform
.
linux
_x64
,
testable:
true
));
}
...
...
@@ -284,14 +283,12 @@ class FlutterCommandRunner extends CommandRunner {
if
(
hostPlatform
==
HostPlatform
.
mac
)
{
configs
.
add
(
new
BuildConfiguration
.
prebuilt
(
hostPlatform:
HostPlatform
.
mac
,
targetPlatform:
TargetPlatform
.
iOS
,
deviceId:
globalResults
[
'device-id'
]
targetPlatform:
TargetPlatform
.
ios_arm
));
configs
.
add
(
new
BuildConfiguration
.
prebuilt
(
hostPlatform:
HostPlatform
.
mac
,
targetPlatform:
TargetPlatform
.
iOSSimulator
,
deviceId:
globalResults
[
'device-id'
]
targetPlatform:
TargetPlatform
.
ios_x64
));
}
}
else
{
...
...
@@ -305,10 +302,9 @@ class FlutterCommandRunner extends CommandRunner {
configs
.
add
(
new
BuildConfiguration
.
local
(
type:
BuildType
.
debug
,
hostPlatform:
hostPlatform
,
targetPlatform:
TargetPlatform
.
android
,
targetPlatform:
TargetPlatform
.
android
_arm
,
enginePath:
enginePath
,
buildPath:
globalResults
[
'android-debug-build-path'
],
deviceId:
globalResults
[
'device-id'
]
buildPath:
globalResults
[
'android-debug-build-path'
]
));
configs
.
add
(
new
BuildConfiguration
.
local
(
...
...
@@ -324,19 +320,17 @@ class FlutterCommandRunner extends CommandRunner {
configs
.
add
(
new
BuildConfiguration
.
local
(
type:
BuildType
.
debug
,
hostPlatform:
hostPlatform
,
targetPlatform:
TargetPlatform
.
i
OS
,
targetPlatform:
TargetPlatform
.
i
os_arm
,
enginePath:
enginePath
,
buildPath:
globalResults
[
'ios-debug-build-path'
],
deviceId:
globalResults
[
'device-id'
]
buildPath:
globalResults
[
'ios-debug-build-path'
]
));
configs
.
add
(
new
BuildConfiguration
.
local
(
type:
BuildType
.
debug
,
hostPlatform:
hostPlatform
,
targetPlatform:
TargetPlatform
.
i
OSSimulator
,
targetPlatform:
TargetPlatform
.
i
os_x64
,
enginePath:
enginePath
,
buildPath:
globalResults
[
'ios-sim-debug-build-path'
],
deviceId:
globalResults
[
'device-id'
]
buildPath:
globalResults
[
'ios-sim-debug-build-path'
]
));
}
}
...
...
@@ -345,10 +339,9 @@ class FlutterCommandRunner extends CommandRunner {
configs
.
add
(
new
BuildConfiguration
.
local
(
type:
BuildType
.
release
,
hostPlatform:
hostPlatform
,
targetPlatform:
TargetPlatform
.
android
,
targetPlatform:
TargetPlatform
.
android
_arm
,
enginePath:
enginePath
,
buildPath:
globalResults
[
'android-release-build-path'
],
deviceId:
globalResults
[
'device-id'
]
buildPath:
globalResults
[
'android-release-build-path'
]
));
configs
.
add
(
new
BuildConfiguration
.
local
(
...
...
@@ -364,19 +357,17 @@ class FlutterCommandRunner extends CommandRunner {
configs
.
add
(
new
BuildConfiguration
.
local
(
type:
BuildType
.
release
,
hostPlatform:
hostPlatform
,
targetPlatform:
TargetPlatform
.
i
OS
,
targetPlatform:
TargetPlatform
.
i
os_arm
,
enginePath:
enginePath
,
buildPath:
globalResults
[
'ios-release-build-path'
],
deviceId:
globalResults
[
'device-id'
]
buildPath:
globalResults
[
'ios-release-build-path'
]
));
configs
.
add
(
new
BuildConfiguration
.
local
(
type:
BuildType
.
release
,
hostPlatform:
hostPlatform
,
targetPlatform:
TargetPlatform
.
i
OSSimulator
,
targetPlatform:
TargetPlatform
.
i
os_x64
,
enginePath:
enginePath
,
buildPath:
globalResults
[
'ios-sim-release-build-path'
],
deviceId:
globalResults
[
'device-id'
]
buildPath:
globalResults
[
'ios-sim-release-build-path'
]
));
}
}
...
...
packages/flutter_tools/test/src/mocks.dart
View file @
f1331486
...
...
@@ -32,17 +32,17 @@ class MockToolchain extends Toolchain {
}
class
MockAndroidDevice
extends
Mock
implements
AndroidDevice
{
TargetPlatform
get
platform
=>
TargetPlatform
.
android
;
TargetPlatform
get
platform
=>
TargetPlatform
.
android
_arm
;
bool
isSupported
()
=>
true
;
}
class
MockIOSDevice
extends
Mock
implements
IOSDevice
{
TargetPlatform
get
platform
=>
TargetPlatform
.
i
OS
;
TargetPlatform
get
platform
=>
TargetPlatform
.
i
os_arm
;
bool
isSupported
()
=>
true
;
}
class
MockIOSSimulator
extends
Mock
implements
IOSSimulator
{
TargetPlatform
get
platform
=>
TargetPlatform
.
i
OSSimulator
;
TargetPlatform
get
platform
=>
TargetPlatform
.
i
os_x64
;
bool
isSupported
()
=>
true
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment