Commit d97b13b5 authored by Sarah Zakarias's avatar Sarah Zakarias Committed by GitHub

Add objc doc to the dartdoc output (#10905)

parent f9461718
......@@ -14,7 +14,7 @@ bin/cache/dart-sdk/bin/pub global activate dartdoc 0.13.0+1
# a custom index.html, placing everything into dev/docs/doc.
(cd dev/tools; ../../bin/cache/dart-sdk/bin/pub get)
FLUTTER_ROOT=$PWD bin/cache/dart-sdk/bin/dart dev/tools/dartdoc.dart
FLUTTER_ROOT=$PWD bin/cache/dart-sdk/bin/dart dev/tools/javadoc.dart
FLUTTER_ROOT=$PWD bin/cache/dart-sdk/bin/dart dev/tools/java_and_objc_doc.dart
# Ensure google webmaster tools can verify our site.
cp dev/docs/google2ed1af765c529f57.html dev/docs/doc
......
/// [Flutter platform integration APIs for iOS.](https://docs.flutter.io/objcdoc/)
library iOS;
......@@ -200,6 +200,11 @@ void addHtmlBaseToIndex() {
'href="Android/Android-library.html"',
'href="https://docs.flutter.io/javadoc/"'
);
indexContents = indexContents.replaceAll(
'href="iOS/iOS-library.html"',
'href="https://docs.flutter.io/objc/"'
);
indexFile.writeAsStringSync(indexContents);
}
......@@ -243,10 +248,13 @@ Iterable<String> libraryRefs({ bool diskPath: false }) sync* {
}
// Add a fake package for platform integration APIs.
if (diskPath)
if (diskPath) {
yield 'platform_integration/lib/android.dart';
else
yield 'platform_integration/lib/ios.dart';
} else {
yield 'platform_integration/android.dart';
yield 'platform_integration/ios.dart';
}
}
void printStream(Stream<List<int>> stream) {
......
......@@ -10,18 +10,30 @@ 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.
/// This script downloads an archive of Javadoc and objc doc for the engine from
/// the artifact store and extracts them to the location used for Dartdoc.
Future<Null> main(List<String> args) async {
final String engineVersion = new File('bin/internal/engine.version').readAsStringSync().trim();
final String engineVersion =
new File('bin/internal/engine.version').readAsStringSync().trim();
final String url = 'https://storage.googleapis.com/flutter_infra/flutter/$engineVersion/android-javadoc.zip';
final String javadocUrl =
'https://storage.googleapis.com/flutter_infra/flutter/$engineVersion/android-javadoc.zip';
generateDocs(javadocUrl, 'javadoc', 'io/flutter/view/FlutterView.html');
final String objcdocUrl =
'https://storage.googleapis.com/flutter_infra/flutter/$engineVersion/ios-objcdoc.zip';
generateDocs(
objcdocUrl, 'objcdoc', 'objc/Classes/FlutterViewController.html');
}
Future<Null> generateDocs(
final String url, String docName, String checkFile) async {
final http.Response response = await http.get(url);
final Archive archive = new ZipDecoder().decodeBytes(response.bodyBytes);
final Directory output = new Directory('$kDocRoot/javadoc');
print('Extracing javadoc to ${output.path}');
final Directory output = new Directory('$kDocRoot/$docName');
print('Extracing $docName to ${output.path}');
output.createSync(recursive: true);
for (ArchiveFile af in archive) {
......@@ -32,10 +44,10 @@ Future<Null> main(List<String> args) async {
}
}
final File testFile = new File('${output.path}/io/flutter/view/FlutterView.html');
final File testFile = new File('${output.path}/$checkFile');
if (!testFile.existsSync()) {
print('Expected file ${testFile.path} not found');
exit(1);
}
print('Javadocs ready to go!');
print('$docName ready to go!');
}
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