Skip to content

Commit

Permalink
chore: code cleanup, project update, include readme, etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaszmalik committed Dec 7, 2023
1 parent 7841a4f commit acd3f5b
Show file tree
Hide file tree
Showing 18 changed files with 1,389 additions and 1,195 deletions.
48 changes: 48 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# top-most EditorConfig file
root = true

# charset
[*]
charset = utf-8

# lines
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = off

# tabs
[*]
indent_style = space
indent_size = 4
tab_width = 4

[*.{csproj,props,resx,targets}]
indent_style = space
indent_size = 2
tab_width = 2

# rules
# CA2225: Operator overloads have named alternates
dotnet_diagnostic.CA2225.severity = none
# CA1716: Identifiers should not match keywords
dotnet_diagnostic.CA1716.severity = none
# CA1054: URI-like parameters should not be strings
dotnet_diagnostic.CA1054.severity = none
# CA1056: URI-like properties should not be strings
dotnet_diagnostic.CA1056.severity = none
# CA1062: Validate arguments of public methods
dotnet_diagnostic.CA1062.severity = none
# CA1033: Interface methods should be callable by child types
dotnet_diagnostic.CA1033.severity = none
# CA1034: Nested types should not be visible
dotnet_diagnostic.CA1034.severity = none
# CA1308: Normalize strings to uppercase
dotnet_diagnostic.CA1308.severity = none
# CA1805: Do not initialize unnecessarily
dotnet_diagnostic.CA1805.severity = none
# CA1031: Do not catch general exception types
dotnet_diagnostic.CA1031.severity = none
# CA1714: Flags enums should have plural names
dotnet_diagnostic.CA1714.severity = none
24 changes: 21 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<Project>
<Project>

<!-- Company/Copyright -->
<PropertyGroup>
<Company>Tag Bites sp. z o.o.</Company>
<Authors>Tag Bites sp. z o.o.</Authors>
<Copyright>Tag Bites sp. z o.o. © 2012-2021</Copyright>
<CopyrightSinceYear>2012</CopyrightSinceYear>

<Copyright>© $(CopyrightSinceYear)-$([System.DateTime]::Today.ToString(`yyyy`)) $(Company)</Copyright>
</PropertyGroup>

<!-- Bin/Obj directories -->
Expand All @@ -21,6 +23,11 @@
<Deterministic>true</Deterministic>
</PropertyGroup>

<!-- Documentation -->
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<!-- Warnings -->
<PropertyGroup>
<NoWarn>1701;1702;1591;NU5048;NU5125</NoWarn>
Expand All @@ -36,9 +43,20 @@
<DefaultItemExcludes>$(DefaultItemExcludes);*.csproj.DotSettings</DefaultItemExcludes>
</PropertyGroup>

<!-- Usings -->
<ItemGroup>
<Using Include="System" />
<Using Include="System.Collections" />
<Using Include="System.Collections.Generic" />
<Using Include="System.IO" />
<Using Include="System.Linq" />
<Using Include="System.Threading" />
<Using Include="System.Threading.Tasks" />
<Using Include="JetBrains.Annotations" />
</ItemGroup>

<!-- Includes -->
<Import Condition="exists('Version.props')" Project="Version.props" />
<Import Condition="exists('Licensing.props')" Project="Licensing.props" />
<Import Condition="exists('Package.props')" Project="Package.props" />

</Project>
19 changes: 8 additions & 11 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
<Project>

<ItemGroup>
<PackageReference Include="GitInfo" Version="2.1.2">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="MinVer" Version="2.5.0">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>

