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
2e663b24
Unverified
Commit
2e663b24
authored
Sep 28, 2021
by
Daco Harkes
Committed by
GitHub
Sep 28, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[bots] Print more on --verbose analyze_sample_code (#90880)
parent
99b210f5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
9 deletions
+40
-9
analyze_sample_code.dart
dev/bots/analyze_sample_code.dart
+40
-9
No files found.
dev/bots/analyze_sample_code.dart
View file @
2e663b24
...
...
@@ -434,15 +434,32 @@ class SampleChecker {
// The cached JSON Flutter version information from 'flutter --version --machine'.
String
?
_flutterVersion
;
Future
<
Process
Result
>
_runSnippetsScript
(
List
<
String
>
args
)
async
{
Future
<
Process
>
_runSnippetsScript
(
List
<
String
>
args
)
async
{
final
String
workingDirectory
=
path
.
join
(
_flutterRoot
,
'dev'
,
'docs'
);
if
(
_flutterVersion
==
null
)
{
// Capture the flutter version information once so that the snippets tool doesn't
// have to run it for every snippet.
if
(
verbose
)
{
print
(<
String
>[
_flutter
,
'--version'
,
'--machine'
].
join
(
' '
));
}
final
ProcessResult
versionResult
=
Process
.
runSync
(
_flutter
,
<
String
>[
'--version'
,
'--machine'
]);
if
(
verbose
)
{
stdout
.
write
(
versionResult
.
stdout
);
stderr
.
write
(
versionResult
.
stderr
);
}
_flutterVersion
=
versionResult
.
stdout
as
String
?
??
''
;
}
return
Process
.
run
(
if
(
verbose
)
{
print
(<
String
>[
Platform
.
resolvedExecutable
,
'pub'
,
'global'
,
'run'
,
'snippets'
,
...
args
,
].
join
(
' '
));
}
return
Process
.
start
(
Platform
.
resolvedExecutable
,
<
String
>[
'pub'
,
...
...
@@ -467,7 +484,14 @@ class SampleChecker {
final
String
sampleId
=
_createNameFromSource
(
'sample'
,
sample
.
start
.
filename
,
sample
.
start
.
line
);
final
String
inputName
=
'
$sampleId
.input'
;
// Now we have a filename like 'lib.src.material.foo_widget.123.dart' for each snippet.
final
File
inputFile
=
File
(
path
.
join
(
_tempDirectory
.
path
,
inputName
))..
createSync
(
recursive:
true
);
final
String
inputFilePath
=
path
.
join
(
_tempDirectory
.
path
,
inputName
);
if
(
verbose
)
{
stdout
.
writeln
(
'Creating
$inputFilePath
.'
);
}
final
File
inputFile
=
File
(
inputFilePath
)..
createSync
(
recursive:
true
);
if
(
verbose
)
{
stdout
.
writeln
(
'Writing
$inputFilePath
.'
);
}
inputFile
.
writeAsStringSync
(
sample
.
input
.
join
(
'
\n
'
));
final
File
outputFile
=
File
(
path
.
join
(
_tempDirectory
.
path
,
'
$sampleId
.dart'
));
final
List
<
String
>
args
=
<
String
>[
...
...
@@ -478,15 +502,22 @@ class SampleChecker {
'--no-format-output'
,
...
sample
.
args
,
];
if
(
verbose
)
if
(
verbose
)
{
print
(
'Generating sample for
${sample.start.filename}
:
${sample.start.line}
'
);
final
ProcessResult
process
=
await
_runSnippetsScript
(
args
);
if
(
verbose
)
stderr
.
write
(
'
${process.stderr}
'
);
if
(
process
.
exitCode
!=
0
)
{
}
final
Process
process
=
await
_runSnippetsScript
(
args
);
if
(
verbose
)
{
process
.
stdout
.
transform
(
utf8
.
decoder
).
forEach
(
stdout
.
write
);
}
process
.
stderr
.
transform
(
utf8
.
decoder
).
forEach
(
stderr
.
write
);
final
int
exitCode
=
await
process
.
exitCode
.
timeout
(
const
Duration
(
seconds:
30
),
onTimeout:
()
{
stderr
.
writeln
(
'Snippet script timed out.'
);
return
-
1
;
});
if
(
exitCode
!=
0
)
{
throw
SampleCheckerException
(
'Unable to create sample for
${sample.start.filename}
:
${sample.start.line}
'
'(using input from
${inputFile.path}
):
\n
${process.stdout}
\n
${process.stderr}
'
,
'(using input from
${inputFile.path}
).
'
,
file:
sample
.
start
.
filename
,
line:
sample
.
start
.
line
,
);
...
...
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