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
0aed0b61
Unverified
Commit
0aed0b61
authored
Jan 04, 2020
by
Jenn Magder
Committed by
GitHub
Jan 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add newlines between plugin names in GitHub template (#46937)
parent
fa1ebab8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
147 additions
and
68 deletions
+147
-68
github_template.dart
...ages/flutter_tools/lib/src/reporting/github_template.dart
+39
-34
github_template_test.dart
...lutter_tools/test/general.shard/github_template_test.dart
+108
-34
No files found.
packages/flutter_tools/lib/src/reporting/github_template.dart
View file @
0aed0b61
...
@@ -7,6 +7,7 @@ import 'dart:async';
...
@@ -7,6 +7,7 @@ import 'dart:async';
import
'package:file/file.dart'
;
import
'package:file/file.dart'
;
import
'../base/context.dart'
;
import
'../base/context.dart'
;
import
'../base/file_system.dart'
;
import
'../base/io.dart'
;
import
'../base/io.dart'
;
import
'../base/net.dart'
;
import
'../base/net.dart'
;
import
'../convert.dart'
;
import
'../convert.dart'
;
...
@@ -40,27 +41,27 @@ class GitHubTemplateCreator {
...
@@ -40,27 +41,27 @@ class GitHubTemplateCreator {
)
async
{
)
async
{
final
String
title
=
'[tool_crash]
$errorString
'
;
final
String
title
=
'[tool_crash]
$errorString
'
;
final
String
body
=
'''## Command
final
String
body
=
'''## Command
```
```
$command
$command
```
```
## Steps to Reproduce
## Steps to Reproduce
1. ...
1. ...
2. ...
2. ...
3. ...
3. ...
## Logs
## Logs
$exception
$exception
```
```
${LineSplitter.split(stackTrace.toString()).take(20).join('\n')}
${LineSplitter.split(stackTrace.toString()).take(20).join('\n')}
```
```
```
```
$doctorText
$doctorText
```
```
## Flutter Application Metadata
## Flutter Application Metadata
${_projectMetadataInformation()}
${_projectMetadataInformation()}
'''
;
'''
;
final
String
fullURL
=
'https://github.com/flutter/flutter/issues/new?'
final
String
fullURL
=
'https://github.com/flutter/flutter/issues/new?'
'title=
${Uri.encodeQueryComponent(title)}
'
'title=
${Uri.encodeQueryComponent(title)}
'
...
@@ -84,29 +85,33 @@ class GitHubTemplateCreator {
...
@@ -84,29 +85,33 @@ class GitHubTemplateCreator {
if
(
project
==
null
||
manifest
==
null
||
manifest
.
isEmpty
)
{
if
(
project
==
null
||
manifest
==
null
||
manifest
.
isEmpty
)
{
return
'No pubspec in working directory.'
;
return
'No pubspec in working directory.'
;
}
}
String
description
=
''
;
final
StringBuffer
description
=
StringBuffer
()
description
+=
'''
..
writeln
(
'**Version**:
${manifest.appVersion}
'
)
**Version**:
${manifest.appVersion}
..
writeln
(
'**Material**:
${manifest.usesMaterialDesign}
'
)
**Material**:
${manifest.usesMaterialDesign}
..
writeln
(
'**Android X**:
${manifest.usesAndroidX}
'
)
**Android X**:
${manifest.usesAndroidX}
..
writeln
(
'**Module**:
${manifest.isModule}
'
)
**Module**:
${manifest.isModule}
..
writeln
(
'**Plugin**:
${manifest.isPlugin}
'
)
**Plugin**:
${manifest.isPlugin}
..
writeln
(
'**Android package**:
${manifest.androidPackage}
'
)
**Android package**:
${manifest.androidPackage}
..
writeln
(
'**iOS bundle identifier**:
${manifest.iosBundleIdentifier}
'
);
**iOS bundle identifier**:
${manifest.iosBundleIdentifier}
'''
;
final
File
file
=
project
.
flutterPluginsFile
;
final
File
file
=
project
.
flutterPluginsFile
;
if
(
file
.
existsSync
())
{
if
(
file
.
existsSync
())
{
description
+=
'### Plugins
\n
'
;
description
.
writeln
(
'### Plugins'
);
// Format is:
// camera=/path/to/.pub-cache/hosted/pub.dartlang.org/camera-0.5.7+2/
for
(
String
plugin
in
project
.
flutterPluginsFile
.
readAsLinesSync
())
{
for
(
String
plugin
in
project
.
flutterPluginsFile
.
readAsLinesSync
())
{
final
List
<
String
>
pluginParts
=
plugin
.
split
(
'='
);
final
List
<
String
>
pluginParts
=
plugin
.
split
(
'='
);
if
(
pluginParts
.
length
!=
2
)
{
if
(
pluginParts
.
length
!=
2
)
{
continue
;
continue
;
}
}
description
+=
pluginParts
.
first
;
// Write the last part of the path, which includes the plugin name and version.
// Example: camera-0.5.7+2
final
List
<
String
>
pathParts
=
fs
.
path
.
split
(
pluginParts
[
1
]);
description
.
writeln
(
pathParts
.
isEmpty
?
pluginParts
.
first
:
pathParts
.
last
);
}
}
}
}
return
description
;
return
description
.
toString
()
;
}
on
Exception
catch
(
exception
)
{
}
on
Exception
catch
(
exception
)
{
return
exception
.
toString
();
return
exception
.
toString
();
}
}
...
...
packages/flutter_tools/test/general.shard/github_template_test.dart
View file @
0aed0b61
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'package:file/file.dart'
;
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/base/net.dart'
;
import
'package:flutter_tools/src/base/net.dart'
;
import
'package:flutter_tools/src/reporting/github_template.dart'
;
import
'package:flutter_tools/src/reporting/github_template.dart'
;
...
@@ -14,7 +16,6 @@ const String _kShortURL = 'https://www.example.com/short';
...
@@ -14,7 +16,6 @@ const String _kShortURL = 'https://www.example.com/short';
void
main
(
)
{
void
main
(
)
{
group
(
'GitHub template creator'
,
()
{
group
(
'GitHub template creator'
,
()
{
testUsingContext
(
'similar issues URL'
,
()
async
{
testUsingContext
(
'similar issues URL'
,
()
async
{
final
GitHubTemplateCreator
creator
=
GitHubTemplateCreator
();
final
GitHubTemplateCreator
creator
=
GitHubTemplateCreator
();
expect
(
expect
(
...
@@ -23,6 +24,8 @@ void main() {
...
@@ -23,6 +24,8 @@ void main() {
);
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
HttpClientFactory:
()
=>
()
=>
SuccessShortenURLFakeHttpClient
(),
HttpClientFactory:
()
=>
()
=>
SuccessShortenURLFakeHttpClient
(),
FileSystem:
()
=>
MemoryFileSystem
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
});
testUsingContext
(
'similar issues URL with network failure'
,
()
async
{
testUsingContext
(
'similar issues URL with network failure'
,
()
async
{
...
@@ -33,45 +36,116 @@ void main() {
...
@@ -33,45 +36,116 @@ void main() {
);
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
HttpClientFactory:
()
=>
()
=>
FakeHttpClient
(),
HttpClientFactory:
()
=>
()
=>
FakeHttpClient
(),
FileSystem:
()
=>
MemoryFileSystem
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
});
testUsingContext
(
'new issue template URL'
,
()
async
{
group
(
'new issue template URL'
,
()
{
final
GitHubTemplateCreator
creator
=
GitHubTemplateCreator
();
StackTrace
stackTrace
;
const
String
command
=
'flutter test'
;
const
String
errorString
=
'this is a 100% error'
;
const
String
exception
=
'failing to succeed!!!'
;
final
StackTrace
stackTrace
=
StackTrace
.
fromString
(
'trace'
);
const
String
doctorText
=
' [✓] Flutter (Channel report'
;
expect
(
await
creator
.
toolCrashIssueTemplateGitHubURL
(
command
,
errorString
,
exception
,
stackTrace
,
doctorText
),
_kShortURL
);
},
overrides:
<
Type
,
Generator
>{
HttpClientFactory:
()
=>
()
=>
SuccessShortenURLFakeHttpClient
(),
});
testUsingContext
(
'new issue template URL with network failure'
,
()
async
{
final
GitHubTemplateCreator
creator
=
GitHubTemplateCreator
();
const
String
command
=
'flutter test'
;
const
String
command
=
'flutter test'
;
const
String
errorString
=
'this is a 100% error'
;
const
String
errorString
=
'this is a 100% error'
;
const
String
exception
=
'failing to succeed!!!'
;
const
String
exception
=
'failing to succeed!!!'
;
final
StackTrace
stackTrace
=
StackTrace
.
fromString
(
'trace'
);
const
String
doctorText
=
' [✓] Flutter (Channel report'
;
const
String
doctorText
=
' [✓] Flutter (Channel report'
;
FileSystem
fs
;
expect
(
await
creator
.
toolCrashIssueTemplateGitHubURL
(
command
,
errorString
,
exception
,
stackTrace
,
doctorText
),
setUp
(()
async
{
'https://github.com/flutter/flutter/issues/new?title=%5Btool_crash%5D+this+is+a+100%25+error&body=%23%'
stackTrace
=
StackTrace
.
fromString
(
'trace'
);
'23+Command%0A++%60%60%60%0A++flutter+test%0A++%60%60%60%0A%0A++%23%23+Steps+to+Reproduce%0A++1.+...'
fs
=
MemoryFileSystem
();
'%0A++2.+...%0A++3.+...%0A%0A++%23%23+Logs%0A++failing+to+succeed%21%21%21%0A++%60%60%60%0A++trace%0A'
});
'++%60%60%60%0A++%60%60%60%0A+++%5B%E2%9C%93%5D+Flutter+%28Channel+report%0A++%60%60%60%0A%0A++%23%23'
'+Flutter+Application+Metadata%0A++%2A%2AVersion%2A%2A%3A+null%0A%2A%2AMaterial%2A%2A%3A+false%0A%2A'
testUsingContext
(
'shortened'
,
()
async
{
'%2AAndroid+X%2A%2A%3A+false%0A%2A%2AModule%2A%2A%3A+false%0A%2A%2APlugin%2A%2A%3A+false%0A%2A%2AAndr'
final
GitHubTemplateCreator
creator
=
GitHubTemplateCreator
();
'oid+package%2A%2A%3A+null%0A%2A%2AiOS+bundle+identifier%2A%2A%3A+null%0A%0A++&labels=tool%2Csevere%3'
expect
(
'A+crash'
await
creator
.
toolCrashIssueTemplateGitHubURL
(
command
,
errorString
,
exception
,
stackTrace
,
doctorText
),
);
_kShortURL
},
overrides:
<
Type
,
Generator
>{
);
HttpClientFactory:
()
=>
()
=>
FakeHttpClient
(),
},
overrides:
<
Type
,
Generator
>{
HttpClientFactory:
()
=>
()
=>
SuccessShortenURLFakeHttpClient
(),
FileSystem:
()
=>
MemoryFileSystem
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'with network failure'
,
()
async
{
final
GitHubTemplateCreator
creator
=
GitHubTemplateCreator
();
expect
(
await
creator
.
toolCrashIssueTemplateGitHubURL
(
command
,
errorString
,
exception
,
stackTrace
,
doctorText
),
'https://github.com/flutter/flutter/issues/new?title=%5Btool_crash%5D+this+is+a+100%25+error&body=%23%'
'23+Command%0A%60%60%60%0Aflutter+test%0A%60%60%60%0A%0A%23%23+Steps+to+Reproduce%0A1.+...'
'%0A2.+...%0A3.+...%0A%0A%23%23+Logs%0Afailing+to+succeed%21%21%21%0A%60%60%60%0Atrace%0A'
'%60%60%60%0A%60%60%60%0A+%5B%E2%9C%93%5D+Flutter+%28Channel+report%0A%60%60%60%0A%0A%23%23'
'+Flutter+Application+Metadata%0ANo+pubspec+in+working+directory.%0A&labels=tool%2Csevere%3A+crash'
);
},
overrides:
<
Type
,
Generator
>{
HttpClientFactory:
()
=>
()
=>
FakeHttpClient
(),
FileSystem:
()
=>
MemoryFileSystem
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'app metadata'
,
()
async
{
final
GitHubTemplateCreator
creator
=
GitHubTemplateCreator
();
final
Directory
projectDirectory
=
fs
.
currentDirectory
;
final
File
pluginsFile
=
projectDirectory
.
childFile
(
'.flutter-plugins'
);
projectDirectory
.
childFile
(
'pubspec.yaml'
)
.
writeAsStringSync
(
'''
name: failing_app
version: 2.0.1+100
flutter:
uses-material-design: true
module:
androidX: true
androidPackage: com.example.failing.android
iosBundleIdentifier: com.example.failing.ios
'''
);
pluginsFile
.
writeAsStringSync
(
'''
camera=/fake/pub.dartlang.org/camera-0.5.7+2/
device_info=/fake/pub.dartlang.org/pub.dartlang.org/device_info-0.4.1+4/
'''
);
final
String
actualURL
=
await
creator
.
toolCrashIssueTemplateGitHubURL
(
command
,
errorString
,
exception
,
stackTrace
,
doctorText
);
final
String
actualBody
=
Uri
.
parse
(
actualURL
).
queryParameters
[
'body'
];
const
String
expectedBody
=
'''## Command
```
flutter test
```
## Steps to Reproduce
1. ...
2. ...
3. ...
## Logs
failing to succeed!!!
```
trace
```
```
[✓] Flutter (Channel report
```
## Flutter Application Metadata
**Version**: 2.0.1+100
**Material**: true
**Android X**: true
**Module**: true
**Plugin**: false
**Android package**: com.example.failing.android
**iOS bundle identifier**: com.example.failing.ios
### Plugins
camera-0.5.7+2
device_info-0.4.1+4
'''
;
expect
(
actualBody
,
expectedBody
);
},
overrides:
<
Type
,
Generator
>{
HttpClientFactory:
()
=>
()
=>
FakeHttpClient
(),
FileSystem:
()
=>
fs
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
});
});
});
});
}
}
...
...
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