Skip to content

Commit

Permalink
LAMBJ-152 Package Version Attribute (#554)
Browse files Browse the repository at this point in the history
Adds a package version attribute to assemblies called LambdajectionVersion
  • Loading branch information
talenfisher committed Aug 18, 2022
1 parent 92d6a33 commit 105fe3e
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/releases/v0.10.0-beta2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Enhancements

- Adds an attribute to each Lambdajection assembly called `LambdajectionVersion` which can be used to retrieve the NuGet Package Version of Lambdajection being used.
10 changes: 10 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,14 @@
<ItemGroup>
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" Visible="false" />
</ItemGroup>
<ItemGroup>
<AdditionalThisAssemblyFields Include="NuGetPackageVersion" String="$(NuGetPackageVersion)" />
</ItemGroup>
<Target Name="AddNuGetPackageVersionToThisAssembly" DependsOnTargets="GetBuildVersion" BeforeTargets="GenerateAssemblyNBGVVersionInfo" Condition="'$(SkipAddNuGetPackageVersionToThisAssembly)' != 'true'">
<ItemGroup>
<AssemblyAttribute Include="Lambdajection.Framework.LambdajectionVersion">
<_Parameter1>$(NuGetPackageVersion)</_Parameter1>
</AssemblyAttribute>
</ItemGroup>
</Target>
</Project>
2 changes: 1 addition & 1 deletion src/Encryption/Encryption.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
<ItemGroup>
<None Include="build/**" Pack="true" PackagePath="build/" />
</ItemGroup>
</Project>
</Project>
25 changes: 25 additions & 0 deletions src/Framework/LambdajectionVersionAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;

namespace Lambdajection.Framework
{
/// <summary>
/// Attribute for annotating assemblies with the lambdajection package version.
/// </summary>
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false, Inherited = false)]
public class LambdajectionVersionAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="LambdajectionVersionAttribute" /> class.
/// </summary>
/// <param name="version">Version of the lambdajection package.</param>
public LambdajectionVersionAttribute(string version)
{
Version = version;
}

/// <summary>
/// Gets the version of the Lambdajection package.
/// </summary>
public string Version { get; }
}
}
1 change: 1 addition & 0 deletions src/Generator/Generator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<NoWarn>NU5118;CS8618;NU5128;CS1591;CA1062</NoWarn>
<BuildOutputTargetFolder>analyzers/dotnet/cs</BuildOutputTargetFolder>
<DevelopmentDependency>true</DevelopmentDependency>
<SkipAddNuGetPackageVersionToThisAssembly>true</SkipAddNuGetPackageVersionToThisAssembly>
<PackageDescription>Includes the compile-time generator used to generate code needed for Dependency Injection-enabled AWS Lambdas.</PackageDescription>
<BeforePack>IncludeExtraPackItems</BeforePack>
</PropertyGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Runtime/Runtime.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<PackageId>Lambdajection.Runtime</PackageId>
<AssemblyName>$(PackageId)</AssemblyName>
<NoWarn>NU5128</NoWarn>
<SkipAddNuGetPackageVersionToThisAssembly>true</SkipAddNuGetPackageVersionToThisAssembly>
<PackageDescription>Sets Lambdajection projects up to support custom runtimes.</PackageDescription>
</PropertyGroup>

Expand Down
1 change: 1 addition & 0 deletions src/Templates/Templates.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<IncludeContentInPack>true</IncludeContentInPack>
<PackageDescription>Includes templates for creating Lambdajection projects and components.</PackageDescription>
<BeforePack>CopyTemplates;PrepareTemplates</BeforePack>
<SkipAddNuGetPackageVersionToThisAssembly>true</SkipAddNuGetPackageVersionToThisAssembly>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Tracing/Tracing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<AssemblyName>$(PackageId)</AssemblyName>
<NoWarn>NU5128</NoWarn>
<IncludeBuildOutput>false</IncludeBuildOutput>
<SkipAddNuGetPackageVersionToThisAssembly>true</SkipAddNuGetPackageVersionToThisAssembly>
<PackageDescription>Adds X-Ray Tracing Support to Lambdajection.</PackageDescription>
</PropertyGroup>

Expand Down

0 comments on commit 105fe3e

Please sign in to comment.