Commit 1e6c7eb9 authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Make docs.sh resilient to not having dart in the path (#9981)

parent bc32847f
...@@ -4,14 +4,17 @@ set -e ...@@ -4,14 +4,17 @@ set -e
# If you want to run this script locally, make sure you run it from # If you want to run this script locally, make sure you run it from
# the root of the flutter repository. # the root of the flutter repository.
# Make sure dart is installed
bin/flutter --version
# Install dartdoc. # Install dartdoc.
pub global activate dartdoc 0.11.1 bin/cache/dart-sdk/bin/pub global activate dartdoc 0.11.1
# This script generates a unified doc set, and creates # This script generates a unified doc set, and creates
# a custom index.html, placing everything into dev/docs/doc. # a custom index.html, placing everything into dev/docs/doc.
(cd dev/tools; pub get) (cd dev/tools; ../../bin/cache/dart-sdk/bin/pub get)
FLUTTER_ROOT=$PWD dart dev/tools/dartdoc.dart FLUTTER_ROOT=$PWD bin/cache/dart-sdk/bin/dart dev/tools/dartdoc.dart
FLUTTER_ROOT=$PWD dart dev/tools/javadoc.dart FLUTTER_ROOT=$PWD bin/cache/dart-sdk/bin/dart dev/tools/javadoc.dart
# Ensure google webmaster tools can verify our site. # Ensure google webmaster tools can verify our site.
cp dev/docs/google2ed1af765c529f57.html dev/docs/doc cp dev/docs/google2ed1af765c529f57.html dev/docs/doc
......
...@@ -19,6 +19,11 @@ const String kDocRoot = 'dev/docs/doc'; ...@@ -19,6 +19,11 @@ const String kDocRoot = 'dev/docs/doc';
/// at the root of docs.flutter.io. We are keeping the files inside of /// at the root of docs.flutter.io. We are keeping the files inside of
/// docs.flutter.io/flutter for now, so we need to manipulate paths /// docs.flutter.io/flutter for now, so we need to manipulate paths
/// a bit. See https://github.com/flutter/flutter/issues/3900 for more info. /// a bit. See https://github.com/flutter/flutter/issues/3900 for more info.
///
/// This will only work on UNIX systems, not Windows. It requires that 'git' be
/// in your path. It requires that 'flutter' has been run previously. It uses
/// the version of Dart downloaded by the 'flutter' tool in this repository and
/// will crash if that is absent.
Future<Null> main(List<String> args) async { Future<Null> main(List<String> args) async {
// If we're run from the `tools` dir, set the cwd to the repo root. // If we're run from the `tools` dir, set the cwd to the repo root.
if (path.basename(Directory.current.path) == 'tools') if (path.basename(Directory.current.path) == 'tools')
...@@ -50,11 +55,13 @@ dependencies: ...@@ -50,11 +55,13 @@ dependencies:
new File('dev/docs/lib/temp_doc.dart').writeAsStringSync(contents.toString()); new File('dev/docs/lib/temp_doc.dart').writeAsStringSync(contents.toString());
// Run pub. // Run pub.
Process process = await Process.start('pub', <String>['get'], Process process = await Process.start(
'../../bin/cache/dart-sdk/bin/pub',
<String>['get'],
workingDirectory: 'dev/docs', workingDirectory: 'dev/docs',
environment: <String, String>{ environment: <String, String>{
'FLUTTER_ROOT': Directory.current.path 'FLUTTER_ROOT': Directory.current.path,
} },
); );
printStream(process.stdout); printStream(process.stdout);
printStream(process.stderr); printStream(process.stderr);
...@@ -65,8 +72,11 @@ dependencies: ...@@ -65,8 +72,11 @@ dependencies:
createFooter('dev/docs/lib/footer.html'); createFooter('dev/docs/lib/footer.html');
// Verify which version of dartdoc we're using. // Verify which version of dartdoc we're using.
final ProcessResult result = Process.runSync('pub', final ProcessResult result = Process.runSync(
<String>['global', 'run', 'dartdoc', '--version']); '../../bin/cache/dart-sdk/bin/pub',
<String>['global', 'run', 'dartdoc', '--version'],
workingDirectory: 'dev/docs',
);
print('\n${result.stdout}'); print('\n${result.stdout}');
// Generate the documentation. // Generate the documentation.
...@@ -87,7 +97,11 @@ dependencies: ...@@ -87,7 +97,11 @@ dependencies:
args.add(libraryRef); args.add(libraryRef);
} }
process = await Process.start('pub', args, workingDirectory: 'dev/docs'); process = await Process.start(
'../../bin/cache/dart-sdk/bin/pub',
args,
workingDirectory: 'dev/docs',
);
printStream(process.stdout); printStream(process.stdout);
printStream(process.stderr); printStream(process.stderr);
final int exitCode = await process.exitCode; final int exitCode = await process.exitCode;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment