Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt SL v2 via ThisAssembly.Constants and document in readme(s) #370

Merged
merged 2 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .netconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
url = https://github.com/devlooped/oss/blob/main/src/icon.png
skip

[file "SponsorLink.sln"]
url = https://github.com/devlooped/oss/blob/main/SponsorLink.sln
skip

# the configuration needs repo-specific links to Discussions
[file ".github/ISSUE_TEMPLATE/config.yml"]
url = https://github.com/devlooped/oss/blob/main/.github/ISSUE_TEMPLATE/config.yml
Expand Down
13 changes: 7 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ Git Info from MSBuild, C# and VB
[![License](https://img.shields.io/:license-MIT-blue.svg)](https://opensource.org/licenses/mit-license.php)
[![Build status](https://ci.appveyor.com/api/projects/status/p9e5xdd86vnfe0q8?svg=true)](https://ci.appveyor.com/project/MobileEssentials/gitinfo)

## Usage

After installing via [NuGet](https://www.nuget.org/packages/GitInfo):
Install via [NuGet](https://www.nuget.org/packages/GitInfo):

```pwsh
PM> Install-Package GitInfo
```

<!-- include https://github.com/devlooped/.github/raw/main/sponsorlinkr.md -->

## Usage
<!-- #content -->
By default, if the containing project is a C#, F# or VB project, a compile-time generated
source file will contain all the git information and can be accessed from anywhere within
the assembly, as constants in a `ThisAssembly` (partial) class and its nested `Git` static class:
Expand Down Expand Up @@ -105,8 +107,7 @@ VB:
> the relevant properties to false: `GenerateAssemblyVersionAttribute`,
> `GenerateAssemblyFileVersionAttribute` and `GenerateAssemblyInformationalVersionAttribute`.


MSBuild:
You can also just build your own versioning logic in a target that depends on GitInfo using plain MSBuild:

```xml
<PropertyGroup>
Expand Down Expand Up @@ -255,7 +256,7 @@ to customize the behavior:
included in the [NuGet package](https://www.nuget.org/packages/GitInfo)
- 100% incremental build-friendly and high-performing (all proper Inputs/Outputs in place, smart caching of Git info, etc.)


<!-- #content -->
<!-- include https://github.com/devlooped/sponsors/raw/main/footer.md -->
# Sponsors

Expand Down
24 changes: 0 additions & 24 deletions src/Analyzer/CodeAnalysis.csproj

This file was deleted.

55 changes: 0 additions & 55 deletions src/Analyzer/GitInfoGenerator.cs

This file was deleted.

20 changes: 0 additions & 20 deletions src/Analyzer/SponsorLinker.cs

This file was deleted.

9 changes: 9 additions & 0 deletions src/Directory.targets
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<Project InitialTargets="SetLocalVersion">

<PropertyGroup>
<Description>
$(Description)

> This project uses SponsorLink to attribute sponsor status (direct, indirect or implicit). For IDE usage, sponsor status is required.
> IDE-only warnings will be emitted after a grace period otherwise. Learn more at https://github.com/devlooped#sponsorlink.
</Description>
</PropertyGroup>

<Target Name="SetLocalVersion" Condition="!$(CI)">
<GetVersion>
<Output TaskParameter="Version" PropertyName="Version" />
Expand Down
3 changes: 1 addition & 2 deletions src/GitInfo/GitInfo.msbuildproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@
<ItemGroup>
<PackageReference Include="NuGetizer" Version="1.2.3" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="all" />
<PackageReference Include="ThisAssembly.Constants" Version="2.0.5" Pack="true" TargetFramework="netstandard2.0" />
<PackageReference Include="ThisAssembly.Constants" Version="2.0.6" Pack="true" TargetFramework="netstandard2.0" />
</ItemGroup>
<ItemGroup>
<None Include="build/**/*.*" />
<None Include="buildMultiTargeting/**/*.*" />
<None Include="buildTransitive/**/*.*" />
<None Include="..\..\readme.md" PackagePath="readme.md" />
</ItemGroup>
</Project>
5 changes: 5 additions & 0 deletions src/GitInfo/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!-- include https://github.com/devlooped/.github/raw/main/sponsorlinkr.md -->
<!-- include ../../readme.md#content -->
<!-- include https://github.com/devlooped/sponsors/raw/main/footer.md -->
<!-- prevent expansion via CI markdown includes -->
<!-- exclude -->