This commit is contained in:
Andrey Akinshin 2017-03-04 12:32:11 +05:00
Родитель f85ffe73ec
Коммит 101a801607
8 изменённых файлов: 95 добавлений и 26 удалений

1
.gitignore поставляемый
Просмотреть файл

@ -43,5 +43,6 @@ docs/apihtml
**/project.lock.json
tests/output/*
.vs/restore.dg
artifacts/*
BDN.Generated
BenchmarkDotNet.Samples/Properties/launchSettings.json

15
build/build-and-pack.cmd Normal file
Просмотреть файл

@ -0,0 +1,15 @@
:: this script should be executed from the root dir
git clean -xfd
dotnet restore
dotnet build .\src\BenchmarkDotNet.Core\BenchmarkDotNet.Core.csproj -c Release
dotnet build .\src\BenchmarkDotNet.Toolchains.Roslyn\BenchmarkDotNet.Toolchains.Roslyn.csproj -c Release
dotnet build .\src\BenchmarkDotNet\BenchmarkDotNet.csproj -c Release
dotnet build .\src\BenchmarkDotNet.Diagnostics.Windows\BenchmarkDotNet.Diagnostics.Windows.csproj -c Release
dotnet pack .\src\BenchmarkDotNet.Core\BenchmarkDotNet.Core.csproj -c Release
dotnet pack .\src\BenchmarkDotNet.Toolchains.Roslyn\BenchmarkDotNet.Toolchains.Roslyn.csproj -c Release
dotnet pack .\src\BenchmarkDotNet\BenchmarkDotNet.csproj -c Release
dotnet pack .\src\BenchmarkDotNet.Diagnostics.Windows\BenchmarkDotNet.Diagnostics.Windows.csproj -c Release
rmdir artifacts /s /q
mkdir artifacts
for /R %%x in (BenchmarkDotNet*.nupkg) do copy "%%x" "artifacts/" /Y

Просмотреть файл

@ -31,17 +31,27 @@
</PropertyGroup>
<PropertyGroup>
<BuildNumber Condition=" '$(APPVEYOR_BUILD_NUMBER)' != '' ">$(APPVEYOR_BUILD_NUMBER)</BuildNumber>
<BuildNumber Condition=" '$(BUILD_NUMBER)' != '' ">$(BUILD_NUMBER)</BuildNumber>
<BuildNumber Condition=" '$(BuildNumber)' == '' ">0</BuildNumber>
<Major>0</Major>
<Minor>10</Minor>
<Revision>3</Revision>
<BuildNumber Condition=" '$(APPVEYOR_BUILD_NUMBER)' != '' ">$(APPVEYOR_BUILD_NUMBER)</BuildNumber>
<BuildNumber Condition=" '$(BUILD_NUMBER)' != '' ">$(BUILD_NUMBER)</BuildNumber>
<BuildNumber Condition=" '$(BuildNumber)' == '' ">0</BuildNumber>
<PrereleaseLabel Condition=" '$(APPVEYOR_BUILD_NUMBER)' != '' ">-nightly</PrereleaseLabel>
<PrereleaseLabel Condition=" '$(PrereleaseLabel)' == '' ">-develop</PrereleaseLabel>
<!-- <PrereleaseLabel></PrereleaseLabel> --> <!-- For release versions only -->
<PrereleaseLabelConstants></PrereleaseLabelConstants>
<PrereleaseLabelConstants Condition=" '$(PrereleaseLabel)' == '-nightly' ">PRERELEASE_NIGHTLY</PrereleaseLabelConstants>
<PrereleaseLabelConstants Condition=" '$(PrereleaseLabel)' == '-develop' ">PRERELEASE_DEVELOP</PrereleaseLabelConstants>
<DefineConstants>$(DefineConstants);$(PrereleaseLabelConstants)</DefineConstants>
<AssemblyVersion>$(Major).$(Minor).$(Revision).$(BuildNumber)</AssemblyVersion>
<AssemblyFileVersion>$(Major).$(Minor).$(Revision).$(BuildNumber)</AssemblyFileVersion>
<AssemblyInformationalVersion>$(Major).$(Minor).$(Revision).$(BuildNumber)</AssemblyInformationalVersion>
<PackageVersion>$(Major).$(Minor).$(Revision).$(BuildNumber)</PackageVersion>
<AssemblyInformationalVersion>$(Major).$(Minor).$(Revision).$(BuildNumber)$(PrereleaseLabel)</AssemblyInformationalVersion>
<PackageVersion>$(Major).$(Minor).$(Revision).$(BuildNumber)$(PrereleaseLabel)</PackageVersion>
</PropertyGroup>
</Project>

Просмотреть файл

@ -9,12 +9,4 @@ We have full F# support, all you have to do is to run `dotnet restore` to downlo
## How can I help?
[Here is a list of up-for-grabs issues](https://github.com/dotnet/BenchmarkDotNet/issues?q=is%3Aissue+is%3Aopen+label%3Aup-for-grabs)
## Nightly NuGet feed
If you want to check the develop version of the BenchmarkDotNet NuGet package, add the following line in the `<packageSources>` section of your `NuGet.config`:
```xml
<add key="appveyor-bdn" value="https://ci.appveyor.com/nuget/benchmarkdotnet" />
```
Now you can install the package from the `appveyor-bdn` feed.
[Here is a list of up-for-grabs issues](https://github.com/dotnet/BenchmarkDotNet/issues?q=is%3Aissue+is%3Aopen+label%3Aup-for-grabs)

Просмотреть файл

@ -1,16 +1,47 @@
# NuGet Packages
# NuGet
## Packages
We have the following set of NuGet packages (you can install it directly from `nuget.org`):
* `BenchmarkDotNet.Core`: basic BenchmarkDotNet infrastructure and logic. Doesn't have any dependencies.
* `BenchmarkDotNet.Toolchains.Roslyn`: a package that includes `RoslynToolchain` which adds an ability to build your benchmarks with the Roslyn compiler. Denends on a set of additional NuGet packages.
* `BenchmarkDotNet.Toolchains.Roslyn`: a package that includes `RoslynToolchain` which adds an ability to build your benchmarks with the Roslyn compiler. Depends on a set of additional NuGet packages.
* `BenchmarkDotNet`: an ultimate package that depends on `BenchmarkDotNet.Core` and `BenchmarkDotNet.Toolchains.Roslyn`: provides the `BenchmarkRunner`. In 99% of situations, you should start with this package.
* `BenchmarkDotNet.Diagnostics.Windows`: an additional optional package that provides a set of Windows diagnosers.
## Nightly NuGet feed
## Versioning system and feeds
We have 3 kinds of versions: *stable*, *nightly*, and *develop*.
You can get the current version from the source code via `BenchmarkDotNetInfo.FullVersion` and the full title via `BenchmarkDotNetInfo.FullTitle`.
### Stable
These versions are available from the official NuGet feed.
If you want to check the develop version of the BenchmarkDotNet NuGet packages, add the following line in the `<packageSources>` section of your `NuGet.config`:
```xml
<add key="appveyor-bdn" value="https://ci.appveyor.com/nuget/benchmarkdotnet" />
<packageSources>
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
```
Now you can install the packages from the `appveyor-bdn` feed.
* Example of the main NuGet package: `BenchmarkDotNet.0.10.3.nupkg`.
* Example of `BenchmarkDotNetInfo.FullTitle`: `BenchmarkDotNet v0.10.3`.
### Nightly
If you want to check a nightly prerelease version of the BenchmarkDotNet, add the `https://ci.appveyor.com/nuget/benchmarkdotnet` feed in the `<packageSources>` section of your `NuGet.config`:
```xml
<packageSources>
<add key="bdn-nightly" value="https://ci.appveyor.com/nuget/benchmarkdotnet" />
</packageSources>
```
Now you can install the packages from the `bdn-nightly` feed (don't forget to enable the "Include prerelease" checkbox).
* Example of the main NuGet package: `BenchmarkDotNet.0.10.3.13-nightly.nupkg`.
* Example of `BenchmarkDotNetInfo.FullTitle`: `BenchmarkDotNet v0.10.3.13-nightly`.
### Develop
You also can build BenchmarkDotNet from source code.
The `.nupkg` files could be build with the help of `.\build\build-and-pack.cmd`.
* Example of the main NuGet package: `BenchmarkDotNet.0.10.3-develop.nupkg`.
* Example of `BenchmarkDotNetInfo.FullTitle`: `BenchmarkDotNet v0.10.3.20170304-develop`.

Просмотреть файл

@ -88,6 +88,6 @@ namespace BenchmarkDotNet.Environments
internal bool IsDotNetCliInstalled() => !string.IsNullOrEmpty(DotNetCliVersion.Value);
private static string GetBenchmarkDotNetVersion() => BenchmarkDotNetInfo.FullVersion.Value;
private static string GetBenchmarkDotNetVersion() => BenchmarkDotNetInfo.FullVersion;
}
}

Просмотреть файл

@ -33,7 +33,7 @@ namespace BenchmarkDotNet.Exporters
var scriptFullPath = Path.Combine(summary.ResultsDirectoryPath, scriptFileName);
var script = ResourceHelper.
LoadTemplate(scriptFileName).
Replace("$BenchmarkDotNetVersion$", BenchmarkDotNetInfo.FullTitle.Value).
Replace("$BenchmarkDotNetVersion$", BenchmarkDotNetInfo.FullTitle).
Replace("$CsvSeparator$", CsvMeasurementsExporter.Default.Separator);
lock (buildScriptLock)
File.WriteAllText(scriptFullPath, script);

Просмотреть файл

@ -5,10 +5,30 @@ namespace BenchmarkDotNet.Properties
{
public static class BenchmarkDotNetInfo
{
public const bool IsDevelopVersion = true; // Set to false for NuGet publishing
#if PRERELEASE_NIGHTLY
public const string PrereleaseLabel = "-nightly";
#elif PRERELEASE_DEVELOP
public const string PrereleaseLabel = "-develop";
#else
public const string PrereleaseLabel = "";
#endif
public static readonly Lazy<string> FullVersion = new Lazy<string>(() => typeof(BenchmarkDotNetInfo).GetTypeInfo().Assembly.GetName().Version.ToString() + (IsDevelopVersion ? "-develop" : ""));
public static readonly Lazy<string> FullTitle = new Lazy<string>(() => "BenchmarkDotNet v" + FullVersion.Value);
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
private static readonly Lazy<string> FullVersionLazy = new Lazy<string>(() =>
{
string version = typeof(BenchmarkDotNetInfo).GetTypeInfo().Assembly.GetName().Version.ToString();
if (version.EndsWith(".0") && PrereleaseLabel == "")
version = version.Substring(0, version.Length - 2);
if (version.EndsWith(".0") && PrereleaseLabel == "-develop")
version = version.Substring(0, version.Length - 1) + DateTime.Now.ToString("yyyyMMdd");
return version + PrereleaseLabel;
});
private static readonly Lazy<string> FullTitleLazy = new Lazy<string>(() => "BenchmarkDotNet v" + FullVersionLazy.Value);
public static string FullVersion => FullVersionLazy.Value;
public static string FullTitle => FullTitleLazy.Value;
internal const string PublicKey =
"00240000048000009400000006020000002400005253413100040000010001002970bbdfca4d12" +