aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Tango.NET/Tango.Protobuf
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2017-10-30 17:57:06 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2017-10-30 17:57:06 +0200
commitc5bb832c1880d0a0d55c3ba11cf97cc6dff6a78d (patch)
treedced3401ffd5ee33acb7e54febec4f390ab2a4b8 /Software/Tango.NET/Tango.Protobuf
parentb0000c813d6dfac11cf041fca7de1928596f42ae (diff)
downloadTango-c5bb832c1880d0a0d55c3ba11cf97cc6dff6a78d.tar.gz
Tango-c5bb832c1880d0a0d55c3ba11cf97cc6dff6a78d.zip
Protobuf Compiler API first draft.
Added compiled protobuf & protobuf-c repositories.
Diffstat (limited to 'Software/Tango.NET/Tango.Protobuf')
-rw-r--r--Software/Tango.NET/Tango.Protobuf/IProtoCompiler.cs22
-rw-r--r--Software/Tango.NET/Tango.Protobuf/Properties/AssemblyInfo.cs6
-rw-r--r--Software/Tango.NET/Tango.Protobuf/ProtoCompiler.cs51
-rw-r--r--Software/Tango.NET/Tango.Protobuf/Tango.Protobuf.csproj62
4 files changed, 141 insertions, 0 deletions
diff --git a/Software/Tango.NET/Tango.Protobuf/IProtoCompiler.cs b/Software/Tango.NET/Tango.Protobuf/IProtoCompiler.cs
new file mode 100644
index 000000000..bd2923ede
--- /dev/null
+++ b/Software/Tango.NET/Tango.Protobuf/IProtoCompiler.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.Protobuf
+{
+ /// <summary>
+ /// Represents a protobuf messages compiler.
+ /// </summary>
+ public interface IProtoCompiler : IDisposable
+ {
+ /// <summary>
+ /// Compiles the specified .proto message file and saves the result at the specified output folder.
+ /// </summary>
+ /// <param name="inputFile">.proto file to compile</param>
+ /// <param name="outputFolder">Output folder to save the resulted source code.</param>
+ /// <returns>A list of output source code files.</returns>
+ List<String> Compile(String inputFile, String outputFolder);
+ }
+}
diff --git a/Software/Tango.NET/Tango.Protobuf/Properties/AssemblyInfo.cs b/Software/Tango.NET/Tango.Protobuf/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..37ad6afb4
--- /dev/null
+++ b/Software/Tango.NET/Tango.Protobuf/Properties/AssemblyInfo.cs
@@ -0,0 +1,6 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("Twine - Protobuf Components")]
+[assembly: ComVisible(false)] \ No newline at end of file
diff --git a/Software/Tango.NET/Tango.Protobuf/ProtoCompiler.cs b/Software/Tango.NET/Tango.Protobuf/ProtoCompiler.cs
new file mode 100644
index 000000000..0095046ce
--- /dev/null
+++ b/Software/Tango.NET/Tango.Protobuf/ProtoCompiler.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.Protobuf
+{
+ public abstract class ProtoCompiler : IProtoCompiler
+ {
+ public List<string> Compile(string inputFile, string outputFolder)
+ {
+ throw new NotImplementedException();
+ }
+
+ #region IDisposable Support
+ private bool disposedValue = false; // To detect redundant calls
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!disposedValue)
+ {
+ if (disposing)
+ {
+ // TODO: dispose managed state (managed objects).
+ }
+
+ // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
+ // TODO: set large fields to null.
+
+ disposedValue = true;
+ }
+ }
+
+ // TODO: override a finalizer only if Dispose(bool disposing) above has code to free unmanaged resources.
+ // ~ProtoCompiler() {
+ // // Do not change this code. Put cleanup code in Dispose(bool disposing) above.
+ // Dispose(false);
+ // }
+
+ // This code added to correctly implement the disposable pattern.
+ public void Dispose()
+ {
+ // Do not change this code. Put cleanup code in Dispose(bool disposing) above.
+ Dispose(true);
+ // TODO: uncomment the following line if the finalizer is overridden above.
+ // GC.SuppressFinalize(this);
+ }
+ #endregion
+ }
+}
diff --git a/Software/Tango.NET/Tango.Protobuf/Tango.Protobuf.csproj b/Software/Tango.NET/Tango.Protobuf/Tango.Protobuf.csproj
new file mode 100644
index 000000000..87aa6bc31
--- /dev/null
+++ b/Software/Tango.NET/Tango.Protobuf/Tango.Protobuf.csproj
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{40073806-914E-4E78-97AB-FA9639308EBE}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Tango.Protobuf</RootNamespace>
+ <AssemblyName>Tango.Protobuf</AssemblyName>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\Build\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Net.Http" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="ProtoCompiler.cs" />
+ <Compile Include="IProtoCompiler.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="..\..\External Repositories\Protobuf\protoc-1.0M4.jar">
+ <Link>Utils\protoc-1.0M4.jar</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="..\..\External Repositories\Protobuf\protoc-c.exe">
+ <Link>Utils\protoc-c.exe</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="..\..\External Repositories\Protobuf\protoc.exe">
+ <Link>Utils\protoc.exe</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project> \ No newline at end of file