@@ -77,7 +77,7 @@ Future<void> main(List<String> arguments) async {
7777 configurator.generateConfiguration ();
7878
7979 final PlatformDocGenerator platformGenerator = PlatformDocGenerator (outputDir: publishRoot, filesystem: filesystem);
80- platformGenerator.generatePlatformDocs ();
80+ await platformGenerator.generatePlatformDocs ();
8181
8282 final DartdocGenerator dartdocGenerator = DartdocGenerator (
8383 publishRoot: publishRoot,
@@ -465,7 +465,7 @@ class DartdocGenerator {
465465
466466 // Verify which version of snippets and dartdoc we're using.
467467 final ProcessResult snippetsResult = Process .runSync (
468- FlutterInformation .instance.getDartBinaryPath ().path,
468+ FlutterInformation .instance.getFlutterBinaryPath ().path,
469469 < String > [
470470 'pub' ,
471471 'global' ,
@@ -779,16 +779,16 @@ class PlatformDocGenerator {
779779
780780 /// This downloads an archive of platform docs for the engine from the artifact
781781 /// store and extracts them to the location used for Dartdoc.
782- void generatePlatformDocs () {
782+ Future < void > generatePlatformDocs () async {
783783 final String realm = engineRealm.isNotEmpty ? '$engineRealm /' : '' ;
784784
785785 final String javadocUrl =
786786 'https://storage.googleapis.com/${realm }flutter_infra_release/flutter/$engineRevision /android-javadoc.zip' ;
787- _extractDocs (javadocUrl, 'javadoc' , 'io/flutter/view/FlutterView.html' , outputDir);
787+ await _extractDocs (javadocUrl, 'javadoc' , 'io/flutter/view/FlutterView.html' , outputDir);
788788
789789 final String objcdocUrl =
790790 'https://storage.googleapis.com/${realm }flutter_infra_release/flutter/$engineRevision /ios-objcdoc.zip' ;
791- _extractDocs (objcdocUrl, 'objcdoc' , 'Classes/FlutterViewController.html' , outputDir);
791+ await _extractDocs (objcdocUrl, 'objcdoc' , 'Classes/FlutterViewController.html' , outputDir);
792792 }
793793
794794 /// Fetches the zip archive at the specified url.
@@ -935,7 +935,7 @@ Future<Process> runPubProcess({
935935 @visibleForTesting FileSystem filesystem = const LocalFileSystem (),
936936}) {
937937 return processManager.start (
938- < Object > [FlutterInformation .instance.getDartBinaryPath ().path, 'pub' , ...arguments],
938+ < Object > [FlutterInformation .instance.getFlutterBinaryPath ().path, 'pub' , ...arguments],
939939 workingDirectory: (workingDirectory ?? filesystem.currentDirectory).path,
940940 environment: environment,
941941 );
@@ -968,21 +968,13 @@ List<Directory> findPackages(FileSystem filesystem) {
968968}
969969
970970/// An exception class used to indicate problems when collecting information.
971- class DartdocException implements Exception {
972- DartdocException (this .message, { this .file, this .line} );
971+ class FlutterInformationException implements Exception {
972+ FlutterInformationException (this .message);
973973 final String message;
974- final String ? file;
975- final int ? line;
976974
977975 @override
978976 String toString () {
979- if (file != null || line != null ) {
980- final String fileStr = file == null ? '' : '$file :' ;
981- final String lineStr = line == null ? '' : '$line :' ;
982- return '$runtimeType : $fileStr $lineStr : $message ' ;
983- } else {
984- return '$runtimeType : $message ' ;
985- }
977+ return '$runtimeType : $message ' ;
986978 }
987979}
988980
@@ -1017,6 +1009,13 @@ class FlutterInformation {
10171009 return getFlutterRoot ().childDirectory ('bin' ).childFile ('dart' );
10181010 }
10191011
1012+ /// The path to the Dart binary in the Flutter repo.
1013+ ///
1014+ /// This is probably a shell script.
1015+ File getFlutterBinaryPath () {
1016+ return getFlutterRoot ().childDirectory ('bin' ).childFile ('flutter' );
1017+ }
1018+
10201019 /// The path to the Flutter repo root directory.
10211020 ///
10221021 /// If the environment variable `FLUTTER_ROOT` is set, will use that instead
@@ -1074,11 +1073,12 @@ class FlutterInformation {
10741073 try {
10751074 result = processManager.runSync (< String > [flutterCommand, '--version' , '--machine' ], stdoutEncoding: utf8);
10761075 } on ProcessException catch (e) {
1077- throw DartdocException (
1076+ throw FlutterInformationException (
10781077 'Unable to determine Flutter information. Either set FLUTTER_ROOT, or place flutter command in your path.\n $e ' );
10791078 }
10801079 if (result.exitCode != 0 ) {
1081- throw DartdocException ('Unable to determine Flutter information, because of abnormal exit to flutter command.' );
1080+ throw FlutterInformationException (
1081+ 'Unable to determine Flutter information, because of abnormal exit to flutter command.' );
10821082 }
10831083 flutterVersionJson = (result.stdout as String )
10841084 .replaceAll ('Waiting for another flutter command to release the startup lock...' , '' );
@@ -1088,7 +1088,7 @@ class FlutterInformation {
10881088 if (flutterVersion['flutterRoot' ] == null ||
10891089 flutterVersion['frameworkVersion' ] == null ||
10901090 flutterVersion['dartSdkVersion' ] == null ) {
1091- throw DartdocException (
1091+ throw FlutterInformationException (
10921092 'Flutter command output has unexpected format, unable to determine flutter root location.' );
10931093 }
10941094
@@ -1097,14 +1097,13 @@ class FlutterInformation {
10971097 info['flutterRoot' ] = flutterRoot;
10981098 info['frameworkVersion' ] = Version .parse (flutterVersion['frameworkVersion' ] as String );
10991099 info['engineRevision' ] = flutterVersion['engineRevision' ] as String ;
1100- info['engineRealm' ] = filesystem.file (
1101- path.join (flutterRoot.path, 'bin' , 'internal' , 'engine.realm' ,
1102- )).readAsStringSync ().trim ();
1100+ final File engineRealm = flutterRoot.childDirectory ('bin' ).childDirectory ('internal' ).childFile ('engine.realm' );
1101+ info['engineRealm' ] = engineRealm.existsSync () ? engineRealm.readAsStringSync ().trim () : '' ;
11031102
11041103 final RegExpMatch ? dartVersionRegex = RegExp (r'(?<base>[\d.]+)(?:\s+\(build (?<detail>[-.\w]+)\))?' )
11051104 .firstMatch (flutterVersion['dartSdkVersion' ] as String );
11061105 if (dartVersionRegex == null ) {
1107- throw DartdocException (
1106+ throw FlutterInformationException (
11081107 'Flutter command output has unexpected format, unable to parse dart SDK version ${flutterVersion ['dartSdkVersion' ]}.' );
11091108 }
11101109 info['dartSdkVersion' ] =
0 commit comments