Skip to content

Commit

Permalink
Use msbuild to generate nuget package and enable sourcelink
Browse files Browse the repository at this point in the history
  • Loading branch information
ocoanet committed Sep 24, 2018
1 parent 9763385 commit c44fc6f
Show file tree
Hide file tree
Showing 18 changed files with 94 additions and 112 deletions.
8 changes: 4 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 3.4.0.{build}
image: Visual Studio 2017
build_script:
- ps: build\build.ps1 -Script build\build.cake -Target Build-Assembly
test_script:
- ps: build\build.ps1 -Script build\build.cake -Target Run-Tests
- ps: build\build.ps1 -Script build\build.cake -Target AppVeyor
test: off
artifacts:
- path: output\nuget\*.nupkg
18 changes: 0 additions & 18 deletions build/Disruptor-net.nuspec

This file was deleted.

21 changes: 11 additions & 10 deletions build/build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,13 @@ var paths = new
AssemblyProject = MakeAbsolute(File("../src/Disruptor/Disruptor.csproj")),
TestsProject = MakeAbsolute(File("../src/Disruptor.Tests/Disruptor.Tests.csproj")),
PerfProject = MakeAbsolute(File("../src/Disruptor.PerfTests/Disruptor.PerfTests.csproj")),
Nuspec = MakeAbsolute(File("Disruptor-net.nuspec")),
NUnit = MakeAbsolute(File("../tools/NUnit/nunit3-console.exe")),
Projects = GetFiles("../src/**/*.csproj").Select(MakeAbsolute),
};

var nugetVersion = XmlPeek(paths.AssemblyProject, "//InformationalVersion/text()");
var targetFrameworks = XmlPeek(paths.AssemblyProject, "//TargetFrameworks/text()").Split(';');
var testsFrameworks = XmlPeek(paths.TestsProject, "//TargetFrameworks/text()").Split(';');


