mirror of
https://github.com/FabInfra/capnproto-dotnetcore_Runtime.git
synced 2025-03-12 14:51:41 +01:00
Deployment aspects
This commit is contained in:
parent
d80fcdc27d
commit
97883572af
2
.gitignore
vendored
2
.gitignore
vendored
@ -84,6 +84,8 @@ StyleCopReport.xml
|
|||||||
*.pidb
|
*.pidb
|
||||||
*.svclog
|
*.svclog
|
||||||
*.scc
|
*.scc
|
||||||
|
*.dll
|
||||||
|
*.exe
|
||||||
|
|
||||||
# Chutzpah Test files
|
# Chutzpah Test files
|
||||||
_Chutzpah*
|
_Chutzpah*
|
||||||
|
@ -540,7 +540,7 @@
|
|||||||
<exception cref="T:System.IO.EndOfStreamException">The end of the stream is reached.</exception>
|
<exception cref="T:System.IO.EndOfStreamException">The end of the stream is reached.</exception>
|
||||||
<exception cref="T:System.ObjectDisposedException">The stream is closed.</exception>
|
<exception cref="T:System.ObjectDisposedException">The stream is closed.</exception>
|
||||||
<exception cref="T:System.IO.IOException">An I/O error occurs.</exception>
|
<exception cref="T:System.IO.IOException">An I/O error occurs.</exception>
|
||||||
<exception cref="T:System.IO.InvalidDataException">Encountered invalid framing data.</exception>
|
<exception cref="T:System.IO.InvalidDataException">Encountered invalid framing data, too many or too large segments</exception>
|
||||||
<exception cref="T:System.OutOfMemoryException">Too many or too large segments, probably due to invalid framing data.</exception>
|
<exception cref="T:System.OutOfMemoryException">Too many or too large segments, probably due to invalid framing data.</exception>
|
||||||
</member>
|
</member>
|
||||||
<member name="T:Capnp.ICapnpSerializable">
|
<member name="T:Capnp.ICapnpSerializable">
|
||||||
|
@ -21,7 +21,7 @@ namespace Capnp
|
|||||||
/// <exception cref="EndOfStreamException">The end of the stream is reached.</exception>
|
/// <exception cref="EndOfStreamException">The end of the stream is reached.</exception>
|
||||||
/// <exception cref="ObjectDisposedException">The stream is closed.</exception>
|
/// <exception cref="ObjectDisposedException">The stream is closed.</exception>
|
||||||
/// <exception cref="IOException">An I/O error occurs.</exception>
|
/// <exception cref="IOException">An I/O error occurs.</exception>
|
||||||
/// <exception cref="InvalidDataException">Encountered invalid framing data.</exception>
|
/// <exception cref="InvalidDataException">Encountered invalid framing data, too many or too large segments</exception>
|
||||||
/// <exception cref="OutOfMemoryException">Too many or too large segments, probably due to invalid framing data.</exception>
|
/// <exception cref="OutOfMemoryException">Too many or too large segments, probably due to invalid framing data.</exception>
|
||||||
public static WireFrame ReadSegments(Stream stream)
|
public static WireFrame ReadSegments(Stream stream)
|
||||||
{
|
{
|
||||||
@ -39,15 +39,28 @@ namespace Capnp
|
|||||||
throw new InvalidDataException("Encountered invalid framing data");
|
throw new InvalidDataException("Encountered invalid framing data");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cannot have more segments than the traversal limit
|
||||||
|
if (scount >= SecurityOptions.TraversalLimit)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException("Too many segments. Probably invalid data. Try increasing the traversal limit.");
|
||||||
|
}
|
||||||
|
|
||||||
var buffers = new Memory<ulong>[scount];
|
var buffers = new Memory<ulong>[scount];
|
||||||
|
|
||||||
for (uint i = 0; i < scount; i++)
|
for (uint i = 0; i < scount; i++)
|
||||||
{
|
{
|
||||||
uint size = reader.ReadUInt32();
|
uint size = reader.ReadUInt32();
|
||||||
|
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
{
|
{
|
||||||
throw new EndOfStreamException("Stream closed");
|
throw new EndOfStreamException("Stream closed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (size >= SecurityOptions.TraversalLimit)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException("Too large segment. Probably invalid data. Try increasing the traversal limit.");
|
||||||
|
}
|
||||||
|
|
||||||
buffers[i] = new Memory<ulong>(new ulong[size]);
|
buffers[i] = new Memory<ulong>(new ulong[size]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
using Capnp;
|
using Capnp;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
namespace CapnpC
|
namespace CapnpC
|
||||||
{
|
{
|
||||||
@ -17,22 +15,33 @@ namespace CapnpC
|
|||||||
input = new FileStream(args[0], FileMode.Open, FileAccess.Read);
|
input = new FileStream(args[0], FileMode.Open, FileAccess.Read);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Console.WriteLine("Cap'n Proto C# code generator backend");
|
||||||
|
Console.WriteLine("expecting binary-encoded code generation request from standard input");
|
||||||
|
|
||||||
input = Console.OpenStandardInput();
|
input = Console.OpenStandardInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
WireFrame segments;
|
try
|
||||||
|
|
||||||
using (input)
|
|
||||||
{
|
{
|
||||||
segments = Framing.ReadSegments(input);
|
WireFrame segments;
|
||||||
}
|
|
||||||
|
|
||||||
var dec = DeserializerState.CreateRoot(segments);
|
using (input)
|
||||||
var reader = Schema.CodeGeneratorRequest.Reader.Create(dec);
|
{
|
||||||
var model = Model.SchemaModel.Create(reader);
|
segments = Framing.ReadSegments(input);
|
||||||
var codeGen = new Generator.CodeGenerator(model, new Generator.GeneratorOptions());
|
}
|
||||||
codeGen.Generate();
|
|
||||||
|
var dec = DeserializerState.CreateRoot(segments);
|
||||||
|
var reader = Schema.CodeGeneratorRequest.Reader.Create(dec);
|
||||||
|
var model = Model.SchemaModel.Create(reader);
|
||||||
|
var codeGen = new Generator.CodeGenerator(model, new Generator.GeneratorOptions());
|
||||||
|
codeGen.Generate();
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Console.Error.WriteLine(exception.Message);
|
||||||
|
Environment.ExitCode = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,18 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||||
<RootNamespace>CapnpC</RootNamespace>
|
<RootNamespace>CapnpC</RootNamespace>
|
||||||
<LangVersion>7.1</LangVersion>
|
<LangVersion>7.1</LangVersion>
|
||||||
|
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
|
||||||
|
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||||
|
<Authors>Christian Köllner and contributors</Authors>
|
||||||
|
<Description>Cap'n Proto C# code generator backend</Description>
|
||||||
|
<Copyright>Christian Köllner and contributors</Copyright>
|
||||||
|
<PackageProjectUrl>https://github.com/c80k/capnproto-dotnetcore</PackageProjectUrl>
|
||||||
|
<RepositoryType>Git</RepositoryType>
|
||||||
|
<PackageTags>capnp capnpc RPC serialization cerealization</PackageTags>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
22
chocolatey/capnpc-csharp.1.0.0.nuspec
Normal file
22
chocolatey/capnpc-csharp.1.0.0.nuspec
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
|
||||||
|
<metadata>
|
||||||
|
<id>capnpc-csharp</id>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<authors>Christian Köllner and contributors</authors>
|
||||||
|
<owners>Christian Köllner and contributors</owners>
|
||||||
|
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||||
|
<!--<license type="expression">MIT</license>-->
|
||||||
|
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
|
||||||
|
<projectUrl>https://github.com/c80k/capnproto-dotnetcore</projectUrl>
|
||||||
|
<description>Cap'n Proto C# code generator backend</description>
|
||||||
|
<copyright>Christian Köllner and contributors</copyright>
|
||||||
|
<tags>capnp capnpc RPC serialization cerealization</tags>
|
||||||
|
<!--<repository type="Git" />-->
|
||||||
|
</metadata>
|
||||||
|
<files>
|
||||||
|
<file src="chocolateyinstall.ps1" target="tools" />
|
||||||
|
<file src="chocolateyuninstall.ps1" target="tools" />
|
||||||
|
<file src=".\deploy\**" target="tools" />
|
||||||
|
</files>
|
||||||
|
</package>
|
5
chocolatey/chocolateyinstall.ps1
Normal file
5
chocolatey/chocolateyinstall.ps1
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
$ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
|
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
|
||||||
|
|
||||||
|
Install-Binfile -Name capnpc-csharp -Path "$toolsDir\capnpc-csharp.exe"
|
3
chocolatey/chocolateyuninstall.ps1
Normal file
3
chocolatey/chocolateyuninstall.ps1
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
$ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
|
Uninstall-BinFile capnpc-sharp
|
2464
chocolatey/deploy/capnpc-csharp.deps.json
Normal file
2464
chocolatey/deploy/capnpc-csharp.deps.json
Normal file
File diff suppressed because it is too large
Load Diff
3
chocolatey/deploy/capnpc-csharp.runtimeconfig.json
Normal file
3
chocolatey/deploy/capnpc-csharp.runtimeconfig.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"runtimeOptions": {}
|
||||||
|
}
|
8
scripts/capnpc-csharp-install.ps1
Normal file
8
scripts/capnpc-csharp-install.ps1
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
$id = "capnpc-csharp"
|
||||||
|
|
||||||
|
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||||
|
$installDir = "$scriptDir\..\chocolatey\install"
|
||||||
|
|
||||||
|
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit }
|
||||||
|
|
||||||
|
choco install $id -s $installDir --force
|
14
scripts/capnpc-csharp-pack.ps1
Normal file
14
scripts/capnpc-csharp-pack.ps1
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
$id = "capnpc-csharp"
|
||||||
|
$version = "1.0.0"
|
||||||
|
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||||
|
$prefix = "$id.$version"
|
||||||
|
$chocoDir = "$scriptDir\..\chocolatey"
|
||||||
|
$nuspecFile = "$prefix.nuspec"
|
||||||
|
$nuspecPath = "$chocoDir\$nuspecFile"
|
||||||
|
$deployDir = "$chocoDir\deploy"
|
||||||
|
$installDir = "$chocoDir\install"
|
||||||
|
$csprojDir = "$scriptDir\..\capnpc-csharp"
|
||||||
|
$csprojFile = "capnpc-csharp.csproj"
|
||||||
|
|
||||||
|
dotnet publish -c Release -r win-x86 --self-contained -o $deployDir "$csprojDir\$csprojFile"
|
||||||
|
choco pack $nuspecPath --outputdirectory $installDir
|
Loading…
x
Reference in New Issue
Block a user