Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,30 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<Target Name="GenerateVersionInfo" BeforeTargets="CoreCompile">
<PropertyGroup>
<VersionMajor>$(PackageVersion.Split('.')[0])</VersionMajor>
<VersionMinor>$(PackageVersion.Split('.')[1])</VersionMinor>
<VersionPatch>$(PackageVersion.Split('.')[2])</VersionPatch>
<GeneratedVersionFile>$(IntermediateOutputPath)VersionInfo.g.cs</GeneratedVersionFile>
</PropertyGroup>
<WriteLinesToFile File="$(GeneratedVersionFile)" Overwrite="true" Lines="
namespace Amazon.SecretsManager.Extensions.Caching
{
internal static class VersionInfo
{
public const string MAJOR = &quot;$(VersionMajor)&quot;%3B
public const string MINOR = &quot;$(VersionMinor)&quot;%3B
public const string PATCH = &quot;$(VersionPatch)&quot;%3B
public const string USER_AGENT_HEADER = &quot;User-Agent&quot;%3B
public static readonly string RELEASE_VERSION = $&quot;{MAJOR}.{MINOR}.{PATCH}&quot;%3B
public static readonly string USER_AGENT_STRING = $&quot;AwsSecretCache/{RELEASE_VERSION}&quot;%3B
}
}" />
<ItemGroup>
<Compile Include="$(GeneratedVersionFile)" />
<FileWrites Include="$(GeneratedVersionFile)" />
</ItemGroup>
</Target>
</Project>
55 changes: 2 additions & 53 deletions src/Amazon.SecretsManager.Extensions.Caching/VersionInfo.cs
Original file line number Diff line number Diff line change
@@ -1,53 +1,2 @@
/*
* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/

namespace Amazon.SecretsManager.Extensions.Caching
{
internal static class VersionInfo
{
/// <summary>
/// Incremented for design changes that break backward compatibility.
/// </summary>
public const string VERSION_NUM = "1";

/// <summary>
/// Incremented for major changes to the implementation
/// </summary>
public const string MAJOR_REVISION_NUM = "1";

/// <summary>
/// Incremented for minor changes to the implementation
/// </summary>
public const string MINOR_REVISION_NUM = "0";

/// <summary>
/// Incremented for releases containing an immediate bug fix.
/// </summary>
public const string BUGFIX_REVISION_NUM = "0";

/// <summary>
/// The value used as the user agent header name.
/// </summary>
public const string USER_AGENT_HEADER = "User-Agent";

/// <summary>
/// The release version string.
/// </summary>
public static readonly string RELEASE_VERSION = $"{VERSION_NUM}.{MAJOR_REVISION_NUM}.{MINOR_REVISION_NUM}.{BUGFIX_REVISION_NUM}";

/// <summary>
/// The user agent string that will be appended to the SDK user agent string
/// </summary>
public static readonly string USER_AGENT_STRING = $"AwsSecretCache/{RELEASE_VERSION}";
}
}
// This file is auto-generated during build from PackageVersion in the .csproj file.
// Do not edit manually. See GenerateVersionInfo target in Amazon.SecretsManager.Extensions.Caching.csproj
Comment on lines +1 to +2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file VersionInfo.g.cs is being auto-generated so why have the file VersionInfo.cs at all? Shouldn't we delete this?
Also, have we tested this?

Loading