mirror of
https://github.com/FabInfra/capnproto-dotnetcore_Runtime.git
synced 2025-03-12 14:51:41 +01:00
commit
472d7c918d
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||||
|
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||||
<RootNamespace>CapnpC.CSharp.Generator.Tests</RootNamespace>
|
<RootNamespace>CapnpC.CSharp.Generator.Tests</RootNamespace>
|
||||||
|
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
|
@ -27,16 +27,27 @@ namespace CapnpC.CSharp.Generator.Tests
|
|||||||
return assembly.GetManifestResourceStream(urn);
|
return assembly.GetManifestResourceStream(urn);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static bool IsCapnpExeInstalled()
|
internal static bool IsCapnpInstalled()
|
||||||
{
|
{
|
||||||
using (var process = Process.Start("where", "capnp.exe"))
|
try
|
||||||
{
|
{
|
||||||
if (process == null)
|
var startInfo = new ProcessStartInfo(CapnpCompilation.CapnpCompilerFilename, "--version");
|
||||||
Assert.Fail("Unable to start 'where'");
|
startInfo.UseShellExecute = false;
|
||||||
|
startInfo.RedirectStandardOutput = true;
|
||||||
|
startInfo.RedirectStandardError = true;
|
||||||
|
|
||||||
process.WaitForExit();
|
using (var process = Process.Start(startInfo))
|
||||||
|
{
|
||||||
|
Assert.IsNotNull(process, $"Unable to start '{CapnpCompilation.CapnpCompilerFilename}'");
|
||||||
|
|
||||||
return process.ExitCode == 0;
|
process.WaitForExit();
|
||||||
|
|
||||||
|
return process.ExitCode == 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,9 +123,9 @@ namespace CapnpC.CSharp.Generator.Tests
|
|||||||
[Given(@"capnp\.exe is installed on my system")]
|
[Given(@"capnp\.exe is installed on my system")]
|
||||||
public void GivenCapnp_ExeIsInstalledOnMySystem()
|
public void GivenCapnp_ExeIsInstalledOnMySystem()
|
||||||
{
|
{
|
||||||
if (!IsCapnpExeInstalled())
|
if (!IsCapnpInstalled())
|
||||||
{
|
{
|
||||||
Assert.Inconclusive("capnp.exe not found. Precondition of this test is not met.");
|
Assert.Inconclusive("Capnp compiler not found. Precondition of this test is not met.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,9 +162,9 @@ namespace CapnpC.CSharp.Generator.Tests
|
|||||||
[Given(@"capnp\.exe is not installed on my system")]
|
[Given(@"capnp\.exe is not installed on my system")]
|
||||||
public void GivenCapnp_ExeIsNotInstalledOnMySystem()
|
public void GivenCapnp_ExeIsNotInstalledOnMySystem()
|
||||||
{
|
{
|
||||||
if (IsCapnpExeInstalled())
|
if (IsCapnpInstalled())
|
||||||
{
|
{
|
||||||
Assert.Inconclusive("capnp.exe found. Precondition of this test is not met.");
|
Assert.Inconclusive("Capnp compiler found. Precondition of this test is not met.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,12 @@ namespace CapnpC.CSharp.Generator.Tests.Util
|
|||||||
|
|
||||||
string capnpRuntimePath = Path.GetFullPath(Path.Combine(
|
string capnpRuntimePath = Path.GetFullPath(Path.Combine(
|
||||||
Assembly.GetExecutingAssembly().Location,
|
Assembly.GetExecutingAssembly().Location,
|
||||||
@"..\..\..\..\..\Capnp.Net.Runtime\bin\Debug\netcoreapp2.1\Capnp.Net.Runtime.dll"));
|
"..", "..", "..", "..", "..",
|
||||||
|
"Capnp.Net.Runtime",
|
||||||
|
"bin",
|
||||||
|
"Debug",
|
||||||
|
"netcoreapp2.1",
|
||||||
|
"Capnp.Net.Runtime.dll"));
|
||||||
|
|
||||||
var capnpRuntimeMetadataRef = MetadataReference.CreateFromFile(capnpRuntimePath);
|
var capnpRuntimeMetadataRef = MetadataReference.CreateFromFile(capnpRuntimePath);
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
[assembly: InternalsVisibleTo("CapnpC.CSharp.Generator.Tests")]
|
[assembly: InternalsVisibleTo("CapnpC.CSharp.Generator.Tests")]
|
||||||
@ -15,6 +16,14 @@ namespace CapnpC.CSharp.Generator
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static class CapnpCompilation
|
public static class CapnpCompilation
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the basename of the capnp executable
|
||||||
|
/// </summary>
|
||||||
|
public static string CapnpCompilerFilename
|
||||||
|
{
|
||||||
|
get => RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "capnp.exe" : "capnp";
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generates C# code from given input stream
|
/// Generates C# code from given input stream
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -60,7 +69,7 @@ namespace CapnpC.CSharp.Generator
|
|||||||
argList.Add($"-o-");
|
argList.Add($"-o-");
|
||||||
argList.AddRange(arguments);
|
argList.AddRange(arguments);
|
||||||
|
|
||||||
compiler.StartInfo.FileName = "capnp.exe";
|
compiler.StartInfo.FileName = CapnpCompilerFilename;
|
||||||
compiler.StartInfo.Arguments = string.Join(" ", argList);
|
compiler.StartInfo.Arguments = string.Join(" ", argList);
|
||||||
compiler.StartInfo.UseShellExecute = false;
|
compiler.StartInfo.UseShellExecute = false;
|
||||||
compiler.StartInfo.RedirectStandardOutput = true;
|
compiler.StartInfo.RedirectStandardOutput = true;
|
||||||
|
@ -210,7 +210,7 @@
|
|||||||
|
|
||||||
cu = cu.AddMembers(ns);
|
cu = cu.AddMembers(ns);
|
||||||
|
|
||||||
return cu.NormalizeWhitespace().ToFullString();
|
return cu.NormalizeWhitespace(" ", Environment.NewLine).ToFullString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IReadOnlyList<FileGenerationResult> Generate()
|
public IReadOnlyList<FileGenerationResult> Generate()
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||||
|
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||||
<Exec Command="rmdir /s /q $(SolutionDir)MsBuildGenerationTest\obj" />
|
<RemoveDir Directories="$(SolutionDir)\MsBuildGenerationTest\obj" />
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
10
appveyor.yml
10
appveyor.yml
@ -56,13 +56,13 @@ artifacts:
|
|||||||
type: NuGetPackage
|
type: NuGetPackage
|
||||||
clone_depth: 1
|
clone_depth: 1
|
||||||
test_script:
|
test_script:
|
||||||
- cmd: vstest.console /logger:Appveyor /inIsolation CapnpC.CSharp.Generator.Tests\bin\Release\netcoreapp2.2\CapnpC.CSharp.Generator.Tests.dll
|
- cmd: vstest.console /logger:Appveyor /inIsolation CapnpC.CSharp.Generator.Tests\bin\Release\netcoreapp2.1\CapnpC.CSharp.Generator.Tests.dll
|
||||||
- cmd: cd %APPVEYOR_BUILD_FOLDER%\chocolatey\install
|
- cmd: cd %APPVEYOR_BUILD_FOLDER%\chocolatey\install
|
||||||
- cmd: choco install capnpc-csharp --source=".;https://chocolatey.org/api/v2" --force -y
|
- cmd: choco install capnpc-csharp --source=".;https://chocolatey.org/api/v2" --force -y
|
||||||
- cmd: cd %APPVEYOR_BUILD_FOLDER%\install-test
|
- cmd: cd %APPVEYOR_BUILD_FOLDER%\install-test
|
||||||
- cmd: compile-test
|
- cmd: compile-test
|
||||||
- cmd: cd %APPVEYOR_BUILD_FOLDER%
|
- cmd: cd %APPVEYOR_BUILD_FOLDER%
|
||||||
- cmd: vstest.console /logger:Appveyor /inIsolation CapnpC.CSharp.Generator.Tests\bin\Release\netcoreapp2.2\CapnpC.CSharp.Generator.Tests.dll
|
- cmd: vstest.console /logger:Appveyor /inIsolation CapnpC.CSharp.Generator.Tests\bin\Release\netcoreapp2.1\CapnpC.CSharp.Generator.Tests.dll
|
||||||
- cmd: choco uninstall capnpc-csharp -y
|
- cmd: choco uninstall capnpc-csharp -y
|
||||||
- cmd: cd %APPVEYOR_BUILD_FOLDER%\install-test
|
- cmd: cd %APPVEYOR_BUILD_FOLDER%\install-test
|
||||||
- cmd: notinstalled-test
|
- cmd: notinstalled-test
|
||||||
@ -73,13 +73,13 @@ test_script:
|
|||||||
- cmd: choco uninstall capnpc-csharp-win-x86 -y
|
- cmd: choco uninstall capnpc-csharp-win-x86 -y
|
||||||
- cmd: notinstalled-test
|
- cmd: notinstalled-test
|
||||||
- cmd: cd %APPVEYOR_BUILD_FOLDER%
|
- cmd: cd %APPVEYOR_BUILD_FOLDER%
|
||||||
- cmd: vstest.console /logger:Appveyor /inIsolation CapnpC.CSharp.MsBuild.Generation.Tests\bin\Release\netcoreapp2.2\CapnpC.CSharp.MsBuild.Generation.Tests.dll
|
- cmd: vstest.console /logger:Appveyor /inIsolation CapnpC.CSharp.MsBuild.Generation.Tests\bin\Release\netcoreapp2.1\CapnpC.CSharp.MsBuild.Generation.Tests.dll
|
||||||
- cmd: msbuild -t:restore ./MsBuildGenerationTest/MsBuildGenerationTest.csproj /p:Configuration="Debug" /p:PackageReferenceVersion="%APPVEYOR_BUILD_VERSION%"
|
- cmd: msbuild -t:restore ./MsBuildGenerationTest/MsBuildGenerationTest.csproj /p:Configuration="Debug" /p:PackageReferenceVersion="%APPVEYOR_BUILD_VERSION%"
|
||||||
- cmd: msbuild ./MsBuildGenerationTest/MsBuildGenerationTest.sln /p:Configuration="Debug" /p:PackageReferenceVersion="%APPVEYOR_BUILD_VERSION%"
|
- cmd: msbuild ./MsBuildGenerationTest/MsBuildGenerationTest.sln /p:Configuration="Debug" /p:PackageReferenceVersion="%APPVEYOR_BUILD_VERSION%"
|
||||||
- cmd: vstest.console /logger:Appveyor /inIsolation Capnp.Net.Runtime.Tests\bin\Debug\net471\Capnp.Net.Runtime.Tests.Std20.dll
|
- cmd: vstest.console /logger:Appveyor /inIsolation Capnp.Net.Runtime.Tests\bin\Debug\net471\Capnp.Net.Runtime.Tests.Std20.dll
|
||||||
- cmd: vstest.console /logger:Appveyor /inIsolation Capnp.Net.Runtime.Tests\bin\Release\net471\Capnp.Net.Runtime.Tests.Std20.dll
|
- cmd: vstest.console /logger:Appveyor /inIsolation Capnp.Net.Runtime.Tests\bin\Release\net471\Capnp.Net.Runtime.Tests.Std20.dll
|
||||||
- cmd: vstest.console /logger:Appveyor /inIsolation Capnp.Net.Runtime.Tests.Core21\bin\Debug\netcoreapp2.2\Capnp.Net.Runtime.Tests.Core21.dll
|
- cmd: vstest.console /logger:Appveyor /inIsolation Capnp.Net.Runtime.Tests.Core21\bin\Debug\netcoreapp2.1\Capnp.Net.Runtime.Tests.Core21.dll
|
||||||
- cmd: vstest.console /logger:Appveyor /inIsolation Capnp.Net.Runtime.Tests.Core21\bin\Release\netcoreapp2.2\Capnp.Net.Runtime.Tests.Core21.dll
|
- cmd: vstest.console /logger:Appveyor /inIsolation Capnp.Net.Runtime.Tests.Core21\bin\Release\netcoreapp2.1\Capnp.Net.Runtime.Tests.Core21.dll
|
||||||
on_finish :
|
on_finish :
|
||||||
# any cleanup in here
|
# any cleanup in here
|
||||||
deploy:
|
deploy:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user