@@ -7,13 +7,10 @@ library dartdoc.generator;
77
88import 'dart:async' show Future;
99import 'dart:io' show Directory;
10- import 'dart:isolate' ;
1110
1211import 'package:dartdoc/src/dartdoc_options.dart' ;
1312import 'package:dartdoc/src/model/model.dart' show PackageGraph;
14- import 'package:dartdoc/src/package_meta.dart' ;
1513import 'package:dartdoc/src/warnings.dart' ;
16- import 'package:path/path.dart' as path;
1714
1815abstract class FileWriter {
1916 /// All filenames written by this generator.
@@ -38,12 +35,10 @@ abstract class Generator {
3835mixin GeneratorContext on DartdocOptionContextBase {
3936 List <String > get footer => optionSet['footer' ].valueAt (context);
4037
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);
4439
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);
4742
4843 List <String > get header => optionSet['header' ].valueAt (context);
4944
@@ -60,19 +55,7 @@ mixin GeneratorContext on DartdocOptionContextBase {
6055 bool get useBaseHref => optionSet['useBaseHref' ].valueAt (context);
6156}
6257
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-
7458Future <List <DartdocOption >> createGeneratorOptions () async {
75- await _setSdkFooterCopyrightUri ();
7659 return < DartdocOption > [
7760 DartdocOptionArgFile <List <String >>('footer' , [],
7861 isFile: true ,
@@ -89,23 +72,12 @@ Future<List<DartdocOption>> createGeneratorOptions() async {
8972 'package name and version).' ,
9073 mustExist: true ,
9174 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;
10579 },
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)' ,
10981 ),
11082 DartdocOptionArgFile <List <String >>('header' , [],
11183 isFile: true ,
0 commit comments