<!-- Copy package to local packages repository -->
<Target Name="CopyPackage" AfterTargets="Pack" Condition="exists('$(SolutionDir)..\LocalPackages\')">
<Message Text="Copy '$(PackageOutputPath)$(PackageId).$(PackageVersion).nupkg' to '$(SolutionDir)..\LocalPackages\'" Importance="high"/>
<Copy
<Target Name="CopyPackage" AfterTargets="Pack" Condition="exists('$(MSBuildThisFileDirectory)..\LocalPackages\')">
<Message Text="Copy '$(PackageOutputPath)$(PackageId).$(PackageVersion).nupkg' to '$(MSBuildThisFileDirectory)..\LocalPackages\'" Importance="high"/>
<Copy
SourceFiles="$(PackageOutputPath)$(PackageId).$(PackageVersion).nupkg"
DestinationFolder="$(SolutionDir)..\LocalPackages\"
ContinueOnError="false" />
<Message Text="Delete local package folder 'C:\Users\User\.nuget\packages\$(PackageId)\$(PackageVersion)'" Importance="high"/>
<RemoveDir Directories="C:\Users\User\.nuget\packages\$(PackageId)\$(PackageVersion)" />
DestinationFolder="$(MSBuildThisFileDirectory)..\LocalPackages\"
ContinueOnError="false" />

<Message Text="Delete local package folder 'C:\Users\$([System.Environment]::UserName)\.nuget\packages\$(PackageId)\$(PackageVersion)'" Importance="high"/>
<RemoveDir Directories="C:\Users\$([System.Environment]::UserName)\.nuget\packages\$(PackageId)\$(PackageVersion)" />
</Target>

</Project>
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Tag Bites

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
11 changes: 8 additions & 3 deletions Package.props
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
<Project>
<PropertyGroup>
<Description>Container and manager to simplify exports lookup.</Description>
<PackageTags></PackageTags>
<Description>A .NET export container and manager designed to simplify access to exported types. Well suited for plugin integration.</Description>
<PackageTags>.NET; export; container; MEF</PackageTags>

<PackageProjectUrl>https://www.tagbites.com/</PackageProjectUrl>
<PackageProjectUrl>https://github.com/TagBites/TagBites.ComponentModel.Composition</PackageProjectUrl>
<PackageIconUrl></PackageIconUrl>

<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageLicenseExpression>MIT</PackageLicenseExpression>

<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/TagBites/TagBites.ComponentModel.Composition.git</RepositoryUrl>

<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>
</Project>
43 changes: 42 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
# TBS.ComponentModel.Composition

Contains export container and manager to simplify exports lookup. It also supports cache to speedup app startup without need to load and analyse all assemblies.
[![Nuget](https://img.shields.io/nuget/v/TagBites.ComponentModel.Composition.svg)](https://www.nuget.org/packages/TagBites.ComponentModel.Composition/)
[![License](http://img.shields.io/github/license/TagBites/TagBites.ComponentModel.Composition)](https://github.com/TagBites/TagBites.ComponentModel.Composition/blob/master/LICENSE)

A .NET export container and manager designed to simplify access to exported types. Well suited for plugin integration. Supports caching to speed up application startup, eliminating the necessity to load and analyze all assemblies.

## Example

```csharp
internal static class Program
{
public static ExportComponentManager ComponentManager { get; set; }


static void Main()
{
// Load
ComponentManager = new ExportComponentManager();

foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
ComponentManager.LoadAssembly(assembly);

// Test
foreach (var testInstance in ComponentManager.GetExportInstances<ITest>())
Console.WriteLine(testInstance.GetType().Name);

// Output:
// Test1
// Test2
}
}

public interface ITest
{ }

[Export(typeof(ITest))]
internal class Test1 : ITest
{ }

[Export(typeof(ITest))]
internal class Test2 : ITest
{ }
```
5 changes: 2 additions & 3 deletions TagBites.ComponentModel.Composition.sln
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29326.143
# Visual Studio Version 17
VisualStudioVersion = 17.8.34309.116
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TagBites.ComponentModel.Composition", "src\TagBites.ComponentModel.Composition\TagBites.ComponentModel.Composition.csproj", "{A7C9CFB8-03D0-45B4-9091-AA3AC35C6DFE}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2DDA76A3-970A-4E85-812E-B88BAF37418E}"
ProjectSection(SolutionItems) = preProject
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
Licensing.props = Licensing.props
Package.props = Package.props
README.md = README.md
Version.props = Version.props
Expand Down
3 changes: 0 additions & 3 deletions src/Directory.Build.props

This file was deleted.

Loading

0 comments on commit acd3f5b

Please sign in to comment.