Centralized infrastructure elements for SixLabors projects. (msbuild, linting, shared internals)
Перейти к файлу
James Jackson-South 13749e5602
Merge pull request #46 from SixLabors/dependabot/github_actions/actions/cache-4
Bump actions/cache from 3 to 4
2024-04-17 22:28:24 +10:00
.github Bump actions/cache from 3 to 4 2024-01-22 06:37:29 +00:00
branding@e4597cdbe9
msbuild Update Xunit 2024-01-21 21:53:46 +10:00
src
tests
.editorconfig Add primary constructor rule 2024-01-21 21:53:33 +10:00
.gitattributes Update .gitattributes 2024-04-17 22:22:04 +10:00
.gitignore
.gitmodules
Directory.Build.props
Directory.Build.targets
LICENSE
README.md
SharedInfrastructure.sln
SixLabors.snk
THIRD-PARTY-NOTICES.TXT
ci-build.ps1
ci-test.ps1
codecov.yml
sixlabors.ruleset
sixlabors.tests.ruleset
stylecop.json

README.md

SixLabors.SharedInfrastructure
SixLabors.SharedInfrastructure

Build Status Code coverage License: Six Labors Split

This repository contains:

  • Configuration and guidelines for automated linting of C# projects.
  • Standardized internal C# utility classes to be reused across SixLabors projects (like Guard, DebugGuard)
  • SixLabors.snk to support strong-name signing of SixLabors assemblies
  • Centralized msbuild configuration and utilities for SixLabors projects

It is designed to be installed as a git submodule into Six Labors solutions.

Installation.

This installation guide assumes that your solution conforms to the following structure:

solution.sln
readme.md
.gitignore
+---> src
+      +
+      +---> project
+      +   +
+      +   +---> project.csproj
+      +
+      +---> project
+          +
+          +---> project.csproj
+
+---> tests
       +
       +---> project.tests
       +   +
       +   +---> project.tests.csproj
       +
       +---> project.tests
           +
           +---> project.tests.csproj

If the solution does not conform to this structure you will have to update it to do so.

Adding the Submodule

To add SixLabors.SharedInfrastructure as a submodule of your project. In the project repository type:

git submodule add https://github.com/SixLabors/SharedInfrastructure shared-infrastructure

At this point, youll have a shared-infrastructure folder inside your project, but if you were to peek inside that folder, depending on your version of Git, you might see… nothing.

Newer versions of Git will do this automatically, but older versions will require you to explicitly tell Git to download the contents of shared-infrastructure:

git submodule update --init --recursive

If everything looks good, you can commit this change and youll have a shared-infrastructure folder in your project repository with all the content from the SixLabors.SharedInfrastructure repository.

Updating the Submodule.

Since the submodule is stored in a separate repository you may find at times updates have been made to the linting rules that require you to update your copy. The command below will allow you to do so:

git submodule update --init --recursive
git submodule foreach git pull origin main

Linting Tools

There are three tools contained within the submodule that will help to automatically promote and enforce coding standards and consistency:

These tools are automatically installed into your solution by referencing the .props and .targets files found in the /msbuild folder.

MsBuild

Within the aforementioned folder there are separate .props and .targets files designed for shared, src, and test scenarios. These files control the build process and are responsible for automatically referencing all the required projects for versioning, linting and testing. An example use case and installation can be found at the ImageSharp repository.