Skip to content

Commit

Permalink
Implemented bootstrapper.
Browse files Browse the repository at this point in the history
  • Loading branch information
kekyo committed Oct 11, 2023
1 parent 0dba499 commit 553fe18
Show file tree
Hide file tree
Showing 12 changed files with 107 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Nullable>enable</Nullable>
<TargetFrameworks>net48;net5.0;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net48;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
<NoWarn>$(NoWarn);NU5104</NoWarn>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;netstandard2.0;netstandard2.1;net5.0;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net461;netstandard2.0;netstandard2.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
<NoWarn>$(NoWarn);NU5104</NoWarn>

<AssemblyName>RelaxVersioner.Core</AssemblyName>
Expand All @@ -15,7 +15,7 @@
<PackageReference Include="GitReader" Version="1.4.0" />
<PackageReference Include="NamingFormatter" Version="2.2.0" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="All" />
<PackageReference Include="RelaxVersioner" Version="3.1.0" PrivateAssets="all" />
<PackageReference Condition="'$(RV_BOOTSTRAP)' != 'True'" Include="RelaxVersioner" Version="3.2.0" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
31 changes: 31 additions & 0 deletions CenterCLR.RelaxVersioner.Core/Properties/Bootstrap.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// RelaxVersioner - Git tag/branch based, full-automatic version information inserter.
// Copyright (c) Kouji Matsui (@kozy_kekyo, @[email protected])
//
// Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0
//
////////////////////////////////////////////////////////////////////////////////////////

#if BOOTSTRAP
using System.Reflection;

[assembly: AssemblyVersion("0.0.1")]
[assembly: AssemblyFileVersion("2023.10.1.0")]
[assembly: AssemblyInformationalVersion("0.0.1-bootstrap")]

