From 7f0ef0028f9355b7f9d2ea9cc68f8e77cf2e4036 Mon Sep 17 00:00:00 2001 From: Alejandro Santiago Date: Fri, 29 Sep 2023 10:38:20 +0100 Subject: [PATCH 01/16] feat(spdx_license): include tryParse --- .../__brick__/spdx_license.gen.dart | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/bricks/spdx_license/__brick__/spdx_license.gen.dart b/bricks/spdx_license/__brick__/spdx_license.gen.dart index 4d5c4b6a..b2d4be94 100644 --- a/bricks/spdx_license/__brick__/spdx_license.gen.dart +++ b/bricks/spdx_license/__brick__/spdx_license.gen.dart @@ -23,10 +23,28 @@ enum SpdxLicense { /// Parses a [String] into a [SpdxLicense]. /// - /// If the [value] is not a valid [SpdxLicense], [SpdxLicense.$unknown] is - /// returned instead. - factory SpdxLicense.parse(String value) => - _valueMap[value] ?? SpdxLicense.$unknown; + /// If the [source] is not a valid [SpdxLicense], a [FormatException] is + /// thrown. + factory SpdxLicense.parse(String source) { + final result = _valueMap[source]; + if (result == null) { + throw FormatException('Failed to parse $source as SpdxLicense.'); + } + + return result; + } + + /// Parse [source] into a possible [SpdxLicense]. + /// + /// Like [SpdxLicense.parse] except that it returns `null` where a similar + /// call to [SpdxLicense.parse] would throw a [FormatException]. + static SpdxLicense? tryParse(String source) { + try { + return SpdxLicense.parse(source); + } on FormatException { + return null; + } + } static final Map _valueMap = SpdxLicense.values .asNameMap() From 1bdd947d0cf5157445bad5e9984fedf2c9cd4eb9 Mon Sep 17 00:00:00 2001 From: Alejandro Santiago Date: Mon, 2 Oct 2023 12:33:52 +0100 Subject: [PATCH 02/16] test: include brick test --- bricks/spdx_license/analysis_options.yaml | 4 + bricks/spdx_license/pubspec.yaml | 15 + .../spdx_license/test/spdx_license.gen.dart | 655 ++++++++++++++++++ .../spdx_license/test/spdx_license_test.dart | 45 ++ 4 files changed, 719 insertions(+) create mode 100644 bricks/spdx_license/analysis_options.yaml create mode 100644 bricks/spdx_license/pubspec.yaml create mode 100644 bricks/spdx_license/test/spdx_license.gen.dart create mode 100644 bricks/spdx_license/test/spdx_license_test.dart diff --git a/bricks/spdx_license/analysis_options.yaml b/bricks/spdx_license/analysis_options.yaml new file mode 100644 index 00000000..d8cdc5cb --- /dev/null +++ b/bricks/spdx_license/analysis_options.yaml @@ -0,0 +1,4 @@ +include: package:very_good_analysis/analysis_options.5.1.0.yaml +analyzer: + exclude: + - "__brick__" diff --git a/bricks/spdx_license/pubspec.yaml b/bricks/spdx_license/pubspec.yaml new file mode 100644 index 00000000..f66225e6 --- /dev/null +++ b/bricks/spdx_license/pubspec.yaml @@ -0,0 +1,15 @@ +name: spdx_license_brick +description: Testing the generated SPDX license brick. +version: 0.1.0+1 +repository: https://github.com/VeryGoodOpenSource/very_good_cli +issue_tracker: https://github.com/VeryGoodOpenSource/very_good_cli/issues +publish_to: none + +environment: + sdk: ">=3.0.0 <4.0.0" + +dev_dependencies: + mocktail: ^1.0.0 + path: ^1.8.3 + test: ^1.19.2 + very_good_analysis: ^5.1.0 diff --git a/bricks/spdx_license/test/spdx_license.gen.dart b/bricks/spdx_license/test/spdx_license.gen.dart new file mode 100644 index 00000000..621e220e --- /dev/null +++ b/bricks/spdx_license/test/spdx_license.gen.dart @@ -0,0 +1,655 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// +// If you need to make changes, please refer to the SPDX License brick +// CONTRIBUTING file. + +// ignore_for_file: type=lint + +/// List of all SPDX licenses. +/// +/// This file was automatically generated with the SPDX License brick. +library spdx_license; + +/// {@template spdx_license} +/// A list of all 602 SPDX licenses. +/// +/// These have been automatically generated from the SPDX License brick. +/// {@endtemplate} +enum SpdxLicense { + $0BSD._('0BSD'), + $AAL._('AAL'), + $ADSL._('ADSL'), + $AFL_1_1._('AFL-1.1'), + $AFL_1_2._('AFL-1.2'), + $AFL_2_0._('AFL-2.0'), + $AFL_2_1._('AFL-2.1'), + $AFL_3_0._('AFL-3.0'), + $AGPL_1_0._('AGPL-1.0'), + $AGPL_1_0_only._('AGPL-1.0-only'), + $AGPL_1_0_or_later._('AGPL-1.0-or-later'), + $AGPL_3_0._('AGPL-3.0'), + $AGPL_3_0_only._('AGPL-3.0-only'), + $AGPL_3_0_or_later._('AGPL-3.0-or-later'), + $AMDPLPA._('AMDPLPA'), + $AML._('AML'), + $AMPAS._('AMPAS'), + $ANTLR_PD._('ANTLR-PD'), + $ANTLR_PD_fallback._('ANTLR-PD-fallback'), + $APAFML._('APAFML'), + $APL_1_0._('APL-1.0'), + $APSL_1_0._('APSL-1.0'), + $APSL_1_1._('APSL-1.1'), + $APSL_1_2._('APSL-1.2'), + $APSL_2_0._('APSL-2.0'), + $ASWF_Digital_Assets_1_0._('ASWF-Digital-Assets-1.0'), + $ASWF_Digital_Assets_1_1._('ASWF-Digital-Assets-1.1'), + $Abstyles._('Abstyles'), + $AdaCore_doc._('AdaCore-doc'), + $Adobe_2006._('Adobe-2006'), + $Adobe_Glyph._('Adobe-Glyph'), + $Adobe_Utopia._('Adobe-Utopia'), + $Afmparse._('Afmparse'), + $Aladdin._('Aladdin'), + $Apache_1_0._('Apache-1.0'), + $Apache_1_1._('Apache-1.1'), + $Apache_2_0._('Apache-2.0'), + $App_s2p._('App-s2p'), + $Arphic_1999._('Arphic-1999'), + $Artistic_1_0._('Artistic-1.0'), + $Artistic_1_0_Perl._('Artistic-1.0-Perl'), + $Artistic_1_0_cl8._('Artistic-1.0-cl8'), + $Artistic_2_0._('Artistic-2.0'), + $BSD_1_Clause._('BSD-1-Clause'), + $BSD_2_Clause._('BSD-2-Clause'), + $BSD_2_Clause_FreeBSD._('BSD-2-Clause-FreeBSD'), + $BSD_2_Clause_NetBSD._('BSD-2-Clause-NetBSD'), + $BSD_2_Clause_Patent._('BSD-2-Clause-Patent'), + $BSD_2_Clause_Views._('BSD-2-Clause-Views'), + $BSD_3_Clause._('BSD-3-Clause'), + $BSD_3_Clause_Attribution._('BSD-3-Clause-Attribution'), + $BSD_3_Clause_Clear._('BSD-3-Clause-Clear'), + $BSD_3_Clause_HP._('BSD-3-Clause-HP'), + $BSD_3_Clause_LBNL._('BSD-3-Clause-LBNL'), + $BSD_3_Clause_Modification._('BSD-3-Clause-Modification'), + $BSD_3_Clause_No_Military_License._('BSD-3-Clause-No-Military-License'), + $BSD_3_Clause_No_Nuclear_License._('BSD-3-Clause-No-Nuclear-License'), + $BSD_3_Clause_No_Nuclear_License_2014._('BSD-3-Clause-No-Nuclear-License-2014'), + $BSD_3_Clause_No_Nuclear_Warranty._('BSD-3-Clause-No-Nuclear-Warranty'), + $BSD_3_Clause_Open_MPI._('BSD-3-Clause-Open-MPI'), + $BSD_3_Clause_Sun._('BSD-3-Clause-Sun'), + $BSD_4_Clause._('BSD-4-Clause'), + $BSD_4_Clause_Shortened._('BSD-4-Clause-Shortened'), + $BSD_4_Clause_UC._('BSD-4-Clause-UC'), + $BSD_4_3RENO._('BSD-4.3RENO'), + $BSD_4_3TAHOE._('BSD-4.3TAHOE'), + $BSD_Advertising_Acknowledgement._('BSD-Advertising-Acknowledgement'), + $BSD_Attribution_HPND_disclaimer._('BSD-Attribution-HPND-disclaimer'), + $BSD_Inferno_Nettverk._('BSD-Inferno-Nettverk'), + $BSD_Protection._('BSD-Protection'), + $BSD_Source_Code._('BSD-Source-Code'), + $BSD_Systemics._('BSD-Systemics'), + $BSL_1_0._('BSL-1.0'), + $BUSL_1_1._('BUSL-1.1'), + $Baekmuk._('Baekmuk'), + $Bahyph._('Bahyph'), + $Barr._('Barr'), + $Beerware._('Beerware'), + $BitTorrent_1_0._('BitTorrent-1.0'), + $BitTorrent_1_1._('BitTorrent-1.1'), + $Bitstream_Charter._('Bitstream-Charter'), + $Bitstream_Vera._('Bitstream-Vera'), + $BlueOak_1_0_0._('BlueOak-1.0.0'), + $Boehm_GC._('Boehm-GC'), + $Borceux._('Borceux'), + $Brian_Gladman_3_Clause._('Brian-Gladman-3-Clause'), + $C_UDA_1_0._('C-UDA-1.0'), + $CAL_1_0._('CAL-1.0'), + $CAL_1_0_Combined_Work_Exception._('CAL-1.0-Combined-Work-Exception'), + $CATOSL_1_1._('CATOSL-1.1'), + $CC_BY_1_0._('CC-BY-1.0'), + $CC_BY_2_0._('CC-BY-2.0'), + $CC_BY_2_5._('CC-BY-2.5'), + $CC_BY_2_5_AU._('CC-BY-2.5-AU'), + $CC_BY_3_0._('CC-BY-3.0'), + $CC_BY_3_0_AT._('CC-BY-3.0-AT'), + $CC_BY_3_0_DE._('CC-BY-3.0-DE'), + $CC_BY_3_0_IGO._('CC-BY-3.0-IGO'), + $CC_BY_3_0_NL._('CC-BY-3.0-NL'), + $CC_BY_3_0_US._('CC-BY-3.0-US'), + $CC_BY_4_0._('CC-BY-4.0'), + $CC_BY_NC_1_0._('CC-BY-NC-1.0'), + $CC_BY_NC_2_0._('CC-BY-NC-2.0'), + $CC_BY_NC_2_5._('CC-BY-NC-2.5'), + $CC_BY_NC_3_0._('CC-BY-NC-3.0'), + $CC_BY_NC_3_0_DE._('CC-BY-NC-3.0-DE'), + $CC_BY_NC_4_0._('CC-BY-NC-4.0'), + $CC_BY_NC_ND_1_0._('CC-BY-NC-ND-1.0'), + $CC_BY_NC_ND_2_0._('CC-BY-NC-ND-2.0'), + $CC_BY_NC_ND_2_5._('CC-BY-NC-ND-2.5'), + $CC_BY_NC_ND_3_0._('CC-BY-NC-ND-3.0'), + $CC_BY_NC_ND_3_0_DE._('CC-BY-NC-ND-3.0-DE'), + $CC_BY_NC_ND_3_0_IGO._('CC-BY-NC-ND-3.0-IGO'), + $CC_BY_NC_ND_4_0._('CC-BY-NC-ND-4.0'), + $CC_BY_NC_SA_1_0._('CC-BY-NC-SA-1.0'), + $CC_BY_NC_SA_2_0._('CC-BY-NC-SA-2.0'), + $CC_BY_NC_SA_2_0_DE._('CC-BY-NC-SA-2.0-DE'), + $CC_BY_NC_SA_2_0_FR._('CC-BY-NC-SA-2.0-FR'), + $CC_BY_NC_SA_2_0_UK._('CC-BY-NC-SA-2.0-UK'), + $CC_BY_NC_SA_2_5._('CC-BY-NC-SA-2.5'), + $CC_BY_NC_SA_3_0._('CC-BY-NC-SA-3.0'), + $CC_BY_NC_SA_3_0_DE._('CC-BY-NC-SA-3.0-DE'), + $CC_BY_NC_SA_3_0_IGO._('CC-BY-NC-SA-3.0-IGO'), + $CC_BY_NC_SA_4_0._('CC-BY-NC-SA-4.0'), + $CC_BY_ND_1_0._('CC-BY-ND-1.0'), + $CC_BY_ND_2_0._('CC-BY-ND-2.0'), + $CC_BY_ND_2_5._('CC-BY-ND-2.5'), + $CC_BY_ND_3_0._('CC-BY-ND-3.0'), + $CC_BY_ND_3_0_DE._('CC-BY-ND-3.0-DE'), + $CC_BY_ND_4_0._('CC-BY-ND-4.0'), + $CC_BY_SA_1_0._('CC-BY-SA-1.0'), + $CC_BY_SA_2_0._('CC-BY-SA-2.0'), + $CC_BY_SA_2_0_UK._('CC-BY-SA-2.0-UK'), + $CC_BY_SA_2_1_JP._('CC-BY-SA-2.1-JP'), + $CC_BY_SA_2_5._('CC-BY-SA-2.5'), + $CC_BY_SA_3_0._('CC-BY-SA-3.0'), + $CC_BY_SA_3_0_AT._('CC-BY-SA-3.0-AT'), + $CC_BY_SA_3_0_DE._('CC-BY-SA-3.0-DE'), + $CC_BY_SA_3_0_IGO._('CC-BY-SA-3.0-IGO'), + $CC_BY_SA_4_0._('CC-BY-SA-4.0'), + $CC_PDDC._('CC-PDDC'), + $CC0_1_0._('CC0-1.0'), + $CDDL_1_0._('CDDL-1.0'), + $CDDL_1_1._('CDDL-1.1'), + $CDL_1_0._('CDL-1.0'), + $CDLA_Permissive_1_0._('CDLA-Permissive-1.0'), + $CDLA_Permissive_2_0._('CDLA-Permissive-2.0'), + $CDLA_Sharing_1_0._('CDLA-Sharing-1.0'), + $CECILL_1_0._('CECILL-1.0'), + $CECILL_1_1._('CECILL-1.1'), + $CECILL_2_0._('CECILL-2.0'), + $CECILL_2_1._('CECILL-2.1'), + $CECILL_B._('CECILL-B'), + $CECILL_C._('CECILL-C'), + $CERN_OHL_1_1._('CERN-OHL-1.1'), + $CERN_OHL_1_2._('CERN-OHL-1.2'), + $CERN_OHL_P_2_0._('CERN-OHL-P-2.0'), + $CERN_OHL_S_2_0._('CERN-OHL-S-2.0'), + $CERN_OHL_W_2_0._('CERN-OHL-W-2.0'), + $CFITSIO._('CFITSIO'), + $CMU_Mach._('CMU-Mach'), + $CNRI_Jython._('CNRI-Jython'), + $CNRI_Python._('CNRI-Python'), + $CNRI_Python_GPL_Compatible._('CNRI-Python-GPL-Compatible'), + $COIL_1_0._('COIL-1.0'), + $CPAL_1_0._('CPAL-1.0'), + $CPL_1_0._('CPL-1.0'), + $CPOL_1_02._('CPOL-1.02'), + $CUA_OPL_1_0._('CUA-OPL-1.0'), + $Caldera._('Caldera'), + $ClArtistic._('ClArtistic'), + $Clips._('Clips'), + $Community_Spec_1_0._('Community-Spec-1.0'), + $Condor_1_1._('Condor-1.1'), + $Cornell_Lossless_JPEG._('Cornell-Lossless-JPEG'), + $Cronyx._('Cronyx'), + $Crossword._('Crossword'), + $CrystalStacker._('CrystalStacker'), + $Cube._('Cube'), + $D_FSL_1_0._('D-FSL-1.0'), + $DL_DE_BY_2_0._('DL-DE-BY-2.0'), + $DL_DE_ZERO_2_0._('DL-DE-ZERO-2.0'), + $DOC._('DOC'), + $DRL_1_0._('DRL-1.0'), + $DSDP._('DSDP'), + $Dotseqn._('Dotseqn'), + $ECL_1_0._('ECL-1.0'), + $ECL_2_0._('ECL-2.0'), + $EFL_1_0._('EFL-1.0'), + $EFL_2_0._('EFL-2.0'), + $EPICS._('EPICS'), + $EPL_1_0._('EPL-1.0'), + $EPL_2_0._('EPL-2.0'), + $EUDatagrid._('EUDatagrid'), + $EUPL_1_0._('EUPL-1.0'), + $EUPL_1_1._('EUPL-1.1'), + $EUPL_1_2._('EUPL-1.2'), + $Elastic_2_0._('Elastic-2.0'), + $Entessa._('Entessa'), + $ErlPL_1_1._('ErlPL-1.1'), + $Eurosym._('Eurosym'), + $FBM._('FBM'), + $FDK_AAC._('FDK-AAC'), + $FSFAP._('FSFAP'), + $FSFUL._('FSFUL'), + $FSFULLR._('FSFULLR'), + $FSFULLRWD._('FSFULLRWD'), + $FTL._('FTL'), + $Fair._('Fair'), + $Ferguson_Twofish._('Ferguson-Twofish'), + $Frameworx_1_0._('Frameworx-1.0'), + $FreeBSD_DOC._('FreeBSD-DOC'), + $FreeImage._('FreeImage'), + $Furuseth._('Furuseth'), + $GD._('GD'), + $GFDL_1_1._('GFDL-1.1'), + $GFDL_1_1_invariants_only._('GFDL-1.1-invariants-only'), + $GFDL_1_1_invariants_or_later._('GFDL-1.1-invariants-or-later'), + $GFDL_1_1_no_invariants_only._('GFDL-1.1-no-invariants-only'), + $GFDL_1_1_no_invariants_or_later._('GFDL-1.1-no-invariants-or-later'), + $GFDL_1_1_only._('GFDL-1.1-only'), + $GFDL_1_1_or_later._('GFDL-1.1-or-later'), + $GFDL_1_2._('GFDL-1.2'), + $GFDL_1_2_invariants_only._('GFDL-1.2-invariants-only'), + $GFDL_1_2_invariants_or_later._('GFDL-1.2-invariants-or-later'), + $GFDL_1_2_no_invariants_only._('GFDL-1.2-no-invariants-only'), + $GFDL_1_2_no_invariants_or_later._('GFDL-1.2-no-invariants-or-later'), + $GFDL_1_2_only._('GFDL-1.2-only'), + $GFDL_1_2_or_later._('GFDL-1.2-or-later'), + $GFDL_1_3._('GFDL-1.3'), + $GFDL_1_3_invariants_only._('GFDL-1.3-invariants-only'), + $GFDL_1_3_invariants_or_later._('GFDL-1.3-invariants-or-later'), + $GFDL_1_3_no_invariants_only._('GFDL-1.3-no-invariants-only'), + $GFDL_1_3_no_invariants_or_later._('GFDL-1.3-no-invariants-or-later'), + $GFDL_1_3_only._('GFDL-1.3-only'), + $GFDL_1_3_or_later._('GFDL-1.3-or-later'), + $GL2PS._('GL2PS'), + $GLWTPL._('GLWTPL'), + $GNU_compiler_exception._('GNU-compiler-exception'), + $GPL_1_0._('GPL-1.0'), + $GPL_1_0plus._('GPL-1.0+'), + $GPL_1_0_only._('GPL-1.0-only'), + $GPL_1_0_or_later._('GPL-1.0-or-later'), + $GPL_2_0._('GPL-2.0'), + $GPL_2_0plus._('GPL-2.0+'), + $GPL_2_0_only._('GPL-2.0-only'), + $GPL_2_0_or_later._('GPL-2.0-or-later'), + $GPL_2_0_with_GCC_exception._('GPL-2.0-with-GCC-exception'), + $GPL_2_0_with_autoconf_exception._('GPL-2.0-with-autoconf-exception'), + $GPL_2_0_with_bison_exception._('GPL-2.0-with-bison-exception'), + $GPL_2_0_with_classpath_exception._('GPL-2.0-with-classpath-exception'), + $GPL_2_0_with_font_exception._('GPL-2.0-with-font-exception'), + $GPL_3_0._('GPL-3.0'), + $GPL_3_0plus._('GPL-3.0+'), + $GPL_3_0_only._('GPL-3.0-only'), + $GPL_3_0_or_later._('GPL-3.0-or-later'), + $GPL_3_0_with_GCC_exception._('GPL-3.0-with-GCC-exception'), + $GPL_3_0_with_autoconf_exception._('GPL-3.0-with-autoconf-exception'), + $Giftware._('Giftware'), + $Glide._('Glide'), + $Glulxe._('Glulxe'), + $Graphics_Gems._('Graphics-Gems'), + $HP_1986._('HP-1986'), + $HP_1989._('HP-1989'), + $HPND._('HPND'), + $HPND_DEC._('HPND-DEC'), + $HPND_Markus_Kuhn._('HPND-Markus-Kuhn'), + $HPND_Pbmplus._('HPND-Pbmplus'), + $HPND_UC._('HPND-UC'), + $HPND_doc._('HPND-doc'), + $HPND_doc_sell._('HPND-doc-sell'), + $HPND_export_US._('HPND-export-US'), + $HPND_export_US_modify._('HPND-export-US-modify'), + $HPND_sell_regexpr._('HPND-sell-regexpr'), + $HPND_sell_variant._('HPND-sell-variant'), + $HPND_sell_variant_MIT_disclaimer._('HPND-sell-variant-MIT-disclaimer'), + $HTMLTIDY._('HTMLTIDY'), + $HaskellReport._('HaskellReport'), + $Hippocratic_2_1._('Hippocratic-2.1'), + $IBM_pibs._('IBM-pibs'), + $ICU._('ICU'), + $IEC_Code_Components_EULA._('IEC-Code-Components-EULA'), + $IJG._('IJG'), + $IJG_short._('IJG-short'), + $IPA._('IPA'), + $IPL_1_0._('IPL-1.0'), + $ISC._('ISC'), + $ImageMagick._('ImageMagick'), + $Imlib2._('Imlib2'), + $Info_ZIP._('Info-ZIP'), + $Inner_Net_2_0._('Inner-Net-2.0'), + $Intel._('Intel'), + $Intel_ACPI._('Intel-ACPI'), + $Interbase_1_0._('Interbase-1.0'), + $JPL_image._('JPL-image'), + $JPNIC._('JPNIC'), + $JSON._('JSON'), + $Jam._('Jam'), + $JasPer_2_0._('JasPer-2.0'), + $Kastrup._('Kastrup'), + $Kazlib._('Kazlib'), + $Knuth_CTAN._('Knuth-CTAN'), + $LAL_1_2._('LAL-1.2'), + $LAL_1_3._('LAL-1.3'), + $LGPL_2_0._('LGPL-2.0'), + $LGPL_2_0plus._('LGPL-2.0+'), + $LGPL_2_0_only._('LGPL-2.0-only'), + $LGPL_2_0_or_later._('LGPL-2.0-or-later'), + $LGPL_2_1._('LGPL-2.1'), + $LGPL_2_1plus._('LGPL-2.1+'), + $LGPL_2_1_only._('LGPL-2.1-only'), + $LGPL_2_1_or_later._('LGPL-2.1-or-later'), + $LGPL_3_0._('LGPL-3.0'), + $LGPL_3_0plus._('LGPL-3.0+'), + $LGPL_3_0_only._('LGPL-3.0-only'), + $LGPL_3_0_or_later._('LGPL-3.0-or-later'), + $LGPLLR._('LGPLLR'), + $LOOP._('LOOP'), + $LPL_1_0._('LPL-1.0'), + $LPL_1_02._('LPL-1.02'), + $LPPL_1_0._('LPPL-1.0'), + $LPPL_1_1._('LPPL-1.1'), + $LPPL_1_2._('LPPL-1.2'), + $LPPL_1_3a._('LPPL-1.3a'), + $LPPL_1_3c._('LPPL-1.3c'), + $LZMA_SDK_9_11_to_9_20._('LZMA-SDK-9.11-to-9.20'), + $LZMA_SDK_9_22._('LZMA-SDK-9.22'), + $Latex2e._('Latex2e'), + $Latex2e_translated_notice._('Latex2e-translated-notice'), + $Leptonica._('Leptonica'), + $LiLiQ_P_1_1._('LiLiQ-P-1.1'), + $LiLiQ_R_1_1._('LiLiQ-R-1.1'), + $LiLiQ_Rplus_1_1._('LiLiQ-Rplus-1.1'), + $Libpng._('Libpng'), + $Linux_OpenIB._('Linux-OpenIB'), + $Linux_man_pages_1_para._('Linux-man-pages-1-para'), + $Linux_man_pages_copyleft._('Linux-man-pages-copyleft'), + $Linux_man_pages_copyleft_2_para._('Linux-man-pages-copyleft-2-para'), + $Linux_man_pages_copyleft_var._('Linux-man-pages-copyleft-var'), + $Lucida_Bitmap_Fonts._('Lucida-Bitmap-Fonts'), + $MIT._('MIT'), + $MIT_0._('MIT-0'), + $MIT_CMU._('MIT-CMU'), + $MIT_Festival._('MIT-Festival'), + $MIT_Modern_Variant._('MIT-Modern-Variant'), + $MIT_Wu._('MIT-Wu'), + $MIT_advertising._('MIT-advertising'), + $MIT_enna._('MIT-enna'), + $MIT_feh._('MIT-feh'), + $MIT_open_group._('MIT-open-group'), + $MIT_testregex._('MIT-testregex'), + $MITNFA._('MITNFA'), + $MMIXware._('MMIXware'), + $MPEG_SSG._('MPEG-SSG'), + $MPL_1_0._('MPL-1.0'), + $MPL_1_1._('MPL-1.1'), + $MPL_2_0._('MPL-2.0'), + $MPL_2_0_no_copyleft_exception._('MPL-2.0-no-copyleft-exception'), + $MS_LPL._('MS-LPL'), + $MS_PL._('MS-PL'), + $MS_RL._('MS-RL'), + $MTLL._('MTLL'), + $MakeIndex._('MakeIndex'), + $Martin_Birgmeier._('Martin-Birgmeier'), + $McPhee_slideshow._('McPhee-slideshow'), + $Minpack._('Minpack'), + $MirOS._('MirOS'), + $Motosoto._('Motosoto'), + $MulanPSL_1_0._('MulanPSL-1.0'), + $MulanPSL_2_0._('MulanPSL-2.0'), + $Multics._('Multics'), + $Mup._('Mup'), + $NAIST_2003._('NAIST-2003'), + $NASA_1_3._('NASA-1.3'), + $NBPL_1_0._('NBPL-1.0'), + $NCGL_UK_2_0._('NCGL-UK-2.0'), + $NCSA._('NCSA'), + $NGPL._('NGPL'), + $NICTA_1_0._('NICTA-1.0'), + $NIST_PD._('NIST-PD'), + $NIST_PD_fallback._('NIST-PD-fallback'), + $NIST_Software._('NIST-Software'), + $NLOD_1_0._('NLOD-1.0'), + $NLOD_2_0._('NLOD-2.0'), + $NLPL._('NLPL'), + $NOSL._('NOSL'), + $NPL_1_0._('NPL-1.0'), + $NPL_1_1._('NPL-1.1'), + $NPOSL_3_0._('NPOSL-3.0'), + $NRL._('NRL'), + $NTP._('NTP'), + $NTP_0._('NTP-0'), + $Naumen._('Naumen'), + $Net_SNMP._('Net-SNMP'), + $NetCDF._('NetCDF'), + $Newsletr._('Newsletr'), + $Nokia._('Nokia'), + $Noweb._('Noweb'), + $Nunit._('Nunit'), + $O_UDA_1_0._('O-UDA-1.0'), + $OCCT_PL._('OCCT-PL'), + $OCLC_2_0._('OCLC-2.0'), + $ODC_By_1_0._('ODC-By-1.0'), + $ODbL_1_0._('ODbL-1.0'), + $OFFIS._('OFFIS'), + $OFL_1_0._('OFL-1.0'), + $OFL_1_0_RFN._('OFL-1.0-RFN'), + $OFL_1_0_no_RFN._('OFL-1.0-no-RFN'), + $OFL_1_1._('OFL-1.1'), + $OFL_1_1_RFN._('OFL-1.1-RFN'), + $OFL_1_1_no_RFN._('OFL-1.1-no-RFN'), + $OGC_1_0._('OGC-1.0'), + $OGDL_Taiwan_1_0._('OGDL-Taiwan-1.0'), + $OGL_Canada_2_0._('OGL-Canada-2.0'), + $OGL_UK_1_0._('OGL-UK-1.0'), + $OGL_UK_2_0._('OGL-UK-2.0'), + $OGL_UK_3_0._('OGL-UK-3.0'), + $OGTSL._('OGTSL'), + $OLDAP_1_1._('OLDAP-1.1'), + $OLDAP_1_2._('OLDAP-1.2'), + $OLDAP_1_3._('OLDAP-1.3'), + $OLDAP_1_4._('OLDAP-1.4'), + $OLDAP_2_0._('OLDAP-2.0'), + $OLDAP_2_0_1._('OLDAP-2.0.1'), + $OLDAP_2_1._('OLDAP-2.1'), + $OLDAP_2_2._('OLDAP-2.2'), + $OLDAP_2_2_1._('OLDAP-2.2.1'), + $OLDAP_2_2_2._('OLDAP-2.2.2'), + $OLDAP_2_3._('OLDAP-2.3'), + $OLDAP_2_4._('OLDAP-2.4'), + $OLDAP_2_5._('OLDAP-2.5'), + $OLDAP_2_6._('OLDAP-2.6'), + $OLDAP_2_7._('OLDAP-2.7'), + $OLDAP_2_8._('OLDAP-2.8'), + $OLFL_1_3._('OLFL-1.3'), + $OML._('OML'), + $OPL_1_0._('OPL-1.0'), + $OPL_UK_3_0._('OPL-UK-3.0'), + $OPUBL_1_0._('OPUBL-1.0'), + $OSET_PL_2_1._('OSET-PL-2.1'), + $OSL_1_0._('OSL-1.0'), + $OSL_1_1._('OSL-1.1'), + $OSL_2_0._('OSL-2.0'), + $OSL_2_1._('OSL-2.1'), + $OSL_3_0._('OSL-3.0'), + $OpenPBS_2_3._('OpenPBS-2.3'), + $OpenSSL._('OpenSSL'), + $PADL._('PADL'), + $PDDL_1_0._('PDDL-1.0'), + $PHP_3_0._('PHP-3.0'), + $PHP_3_01._('PHP-3.01'), + $PSF_2_0._('PSF-2.0'), + $Parity_6_0_0._('Parity-6.0.0'), + $Parity_7_0_0._('Parity-7.0.0'), + $Plexus._('Plexus'), + $PolyForm_Noncommercial_1_0_0._('PolyForm-Noncommercial-1.0.0'), + $PolyForm_Small_Business_1_0_0._('PolyForm-Small-Business-1.0.0'), + $PostgreSQL._('PostgreSQL'), + $Python_2_0._('Python-2.0'), + $Python_2_0_1._('Python-2.0.1'), + $QPL_1_0._('QPL-1.0'), + $QPL_1_0_INRIA_2004._('QPL-1.0-INRIA-2004'), + $Qhull._('Qhull'), + $RHeCos_1_1._('RHeCos-1.1'), + $RPL_1_1._('RPL-1.1'), + $RPL_1_5._('RPL-1.5'), + $RPSL_1_0._('RPSL-1.0'), + $RSA_MD._('RSA-MD'), + $RSCPL._('RSCPL'), + $Rdisc._('Rdisc'), + $Ruby._('Ruby'), + $SANE_exception._('SANE-exception'), + $SAX_PD._('SAX-PD'), + $SCEA._('SCEA'), + $SGI_B_1_0._('SGI-B-1.0'), + $SGI_B_1_1._('SGI-B-1.1'), + $SGI_B_2_0._('SGI-B-2.0'), + $SGI_OpenGL._('SGI-OpenGL'), + $SGP4._('SGP4'), + $SHL_0_5._('SHL-0.5'), + $SHL_0_51._('SHL-0.51'), + $SISSL._('SISSL'), + $SISSL_1_2._('SISSL-1.2'), + $SL._('SL'), + $SMLNJ._('SMLNJ'), + $SMPPL._('SMPPL'), + $SNIA._('SNIA'), + $SPL_1_0._('SPL-1.0'), + $SSH_OpenSSH._('SSH-OpenSSH'), + $SSH_short._('SSH-short'), + $SSPL_1_0._('SSPL-1.0'), + $SWL._('SWL'), + $Saxpath._('Saxpath'), + $SchemeReport._('SchemeReport'), + $Sendmail._('Sendmail'), + $Sendmail_8_23._('Sendmail-8.23'), + $SimPL_2_0._('SimPL-2.0'), + $Sleepycat._('Sleepycat'), + $Soundex._('Soundex'), + $Spencer_86._('Spencer-86'), + $Spencer_94._('Spencer-94'), + $Spencer_99._('Spencer-99'), + $StandardML_NJ._('StandardML-NJ'), + $SugarCRM_1_1_3._('SugarCRM-1.1.3'), + $SunPro._('SunPro'), + $Symlinks._('Symlinks'), + $TAPR_OHL_1_0._('TAPR-OHL-1.0'), + $TCL._('TCL'), + $TCP_wrappers._('TCP-wrappers'), + $TMate._('TMate'), + $TORQUE_1_1._('TORQUE-1.1'), + $TOSL._('TOSL'), + $TPDL._('TPDL'), + $TPL_1_0._('TPL-1.0'), + $TTWL._('TTWL'), + $TTYP0._('TTYP0'), + $TU_Berlin_1_0._('TU-Berlin-1.0'), + $TU_Berlin_2_0._('TU-Berlin-2.0'), + $TermReadKey._('TermReadKey'), + $Texinfo_exception._('Texinfo-exception'), + $UCAR._('UCAR'), + $UCL_1_0._('UCL-1.0'), + $UPL_1_0._('UPL-1.0'), + $URT_RLE._('URT-RLE'), + $Unicode_DFS_2015._('Unicode-DFS-2015'), + $Unicode_DFS_2016._('Unicode-DFS-2016'), + $Unicode_TOU._('Unicode-TOU'), + $UnixCrypt._('UnixCrypt'), + $Unlicense._('Unlicense'), + $VOSTROM._('VOSTROM'), + $VSL_1_0._('VSL-1.0'), + $Vim._('Vim'), + $W3C._('W3C'), + $W3C_19980720._('W3C-19980720'), + $W3C_20150513._('W3C-20150513'), + $WTFPL._('WTFPL'), + $Watcom_1_0._('Watcom-1.0'), + $Widget_Workshop._('Widget-Workshop'), + $Wsuipa._('Wsuipa'), + $X11._('X11'), + $X11_distribute_modifications_variant._('X11-distribute-modifications-variant'), + $XFree86_1_1._('XFree86-1.1'), + $XSkat._('XSkat'), + $Xdebug_1_03._('Xdebug-1.03'), + $Xerox._('Xerox'), + $Xfig._('Xfig'), + $Xnet._('Xnet'), + $YPL_1_0._('YPL-1.0'), + $YPL_1_1._('YPL-1.1'), + $ZPL_1_1._('ZPL-1.1'), + $ZPL_2_0._('ZPL-2.0'), + $ZPL_2_1._('ZPL-2.1'), + $Zed._('Zed'), + $Zeeff._('Zeeff'), + $Zend_2_0._('Zend-2.0'), + $Zimbra_1_3._('Zimbra-1.3'), + $Zimbra_1_4._('Zimbra-1.4'), + $Zlib._('Zlib'), + $blessing._('blessing'), + $bzip2_1_0_5._('bzip2-1.0.5'), + $bzip2_1_0_6._('bzip2-1.0.6'), + $check_cvs._('check-cvs'), + $checkmk._('checkmk'), + $copyleft_next_0_3_0._('copyleft-next-0.3.0'), + $copyleft_next_0_3_1._('copyleft-next-0.3.1'), + $curl._('curl'), + $details._('details'), + $diffmark._('diffmark'), + $dtoa._('dtoa'), + $dvipdfm._('dvipdfm'), + $eCos_2_0._('eCos-2.0'), + $eGenix._('eGenix'), + $etalab_2_0._('etalab-2.0'), + $fwlw._('fwlw'), + $gSOAP_1_3b._('gSOAP-1.3b'), + $gnuplot._('gnuplot'), + $iMatix._('iMatix'), + $libpng_2_0._('libpng-2.0'), + $libselinux_1_0._('libselinux-1.0'), + $libtiff._('libtiff'), + $libutil_David_Nugent._('libutil-David-Nugent'), + $lsof._('lsof'), + $magaz._('magaz'), + $metamail._('metamail'), + $mpi_permissive._('mpi-permissive'), + $mpich2._('mpich2'), + $mplus._('mplus'), + $pnmstitch._('pnmstitch'), + $psfrag._('psfrag'), + $psutils._('psutils'), + $python_ldap._('python-ldap'), + $snprintf._('snprintf'), + $ssh_keyscan._('ssh-keyscan'), + $stunnel_exception._('stunnel-exception'), + $swrule._('swrule'), + $ulem._('ulem'), + $w3m._('w3m'), + $wxWindows._('wxWindows'), + $xinetd._('xinetd'), + $xlock._('xlock'), + $xpp._('xpp'), + $zlib_acknowledgement._('zlib-acknowledgement'), + $unknown._('unknown'); + + const SpdxLicense._(this.value); + + /// Parses a [String] into a [SpdxLicense]. + /// + /// If the [source] is not a valid [SpdxLicense], a [FormatException] is + /// thrown. + factory SpdxLicense.parse(String source) { + final result = _valueMap[source]; + if (result == null) { + throw FormatException('Failed to parse $source as SpdxLicense.'); + } + + return result; + } + + /// Parse [source] into a possible [SpdxLicense]. + /// + /// Like [SpdxLicense.parse] except that it returns `null` where a similar + /// call to [SpdxLicense.parse] would throw a [FormatException]. + static SpdxLicense? tryParse(String source) { + try { + return SpdxLicense.parse(source); + } on FormatException { + return null; + } + } + + static final Map _valueMap = SpdxLicense.values + .asNameMap() + .map((key, value) => MapEntry(value.value, value)); + + final String value; +} diff --git a/bricks/spdx_license/test/spdx_license_test.dart b/bricks/spdx_license/test/spdx_license_test.dart new file mode 100644 index 00000000..88a20f1c --- /dev/null +++ b/bricks/spdx_license/test/spdx_license_test.dart @@ -0,0 +1,45 @@ +import 'package:test/test.dart'; +import 'spdx_license.gen.dart'; + +void main() { + group('SpdxLicense', () { + const invalidLicenseSource = 'invalid'; + + group('parse', () { + test('can parse a valid SPDX license', () { + expect(SpdxLicense.parse('MIT'), SpdxLicense.$MIT); + }); + + test('can parse "unknown"', () { + expect(SpdxLicense.parse('unknown'), SpdxLicense.$unknown); + }); + + test('throws on invalid SPDX license', () { + expect( + () => SpdxLicense.parse(invalidLicenseSource), + throwsA( + isA().having( + (exception) => exception.message, + 'message', + 'Failed to parse $invalidLicenseSource as SpdxLicense.', + ), + ), + ); + }); + }); + + group('tryParse', () { + test('can parse a valid SPDX license', () { + expect(SpdxLicense.tryParse('MIT'), SpdxLicense.$MIT); + }); + + test('can parse "unknown"', () { + expect(SpdxLicense.tryParse('unknown'), SpdxLicense.$unknown); + }); + + test('returns null on invalid SPDX license', () { + expect(SpdxLicense.tryParse(invalidLicenseSource), isNull); + }); + }); + }); +} From d59689d558688819bf5a382586c329593b29d6ba Mon Sep 17 00:00:00 2001 From: Alejandro Santiago Date: Mon, 2 Oct 2023 12:57:42 +0100 Subject: [PATCH 03/16] docs --- .github/workflows/spdx_license.yaml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/spdx_license.yaml b/.github/workflows/spdx_license.yaml index 36c0d94b..7d7b47c6 100644 --- a/.github/workflows/spdx_license.yaml +++ b/.github/workflows/spdx_license.yaml @@ -51,3 +51,26 @@ jobs: uses: VeryGoodOpenSource/very_good_coverage@v2.1.0 with: path: bricks/spdx_license/hooks/coverage/lcov.info + brick_test: + defaults: + run: + working-directory: bricks/spdx_license + runs-on: ubuntu-latest + steps: + - name: ๐Ÿ“š Git Checkout + uses: actions/checkout@v4 + + - uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/dart_package.yml@v1 + with: + working_directory: bricks/spdx_license + + - name: ๐Ÿงฑ Mason make + # If this step fails, you may need to run the following command (from bricks/spdx_license): + # ```sh + # mason make spdx_license --licenses "[]" -o test --on-conflict overwrite` + # ``` + # This will build the brick and generate the necessary and latest files for testing. + run: | + dart pub global activate mason_cli + mason get + mason make spdx_license --licenses "[]" -o test --on-conflict overwrite --set-exit-if-changed From 8ada4103950de17a9e578bdee6a344474adf345b Mon Sep 17 00:00:00 2001 From: Alejandro Santiago Date: Mon, 2 Oct 2023 13:00:56 +0100 Subject: [PATCH 04/16] updated pubspec --- bricks/spdx_license/pubspec.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bricks/spdx_license/pubspec.yaml b/bricks/spdx_license/pubspec.yaml index f66225e6..55f5cc09 100644 --- a/bricks/spdx_license/pubspec.yaml +++ b/bricks/spdx_license/pubspec.yaml @@ -1,5 +1,5 @@ -name: spdx_license_brick -description: Testing the generated SPDX license brick. +name: spdx_license_brick_test +description: Testing package for the SPDX license brick output. version: 0.1.0+1 repository: https://github.com/VeryGoodOpenSource/very_good_cli issue_tracker: https://github.com/VeryGoodOpenSource/very_good_cli/issues @@ -9,7 +9,5 @@ environment: sdk: ">=3.0.0 <4.0.0" dev_dependencies: - mocktail: ^1.0.0 - path: ^1.8.3 test: ^1.19.2 very_good_analysis: ^5.1.0 From ebb21cf1e997cb0b11ee1a7d50140450fd3c5682 Mon Sep 17 00:00:00 2001 From: Alejandro Santiago Date: Mon, 2 Oct 2023 13:10:53 +0100 Subject: [PATCH 05/16] typo --- .github/workflows/spdx_license.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/spdx_license.yaml b/.github/workflows/spdx_license.yaml index 7d7b47c6..941820dd 100644 --- a/.github/workflows/spdx_license.yaml +++ b/.github/workflows/spdx_license.yaml @@ -51,6 +51,7 @@ jobs: uses: VeryGoodOpenSource/very_good_coverage@v2.1.0 with: path: bricks/spdx_license/hooks/coverage/lcov.info + brick_test: defaults: run: @@ -67,7 +68,7 @@ jobs: - name: ๐Ÿงฑ Mason make # If this step fails, you may need to run the following command (from bricks/spdx_license): # ```sh - # mason make spdx_license --licenses "[]" -o test --on-conflict overwrite` + # mason make spdx_license --licenses "[]" -o test --on-conflict overwrite # ``` # This will build the brick and generate the necessary and latest files for testing. run: | From 73d0e8ffc3606581140ba78d4efcac3467f5c892 Mon Sep 17 00:00:00 2001 From: Alejandro Santiago Date: Mon, 2 Oct 2023 14:55:21 +0100 Subject: [PATCH 06/16] ci: update workflow --- .github/workflows/spdx_license.yaml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/.github/workflows/spdx_license.yaml b/.github/workflows/spdx_license.yaml index 941820dd..cc28bae7 100644 --- a/.github/workflows/spdx_license.yaml +++ b/.github/workflows/spdx_license.yaml @@ -58,20 +58,6 @@ jobs: working-directory: bricks/spdx_license runs-on: ubuntu-latest steps: - - name: ๐Ÿ“š Git Checkout - uses: actions/checkout@v4 - - uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/dart_package.yml@v1 with: working_directory: bricks/spdx_license - - - name: ๐Ÿงฑ Mason make - # If this step fails, you may need to run the following command (from bricks/spdx_license): - # ```sh - # mason make spdx_license --licenses "[]" -o test --on-conflict overwrite - # ``` - # This will build the brick and generate the necessary and latest files for testing. - run: | - dart pub global activate mason_cli - mason get - mason make spdx_license --licenses "[]" -o test --on-conflict overwrite --set-exit-if-changed From 770735b37e01c0b3e31c7aeb7ba0b80157dd002d Mon Sep 17 00:00:00 2001 From: Alejandro Santiago Date: Mon, 2 Oct 2023 14:56:15 +0100 Subject: [PATCH 07/16] ci: workflow --- .github/workflows/spdx_license.yaml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/spdx_license.yaml b/.github/workflows/spdx_license.yaml index cc28bae7..36c0d94b 100644 --- a/.github/workflows/spdx_license.yaml +++ b/.github/workflows/spdx_license.yaml @@ -51,13 +51,3 @@ jobs: uses: VeryGoodOpenSource/very_good_coverage@v2.1.0 with: path: bricks/spdx_license/hooks/coverage/lcov.info - - brick_test: - defaults: - run: - working-directory: bricks/spdx_license - runs-on: ubuntu-latest - steps: - - uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/dart_package.yml@v1 - with: - working_directory: bricks/spdx_license From 3e37e2145d150ed7a57ed325d94f6f1b82c720df Mon Sep 17 00:00:00 2001 From: Alejandro Santiago Date: Mon, 2 Oct 2023 14:57:26 +0100 Subject: [PATCH 08/16] ci: workflow --- .github/workflows/spdx_license.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/spdx_license.yaml b/.github/workflows/spdx_license.yaml index 36c0d94b..23e13f7e 100644 --- a/.github/workflows/spdx_license.yaml +++ b/.github/workflows/spdx_license.yaml @@ -51,3 +51,12 @@ jobs: uses: VeryGoodOpenSource/very_good_coverage@v2.1.0 with: path: bricks/spdx_license/hooks/coverage/lcov.info + + build_brick: + defaults: + run: + working-directory: bricks/spdx_license + runs-on: ubuntu-latest + steps: + - name: ๐Ÿ“š Git Checkout + uses: actions/checkout@v4 From bfe82877db822b4d1b528204a1636b04f7dba7eb Mon Sep 17 00:00:00 2001 From: Alejandro Santiago Date: Mon, 2 Oct 2023 14:58:36 +0100 Subject: [PATCH 09/16] ci: workflow --- .github/workflows/spdx_license.yaml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/spdx_license.yaml b/.github/workflows/spdx_license.yaml index 23e13f7e..536f2e5e 100644 --- a/.github/workflows/spdx_license.yaml +++ b/.github/workflows/spdx_license.yaml @@ -53,10 +53,6 @@ jobs: path: bricks/spdx_license/hooks/coverage/lcov.info build_brick: - defaults: - run: - working-directory: bricks/spdx_license - runs-on: ubuntu-latest - steps: - - name: ๐Ÿ“š Git Checkout - uses: actions/checkout@v4 + uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/dart_package.yml@v1 + with: + working-directory: bricks/spdx_license From 0aa554e80bbc80bbded05e62bcfa821080df865c Mon Sep 17 00:00:00 2001 From: Alejandro Santiago Date: Mon, 2 Oct 2023 14:59:41 +0100 Subject: [PATCH 10/16] ci: workflow --- .github/workflows/spdx_license.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/spdx_license.yaml b/.github/workflows/spdx_license.yaml index 536f2e5e..b5ef543d 100644 --- a/.github/workflows/spdx_license.yaml +++ b/.github/workflows/spdx_license.yaml @@ -55,4 +55,4 @@ jobs: build_brick: uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/dart_package.yml@v1 with: - working-directory: bricks/spdx_license + working_directory: bricks/spdx_license From 8c186be8b7281e5cfa46a06835988ee03099e8b1 Mon Sep 17 00:00:00 2001 From: Alejandro Santiago Date: Tue, 3 Oct 2023 11:04:28 +0100 Subject: [PATCH 11/16] ci: workflow --- .github/workflows/spdx_license.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/spdx_license.yaml b/.github/workflows/spdx_license.yaml index b5ef543d..d994c4a8 100644 --- a/.github/workflows/spdx_license.yaml +++ b/.github/workflows/spdx_license.yaml @@ -56,3 +56,4 @@ jobs: uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/dart_package.yml@v1 with: working_directory: bricks/spdx_license + format_directories: test/**_test.dart From 05e4126a9aba4feeb3f46666b4b727e889f760fd Mon Sep 17 00:00:00 2001 From: Alejandro Santiago Date: Tue, 3 Oct 2023 11:07:01 +0100 Subject: [PATCH 12/16] ci: workflow --- .github/workflows/spdx_license.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/spdx_license.yaml b/.github/workflows/spdx_license.yaml index d994c4a8..ae24df1b 100644 --- a/.github/workflows/spdx_license.yaml +++ b/.github/workflows/spdx_license.yaml @@ -57,3 +57,4 @@ jobs: with: working_directory: bricks/spdx_license format_directories: test/**_test.dart + analyze_directories: test/**_test.dart From cf41bf9b0f92fbf1ba216d925101642e2568f526 Mon Sep 17 00:00:00 2001 From: Alejandro Santiago Date: Tue, 3 Oct 2023 11:16:53 +0100 Subject: [PATCH 13/16] ci: workflow --- .github/workflows/spdx_license.yaml | 36 +++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/.github/workflows/spdx_license.yaml b/.github/workflows/spdx_license.yaml index ae24df1b..04d7a587 100644 --- a/.github/workflows/spdx_license.yaml +++ b/.github/workflows/spdx_license.yaml @@ -53,8 +53,34 @@ jobs: path: bricks/spdx_license/hooks/coverage/lcov.info build_brick: - uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/dart_package.yml@v1 - with: - working_directory: bricks/spdx_license - format_directories: test/**_test.dart - analyze_directories: test/**_test.dart + defaults: + run: + working-directory: bricks/spdx_license + runs-on: ubuntu-latest + steps: + - name: ๐Ÿ“š Git Checkout + uses: actions/checkout@v4 + + - name: ๐ŸŽฏ Setup Dart + uses: dart-lang/setup-dart@v1 + with: + sdk: 3.1.0 + + - name: ๐Ÿ“ฆ Install Dependencies + run: dart pub get + + - name: โœจ Check Formatting + run: dart format --set-exit-if-changed test/**_test.dart + + - name: ๐Ÿ•ต๏ธ Analyze + run: dart analyze --fatal-infos --fatal-warnings test/**_test.dart + + - name: ๐Ÿงช Run Tests + run: | + dart pub global activate coverage 1.2.0 + dart pub run test -j 4 --run-skipped --coverage=coverage --test-randomize-ordering-seed random && dart pub global run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.dart_tool/package_config.json --report-on="test/**.gen.dart" + + - name: ๐Ÿ“Š Check Code Coverage + uses: VeryGoodOpenSource/very_good_coverage@v2.1.0 + with: + path: bricks/spdx_license/coverage/lcov.info From 73f6553150dec82c3bb369b15dbfa0f3ee6937d5 Mon Sep 17 00:00:00 2001 From: Alejandro Santiago Date: Tue, 3 Oct 2023 12:08:26 +0100 Subject: [PATCH 14/16] ci: workflow --- .github/workflows/spdx_license.yaml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/spdx_license.yaml b/.github/workflows/spdx_license.yaml index 04d7a587..8d7a3ea0 100644 --- a/.github/workflows/spdx_license.yaml +++ b/.github/workflows/spdx_license.yaml @@ -76,11 +76,4 @@ jobs: run: dart analyze --fatal-infos --fatal-warnings test/**_test.dart - name: ๐Ÿงช Run Tests - run: | - dart pub global activate coverage 1.2.0 - dart pub run test -j 4 --run-skipped --coverage=coverage --test-randomize-ordering-seed random && dart pub global run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.dart_tool/package_config.json --report-on="test/**.gen.dart" - - - name: ๐Ÿ“Š Check Code Coverage - uses: VeryGoodOpenSource/very_good_coverage@v2.1.0 - with: - path: bricks/spdx_license/coverage/lcov.info + run: dart test -j 4 --run-skipped --test-randomize-ordering-seed random From deb9a368bb521c8edb06e84b411fcf61591ccb22 Mon Sep 17 00:00:00 2001 From: Alejandro Santiago Date: Tue, 3 Oct 2023 12:14:04 +0100 Subject: [PATCH 15/16] ci: workflow --- .github/workflows/spdx_license.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/spdx_license.yaml b/.github/workflows/spdx_license.yaml index 8d7a3ea0..188784a3 100644 --- a/.github/workflows/spdx_license.yaml +++ b/.github/workflows/spdx_license.yaml @@ -69,6 +69,17 @@ jobs: - name: ๐Ÿ“ฆ Install Dependencies run: dart pub get + - name: ๐Ÿงฑ Mason make + # If this step fails, you may need to run the following command (from bricks/spdx_license): + # ```sh + # mason make spdx_license --licenses "[]" -o test --on-conflict overwrite + # ``` + # This will build the brick and generate the latest files for testing. + run: | + dart pub global activate mason_cli + mason get + mason make spdx_license --licenses "[]" -o test --on-conflict overwrite --set-exit-if-changed + - name: โœจ Check Formatting run: dart format --set-exit-if-changed test/**_test.dart From ecb3e3d2990817c1de2220115370696fa62a10a8 Mon Sep 17 00:00:00 2001 From: Alejandro Santiago Date: Tue, 3 Oct 2023 12:17:15 +0100 Subject: [PATCH 16/16] docs --- bricks/spdx_license/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bricks/spdx_license/pubspec.yaml b/bricks/spdx_license/pubspec.yaml index 55f5cc09..f71ecd7b 100644 --- a/bricks/spdx_license/pubspec.yaml +++ b/bricks/spdx_license/pubspec.yaml @@ -1,5 +1,5 @@ name: spdx_license_brick_test -description: Testing package for the SPDX license brick output. +description: Testing package for the SPDX License brick output. version: 0.1.0+1 repository: https://github.com/VeryGoodOpenSource/very_good_cli issue_tracker: https://github.com/VeryGoodOpenSource/very_good_cli/issues