Skip to content

Commit e943f2d

Browse files
srawlinsszakarias
andauthored
Remove the include-external option (#4027)
--------- Co-authored-by: Sarah Zakarias <zarah@google.com>
1 parent 668f7a1 commit e943f2d

File tree

7 files changed

+7
-84
lines changed

7 files changed

+7
-84
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
## 9.0.0-wip
2-
* Remove deprecated `missingCodeBlockLanguage` warning.
2+
* Remove the deprecated `missingCodeBlockLanguage` warning.
33
* Remove the deprecated `templates-dir` option.
44
* Remove the deprecated `nodoc` option.
5+
* Remove the deprecated `include-external` option.
56

67
## 8.3.4
78
* The URL for category pages now uses _category name_ instead of

lib/src/dartdoc.dart

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,6 @@ class Dartdoc {
187187
runtimeStats.startPerfTask('buildPackageGraph');
188188
var packageGraph = await packageBuilder.buildPackageGraph();
189189
runtimeStats.endPerfTask();
190-
if (packageBuilder.includeExternalsWasSpecified) {
191-
packageGraph.defaultPackage.warn(
192-
PackageWarning.deprecated,
193-
message:
194-
"The '--include-externals' option is deprecated, and will soon be "
195-
'removed.',
196-
);
197-
}
198190
var libs = packageGraph.libraryCount;
199191
logInfo("Initialized dartdoc with $libs librar${libs == 1 ? 'y' : 'ies'}");
200192

lib/src/dartdoc_options.dart

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,9 +1179,6 @@ class DartdocOptionContext extends DartdocOptionContextBase
11791179
late final Set<String> include =
11801180
Set.of(optionSet['include'].valueAt(context));
11811181

1182-
List<String> get includeExternal =>
1183-
optionSet['includeExternal'].valueAt(context);
1184-
11851182
bool get includeSource => optionSet['includeSource'].valueAt(context);
11861183

11871184
bool get injectHtml => optionSet['injectHtml'].valueAt(context);
@@ -1394,7 +1391,7 @@ List<DartdocOption> createDartdocOptions(
13941391
DartdocOptionArgOnly<bool>(
13951392
'autoIncludeDependencies', false, resourceProvider,
13961393
help: 'Include all the used libraries into the docs, even the ones not '
1397-
'in the current package or "include-external"',
1394+
'in the current package',
13981395
negatable: true),
13991396
DartdocOptionArgFile<List<String>>(
14001397
'categoryOrder', const [], resourceProvider,
@@ -1426,12 +1423,6 @@ List<DartdocOption> createDartdocOptions(
14261423
mustExist: true),
14271424
DartdocOptionArgFile<List<String>>('include', [], resourceProvider,
14281425
help: 'Names of libraries to document.', splitCommas: true),
1429-
DartdocOptionArgFile<List<String>>('includeExternal', [], resourceProvider,
1430-
optionIs: OptionKind.file,
1431-
help: 'Additional (external) dart files to include; use '
1432-
'"<directory name>/<file name>", as in "lib/material.dart".',
1433-
mustExist: true,
1434-
splitCommas: true),
14351426
DartdocOptionArgOnly<bool>('includeSource', true, resourceProvider,
14361427
help: 'Show source code blocks.', negatable: true),
14371428
DartdocOptionArgOnly<bool>('injectHtml', false, resourceProvider,

lib/src/generator/templates.runtime_renderers.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25682,7 +25682,6 @@ const _invisibleGetters = {
2568225682
'flutterRoot',
2568325683
'hashCode',
2568425684
'include',
25685-
'includeExternal',
2568625685
'includeSource',
2568725686
'injectHtml',
2568825687
'inputDir',

lib/src/model/package_builder.dart

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ import 'package:path/path.dart' as p show Context;
3636
abstract class PackageBuilder {
3737
// Builds package graph to be used by documentation generator.
3838
Future<PackageGraph> buildPackageGraph();
39-
40-
/// The `include-external` option is deprecated, so we track whether it was
41-
/// used, to report it.
42-
bool get includeExternalsWasSpecified;
4339
}
4440

4541
/// A package builder that understands pub package format.
@@ -281,11 +277,6 @@ class PubPackageBuilder implements PackageBuilder {
281277
processedLibraries.add(resolvedLibrary.element);
282278
}
283279
files.addAll(newFiles);
284-
var externals = _includedExternalsFrom(newFiles);
285-
if (externals.isNotEmpty) {
286-
includeExternalsWasSpecified = true;
287-
}
288-
files.addAll(externals);
289280

290281
var packages = _packageMetasForFiles(files.difference(_knownParts));
291282
filesInCurrentPass = {...files.difference(_knownParts)};
@@ -382,25 +373,11 @@ class PubPackageBuilder implements PackageBuilder {
382373
return dirs;
383374
}
384375

385-
/// Calculates 'includeExternal' based on a list of files.
386-
///
387-
/// Assumes each file might be part of a [DartdocOptionContext], and loads
388-
/// those objects to find any [DartdocOptionContext.includeExternal]
389-
/// configurations therein.
390-
List<String> _includedExternalsFrom(Iterable<String> files) => [
391-
for (var file in files)
392-
...DartdocOptionContext.fromContext(
393-
_config,
394-
_config.resourceProvider.getFile(file),
395-
_config.resourceProvider,
396-
).includeExternal,
397-
];
398-
399376
/// Returns the set of files that may contain elements that need to be
400377
/// documented.
401378
///
402-
/// This takes into account the 'auto-include-dependencies' option, the
403-
/// 'exclude' option, and the 'include-external' option.
379+
/// This takes into account the 'auto-include-dependencies' option, and the
380+
/// 'exclude' option.
404381
Future<Set<String>> _getFilesToDocument() async {
405382
if (_config.topLevelPackageMeta.isSdk) {
406383
return _sdkFilesToDocument
@@ -410,12 +387,7 @@ class PubPackageBuilder implements PackageBuilder {
410387
var packagesToDocument = await _findPackagesToDocument(
411388
_config.inputDir,
412389
);
413-
var files = _findFilesToDocumentInPackage(packagesToDocument).toList();
414-
var externals = _includedExternalsFrom(files);
415-
if (externals.isNotEmpty) {
416-
includeExternalsWasSpecified = true;
417-
files = [...files, ...externals];
418-
}
390+
var files = _findFilesToDocumentInPackage(packagesToDocument);
419391
return {
420392
...files.map(
421393
(s) => _pathContext.absolute(_resourceProvider.getFile(s).path)),
@@ -444,9 +416,6 @@ class PubPackageBuilder implements PackageBuilder {
444416
};
445417
}
446418

447-
@override
448-
bool includeExternalsWasSpecified = false;
449-
450419
Iterable<String> get _embedderSdkFiles => [
451420
for (var dartUri in _embedderSdkUris)
452421
_pathContext.absolute(_resourceProvider

test/packages_test.dart

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -330,35 +330,6 @@ dartdoc:
330330
packageGraph.packages.singleWhere((p) => p.name == 'one');
331331
expect(packageOne.documentedWhere, equals(DocumentLocation.missing));
332332
});
333-
334-
test(
335-
'includes external remote elements when includeExternal is specified',
336-
() async {
337-
packageOneRoot
338-
.getChildAssumingFile('dartdoc_options.yaml')
339-
.writeAsStringSync('''
340-
dartdoc:
341-
includeExternal:
342-
- bin/script.dart
343-
linkTo:
344-
url: 'https://mypub.topdomain/%n%/%v%'
345-
''');
346-
var packageGraph = await utils.bootBasicPackage(
347-
packageTwoRoot.path, packageMetaProvider, packageConfigProvider,
348-
additionalArguments: ['--link-to-remote']);
349-
350-
expect(packageGraph.packages, hasLength(3));
351-
var packageOne =
352-
packageGraph.packages.singleWhere((p) => p.name == 'one');
353-
expect(packageOne.documentedWhere, equals(DocumentLocation.remote));
354-
// TODO(srawlins): Why is there more than one?
355-
var libraryScript = packageOne.allLibraries.named('script');
356-
var classScript = libraryScript.classesAndExceptions.named('Script');
357-
expect(
358-
classScript.href,
359-
equals(
360-
'https://mypub.topdomain/one/0.0.1/script/Script-class.html'));
361-
});
362333
});
363334

364335
group('SDK package', () {

test/src/utils.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Future<DartdocOptionContext> contextFromArgv(
4747
'dartdoc', [createDartdocOptions], packageMetaProvider);
4848
optionSet.parseArguments(argv);
4949
return DartdocOptionContext.fromDefaultContextLocation(
50-
optionSet, pubPackageMetaProvider.resourceProvider);
50+
optionSet, packageMetaProvider.resourceProvider);
5151
}
5252

5353
/// Convenience factory to build a [DartdocGeneratorOptionContext] and

0 commit comments

Comments
 (0)