GithubHelp home page GithubHelp logo

isabella232 / falanx Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jet/falanx

0.0 0.0 0.0 632 KB

Generates F# code from protobuf schema for binary and json format

License: Other

F# 98.50% Shell 0.09% Batchfile 0.04% Scala 1.37%

falanx's Introduction

Build Status NuGet

Falanx code generation

This repository contains the code generator to generate F# source (.fs files) from Protobuf v3 schema.

The general concepts are as follows:

  • Code generation, to generate F# source code, rather than types being injected as a type provider.
  • Idiomatic F# code is generated rather than simple .NET 1.1 era code. This means records, discriminated unions, etc., are generated where appropriate.

How to use

In a .NET Sdk library project, add the following packages

<PackageReference Include="Falanx.Proto.Codec.Binary" Version="0.5.*" />
<PackageReference Include="Falanx.Proto.Codec.Json" Version="0.5.*" />
<PackageReference Include="Falanx.Sdk" Version="0.5.*" PrivateAssets="All" />

It's possibile to use only one of Falanx.Proto.Codec.Binary and Falanx.Proto.Codec.Json or both, the generated code will depends on the packages referenced

Now specify the .proto file path like

  <ItemGroup>
    <ProtoFile Include="..\proto\bundle.proto" />
  </ItemGroup>

and an auto generated file will be created on build

More info in example-sdk/README.md

Template

Install the .NET template for an example library sample

dotnet new -i Falanx.Templates
dotnet new falanx

use --codec argument to specify the codecs (values json,binary,all)

Tool

It's possibile to use falanx as command line .NET global tool

dotnet tool install -g Falanx.Tool
falanx --help

To generate a .fs file for a specified .proto file:

falanx --inputfile test\examples\schemas\bundle.proto --defaultnamespace test --outputfile bundle.fs

More info in example\README.md

How to build Falanx

More info in docs/developer_guide.md

Use the src/Falanx.sln solution for development, or directly the projects with .NET Core Sdk (dotnet).

Projects:

  • src/Falanx.Tool the falanx console app, run with dotnet run
  • test/Falanx.Tests the unit test, run with dotnet run
  • test/Falanx.IntegrationTests the integration tests, run with dotnet run

As shortcuts, from root:

  • dotnet build to build the falanx executable Falanx.Tool.
  • dotnet pack to generate packages in bin/nupks
  • dotnet test -v n to run tests

To build packages

From root

dotnet pack

The nupkgs will be in bin/nupkg

To specify a version pass the Version property like /p:Version=0.1.0-alpha7

Info

Falanx uses:

  • Type Provider SDK common type for quotation and AST support
  • FsAst untyped F# AST to code via the code formatter Fantomas
  • Froto protobuf parser and binary serializer
  • Fantomas code formatter and linter

Security

This repository is actively monitored by Jet Engineers and the Jet Security team. Please monitor this repo for security updates and advisories. For more information and contacts, please see SECURITY

falanx's People

Contributors

enricosada avatar 7sharp9 avatar kevmal avatar vbfox avatar vchekan avatar erichgoldman avatar gusty avatar haf avatar jorgef avatar mshulman avatar troykershaw avatar wuzzeb avatar natelkins avatar realvictorprm avatar azure-pipelines[bot] avatar vasily-kirichenko avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.