namespace RelaxVersioner
{
internal static class ThisAssembly
{
public const string @AssemblyVersion = @"0.0.1";
public const string @AssemblyFileVersion = @"2023.10.1.0";
public const string @AssemblyInformationalVersion = @"0.0.1-bootstrap";
public static class AssemblyMetadata
{
public const string @CommitId = @"bootstrap";
public const string @TargetFrameworkMoniker = @"bootstrap";
}
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="All" />
<PackageReference Include="RelaxVersioner" Version="3.1.0" PrivateAssets="all" />
<PackageReference Condition="'$(RV_BOOTSTRAP)' != 'True'" Include="RelaxVersioner" Version="3.2.0" PrivateAssets="all" />
</ItemGroup>

</Project>
3 changes: 2 additions & 1 deletion CenterCLR.RelaxVersioner.sln
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C3592BB3-F62F-499E-B1E8-2B497161C389}"
ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
build-nupkg-bootstrap.bat = build-nupkg-bootstrap.bat
build-nupkg.bat = build-nupkg.bat
.github\workflows\build.yml = .github\workflows\build.yml
Images\CenterCLR.RelaxVersioner.100.png = Images\CenterCLR.RelaxVersioner.100.png
Expand Down Expand Up @@ -53,7 +54,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSharpNewTestProject", "Pla
{F8E532DE-24B0-49BA-A667-6447CA4BAA89} = {F8E532DE-24B0-49BA-A667-6447CA4BAA89}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CenterCLR.RelaxVersioner.Core.Tests", "CenterCLR.RelaxVersioner.Core.Tests\CenterCLR.RelaxVersioner.Core.Tests.csproj", "{05E2B482-70C7-4A36-B90B-BC87BE0E1ADF}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CenterCLR.RelaxVersioner.Core.Tests", "CenterCLR.RelaxVersioner.Core.Tests\CenterCLR.RelaxVersioner.Core.Tests.csproj", "{05E2B482-70C7-4A36-B90B-BC87BE0E1ADF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
8 changes: 6 additions & 2 deletions CenterCLR.RelaxVersioner/CenterCLR.RelaxVersioner.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;netcoreapp2.2;netcoreapp3.1;net5.0;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp2.2;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<Nullable>enable</Nullable>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
Expand All @@ -20,6 +20,10 @@
<IncludeBuildOutput>false</IncludeBuildOutput>
</PropertyGroup>

<PropertyGroup Condition="'$(RV_BOOTSTRAP)' == 'True'">
<NuspecProperties>$(NuspecProperties);Configuration=$(Configuration);PackageVersion=$(PackageVersion)</NuspecProperties>
</PropertyGroup>

<ItemGroup>
<Content Include="buildMultiTargeting\*.*" />
<Content Include="build\*.*" />
Expand All @@ -28,7 +32,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="All" />
<PackageReference Include="Mono.Options" Version="6.12.0.148" />
<PackageReference Include="RelaxVersioner" Version="3.1.0" PrivateAssets="all" />
<PackageReference Condition="'$(RV_BOOTSTRAP)' != 'True'" Include="RelaxVersioner" Version="3.2.0" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
31 changes: 31 additions & 0 deletions CenterCLR.RelaxVersioner/Properties/Bootstrap.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// RelaxVersioner - Git tag/branch based, full-automatic version information inserter.
// Copyright (c) Kouji Matsui (@kozy_kekyo, @[email protected])
//
// Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0
//
////////////////////////////////////////////////////////////////////////////////////////

#if BOOTSTRAP
using System.Reflection;

[assembly: AssemblyVersion("0.0.1")]
[assembly: AssemblyFileVersion("2023.10.1.0")]
[assembly: AssemblyInformationalVersion("0.0.1-bootstrap")]

namespace RelaxVersioner
{
internal static class ThisAssembly
{
public const string @AssemblyVersion = @"0.0.1";
public const string @AssemblyFileVersion = @"2023.10.1.0";
public const string @AssemblyInformationalVersion = @"0.0.1-bootstrap";
public static class AssemblyMetadata
{
public const string @CommitId = @"bootstrap";
public const string @TargetFrameworkMoniker = @"bootstrap";
}
}
}
#endif
1 change: 1 addition & 0 deletions CenterCLR.RelaxVersioner/RelaxVersioner.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@
<file src="bin\$Configuration$\net5.0\**\*.*" target="tools/net5.0" />
<file src="bin\$Configuration$\net6.0\**\*.*" target="tools/net6.0" />
<file src="bin\$Configuration$\net7.0\**\*.*" target="tools/net7.0" />
<file src="bin\$Configuration$\net8.0\**\*.*" target="tools/net8.0" />
</files>
</package>
10 changes: 8 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/kekyo/CenterCLR.RelaxVersioner.git</RepositoryUrl>

<RootNamespace>RelaxVersioner</RootNamespace>
<Product>RelaxVersioner</Product>
<Trademark>RelaxVersioner</Trademark>
Expand All @@ -22,7 +22,7 @@
<Authors>Kouji Matsui (@kozy_kekyo, @[email protected])</Authors>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<AllowedOutputExtensionsInPackageBuildOutputFolder>.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<NoWarn>$(NoWarn);NU1605;NU1701;NU1803</NoWarn>
<NoWarn>$(NoWarn);NU1605;NU1701;NU1803;NU1902;NU1903;NETSDK1057;NETSDK1209</NoWarn>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand All @@ -40,6 +40,12 @@
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>

<PropertyGroup Condition="'$(BOOTSTRAP)' == 'True'">
<DefineConstants>$(DefineConstants);BOOTSTRAP</DefineConstants>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<RV_BOOTSTRAP>True</RV_BOOTSTRAP>
</PropertyGroup>

<ItemGroup Condition="'$(Configuration)' == 'Release'">
<SourceRoot Include="$(MSBuildThisFileDirectory)/"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<!--<TargetFrameworks>net48;net6.0;net7.0</TargetFrameworks>-->
<!--<TargetFrameworks>net48;net6.0;net7.0;net8.0</TargetFrameworks>-->
<TargetFrameworks>net48</TargetFrameworks>
<PlatformTarget>x86</PlatformTarget>

Expand Down
2 changes: 1 addition & 1 deletion PlayGround/CSharpNewTestProject/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//[assembly: AssemblyCompany("")]
//[assembly: AssemblyProduct("CSharpTestProject")]
//[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
//[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

[assembly: ComVisible(false)]
Expand Down
22 changes: 22 additions & 0 deletions build-nupkg-bootstrap.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@echo off

rem RelaxVersioner - Git tag/branch based, full-automatic version information inserter.
rem Copyright (c) Kouji Matsui (@kozy_kekyo, @[email protected])
rem
rem Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0

rem This script is used by the RelaxVersioner to get over when .NET releases a new major version.
rem For example .NET 8.0 release, the RelaxVersioner that uses itself will fail to build
rem because it must support the `net8.0` TFM, which was not included in earlier versions.
rem This script will generate a RelaxVersioner with a temporary version embedded
rem and a private package so that it can build itself with the new .NET version.

rem `PackageVersion` should be set appropriately.

echo.
echo "==========================================================="
echo "Build RelaxVersioner (Bootstrap)"
echo.

dotnet build -p:Configuration=Release -p:Platform="Any CPU" -p:BOOTSTRAP=True -p:PackageVersion=3.2.10 CenterCLR.RelaxVersioner.sln
dotnet pack -p:Configuration=Release -p:Platform="Any CPU" -p:BOOTSTRAP=True -p:PackageVersion=3.2.10 -o artifacts CenterCLR.RelaxVersioner.sln

0 comments on commit 553fe18

Please sign in to comment.