Skip to content

Commit

Permalink
Creating a contracts package
Browse files Browse the repository at this point in the history
  • Loading branch information
jbogard committed Jan 6, 2022
1 parent a533cf2 commit b2b0222
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 15 deletions.
34 changes: 34 additions & 0 deletions BuildContracts.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Taken from psake https://github.com/psake/psake

<#
.SYNOPSIS
This is a helper function that runs a scriptblock and checks the PS variable $lastexitcode
to see if an error occcured. If an error is detected then an exception is thrown.
This function allows you to run command-line programs without having to
explicitly check the $lastexitcode variable.
.EXAMPLE
exec { svn info $repository_trunk } "Error executing SVN. Please verify SVN command-line client is installed"
#>
function Exec
{
[CmdletBinding()]
param(
[Parameter(Position=0,Mandatory=1)][scriptblock]$cmd,
[Parameter(Position=1,Mandatory=0)][string]$errorMessage = ($msgs.error_bad_command -f $cmd)
)
& $cmd
if ($lastexitcode -ne 0) {
throw ("Exec: " + $errorMessage)
}
}

$artifacts = ".\artifacts"
$contracts = ".\src\MediatR.Contracts\MediatR.Contracts.csproj"

if(Test-Path $artifacts) { Remove-Item $artifacts -Force -Recurse }

exec { & dotnet clean $contracts -c Release }

exec { & dotnet build $contracts -c Release -p:ContinuousIntegrationBuild=true }

exec { & dotnet pack $contracts -c Release -o $artifacts --no-build }
3 changes: 2 additions & 1 deletion MediatR.sln
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
Build.ps1 = Build.ps1
BuildContracts.ps1 = BuildContracts.ps1
.github\workflows\ci.yml = .github\workflows\ci.yml
Directory.Build.props = Directory.Build.props
Push.ps1 = Push.ps1
Expand All @@ -50,7 +51,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MediatR.Benchmarks", "test\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MediatR.Examples.Stashbox", "samples\MediatR.Examples.Stashbox\MediatR.Examples.Stashbox.csproj", "{575EC49E-BEC8-4DFF-BD22-8464844093FE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediatR.Contracts", "src\MediatR.Contracts\MediatR.Contracts.csproj", "{87F5A238-44B5-4769-82E5-E68B712D6E6D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MediatR.Contracts", "src\MediatR.Contracts\MediatR.Contracts.csproj", "{87F5A238-44B5-4769-82E5-E68B712D6E6D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
14 changes: 0 additions & 14 deletions PushContracts.ps1

This file was deleted.

7 changes: 7 additions & 0 deletions src/MediatR.Contracts/IStreamRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace MediatR;

/// <summary>
/// Marker interface to represent a request with a streaming response
/// </summary>
/// <typeparam name="TResponse">Response type</typeparam>
public interface IStreamRequest<out TResponse> { }

0 comments on commit b2b0222

Please sign in to comment.