Task("Restore-NuGet-Packages")
.Does(() =>
{
Expand Down Expand Up @@ -107,13 +104,17 @@ Task("Pack")
.Does(() =>
{
CreateDirectory(paths.NugetOutput);
Information("Packing {0}", nugetVersion);
NuGetPack(paths.Nuspec, new NuGetPackSettings
{
Version = nugetVersion,
BasePath = paths.AssemblyOutput.FullPath,
OutputDirectory = paths.NugetOutput
});
MSBuild(paths.AssemblyProject, settings => settings
.WithTarget("Pack")
.SetConfiguration("Release")
.SetPlatformTarget(PlatformTarget.MSIL)
.SetVerbosity(Verbosity.Minimal)
.WithProperty("PackageOutputPath", paths.NugetOutput.FullPath)
);
});

Task("AppVeyor")
.IsDependentOn("Run-Tests")
.IsDependentOn("Pack");

RunTarget(target);
44 changes: 44 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<LangVersion>latest</LangVersion>
<Prefer32Bit>false</Prefer32Bit>
<DefaultItemExcludes>$(DefaultItemExcludes);*.DotSettings;*.ncrunchproject</DefaultItemExcludes>
<DebugType>embedded</DebugType>
<IsPackable>false</IsPackable>
</PropertyGroup>

<PropertyGroup>
<Version>3.4.0</Version>
<LastPortedJavaRevision>a18f8198ab94590f0a5ec7c3378ba87f997ea670</LastPortedJavaRevision>
<Product>Disruptor</Product>
<Description>A High Performance Inter-Thread Messaging Library</Description>
<Authors>Olivier Deheurles, Mendel Monteiro Beckerman, Antoine Blanchet, Olivier Coanet</Authors>
<PackageProjectUrl>https://github.com/disruptor-net/Disruptor-net</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/disruptor-net/Disruptor-net/blob/master/LICENSE</PackageLicenseUrl>
<PackageTags>Concurrency;Disruptor;Latency;Throughput;Queue</PackageTags>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
</PropertyGroup>

<PropertyGroup Condition="'$(APPVEYOR)' == 'True'">
<Deterministic>true</Deterministic>
<DeterministicSourcePaths>true</DeterministicSourcePaths>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(Version)</PackageVersion>
<PackageVersion Condition="'$(APPVEYOR_REPO_TAG)' == 'false' and '$(APPVEYOR_BUILD_NUMBER)' != ''">$(PackageVersion)-pre$(APPVEYOR_BUILD_NUMBER)</PackageVersion>
<PackageVersion Condition="'$(APPVEYOR_REPO_TAG)' == 'true' and '$(APPVEYOR_REPO_TAG_NAME)' != ''">$(APPVEYOR_REPO_TAG_NAME)</PackageVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(NCrunch)' == '1'">
<EnableSourceLink>false</EnableSourceLink>
<EnableSourceControlManagerQueries>false</EnableSourceControlManagerQueries>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2018.2.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63127-02" PrivateAssets="All" />
</ItemGroup>

</Project>
8 changes: 2 additions & 6 deletions src/Disruptor.Benchmarks/Disruptor.Benchmarks.csproj
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AssemblyName>Disruptor.Benchmarks</AssemblyName>
<RootNamespace>Disruptor.Benchmarks</RootNamespace>
<Title>Disruptor.Benchmarks</Title>
<TargetFramework>net47</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<OutputType>exe</OutputType>
</PropertyGroup>

<ItemGroup>
<None Remove="BenchmarkDotNet.Artifacts\**" />
<None Remove="Disruptor.Benchmarks.v3.ncrunchproject" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.10.10" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.4.0" />
<PackageReference Include="InlineIL.Fody" Version="0.5.0" />
<PackageReference Include="Fody" Version="3.2.4" PrivateAssets="all" />
<PackageReference Include="InlineIL.Fody" Version="0.7.0" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ public unsafe class MultiProducerSequencerBenchmarks
private MultiProducerSequencer _sequencer;
private MultiProducerSequencerPointer _sequencerPointer;
private long _sequence;
private long _sequencePointer;

public MultiProducerSequencerBenchmarks()
{
Expand Down
16 changes: 4 additions & 12 deletions src/Disruptor.PerfTests/Disruptor.PerfTests.csproj
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AssemblyName>Disruptor.PerfTests</AssemblyName>
<RootNamespace>Disruptor.PerfTests</RootNamespace>
<Title>Disruptor.PerfTests</Title>
<TargetFramework>net47</TargetFramework>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<OutputType>exe</OutputType>
<OutputType>exe</OutputType>
</PropertyGroup>

<ItemGroup>
<None Remove="Disruptor.PerfTests.v3.ncrunchproject" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="HdrHistogram" Version="1.7.0" />
<PackageReference Include="HdrHistogram" Version="1.7.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Disruptor\Disruptor.csproj" />
<ProjectReference Include="..\Disruptor.Scheduler\Disruptor.Scheduler.csproj" />
<ProjectReference Include="..\Disruptor.Tests\Disruptor.Tests.csproj" />
<ProjectReference Include="..\Disruptor.Scheduler\Disruptor.Scheduler.csproj" />
<ProjectReference Include="..\Disruptor.Tests\Disruptor.Tests.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 1 addition & 3 deletions src/Disruptor.PerfTests/Queue/PingPingQueueLatencyTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ private class QueuePinger
private HistogramBase _histogram;
private ManualResetEvent _signal;
private CountdownEvent _globalSignal;
private long _counter;

public QueuePinger(ArrayConcurrentQueue<long> pingQueue, ArrayConcurrentQueue<long> pongQueue, long maxEvents, long pauseTimeInNano)
{
Expand Down Expand Up @@ -101,7 +100,6 @@ public void Reset(CountdownEvent globalSignal, ManualResetEvent signal, Histogra
_globalSignal = globalSignal;
_signal = signal;
_histogram = histogram;
_counter = 0;
}
}

Expand Down Expand Up @@ -140,4 +138,4 @@ public void Reset(CountdownEvent globalSignal, CancellationToken cancellationTok
}
}
}
}
}
8 changes: 0 additions & 8 deletions src/Disruptor.Scheduler/Disruptor.Scheduler.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AssemblyName>Disruptor.Scheduler</AssemblyName>
<RootNamespace>Disruptor.Scheduler</RootNamespace>
<Title>Disruptor.Scheduler</Title>
<TargetFrameworks>net47</TargetFrameworks>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup>
<None Remove="Disruptor.Scheduler.v3.ncrunchproject" />
</ItemGroup>

</Project>
12 changes: 0 additions & 12 deletions src/Disruptor.Tests/Disruptor.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AssemblyName>Disruptor.Tests</AssemblyName>
<RootNamespace>Disruptor.Tests</RootNamespace>
<Title>Disruptor.Tests</Title>
<TargetFrameworks>net452;netcoreapp2.0</TargetFrameworks>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<StartupObject>Disruptor.Tests.Example.DynamiclyAddHandler</StartupObject>
<OutputType>exe</OutputType>
</PropertyGroup>

<ItemGroup>
<Reference Include="netstandard" />
</ItemGroup>

