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
efb06947
Unverified
Commit
efb06947
authored
Nov 17, 2022
by
Jenn Magder
Committed by
GitHub
Nov 17, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused flutter_attach_test_fuchsia (#115515)
parent
e1efd0d3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
238 deletions
+0
-238
flutter_attach_test_fuchsia.dart
dev/devicelab/bin/tasks/flutter_attach_test_fuchsia.dart
+0
-238
No files found.
dev/devicelab/bin/tasks/flutter_attach_test_fuchsia.dart
deleted
100644 → 0
View file @
e1efd0d3
// Copyright 2014 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
'dart:async'
;
import
'dart:convert'
;
import
'dart:io'
;
import
'dart:math'
;
import
'package:flutter_devicelab/framework/devices.dart'
;
import
'package:flutter_devicelab/framework/framework.dart'
;
import
'package:flutter_devicelab/framework/task_result.dart'
;
import
'package:flutter_devicelab/framework/utils.dart'
;
import
'package:path/path.dart'
as
path
;
void
generateMain
(
Directory
appDir
,
String
sentinel
)
{
final
String
mainCode
=
'''
import '
package:
flutter
/
foundation
.
dart
';
import '
package:
flutter
/
widgets
.
dart
';
import '
package:
flutter_driver
/
driver_extension
.
dart
';
class ReassembleListener extends StatefulWidget {
const ReassembleListener({Key key, this.child})
: super(key: key);
final Widget child;
@override
_ReassembleListenerState createState() => _ReassembleListenerState();
}
class _ReassembleListenerState extends State<ReassembleListener> {
@override
initState() {
super.initState();
print('
$sentinel
');
}
@override
void reassemble() {
super.reassemble();
print('
$sentinel
');
}
@override
Widget build(BuildContext context) {
return widget.child;
}
}
void main() {
runApp(
ReassembleListener(
child: Text(
'
Hello
,
word
!
',
textDirection: TextDirection.rtl,
)
)
);
}
'''
;
File
(
path
.
join
(
appDir
.
path
,
'lib'
,
'fuchsia_main.dart'
))
.
writeAsStringSync
(
mainCode
,
flush:
true
);
}
void
main
(
)
{
deviceOperatingSystem
=
DeviceOperatingSystem
.
fuchsia
;
task
(()
async
{
section
(
'Checking environment variables'
);
if
(
Platform
.
environment
[
'FUCHSIA_SSH_CONFIG'
]
==
null
&&
Platform
.
environment
[
'FUCHSIA_BUILD_DIR'
]
==
null
)
{
throw
Exception
(
'No FUCHSIA_SSH_CONFIG or FUCHSIA_BUILD_DIR set'
);
}
final
String
flutterBinary
=
path
.
join
(
flutterDirectory
.
path
,
'bin'
,
'flutter'
);
section
(
'Downloading Fuchsia SDK and flutter runner'
);
// Download the Fuchsia SDK.
final
int
precacheResult
=
await
exec
(
flutterBinary
,
<
String
>[
'precache'
,
'--fuchsia'
,
'--flutter_runner'
,
]
);
if
(
precacheResult
!=
0
)
{
throw
Exception
(
'flutter precache failed with exit code
$precacheResult
'
);
}
final
Directory
fuchsiaToolDirectory
=
Directory
(
path
.
join
(
flutterDirectory
.
path
,
'bin'
,
'cache'
,
'artifacts'
,
'fuchsia'
,
'tools'
));
if
(!
fuchsiaToolDirectory
.
existsSync
())
{
throw
Exception
(
'Expected Fuchsia tool directory at
${fuchsiaToolDirectory.path}
'
);
}
final
Device
device
=
await
devices
.
workingDevice
;
final
Directory
appDir
=
dir
(
path
.
join
(
flutterDirectory
.
path
,
'dev'
,
'integration_tests'
,
'ui'
,
));
await
inDirectory
(
appDir
,
()
async
{
final
Random
random
=
Random
();
final
Map
<
String
,
Completer
<
void
>>
sentinelMessage
=
<
String
,
Completer
<
void
>>{
'sentinel-
${random.nextInt(1<<32)}
'
:
Completer
<
void
>(),
'sentinel-
${random.nextInt(1<<32)}
'
:
Completer
<
void
>(),
};
late
Process
runProcess
;
late
Process
logsProcess
;
try
{
section
(
'Creating lib/fuchsia_main.dart'
);
generateMain
(
appDir
,
sentinelMessage
.
keys
.
toList
()[
0
]);
section
(
'Launching `flutter run` in
${appDir.path}
'
);
runProcess
=
await
startProcess
(
flutterBinary
,
<
String
>[
'run'
,
'--suppress-analytics'
,
'-d'
,
device
.
deviceId
,
'-t'
,
'lib/fuchsia_main.dart'
,
],
isBot:
false
,
// We just want to test the output, not have any debugging info.
);
logsProcess
=
await
startProcess
(
flutterBinary
,
<
String
>[
'logs'
,
'--suppress-analytics'
,
'-d'
,
device
.
deviceId
],
isBot:
false
,
// We just want to test the output, not have any debugging info.
);
Future
<
dynamic
>
eventOrExit
(
Future
<
void
>
event
)
{
return
Future
.
any
<
dynamic
>(<
Future
<
dynamic
>>[
event
,
runProcess
.
exitCode
,
logsProcess
.
exitCode
,
]);
}
logsProcess
.
stdout
.
transform
<
String
>(
utf8
.
decoder
)
.
transform
<
String
>(
const
LineSplitter
())
.
listen
((
String
log
)
{
print
(
'logs:stdout:
$log
'
);
for
(
final
String
sentinel
in
sentinelMessage
.
keys
)
{
if
(
log
.
contains
(
sentinel
))
{
if
(
sentinelMessage
[
sentinel
]!.
isCompleted
)
{
throw
Exception
(
'Expected a single `
$sentinel
` message in the device log, but found more than one'
);
}
sentinelMessage
[
sentinel
]!.
complete
();
break
;
}
}
});
final
Completer
<
void
>
hotReloadCompleter
=
Completer
<
void
>();
final
Completer
<
void
>
reloadedCompleter
=
Completer
<
void
>();
final
RegExp
observatoryRegexp
=
RegExp
(
'An Observatory debugger and profiler on .+ is available at'
);
runProcess
.
stdout
.
transform
<
String
>(
utf8
.
decoder
)
.
transform
<
String
>(
const
LineSplitter
())
.
listen
((
String
line
)
{
print
(
'run:stdout:
$line
'
);
if
(
observatoryRegexp
.
hasMatch
(
line
))
{
hotReloadCompleter
.
complete
();
}
else
if
(
line
.
contains
(
'Reloaded'
))
{
reloadedCompleter
.
complete
();
}
});
final
List
<
String
>
runStderr
=
<
String
>[];
runProcess
.
stderr
.
transform
<
String
>(
utf8
.
decoder
)
.
transform
<
String
>(
const
LineSplitter
())
.
listen
((
String
line
)
{
runStderr
.
add
(
line
);
print
(
'run:stderr:
$line
'
);
});
section
(
'Waiting for hot reload availability'
);
await
eventOrExit
(
hotReloadCompleter
.
future
);
section
(
'Waiting for Dart VM'
);
// Wait for the first message in the log from the Dart VM.
await
eventOrExit
(
sentinelMessage
.
values
.
toList
()[
0
].
future
);
// Change the dart file.
generateMain
(
appDir
,
sentinelMessage
.
keys
.
toList
()[
1
]);
section
(
'Hot reload'
);
runProcess
.
stdin
.
write
(
'r'
);
unawaited
(
runProcess
.
stdin
.
flush
());
await
eventOrExit
(
reloadedCompleter
.
future
);
section
(
'Waiting for Dart VM'
);
// Wait for the second message in the log from the Dart VM.
await
eventOrExit
(
sentinelMessage
.
values
.
toList
()[
1
].
future
);
section
(
'Quitting flutter run'
);
runProcess
.
stdin
.
write
(
'q'
);
unawaited
(
runProcess
.
stdin
.
flush
());
final
int
runExitCode
=
await
runProcess
.
exitCode
;
if
(
runExitCode
!=
0
||
runStderr
.
isNotEmpty
)
{
throw
Exception
(
'flutter run exited with code
$runExitCode
and errors:
${runStderr.join('\n')}
.'
);
}
}
finally
{
runProcess
.
kill
();
logsProcess
.
kill
();
File
(
path
.
join
(
appDir
.
path
,
'lib'
,
'fuchsia_main.dart'
)).
deleteSync
();
}
for
(
final
String
sentinel
in
sentinelMessage
.
keys
)
{
if
(!
sentinelMessage
[
sentinel
]!.
isCompleted
)
{
throw
Exception
(
'Expected
$sentinel
in the device logs.'
);
}
}
});
return
TaskResult
.
success
(
null
);
});
}
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