blob: 3e2a47e58ddb1983878b31549c008ee71962ee23 [file]
// 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:api_summary/api_summary.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? customizer,
}) => [
GeneratedFile('$packageName/api.txt', (pkgRoot) async {
var packagePath = join(pkgRoot, packageName);
var summary = await apiSummary(
packagePath,
packageName: packageName,
customizer: customizer,
);
return summary.toString();
}),
];