An MsBuild tool to compile AElf contracts using protobuf and an extension tool. It's based on the gRPC tool.
Add a local nuget source - this only needs to be done once.
nuget sources Add -Name Local -Source $env:UserProfile\LocalNuget
dotnet pack
nuget add .\bin\Debug\AElf.Tools.1.0.0.nupkg -Source $env:UserProfile\LocalNuget
<ItemGroup>
<PackageReference Include="AElf.Tools" Version="1.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Protobuf Include="Protobuf/base/*.proto">
<ContractOutputOptions>nocontract</ContractOutputOptions>
</Protobuf>
<Protobuf Include="Protobuf/contract/*.proto"/>
<Protobuf Include="Protobuf/message/*.proto">
<ContractOutputOptions>nocontract</ContractOutputOptions>
</Protobuf>
<Protobuf Include="Protobuf/reference/*.proto">
<ContractOutputOptions>reference</ContractOutputOptions>
<Access>Internal</Access>
</Protobuf>
<Protobuf Include="Protobuf/stub/*.proto">
<ContractOutputOptions>stub</ContractOutputOptions>
<Access>Internal</Access>
</Protobuf>
</ItemGroup>-
Clean up gRPC stuff (e.g. gRPC supports codegen for C++ which we don't need) -
Currently only Windows x64 binaries are included, we need to add binaries for other platforms -
Currently proto files have to be specified in.csprojfile, we can add direct detection for convention folders underProtobuf, subfolders include:basefor protos which requiresContractBaseto be generatedcontractfor protos which requiresContractCodeto be generatedmessagefor protos which only require protobuf messages to be generatedreferencefor protos which requireReferenceStateto be generatedstubfor protos which requireStubs to be generated
- Currently this tool include
aelf/options.protoandaelf/core.proto(together with google native protos), we can consider addingacsprotos as well -
Add tests - Publish nuget packages