From 4b013956754d21ecf50ab4206212fb3a745138a2 Mon Sep 17 00:00:00 2001 From: Maximilian Haru Raditya Date: Tue, 26 Dec 2023 04:08:14 +0700 Subject: [PATCH] Updated configuration. --- .editorconfig | 165 ++++++++++-------- .gitattributes | 138 ++++++++------- .github/workflows/build.yml | 18 +- .gitignore | 13 +- CleanPackages.cmd | 29 ++- Directory.Packages.props | 34 ++++ LICENSE | 2 +- NHibernate.ObservableCollections-all.sln | 28 ++- NHibernate.ObservableCollections.sln | 3 +- README.md | 4 +- build/AssemblyInfo.Global.cs | 3 - build/Build.props | 32 ++-- build/BuildPackages.cmd | 11 +- ...rnate.ObservableCollections.DemoApp.csproj | 14 +- ...rnate.ObservableCollections.Helpers.csproj | 8 +- .../Outlining/RelativePosition.cs | 2 +- ...bernate.ObservableCollections.Tests.csproj | 27 ++- .../DebugView.cs | 2 +- .../NHibernate.ObservableCollections.csproj | 8 +- .../Explicit.NuGet.Versions.csproj | 13 +- .../Explicit.NuGet.Versions.sln | 2 +- tools/Explicit.NuGet.Versions/Program.cs | 38 ++-- 22 files changed, 341 insertions(+), 253 deletions(-) create mode 100644 Directory.Packages.props diff --git a/.editorconfig b/.editorconfig index f25bbdc..a87fd69 100644 --- a/.editorconfig +++ b/.editorconfig @@ -27,7 +27,7 @@ tab_width = 2 # Solution and project configuration files -[*.{props,targets,yml,ruleset,nuspec,vsixmanifest,vsct}] +[*.{props,targets,manifest,yml,ruleset,nuspec,vsixmanifest,vsct}] indent_size = 2 tab_width = 2 @@ -76,56 +76,57 @@ dotnet_sort_system_directives_first = true file_header_template = unset # this. and Me. preferences -dotnet_style_qualification_for_event = false -dotnet_style_qualification_for_field = false -dotnet_style_qualification_for_method = false -dotnet_style_qualification_for_property = false +dotnet_style_qualification_for_event = false:silent +dotnet_style_qualification_for_field = false:silent +dotnet_style_qualification_for_method = false:silent +dotnet_style_qualification_for_property = false:silent # Language keywords vs BCL types preferences -dotnet_style_predefined_type_for_locals_parameters_members = true -dotnet_style_predefined_type_for_member_access = true +dotnet_style_predefined_type_for_locals_parameters_members = true:silent +dotnet_style_predefined_type_for_member_access = true:silent # Parentheses preferences -dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity -dotnet_style_parentheses_in_other_binary_operators = always_for_clarity -dotnet_style_parentheses_in_other_operators = never_if_unnecessary -dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent # Modifier preferences -dotnet_style_require_accessibility_modifiers = for_non_interface_members +dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent # Expression-level preferences -dotnet_style_coalesce_expression = true -dotnet_style_collection_initializer = true -dotnet_style_explicit_tuple_names = true -dotnet_style_namespace_match_folder = true +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_explicit_tuple_names = true:suggestion +dotnet_style_namespace_match_folder = true:suggestion dotnet_diagnostic.IDE0130.severity = suggestion -dotnet_style_null_propagation = true -dotnet_style_object_initializer = true +dotnet_style_null_propagation = true:suggestion +dotnet_style_object_initializer = true:suggestion dotnet_style_operator_placement_when_wrapping = end_of_line -dotnet_style_prefer_auto_properties = true -dotnet_style_prefer_compound_assignment = true -dotnet_style_prefer_conditional_expression_over_assignment = true -dotnet_style_prefer_conditional_expression_over_return = true +dotnet_style_prefer_auto_properties = true:silent +dotnet_style_prefer_collection_expression = true:suggestion +dotnet_style_prefer_compound_assignment = true:suggestion +dotnet_style_prefer_conditional_expression_over_assignment = true:silent +dotnet_style_prefer_conditional_expression_over_return = true:silent dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed -dotnet_style_prefer_inferred_anonymous_type_member_names = true -dotnet_style_prefer_inferred_tuple_names = true -dotnet_style_prefer_is_null_check_over_reference_equality_method = true -dotnet_style_prefer_simplified_boolean_expressions = true -dotnet_style_prefer_simplified_interpolation = true +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion +dotnet_style_prefer_inferred_tuple_names = true:suggestion +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion +dotnet_style_prefer_simplified_boolean_expressions = true:suggestion +dotnet_style_prefer_simplified_interpolation = true:suggestion # Field preferences -dotnet_style_readonly_field = true +dotnet_style_readonly_field = true:suggestion # Parameter preferences -dotnet_code_quality_unused_parameters = all +dotnet_code_quality_unused_parameters = all:suggestion # Suppression preferences dotnet_remove_unnecessary_suppression_exclusions = none # New line preferences -dotnet_style_allow_multiple_blank_lines_experimental = true -dotnet_style_allow_statement_immediately_after_block_experimental = false +dotnet_style_allow_multiple_blank_lines_experimental = true:silent +dotnet_style_allow_statement_immediately_after_block_experimental = false:silent #### Naming styles #### @@ -177,11 +178,19 @@ dotnet_naming_style.begins_with_i.capitalization = pascal_case # CA1307: Specify StringComparison for clarity # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1307 -dotnet_diagnostic.CA1307.severity = suggestion +dotnet_diagnostic.CA1307.severity = warning # CA1309: Use ordinal StringComparison # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1309 -dotnet_diagnostic.CA1309.severity = suggestion +dotnet_diagnostic.CA1309.severity = warning + +# CA1311: Specify a culture or use an invariant version +# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1311 +dotnet_diagnostic.CA1311.severity = warning + +# CA1815: Override equals and operator equals on value types +# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1815 +dotnet_diagnostic.CA1815.severity = error # C# files @@ -190,64 +199,64 @@ dotnet_diagnostic.CA1309.severity = suggestion #### C# Coding Conventions #### # var preferences -csharp_style_var_elsewhere = true -csharp_style_var_for_built_in_types = true -csharp_style_var_when_type_is_apparent = true +csharp_style_var_elsewhere = true:silent +csharp_style_var_for_built_in_types = true:silent +csharp_style_var_when_type_is_apparent = true:silent # Expression-bodied members -csharp_style_expression_bodied_accessors = true -csharp_style_expression_bodied_constructors = false -csharp_style_expression_bodied_indexers = true -csharp_style_expression_bodied_lambdas = true -csharp_style_expression_bodied_local_functions = false -csharp_style_expression_bodied_methods = false -csharp_style_expression_bodied_operators = false -csharp_style_expression_bodied_properties = true +csharp_style_expression_bodied_accessors = true:silent +csharp_style_expression_bodied_constructors = false:silent +csharp_style_expression_bodied_indexers = true:silent +csharp_style_expression_bodied_lambdas = true:silent +csharp_style_expression_bodied_local_functions = false:silent +csharp_style_expression_bodied_methods = false:silent +csharp_style_expression_bodied_operators = false:silent +csharp_style_expression_bodied_properties = true:silent # Pattern matching preferences -csharp_style_pattern_matching_over_as_with_null_check = true -csharp_style_pattern_matching_over_is_with_cast_check = true -csharp_style_prefer_extended_property_pattern = true -csharp_style_prefer_not_pattern = true -csharp_style_prefer_pattern_matching = true -csharp_style_prefer_switch_expression = true +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion +csharp_style_prefer_extended_property_pattern = true:suggestion +csharp_style_prefer_not_pattern = true:suggestion +csharp_style_prefer_pattern_matching = true:silent +csharp_style_prefer_switch_expression = true:suggestion # Null-checking preferences -csharp_style_conditional_delegate_call = true +csharp_style_conditional_delegate_call = true:suggestion # Modifier preferences -csharp_prefer_static_local_function = true +csharp_prefer_static_local_function = true:suggestion csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async # Code-block preferences -csharp_prefer_braces = true -csharp_prefer_simple_using_statement = true -csharp_style_namespace_declarations = block_scoped -csharp_style_prefer_method_group_conversion = true -csharp_style_prefer_top_level_statements = true +csharp_prefer_braces = true:silent +csharp_prefer_simple_using_statement = true:suggestion +csharp_style_namespace_declarations = file_scoped:silent +csharp_style_prefer_method_group_conversion = true:silent +csharp_style_prefer_top_level_statements = true:silent # Expression-level preferences -csharp_prefer_simple_default_expression = true -csharp_style_deconstructed_variable_declaration = true -csharp_style_implicit_object_creation_when_type_is_apparent = true -csharp_style_inlined_variable_declaration = true -csharp_style_prefer_index_operator = true -csharp_style_prefer_local_over_anonymous_function = true -csharp_style_prefer_null_check_over_type_check = true -csharp_style_prefer_range_operator = true -csharp_style_prefer_tuple_swap = true -csharp_style_prefer_utf8_string_literals = true -csharp_style_throw_expression = true -csharp_style_unused_value_assignment_preference = discard_variable -csharp_style_unused_value_expression_statement_preference = discard_variable +csharp_prefer_simple_default_expression = true:suggestion +csharp_style_deconstructed_variable_declaration = true:suggestion +csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion +csharp_style_inlined_variable_declaration = true:suggestion +csharp_style_prefer_index_operator = true:suggestion +csharp_style_prefer_local_over_anonymous_function = true:suggestion +csharp_style_prefer_null_check_over_type_check = true:suggestion +csharp_style_prefer_range_operator = true:suggestion +csharp_style_prefer_tuple_swap = true:suggestion +csharp_style_prefer_utf8_string_literals = true:suggestion +csharp_style_throw_expression = true:suggestion +csharp_style_unused_value_assignment_preference = discard_variable:suggestion +csharp_style_unused_value_expression_statement_preference = discard_variable:silent # 'using' directive preferences -csharp_using_directive_placement = inside_namespace +csharp_using_directive_placement = inside_namespace:silent # New line preferences -csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true -csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false -csharp_style_allow_embedded_statements_on_same_line_experimental = false +csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent +csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false:silent +csharp_style_allow_embedded_statements_on_same_line_experimental = false:silent #### C# Formatting Rules #### @@ -296,6 +305,11 @@ csharp_space_between_square_brackets = false # Wrapping preferences csharp_preserve_single_line_blocks = true csharp_preserve_single_line_statements = true +csharp_style_prefer_primary_constructors = false:suggestion +csharp_style_prefer_readonly_struct_member = true:suggestion +csharp_style_prefer_readonly_struct = true:suggestion +csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:silent +csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent # C# generated files @@ -307,6 +321,3 @@ generated_code = true [*.vb] # Modifier preferences visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async - - - diff --git a/.gitattributes b/.gitattributes index b064dcd..8a0bad5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,72 +1,80 @@ +## https://git-scm.com/docs/gitattributes +## https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes +## https://github.com/gitattributes/gitattributes ## https://github.com/alexkaratarakis/gitattributes # Set default behavior to automatically normalize line endings. # Auto detect text files and perform LF normalization -* text=auto +* text=auto -# Set the merge driver for project and solution files +# Project and solution files # Files that will always have CRLF line endings on checkout. -*.sln text eol=crlf -*.csproj text eol=crlf -*.props text eol=crlf -*.targets text eol=crlf -*.proj text eol=crlf -*.config text eol=crlf -*.json text eol=crlf -*.cs text eol=crlf -*.xml text eol=crlf -*.xaml text eol=crlf -*.html text eol=crlf -*.js text eol=crlf -*.map text eol=crlf -*.css text eol=crlf -*.less text eol=crlf -*.resx text eol=crlf -*.manifest text eol=crlf -*.txt text eol=crlf -*.cpp text eol=crlf -*.c text eol=crlf -*.h text eol=crlf -SOURCES text eol=crlf -MAKEFILE text eol=crlf - -# Binary files that should not be modified. -*.exe binary -*.dll binary -*.pdb binary -*.xap binary -*.snk binary -*.png binary -*.ico binary -*.jpg binary -*.jpeg binary -*.gif binary -*.bmp binary -*.webp binary -*.cur binary -*.sys binary -*.chm binary - -# Custom for Visual Studio -*.cs diff=csharp -*.js diff=astextplain -*.sln merge=union -*.csproj merge=union -*.vbproj merge=union -*.fsproj merge=union -*.dbproj merge=union - -# Standard to msysgit -*.doc diff=astextplain -*.DOC diff=astextplain -*.docx diff=astextplain -*.DOCX diff=astextplain -*.dot diff=astextplain -*.DOT diff=astextplain -*.pdf diff=astextplain -*.PDF diff=astextplain -*.rtf diff=astextplain -*.RTF diff=astextplain - - +*.sln text eol=crlf merge=union +*.manifest text eol=crlf +*.props text eol=crlf +*.targets text eol=crlf +*.json text +*.config text eol=crlf +*.ruleset text eol=crlf +*.resx text eol=crlf +*.xaml text eol=crlf diff=html +*.csproj text eol=crlf merge=union +*.cs text eol=crlf diff=csharp +*.csx text eol=crlf diff=csharp +*.cshtml text eol=crlf diff=html +*.vbproj text eol=crlf merge=union +*.vb text eol=crlf +*.vbx text eol=crlf +*.vbhtml text eol=crlf diff=html +*.vcxproj text eol=crlf merge=union +*.vcproj text eol=crlf merge=union +*.h text diff=cpp +*.c text diff=cpp +*.cpp text diff=cpp +SOURCES text +MAKEFILE text +*.fsproj text eol=crlf merge=union +*.fs text eol=crlf +*.sqlproj text eol=crlf merge=union +*.dbproj text eol=crlf merge=union +*.sql text +*.sqlgen text eol=crlf +*.wixproj text eol=crlf merge=union +*.proj text eol=crlf merge=union +*.xml text diff=html +*.xsd text diff=html +*.html text diff=html +*.htm text diff=html +*.css text diff=css +*.less text diff=css +*.ts text +*.js text +*.map text +*.ps1 text eol=crlf +*.psm1 text eol=crlf +*.psd1 text eol=crlf +*.ps1xml text eol=crlf +*.cmd text eol=crlf +*.bat text eol=crlf +*.licenseheader text eol=crlf +*.pubxml text eol=crlf +*.md text diff=markdown +*.txt text +# Binary files +*.exe binary +*.dll binary +*.pdb binary +*.msi binary +*.xap binary +*.snk binary +*.png binary +*.ico binary +*.jpg binary +*.jpeg binary +*.gif binary +*.bmp binary +*.webp binary +*.cur binary +*.sys binary +*.chm binary diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index db8be70..0087d0c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,7 @@ jobs: os: [windows-latest, ubuntu-latest, macos-latest] project: - 'NHibernate.ObservableCollections.sln' - framework: [net7.0, net6.0, net48] + framework: [net8.0, net7.0, net6.0, net48] configuration: [Release] exclude: - os: ubuntu-latest @@ -36,6 +36,12 @@ jobs: - name: Checkout Source Code uses: actions/checkout@v3 + - name: Setup .NET 8.0 SDK + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 8.0.x + if: ${{ startswith(matrix.framework, 'net8.') }} + - name: Setup .NET 7.0 SDK uses: actions/setup-dotnet@v3 with: @@ -51,17 +57,17 @@ jobs: - name: Setup Environment Variables run: | $project_name = [System.IO.Path]::GetFileNameWithoutExtension("${{matrix.project}}") - $test_results_artifact_name = "TestResults_${{matrix.os}}_${{matrix.framework}}_${{matrix.configuration}}" + $test_results_artifact_name = "TestResults_${project_name}_${{matrix.os}}_${{matrix.framework}}_${{matrix.configuration}}" $working_directory = "$env:GITHUB_WORKSPACE" Write-Host "Project Name: $project_name" Write-Host "Test Results Artifact Name: $test_results_artifact_name" Write-Host "Working Directory: $working_directory" - echo "project_name=$project_name" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - echo "test_results_artifact_name=$test_results_artifact_name" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + Write-Output "project_name=$project_name" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + Write-Output "test_results_artifact_name=$test_results_artifact_name" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append # Set the Azure DevOps default working directory env variable, so our tests only need to deal with a single env variable - echo "SYSTEM_DEFAULTWORKINGDIRECTORY=$working_directory" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + Write-Output "SYSTEM_DEFAULTWORKINGDIRECTORY=$working_directory" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append # Title for LiquidTestReports.Markdown - echo "title=Test Run for $project_name - ${{matrix.framework}} - ${{matrix.os}}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + Write-Output "title=Test Run for $project_name - ${{matrix.os}} - ${{matrix.framework}}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append shell: pwsh - name: Build diff --git a/.gitignore b/.gitignore index ec1127b..244a8e4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,10 @@ ## https://github.com/github/gitignore -src/*/bin/ -src/*/obj/ -lib/packages/ -bin/ -log/ -obj/ -temp/ .vs/ .idea/ +bin/ +obj/ +log/ *.suo *.user @@ -17,6 +13,3 @@ temp/ *.log *.cache Thumbs.db - - - diff --git a/CleanPackages.cmd b/CleanPackages.cmd index f889708..cc0bed0 100644 --- a/CleanPackages.cmd +++ b/CleanPackages.cmd @@ -1,39 +1,36 @@ @ECHO OFF -ECHO. +SET OUTPUT_FOLDER_PATH=bin +SET TEMPORARY_OUTPUT_FOLDER_PATH=obj +SET NEV_BIN_FOLDER_PATH=tools\Explicit.NuGet.Versions\bin +SET NEV_OBJ_FOLDER_PATH=tools\Explicit.NuGet.Versions\obj -SET "OUTPUT_FOLDER_PATH=bin" -SET "TEMPORARY_OUTPUT_FOLDER_PATH=obj" -SET "NEV_BIN_FOLDER_PATH=tools\Explicit.NuGet.Versions\bin" -SET "NEV_OBJ_FOLDER_PATH=tools\Explicit.NuGet.Versions\obj" +ECHO. REM dotnet clean %1 --configuration Debug REM dotnet clean %1 --configuration Release -IF EXIST %OUTPUT_FOLDER_PATH% ( +IF EXIST "%OUTPUT_FOLDER_PATH%" ( ECHO Deleting "%OUTPUT_FOLDER_PATH%" folder... - RMDIR %OUTPUT_FOLDER_PATH% /S /Q + RMDIR "%OUTPUT_FOLDER_PATH%" /S /Q ) -IF EXIST %TEMPORARY_OUTPUT_FOLDER_PATH% ( +IF EXIST "%TEMPORARY_OUTPUT_FOLDER_PATH%" ( ECHO Deleting "%TEMPORARY_OUTPUT_FOLDER_PATH%" folder... - RMDIR %TEMPORARY_OUTPUT_FOLDER_PATH% /S /Q + RMDIR "%TEMPORARY_OUTPUT_FOLDER_PATH%" /S /Q ) -IF EXIST %NEV_BIN_FOLDER_PATH% ( +IF EXIST "%NEV_BIN_FOLDER_PATH%" ( ECHO Deleting "%NEV_BIN_FOLDER_PATH%" folder... - RMDIR %NEV_BIN_FOLDER_PATH% /S /Q + RMDIR "%NEV_BIN_FOLDER_PATH%" /S /Q ) -IF EXIST %NEV_OBJ_FOLDER_PATH% ( +IF EXIST "%NEV_OBJ_FOLDER_PATH%" ( ECHO Deleting "%NEV_OBJ_FOLDER_PATH%" folder... - RMDIR %NEV_OBJ_FOLDER_PATH% /S /Q + RMDIR "%NEV_OBJ_FOLDER_PATH%" /S /Q ) ECHO. - - - diff --git a/Directory.Packages.props b/Directory.Packages.props new file mode 100644 index 0000000..cc1f867 --- /dev/null +++ b/Directory.Packages.props @@ -0,0 +1,34 @@ + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/LICENSE b/LICENSE index 44780a5..e907581 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022 NHibernate.ObservableCollections Contributors +Copyright (c) 2007-2024 NHibernate.ObservableCollections Contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/NHibernate.ObservableCollections-all.sln b/NHibernate.ObservableCollections-all.sln index 9dc2c17..9d09e79 100644 --- a/NHibernate.ObservableCollections-all.sln +++ b/NHibernate.ObservableCollections-all.sln @@ -1,6 +1,7 @@ + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 -VisualStudioVersion = 17.2.32519.379 +VisualStudioVersion = 17.8.34330.188 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7E507A42-984B-470D-8A0C-648B9AF8E1DC}" ProjectSection(SolutionItems) = preProject @@ -9,20 +10,17 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution .gitignore = .gitignore CHANGELOG.md = CHANGELOG.md LICENSE = LICENSE - Read Me.txt = Read Me.txt README.md = README.md EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{6E3FEE79-C382-439C-AFD9-5505D414680D}" ProjectSection(SolutionItems) = preProject - build\AssemblyInfo.Global.cs = build\AssemblyInfo.Global.cs - build\Build.props = build\Build.props - build\Build.targets = build\Build.targets BuildPackages.cmd = BuildPackages.cmd - build\BuildPackages.cmd = build\BuildPackages.cmd CleanPackages.cmd = CleanPackages.cmd + Directory.Build.props = Directory.Build.props + Directory.Build.targets = Directory.Build.targets + Directory.Packages.props = Directory.Packages.props nuget.config = nuget.config - build\Read Me.txt = build\Read Me.txt EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GitHub Actions", "GitHub Actions", "{7BAAD61E-1493-4B51-A458-2A8F2FDD45FE}" @@ -38,6 +36,20 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NHibernate.ObservableCollec EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NHibernate.ObservableCollections.DemoApp", "src\NHibernate.ObservableCollections.DemoApp\NHibernate.ObservableCollections.DemoApp.csproj", "{E97AE325-7B6F-4C7F-AF03-643877DC8C52}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{E8456C26-3E0D-4272-9794-3041D2DC97E8}" + ProjectSection(SolutionItems) = preProject + build\AssemblyInfo.Global.cs = build\AssemblyInfo.Global.cs + build\Build.props = build\Build.props + build\Build.targets = build\Build.targets + build\BuildPackages.cmd = build\BuildPackages.cmd + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{BCAA4557-7813-4A6E-AFE3-D5745C62E6BB}" + ProjectSection(SolutionItems) = preProject + src\Directory.Build.props = src\Directory.Build.props + src\Directory.Build.targets = src\Directory.Build.targets + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -67,6 +79,8 @@ Global GlobalSection(NestedProjects) = preSolution {6E3FEE79-C382-439C-AFD9-5505D414680D} = {7E507A42-984B-470D-8A0C-648B9AF8E1DC} {7BAAD61E-1493-4B51-A458-2A8F2FDD45FE} = {6E3FEE79-C382-439C-AFD9-5505D414680D} + {E8456C26-3E0D-4272-9794-3041D2DC97E8} = {6E3FEE79-C382-439C-AFD9-5505D414680D} + {BCAA4557-7813-4A6E-AFE3-D5745C62E6BB} = {6E3FEE79-C382-439C-AFD9-5505D414680D} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {533C1EB4-B488-47CC-AB26-AD9C1A24E5CF} diff --git a/NHibernate.ObservableCollections.sln b/NHibernate.ObservableCollections.sln index 43ffee5..4c37e35 100644 --- a/NHibernate.ObservableCollections.sln +++ b/NHibernate.ObservableCollections.sln @@ -1,6 +1,7 @@ + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 -VisualStudioVersion = 17.2.32519.379 +VisualStudioVersion = 17.8.34330.188 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7E507A42-984B-470D-8A0C-648B9AF8E1DC}" ProjectSection(SolutionItems) = preProject diff --git a/README.md b/README.md index 11397e7..0ac2e83 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,7 @@ NHibernate.ObservableCollections ## License -Copyright (c) 2022 NHibernate.ObservableCollections Contributors. - -It is free software, and may be redistributed under the terms of the [MIT](https://opensource.org/licenses/MIT) license. +NHibernate.ObservableCollections is © 2007-2024 NHibernate.ObservableCollections Contributors. It is licensed under the terms of the [MIT](https://opensource.org/license/mit/) license. diff --git a/build/AssemblyInfo.Global.cs b/build/AssemblyInfo.Global.cs index 4f16143..f867fa1 100644 --- a/build/AssemblyInfo.Global.cs +++ b/build/AssemblyInfo.Global.cs @@ -2,6 +2,3 @@ [assembly: CLSCompliant(true)] [assembly: ComVisible(false)] - - - diff --git a/build/Build.props b/build/Build.props index b027ac9..713b793 100644 --- a/build/Build.props +++ b/build/Build.props @@ -1,6 +1,6 @@ @@ -9,13 +9,13 @@ --> - net7.0-windows + net8.0-windows - net7.0-windows;net6.0-windows;net48 + net8.0-windows;net48 - net7.0 - net7.0;net6.0;net48 - net7.0;net6.0;net48 + net8.0; + net8.0;net7.0;net6.0;net48 + net8.0;net7.0;net6.0;net48 true latest @@ -34,7 +34,7 @@ false @@ -141,7 +143,7 @@ NHibernate.ObservableCollections @@ -155,20 +157,23 @@ $(BuildVersionMajor).0.0 $(BuildVersionNoSuffix) + $(OutputBaseFolderPath)$(Configuration)\ MIT false https://github.com/mahara/NHibernate.ObservableCollections $(Product) $(BuildVersion) - $(OutputBaseFolderPath)$(Configuration)\ + README.md true false . - + + + @@ -189,9 +194,9 @@ - + - + + - + diff --git a/build/BuildPackages.cmd b/build/BuildPackages.cmd index f606215..4a6fba1 100644 --- a/build/BuildPackages.cmd +++ b/build/BuildPackages.cmd @@ -33,7 +33,7 @@ ECHO ---------------------------------------------------- dotnet build "NHibernate.ObservableCollections.sln" --configuration %BUILD_CONFIGURATION% -property:APPVEYOR_BUILD_VERSION=%BUILD_VERSION% || EXIT /B 1 dotnet build "tools\Explicit.NuGet.Versions\Explicit.NuGet.Versions.sln" --configuration Release -"tools\Explicit.NuGet.Versions\bin\nev.exe" "bin" "NHibernate.ObservableCollections." +"tools\Explicit.NuGet.Versions\bin\nev.exe" "bin" "NHibernate.ObservableCollections" GOTO TEST @@ -45,6 +45,12 @@ REM https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-vstest REM https://github.com/Microsoft/vstest-docs/blob/main/docs/report.md REM https://github.com/spekt/nunit.testlogger/issues/56 +ECHO ------------------------------------ +ECHO Running .NET (net8.0) Unit Tests +ECHO ------------------------------------ + +dotnet test "bin\%BUILD_CONFIGURATION%\net8.0\NHibernate.ObservableCollections.Tests\NHibernate.ObservableCollections.Tests.dll" --results-directory "bin\%BUILD_CONFIGURATION%" --logger "nunit;LogFileName=NHibernate.ObservableCollections_net8.0_TestResults.xml;format=nunit3" + ECHO ------------------------------------ ECHO Running .NET (net7.0) Unit Tests ECHO ------------------------------------ @@ -62,6 +68,3 @@ ECHO Running .NET Framework (net48) Unit Tests ECHO -------------------------------------------- dotnet test "bin\%BUILD_CONFIGURATION%\net48\NHibernate.ObservableCollections.Tests\NHibernate.ObservableCollections.Tests.exe" --results-directory "bin\%BUILD_CONFIGURATION%" --logger "nunit;LogFileName=NHibernate.ObservableCollections_net48_TestResults.xml;format=nunit3" - - - diff --git a/src/NHibernate.ObservableCollections.DemoApp/NHibernate.ObservableCollections.DemoApp.csproj b/src/NHibernate.ObservableCollections.DemoApp/NHibernate.ObservableCollections.DemoApp.csproj index 68a0ab2..7e523ae 100644 --- a/src/NHibernate.ObservableCollections.DemoApp/NHibernate.ObservableCollections.DemoApp.csproj +++ b/src/NHibernate.ObservableCollections.DemoApp/NHibernate.ObservableCollections.DemoApp.csproj @@ -2,7 +2,7 @@ $(WinExeTargetFrameworks) - + true @@ -12,7 +12,7 @@ NHibernate.ObservableCollections.DemoApp @@ -25,12 +25,12 @@ - - - - + + + + - + diff --git a/src/NHibernate.ObservableCollections.Helpers/NHibernate.ObservableCollections.Helpers.csproj b/src/NHibernate.ObservableCollections.Helpers/NHibernate.ObservableCollections.Helpers.csproj index 62790bd..41f1630 100644 --- a/src/NHibernate.ObservableCollections.Helpers/NHibernate.ObservableCollections.Helpers.csproj +++ b/src/NHibernate.ObservableCollections.Helpers/NHibernate.ObservableCollections.Helpers.csproj @@ -8,7 +8,7 @@ NHibernate.ObservableCollections.Helpers @@ -21,10 +21,10 @@ - - + + - + diff --git a/src/NHibernate.ObservableCollections.Helpers/Outlining/RelativePosition.cs b/src/NHibernate.ObservableCollections.Helpers/Outlining/RelativePosition.cs index 808cb71..01d5a04 100644 --- a/src/NHibernate.ObservableCollections.Helpers/Outlining/RelativePosition.cs +++ b/src/NHibernate.ObservableCollections.Helpers/Outlining/RelativePosition.cs @@ -2,7 +2,7 @@ namespace NHibernate.ObservableCollections.Helpers.Outlining { using System.Windows.Input; - public struct RelativePosition + public record struct RelativePosition { /// Desired index when inserting a child. public int ChildIndex; diff --git a/src/NHibernate.ObservableCollections.Tests/NHibernate.ObservableCollections.Tests.csproj b/src/NHibernate.ObservableCollections.Tests/NHibernate.ObservableCollections.Tests.csproj index 4170af9..0984407 100644 --- a/src/NHibernate.ObservableCollections.Tests/NHibernate.ObservableCollections.Tests.csproj +++ b/src/NHibernate.ObservableCollections.Tests/NHibernate.ObservableCollections.Tests.csproj @@ -8,7 +8,7 @@ NHibernate.ObservableCollections.Tests @@ -21,26 +21,25 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - + + + + + - + diff --git a/src/NHibernate.ObservableCollections/DebugView.cs b/src/NHibernate.ObservableCollections/DebugView.cs index 3eb555f..6619b69 100644 --- a/src/NHibernate.ObservableCollections/DebugView.cs +++ b/src/NHibernate.ObservableCollections/DebugView.cs @@ -3,7 +3,7 @@ namespace Iesi.Collections.Generic using System.Diagnostics; /// - /// + /// /// /// /// diff --git a/src/NHibernate.ObservableCollections/NHibernate.ObservableCollections.csproj b/src/NHibernate.ObservableCollections/NHibernate.ObservableCollections.csproj index 4b3addc..1bb4c69 100644 --- a/src/NHibernate.ObservableCollections/NHibernate.ObservableCollections.csproj +++ b/src/NHibernate.ObservableCollections/NHibernate.ObservableCollections.csproj @@ -5,7 +5,7 @@ NHibernate.ObservableCollections @@ -19,10 +19,10 @@ - - + + - + diff --git a/tools/Explicit.NuGet.Versions/Explicit.NuGet.Versions.csproj b/tools/Explicit.NuGet.Versions/Explicit.NuGet.Versions.csproj index d9a877b..80cabc1 100644 --- a/tools/Explicit.NuGet.Versions/Explicit.NuGet.Versions.csproj +++ b/tools/Explicit.NuGet.Versions/Explicit.NuGet.Versions.csproj @@ -1,15 +1,22 @@ + net8.0 + true + + latest + enable + enable + Exe - net7.0 + + nev bin\ false - nev - + diff --git a/tools/Explicit.NuGet.Versions/Explicit.NuGet.Versions.sln b/tools/Explicit.NuGet.Versions/Explicit.NuGet.Versions.sln index 5b6eb1f..b1c7c1a 100644 --- a/tools/Explicit.NuGet.Versions/Explicit.NuGet.Versions.sln +++ b/tools/Explicit.NuGet.Versions/Explicit.NuGet.Versions.sln @@ -1,7 +1,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 -VisualStudioVersion = 17.4.33110.190 +VisualStudioVersion = 17.8.34330.188 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Explicit.NuGet.Versions", "Explicit.NuGet.Versions.csproj", "{9F0F7F9B-4CC0-4D92-B241-0F55B41E9AE5}" EndProject diff --git a/tools/Explicit.NuGet.Versions/Program.cs b/tools/Explicit.NuGet.Versions/Program.cs index e991bcd..98c02fe 100644 --- a/tools/Explicit.NuGet.Versions/Program.cs +++ b/tools/Explicit.NuGet.Versions/Program.cs @@ -1,5 +1,5 @@ #region License -// Copyright 2004-2022 Castle Project - https://www.castleproject.org/ +// Copyright 2004-2024 Castle Project - https://www.castleproject.org/ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -32,22 +32,28 @@ private static void Main(string[] args) var packageDiscoveryDirectory = Path.Combine(Environment.CurrentDirectory, args[0]); var packageDiscoverDirectoryInfo = new DirectoryInfo(packageDiscoveryDirectory); var packageMetaData = ReadNuspecFromPackages(packageDiscoverDirectoryInfo); + UpdateNuspecManifestContent(packageMetaData, args[1]); + WriteNuspecToPackages(packageMetaData); } private static Dictionary ReadNuspecFromPackages(DirectoryInfo packageDiscoverDirectoryInfo) { var packageNuspecDictionary = new Dictionary(); + foreach (var packageFilePath in packageDiscoverDirectoryInfo.GetFiles("*.nupkg", SearchOption.AllDirectories)) { using var zipFile = ZipFile.Read(packageFilePath.FullName); + foreach (var zipEntry in zipFile.Entries) { - if (zipEntry.FileName.ToLowerInvariant().EndsWith(".nuspec")) + if (zipEntry.FileName.EndsWith(".nuspec", StringComparison.OrdinalIgnoreCase)) { using var zipEntryReader = new StreamReader(zipEntry.OpenReader()); + var nuspecXml = zipEntryReader.ReadToEnd(); + packageNuspecDictionary[packageFilePath.FullName] = new NuspecContentEntry { EntryName = zipEntry.FileName, @@ -72,7 +78,11 @@ private static void UpdateNuspecManifestContent(Dictionary { - if (node.Name.ToLowerInvariant() == "dependency" - && !string.IsNullOrEmpty(node.Attributes["id"].Value) - && node.Attributes["id"].Value.StartsWith(nugetIdFilter, StringComparison.InvariantCultureIgnoreCase)) + if (string.Equals(node.Name, "dependency", StringComparison.OrdinalIgnoreCase) && + !string.IsNullOrEmpty(node.Attributes!["id"]!.Value) && + node.Attributes!["id"]!.Value.StartsWith(nugetIdFilter, StringComparison.OrdinalIgnoreCase)) { - var currentVersion = node.Attributes["version"].Value; - if (!node.Attributes["version"].Value.StartsWith("[") && !node.Attributes["version"].Value.EndsWith("]")) + var dependencyVersion = node.Attributes!["version"]!.Value; + if (!(dependencyVersion.StartsWith('[') || + dependencyVersion.EndsWith(']'))) { - node.Attributes["version"].Value = $"[{currentVersion}]"; + node.Attributes!["version"]!.Value = $"[{dependencyVersion}]"; } } }); @@ -105,6 +116,7 @@ private static void WalkDocumentNodes(XmlNodeList nodes, Action callbac foreach (XmlNode node in nodes) { callback(node); + WalkDocumentNodes(node.ChildNodes, callback); } } @@ -114,16 +126,18 @@ private static void WriteNuspecToPackages(Dictionary foreach (var packageFile in packageMetaData.ToList()) { using var zipFile = ZipFile.Read(packageFile.Key); + zipFile.UpdateEntry(packageFile.Value.EntryName, packageFile.Value.Contents); + zipFile.Save(); } } - internal class NuspecContentEntry + internal record NuspecContentEntry { - public string EntryName { get; set; } + public string EntryName { get; set; } = string.Empty; - public string Contents { get; set; } + public string Contents { get; set; } = string.Empty; } }