@@ -7,13 +7,10 @@ library dartdoc.generator;
7
7
8
8
import 'dart:async' show Future;
9
9
import 'dart:io' show Directory;
10
- import 'dart:isolate' ;
11
10
12
11
import 'package:dartdoc/src/dartdoc_options.dart' ;
13
12
import 'package:dartdoc/src/model/model.dart' show PackageGraph;
14
- import 'package:dartdoc/src/package_meta.dart' ;
15
13
import 'package:dartdoc/src/warnings.dart' ;
16
- import 'package:path/path.dart' as path;
17
14
18
15
abstract class FileWriter {
19
16
/// All filenames written by this generator.
@@ -38,12 +35,10 @@ abstract class Generator {
38
35
mixin GeneratorContext on DartdocOptionContextBase {
39
36
List <String > get footer => optionSet['footer' ].valueAt (context);
40
37
41
- /// _footerText is only used to construct synthetic options.
42
- // ignore: unused_element
43
- List <String > get _footerText => optionSet['footerText' ].valueAt (context);
38
+ List <String > get footerText => optionSet['footerText' ].valueAt (context);
44
39
45
- List < String > get footerTextPaths =>
46
- optionSet['footerTextPaths ' ].valueAt (context);
40
+ // Synthetic. TODO(jcollins-g): Eliminate special case for SDK and use config file.
41
+ bool get addSdkFooter => optionSet['addSdkFooter ' ].valueAt (context);
47
42
48
43
List <String > get header => optionSet['header' ].valueAt (context);
49
44
@@ -60,19 +55,7 @@ mixin GeneratorContext on DartdocOptionContextBase {
60
55
bool get useBaseHref => optionSet['useBaseHref' ].valueAt (context);
61
56
}
62
57
63
- Uri _sdkFooterCopyrightUri;
64
-
65
- Future <void > _setSdkFooterCopyrightUri () async {
66
- if (_sdkFooterCopyrightUri == null ) {
67
- // TODO(jdkoren): find a way to make this not specific to HTML, or have
68
- // alternatives for other supported formats.
69
- _sdkFooterCopyrightUri = await Isolate .resolvePackageUri (
70
- Uri .parse ('package:dartdoc/resources/sdk_footer_text.html' ));
71
- }
72
- }
73
-
74
58
Future <List <DartdocOption >> createGeneratorOptions () async {
75
- await _setSdkFooterCopyrightUri ();
76
59
return < DartdocOption > [
77
60
DartdocOptionArgFile <List <String >>('footer' , [],
78
61
isFile: true ,
@@ -89,23 +72,12 @@ Future<List<DartdocOption>> createGeneratorOptions() async {
89
72
'package name and version).' ,
90
73
mustExist: true ,
91
74
splitCommas: true ),
92
- DartdocOptionSyntheticOnly <List <String >>(
93
- 'footerTextPaths' ,
94
- (DartdocSyntheticOption <List <String >> option, Directory dir) {
95
- final List <String > footerTextPaths = < String > [];
96
- final PackageMeta topLevelPackageMeta =
97
- option.root['topLevelPackageMeta' ].valueAt (dir);
98
- // TODO(jcollins-g): Eliminate special casing for SDK and use config file.
99
- if (topLevelPackageMeta.isSdk == true ) {
100
- footerTextPaths
101
- .add (path.canonicalize (_sdkFooterCopyrightUri.toFilePath ()));
102
- }
103
- footerTextPaths.addAll (option.parent['footerText' ].valueAt (dir));
104
- return footerTextPaths;
75
+ DartdocOptionSyntheticOnly <bool >(
76
+ 'addSdkFooter' ,
77
+ (DartdocSyntheticOption <bool > option, Directory dir) {
78
+ return option.root['topLevelPackageMeta' ].valueAt (dir).isSdk;
105
79
},
106
- isFile: true ,
107
- help: 'paths to footer-text-files (adding special case for SDK)' ,
108
- mustExist: true ,
80
+ help: 'Whether the SDK footer text should be added (synthetic)' ,
109
81
),
110
82
DartdocOptionArgFile <List <String >>('header' , [],
111
83
isFile: true ,
0 commit comments