Skip to content

Commit

Permalink
Migrating Summary.licenseFile and Summary.licenses to AnalysisResult.…
Browse files Browse the repository at this point in the history
…licenses
  • Loading branch information
isoos committed Jul 3, 2024
1 parent 5146beb commit f657f00
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- Updated dependency: `tar: ^2.0.0`.
- New text logging format.
- Migrating `Summary.licenseFile` and `Summary.licenses` to `AnalysisResult.licenses`.

## 0.22.7

Expand Down
8 changes: 8 additions & 0 deletions lib/src/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ class Summary {
final String? packageName;
final Version? packageVersion;
final Pubspec? pubspec;
@Deprecated('Use `result.licenses` instead.')
final LicenseFile? licenseFile;
@Deprecated('Use `result.licenses` instead.')
final List<License>? licenses;

/// The packages that are either direct-, dev- or transient dependencies.
Expand Down Expand Up @@ -160,6 +162,8 @@ class PanaRuntimeInfo {
@JsonSerializable()
class License {
/// The file path that was recognized as a license.
@Deprecated(
'The field will be removed, as we only accept `LICENSE` as filename.')
final String path;

/// The SPDX identifier of the license.
Expand All @@ -177,6 +181,7 @@ class License {
}

@JsonSerializable()
@Deprecated('The class will be removed.')
class LicenseFile {
final String path;
final String name;
Expand Down Expand Up @@ -207,6 +212,7 @@ class LicenseFile {
int get hashCode => path.hashCode ^ name.hashCode ^ version.hashCode;
}

@Deprecated('The class will be removed.')
abstract class LicenseNames {
static const String agpl = 'AGPL';
static const String apache = 'Apache';
Expand Down Expand Up @@ -327,6 +333,7 @@ class AnalysisResult {
final List<String>? fundingUrls;
final Repository? repository;
final String? contributingUrl;
final List<License>? licenses;
final int? grantedPoints;
final int? maxPoints;

Expand All @@ -338,6 +345,7 @@ class AnalysisResult {
this.fundingUrls,
this.repository,
this.contributingUrl,
this.licenses,
this.grantedPoints,
this.maxPoints,
});
Expand Down
4 changes: 4 additions & 0 deletions lib/src/model.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/src/package_analyzer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ Future<AnalysisResult> _createAnalysisResult(
fundingUrls: fundingUrls.isEmpty ? null : fundingUrls,
repository: repository,
contributingUrl: repoVerification?.contributingUrl,
licenses: await context.licenses,
grantedPoints: report.grantedPoints,
maxPoints: report.maxPoints,
);
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies:
html: ^0.15.0
http: ^1.0.0
io: ^1.0.0
json_annotation: ^4.8.1
json_annotation: ^4.9.0
lints: ^4.0.0
logging: ^1.0.0
markdown: ^7.0.0
Expand Down

0 comments on commit f657f00

Please sign in to comment.