Skip to content

Commit

Permalink
Remove pkg/pub_dartdoc_data (dart-lang#7226)
Browse files Browse the repository at this point in the history
  • Loading branch information
isoos authored Nov 28, 2023
1 parent 8a742fe commit 7b73d66
Show file tree
Hide file tree
Showing 18 changed files with 53 additions and 965 deletions.
75 changes: 12 additions & 63 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ jobs:
- name: mono_repo self validate
run: dart pub global run mono_repo generate --validate
job_002:
name: "smoke_test; PKGS: app, pkg/_popularity, pkg/_pub_shared, pkg/api_builder, pkg/fake_gcloud, pkg/pub_dartdoc_data, pkg/pub_package_reader, pkg/web_app, pkg/web_css; `dart format --output=none --set-exit-if-changed .`, `dart analyze --fatal-infos .`"
name: "smoke_test; PKGS: app, pkg/_popularity, pkg/_pub_shared, pkg/api_builder, pkg/fake_gcloud, pkg/pub_package_reader, pkg/web_app, pkg/web_css; `dart format --output=none --set-exit-if-changed .`, `dart analyze --fatal-infos .`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.2.0;packages:app-pkg/_popularity-pkg/_pub_shared-pkg/api_builder-pkg/fake_gcloud-pkg/pub_dartdoc_data-pkg/pub_package_reader-pkg/web_app-pkg/web_css;commands:format-analyze_0"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.2.0;packages:app-pkg/_popularity-pkg/_pub_shared-pkg/api_builder-pkg/fake_gcloud-pkg/pub_package_reader-pkg/web_app-pkg/web_css;commands:format-analyze_0"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:3.2.0;packages:app-pkg/_popularity-pkg/_pub_shared-pkg/api_builder-pkg/fake_gcloud-pkg/pub_dartdoc_data-pkg/pub_package_reader-pkg/web_app-pkg/web_css
os:ubuntu-latest;pub-cache-hosted;sdk:3.2.0;packages:app-pkg/_popularity-pkg/_pub_shared-pkg/api_builder-pkg/fake_gcloud-pkg/pub_package_reader-pkg/web_app-pkg/web_css
os:ubuntu-latest;pub-cache-hosted;sdk:3.2.0
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
Expand Down Expand Up @@ -125,19 +125,6 @@ jobs:
run: dart analyze --fatal-infos .
if: "always() && steps.pkg_fake_gcloud_pub_get.conclusion == 'success'"
working-directory: pkg/fake_gcloud
- id: pkg_pub_dartdoc_data_pub_get
name: pkg/pub_dartdoc_data; dart pub get
run: dart pub get
if: "always() && steps.checkout.conclusion == 'success'"
working-directory: pkg/pub_dartdoc_data
- name: "pkg/pub_dartdoc_data; dart format --output=none --set-exit-if-changed ."
run: "dart format --output=none --set-exit-if-changed ."
if: "always() && steps.pkg_pub_dartdoc_data_pub_get.conclusion == 'success'"
working-directory: pkg/pub_dartdoc_data
- name: "pkg/pub_dartdoc_data; dart analyze --fatal-infos ."
run: dart analyze --fatal-infos .
if: "always() && steps.pkg_pub_dartdoc_data_pub_get.conclusion == 'success'"
working-directory: pkg/pub_dartdoc_data
- id: pkg_pub_package_reader_pub_get
name: pkg/pub_package_reader; dart pub get
run: dart pub get
Expand Down Expand Up @@ -844,44 +831,6 @@ jobs:
- job_006
- job_007
job_020:
name: "unit_test; PKG: pkg/pub_dartdoc_data; `dart test --run-skipped`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.2.0;packages:pkg/pub_dartdoc_data;commands:test_08"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:3.2.0;packages:pkg/pub_dartdoc_data
os:ubuntu-latest;pub-cache-hosted;sdk:3.2.0
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46
with:
sdk: "3.2.0"
- id: checkout
name: Checkout repository
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
- id: pkg_pub_dartdoc_data_pub_get
name: pkg/pub_dartdoc_data; dart pub get
run: dart pub get
if: "always() && steps.checkout.conclusion == 'success'"
working-directory: pkg/pub_dartdoc_data
- name: "pkg/pub_dartdoc_data; dart test --run-skipped"
run: dart test --run-skipped
if: "always() && steps.pkg_pub_dartdoc_data_pub_get.conclusion == 'success'"
working-directory: pkg/pub_dartdoc_data
needs:
- job_001
- job_002
- job_003
- job_004
- job_005
- job_006
- job_007
job_021:
name: "unit_test; PKG: pkg/pub_package_reader; `dart test --run-skipped`"
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -919,7 +868,7 @@ jobs:
- job_005
- job_006
- job_007
job_022:
job_021:
name: "unit_test; PKG: pkg/web_app; `dart test --run-skipped`"
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -957,7 +906,7 @@ jobs:
- job_005
- job_006
- job_007
job_023:
job_022:
name: "unit_test; PKG: pkg/web_css; `dart test --run-skipped`"
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -995,7 +944,7 @@ jobs:
- job_005
- job_006
- job_007
job_024:
job_023:
name: "unit_test; PKG: pkg/pub_integration; `dart test -j1 --run-skipped `find test -name \"*_test\\\\.dart\" | sort | sed -n '0~4p'``"
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -1033,7 +982,7 @@ jobs:
- job_005
- job_006
- job_007
job_025:
job_024:
name: "unit_test; PKG: pkg/pub_integration; `dart test -j1 --run-skipped `find test -name \"*_test\\\\.dart\" | sort | sed -n '1~4p'``"
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -1071,7 +1020,7 @@ jobs:
- job_005
- job_006
- job_007
job_026:
job_025:
name: "unit_test; PKG: pkg/pub_integration; `dart test -j1 --run-skipped `find test -name \"*_test\\\\.dart\" | sort | sed -n '2~4p'``"
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -1109,7 +1058,7 @@ jobs:
- job_005
- job_006
- job_007
job_027:
job_026:
name: "unit_test; PKG: pkg/pub_integration; `dart test -j1 --run-skipped `find test -name \"*_test\\\\.dart\" | sort | sed -n '3~4p'``"
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -1147,7 +1096,7 @@ jobs:
- job_005
- job_006
- job_007
job_028:
job_027:
name: "unit_test; PKG: pkg/pub_worker; `dart test --run-skipped --concurrency=1 `find test -name \"*_test\\\\.dart\" | sort | sed -n '0~3p'``"
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -1185,7 +1134,7 @@ jobs:
- job_005
- job_006
- job_007
job_029:
job_028:
name: "unit_test; PKG: pkg/pub_worker; `dart test --run-skipped --concurrency=1 `find test -name \"*_test\\\\.dart\" | sort | sed -n '1~3p'``"
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -1223,7 +1172,7 @@ jobs:
- job_005
- job_006
- job_007
job_030:
job_029:
name: "unit_test; PKG: pkg/pub_worker; `dart test --run-skipped --concurrency=1 `find test -name \"*_test\\\\.dart\" | sort | sed -n '2~3p'``"
runs-on: ubuntu-latest
steps:
Expand Down
36 changes: 23 additions & 13 deletions app/lib/fake/backend/fake_pub_worker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import 'package:indexed_blob/indexed_blob.dart';
import 'package:meta/meta.dart';
import 'package:pana/pana.dart';
import 'package:path/path.dart' as p;
import 'package:pub_dartdoc_data/pub_dartdoc_data.dart';
import 'package:pub_dev/fake/backend/fake_pana_runner.dart';
import 'package:pub_dev/frontend/handlers/pubapi.client.dart';
import 'package:pub_dev/scorecard/backend.dart';
Expand Down Expand Up @@ -85,13 +84,17 @@ Future<void> _processPayload(Payload payload) async {
final packageStatus =
await scoreCardBackend.getPackageStatus(payload.package, v.version);

final dartdocFiles = _fakeDartdocFiles(payload.package, v.version);
final docData = PubDartdocData.fromJson(json.decode(
dartdocFiles['pub-data.json']!,
) as Map<String, dynamic>);
final random = Random('${payload.package}/${v.version}'.hashCode);
final documented = random.nextInt(21);
final dartdocFiles = _fakeDartdocFiles(
payload.package,
v.version,
documented: documented,
total: 20,
);
final docSection = documentationCoverageSection(
documented: docData.coverage?.documented ?? 0,
total: docData.coverage?.total ?? 0,
documented: documented,
total: 20,
);

late Summary summary;
Expand Down Expand Up @@ -164,14 +167,21 @@ Future<void> fakeCloudComputeInstanceRunner(FakeCloudInstance instance) async {
await _processPayload(payload);
}

Map<String, String> _fakeDartdocFiles(String package, String version) {
final random = Random('$package/$version'.hashCode);
final pubData = PubDartdocData(
coverage: Coverage(documented: random.nextInt(21), total: 20),
apiElements: [
Map<String, String> _fakeDartdocFiles(
String package,
String version, {
required int documented,
required int total,
}) {
final pubData = {
'coverage': {
'documented': documented,
'total': total,
},
'apiElements': [
// TODO: add fake library elements
],
);
};
return {
'index.html': json.encode(DartDocPage(
title: 'index',
Expand Down
3 changes: 2 additions & 1 deletion app/lib/search/backend.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ import 'package:gcloud/storage.dart';
import 'package:html/parser.dart' as html_parser;
import 'package:logging/logging.dart';
import 'package:meta/meta.dart';
// ignore: implementation_imports
import 'package:pana/src/dartdoc/pub_dartdoc_data.dart';
import 'package:pool/pool.dart';

import 'package:pub_dartdoc_data/pub_dartdoc_data.dart';
import 'package:pub_dev/shared/popularity_storage.dart';
import 'package:retry/retry.dart';

Expand Down
7 changes: 0 additions & 7 deletions app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -596,13 +596,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.0"
pub_dartdoc_data:
dependency: "direct main"
description:
path: "../pkg/pub_dartdoc_data"
relative: true
source: path
version: "0.0.0"
pub_package_reader:
dependency: "direct main"
description:
Expand Down
2 changes: 0 additions & 2 deletions app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ dependencies:
path: '^1.8.0'
pem: ^2.0.1
pool: '^1.5.0'
pub_dartdoc_data:
path: ../pkg/pub_dartdoc_data
pub_package_reader:
path: ../pkg/pub_package_reader
pub_semver: '^2.0.0'
Expand Down
71 changes: 0 additions & 71 deletions app/test/dartdoc/coverage_test.dart

This file was deleted.

9 changes: 0 additions & 9 deletions pkg/pub_dartdoc_data/build.yaml

This file was deleted.

Loading

0 comments on commit 7b73d66

Please sign in to comment.