├── .gitattributes
├── .github
├── ISSUE_TEMPLATE
│ ├── blast_repo.md
│ ├── canary.md
│ ├── corpus.md
│ ├── dart_flutter_team_lints.md
│ ├── firehose.md
│ ├── repo_manage.md
│ ├── repo_query.md
│ ├── sdk_triage_bot.md
│ └── trebuchet.md
├── dependabot.yaml
├── labeler.yml
├── test_repos
│ └── repos.json
└── workflows
│ ├── blast_repo.yml
│ ├── canary.yaml
│ ├── canary_internal.yaml
│ ├── canary_test.yml
│ ├── corpus.yml
│ ├── dart_flutter_team_lints.yml
│ ├── firehose.yml
│ ├── health.yaml
│ ├── health_base.yaml
│ ├── health_internal.yaml
│ ├── no-response.yml
│ ├── post_summaries.yaml
│ ├── publish.yaml
│ ├── publish_internal.yaml
│ ├── pull_request_label.yml
│ ├── puppy.yml
│ ├── repo_manage.yml
│ ├── sdk_triage_bot.yml
│ └── trebuchet.yml
├── .gitignore
├── .vscode
└── launch.json
├── CODEOWNERS
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── pkgs
├── blast_repo
│ ├── .gitignore
│ ├── AUTHORS
│ ├── LICENSE
│ ├── README.md
│ ├── analysis_options.yaml
│ ├── bin
│ │ └── blast_repo.dart
│ ├── lib
│ │ └── src
│ │ │ ├── action_version.dart
│ │ │ ├── exact_file_tweak.dart
│ │ │ ├── github.dart
│ │ │ ├── github_action_resolver.dart
│ │ │ ├── repo_tweak.dart
│ │ │ ├── top_level.dart
│ │ │ ├── tweaks
│ │ │ ├── auto_publish_tweak.dart
│ │ │ ├── dependabot_tweak.dart
│ │ │ ├── drop_lint_tweak.dart
│ │ │ ├── github_action_tweak.dart
│ │ │ ├── mono_repo_tweak.dart
│ │ │ └── no_reponse_tweak.dart
│ │ │ └── utils.dart
│ ├── pubspec.yaml
│ ├── pubspec_overrides.yaml
│ └── test
│ │ ├── auto_publish_test.dart
│ │ ├── dependabot_test.dart
│ │ ├── drop_lint_test.dart
│ │ ├── github_action_test.dart
│ │ ├── mono_repo_test.dart
│ │ ├── no_response_test.dart
│ │ └── utils_test.dart
├── canary
│ ├── .gitignore
│ ├── LICENSE
│ ├── README.md
│ ├── analysis_options.yaml
│ ├── bin
│ │ └── canary.dart
│ ├── pubspec.yaml
│ ├── schema.json
│ └── test
│ │ └── canary_test.dart
├── corpus
│ ├── .gitignore
│ ├── AUTHORS
│ ├── LICENSE
│ ├── README.md
│ ├── analysis_options.yaml
│ ├── bin
│ │ ├── deps.dart
│ │ └── usage.dart
│ ├── doc
│ │ ├── dart_collection.md
│ │ ├── matcher.csv
│ │ └── package_collection.md
│ ├── lib
│ │ ├── api.dart
│ │ ├── cache.dart
│ │ ├── packages.dart
│ │ ├── pub.dart
│ │ ├── report.dart
│ │ ├── surveyor.dart
│ │ ├── usage.dart
│ │ └── utils.dart
│ ├── pubspec.yaml
│ └── test
│ │ ├── api_test.dart
│ │ ├── data
│ │ ├── class_references.dart
│ │ ├── dart_extension_references.dart
│ │ ├── dart_library_references.dart
│ │ ├── dart_top_level_symbol_references.dart
│ │ ├── extension_references.dart
│ │ ├── library_references.dart
│ │ └── top_level_symbol_references.dart
│ │ ├── pub_test.dart
│ │ └── visitor_test.dart
├── dart_flutter_team_lints
│ ├── .gitignore
│ ├── CHANGELOG.md
│ ├── LICENSE
│ ├── README.md
│ ├── analysis_options.yaml
│ ├── lib
│ │ └── analysis_options.yaml
│ ├── pubspec.yaml
│ ├── test
│ │ └── validate_test.dart
│ └── tool
│ │ └── dedup.dart
├── firehose
│ ├── .gitignore
│ ├── .pubignore
│ ├── CHANGELOG.md
│ ├── LICENSE
│ ├── README.md
│ ├── analysis_options.yaml
│ ├── bin
│ │ ├── firehose.dart
│ │ └── health.dart
│ ├── lib
│ │ ├── firehose.dart
│ │ └── src
│ │ │ ├── changelog.dart
│ │ │ ├── delayed_client.dart
│ │ │ ├── github.dart
│ │ │ ├── health
│ │ │ ├── changelog.dart
│ │ │ ├── coverage.dart
│ │ │ ├── health.dart
│ │ │ ├── lcov.dart
│ │ │ └── license.dart
│ │ │ ├── pub.dart
│ │ │ ├── repo.dart
│ │ │ └── utils.dart
│ ├── pubspec.yaml
│ ├── test
│ │ ├── changelog_test.dart
│ │ ├── coverage_test.dart
│ │ ├── github_test.dart
│ │ ├── health_test.dart
│ │ ├── lcov.info
│ │ ├── license_test.dart
│ │ ├── pub_test.dart
│ │ ├── repo_test.dart
│ │ └── utils_test.dart
│ └── test_data
│ │ ├── base_test_repo
│ │ └── pkgs
│ │ │ ├── package1
│ │ │ ├── .gitignore
│ │ │ ├── CHANGELOG.md
│ │ │ ├── README.md
│ │ │ ├── analysis_options.yaml
│ │ │ ├── bin
│ │ │ │ └── package1.dart
│ │ │ ├── lib
│ │ │ │ └── package1.dart
│ │ │ ├── pubspec.yaml
│ │ │ └── test
│ │ │ │ └── package1_test.dart
│ │ │ ├── package2
│ │ │ ├── .gitignore
│ │ │ ├── CHANGELOG.md
│ │ │ ├── README.md
│ │ │ ├── analysis_options.yaml
│ │ │ ├── bin
│ │ │ │ └── package2.dart
│ │ │ ├── lib
│ │ │ │ └── package2.dart
│ │ │ ├── pubspec.yaml
│ │ │ └── test
│ │ │ │ └── package2_test.dart
│ │ │ ├── package3
│ │ │ ├── .gitignore
│ │ │ ├── CHANGELOG.md
│ │ │ ├── README.md
│ │ │ ├── analysis_options.yaml
│ │ │ ├── bin
│ │ │ │ └── package3.dart
│ │ │ ├── lib
│ │ │ │ └── package3.dart
│ │ │ ├── pubspec.yaml
│ │ │ └── test
│ │ │ │ └── package3_test.dart
│ │ │ └── package5
│ │ │ ├── lib
│ │ │ ├── package5.dart
│ │ │ └── src
│ │ │ │ └── package5_base.dart
│ │ │ └── pubspec.yaml
│ │ ├── golden
│ │ ├── comment_breaking.md
│ │ ├── comment_breaking_healthchanged.md
│ │ ├── comment_breaking_ignore_package.md
│ │ ├── comment_changelog.md
│ │ ├── comment_changelog_healthchanged.md
│ │ ├── comment_changelog_ignore_package.md
│ │ ├── comment_coverage.md
│ │ ├── comment_coverage_healthchanged.md
│ │ ├── comment_coverage_ignore_package.md
│ │ ├── comment_do-not-submit.md
│ │ ├── comment_do-not-submit_healthchanged.md
│ │ ├── comment_do-not-submit_ignore_package.md
│ │ ├── comment_leaking.md
│ │ ├── comment_leaking_healthchanged.md
│ │ ├── comment_leaking_ignore_package.md
│ │ ├── comment_license.md
│ │ ├── comment_license_healthchanged.md
│ │ ├── comment_license_ignore_license.md
│ │ └── comment_license_ignore_package.md
│ │ ├── root_unpublished_pkg
│ │ ├── pkg_1
│ │ │ └── pubspec.yaml
│ │ ├── pkg_2
│ │ │ └── pubspec.yaml
│ │ └── pubspec.yaml
│ │ ├── test_repo
│ │ └── pkgs
│ │ │ ├── package1
│ │ │ ├── .gitignore
│ │ │ ├── CHANGELOG.md
│ │ │ ├── README.md
│ │ │ ├── analysis_options.yaml
│ │ │ ├── bin
│ │ │ │ └── package1.dart
│ │ │ ├── lib
│ │ │ │ └── package1.dart
│ │ │ ├── pubspec.yaml
│ │ │ └── test
│ │ │ │ └── package1_test.dart
│ │ │ ├── package2
│ │ │ ├── .gitignore
│ │ │ ├── CHANGELOG.md
│ │ │ ├── README.md
│ │ │ ├── analysis_options.yaml
│ │ │ ├── bin
│ │ │ │ └── package2.dart
│ │ │ ├── lib
│ │ │ │ ├── anotherLib.dart
│ │ │ │ └── package2.dart
│ │ │ ├── pubspec.yaml
│ │ │ ├── someImage.png
│ │ │ └── test
│ │ │ │ └── package2_test.dart
│ │ │ ├── package3
│ │ │ ├── .gitignore
│ │ │ ├── CHANGELOG.md
│ │ │ ├── README.md
│ │ │ ├── analysis_options.yaml
│ │ │ ├── bin
│ │ │ │ └── package3.dart
│ │ │ ├── lib
│ │ │ │ └── package3.dart
│ │ │ ├── pubspec.yaml
│ │ │ └── test
│ │ │ │ └── package3_test.dart
│ │ │ └── package5
│ │ │ ├── lib
│ │ │ ├── package5.dart
│ │ │ └── src
│ │ │ │ └── package5_base.dart
│ │ │ └── pubspec.yaml
│ │ └── workspace_repo
│ │ ├── pkg_1
│ │ └── pubspec.yaml
│ │ ├── pkg_2
│ │ └── pubspec.yaml
│ │ └── pubspec.yaml
├── puppy
│ ├── README.md
│ ├── analysis_options.yaml
│ ├── bin
│ │ └── puppy.dart
│ ├── lib
│ │ └── src
│ │ │ ├── constants.dart
│ │ │ ├── run_command.dart
│ │ │ ├── run_command.g.dart
│ │ │ └── utils.dart
│ └── pubspec.yaml
├── repo_manage
│ ├── .gitignore
│ ├── README.md
│ ├── analysis_options.yaml
│ ├── bin
│ │ └── report.dart
│ ├── lib
│ │ ├── branches.dart
│ │ ├── contributors.dart
│ │ ├── issue_transfer.dart
│ │ ├── labels.dart
│ │ ├── labels_update.dart
│ │ ├── src
│ │ │ └── common.dart
│ │ └── weekly.dart
│ └── pubspec.yaml
├── sdk_triage_bot
│ ├── .gitignore
│ ├── README.md
│ ├── analysis_options.yaml
│ ├── bin
│ │ └── triage.dart
│ ├── lib
│ │ ├── src
│ │ │ ├── common.dart
│ │ │ ├── gemini.dart
│ │ │ ├── github.dart
│ │ │ └── prompts.dart
│ │ └── triage.dart
│ ├── pubspec.yaml
│ ├── test
│ │ ├── fakes.dart
│ │ └── triage_test.dart
│ └── tool
│ │ ├── bench.dart
│ │ ├── bench.md
│ │ └── create_tuning_data.dart
└── trebuchet
│ ├── LICENSE
│ ├── README.md
│ ├── analysis_options.yaml
│ ├── bin
│ └── trebuchet.dart
│ └── pubspec.yaml
└── tool
└── ci.sh
/.gitattributes:
--------------------------------------------------------------------------------
1 | .github/workflows/dart.yml linguist-generated=true
2 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/blast_repo.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: "package:blast_repo"
3 | about: "Create a bug or file a feature request against package:blast_repo."
4 | labels: "package:blast_repo"
5 | ---
6 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/canary.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: "package:canary"
3 | about: "Create a bug or file a feature request against package:canary."
4 | labels: "package:canary"
5 | ---
6 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/corpus.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: "package:corpus"
3 | about: "Create a bug or file a feature request against package:corpus."
4 | labels: "package:corpus"
5 | ---
6 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/dart_flutter_team_lints.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: "package:dart_flutter_team_lints"
3 | about: "Create a bug or file a feature request against package:dart_flutter_team_lints."
4 | labels: "package:dart_flutter_team_lints"
5 | ---
6 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/firehose.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: "package:firehose"
3 | about: "Create a bug or file a feature request against package:firehose."
4 | labels: "package:firehose"
5 | ---
6 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/repo_manage.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: "package:repo_manage"
3 | about: "Create a bug or file a feature request against package:repo_manage."
4 | labels: "package:repo_manage"
5 | ---
6 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/repo_query.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: "package:repo_manage"
3 | about: "Create a bug or file a feature request against package:repo_manage."
4 | labels: "package:repo_manage"
5 | ---
6 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/sdk_triage_bot.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: "package:sdk_triage_bot"
3 | about: "Create a bug or file a feature request against package:sdk_triage_bot."
4 | labels: "package:sdk_triage_bot"
5 | ---
6 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/trebuchet.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: "package:trebuchet"
3 | about: "Create a bug or file a feature request against package:trebuchet."
4 | labels: "package:trebuchet"
5 | ---
6 |
--------------------------------------------------------------------------------
/.github/dependabot.yaml:
--------------------------------------------------------------------------------
1 | # Dependabot configuration file.
2 | version: 2
3 |
4 | updates:
5 | - package-ecosystem: github-actions
6 | directory: /
7 | schedule:
8 | interval: monthly
9 | labels:
10 | - autosubmit
11 | groups:
12 | github-actions:
13 | patterns:
14 | - "*"
15 |
--------------------------------------------------------------------------------
/.github/labeler.yml:
--------------------------------------------------------------------------------
1 | # Configuration for .github/workflows/pull_request_label.yml.
2 |
3 | 'type-infra':
4 | - changed-files:
5 | - any-glob-to-any-file: '.github/**'
6 |
7 | 'package:blast_repo':
8 | - changed-files:
9 | - any-glob-to-any-file: 'pkgs/blast_repo/**'
10 |
11 | 'package:corpus':
12 | - changed-files:
13 | - any-glob-to-any-file: 'pkgs/corpus/**'
14 |
15 | 'package:dart_flutter_team_lints':
16 | - changed-files:
17 | - any-glob-to-any-file: 'pkgs/dart_flutter_team_lints/**'
18 |
19 | 'package:firehose':
20 | - changed-files:
21 | - any-glob-to-any-file: 'pkgs/firehose/**'
22 |
23 | 'package:repo_manage':
24 | - changed-files:
25 | - any-glob-to-any-file: 'pkgs/repo_manage/**'
26 |
27 | 'package:puppy':
28 | - changed-files:
29 | - any-glob-to-any-file: 'pkgs/puppy/**'
30 |
31 | 'package:sdk_triage_bot':
32 | - changed-files:
33 | - any-glob-to-any-file: 'pkgs/sdk_triage_bot/**'
34 |
35 | 'package:trebuchet':
36 | - changed-files:
37 | - any-glob-to-any-file: 'pkgs/trebuchet/**'
38 |
--------------------------------------------------------------------------------
/.github/test_repos/repos.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "../../pkgs/canary/schema.json",
3 | "https://github.com/mosuem/my_app_old_web": {
4 | "level": "analyze"
5 | },
6 | "https://github.com/mosuem/my_app_new_web": {
7 | "level": "test",
8 | "packages": {
9 | "exclude": "intl4x"
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/.github/workflows/blast_repo.yml:
--------------------------------------------------------------------------------
1 | name: package:blast_repo
2 |
3 | permissions: read-all
4 |
5 | on:
6 | pull_request:
7 | branches: [ main ]
8 | paths:
9 | - '.github/workflows/blast_repo.yml'
10 | - 'pkgs/blast_repo/**'
11 | push:
12 | branches: [ main ]
13 | paths:
14 | - '.github/workflows/blast_repo.yml'
15 | - 'pkgs/blast_repo/**'
16 | schedule:
17 | - cron: '0 0 * * 0' # weekly
18 |
19 | defaults:
20 | run:
21 | working-directory: pkgs/blast_repo
22 |
23 | jobs:
24 | build:
25 | runs-on: ubuntu-latest
26 | strategy:
27 | fail-fast: false
28 | matrix:
29 | sdk: [stable, dev]
30 | steps:
31 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
32 | - uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
33 | with:
34 | sdk: ${{ matrix.sdk }}
35 |
36 | - run: dart pub get
37 |
38 | - run: dart analyze --fatal-infos
39 |
40 | - run: dart format --output=none --set-exit-if-changed .
41 | if: ${{ matrix.sdk == 'stable' }}
42 |
43 | - run: dart test
44 |
--------------------------------------------------------------------------------
/.github/workflows/canary.yaml:
--------------------------------------------------------------------------------
1 | name: Canary
2 |
3 | on:
4 | workflow_call:
5 | inputs:
6 | repos_file:
7 | description: 'Path to the file containing the list of repository names'
8 | type: string
9 | required: true
10 | local_debug:
11 | description: Whether to use a local version of ecosystem testing - only for debug
12 | default: false
13 | type: boolean
14 | required: false
15 |
16 | jobs:
17 | test:
18 | runs-on: ubuntu-latest
19 | steps:
20 | - name: Checkout repository
21 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
22 | with:
23 | token: ${{ secrets.GITHUB_TOKEN }}
24 |
25 | - uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff
26 | with:
27 | channel: main
28 |
29 | - run: echo "${{ toJSON(github.event.pull_request.labels.*.name) }}"
30 |
31 | - name: Install local version of `package:canary`
32 | run: dart pub global activate -s path pkgs/canary
33 | if: ${{ inputs.local_debug }}
34 |
35 | - run: dart pub global activate -s git https://github.com/dart-lang/ecosystem.git --git-ref main --git-path pkgs/canary
36 | if: ${{ !inputs.local_debug }}
37 |
38 | - name: Update package and test
39 | run: |
40 | dart pub global run canary ${{ inputs.repos_file }} ${{ github.repositoryUrl }} ${{ github.head_ref || github.ref_name }} "${{ toJSON(github.event.pull_request.labels.*.name) }}"
41 | env:
42 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43 |
44 | - name: Output issue number
45 | run: |
46 | mkdir -p output
47 | echo ${{ github.event.number }} > output/issueNumber
48 |
49 | - name: Find Comment
50 | uses: peter-evans/find-comment@9735ba2ed6a47d05499d9b653e05f347f3031e89
51 | id: fc
52 | with:
53 | issue-number: ${{ github.event.number }}
54 | comment-author: github-actions[bot]
55 | body-includes: '## Ecosystem testing'
56 |
57 | - name: Write comment id to file
58 | if: ${{ steps.fc.outputs.comment-id != 0 }}
59 | run: echo ${{ steps.fc.outputs.comment-id }} >> output/commentId
60 |
61 | - name: Upload markdown
62 | if: success() || failure()
63 | uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1
64 | with:
65 | name: output
66 | path: output/
67 |
--------------------------------------------------------------------------------
/.github/workflows/canary_internal.yaml:
--------------------------------------------------------------------------------
1 | name: Canary:Internal
2 |
3 | on:
4 | pull_request:
5 | branches: [ main ]
6 | types: [opened, synchronize, reopened, labeled, unlabeled]
7 |
8 | jobs:
9 | test_ecosystem:
10 | uses: ./.github/workflows/canary.yaml
11 | with:
12 | repos_file: .github/test_repos/repos.json
13 | local_debug: true
14 |
--------------------------------------------------------------------------------
/.github/workflows/canary_test.yml:
--------------------------------------------------------------------------------
1 | name: package:canary
2 |
3 | permissions: read-all
4 |
5 | on:
6 | pull_request:
7 | branches: [ main ]
8 | paths:
9 | - '.github/workflows/canary.yml'
10 | - 'pkgs/canary/**'
11 | push:
12 | branches: [ main ]
13 | paths:
14 | - '.github/workflows/canary.yml'
15 | - 'pkgs/canary/**'
16 | schedule:
17 | - cron: '0 0 * * 0' # weekly
18 |
19 | defaults:
20 | run:
21 | working-directory: pkgs/canary
22 |
23 | env:
24 | GH_TOKEN: ${{ github.token }}
25 |
26 | jobs:
27 | build:
28 | runs-on: ubuntu-latest
29 | steps:
30 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
31 | - uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff
32 | with:
33 | channel: main
34 |
35 | - run: dart pub get
36 |
37 | - run: dart analyze --fatal-infos
38 |
39 | - run: dart format --output=none --set-exit-if-changed .
40 |
41 | - run: dart test
42 |
--------------------------------------------------------------------------------
/.github/workflows/corpus.yml:
--------------------------------------------------------------------------------
1 | name: package:corpus
2 |
3 | permissions: read-all
4 |
5 | on:
6 | pull_request:
7 | branches: [ main ]
8 | paths:
9 | - '.github/workflows/corpus.yml'
10 | - 'pkgs/corpus/**'
11 | push:
12 | branches: [ main ]
13 | paths:
14 | - '.github/workflows/corpus.yml'
15 | - 'pkgs/corpus/**'
16 | schedule:
17 | - cron: '0 0 * * 0' # weekly
18 |
19 | defaults:
20 | run:
21 | working-directory: pkgs/corpus
22 |
23 | jobs:
24 | build:
25 | runs-on: ubuntu-latest
26 | strategy:
27 | fail-fast: false
28 | matrix:
29 | sdk: [3.6, dev]
30 | steps:
31 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
32 | - uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
33 | with:
34 | sdk: ${{ matrix.sdk }}
35 |
36 | - run: dart pub get
37 |
38 | - run: dart analyze --fatal-infos
39 |
40 | - run: dart format --output=none --set-exit-if-changed .
41 | if: ${{ matrix.sdk == 'dev' }}
42 |
43 | - run: dart test
44 |
--------------------------------------------------------------------------------
/.github/workflows/dart_flutter_team_lints.yml:
--------------------------------------------------------------------------------
1 | name: package:dart_flutter_team_lints
2 |
3 | permissions: read-all
4 |
5 | on:
6 | pull_request:
7 | branches: [ main ]
8 | paths:
9 | - '.github/workflows/dart_flutter_team_lints.yml'
10 | - 'pkgs/dart_flutter_team_lints/**'
11 | push:
12 | branches: [ main ]
13 | paths:
14 | - '.github/workflows/dart_flutter_team_lints.yml'
15 | - 'pkgs/dart_flutter_team_lints/**'
16 | schedule:
17 | - cron: '0 0 * * 0' # weekly
18 |
19 | defaults:
20 | run:
21 | working-directory: pkgs/dart_flutter_team_lints
22 |
23 | jobs:
24 | build:
25 | runs-on: ubuntu-latest
26 | strategy:
27 | fail-fast: false
28 | matrix:
29 | sdk: [3.8, dev]
30 | steps:
31 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
32 | - uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
33 | with:
34 | sdk: ${{ matrix.sdk }}
35 |
36 | - run: dart pub get
37 |
38 | - run: dart analyze --fatal-infos
39 |
40 | - run: dart format --output=none --set-exit-if-changed .
41 | if: ${{ matrix.sdk == 'dev' }}
42 |
43 | - run: dart test
44 |
--------------------------------------------------------------------------------
/.github/workflows/firehose.yml:
--------------------------------------------------------------------------------
1 | name: package:firehose
2 |
3 | permissions: read-all
4 |
5 | on:
6 | pull_request:
7 | branches: [ main ]
8 | paths:
9 | - '.github/workflows/firehose.yml'
10 | - 'pkgs/firehose/**'
11 | push:
12 | branches: [ main ]
13 | paths:
14 | - '.github/workflows/firehose.yml'
15 | - 'pkgs/firehose/**'
16 | schedule:
17 | - cron: '0 0 * * 0' # weekly
18 |
19 | defaults:
20 | run:
21 | working-directory: pkgs/firehose
22 |
23 | jobs:
24 | build:
25 | runs-on: ubuntu-latest
26 | strategy:
27 | fail-fast: false
28 | matrix:
29 | sdk: [stable, dev]
30 | steps:
31 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
32 | - uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
33 | with:
34 | sdk: ${{ matrix.sdk }}
35 |
36 | - run: dart pub get
37 |
38 | - run: dart analyze --fatal-infos
39 |
40 | - run: dart format --output=none --set-exit-if-changed .
41 | if: ${{ matrix.sdk == 'stable' }}
42 |
43 | - run: dart test
44 |
--------------------------------------------------------------------------------
/.github/workflows/health_internal.yaml:
--------------------------------------------------------------------------------
1 | # A CI configuration to check PR health.
2 |
3 | name: Health:Internal
4 |
5 | on:
6 | pull_request:
7 | branches: [ main ]
8 | types: [opened, synchronize, reopened, labeled, unlabeled]
9 |
10 | jobs:
11 | health:
12 | uses: ./.github/workflows/health.yaml
13 | with:
14 | sdk: dev
15 | local_debug: true
16 | coverage_web: false
17 | upload_coverage: false
18 | checks: changelog,license,coverage,breaking,do-not-submit,leaking
19 | fail_on: changelog,do-not-submit
20 | warn_on: license,coverage,breaking,leaking
21 | ignore_license: 'pkgs/firehose/test_data'
22 | ignore_coverage: 'pkgs/firehose/bin,pkgs/firehose/test_data'
23 | permissions:
24 | pull-requests: write
25 |
--------------------------------------------------------------------------------
/.github/workflows/no-response.yml:
--------------------------------------------------------------------------------
1 | # A workflow to close issues where the author hasn't responded to a request for
2 | # more information; see https://github.com/actions/stale.
3 |
4 | name: No Response
5 |
6 | # Run as a daily cron.
7 | on:
8 | schedule:
9 | # Every day at 8am
10 | - cron: '0 8 * * *'
11 |
12 | # All permissions not specified are set to 'none'.
13 | permissions:
14 | issues: write
15 | pull-requests: write
16 |
17 | jobs:
18 | no-response:
19 | runs-on: ubuntu-latest
20 | if: ${{ github.repository_owner == 'dart-lang' }}
21 | steps:
22 | - uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639
23 | with:
24 | days-before-stale: -1
25 | days-before-close: 14
26 | stale-issue-label: "needs-info"
27 | close-issue-message: >
28 | Without additional information we're not able to resolve this issue.
29 | Feel free to add more info or respond to any questions above and we
30 | can reopen the case. Thanks for your contribution!
31 | stale-pr-label: "needs-info"
32 | close-pr-message: >
33 | Without additional information we're not able to resolve this PR.
34 | Feel free to add more info or respond to any questions above.
35 | Thanks for your contribution!
36 |
--------------------------------------------------------------------------------
/.github/workflows/publish_internal.yaml:
--------------------------------------------------------------------------------
1 | # A CI configuration to auto-publish pub packages from dart-lang/ecosystem.
2 |
3 | # We don't use the regular publish.yaml script here in order to dogfood the
4 | # publishing code at head.
5 |
6 | name: Publish:Internal
7 |
8 | on:
9 | pull_request:
10 | branches: [ main ]
11 | types: [opened, synchronize, reopened, labeled, unlabeled]
12 | push:
13 | tags: [ '[A-z0-9]+-v[0-9]+.[0-9]+.[0-9]+*' ]
14 |
15 | jobs:
16 | publish:
17 | uses: ./.github/workflows/publish.yaml
18 | with:
19 | local_debug: true
20 | use-flutter: false
21 | write-comments: false
22 | sdk: dev
23 | permissions:
24 | id-token: write
25 | pull-requests: write
26 |
--------------------------------------------------------------------------------
/.github/workflows/pull_request_label.yml:
--------------------------------------------------------------------------------
1 | # This workflow applies labels to pull requests based on the paths that are
2 | # modified in the pull request.
3 | #
4 | # Edit `.github/labeler.yml` to configure labels. For more information, see
5 | # https://github.com/actions/labeler.
6 |
7 | name: Pull Request Labeler
8 | permissions: read-all
9 |
10 | on:
11 | pull_request_target
12 |
13 | jobs:
14 | label:
15 | permissions:
16 | pull-requests: write
17 | runs-on: ubuntu-latest
18 | steps:
19 | - uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9
20 | with:
21 | repo-token: "${{ secrets.GITHUB_TOKEN }}"
22 | sync-labels: true
23 |
--------------------------------------------------------------------------------
/.github/workflows/puppy.yml:
--------------------------------------------------------------------------------
1 | name: package:puppy
2 |
3 | permissions: read-all
4 |
5 | on:
6 | pull_request:
7 | branches: [ main ]
8 | paths:
9 | - '.github/workflows/puppy.yml'
10 | - 'pkgs/puppy/**'
11 | push:
12 | branches: [ main ]
13 | paths:
14 | - '.github/workflows/puppy.yml'
15 | - 'pkgs/puppy/**'
16 | schedule:
17 | - cron: '0 0 * * 0' # weekly
18 |
19 | defaults:
20 | run:
21 | working-directory: pkgs/puppy
22 |
23 | jobs:
24 | build:
25 | runs-on: ubuntu-latest
26 | strategy:
27 | fail-fast: false
28 | matrix:
29 | sdk: [3.6, dev]
30 | steps:
31 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
32 | - uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
33 | with:
34 | sdk: ${{ matrix.sdk }}
35 |
36 | - run: dart pub get
37 | - run: dart analyze --fatal-infos
38 | - run: dart format --output=none --set-exit-if-changed .
39 | if: ${{ matrix.sdk == 'dev' }}
40 | # TODO: enable when there are tests!
41 | #- run: dart test
42 |
--------------------------------------------------------------------------------
/.github/workflows/repo_manage.yml:
--------------------------------------------------------------------------------
1 | name: package:repo_manage
2 |
3 | permissions: read-all
4 |
5 | on:
6 | pull_request:
7 | branches: [ main ]
8 | paths:
9 | - '.github/workflows/repo_manage.yml'
10 | - 'pkgs/repo_manage/**'
11 | push:
12 | branches: [ main ]
13 | paths:
14 | - '.github/workflows/repo_manage.yml'
15 | - 'pkgs/repo_manage/**'
16 | schedule:
17 | - cron: '0 0 * * 0' # weekly
18 |
19 | defaults:
20 | run:
21 | working-directory: pkgs/repo_manage
22 |
23 | jobs:
24 | build:
25 | runs-on: ubuntu-latest
26 | strategy:
27 | fail-fast: false
28 | matrix:
29 | sdk: [stable, dev]
30 | steps:
31 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
32 | - uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
33 | with:
34 | sdk: ${{ matrix.sdk }}
35 |
36 | - run: dart pub get
37 |
38 | - run: dart analyze --fatal-infos
39 |
40 | - run: dart format --output=none --set-exit-if-changed .
41 | if: ${{ matrix.sdk == 'stable' }}
42 |
--------------------------------------------------------------------------------
/.github/workflows/sdk_triage_bot.yml:
--------------------------------------------------------------------------------
1 | name: package:sdk_triage_bot
2 |
3 | permissions: read-all
4 |
5 | on:
6 | pull_request:
7 | branches: [ main ]
8 | paths:
9 | - '.github/workflows/sdk_triage_bot.yml'
10 | - 'pkgs/sdk_triage_bot/**'
11 | push:
12 | branches: [ main ]
13 | paths:
14 | - '.github/workflows/sdk_triage_bot.yml'
15 | - 'pkgs/sdk_triage_bot/**'
16 | schedule:
17 | - cron: '0 0 * * 0' # weekly
18 |
19 | defaults:
20 | run:
21 | working-directory: pkgs/sdk_triage_bot
22 |
23 | jobs:
24 | build:
25 | runs-on: ubuntu-latest
26 | strategy:
27 | fail-fast: false
28 | matrix:
29 | sdk: [stable, dev]
30 | steps:
31 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
32 | - uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
33 | with:
34 | sdk: ${{ matrix.sdk }}
35 |
36 | - run: dart pub get
37 |
38 | - run: dart analyze --fatal-infos
39 |
40 | - run: dart format --output=none --set-exit-if-changed .
41 | if: ${{ matrix.sdk == 'stable' }}
42 |
43 | - run: dart test
44 |
--------------------------------------------------------------------------------
/.github/workflows/trebuchet.yml:
--------------------------------------------------------------------------------
1 | name: package:trebuchet
2 |
3 | permissions: read-all
4 |
5 | on:
6 | pull_request:
7 | branches: [ main ]
8 | paths:
9 | - '.github/workflows/trebuchet.yml'
10 | - 'pkgs/trebuchet/**'
11 | push:
12 | branches: [ main ]
13 | paths:
14 | - '.github/workflows/trebuchet.yml'
15 | - 'pkgs/trebuchet/**'
16 | schedule:
17 | - cron: '0 0 * * 0' # weekly
18 |
19 | defaults:
20 | run:
21 | working-directory: pkgs/trebuchet
22 |
23 | jobs:
24 | build:
25 | runs-on: ubuntu-latest
26 | strategy:
27 | fail-fast: false
28 | matrix:
29 | sdk: [stable, dev]
30 | steps:
31 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
32 | - uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
33 | with:
34 | sdk: ${{ matrix.sdk }}
35 |
36 | - run: dart pub get
37 |
38 | - run: dart analyze --fatal-infos
39 |
40 | - run: dart format --output=none --set-exit-if-changed .
41 | if: ${{ matrix.sdk == 'stable' }}
42 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Files and directories created by pub.
2 | .dart_tool/
3 | .packages
4 |
5 | # Conventional directory for build outputs.
6 | build/
7 |
8 | # Omit committing pubspec.lock for library packages; see
9 | # https://dart.dev/guides/libraries/private-files#pubspeclock.
10 | pubspec.lock
11 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "name": "health",
9 | "program": "${workspaceFolder}/pkgs/firehose/bin/health.dart",
10 | "request": "launch",
11 | "type": "dart",
12 | "env": {
13 | "GITHUB_REPOSITORY": "dart-lang/ecosystem",
14 | "ISSUE_NUMBER": "173",
15 | "GITHUB_SHA": "null",
16 | "GITHUB_STEP_SUMMARY": "/tmp/github_step_summary_mock.md",
17 | },
18 | "args": [
19 | "--check",
20 | "breaking"
21 | ],
22 | }
23 | ]
24 | }
25 |
--------------------------------------------------------------------------------
/CODEOWNERS:
--------------------------------------------------------------------------------
1 | # Below are suggested reviewers for PRs to packages in this repository.
2 | #
3 | # These are suggestions; it is fine to have your changes reviewed by someone
4 | # else.
5 |
6 | /pkgs/blast_repo/ @kevmoo
7 | /pkgs/canary/ @mosuem
8 | /pkgs/corpus/ @devoncarew
9 | /pkgs/dart_flutter_team_lints/ @devoncarew @natebosch
10 | /pkgs/firehose/ @devoncarew @mosuem
11 | /pkgs/repo_manage/ @devoncarew @mosuem
12 | /pkgs/sdk_triage_bot/ @devoncarew
13 | /pkgs/trebuchet/ @mosuem
14 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # How to Contribute
2 |
3 | We'd love to accept your patches and contributions to this project. There are
4 | just a few small guidelines you need to follow.
5 |
6 | ## Contributor License Agreement
7 |
8 | Contributions to this project must be accompanied by a Contributor License
9 | Agreement (CLA). You (or your employer) retain the copyright to your
10 | contribution; this simply gives us permission to use and redistribute your
11 | contributions as part of the project. Head over to
12 | to see your current agreements on file or
13 | to sign a new one.
14 |
15 | You generally only need to submit a CLA once, so if you've already submitted one
16 | (even if it was for a different project), you probably don't need to do it
17 | again.
18 |
19 | ## Code Reviews
20 |
21 | All submissions, including submissions by project members, require review. We
22 | use GitHub pull requests for this purpose. Consult
23 | [GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
24 | information on using pull requests.
25 |
26 | ## Coding style
27 |
28 | The Dart source code in this repo follows the:
29 |
30 | * [Dart style guide](https://dart.dev/guides/language/effective-dart/style)
31 |
32 | You should familiarize yourself with those guidelines.
33 |
34 | ## File headers
35 |
36 | All files in the Dart project must start with the following header; if you add a
37 | new file please also add this. The year should be a single number stating the
38 | year the file was created (don't use a range like "2011-2012"). Additionally, if
39 | you edit an existing file, you shouldn't update the year.
40 |
41 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
42 | // for details. All rights reserved. Use of this source code is governed by a
43 | // BSD-style license that can be found in the LICENSE file.
44 |
45 | ## Community Guidelines
46 |
47 | This project follows
48 | [Google's Open Source Community Guidelines](https://opensource.google/conduct/).
49 |
50 | We pledge to maintain an open and welcoming environment. For details, see our
51 | [code of conduct](https://dart.dev/code-of-conduct).
52 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2022, the Dart project authors.
2 |
3 | Redistribution and use in source and binary forms, with or without
4 | modification, are permitted provided that the following conditions are
5 | met:
6 |
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above
10 | copyright notice, this list of conditions and the following
11 | disclaimer in the documentation and/or other materials provided
12 | with the distribution.
13 | * Neither the name of Google LLC nor the names of its
14 | contributors may be used to endorse or promote products derived
15 | from this software without specific prior written permission.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Overview
2 |
3 | This repository is home to general Dart Ecosystem tools and packages.
4 |
5 | ## Packages
6 |
7 | | Package | Description | Version |
8 | | --- | --- | --- |
9 | | [blast_repo](pkgs/blast_repo/) | A tool to bulk validate and fix GitHub repos. | |
10 | | [canary](pkgs/canary/) | Test package upgrades against the ecosystem. | |
11 | | [corpus](pkgs/corpus/) | A tool to calculate the API usage for a package. | |
12 | | [dart_flutter_team_lints](pkgs/dart_flutter_team_lints/) | An analysis rule set used by the Dart and Flutter teams. | [](https://pub.dev/packages/dart_flutter_team_lints) |
13 | | [firehose](pkgs/firehose/) | A tool to automate publishing of Pub packages from GitHub actions. | [](https://pub.dev/packages/firehose) |
14 | | [puppy](pkgs/puppy/) | A grab bag of CLI tools for managing Dart code. | |
15 | | [repo_manage](pkgs/repo_manage/) | Miscellaneous issue, repo, and PR query tools. | |
16 | | [sdk_triage_bot](pkgs/sdk_triage_bot/) | A triage automation tool for dart-lang/sdk issues. | |
17 | | [trebuchet](pkgs/trebuchet/) | A tool for moving existing packages into monorepos. | |
18 |
19 | ## Publishing automation
20 |
21 | For information about our publishing automation and release process, see
22 | https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.
23 |
24 | For additional information about contributing, see our
25 | [contributing](CONTRIBUTING.md) page.
26 |
--------------------------------------------------------------------------------
/pkgs/blast_repo/.gitignore:
--------------------------------------------------------------------------------
1 | # https://dart.dev/guides/libraries/private-files
2 | pubspec.lock
3 |
--------------------------------------------------------------------------------
/pkgs/blast_repo/AUTHORS:
--------------------------------------------------------------------------------
1 | # Below is a list of people and organizations that have contributed
2 | # to the project. Names should be added to the list like so:
3 | #
4 | # Name/Organization
5 |
6 | Google Inc.
7 |
--------------------------------------------------------------------------------
/pkgs/blast_repo/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2022, the Dart project authors.
2 |
3 | Redistribution and use in source and binary forms, with or without
4 | modification, are permitted provided that the following conditions are
5 | met:
6 |
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above
10 | copyright notice, this list of conditions and the following
11 | disclaimer in the documentation and/or other materials provided
12 | with the distribution.
13 | * Neither the name of Google LLC nor the names of its
14 | contributors may be used to endorse or promote products derived
15 | from this software without specific prior written permission.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
--------------------------------------------------------------------------------
/pkgs/blast_repo/README.md:
--------------------------------------------------------------------------------
1 | A tool to bulk validate and fix GitHub repos.
2 |
3 | ## blast_repo
4 |
5 | ```
6 | Usage: blast_repo [org/repo]
7 |
8 | --keep-temp Don't delete the temporary repo clone.
9 | --tweaks= Optionally list the specific tweaks to run (defaults to all applicable tweaks).
10 | [auto-publish, dependabot, github-actions, monorepo, no-response]
11 | --reviewer= Specify the GitHub handle for the desired reviewer.
12 | -h, --help Prints out usage and exits.
13 |
14 | available tweaks:
15 | auto-publish: configure a github action to enable package auto-publishing
16 | dependabot: ensure ".github/dependabot.yml" exists and has the correct content
17 | github-actions: ensure GitHub actions use the latest versions and are keyed by SHA
18 | monorepo: regenerate the latest configuration files for package:mono_repo
19 | no-response: configure a 'no response' bot to handle needs-info labels
20 | ```
21 |
--------------------------------------------------------------------------------
/pkgs/blast_repo/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | include: package:dart_flutter_team_lints/analysis_options.yaml
2 |
3 | analyzer:
4 | language:
5 | strict-inference: true
6 | strict-raw-types: true
7 |
--------------------------------------------------------------------------------
/pkgs/blast_repo/bin/blast_repo.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | import 'dart:io';
6 |
7 | import 'package:args/args.dart';
8 | import 'package:blast_repo/src/top_level.dart';
9 | import 'package:blast_repo/src/utils.dart';
10 | import 'package:io/io.dart';
11 | import 'package:stack_trace/stack_trace.dart';
12 |
13 | Future main(List args) async {
14 | final parser = ArgParser()
15 | ..addFlag(
16 | 'dry-run',
17 | aliases: ['keep-temp'],
18 | help: "Don't create a PR or delete the temporary repo clone.",
19 | negatable: false,
20 | )
21 | ..addMultiOption('tweaks',
22 | help: 'Optionally list the specific tweaks to run (defaults to all '
23 | 'applicable tweaks).',
24 | allowed: allTweaks.map((t) => t.id),
25 | valueHelp: 'tweak1,tweak2')
26 | ..addOption(
27 | 'reviewer',
28 | aliases: ['pr-reviewer'],
29 | valueHelp: 'github-id',
30 | help: 'Specify the GitHub handle for the desired reviewer.',
31 | )
32 | ..addMultiOption(
33 | 'labels',
34 | help: 'Specify labels to apply to the PR.',
35 | )
36 | ..addFlag(
37 | 'help',
38 | abbr: 'h',
39 | negatable: false,
40 | help: 'Prints out usage and exits.',
41 | );
42 |
43 | void printUsage() {
44 | print('Usage: $packageName [org/repo]\n');
45 | print(parser.usage);
46 | print('\navailable tweaks:');
47 | for (var tweak in allTweaks) {
48 | print(' ${tweak.id}: ${tweak.description}');
49 | }
50 | }
51 |
52 | final ArgResults argResults;
53 | try {
54 | argResults = parser.parse(args);
55 | } on FormatException catch (e) {
56 | printError(e.message);
57 | printUsage();
58 | exitCode = ExitCode.usage.code;
59 | return;
60 | }
61 |
62 | if (argResults.flag('help') || argResults.rest.isEmpty) {
63 | printUsage();
64 | return;
65 | }
66 |
67 | final slug = argResults.rest.single;
68 |
69 | final dryRun = argResults.flag('dry-run');
70 |
71 | final reviewer = argResults.option('reviewer');
72 | final explicitTweakIds = argResults.multiOption('tweaks');
73 | final explicitTweaks = explicitTweakIds.isEmpty
74 | ? null
75 | : explicitTweakIds
76 | .map((id) => allTweaks.firstWhere((t) => t.id == id))
77 | .toList();
78 |
79 | final labels = argResults.multiOption('labels');
80 |
81 | try {
82 | await runFix(
83 | slug: slug,
84 | deleteTemp: !dryRun,
85 | tweaks: explicitTweaks,
86 | reviewer: reviewer,
87 | labels: labels,
88 | dryRun: dryRun,
89 | );
90 | } catch (error, stack) {
91 | final chain = Chain.forTrace(stack);
92 | print('Error type: ${error.runtimeType}');
93 | print(error);
94 | print(chain.terse.toString().trim());
95 | exitCode = 1;
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/pkgs/blast_repo/lib/src/action_version.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | import 'package:path/path.dart' as p;
6 |
7 | class ActionVersion {
8 | ActionVersion({
9 | required this.org,
10 | required this.repo,
11 | required this.path,
12 | required this.version,
13 | });
14 |
15 | factory ActionVersion.parse(String value) {
16 | final atSplit = value.split('@');
17 | if (atSplit.length != 2) {
18 | throw ArgumentError.value(
19 | value,
20 | 'value',
21 | 'Should have two halves seperated by "@".',
22 | );
23 | }
24 |
25 | final pathSegments = p.url.split(atSplit[0]);
26 |
27 | if (pathSegments.length < 2) {
28 | throw ArgumentError.value(
29 | value,
30 | 'value',
31 | 'Should have at least two initial path segments.',
32 | );
33 | }
34 |
35 | final path =
36 | pathSegments.length > 2 ? pathSegments.skip(2).join('/') : null;
37 |
38 | return ActionVersion(
39 | org: pathSegments[0],
40 | repo: pathSegments[1],
41 | path: path,
42 | version: atSplit[1],
43 | );
44 | }
45 |
46 | final String org;
47 | final String repo;
48 | final String? path;
49 | final String version;
50 |
51 | String get fullRepo => '$org/$repo';
52 |
53 | @override
54 | String toString() =>
55 | '${[org, repo, if (path != null) path].join('/')}@$version';
56 |
57 | @override
58 | bool operator ==(Object other) =>
59 | other is ActionVersion &&
60 | org == other.org &&
61 | repo == other.repo &&
62 | path == other.path &&
63 | version == other.version;
64 |
65 | @override
66 | int get hashCode => Object.hash(org, repo, path, version);
67 | }
68 |
--------------------------------------------------------------------------------
/pkgs/blast_repo/lib/src/exact_file_tweak.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | import 'dart:async';
6 | import 'dart:io';
7 |
8 | import 'package:path/path.dart' as p;
9 |
10 | import 'repo_tweak.dart';
11 |
12 | abstract class ExactFileTweak extends RepoTweak {
13 | ExactFileTweak({
14 | required this.filePath,
15 | required super.id,
16 | required super.description,
17 | this.alternateFilePaths = const {},
18 | }) : assert(p.isRelative(filePath)) {
19 | if (!p.isRelative(filePath)) {
20 | throw ArgumentError.value(
21 | filePath,
22 | 'filePath',
23 | 'Must be a relative path!',
24 | );
25 | }
26 |
27 | for (var entry in alternateFilePaths) {
28 | if (p.equals(entry, filePath)) {
29 | throw ArgumentError.value(
30 | alternateFilePaths,
31 | 'alternateFilePaths',
32 | 'Should not contain `filePath` ($filePath).',
33 | );
34 | }
35 | if (!p.isRelative(entry)) {
36 | throw ArgumentError.value(
37 | alternateFilePaths,
38 | 'alternateFilePaths',
39 | 'Must be a relative path ($entry)',
40 | );
41 | }
42 | }
43 | }
44 |
45 | final String filePath;
46 | final Set alternateFilePaths;
47 |
48 | String expectedContent(Directory checkout, String repoSlug);
49 |
50 | @override
51 | FutureOr fix(Directory checkout, String repoSlug) {
52 | final file = _targetFile(checkout);
53 |
54 | var fixResults = [];
55 |
56 | final newContent = expectedContent(checkout, repoSlug);
57 | if (!file.existsSync()) {
58 | file.writeAsStringSync(newContent);
59 | fixResults.add('$filePath has been created.');
60 | } else if (file.readAsStringSync() != newContent) {
61 | file.writeAsStringSync(newContent);
62 | fixResults.add('$filePath has been updated.');
63 | }
64 |
65 | return fixResults.isEmpty
66 | ? FixResult.noFixesMade
67 | : FixResult(fixes: fixResults);
68 | }
69 |
70 | File _targetFile(Directory checkout) {
71 | assert(checkout.existsSync());
72 |
73 | for (var option in [filePath, ...alternateFilePaths]) {
74 | final realPath = p.join(checkout.path, option);
75 |
76 | final realFile = File(realPath);
77 | if (realFile.existsSync()) {
78 | return realFile;
79 | }
80 | }
81 |
82 | return File(p.join(checkout.path, filePath));
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/pkgs/blast_repo/lib/src/github.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | import 'dart:io';
6 |
7 | import 'package:github/github.dart';
8 |
9 | GitHub createGitHubClient() => GitHub(
10 | auth: Authentication.withToken(Platform.environment['GITHUB_TOKEN']),
11 | );
12 |
--------------------------------------------------------------------------------
/pkgs/blast_repo/lib/src/repo_tweak.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | import 'dart:async';
6 | import 'dart:io';
7 |
8 | abstract class RepoTweak {
9 | const RepoTweak({
10 | required this.id,
11 | required this.description,
12 | });
13 |
14 | final String id;
15 | final String description;
16 |
17 | /// Returns whether this tweak should run for the given repository by default.
18 | ///
19 | /// Some tweaks may only run by default in the presence of a file in the repo,
20 | /// or only if the repo is a mono repo.
21 | bool shouldRunByDefault(Directory checkout, String repoSlug);
22 |
23 | /// Checks to see if the [checkout] needs to be fixed.
24 | ///
25 | /// If no fix is needed, nothing happens and `false` is returned.
26 | ///
27 | /// If a fix is needed, the fix is run and `true` is returned.
28 | ///
29 | /// If the repo cannot be checked or if a required fix cannot be applied,
30 | /// an error is thrown.
31 | FutureOr fix(Directory checkout, String repoSlug);
32 |
33 | @override
34 | String toString() => id;
35 | }
36 |
37 | class CheckResult {
38 | static const noFixNeeded = CheckResult._();
39 |
40 | const CheckResult._() : neededFixes = const [];
41 |
42 | CheckResult({required this.neededFixes}) {
43 | neededFixes.forEach(_validateItem);
44 | }
45 |
46 | final List