This repository has been archived by the owner on Feb 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add button to showLicensePage + add script that checks dependency lic…
…enses
- Loading branch information
Hjort
committed
Nov 23, 2023
1 parent
48d0c29
commit d91727a
Showing
6 changed files
with
187 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// ignore_for_file: avoid_print | ||
import 'dart:io'; | ||
import 'package:license_checker/src/config.dart'; | ||
import 'package:license_checker/src/check_license.dart'; | ||
import 'package:license_checker/src/dependency_checker.dart'; | ||
import 'package:license_checker/src/package_checker.dart'; | ||
|
||
void main() async { | ||
// Load the config file | ||
Config config = Config.fromFile(File('./scripts/license.yaml')); | ||
|
||
// Get the package configuration from the current directory | ||
PackageChecker packageConfig = await PackageChecker.fromCurrentDirectory(config: config); | ||
|
||
// Run the license check on all packages | ||
List<LicenseDisplayWithPriority<String>> lic = await checkAllPackageLicenses<String>( | ||
packageConfig: packageConfig, | ||
showDirectDepsOnly: false, | ||
filterApproved: true, | ||
licenseDisplay: ({ | ||
required String licenseName, | ||
required String packageName, | ||
required LicenseStatus licenseStatus, | ||
}) => | ||
'$packageName $licenseName ${licenseStatus.toString()}', | ||
); | ||
|
||
if (lic.isNotEmpty) { | ||
print('Unapproved licenses used!'); | ||
for (final x in lic) { | ||
print(x.display); | ||
} | ||
throw "Unapproved licenses used!"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
permittedLicenses: | ||
- MIT | ||
- BSD-3-Clause | ||
|
||
rejectedLicenses: | ||
- GPL | ||
- GPL-1 | ||
- GPL-2 | ||
- GPL-3 | ||
|
||
omitDisclaimer: | ||
- flutter_test | ||
- flutter_web_plugins | ||
|