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.csproj
file, we can add direct detection for convention folders underProtobuf
, subfolders include:base
for protos which requiresContractBase
to be generatedcontract
for protos which requiresContractCode
to be generatedmessage
for protos which only require protobuf messages to be generatedreference
for protos which requireReferenceState
to be generatedstub
for protos which requireStub
s to be generated
- Currently this tool include
aelf/options.proto
andaelf/core.proto
(together with google native protos), we can consider addingacs
protos as well -
Add tests - Publish nuget packages