<ItemGroup>
<None Remove="Disruptor.Tests.v3.ncrunchproject" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.6.1" />
<PackageReference Include="NUnit" Version="3.10.0" />
Expand Down
2 changes: 1 addition & 1 deletion src/Disruptor.Tests/DisruptorStressTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public void Run()
_ringBuffer.Publish(next);
}
}
catch (Exception e)
catch (Exception)
{
Failed = true;
}
Expand Down
2 changes: 2 additions & 0 deletions src/Disruptor.Tests/Dsl/DisruptorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Disruptor.Tests.Support;
using NUnit.Framework;

#pragma warning disable 618

namespace Disruptor.Tests.Dsl
{
[TestFixture]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ namespace Disruptor.Tests.Example.PullWithBatchedPoller
{
public class BatchedPoller<T> where T : class
{
private readonly EventPoller<DataEvent<T>> _poller;
private readonly EventPoller<DataEvent> _poller;
private readonly int _maxBatchSize;
private readonly BatchedData<T> _polledData;
private readonly BatchedData _polledData;

public BatchedPoller(RingBuffer<DataEvent<T>> ringBuffer, int batchSize)
public BatchedPoller(RingBuffer<DataEvent> ringBuffer, int batchSize)
{
_poller = ringBuffer.NewPoller();
ringBuffer.AddGatingSequences(_poller.Sequence);
Expand All @@ -18,7 +18,7 @@ public BatchedPoller(RingBuffer<DataEvent<T>> ringBuffer, int batchSize)
batchSize = 20;
}
_maxBatchSize = batchSize;
_polledData = new BatchedData<T>(_maxBatchSize);
_polledData = new BatchedData(_maxBatchSize);
}

public T Poll()
Expand All @@ -32,7 +32,7 @@ public T Poll()
return _polledData.GetMsgCount() > 0 ? _polledData.PollMessage() : null;
}

private PollState LoadNextValues(EventPoller<DataEvent<T>> poller, BatchedData<T> batch)
private PollState LoadNextValues(EventPoller<DataEvent> poller, BatchedData batch)
{
return poller.Poll((ev, sequence, endOfBatch) =>
{
Expand All @@ -41,7 +41,7 @@ private PollState LoadNextValues(EventPoller<DataEvent<T>> poller, BatchedData<T
});
}

public class DataEvent<T>
public class DataEvent
{
public T Data { get; set; }

Expand All @@ -62,7 +62,7 @@ void Set(T d)
}
}

public class BatchedData<T>
public class BatchedData
{

private int _msgHighBound;
Expand Down Expand Up @@ -114,4 +114,4 @@ public T PollMessage()
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class PullWithBatchedPoller
public static void Main(string[] args)
{
var batchSize = 40;
var ringBuffer = RingBuffer<BatchedPoller<object>.DataEvent<object>>.CreateMultiProducer(() => new BatchedPoller<object>.DataEvent<object>(), 1024);
var ringBuffer = RingBuffer<BatchedPoller<object>.DataEvent>.CreateMultiProducer(() => new BatchedPoller<object>.DataEvent(), 1024);

var poller = new BatchedPoller<object>(ringBuffer, batchSize);

Expand All @@ -20,4 +20,4 @@ public static void Main(string[] args)
}
}
}
}
}
2 changes: 2 additions & 0 deletions src/Disruptor.Tests/RingBufferTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Gen = System.Collections.Generic;
using static Disruptor.Tests.RingBufferEqualsConstraint;

#pragma warning disable 618,612

namespace Disruptor.Tests
{
[TestFixture]
Expand Down
4 changes: 2 additions & 2 deletions src/Disruptor.Tests/TimeoutBlockingWaitStrategyTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void ShouldTimeoutWaitFor()
waitStrategy.WaitFor(6, cursor, dependent, sequenceBarrier);
throw new ApplicationException("TimeoutException should have been thrown");
}
catch (TimeoutException e)
catch (TimeoutException)
{
}

Expand All @@ -35,4 +35,4 @@ public void ShouldTimeoutWaitFor()
Assert.That(timeWaiting, Is.GreaterThanOrEqualTo(theTimeout));
}
}
}
}
6 changes: 3 additions & 3 deletions src/Disruptor.Tests/WorkerStressTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ public void Run()
testEvent.Sequence = next;
testEvent.A = next + 13;
testEvent.B = next - 7;
//testEvent.S = "wibble-" + next;
testEvent.S = "wibble-";
_ringBuffer.Publish(next);
}
}
catch (Exception e)
catch (Exception)
{
Failed = true;
}
Expand All @@ -144,4 +144,4 @@ private class TestEvent
public string S;
}
}
}
}
Loading

0 comments on commit c44fc6f

Please sign in to comment.