Skip to content

Remove all deprecated bits in preparation for next release #2821

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions lib/dartdoc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -141,20 +141,6 @@ class Dartdoc {
// ignore: unnecessary_getters_setters
set generator(Generator newGenerator) => _generator = newGenerator;

/// An asynchronous factory method that builds Dartdoc's file writers
/// and returns a Dartdoc object with them.
@Deprecated('Prefer fromContext() instead')
static Future<Dartdoc> withDefaultGenerators(
DartdocGeneratorOptionContext config,
PackageBuilder packageBuilder,
) async {
return Dartdoc._(
config,
await initHtmlGenerator(config),
packageBuilder,
);
}

/// Asynchronous factory method that builds Dartdoc with an empty generator.
static Future<Dartdoc> withEmptyGenerator(
DartdocOptionContext config,
Expand Down Expand Up @@ -193,15 +179,10 @@ class Dartdoc {

Stream<String> get onCheckProgress => _onCheckProgress.stream;

@Deprecated('Will be removed in 4.0.0. '
'Use the return value from generateDocsBase instead.')
PackageGraph packageGraph;

@visibleForTesting
Future<DartdocResults> generateDocsBase() async {
var stopwatch = Stopwatch()..start();
var packageGraph = await packageBuilder.buildPackageGraph();
this.packageGraph = packageGraph;
var seconds = stopwatch.elapsedMilliseconds / 1000.0;
var libs = packageGraph.libraries.length;
logInfo("Initialized dartdoc with $libs librar${libs == 1 ? 'y' : 'ies'} "
Expand Down
43 changes: 2 additions & 41 deletions lib/src/generator/templates.runtime_renderers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1138,26 +1138,6 @@ class _Renderer_Category extends RendererBase<Category> {
parent: r);
},
),
'fileType': Property(
getValue: (CT_ c) => c.fileType,
renderVariable:
(CT_ c, Property<CT_> self, List<String> remainingNames) {
if (remainingNames.isEmpty) {
return self.getValue(c).toString();
}
var name = remainingNames.first;
var nextProperty =
_Renderer_String.propertyMap().getValue(name);
return nextProperty.renderVariable(self.getValue(c),
nextProperty, [...remainingNames.skip(1)]);
},
isNullValue: (CT_ c) => c.fileType == null,
renderValue: (CT_ c, RendererBase<CT_> r,
List<MustachioNode> ast, StringSink sink) {
_render_String(c.fileType, ast, r.template, sink,
parent: r);
},
),
'fullyQualifiedName': Property(
getValue: (CT_ c) => c.fullyQualifiedName,
renderVariable:
Expand Down Expand Up @@ -7373,18 +7353,6 @@ class _Renderer_Library extends RendererBase<Library> {
parent: r));
},
),
'allOriginalModelElementNames': Property(
getValue: (CT_ c) => c.allOriginalModelElementNames,
renderVariable: (CT_ c, Property<CT_> self,
List<String> remainingNames) =>
self.renderSimpleVariable(
c, remainingNames, 'Iterable<String>'),
renderIterable: (CT_ c, RendererBase<CT_> r,
List<MustachioNode> ast, StringSink sink) {
return c.allOriginalModelElementNames.map((e) =>
_render_String(e, ast, r.template, sink, parent: r));
},
),
'canonicalFor': Property(
getValue: (CT_ c) => c.canonicalFor,
renderVariable: (CT_ c, Property<CT_> self,
Expand Down Expand Up @@ -11196,13 +11164,6 @@ class _Renderer_Package extends RendererBase<Package> {
self.renderSimpleVariable(c, remainingNames, 'bool'),
getBool: (CT_ c) => c.hasDocumentation == true,
),
'hasDocumentationFile': Property(
getValue: (CT_ c) => c.hasDocumentationFile,
renderVariable: (CT_ c, Property<CT_> self,
List<String> remainingNames) =>
self.renderSimpleVariable(c, remainingNames, 'bool'),
getBool: (CT_ c) => c.hasDocumentationFile == true,
),
'hasDocumentedCategories': Property(
getValue: (CT_ c) => c.hasDocumentedCategories,
renderVariable: (CT_ c, Property<CT_> self,
Expand Down Expand Up @@ -11594,7 +11555,7 @@ class _Renderer_Package extends RendererBase<Package> {
}
}

String renderIndex(PackageTemplateData context, Template template) {
String renderError(PackageTemplateData context, Template template) {
var buffer = StringBuffer();
_render_PackageTemplateData(context, template.ast, template, buffer);
return buffer.toString();
Expand Down Expand Up @@ -11796,7 +11757,7 @@ class _Renderer_PackageTemplateData extends RendererBase<PackageTemplateData> {
}
}

String renderError(PackageTemplateData context, Template template) {
String renderIndex(PackageTemplateData context, Template template) {
var buffer = StringBuffer();
_render_PackageTemplateData(context, template.ast, template, buffer);
return buffer.toString();
Expand Down
11 changes: 0 additions & 11 deletions lib/src/io_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,6 @@ String getFileNameFor(String name) =>
'${name.replaceAll(_libraryNameRegExp, '-')}.html';

final _libraryNameRegExp = RegExp('[.:]');
@Deprecated('Public variable intended to be private; will be removed as early '
'as Dartdoc 1.0.0')
RegExp get libraryNameRegexp => _libraryNameRegExp;

@Deprecated('Public variable intended to be private; will be removed as early '
'as Dartdoc 1.0.0')
final RegExp partOfRegexp = RegExp('part of ');

@Deprecated('Public variable intended to be private; will be removed as early '
'as Dartdoc 1.0.0')
final RegExp newLinePartOfRegexp = RegExp('\npart of ');

typedef TaskQueueClosure<T> = Future<T> Function();

Expand Down
34 changes: 2 additions & 32 deletions lib/src/model/canonicalization.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ abstract class Canonicalization implements Locatable, Documentable {
}

ScoredCandidate _scoreElementWithLibrary(Library lib) {
var scoredCandidate = ScoredCandidate(this, lib);
var scoredCandidate = ScoredCandidate(lib);
Iterable<String> resplit(Set<String> items) sync* {
for (var item in items) {
for (var subItem in item.split('_')) {
Expand Down Expand Up @@ -70,44 +70,20 @@ abstract class Canonicalization implements Locatable, Documentable {
scoreBoost, 'element location parts start with parts of name');
return scoredCandidate;
}

@Deprecated(
'Public method intended to be private; will be removed as early as '
'Dartdoc 1.0.0')
ScoredCandidate scoreElementWithLibrary(Library lib) =>
_scoreElementWithLibrary(lib);
}

/// This class represents the score for a particular element; how likely
/// it is that this is the canonical element.
class ScoredCandidate implements Comparable<ScoredCandidate> {
final List<String> _reasons = [];

@Deprecated(
'Public field intended to be private; will be removed as early as '
'Dartdoc 1.0.0')
List<String> get reasons => _reasons;

@Deprecated(
'Public field intended to be private; will be removed as early as '
'Dartdoc 1.0.0')
set reasons(List<String> value) => reasons = value;

/// The canonicalization element being scored.
final Canonicalization _element;

@Deprecated(
'Public getter intended to be private; will be removed as early as '
'Dartdoc 1.0.0')
Canonicalization get element => _element;

final Library library;

/// The score accumulated so far. Higher means it is more likely that this
/// is the intended canonical Library.
double score = 0.0;

ScoredCandidate(this._element, this.library);
ScoredCandidate(this.library);

void _alterScore(double scoreDelta, String reason) {
score += scoreDelta;
Expand All @@ -117,12 +93,6 @@ class ScoredCandidate implements Comparable<ScoredCandidate> {
}
}

@Deprecated(
'Public method intended to be private; will be removed as early as '
'Dartdoc 1.0.0')
void alterScore(double scoreDelta, String reason) =>
_alterScore(scoreDelta, reason);

@override
int compareTo(ScoredCandidate other) {
//assert(element == other.element);
Expand Down
4 changes: 0 additions & 4 deletions lib/src/model/categorization.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ final RegExp _categoryRegExp = RegExp(
r'[ ]*{@(api|category|subCategory|image|samples) (.+?)}[ ]*\n?',
multiLine: true);

@Deprecated('Public variable intended to be private; will be removed as early '
'as Dartdoc 1.0.0')
RegExp get categoryRegexp => _categoryRegExp;

/// Mixin implementing dartdoc categorization for ModelElements.
abstract class Categorization implements ModelElement {
@override
Expand Down
21 changes: 2 additions & 19 deletions lib/src/model/category.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,18 @@ class Category extends Nameable
Indexable
implements Documentable {
/// All libraries in [libraries] must come from [package].
// TODO(srawlins): To make final, remove public getter, setter, rename to be
// public, and add `final` modifier.
Package _package;
final Package _package;

@override
Package get package => _package;

@Deprecated('Field intended to be final; setter will be removed as early as '
'Dartdoc 1.0.0')
set package(Package value) => _package = value;

final String _name;

// TODO(srawlins): To make final, remove public getter, setter, rename to be
// public, and add `final` modifier.
DartdocOptionContext _config;
final DartdocOptionContext _config;

@override
DartdocOptionContext get config => _config;

@Deprecated('Field intended to be final; setter will be removed as early as '
'Dartdoc 1.0.0')
set config(DartdocOptionContext value) => _config = value;

final Set<Categorization> _allItems = {};

final List<Class> _classes = [];
Expand Down Expand Up @@ -140,11 +128,6 @@ class Category extends Nameable

String get _fileType => package.fileType;

@Deprecated(
'Public field intended to be private; will be removed as early as '
'Dartdoc 1.0.0')
String get fileType => _fileType;

String get filePath => 'topics/$name-topic.$_fileType';

@override
Expand Down
5 changes: 0 additions & 5 deletions lib/src/model/inheriting_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,6 @@ abstract class InheritingContainer extends Container
.map((et) => (et.modelElement as InheritingContainer))
.contains(other);

@Deprecated(
'Public method intended to be private; will be removed as early as '
'Dartdoc 1.0.0')
bool isInheritingFrom(InheritingContainer other) => _isInheritingFrom(other);

DefinedElementType _modelType;

@override
Expand Down
13 changes: 0 additions & 13 deletions lib/src/model/library.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,6 @@ class Library extends ModelElement with Categorization, TopLevelContainer {
]);
}

@Deprecated(
'Public method intended to be private; will be removed as early as '
'Dartdoc 1.0.0')
static Iterable<Element> getDefinedElements(
CompilationUnitElement compilationUnit) =>
_getDefinedElements(compilationUnit);

/// Allow scope for Libraries.
@override
Scope get scope => element.scope;
Expand Down Expand Up @@ -171,12 +164,6 @@ class Library extends ModelElement with Categorization, TopLevelContainer {
return __allOriginalModelElementNames;
}

@Deprecated(
'Public getter intended to be private; will be removed as early as '
'Dartdoc 1.0.0')
Iterable<String> get allOriginalModelElementNames =>
_allOriginalModelElementNames;

@override
CharacterLocation get characterLocation {
if (element.nameOffset == -1) {
Expand Down
13 changes: 0 additions & 13 deletions lib/src/model/package.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ import 'package:meta/meta.dart';
import 'package:path/path.dart' as path show Context;
import 'package:pub_semver/pub_semver.dart';

@Deprecated('Public variable intended to be private; will be removed as early '
'as Dartdoc 1.0.0')
RegExp get substituteNameVersion => Package._substituteNameVersion;

// All hrefs are emitted as relative paths from the output root. We are unable
// to compute them from the page we are generating, and many properties computed
// using hrefs are memoized anyway. To build complete relative hrefs, we emit
Expand All @@ -31,11 +27,6 @@ RegExp get substituteNameVersion => Package._substituteNameVersion;
@internal
const String htmlBasePlaceholder = '\%\%__HTMLBASE_dartdoc_internal__\%\%';

@Deprecated('Public variable intended to be private; will be removed as early '
'as Dartdoc 1.0.0')
// ignore: non_constant_identifier_names
const String HTMLBASE_PLACEHOLDER = htmlBasePlaceholder;

/// A [LibraryContainer] that contains [Library] objects related to a particular
/// package.
class Package extends LibraryContainer
Expand Down Expand Up @@ -142,10 +133,6 @@ class Package extends LibraryContainer

File /*?*/ _documentationFile;

@Deprecated(
'Instead use [documentationFile] which will be `null` if this package does not have one.')
bool get hasDocumentationFile => documentationFile != null;

File /*?*/ get documentationFile =>
_documentationFile ??= packageMeta.getReadmeContents();

Expand Down
11 changes: 0 additions & 11 deletions lib/src/model/package_graph.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,6 @@ class PackageGraph with CommentReferable, Nameable {
@override
Element get element => null;

@Deprecated('Use with [PackageGraph.uninitialized] instead')
// ignore: non_constant_identifier_names
factory PackageGraph.UninitializedPackageGraph(
DartdocOptionContext config,
DartSdk sdk,
bool hasEmbedderSdk,
RendererFactory rendererFactory,
PackageMetaProvider packageMetaProvider) =>
PackageGraph.uninitialized(
config, sdk, hasEmbedderSdk, rendererFactory, packageMetaProvider);

/// Call during initialization to add a library to this [PackageGraph].
///
/// Libraries added in this manner are assumed to be part of documented
Expand Down
3 changes: 0 additions & 3 deletions lib/src/source_linker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ import 'package:meta/meta.dart';
import 'package:path/path.dart' as path;

final _uriTemplateRegExp = RegExp(r'(%[frl]%)');
@Deprecated('Public variable intended to be private; will be removed as early '
'as Dartdoc 1.0.0')
RegExp get uriTemplateRegexp => _uriTemplateRegExp;

abstract class SourceLinkerOptionContext implements DartdocOptionContextBase {
List<String> get linkToSourceExcludes =>
Expand Down
4 changes: 0 additions & 4 deletions test/end2end/dartdoc_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,6 @@ void main() {
var packageGraph = results.packageGraph;
var p = packageGraph.defaultPackage;
expect(p.name, 'test_package');
// ignore: deprecated_member_use_from_same_package
expect(p.hasDocumentationFile, isTrue);
expect(p.documentationFile, isNotNull);
// Total number of public libraries in test_package.
// +2 since we are not manually excluding anything.
Expand Down Expand Up @@ -305,8 +303,6 @@ void main() {

var p = results.packageGraph;
expect(p.defaultPackage.name, 'sky_engine');
// ignore: deprecated_member_use_from_same_package
expect(p.defaultPackage.hasDocumentationFile, isFalse);
expect(p.defaultPackage.documentationFile, isNull);
expect(p.libraries, hasLength(3));
expect(p.libraries.map((lib) => lib.name).contains('dart:core'), isTrue);
Expand Down
Loading