blob: 6b907d067a31c6044bff76b4005c25c731ae193f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
version = "0.1.0"
author = "Oskari Timperi"
description = "protobuf library for Nim"
license = "MIT"
skipDirs = @["examples", "tests"]
bin = @["nimpb/compiler/nimpb_build"]
requires "nim >= 0.18.0"
# Hard dependency for now. In the future we could make nimpb_protoc download
# stuff on-demand which would make the dependency a bit lighter. Especially
# if a user already has the protoc compiler somewhere, in which case
# nimpb_protoc might be unnecessary.
requires "nimpb_protoc"
import ospaths, strformat
task run_conformance_tests, "Run the conformance test suite":
var testDir = "tests/conformance"
var proto = testDir / "test_messages_proto3.proto"
var testRunner = "../protobuf-3.5.1/conformance/conformance-test-runner"
exec &"./nimpb/compiler/nimpb_build -I{testDir} --out={testDir} {proto}"
exec &"nimble c {testDir}/conformance_nim.nim"
exec &"{testRunner} {testDir}/conformance_nim"
task gen_descriptor, "Re-generate nimpb/compiler/descriptor_pb.nim":
var incdir = "../nimpb_protoc/src/nimpb_protocpkg/protobuf/include/google/protobuf"
var descriptor = incdir / "descriptor.proto"
var outdir = "nimpb/compiler"
exec &"./nimpb/compiler/nimpb_build -I{incdir} --out={outdir} {descriptor}"
task gen_wkt, "Re-generate WKT's":
var incdir = "../nimpb_protoc/src/nimpb_protocpkg/protobuf/include/google/protobuf"
var outdir = "nimpb/wkt"
for proto in listFiles(incdir):
echo(&"COMPILING {proto}")
exec &"./nimpb/compiler/nimpb_build -I{incdir} --out={outdir} {proto}"
|