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
b7b06c2a
Commit
b7b06c2a
authored
Feb 15, 2016
by
Devon Carew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes found when running through the getting started process
parent
35eb6c4a
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
75 additions
and
23 deletions
+75
-23
adb.dart
packages/flutter_tools/lib/src/android/adb.dart
+11
-2
android_sdk.dart
packages/flutter_tools/lib/src/android/android_sdk.dart
+4
-1
device_android.dart
packages/flutter_tools/lib/src/android/device_android.dart
+11
-5
apk.dart
packages/flutter_tools/lib/src/commands/apk.dart
+16
-1
create.dart
packages/flutter_tools/lib/src/commands/create.dart
+4
-4
daemon.dart
packages/flutter_tools/lib/src/commands/daemon.dart
+1
-1
logs.dart
packages/flutter_tools/lib/src/commands/logs.dart
+0
-3
run.dart
packages/flutter_tools/lib/src/commands/run.dart
+3
-2
device_ios.dart
packages/flutter_tools/lib/src/ios/device_ios.dart
+25
-4
No files found.
packages/flutter_tools/lib/src/android/adb.dart
View file @
b7b06c2a
...
...
@@ -181,9 +181,8 @@ class AdbDevice {
}
}
// Convert `Nexus_7` / `Nexus_5X` style names to `Nexus 7` ones.
if
(
modelID
!=
null
)
modelID
=
modelID
.
replaceAll
(
'_'
,
' '
);
modelID
=
cleanAdbDeviceName
(
modelID
);
}
static
final
RegExp
deviceRegex
=
new
RegExp
(
r'^(\S+)\s+(\S+)(.*)'
);
...
...
@@ -235,6 +234,16 @@ class AdbDevice {
}
}
String
cleanAdbDeviceName
(
String
name
)
{
// Some emulators use `___` in the name as separators.
name
=
name
.
replaceAll
(
'___'
,
', '
);
// Convert `Nexus_7` / `Nexus_5X` style names to `Nexus 7` ones.
name
=
name
.
replaceAll
(
'_'
,
' '
);
return
name
;
}
List
<
int
>
_createAdbRequest
(
String
payload
)
{
List
<
int
>
data
=
payload
.
codeUnits
;
...
...
packages/flutter_tools/lib/src/android/android_sdk.dart
View file @
b7b06c2a
...
...
@@ -23,7 +23,10 @@ import '../base/os.dart';
// Perhaps something like `flutter config --android-home=foo/bar`.
/// Locate ADB. Prefer to use one from an Android SDK, if we can locate that.
String
getAdbPath
(
)
{
String
getAdbPath
(
[
AndroidSdk
existingSdk
])
{
if
(
existingSdk
?.
adbPath
!=
null
)
return
existingSdk
.
adbPath
;
AndroidSdk
sdk
=
AndroidSdk
.
locateAndroidSdk
();
if
(
sdk
?.
latestVersion
==
null
)
{
...
...
packages/flutter_tools/lib/src/android/device_android.dart
View file @
b7b06c2a
...
...
@@ -8,6 +8,7 @@ import 'dart:io';
import
'package:crypto/crypto.dart'
;
import
'package:path/path.dart'
as
path
;
import
'../android/android_sdk.dart'
;
import
'../application_package.dart'
;
import
'../base/common.dart'
;
import
'../base/globals.dart'
;
...
...
@@ -17,6 +18,7 @@ import '../build_configuration.dart';
import
'../device.dart'
;
import
'../flx.dart'
as
flx
;
import
'../toolchain.dart'
;
import
'adb.dart'
;
import
'android.dart'
;
const
String
_defaultAdbPath
=
'adb'
;
...
...
@@ -249,7 +251,12 @@ class AndroidDevice extends Device {
if
(
route
!=
null
)
cmd
.
addAll
(<
String
>[
'--es'
,
'route'
,
route
]);
cmd
.
add
(
apk
.
launchActivity
);
runCheckedSync
(
cmd
);
String
result
=
runCheckedSync
(
cmd
);
// This invocation returns 0 even when it fails.
if
(
result
.
contains
(
'Error: '
))
{
printError
(
result
.
trim
());
return
false
;
}
return
true
;
}
...
...
@@ -410,10 +417,10 @@ class AndroidDevice extends Device {
}
List
<
AndroidDevice
>
getAdbDevices
()
{
if
(
androidSdk
==
null
)
String
adbPath
=
getAdbPath
(
androidSdk
);
if
(
adbPath
==
null
)
return
<
AndroidDevice
>[];
String
adbPath
=
androidSdk
.
adbPath
;
List
<
AndroidDevice
>
devices
=
[];
List
<
String
>
output
=
runSync
(<
String
>[
adbPath
,
'devices'
,
'-l'
]).
trim
().
split
(
'
\n
'
);
...
...
@@ -445,9 +452,8 @@ List<AndroidDevice> getAdbDevices() {
String
modelID
=
match
[
3
];
String
deviceCodeName
=
match
[
4
];
// Convert `Nexus_7` / `Nexus_5X` style names to `Nexus 7` ones.
if
(
modelID
!=
null
)
modelID
=
modelID
.
replaceAll
(
'_'
,
' '
);
modelID
=
cleanAdbDeviceName
(
modelID
);
devices
.
add
(
new
AndroidDevice
(
deviceID
,
...
...
packages/flutter_tools/lib/src/commands/apk.dart
View file @
b7b06c2a
...
...
@@ -369,6 +369,17 @@ Future<int> buildAndroid({
String
flxPath:
''
,
ApkKeystoreInfo
keystore
})
async
{
// Validate that we can find an android sdk.
if
(
androidSdk
==
null
)
{
printError
(
'No Android SDK found.'
);
return
1
;
}
if
(!
androidSdk
.
validateSdkWellFormed
(
complain:
true
))
{
printError
(
'Try re-installing or updating your Android SDK.'
);
return
1
;
}
if
(!
force
&&
!
_needsRebuild
(
outputFile
,
manifest
))
{
printTrace
(
'APK up to date. Skipping build step.'
);
return
0
;
...
...
@@ -437,13 +448,17 @@ Future buildAll(
continue
;
}
await
buildAndroid
(
int
result
=
await
buildAndroid
(
toolchain:
toolchain
,
configs:
configs
,
enginePath:
enginePath
,
force:
false
,
target:
target
);
if
(
result
!=
0
)
return
result
;
}
}
return
0
;
}
packages/flutter_tools/lib/src/commands/create.dart
View file @
b7b06c2a
...
...
@@ -57,7 +57,7 @@ class CreateCommand extends Command {
All done! To run your application:
\$
cd
${out.path}
\$
flutter
start
\$
flutter
run
'''
;
if
(
argResults
[
'pub'
])
{
...
...
@@ -152,8 +152,8 @@ class FlutterSimpleTemplate extends Template {
// Android files.
files
[
'android/AndroidManifest.xml'
]
=
_apkManifest
;
// Create a file here
, so we create the directory for the user and it gets committed with
git.
files
[
'android/res/
README.md'
]
=
_androidResReadm
e
;
// Create a file here
in order to create the res/ directory and ensure it gets committed to
git.
files
[
'android/res/
.empty'
]
=
_androidEmptyFil
e
;
// iOS files.
files
.
addAll
(
iosTemplateFiles
);
...
...
@@ -285,6 +285,6 @@ final String _apkManifest = '''
</manifest>
'''
;
final
String
_android
ResReadm
e
=
'''
final
String
_android
EmptyFil
e
=
'''
Place Android resources here (http://developer.android.com/guide/topics/resources/overview.html).
'''
;
packages/flutter_tools/lib/src/commands/daemon.dart
View file @
b7b06c2a
...
...
@@ -356,7 +356,7 @@ class AndroidDeviceDiscovery {
void
_initAdb
()
{
if
(
_adb
==
null
)
{
_adb
=
new
Adb
(
getAdbPath
());
_adb
=
new
Adb
(
getAdbPath
(
androidSdk
));
if
(!
_adb
.
exists
())
_adb
=
null
;
}
...
...
packages/flutter_tools/lib/src/commands/logs.dart
View file @
b7b06c2a
...
...
@@ -23,9 +23,6 @@ class LogsCommand extends FlutterCommand {
bool
get
requiresProjectRoot
=>
false
;
Future
<
int
>
runInProject
()
async
{
DeviceManager
deviceManager
=
new
DeviceManager
();
deviceManager
.
specifiedDeviceId
=
globalResults
[
'device-id'
];
List
<
Device
>
devices
=
await
deviceManager
.
getDevices
();
if
(
devices
.
isEmpty
&&
deviceManager
.
hasSpecifiedDeviceId
)
{
...
...
packages/flutter_tools/lib/src/commands/run.dart
View file @
b7b06c2a
...
...
@@ -131,7 +131,6 @@ Future<int> startApp(
bool
startPaused:
false
,
int
debugPort:
observatoryDefaultPort
})
async
{
String
mainPath
=
findMainDartFile
(
target
);
if
(!
FileSystemEntity
.
isFileSync
(
mainPath
))
{
String
message
=
'Tried to run
$mainPath
, but that file does not exist.'
;
...
...
@@ -143,11 +142,13 @@ Future<int> startApp(
if
(
install
)
{
printTrace
(
'Running build command.'
);
await
buildAll
(
int
result
=
await
buildAll
(
devices
,
applicationPackages
,
toolchain
,
configs
,
enginePath:
enginePath
,
target:
target
);
if
(
result
!=
0
)
return
result
;
}
if
(
stop
)
{
...
...
packages/flutter_tools/lib/src/ios/device_ios.dart
View file @
b7b06c2a
...
...
@@ -348,7 +348,12 @@ class IOSSimulator extends Device {
args
.
add
(
"--observatory-port=
$debugPort
"
);
// Step 5: Launch the updated application in the simulator
SimControl
.
launch
(
id
,
app
.
id
,
args
);
try
{
SimControl
.
launch
(
id
,
app
.
id
,
args
);
}
catch
(
error
)
{
printError
(
'
$error
'
);
return
false
;
}
printTrace
(
'Successfully started
${app.name}
on
$id
'
);
...
...
@@ -388,6 +393,12 @@ class IOSSimulator extends Device {
randomFile
.
closeSync
();
}
}
void
ensureLogsExists
()
{
File
logFile
=
new
File
(
logFilePath
);
if
(!
logFile
.
existsSync
())
logFile
.
writeAsBytesSync
(<
int
>[]);
}
}
class
_IOSDeviceLogReader
extends
DeviceLogReader
{
...
...
@@ -427,6 +438,8 @@ class _IOSSimulatorLogReader extends DeviceLogReader {
final
IOSSimulator
device
;
bool
_lastWasFiltered
=
false
;
String
get
name
=>
device
.
name
;
Future
<
int
>
logs
({
bool
clear:
false
})
async
{
...
...
@@ -436,6 +449,8 @@ class _IOSSimulatorLogReader extends DeviceLogReader {
if
(
clear
)
device
.
clearLogs
();
device
.
ensureLogsExists
();
// Match the log prefix (in order to shorten it):
// 'Jan 29 01:31:44 devoncarew-macbookpro3 SpringBoard[96648]: ...'
RegExp
mapRegex
=
new
RegExp
(
r'\S+ +\S+ +\S+ \S+ (.+)\[\d+\]\)?: (.*)$'
);
...
...
@@ -453,19 +468,25 @@ class _IOSSimulatorLogReader extends DeviceLogReader {
mapFunction:
(
String
string
)
{
Match
match
=
mapRegex
.
matchAsPrefix
(
string
);
if
(
match
!=
null
)
{
_lastWasFiltered
=
true
;
// Filter out some messages that clearly aren't related to Flutter.
if
(
string
.
contains
(
': could not find icon for representation -> com.apple.'
))
return
null
;
String
category
=
match
.
group
(
1
);
String
content
=
match
.
group
(
2
);
if
(
category
==
'Game Center'
||
category
==
'itunesstored'
||
category
==
'nanoregistrylaunchd'
)
if
(
category
==
'Game Center'
||
category
==
'itunesstored'
||
category
==
'nanoregistrylaunchd'
||
category
==
'mstreamd'
||
category
==
'syncdefaultsd'
||
category
==
'companionappd'
||
category
==
'searchd'
)
return
null
;
if
(
category
==
'FlutterRunner'
)
_lastWasFiltered
=
false
;
if
(
category
==
'FlutterRunner'
||
category
==
'Runner'
)
return
content
;
return
'
$category
:
$content
'
;
}
match
=
lastMessageRegex
.
matchAsPrefix
(
string
);
if
(
match
!=
null
)
if
(
match
!=
null
&&
!
_lastWasFiltered
)
return
'(
${match.group(1)}
)'
;
return
string
;
}
...
...
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