From fbe31bb97be02fdf235f0a27df3302300a1e0055 Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Thu, 27 Mar 2025 10:29:22 -0700 Subject: [PATCH 1/3] Bump to 9.0.0-dev --- CHANGELOG.md | 1 + testing/test_package/lib/src/nodocme.dart | 11 ----------- 2 files changed, 1 insertion(+), 11 deletions(-) delete mode 100644 testing/test_package/lib/src/nodocme.dart diff --git a/CHANGELOG.md b/CHANGELOG.md index 78fda3d418..110561a847 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## 9.0.0-wip * Remove deprecated `missingCodeBlockLanguage` warning. +* Remove the deprecated `nodoc` option. ## 8.3.4 * The URL for category pages now uses _category name_ instead of diff --git a/testing/test_package/lib/src/nodocme.dart b/testing/test_package/lib/src/nodocme.dart deleted file mode 100644 index 707a399fb6..0000000000 --- a/testing/test_package/lib/src/nodocme.dart +++ /dev/null @@ -1,11 +0,0 @@ -/// -/// The library nodocme should never have any members documented, even if -/// reexported, due to dartdoc_options.yaml in the package root. -/// - -library nodocme; - -/// I should not appear in documentation. -class NodocMeImplementation {} - -class MeNeitherEvenWithoutADocComment {} From 066a0af597d53d95015820de286925cbfcb0e252 Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Thu, 27 Mar 2025 10:29:34 -0700 Subject: [PATCH 2/3] Remove the deprecated nodoc option --- lib/src/dartdoc_options.dart | 9 ------- lib/src/model/documentation_comment.dart | 6 ----- lib/src/model/package_graph.dart | 32 ----------------------- test/end2end/model_test.dart | 16 ------------ testing/test_package/dartdoc_options.yaml | 1 - 5 files changed, 64 deletions(-) diff --git a/lib/src/dartdoc_options.dart b/lib/src/dartdoc_options.dart index 79c1a2a59c..4a09f99f08 100644 --- a/lib/src/dartdoc_options.dart +++ b/lib/src/dartdoc_options.dart @@ -1207,8 +1207,6 @@ class DartdocOptionContext extends DartdocOptionContextBase // ignore: unused_element String get _linkToHosted => optionSet['linkTo']['hosted'].valueAt(context); - List get nodoc => optionSet['nodoc'].valueAt(context); - String get output => optionSet['output'].valueAt(context); PackageMeta get packageMeta => optionSet['packageMeta'].valueAt(context); @@ -1504,13 +1502,6 @@ List createDartdocOptions( help: 'Allow links to be generated for packages outside this one.', negatable: true), ]), - // Deprecated. Use of this option is reported. - // TODO(srawlins): Remove. - DartdocOptionFileOnly>('nodoc', [], resourceProvider, - optionIs: OptionKind.glob, - help: '(deprecated) Dart symbols declared in these files will be ' - 'treated as though they have the @nodoc directive added to their ' - 'documentation comment.'), DartdocOptionArgOnly('output', resourceProvider.pathContext.join('doc', 'api'), resourceProvider, optionIs: OptionKind.dir, help: 'Path to the output directory.'), diff --git a/lib/src/model/documentation_comment.dart b/lib/src/model/documentation_comment.dart index 83880b2b26..6aff687706 100644 --- a/lib/src/model/documentation_comment.dart +++ b/lib/src/model/documentation_comment.dart @@ -85,15 +85,9 @@ mixin DocumentationComment /// dartdoc's generated output. /// /// An element is considered to be 'nodoc' if any of the following are true: - /// * a global 'nodoc' configuration has been set for this element (this - /// feature is deprecated), /// * the element has no documentation comment, /// * the documentation comment contains the `@nodoc` dartdoc directive. late final bool hasNodoc = () { - if (packageGraph - .configSetsNodocFor(element.library2!.firstFragment.source.fullName)) { - return true; - } if (!hasDocumentationComment) { return false; } diff --git a/lib/src/model/package_graph.dart b/lib/src/model/package_graph.dart index 6dbe63a192..4c0de5897a 100644 --- a/lib/src/model/package_graph.dart +++ b/lib/src/model/package_graph.dart @@ -905,38 +905,6 @@ class PackageGraph with CommentReferable, Nameable { return allElements; } - /// Cache of 'nodoc' configurations. - /// - /// Glob lookups can be expensive, so cache per filename. - final _configSetsNodocFor = HashMap(); - - /// Given an element's [fullName], look up the nodoc configuration data and - /// determine whether to unconditionally treat the element as "nodoc", an - /// attribute indicating that documentation should not be included in - /// dartdoc's generated output. - /// - /// This configuration setting is deprecated. - bool configSetsNodocFor(String fullName) { - return _configSetsNodocFor.putIfAbsent(fullName, () { - var file = resourceProvider.getFile(fullName); - // Direct lookup instead of generating a custom context will save some - // cycles. We can't use the element's [DartdocOptionContext] because that - // might not be where the element was defined, which is what's important - // for nodoc's semantics. Looking up the defining element just to pull - // a context is again, slow. - var globs = (config.optionSet['nodoc'].valueAt(file.parent) as List) - .cast(); - if (globs.isNotEmpty) { - packageGraph.defaultPackage.warn( - PackageWarning.deprecated, - message: - "The '--nodoc' option is deprecated, and will soon be removed.", - ); - } - return utils.matchGlobs(globs, fullName); - }); - } - /// Returns a macro by [name], or `null` if no macro is found. String? getMacro(String name) { assert(_localDocumentationBuilt); diff --git a/test/end2end/model_test.dart b/test/end2end/model_test.dart index 319b2affea..8921abe3d6 100644 --- a/test/end2end/model_test.dart +++ b/test/end2end/model_test.dart @@ -1158,22 +1158,6 @@ void main() async { }); }); - group('Comment processing', () { - test('can virtually add nodoc via options file', () { - var NodocMeLibrary = - packageGraph.defaultPackage.allLibraries.named('nodocme'); - expect(NodocMeLibrary.hasNodoc, isTrue); - var NodocMeImplementation = - fakeLibrary.classes.named('NodocMeImplementation'); - expect(NodocMeImplementation.hasNodoc, isTrue); - expect(NodocMeImplementation.isPublic, isFalse); - var MeNeitherEvenWithoutADocComment = - fakeLibrary.classes.named('MeNeitherEvenWithoutADocComment'); - expect(MeNeitherEvenWithoutADocComment.hasNodoc, isTrue); - expect(MeNeitherEvenWithoutADocComment.isPublic, isFalse); - }); - }); - group('doc references', () { late final String docsAsHtml; diff --git a/testing/test_package/dartdoc_options.yaml b/testing/test_package/dartdoc_options.yaml index 62cc21fd8f..81b41de0fd 100644 --- a/testing/test_package/dartdoc_options.yaml +++ b/testing/test_package/dartdoc_options.yaml @@ -7,7 +7,6 @@ dartdoc: Unreal: markdown: "Unreal.md" Real Libraries: - nodoc: ["lib/src/nodoc*.dart"] tools: drill: command: ["bin/drill.dart"] From 6a8ee3b227531a5c25448c9daa3ca1a36e4b9541 Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Thu, 27 Mar 2025 10:38:22 -0700 Subject: [PATCH 3/3] fix --- testing/test_package/lib/fake.dart | 3 --- 1 file changed, 3 deletions(-) diff --git a/testing/test_package/lib/fake.dart b/testing/test_package/lib/fake.dart index e42bcc10a0..4ed5131e92 100644 --- a/testing/test_package/lib/fake.dart +++ b/testing/test_package/lib/fake.dart @@ -79,9 +79,6 @@ import 'mylibpub.dart' as renamedLib2; import 'two_exports.dart' show BaseClass; export 'src/notadotdartfile'; -// Verify that even though reexported, objects don't show in documentation. -export 'package:test_package/src/nodocme.dart'; - // ignore: uri_does_not_exist export 'package:test_package_imported/categoryExporting.dart' show IAmAClassWithCategories;