Skip to content

Merge main branch to NNBD to pick up MockSdk changes #2847

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 6 commits into from
Oct 27, 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
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
## 4.1.0-dev
## 4.1.0
* Move to analyzer 2.7.0. (#2845)
* The library interface is now explicitly marked as experimental via meta.
* Experimental feature: HTML output from markdown rendering, `{@tool}` and
`{@inject-html}` is sanitized when hidden option `--sanitize-html` is passed.
* Refactor of ModelElement and ElementType constructors. Technically breaking
but known users of the API do not attempt to construct these types by hand.
(#2828, #2829)
* Move to recommended set of hints in linter and correct some small errors
in regexps. (#2833)

## 4.0.0
* BREAKING CHANGE: Refactors to support NNBD and adapt to new analyzer
Expand Down
2 changes: 1 addition & 1 deletion dartdoc_options.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dartdoc:
linkToSource:
root: '.'
uriTemplate: 'https://github.com/dart-lang/dartdoc/blob/v4.1.0-dev/%f%#L%l%'
uriTemplate: 'https://github.com/dart-lang/dartdoc/blob/v4.1.0/%f%#L%l%'
12 changes: 0 additions & 12 deletions lib/src/io_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,10 @@ import 'dart:io' as io;

import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/file_system/physical_file_system.dart';
// ignore: implementation_imports
import 'package:analyzer/src/generated/sdk.dart' show SdkLibrary;
// ignore: implementation_imports
import 'package:analyzer/src/test_utilities/mock_sdk.dart' show MockSdkLibrary;
import 'package:path/path.dart' as path show Context;

Encoding utf8AllowMalformed = Utf8Codec(allowMalformed: true);

bool isSdkLibraryDocumented(SdkLibrary library) {
if (library is MockSdkLibrary) {
// Not implemented in [MockSdkLibrary].
return true;
}
return library.isDocumented;
}

extension PathExtensions on path.Context {
/// Returns a canonicalized path including the home directory in place of
/// tilde references.
Expand Down
4 changes: 1 addition & 3 deletions lib/src/model/library.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import 'package:analyzer/src/dart/element/inheritance_manager3.dart'
show InheritanceManager3;
// ignore: implementation_imports
import 'package:analyzer/src/generated/sdk.dart' show SdkLibrary;
import 'package:dartdoc/src/io_utils.dart';
import 'package:dartdoc/src/model/comment_referable.dart';
import 'package:dartdoc/src/model/model.dart';
import 'package:dartdoc/src/package_meta.dart' show PackageMeta;
Expand Down Expand Up @@ -201,8 +200,7 @@ class Library extends ModelElement with Categorization, TopLevelContainer {
@override
bool get isPublic {
if (!super.isPublic) return false;
if (sdkLib != null &&
(sdkLib.isInternal || !isSdkLibraryDocumented(sdkLib))) {
if (sdkLib != null && (sdkLib.isInternal || !sdkLib.isDocumented)) {
return false;
}
if (config.isLibraryExcluded(name) ||
Expand Down
2 changes: 1 addition & 1 deletion lib/src/version.dart
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// Generated code. Do not modify.
const packageVersion = '4.1.0-dev';
const packageVersion = '4.1.0';
8 changes: 4 additions & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
name: dartdoc
# Run `dart run grinder build` after updating.
version: 4.1.0-dev
version: 4.1.0
description: A non-interactive HTML documentation generator for Dart source code.
homepage: https://github.com/dart-lang/dartdoc
environment:
sdk: '>=2.12.0 <3.0.0'

dependencies:
analyzer: ^2.4.0
analyzer: ^2.7.0
args: ^2.3.0
charcode: ^1.3.1
collection: ^1.15.0
cli_util: ^0.3.4
cli_util: ^0.3.5
crypto: ^3.0.1
glob: ^2.0.1
html: ^0.15.0
Expand All @@ -36,7 +36,7 @@ dev_dependencies:
grinder: ^0.9.0
http: ^0.13.3
lints: ^1.0.1
test: ^1.17.12
test: ^1.19.0

executables:
dartdoc: null
19 changes: 12 additions & 7 deletions test/documentation_comment_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/file_system/memory_file_system.dart';
import 'package:analyzer/src/dart/sdk/sdk.dart';
import 'package:analyzer/src/test_utilities/mock_sdk.dart';
import 'package:dartdoc/src/dartdoc_options.dart';
import 'package:dartdoc/src/model/model.dart';
Expand All @@ -20,8 +21,6 @@ void main() {
MemoryResourceProvider resourceProvider;
PackageMetaProvider packageMetaProvider;
FakePackageConfigProvider packageConfigProvider;
MockSdk mockSdk;
Folder sdkFolder;
Folder projectRoot;
String projectPath;
var packageName = 'my_package';
Expand All @@ -42,16 +41,22 @@ void main() {
group('documentation_comment tests', () {
setUp(() async {
resourceProvider = MemoryResourceProvider();
mockSdk = MockSdk(resourceProvider: resourceProvider);
sdkFolder = utils.writeMockSdkFiles(mockSdk);
final sdkRoot = resourceProvider.getFolder(
resourceProvider.convertPath('/sdk'),
);
createMockSdk(
resourceProvider: resourceProvider,
root: sdkRoot,
);
utils.writeMockSdkFiles(sdkRoot);

packageMetaProvider = PackageMetaProvider(
PubPackageMeta.fromElement,
PubPackageMeta.fromFilename,
PubPackageMeta.fromDir,
resourceProvider,
sdkFolder,
defaultSdk: mockSdk,
sdkRoot,
defaultSdk: FolderBasedDartSdk(resourceProvider, sdkRoot),
messageForMissingPackageMeta:
PubPackageMeta.messageForMissingPackageMeta,
);
Expand All @@ -62,7 +67,7 @@ void main() {
// To build the package graph, we always ask package_config for a
// [PackageConfig] for the SDK directory. Put a dummy entry in.
packageConfigProvider.addPackageToConfigFor(
sdkFolder.path, 'analyzer', Uri.file('/sdk/pkg/analyzer/'));
sdkRoot.path, 'analyzer', Uri.file('/sdk/pkg/analyzer/'));

projectRoot = utils.writePackage(
packageName, resourceProvider, packageConfigProvider);
Expand Down
Loading