Skip to content

Commit 5353d24

Browse files
committed
Merge pull request #817 from dart-lang/ddc_snapshot
fixed an issue running dartdoc as a pub global activated snapshot
2 parents 46af07b + dd68981 commit 5353d24

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 0.5.0+1
2+
* [bug] fixed an issue running dartdoc as a pub global activated snapshot
3+
14
## 0.5.0
25
* [health] remove calls to deprecated methods
36
* [health] remove workaround when sorting empty iterable

lib/dartdoc.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export 'src/package_meta.dart';
3636

3737
const String name = 'dartdoc';
3838
// Update when pubspec version changes.
39-
const String version = '0.5.0';
39+
const String version = '0.5.0+1';
4040

4141
final String defaultOutDir = 'doc${Platform.pathSeparator}api';
4242

lib/resource_loader.dart

+13-7
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,15 @@ Future<String> loadAsString(String path) {
2626
if (!path.startsWith('package:')) {
2727
throw new ArgumentError('path must begin with package:');
2828
}
29-
return new Resource(path).readAsString().catchError((_) async {
30-
// TODO: Remove once https://github.com/dart-lang/pub/issues/22 is fixed.
31-
var bytes = await _doLoad(path);
32-
return new String.fromCharCodes(bytes);
33-
});
29+
30+
try {
31+
return new Resource(path).readAsString().catchError((_) {
32+
// TODO: Remove once https://github.com/dart-lang/pub/issues/22 is fixed.
33+
return _doLoad(path).then((bytes) => new String.fromCharCodes(bytes));
34+
});
35+
} catch (_) {
36+
return _doLoad(path).then((bytes) => new String.fromCharCodes(bytes));
37+
}
3438
}
3539

3640
/// Loads a `package:` resource as an [List<int>].
@@ -39,10 +43,12 @@ Future<List<int>> loadAsBytes(String path) {
3943
throw new ArgumentError('path must begin with package:');
4044
}
4145

42-
return new Resource(path).readAsBytes().catchError((_) {
46+
try {
4347
// TODO: Remove once https://github.com/dart-lang/pub/issues/22 is fixed.
48+
return new Resource(path).readAsBytes().catchError((_) => _doLoad(path));
49+
} catch (_) {
4450
return _doLoad(path);
45-
});
51+
}
4652
}
4753

4854
/// Determine how to do the load. HTTP? Snapshotted? From source?

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: dartdoc
22
# Also update the `version` field in lib/dartdoc.dart.
3-
version: 0.5.0
3+
version: 0.5.0+1
44
author: Dart Team <[email protected]>
55
description: A documentation generator for Dart.
66
homepage: https://github.com/dart-lang/dartdoc

0 commit comments

Comments
 (0)