@@ -30,9 +30,9 @@ We do not support
30
30
31
31
### Conformance and Testing
32
32
33
- In this version, we pass all 651 of the
33
+ In this version, we pass all 684 of the
34
34
[ Google conformance tests] ( https://github.com/protocolbuffers/protobuf/tree/main/conformance )
35
- of binary-wire-format * proto3* for [ Protocol Buffers v23 .2] ( https://github.com/protocolbuffers/protobuf/releases/ ) .
35
+ of binary-wire-format * proto3* for [ Protocol Buffers v28 .2] ( https://github.com/protocolbuffers/protobuf/releases/tag/v28.2 ) .
36
36
See the ` conformance/README.md ` in this repository for details.
37
37
38
38
We also have our own unit tests, see ` test/README.md ` in this repository.
@@ -50,13 +50,15 @@ The `nix develop` environment provides
50
50
$ nix develop
51
51
52
52
PureScript Protobuf development environment
53
- libprotoc 23.2
54
- purs 0.15.8
55
- node v18.16.0
53
+ libprotoc 28.2
54
+ node v20.15.1
55
+ purs 0.15.15
56
+ spago 0.93.40
56
57
57
58
To build the protoc compiler plugin, run:
58
59
59
- spago -x spago-plugin.dhall build
60
+ cd plugin
61
+ spago build
60
62
61
63
To compile PureScript .purs files from .proto files, run for example:
62
64
@@ -65,19 +67,30 @@ To compile PureScript .purs files from .proto files, run for example:
65
67
66
68
We can test out code generation immediately by
67
69
generating ` .purs ` files for any of Google’s built-in “well-known types” in the
68
- [ ` google.protobuf ` ] ( https://protobuf.dev/reference/protobuf/google.protobuf/ ) package namespace. Try the command ` protoc --purescript_out=. google/protobuf/any.proto `
69
- or ` protoc --purescript_out=. google/protobuf/timestamp.proto ` .
70
+ [ ` google.protobuf ` ] ( https://protobuf.dev/reference/protobuf/google.protobuf/ ) package namespace. Try the command
71
+ ``` console
72
+ protoc --purescript_out=. google/protobuf/any.proto
73
+ ```
74
+ or
75
+ ``` console
76
+ protoc --purescript_out=. google/protobuf/timestamp.proto
77
+ ```
70
78
71
79
To see
72
80
[ all of the ` .proto ` definitions] ( https://github.com/protocolbuffers/protobuf/tree/main/src/google/protobuf )
73
81
included with the Nix PureScript Protobuf installation including
74
82
the “well-known types,”
75
- ` ls $(nix path-info .#protobuf)/src/google/protobuf/*.proto `
83
+ ``` console
84
+ ls $(nix path-info .#protobuf)/src/google/protobuf/*.proto
85
+ ```
76
86
77
- If you don't want to use Nix, then install the PureScript toolchain and ` protoc ` ,
78
- and add the executable script
79
- [ ` bin/protoc-gen-purescript ` ] ( bin/protoc-gen-purescript )
80
- to your ` PATH ` .
87
+ If you don't want to use Nix,
88
+ 1 . install the PureScript toolchain and ` protoc ` .
89
+ 2 . Build the [ PureScript plugin for ` protoc ` ] ( plugin/ ) .
90
+ 3 . Run ` protoc ` with the path to the PureScript plugin executable, like for example
91
+ ``` console
92
+ protoc --plugin=bin/protoc-gen-purescript --purescript_out=. google/protobuf/timestamp.proto
93
+ ```
81
94
82
95
## Writing programs with the generated code
83
96
@@ -245,13 +258,12 @@ programs which use code generated by __protobuf__. Refer to these
245
258
for further examples of how to use the generated code.
246
259
247
260
1 . The ` protoc `
248
- [ compiler plugin] ( https://github.com/xc-jp/purescript-protobuf/blob/master/plugin/ProtocPlugin/Main.purs ) .
249
- The code generator imports generated code. Trippy, right? This program
250
- literally writes itself.
261
+ [ compiler plugin] ( https://github.com/xc-jp/purescript-protobuf/blob/master/plugin/src/ProtocPlugin/Main.purs ) .
262
+ The code generator imports generated code. This program writes itself.
251
263
2 . The
252
- [ unit test suite] ( https://github.com/xc-jp/purescript-protobuf/blob/master/test/Main.purs )
264
+ [ unit test suite] ( https://github.com/xc-jp/purescript-protobuf/blob/master/library/ test/Main.purs )
253
265
3 . The Google
254
- [ conformance test program] ( https://github.com/xc-jp/purescript-protobuf/blob/master/conformance/Main.purs )
266
+ [ conformance test program] ( https://github.com/xc-jp/purescript-protobuf/blob/master/conformance/src/ Main.purs )
255
267
256
268
The [ Protobuf Decoder Explainer] ( http://jamesdbrock.github.io/protobuf-decoder-explainer/ ) shows an
257
269
example of how to use this library to parse binary Protobuf when we don’t
@@ -317,10 +329,11 @@ For that reason, we can only use top-level
317
329
### PureScript Imports
318
330
319
331
The generated PureScript code will usually have module imports which cause
320
- the ` purs ` compiler to emit redundant import warnings. Sorry. If this causes
332
+ the ` purs ` compiler to emit ` ImplicitQualifiedImport ` warnings. Sorry. If this causes
321
333
trouble then the imports can be fixed automatically in a precompiling pass
322
334
with the command-line tool
323
335
[ __ suggest__ ] ( https://github.com/nwolverson/purescript-suggest ) .
336
+ Or you can [ censor the warnings] ( https://discourse.purescript.org/t/suppressing-warnings-in-code/2485 ) .
324
337
325
338
## Nix derivation
326
339
@@ -330,9 +343,19 @@ derivation. Include `protoc-gen-purescript` and `protobuf` as `nativeBuildInputs
330
343
Then ` protoc --purescript_out=path_to_output file.proto ` will be runnable
331
344
in our derivation phases.
332
345
333
- (` protoc-gen-purescript ` requires an impure build for the ` spago2nix ` step,
334
- so you’ll have to grant
335
- trust at the prompt or configure a relaxed Nix sandbox.)
346
+ Building ` protoc-gen-purescript ` requires an impure Nix build environment.
347
+
348
+ You might need in your ` flake.nix ` :
349
+
350
+ ```
351
+ nixConfig.sandbox = "relaxed";
352
+ ```
353
+
354
+ You might need in your ` ~/.config/nix.conf ` :
355
+
356
+ ```
357
+ experimental-features = nix-command flakes configurable-impure-env auto-allocate-uids
358
+ ```
336
359
337
360
The ` flake.nix ` provides the Google Protocol Buffers conformance tests
338
361
as an ` app ` . To run the conformance tests right now
0 commit comments