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
5bd8579b
Unverified
Commit
5bd8579b
authored
Aug 28, 2023
by
Greg Spencer
Committed by
GitHub
Aug 28, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use flutter pub get instead of dart pub get in create_api_docs.dart (#133493)
parent
e8df4349
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
159 additions
and
157 deletions
+159
-157
create_api_docs.dart
dev/tools/create_api_docs.dart
+23
-24
examples_smoke_test.dart
dev/tools/examples_smoke_test.dart
+13
-13
create_api_docs_test.dart
dev/tools/test/create_api_docs_test.dart
+123
-120
No files found.
dev/tools/create_api_docs.dart
View file @
5bd8579b
...
...
@@ -77,7 +77,7 @@ Future<void> main(List<String> arguments) async {
configurator
.
generateConfiguration
();
final
PlatformDocGenerator
platformGenerator
=
PlatformDocGenerator
(
outputDir:
publishRoot
,
filesystem:
filesystem
);
platformGenerator
.
generatePlatformDocs
();
await
platformGenerator
.
generatePlatformDocs
();
final
DartdocGenerator
dartdocGenerator
=
DartdocGenerator
(
publishRoot:
publishRoot
,
...
...
@@ -465,7 +465,7 @@ class DartdocGenerator {
// Verify which version of snippets and dartdoc we're using.
final
ProcessResult
snippetsResult
=
Process
.
runSync
(
FlutterInformation
.
instance
.
get
Dart
BinaryPath
().
path
,
FlutterInformation
.
instance
.
get
Flutter
BinaryPath
().
path
,
<
String
>[
'pub'
,
'global'
,
...
...
@@ -779,16 +779,16 @@ class PlatformDocGenerator {
/// This downloads an archive of platform docs for the engine from the artifact
/// store and extracts them to the location used for Dartdoc.
void
generatePlatformDocs
()
{
Future
<
void
>
generatePlatformDocs
()
async
{
final
String
realm
=
engineRealm
.
isNotEmpty
?
'
$engineRealm
/'
:
''
;
final
String
javadocUrl
=
'https://storage.googleapis.com/
${realm}
flutter_infra_release/flutter/
$engineRevision
/android-javadoc.zip'
;
_extractDocs
(
javadocUrl
,
'javadoc'
,
'io/flutter/view/FlutterView.html'
,
outputDir
);
await
_extractDocs
(
javadocUrl
,
'javadoc'
,
'io/flutter/view/FlutterView.html'
,
outputDir
);
final
String
objcdocUrl
=
'https://storage.googleapis.com/
${realm}
flutter_infra_release/flutter/
$engineRevision
/ios-objcdoc.zip'
;
_extractDocs
(
objcdocUrl
,
'objcdoc'
,
'Classes/FlutterViewController.html'
,
outputDir
);
await
_extractDocs
(
objcdocUrl
,
'objcdoc'
,
'Classes/FlutterViewController.html'
,
outputDir
);
}
/// Fetches the zip archive at the specified url.
...
...
@@ -935,7 +935,7 @@ Future<Process> runPubProcess({
@visibleForTesting
FileSystem
filesystem
=
const
LocalFileSystem
(),
})
{
return
processManager
.
start
(
<
Object
>[
FlutterInformation
.
instance
.
get
Dart
BinaryPath
().
path
,
'pub'
,
...
arguments
],
<
Object
>[
FlutterInformation
.
instance
.
get
Flutter
BinaryPath
().
path
,
'pub'
,
...
arguments
],
workingDirectory:
(
workingDirectory
??
filesystem
.
currentDirectory
).
path
,
environment:
environment
,
);
...
...
@@ -968,21 +968,13 @@ List<Directory> findPackages(FileSystem filesystem) {
}
/// An exception class used to indicate problems when collecting information.
class
Dartdoc
Exception
implements
Exception
{
DartdocException
(
this
.
message
,
{
this
.
file
,
this
.
line
}
);
class
FlutterInformation
Exception
implements
Exception
{
FlutterInformationException
(
this
.
message
);
final
String
message
;
final
String
?
file
;
final
int
?
line
;
@override
String
toString
()
{
if
(
file
!=
null
||
line
!=
null
)
{
final
String
fileStr
=
file
==
null
?
''
:
'
$file
:'
;
final
String
lineStr
=
line
==
null
?
''
:
'
$line
:'
;
return
'
$runtimeType
:
$fileStr$lineStr
:
$message
'
;
}
else
{
return
'
$runtimeType
:
$message
'
;
}
return
'
$runtimeType
:
$message
'
;
}
}
...
...
@@ -1017,6 +1009,13 @@ class FlutterInformation {
return
getFlutterRoot
().
childDirectory
(
'bin'
).
childFile
(
'dart'
);
}
/// The path to the Dart binary in the Flutter repo.
///
/// This is probably a shell script.
File
getFlutterBinaryPath
()
{
return
getFlutterRoot
().
childDirectory
(
'bin'
).
childFile
(
'flutter'
);
}
/// The path to the Flutter repo root directory.
///
/// If the environment variable `FLUTTER_ROOT` is set, will use that instead
...
...
@@ -1074,11 +1073,12 @@ class FlutterInformation {
try
{
result
=
processManager
.
runSync
(<
String
>[
flutterCommand
,
'--version'
,
'--machine'
],
stdoutEncoding:
utf8
);
}
on
ProcessException
catch
(
e
)
{
throw
Dartdoc
Exception
(
throw
FlutterInformation
Exception
(
'Unable to determine Flutter information. Either set FLUTTER_ROOT, or place flutter command in your path.
\n
$e
'
);
}
if
(
result
.
exitCode
!=
0
)
{
throw
DartdocException
(
'Unable to determine Flutter information, because of abnormal exit to flutter command.'
);
throw
FlutterInformationException
(
'Unable to determine Flutter information, because of abnormal exit to flutter command.'
);
}
flutterVersionJson
=
(
result
.
stdout
as
String
)
.
replaceAll
(
'Waiting for another flutter command to release the startup lock...'
,
''
);
...
...
@@ -1088,7 +1088,7 @@ class FlutterInformation {
if
(
flutterVersion
[
'flutterRoot'
]
==
null
||
flutterVersion
[
'frameworkVersion'
]
==
null
||
flutterVersion
[
'dartSdkVersion'
]
==
null
)
{
throw
Dartdoc
Exception
(
throw
FlutterInformation
Exception
(
'Flutter command output has unexpected format, unable to determine flutter root location.'
);
}
...
...
@@ -1097,14 +1097,13 @@ class FlutterInformation {
info
[
'flutterRoot'
]
=
flutterRoot
;
info
[
'frameworkVersion'
]
=
Version
.
parse
(
flutterVersion
[
'frameworkVersion'
]
as
String
);
info
[
'engineRevision'
]
=
flutterVersion
[
'engineRevision'
]
as
String
;
info
[
'engineRealm'
]
=
filesystem
.
file
(
path
.
join
(
flutterRoot
.
path
,
'bin'
,
'internal'
,
'engine.realm'
,
)).
readAsStringSync
().
trim
();
final
File
engineRealm
=
flutterRoot
.
childDirectory
(
'bin'
).
childDirectory
(
'internal'
).
childFile
(
'engine.realm'
);
info
[
'engineRealm'
]
=
engineRealm
.
existsSync
()
?
engineRealm
.
readAsStringSync
().
trim
()
:
''
;
final
RegExpMatch
?
dartVersionRegex
=
RegExp
(
r'(?<base>[\d.]+)(?:\s+\(build (?<detail>[-.\w]+)\))?'
)
.
firstMatch
(
flutterVersion
[
'dartSdkVersion'
]
as
String
);
if
(
dartVersionRegex
==
null
)
{
throw
Dartdoc
Exception
(
throw
FlutterInformation
Exception
(
'Flutter command output has unexpected format, unable to parse dart SDK version
${flutterVersion['dartSdkVersion']}
.'
);
}
info
[
'dartSdkVersion'
]
=
...
...
dev/tools/examples_smoke_test.dart
View file @
5bd8579b
...
...
@@ -17,21 +17,21 @@ import 'package:path/path.dart' as path;
import
'package:platform/platform.dart'
;
import
'package:process/process.dart'
;
FileSystem
filesystem
=
const
LocalFileSystem
();
ProcessManager
processManager
=
const
LocalProcessManager
();
Platform
platform
=
const
LocalPlatform
();
const
FileSystem
_kFilesystem
=
LocalFileSystem
();
const
ProcessManager
_kProcessManager
=
LocalProcessManager
();
const
Platform
_kPlatform
=
LocalPlatform
();
FutureOr
<
dynamic
>
main
()
async
{
if
(!
platform
.
isLinux
&&
!
platform
.
isWindows
&&
!
p
latform
.
isMacOS
)
{
if
(!
_kPlatform
.
isLinux
&&
!
_kPlatform
.
isWindows
&&
!
_kP
latform
.
isMacOS
)
{
stderr
.
writeln
(
'Example smoke tests are only designed to run on desktop platforms'
);
exitCode
=
4
;
return
;
}
final
Directory
flutterDir
=
f
ilesystem
.
directory
(
final
Directory
flutterDir
=
_kF
ilesystem
.
directory
(
path
.
absolute
(
path
.
dirname
(
path
.
dirname
(
path
.
dirname
(
p
latform
.
script
.
toFilePath
()),
path
.
dirname
(
_kP
latform
.
script
.
toFilePath
()),
),
),
),
...
...
@@ -63,16 +63,16 @@ Future<void> runSmokeTests({
required
Directory
apiDir
,
})
async
{
final
File
flutterExe
=
flutterDir
.
childDirectory
(
'bin'
).
childFile
(
p
latform
.
isWindows
?
'flutter.bat'
:
'flutter'
);
flutterDir
.
childDirectory
(
'bin'
).
childFile
(
_kP
latform
.
isWindows
?
'flutter.bat'
:
'flutter'
);
final
List
<
String
>
cmd
=
<
String
>[
// If we're in a container with no X display, then use the virtual framebuffer.
if
(
p
latform
.
isLinux
&&
(
p
latform
.
environment
[
'DISPLAY'
]
==
null
||
p
latform
.
environment
[
'DISPLAY'
]!.
isEmpty
))
'/usr/bin/xvfb-run'
,
if
(
_kP
latform
.
isLinux
&&
(
_kP
latform
.
environment
[
'DISPLAY'
]
==
null
||
_kP
latform
.
environment
[
'DISPLAY'
]!.
isEmpty
))
'/usr/bin/xvfb-run'
,
flutterExe
.
absolute
.
path
,
'test'
,
'--reporter=expanded'
,
'--device-id=
${
p
latform.operatingSystem}
'
,
'--device-id=
${
_kP
latform.operatingSystem}
'
,
integrationTest
.
absolute
.
path
,
];
await
runCommand
(
cmd
,
workingDirectory:
apiDir
);
...
...
@@ -112,7 +112,7 @@ Future<File> generateTest(Directory apiDir) async {
.
trim
()
.
split
(
'
\n
'
);
final
Iterable
<
File
>
examples
=
gitFiles
.
map
<
File
>((
String
examplePath
)
{
return
f
ilesystem
.
file
(
path
.
join
(
examplesLibDir
.
absolute
.
path
,
examplePath
));
return
_kF
ilesystem
.
file
(
path
.
join
(
examplesLibDir
.
absolute
.
path
,
examplePath
));
});
// Collect the examples, and import them all as separate symbols.
...
...
@@ -202,7 +202,7 @@ Future<String> runCommand(
}
try
{
process
=
await
p
rocessManager
.
start
(
process
=
await
_kP
rocessManager
.
start
(
cmd
,
workingDirectory:
workingDirectory
.
absolute
.
path
,
environment:
environment
,
...
...
dev/tools/test/create_api_docs_test.dart
View file @
5bd8579b
This diff is collapsed.
Click to expand it.
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