adjust defaultBenchmarkDotNetVersion on build (#1879)
* adjust defaultBenchmarkDotNetVersion on build * fix https://github.com/dotnet/BenchmarkDotNet/pull/1879#discussion_r1250960415 * fix https://github.com/dotnet/BenchmarkDotNet/pull/1879#discussion_r1250961663 * fix https://github.com/dotnet/BenchmarkDotNet/pull/1879#discussion_r1250963754 * add install-from-source.sh (for macOS for example) * fix copy paste
This commit is contained in:
Родитель
609e484edd
Коммит
c4debeabe8
|
@ -62,4 +62,28 @@
|
|||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<UsingTask TaskName="ReplaceFileText"
|
||||
TaskFactory="RoslynCodeTaskFactory"
|
||||
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
|
||||
<ParameterGroup>
|
||||
<InputFilename ParameterType="System.String" Required="true" />
|
||||
<OutputFilename ParameterType="System.String" Required="true" />
|
||||
<MatchExpression ParameterType="System.String" Required="true" />
|
||||
<ReplacementText ParameterType="System.String" Required="true" />
|
||||
</ParameterGroup>
|
||||
<Task>
|
||||
<Using Namespace="System" />
|
||||
<Using Namespace="System.IO" />
|
||||
<Using Namespace="System.Text.RegularExpressions" />
|
||||
<Code Type="Fragment" Language="cs">
|
||||
<![CDATA[
|
||||
File.WriteAllText(
|
||||
OutputFilename,
|
||||
Regex.Replace(File.ReadAllText(InputFilename), MatchExpression, ReplacementText)
|
||||
);
|
||||
]]>
|
||||
</Code>
|
||||
</Task>
|
||||
</UsingTask>
|
||||
</Project>
|
||||
|
|
|
@ -24,4 +24,25 @@
|
|||
<Compile Remove="**\*" />
|
||||
<None Remove="*.bat;.sh" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="Fix BenchmarkDotNetVersion"
|
||||
BeforeTargets="Build">
|
||||
<ReplaceFileText
|
||||
InputFilename="templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/.template.config/template.json"
|
||||
OutputFilename="templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/.template.config/template.json"
|
||||
MatchExpression='("defaultValue": )"([\d+\.?]+)"'
|
||||
ReplacementText='${1}"$(VersionPrefix)"' />
|
||||
|
||||
<ReplaceFileText
|
||||
InputFilename="templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/.template.config/template.json"
|
||||
OutputFilename="templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/.template.config/template.json"
|
||||
MatchExpression='("defaultValue": )"([\d+\.?]+)"'
|
||||
ReplacementText='${1}"$(VersionPrefix)"' />
|
||||
|
||||
<ReplaceFileText
|
||||
InputFilename="templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/.template.config/template.json"
|
||||
OutputFilename="templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/.template.config/template.json"
|
||||
MatchExpression='("defaultValue": )"([\d+\.?]+)"'
|
||||
ReplacementText='${1}"$(VersionPrefix)"' />
|
||||
</Target>
|
||||
</Project>
|
|
@ -0,0 +1,13 @@
|
|||
# Run only from the folder where the shell script is located!
|
||||
|
||||
dotnet build BenchmarkDotNet.Templates.csproj -c Release
|
||||
dotnet pack BenchmarkDotNet.Templates.csproj -c Release
|
||||
|
||||
# If we install the templates via a folder path, then it will have a different ID (ID=folder path).
|
||||
# It will conflict with BDN templates from nuget.
|
||||
# We need to install the templates via a FILE path in order to update the template from nuget.
|
||||
|
||||
nupkg_path=$(find . -name "BenchmarkDotNet.Templates*.nupkg")
|
||||
|
||||
dotnet new uninstall "BenchmarkDotNet.Templates"
|
||||
dotnet new install $nupkg_path
|
Загрузка…
Ссылка в новой задаче