Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to spago@next #40

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Unreleased

- `spago@next` build system. Reorganized packages.

# v4.4.0 2024-10-15

Expand Down
39 changes: 25 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ We do not support

### Conformance and Testing

In this version, we pass all 651 of the
In this version, we pass all 684 of the
[Google conformance tests](https://github.com/protocolbuffers/protobuf/tree/main/conformance)
of binary-wire-format *proto3* for [Protocol Buffers v23.2](https://github.com/protocolbuffers/protobuf/releases/).
of binary-wire-format *proto3* for [Protocol Buffers v28.2](https://github.com/protocolbuffers/protobuf/releases/tag/v28.2).
See the `conformance/README.md` in this repository for details.

We also have our own unit tests, see `test/README.md` in this repository.
Expand All @@ -49,13 +49,15 @@ The `nix develop` environment provides
$ nix develop

PureScript Protobuf development environment
libprotoc 23.2
purs 0.15.8
node v18.16.0
libprotoc 28.2
node v20.15.1
purs 0.15.15
spago 0.93.40

To build the protoc compiler plugin, run:

spago -x spago-plugin.dhall build
cd plugin
spago build

To compile PureScript .purs files from .proto files, run for example:

Expand Down Expand Up @@ -244,13 +246,12 @@ programs which use code generated by __protobuf__. Refer to these
for further examples of how to use the generated code.

1. The `protoc`
[compiler plugin](https://github.com/xc-jp/purescript-protobuf/blob/master/plugin/ProtocPlugin/Main.purs).
The code generator imports generated code. Trippy, right? This program
literally writes itself.
[compiler plugin](https://github.com/xc-jp/purescript-protobuf/blob/master/plugin/src/ProtocPlugin/Main.purs).
The code generator imports generated code. This program writes itself.
2. The
[unit test suite](https://github.com/xc-jp/purescript-protobuf/blob/master/test/Main.purs)
[unit test suite](https://github.com/xc-jp/purescript-protobuf/blob/master/library/test/Main.purs)
3. The Google
[conformance test program](https://github.com/xc-jp/purescript-protobuf/blob/master/conformance/Main.purs)
[conformance test program](https://github.com/xc-jp/purescript-protobuf/blob/master/conformance/src/Main.purs)

The [Protobuf Decoder Explainer](http://jamesdbrock.github.io/protobuf-decoder-explainer/) shows an
example of how to use this library to parse binary Protobuf when we don’t
Expand Down Expand Up @@ -329,9 +330,19 @@ derivation. Include `protoc-gen-purescript` and `protobuf` as `nativeBuildInputs
Then `protoc --purescript_out=path_to_output file.proto` will be runnable
in our derivation phases.

(`protoc-gen-purescript` requires an impure build for the `spago2nix` step,
so you’ll have to grant
trust at the prompt or configure a relaxed Nix sandbox.)
Building `protoc-gen-purescript` requires an impure Nix build environment.

You might need in your `flake.nix`:

```
nixConfig.sandbox = "relaxed";
```

You might need in your `~/.config/nix.conf`:

```
experimental-features = nix-command flakes configurable-impure-env auto-allocate-uids
```

The `flake.nix` provides the Google Protocol Buffers conformance tests
as an `app`. To run the conformance tests right now
Expand Down
2 changes: 1 addition & 1 deletion bin/conformance-purescript
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/usr/bin/env bash
node --input-type=module -e "import {main} from './output/Conformance.Main/index.js'; main();"
node --input-type=module --abort-on-uncaught-exception --trace-sigint --trace-uncaught -e "import {main} from 'conformance/output/Conformance.Main/index.js'; main();"
2 changes: 1 addition & 1 deletion bin/protoc-gen-purescript
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/usr/bin/env bash
node --input-type=module -e "import {main} from './output/ProtocPlugin.Main/index.js'; main();"
node --input-type=module -e "import {main} from 'plugin/output/ProtocPlugin.Main/index.js'; main();"
44 changes: 0 additions & 44 deletions bower.json

This file was deleted.

4 changes: 2 additions & 2 deletions conformance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ The derivations in `nix/protobuf.nix` will build `protoc` and the
To generate the conformance `.purs` in the dev environment:

```console
protoc --purescript_out=./conformance/generated --proto_path=$(nix path-info .#protobuf)/conformance $(nix path-info .#protobuf)/conformance/conformance.proto
protoc --purescript_out=./conformance/src/generated --proto_path=$(nix path-info .#protobuf)/conformance $(nix path-info .#protobuf)/conformance/conformance.proto
```
```console
protoc --purescript_out=./conformance/generated --proto_path=$(nix path-info .#protobuf)/src $(nix path-info .#protobuf)/src/google/protobuf/test_messages_proto3.proto
protoc --purescript_out=./conformance/src/generated --proto_path=$(nix path-info .#protobuf)/src $(nix path-info .#protobuf)/src/google/protobuf/test_messages_proto3.proto
```
1 change: 0 additions & 1 deletion conformance/generated/.gitignore

This file was deleted.

Loading
Loading