Skip to content

Remove unused coverage feature #3444

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 5 commits into from
Jun 14, 2023
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
11 changes: 0 additions & 11 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,8 @@ jobs:
run: ./tool/ci.sh
env:
DARTDOC_BOT: ${{ matrix.job }}
#COVERAGE_TOKEN: true # this needs to be set to enable coverage
- name: ${{ matrix.job }}
if: runner.os == 'Windows' && matrix.job == 'main'
run: dart run grinder buildbot
env:
DARTDOC_BOT: ${{ matrix.job }}
# - id: coverage
# name: Upload coverage
# if: runner.os == 'Linux' && matrix.job == 'main' && matrix.sdk == 'dev'
# uses: coverallsapp/github-action@v1.1.2
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# path-to-lcov: lcov.info
# - name: Echo coveralls api result
# if: runner.os == 'Linux' && matrix.job == 'main' && matrix.sdk == 'dev'
# run: echo ${{ steps.coverage.outputs['coveralls-api-result'] }}
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Dart documentation generator

[![Build Status](https://github.com/dart-lang/dartdoc/workflows/Test/badge.svg)](https://github.com/dart-lang/dartdoc/actions?query=workflow%3ATest)
[![Coverage Status](https://coveralls.io/repos/github/dart-lang/dartdoc/badge.svg?branch=main)](https://coveralls.io/github/dart-lang/dartdoc?branch=main)
[![OpenSSF
Scorecard](https://api.securityscorecards.dev/projects/github.com/dart-lang/dartdoc/badge)](https://deps.dev/project/github/dart-lang%2Fdartdoc)

Expand Down
30 changes: 2 additions & 28 deletions lib/src/generator/templates.runtime_renderers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8574,19 +8574,6 @@ class _Renderer_Library extends RendererBase<Library> {
parent: r, getters: _invisibleGetters['Scope']!);
},
),
'sdkLib': Property(
getValue: (CT_ c) => c.sdkLib,
renderVariable: (CT_ c, Property<CT_> self,
List<String> remainingNames) =>
self.renderSimpleVariable(
c, remainingNames, 'SdkLibrary'),
isNullValue: (CT_ c) => c.sdkLib == null,
renderValue: (CT_ c, RendererBase<CT_> r,
List<MustachioNode> ast, StringSink sink) {
renderSimple(c.sdkLib, ast, r.template, sink,
parent: r, getters: _invisibleGetters['SdkLibrary']!);
},
),
'sidebarPath': Property(
getValue: (CT_ c) => c.sidebarPath,
renderVariable:
Expand Down Expand Up @@ -12565,7 +12552,7 @@ class _Renderer_Package extends RendererBase<Package> {
}
}

String renderIndex(PackageTemplateData context, Template template) {
String renderSearchPage(PackageTemplateData context, Template template) {
var buffer = StringBuffer();
_render_PackageTemplateData(context, template.ast, template, buffer);
return buffer.toString();
Expand Down Expand Up @@ -12853,7 +12840,7 @@ String renderError(PackageTemplateData context, Template template) {
return buffer.toString();
}

String renderSearchPage(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 Expand Up @@ -17136,19 +17123,6 @@ const _invisibleGetters = {
'variable'
},
'Scope': {'hashCode', 'runtimeType'},
'SdkLibrary': {
'category',
'hashCode',
'isDart2JsLibrary',
'isDocumented',
'isImplementation',
'isInternal',
'isShared',
'isVmLibrary',
'path',
'runtimeType',
'shortName'
},
'Set': {
'first',
'hashCode',
Expand Down
3 changes: 0 additions & 3 deletions lib/src/model/library.dart
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,6 @@ class Library extends ModelElement
SdkLibrary? get _sdkLib =>
packageGraph.sdkLibrarySources[element.librarySource];

@Deprecated('Will be removed soon')
SdkLibrary? get sdkLib => _sdkLib;

@override
bool get isPublic {
if (!super.isPublic) return false;
Expand Down
3 changes: 0 additions & 3 deletions lib/src/model/package_graph.dart
Original file line number Diff line number Diff line change
Expand Up @@ -624,9 +624,6 @@ class PackageGraph with CommentReferable, Nameable, ModelBuilder {

final Map<Element?, Library?> _canonicalLibraryFor = {};

@Deprecated('Not public API; will be removed')
Library? findCanonicalLibraryFor(Element e) => _findCanonicalLibraryFor(e);

/// Tries to find a top level library that references this element.
Library? _findCanonicalLibraryFor(Element e) {
assert(allLibrariesAdded);
Expand Down
1 change: 0 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ dev_dependencies:
build_test: ^2.1.7
build_version: ^2.1.1
code_builder: ^4.4.0
coverage: ^1.6.3
dart_style: ^2.3.1
grinder: ^0.9.4
http: ">=0.13.6 <2.0.0"
Expand Down
5 changes: 0 additions & 5 deletions tool/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
set -ex

DART_VERSION=`dart --version 2>&1 | awk '{print $4}'`
# Do not run coverage on non-dev builds or non-Linux platforms.
if ! echo "${DART_VERSION}" | grep -q dev || ! uname | grep -q Linux ; then
unset COVERAGE_TOKEN
fi

if [ "$DARTDOC_BOT" = "sdk-docs" ]; then
# Build the SDK docs
Expand All @@ -31,7 +27,6 @@ elif [ "$DARTDOC_BOT" = "packages" ]; then
PACKAGE_NAME=flutter_plugin_tools PACKAGE_VERSION=">=0.0.14+1" dart run grinder build-pub-package 2>&1 | grep "warning: package:flutter_plugin_tools has no documentable libraries"
elif [ "$DARTDOC_BOT" = "sdk-analyzer" ]; then
echo "Running all tests against the SDK analyzer"
unset COVERAGE_TOKEN
dart run grinder test-with-analyzer-sdk
else
echo "Running main dartdoc bot"
Expand Down
84 changes: 22 additions & 62 deletions tool/grind.dart
Original file line number Diff line number Diff line change
Expand Up @@ -214,33 +214,21 @@ void analyzeTestPackages() async {
void checkFormat() async {
if (Platform.version.contains('dev')) {
var filesToFix = <String>[];
// Filter out test packages as they always have strange formatting.
// Passing parameters to dart format for directories to search results in
// filenames being stripped of the dirname so we have to filter here.
void addFileToFix(String line) {
if (!line.startsWith('Changed ')) return;
var fileName = line.substring(8);
var pathComponents = p.split(fileName);
if (pathComponents.isNotEmpty && pathComponents.first == 'testing') {
return;
}
filesToFix.add(fileName);
}

log('Validating dart format with version ${Platform.version}');
await SubprocessLauncher('dart format').runStreamed(
Platform.resolvedExecutable,
[
'format',
'-o',
'none',
'bin',
'lib',
'test',
'tool',
'web',
],
perLine: addFileToFix);
Platform.resolvedExecutable,
[
'format',
'-o',
'none',
'bin',
'lib',
'test',
'tool',
'web',
],
);
if (filesToFix.isNotEmpty) {
fail(
'dart format found files needing reformatting. Use this command to reformat:\n'
Expand All @@ -257,16 +245,16 @@ void checkFormat() async {
checkFormat,
checkBuild,
tryPublish,
smokeTest,
test,
)
void presubmit() {}

@Task('Run long tests, self-test dartdoc, and run the publish test')
@Depends(presubmit, longTest, testDartdoc)
@Task('Run tests, self-test dartdoc, and run the publish test')
@Depends(presubmit, test, testDartdoc)
void buildbot() {}

@Task('Run buildbot tests, but without publish test')
@Depends(analyze, checkFormat, checkBuild, smokeTest, longTest, testDartdoc)
@Depends(analyze, checkFormat, checkBuild, test, testDartdoc)
void buildbotNoPublish() {}

@Task('Generate docs for the Dart SDK')
Expand Down Expand Up @@ -895,7 +883,7 @@ Future<Iterable<Map<String, Object?>>> _buildFlutterDocs(
flutterRepo.cacheDart,
['pub', 'global', 'deactivate', 'snippets'],
);
} on SubProcessException {
} on SubprocessException {
// Ignore failure to deactivate so this works on completely clean bots.
}
await flutterRepo.launcher.runStreamed(
Expand Down Expand Up @@ -1068,7 +1056,6 @@ final _generatedFilesList = <String>[
].map((s) => p.joinAll(p.posix.split(s)));

@Task('Verify generated files are up to date')
@Depends(clean)
Future<void> checkBuild() async {
var originalFileContents = <String, String>{};
var differentFiles = <String>[];
Expand Down Expand Up @@ -1123,24 +1110,10 @@ Future<void> tryPublish() async {
.runStreamed(Platform.resolvedExecutable, ['pub', 'publish', '-n']);
}

@Task('Run a smoke test, only')
@Depends(clean)
Future<void> smokeTest() async {
await testDart(smokeTestFiles);
await testFutures.tasksComplete;
}

@Task('Run non-smoke tests, only')
@Depends(clean)
Future<void> longTest() async {
await testDart(testFiles);
await testFutures.tasksComplete;
}

@Task('Run all the tests.')
@Depends(clean)
@Depends(analyzeTestPackages)
Future<void> test() async {
await testDart(smokeTestFiles.followedBy(testFiles));
await testDart(testFiles);
await testFutures.tasksComplete;
}

Expand Down Expand Up @@ -1169,32 +1142,19 @@ Iterable<Directory> get buildCacheDirectories => Directory('.dart_tool')
.whereType<Directory>()
.where((e) => ['build', 'build_resolvers'].contains(p.basename(e.path)));

List<File> get smokeTestFiles => Directory('test')
.listSync(recursive: true)
.whereType<File>()
.where((e) => p.basename(e.path) == 'model_test.dart')
.toList(growable: false);

List<File> get testFiles => Directory('test')
.listSync(recursive: true)
.whereType<File>()
.where((e) => e.path.endsWith('test.dart'))
.where((e) => p.basename(e.path) != 'model_test.dart')
.toList(growable: false);

Future<void> testDart(Iterable<File> tests) async {
var parameters = <String>['--enable-asserts'];

for (var dartFile in tests) {
await testFutures.add(() =>
CoverageSubprocessLauncher('dart-${p.basename(dartFile.path)}')
.runStreamed(Platform.resolvedExecutable,
<String>[...parameters, dartFile.path]));
SubprocessLauncher('dart-${p.basename(dartFile.path)}').runStreamed(
Platform.resolvedExecutable,
<String>['--enable-asserts', dartFile.path]));
}

return CoverageSubprocessLauncher.generateCoverageToFile(
PhysicalResourceProvider.INSTANCE.getFile(p.canonicalize('lcov.info')),
PhysicalResourceProvider.INSTANCE);
}

@Task('Generate docs for dartdoc without link-to-remote')
Expand Down
Loading