Skip to content

Commit 590edba

Browse files
authored
Remove all deprecated bits in preparation for next release (#2821)
* Remove all deprecated bits in preparation for next release * make some things final
1 parent 5e6ec89 commit 590edba

13 files changed

+6
-181
lines changed

lib/dartdoc.dart

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -141,20 +141,6 @@ class Dartdoc {
141141
// ignore: unnecessary_getters_setters
142142
set generator(Generator newGenerator) => _generator = newGenerator;
143143

144-
/// An asynchronous factory method that builds Dartdoc's file writers
145-
/// and returns a Dartdoc object with them.
146-
@Deprecated('Prefer fromContext() instead')
147-
static Future<Dartdoc> withDefaultGenerators(
148-
DartdocGeneratorOptionContext config,
149-
PackageBuilder packageBuilder,
150-
) async {
151-
return Dartdoc._(
152-
config,
153-
await initHtmlGenerator(config),
154-
packageBuilder,
155-
);
156-
}
157-
158144
/// Asynchronous factory method that builds Dartdoc with an empty generator.
159145
static Future<Dartdoc> withEmptyGenerator(
160146
DartdocOptionContext config,
@@ -193,15 +179,10 @@ class Dartdoc {
193179

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

196-
@Deprecated('Will be removed in 4.0.0. '
197-
'Use the return value from generateDocsBase instead.')
198-
PackageGraph packageGraph;
199-
200182
@visibleForTesting
201183
Future<DartdocResults> generateDocsBase() async {
202184
var stopwatch = Stopwatch()..start();
203185
var packageGraph = await packageBuilder.buildPackageGraph();
204-
this.packageGraph = packageGraph;
205186
var seconds = stopwatch.elapsedMilliseconds / 1000.0;
206187
var libs = packageGraph.libraries.length;
207188
logInfo("Initialized dartdoc with $libs librar${libs == 1 ? 'y' : 'ies'} "

lib/src/generator/templates.runtime_renderers.dart

Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,26 +1138,6 @@ class _Renderer_Category extends RendererBase<Category> {
11381138
parent: r);
11391139
},
11401140
),
1141-
'fileType': Property(
1142-
getValue: (CT_ c) => c.fileType,
1143-
renderVariable:
1144-
(CT_ c, Property<CT_> self, List<String> remainingNames) {
1145-
if (remainingNames.isEmpty) {
1146-
return self.getValue(c).toString();
1147-
}
1148-
var name = remainingNames.first;
1149-
var nextProperty =
1150-
_Renderer_String.propertyMap().getValue(name);
1151-
return nextProperty.renderVariable(self.getValue(c),
1152-
nextProperty, [...remainingNames.skip(1)]);
1153-
},
1154-
isNullValue: (CT_ c) => c.fileType == null,
1155-
renderValue: (CT_ c, RendererBase<CT_> r,
1156-
List<MustachioNode> ast, StringSink sink) {
1157-
_render_String(c.fileType, ast, r.template, sink,
1158-
parent: r);
1159-
},
1160-
),
11611141
'fullyQualifiedName': Property(
11621142
getValue: (CT_ c) => c.fullyQualifiedName,
11631143
renderVariable:
@@ -7373,18 +7353,6 @@ class _Renderer_Library extends RendererBase<Library> {
73737353
parent: r));
73747354
},
73757355
),
7376-
'allOriginalModelElementNames': Property(
7377-
getValue: (CT_ c) => c.allOriginalModelElementNames,
7378-
renderVariable: (CT_ c, Property<CT_> self,
7379-
List<String> remainingNames) =>
7380-
self.renderSimpleVariable(
7381-
c, remainingNames, 'Iterable<String>'),
7382-
renderIterable: (CT_ c, RendererBase<CT_> r,
7383-
List<MustachioNode> ast, StringSink sink) {
7384-
return c.allOriginalModelElementNames.map((e) =>
7385-
_render_String(e, ast, r.template, sink, parent: r));
7386-
},
7387-
),
73887356
'canonicalFor': Property(
73897357
getValue: (CT_ c) => c.canonicalFor,
73907358
renderVariable: (CT_ c, Property<CT_> self,
@@ -11196,13 +11164,6 @@ class _Renderer_Package extends RendererBase<Package> {
1119611164
self.renderSimpleVariable(c, remainingNames, 'bool'),
1119711165
getBool: (CT_ c) => c.hasDocumentation == true,
1119811166
),
11199-
'hasDocumentationFile': Property(
11200-
getValue: (CT_ c) => c.hasDocumentationFile,
11201-
renderVariable: (CT_ c, Property<CT_> self,
11202-
List<String> remainingNames) =>
11203-
self.renderSimpleVariable(c, remainingNames, 'bool'),
11204-
getBool: (CT_ c) => c.hasDocumentationFile == true,
11205-
),
1120611167
'hasDocumentedCategories': Property(
1120711168
getValue: (CT_ c) => c.hasDocumentedCategories,
1120811169
renderVariable: (CT_ c, Property<CT_> self,
@@ -11594,7 +11555,7 @@ class _Renderer_Package extends RendererBase<Package> {
1159411555
}
1159511556
}
1159611557

11597-
String renderIndex(PackageTemplateData context, Template template) {
11558+
String renderError(PackageTemplateData context, Template template) {
1159811559
var buffer = StringBuffer();
1159911560
_render_PackageTemplateData(context, template.ast, template, buffer);
1160011561
return buffer.toString();
@@ -11796,7 +11757,7 @@ class _Renderer_PackageTemplateData extends RendererBase<PackageTemplateData> {
1179611757
}
1179711758
}
1179811759

11799-
String renderError(PackageTemplateData context, Template template) {
11760+
String renderIndex(PackageTemplateData context, Template template) {
1180011761
var buffer = StringBuffer();
1180111762
_render_PackageTemplateData(context, template.ast, template, buffer);
1180211763
return buffer.toString();

lib/src/io_utils.dart

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,6 @@ String getFileNameFor(String name) =>
108108
'${name.replaceAll(_libraryNameRegExp, '-')}.html';
109109

110110
final _libraryNameRegExp = RegExp('[.:]');
111-
@Deprecated('Public variable intended to be private; will be removed as early '
112-
'as Dartdoc 1.0.0')
113-
RegExp get libraryNameRegexp => _libraryNameRegExp;
114-
115-
@Deprecated('Public variable intended to be private; will be removed as early '
116-
'as Dartdoc 1.0.0')
117-
final RegExp partOfRegexp = RegExp('part of ');
118-
119-
@Deprecated('Public variable intended to be private; will be removed as early '
120-
'as Dartdoc 1.0.0')
121-
final RegExp newLinePartOfRegexp = RegExp('\npart of ');
122111

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

lib/src/model/canonicalization.dart

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ abstract class Canonicalization implements Locatable, Documentable {
2626
}
2727

2828
ScoredCandidate _scoreElementWithLibrary(Library lib) {
29-
var scoredCandidate = ScoredCandidate(this, lib);
29+
var scoredCandidate = ScoredCandidate(lib);
3030
Iterable<String> resplit(Set<String> items) sync* {
3131
for (var item in items) {
3232
for (var subItem in item.split('_')) {
@@ -70,44 +70,20 @@ abstract class Canonicalization implements Locatable, Documentable {
7070
scoreBoost, 'element location parts start with parts of name');
7171
return scoredCandidate;
7272
}
73-
74-
@Deprecated(
75-
'Public method intended to be private; will be removed as early as '
76-
'Dartdoc 1.0.0')
77-
ScoredCandidate scoreElementWithLibrary(Library lib) =>
78-
_scoreElementWithLibrary(lib);
7973
}
8074

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

86-
@Deprecated(
87-
'Public field intended to be private; will be removed as early as '
88-
'Dartdoc 1.0.0')
89-
List<String> get reasons => _reasons;
90-
91-
@Deprecated(
92-
'Public field intended to be private; will be removed as early as '
93-
'Dartdoc 1.0.0')
94-
set reasons(List<String> value) => reasons = value;
95-
96-
/// The canonicalization element being scored.
97-
final Canonicalization _element;
98-
99-
@Deprecated(
100-
'Public getter intended to be private; will be removed as early as '
101-
'Dartdoc 1.0.0')
102-
Canonicalization get element => _element;
103-
10480
final Library library;
10581

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

110-
ScoredCandidate(this._element, this.library);
86+
ScoredCandidate(this.library);
11187

11288
void _alterScore(double scoreDelta, String reason) {
11389
score += scoreDelta;
@@ -117,12 +93,6 @@ class ScoredCandidate implements Comparable<ScoredCandidate> {
11793
}
11894
}
11995

120-
@Deprecated(
121-
'Public method intended to be private; will be removed as early as '
122-
'Dartdoc 1.0.0')
123-
void alterScore(double scoreDelta, String reason) =>
124-
_alterScore(scoreDelta, reason);
125-
12696
@override
12797
int compareTo(ScoredCandidate other) {
12898
//assert(element == other.element);

lib/src/model/categorization.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ final RegExp _categoryRegExp = RegExp(
88
r'[ ]*{@(api|category|subCategory|image|samples) (.+?)}[ ]*\n?',
99
multiLine: true);
1010

11-
@Deprecated('Public variable intended to be private; will be removed as early '
12-
'as Dartdoc 1.0.0')
13-
RegExp get categoryRegexp => _categoryRegExp;
14-
1511
/// Mixin implementing dartdoc categorization for ModelElements.
1612
abstract class Categorization implements ModelElement {
1713
@override

lib/src/model/category.dart

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,18 @@ class Category extends Nameable
2525
Indexable
2626
implements Documentable {
2727
/// All libraries in [libraries] must come from [package].
28-
// TODO(srawlins): To make final, remove public getter, setter, rename to be
29-
// public, and add `final` modifier.
30-
Package _package;
28+
final Package _package;
3129

3230
@override
3331
Package get package => _package;
3432

35-
@Deprecated('Field intended to be final; setter will be removed as early as '
36-
'Dartdoc 1.0.0')
37-
set package(Package value) => _package = value;
38-
3933
final String _name;
4034

41-
// TODO(srawlins): To make final, remove public getter, setter, rename to be
42-
// public, and add `final` modifier.
43-
DartdocOptionContext _config;
35+
final DartdocOptionContext _config;
4436

4537
@override
4638
DartdocOptionContext get config => _config;
4739

48-
@Deprecated('Field intended to be final; setter will be removed as early as '
49-
'Dartdoc 1.0.0')
50-
set config(DartdocOptionContext value) => _config = value;
51-
5240
final Set<Categorization> _allItems = {};
5341

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

141129
String get _fileType => package.fileType;
142130

143-
@Deprecated(
144-
'Public field intended to be private; will be removed as early as '
145-
'Dartdoc 1.0.0')
146-
String get fileType => _fileType;
147-
148131
String get filePath => 'topics/$name-topic.$_fileType';
149132

150133
@override

lib/src/model/inheriting_container.dart

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -359,11 +359,6 @@ abstract class InheritingContainer extends Container
359359
.map((et) => (et.modelElement as InheritingContainer))
360360
.contains(other);
361361

362-
@Deprecated(
363-
'Public method intended to be private; will be removed as early as '
364-
'Dartdoc 1.0.0')
365-
bool isInheritingFrom(InheritingContainer other) => _isInheritingFrom(other);
366-
367362
DefinedElementType _modelType;
368363

369364
@override

lib/src/model/library.dart

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,6 @@ class Library extends ModelElement with Categorization, TopLevelContainer {
112112
]);
113113
}
114114

115-
@Deprecated(
116-
'Public method intended to be private; will be removed as early as '
117-
'Dartdoc 1.0.0')
118-
static Iterable<Element> getDefinedElements(
119-
CompilationUnitElement compilationUnit) =>
120-
_getDefinedElements(compilationUnit);
121-
122115
/// Allow scope for Libraries.
123116
@override
124117
Scope get scope => element.scope;
@@ -171,12 +164,6 @@ class Library extends ModelElement with Categorization, TopLevelContainer {
171164
return __allOriginalModelElementNames;
172165
}
173166

174-
@Deprecated(
175-
'Public getter intended to be private; will be removed as early as '
176-
'Dartdoc 1.0.0')
177-
Iterable<String> get allOriginalModelElementNames =>
178-
_allOriginalModelElementNames;
179-
180167
@override
181168
CharacterLocation get characterLocation {
182169
if (element.nameOffset == -1) {

lib/src/model/package.dart

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ import 'package:meta/meta.dart';
1515
import 'package:path/path.dart' as path show Context;
1616
import 'package:pub_semver/pub_semver.dart';
1717

18-
@Deprecated('Public variable intended to be private; will be removed as early '
19-
'as Dartdoc 1.0.0')
20-
RegExp get substituteNameVersion => Package._substituteNameVersion;
21-
2218
// All hrefs are emitted as relative paths from the output root. We are unable
2319
// to compute them from the page we are generating, and many properties computed
2420
// using hrefs are memoized anyway. To build complete relative hrefs, we emit
@@ -31,11 +27,6 @@ RegExp get substituteNameVersion => Package._substituteNameVersion;
3127
@internal
3228
const String htmlBasePlaceholder = '\%\%__HTMLBASE_dartdoc_internal__\%\%';
3329

34-
@Deprecated('Public variable intended to be private; will be removed as early '
35-
'as Dartdoc 1.0.0')
36-
// ignore: non_constant_identifier_names
37-
const String HTMLBASE_PLACEHOLDER = htmlBasePlaceholder;
38-
3930
/// A [LibraryContainer] that contains [Library] objects related to a particular
4031
/// package.
4132
class Package extends LibraryContainer
@@ -142,10 +133,6 @@ class Package extends LibraryContainer
142133

143134
File /*?*/ _documentationFile;
144135

145-
@Deprecated(
146-
'Instead use [documentationFile] which will be `null` if this package does not have one.')
147-
bool get hasDocumentationFile => documentationFile != null;
148-
149136
File /*?*/ get documentationFile =>
150137
_documentationFile ??= packageMeta.getReadmeContents();
151138

lib/src/model/package_graph.dart

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,6 @@ class PackageGraph with CommentReferable, Nameable {
5353
@override
5454
Element get element => null;
5555

56-
@Deprecated('Use with [PackageGraph.uninitialized] instead')
57-
// ignore: non_constant_identifier_names
58-
factory PackageGraph.UninitializedPackageGraph(
59-
DartdocOptionContext config,
60-
DartSdk sdk,
61-
bool hasEmbedderSdk,
62-
RendererFactory rendererFactory,
63-
PackageMetaProvider packageMetaProvider) =>
64-
PackageGraph.uninitialized(
65-
config, sdk, hasEmbedderSdk, rendererFactory, packageMetaProvider);
66-
6756
/// Call during initialization to add a library to this [PackageGraph].
6857
///
6958
/// Libraries added in this manner are assumed to be part of documented

lib/src/source_linker.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ import 'package:meta/meta.dart';
1212
import 'package:path/path.dart' as path;
1313

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

1916
abstract class SourceLinkerOptionContext implements DartdocOptionContextBase {
2017
List<String> get linkToSourceExcludes =>

test/end2end/dartdoc_test.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,6 @@ void main() {
257257
var packageGraph = results.packageGraph;
258258
var p = packageGraph.defaultPackage;
259259
expect(p.name, 'test_package');
260-
// ignore: deprecated_member_use_from_same_package
261-
expect(p.hasDocumentationFile, isTrue);
262260
expect(p.documentationFile, isNotNull);
263261
// Total number of public libraries in test_package.
264262
// +2 since we are not manually excluding anything.
@@ -305,8 +303,6 @@ void main() {
305303

306304
var p = results.packageGraph;
307305
expect(p.defaultPackage.name, 'sky_engine');
308-
// ignore: deprecated_member_use_from_same_package
309-
expect(p.defaultPackage.hasDocumentationFile, isFalse);
310306
expect(p.defaultPackage.documentationFile, isNull);
311307
expect(p.libraries, hasLength(3));
312308
expect(p.libraries.map((lib) => lib.name).contains('dart:core'), isTrue);

0 commit comments

Comments
 (0)