diff --git a/dev/bots/docs.sh b/dev/bots/docs.sh index 27953a98612..c6364751176 100755 --- a/dev/bots/docs.sh +++ b/dev/bots/docs.sh @@ -8,6 +8,7 @@ pub global activate dartdoc 0.9.11 # a custom index.html, placing everything into dev/docs/doc (cd dev/tools; pub get) FLUTTER_ROOT=$PWD dart dev/tools/dartdoc.dart +FLUTTER_ROOT=$PWD dart dev/tools/javadoc.dart # Ensure google webmaster tools can verify our site. cp dev/docs/google2ed1af765c529f57.html dev/docs/doc diff --git a/dev/tools/.gitignore b/dev/tools/.gitignore index 8869425cd29..8ba245b1b60 100644 --- a/dev/tools/.gitignore +++ b/dev/tools/.gitignore @@ -1,3 +1,4 @@ .packages +.pub/ pubspec.lock packages diff --git a/dev/tools/javadoc.dart b/dev/tools/javadoc.dart new file mode 100644 index 00000000000..1c857221d66 --- /dev/null +++ b/dev/tools/javadoc.dart @@ -0,0 +1,40 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:async'; +import 'dart:io'; + +import 'package:archive/archive.dart'; +import 'package:http/http.dart' as http; + +const String kDocRoot = 'dev/docs/doc'; + +/// This script downloads an archive of Javadoc for the engine from the +/// artifact store and extracts it to the location used for Dartdoc. +Future main(List args) async { + String engineVersion = new File('bin/internal/engine.version').readAsStringSync().trim(); + + String url = 'https://storage.googleapis.com/flutter_infra/flutter/$engineVersion/android-javadoc.zip'; + http.Response response = await http.get(url); + + Archive archive = new ZipDecoder().decodeBytes(response.bodyBytes); + + Directory output = new Directory('$kDocRoot/javadoc'); + print('Extracing javadoc to ${output.path}'); + output.createSync(recursive: true); + + for (ArchiveFile af in archive) { + if (af.isFile) { + File file = new File('${output.path}/${af.name}'); + file.createSync(recursive: true); + file.writeAsBytesSync(af.content); + } + } + + File testFile = new File('${output.path}/io/flutter/view/FlutterView.html'); + if (!testFile.existsSync()) { + print('Expected file ${testFile.path} not found'); + exit(1); + } +} diff --git a/dev/tools/pubspec.yaml b/dev/tools/pubspec.yaml index 1fddb3af759..5214103e090 100644 --- a/dev/tools/pubspec.yaml +++ b/dev/tools/pubspec.yaml @@ -2,5 +2,7 @@ name: dev_tools description: Various repository development tools for flutter. dependencies: + archive: ^1.0.20 args: ^0.13.4 + http: ^0.11.3 path: ^1.4.0