From c44fc6f0fc331d884e985167d94738f8c68677f8 Mon Sep 17 00:00:00 2001 From: Olivier Coanet Date: Mon, 24 Sep 2018 16:36:54 +0200 Subject: [PATCH] Use msbuild to generate nuget package and enable sourcelink --- appveyor.yml | 8 ++-- build/Disruptor-net.nuspec | 18 -------- build/build.cake | 21 ++++----- src/Directory.Build.props | 44 +++++++++++++++++++ .../Disruptor.Benchmarks.csproj | 8 +--- .../MultiProducerSequencerBenchmarks.cs | 1 - .../Disruptor.PerfTests.csproj | 16 ++----- .../Queue/PingPingQueueLatencyTest.cs | 4 +- .../Disruptor.Scheduler.csproj | 8 ---- src/Disruptor.Tests/Disruptor.Tests.csproj | 12 ----- src/Disruptor.Tests/DisruptorStressTest.cs | 2 +- src/Disruptor.Tests/Dsl/DisruptorTests.cs | 2 + .../PullWithBatchedPoller/BatchedPoller.cs | 16 +++---- .../PullWithBatchedPoller.cs | 4 +- src/Disruptor.Tests/RingBufferTests.cs | 2 + .../TimeoutBlockingWaitStrategyTest.cs | 4 +- src/Disruptor.Tests/WorkerStressTest.cs | 6 +-- src/Disruptor/Disruptor.csproj | 30 ++++--------- 18 files changed, 94 insertions(+), 112 deletions(-) delete mode 100644 build/Disruptor-net.nuspec create mode 100644 src/Directory.Build.props diff --git a/appveyor.yml b/appveyor.yml index 41a0d00e..e20497d2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -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 diff --git a/build/Disruptor-net.nuspec b/build/Disruptor-net.nuspec deleted file mode 100644 index 463d36e8..00000000 --- a/build/Disruptor-net.nuspec +++ /dev/null @@ -1,18 +0,0 @@ - - - - Disruptor - Disruptor-net - Olivier Deheurles, Mendel Monteiro Beckerman, Antoine Blanchet, Olivier Coanet - Disruptor-net - https://github.com/disruptor-net/Disruptor-net - false - Port of LMAX Disruptor to .NET - Concurrency Disruptor Latency Throughput - - - - - - - \ No newline at end of file diff --git a/build/build.cake b/build/build.cake index fade6dc7..0a422e80 100644 --- a/build/build.cake +++ b/build/build.cake @@ -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(() => { @@ -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); diff --git a/src/Directory.Build.props b/src/Directory.Build.props new file mode 100644 index 00000000..e6e2c256 --- /dev/null +++ b/src/Directory.Build.props @@ -0,0 +1,44 @@ + + + + 4 + true + true + latest + false + $(DefaultItemExcludes);*.DotSettings;*.ncrunchproject + embedded + false + + + + 3.4.0 + a18f8198ab94590f0a5ec7c3378ba87f997ea670 + Disruptor + A High Performance Inter-Thread Messaging Library + Olivier Deheurles, Mendel Monteiro Beckerman, Antoine Blanchet, Olivier Coanet + https://github.com/disruptor-net/Disruptor-net + https://github.com/disruptor-net/Disruptor-net/blob/master/LICENSE + Concurrency;Disruptor;Latency;Throughput;Queue + true + + + + true + true + $(Version) + $(PackageVersion)-pre$(APPVEYOR_BUILD_NUMBER) + $(APPVEYOR_REPO_TAG_NAME) + + + + false + false + + + + + + + + diff --git a/src/Disruptor.Benchmarks/Disruptor.Benchmarks.csproj b/src/Disruptor.Benchmarks/Disruptor.Benchmarks.csproj index ccae489f..b9060303 100644 --- a/src/Disruptor.Benchmarks/Disruptor.Benchmarks.csproj +++ b/src/Disruptor.Benchmarks/Disruptor.Benchmarks.csproj @@ -1,23 +1,19 @@  - Disruptor.Benchmarks - Disruptor.Benchmarks - Disruptor.Benchmarks net47 - true exe - - + + diff --git a/src/Disruptor.Benchmarks/MultiProducerSequencerBenchmarks.cs b/src/Disruptor.Benchmarks/MultiProducerSequencerBenchmarks.cs index 2f445544..e44b0548 100644 --- a/src/Disruptor.Benchmarks/MultiProducerSequencerBenchmarks.cs +++ b/src/Disruptor.Benchmarks/MultiProducerSequencerBenchmarks.cs @@ -8,7 +8,6 @@ public unsafe class MultiProducerSequencerBenchmarks private MultiProducerSequencer _sequencer; private MultiProducerSequencerPointer _sequencerPointer; private long _sequence; - private long _sequencePointer; public MultiProducerSequencerBenchmarks() { diff --git a/src/Disruptor.PerfTests/Disruptor.PerfTests.csproj b/src/Disruptor.PerfTests/Disruptor.PerfTests.csproj index 45620926..bbe094d4 100644 --- a/src/Disruptor.PerfTests/Disruptor.PerfTests.csproj +++ b/src/Disruptor.PerfTests/Disruptor.PerfTests.csproj @@ -1,26 +1,18 @@  - Disruptor.PerfTests - Disruptor.PerfTests - Disruptor.PerfTests net47 - false - exe + exe - - - - - + - - + + diff --git a/src/Disruptor.PerfTests/Queue/PingPingQueueLatencyTest.cs b/src/Disruptor.PerfTests/Queue/PingPingQueueLatencyTest.cs index f294ce07..cbbd0278 100644 --- a/src/Disruptor.PerfTests/Queue/PingPingQueueLatencyTest.cs +++ b/src/Disruptor.PerfTests/Queue/PingPingQueueLatencyTest.cs @@ -59,7 +59,6 @@ private class QueuePinger private HistogramBase _histogram; private ManualResetEvent _signal; private CountdownEvent _globalSignal; - private long _counter; public QueuePinger(ArrayConcurrentQueue pingQueue, ArrayConcurrentQueue pongQueue, long maxEvents, long pauseTimeInNano) { @@ -101,7 +100,6 @@ public void Reset(CountdownEvent globalSignal, ManualResetEvent signal, Histogra _globalSignal = globalSignal; _signal = signal; _histogram = histogram; - _counter = 0; } } @@ -140,4 +138,4 @@ public void Reset(CountdownEvent globalSignal, CancellationToken cancellationTok } } } -} \ No newline at end of file +} diff --git a/src/Disruptor.Scheduler/Disruptor.Scheduler.csproj b/src/Disruptor.Scheduler/Disruptor.Scheduler.csproj index b9636780..6fad912c 100644 --- a/src/Disruptor.Scheduler/Disruptor.Scheduler.csproj +++ b/src/Disruptor.Scheduler/Disruptor.Scheduler.csproj @@ -1,15 +1,7 @@  - Disruptor.Scheduler - Disruptor.Scheduler - Disruptor.Scheduler net47 - false - - - - \ No newline at end of file diff --git a/src/Disruptor.Tests/Disruptor.Tests.csproj b/src/Disruptor.Tests/Disruptor.Tests.csproj index 0205a1f7..837ecd94 100644 --- a/src/Disruptor.Tests/Disruptor.Tests.csproj +++ b/src/Disruptor.Tests/Disruptor.Tests.csproj @@ -1,23 +1,11 @@  - Disruptor.Tests - Disruptor.Tests - Disruptor.Tests net452;netcoreapp2.0 - false Disruptor.Tests.Example.DynamiclyAddHandler exe - - - - - - - - diff --git a/src/Disruptor.Tests/DisruptorStressTest.cs b/src/Disruptor.Tests/DisruptorStressTest.cs index 52d40e57..825253d8 100644 --- a/src/Disruptor.Tests/DisruptorStressTest.cs +++ b/src/Disruptor.Tests/DisruptorStressTest.cs @@ -133,7 +133,7 @@ public void Run() _ringBuffer.Publish(next); } } - catch (Exception e) + catch (Exception) { Failed = true; } diff --git a/src/Disruptor.Tests/Dsl/DisruptorTests.cs b/src/Disruptor.Tests/Dsl/DisruptorTests.cs index 3c06c6f0..6e60af8e 100644 --- a/src/Disruptor.Tests/Dsl/DisruptorTests.cs +++ b/src/Disruptor.Tests/Dsl/DisruptorTests.cs @@ -6,6 +6,8 @@ using Disruptor.Tests.Support; using NUnit.Framework; +#pragma warning disable 618 + namespace Disruptor.Tests.Dsl { [TestFixture] diff --git a/src/Disruptor.Tests/Example/PullWithBatchedPoller/BatchedPoller.cs b/src/Disruptor.Tests/Example/PullWithBatchedPoller/BatchedPoller.cs index bc838909..f0a517d4 100644 --- a/src/Disruptor.Tests/Example/PullWithBatchedPoller/BatchedPoller.cs +++ b/src/Disruptor.Tests/Example/PullWithBatchedPoller/BatchedPoller.cs @@ -4,11 +4,11 @@ namespace Disruptor.Tests.Example.PullWithBatchedPoller { public class BatchedPoller where T : class { - private readonly EventPoller> _poller; + private readonly EventPoller _poller; private readonly int _maxBatchSize; - private readonly BatchedData _polledData; + private readonly BatchedData _polledData; - public BatchedPoller(RingBuffer> ringBuffer, int batchSize) + public BatchedPoller(RingBuffer ringBuffer, int batchSize) { _poller = ringBuffer.NewPoller(); ringBuffer.AddGatingSequences(_poller.Sequence); @@ -18,7 +18,7 @@ public BatchedPoller(RingBuffer> ringBuffer, int batchSize) batchSize = 20; } _maxBatchSize = batchSize; - _polledData = new BatchedData(_maxBatchSize); + _polledData = new BatchedData(_maxBatchSize); } public T Poll() @@ -32,7 +32,7 @@ public T Poll() return _polledData.GetMsgCount() > 0 ? _polledData.PollMessage() : null; } - private PollState LoadNextValues(EventPoller> poller, BatchedData batch) + private PollState LoadNextValues(EventPoller poller, BatchedData batch) { return poller.Poll((ev, sequence, endOfBatch) => { @@ -41,7 +41,7 @@ private PollState LoadNextValues(EventPoller> poller, BatchedData + public class DataEvent { public T Data { get; set; } @@ -62,7 +62,7 @@ void Set(T d) } } - public class BatchedData + public class BatchedData { private int _msgHighBound; @@ -114,4 +114,4 @@ public T PollMessage() } } -} \ No newline at end of file +} diff --git a/src/Disruptor.Tests/Example/PullWithBatchedPoller/PullWithBatchedPoller.cs b/src/Disruptor.Tests/Example/PullWithBatchedPoller/PullWithBatchedPoller.cs index 9f5aeacb..6e088d54 100644 --- a/src/Disruptor.Tests/Example/PullWithBatchedPoller/PullWithBatchedPoller.cs +++ b/src/Disruptor.Tests/Example/PullWithBatchedPoller/PullWithBatchedPoller.cs @@ -7,7 +7,7 @@ public class PullWithBatchedPoller public static void Main(string[] args) { var batchSize = 40; - var ringBuffer = RingBuffer.DataEvent>.CreateMultiProducer(() => new BatchedPoller.DataEvent(), 1024); + var ringBuffer = RingBuffer.DataEvent>.CreateMultiProducer(() => new BatchedPoller.DataEvent(), 1024); var poller = new BatchedPoller(ringBuffer, batchSize); @@ -20,4 +20,4 @@ public static void Main(string[] args) } } } -} \ No newline at end of file +} diff --git a/src/Disruptor.Tests/RingBufferTests.cs b/src/Disruptor.Tests/RingBufferTests.cs index e42bdb46..c4aaf4eb 100644 --- a/src/Disruptor.Tests/RingBufferTests.cs +++ b/src/Disruptor.Tests/RingBufferTests.cs @@ -6,6 +6,8 @@ using Gen = System.Collections.Generic; using static Disruptor.Tests.RingBufferEqualsConstraint; +#pragma warning disable 618,612 + namespace Disruptor.Tests { [TestFixture] diff --git a/src/Disruptor.Tests/TimeoutBlockingWaitStrategyTest.cs b/src/Disruptor.Tests/TimeoutBlockingWaitStrategyTest.cs index 67626487..d36ca178 100644 --- a/src/Disruptor.Tests/TimeoutBlockingWaitStrategyTest.cs +++ b/src/Disruptor.Tests/TimeoutBlockingWaitStrategyTest.cs @@ -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) { } @@ -35,4 +35,4 @@ public void ShouldTimeoutWaitFor() Assert.That(timeWaiting, Is.GreaterThanOrEqualTo(theTimeout)); } } -} \ No newline at end of file +} diff --git a/src/Disruptor.Tests/WorkerStressTest.cs b/src/Disruptor.Tests/WorkerStressTest.cs index ac4b4069..0873e8a5 100644 --- a/src/Disruptor.Tests/WorkerStressTest.cs +++ b/src/Disruptor.Tests/WorkerStressTest.cs @@ -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; } @@ -144,4 +144,4 @@ private class TestEvent public string S; } } -} \ No newline at end of file +} diff --git a/src/Disruptor/Disruptor.csproj b/src/Disruptor/Disruptor.csproj index cded5800..645dc569 100644 --- a/src/Disruptor/Disruptor.csproj +++ b/src/Disruptor/Disruptor.csproj @@ -1,31 +1,17 @@  - Disruptor - Disruptor - Disruptor - Disruptor - A High Performance Inter-Thread Messaging Library - 3.4.0 - 3.4.0-alpha - 3.4.0.0 - a18f8198ab94590f0a5ec7c3378ba87f997ea670 - net452;netstandard2.0 - true - bin\$(Configuration)\$(TargetFramework)\Disruptor.xml + net452;netstandard2.0 + true + true + Disruptor + 1701;1702;1591 - - - - - - - - - - + + +