| // Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |
| |
| /// Generates the file `api.txt`, which describes a package's public API. |
| library; |
| |
| import 'package:analyzer_utilities/src/api_summary/summarize_package.dart'; |
| import 'package:analyzer_utilities/tools.dart'; |
| import 'package:path/path.dart'; |
| |
| /// Computes a list of all targets generated by this code generator for a given |
| /// package. |
| List<GeneratedContent> allTargetsForPackage( |
| String packageName, { |
| ApiSummaryCustomizer Function()? createCustomizer, |
| }) => [ |
| GeneratedFile('$packageName/api.txt', (pkgRoot) async { |
| var packagePath = join(pkgRoot, packageName); |
| return await summarizePackage( |
| packagePath, |
| packageName, |
| createCustomizer: createCustomizer, |
| ); |
| }), |
| ]; |