From 21045c19a89d301d7383c336de9a9140e1fafae0 Mon Sep 17 00:00:00 2001 From: James Brock Date: Tue, 15 Oct 2024 18:19:40 +0900 Subject: [PATCH] Migrate to spago@next --- conformance/{ => src}/Main.purs | 0 flake.lock | 142 +- flake.nix | 418 +++-- library/spago.lock | 794 +++++++++ library/spago.yaml | 39 + .../src}/Protobuf/Internal/Common.purs | 0 .../src}/Protobuf/Internal/Decode.js | 0 .../src}/Protobuf/Internal/Decode.purs | 0 .../src}/Protobuf/Internal/Encode.purs | 0 .../src}/Protobuf/Internal/Prelude.purs | 0 .../src}/Protobuf/Internal/Runtime.purs | 0 {src => library/src}/Protobuf/Library.purs | 0 nix/protobuf.nix | 23 + plugin/spago.lock | 1547 +++++++++++++++++ plugin/spago.yaml | 27 + plugin/{ => src}/ProtocPlugin/Main.purs | 0 .../descriptor.Google.Protobuf.purs | 0 .../plugin.Google.Protobuf.Compiler.purs | 0 {test => plugin/test}/README.md | 2 +- {test => plugin/test/Test}/Bench.purs | 0 {test => plugin/test/Test}/Main.purs | 0 .../test/Test}/generated/README.md | 0 .../Test/generated/empty.Google.Protobuf.purs | 61 + plugin/test/Test/generated/msg1.Pack.purs | 188 ++ plugin/test/Test/generated/msg2.Pack.purs | 227 +++ plugin/test/Test/generated/msg3.Pack3.purs | 120 ++ plugin/test/Test/generated/msg4.Pack4.purs | 212 +++ plugin/test/Test/generated/msg5.Pack5.purs | 232 +++ plugin/test/Test/generated/msg5_1.Pack5.purs | 58 + plugin/test/Test/generated/msg6.Pack6.purs | 64 + plugin/test/Test/generated/msg7.Pack7.purs | 58 + {test => plugin/test}/msg1.proto | 0 {test => plugin/test}/msg2.proto | 0 {test => plugin/test}/msg3.proto | 0 {test => plugin/test}/msg4.proto | 0 {test => plugin/test}/msg5.proto | 0 {test => plugin/test}/msg5_1.proto | 0 {test => plugin/test}/msg6.proto | 0 {test => plugin/test}/msg7.proto | 0 test/generated/.gitignore | 1 - 40 files changed, 3953 insertions(+), 260 deletions(-) rename conformance/{ => src}/Main.purs (100%) create mode 100644 library/spago.lock create mode 100644 library/spago.yaml rename {src => library/src}/Protobuf/Internal/Common.purs (100%) rename {src => library/src}/Protobuf/Internal/Decode.js (100%) rename {src => library/src}/Protobuf/Internal/Decode.purs (100%) rename {src => library/src}/Protobuf/Internal/Encode.purs (100%) rename {src => library/src}/Protobuf/Internal/Prelude.purs (100%) rename {src => library/src}/Protobuf/Internal/Runtime.purs (100%) rename {src => library/src}/Protobuf/Library.purs (100%) create mode 100644 plugin/spago.lock create mode 100644 plugin/spago.yaml rename plugin/{ => src}/ProtocPlugin/Main.purs (100%) rename plugin/{ => src}/ProtocPlugin/descriptor.Google.Protobuf.purs (100%) rename plugin/{ => src}/ProtocPlugin/plugin.Google.Protobuf.Compiler.purs (100%) rename {test => plugin/test}/README.md (90%) rename {test => plugin/test/Test}/Bench.purs (100%) rename {test => plugin/test/Test}/Main.purs (100%) rename {test => plugin/test/Test}/generated/README.md (100%) create mode 100644 plugin/test/Test/generated/empty.Google.Protobuf.purs create mode 100644 plugin/test/Test/generated/msg1.Pack.purs create mode 100644 plugin/test/Test/generated/msg2.Pack.purs create mode 100644 plugin/test/Test/generated/msg3.Pack3.purs create mode 100644 plugin/test/Test/generated/msg4.Pack4.purs create mode 100644 plugin/test/Test/generated/msg5.Pack5.purs create mode 100644 plugin/test/Test/generated/msg5_1.Pack5.purs create mode 100644 plugin/test/Test/generated/msg6.Pack6.purs create mode 100644 plugin/test/Test/generated/msg7.Pack7.purs rename {test => plugin/test}/msg1.proto (100%) rename {test => plugin/test}/msg2.proto (100%) rename {test => plugin/test}/msg3.proto (100%) rename {test => plugin/test}/msg4.proto (100%) rename {test => plugin/test}/msg5.proto (100%) rename {test => plugin/test}/msg5_1.proto (100%) rename {test => plugin/test}/msg6.proto (100%) rename {test => plugin/test}/msg7.proto (100%) delete mode 100644 test/generated/.gitignore diff --git a/conformance/Main.purs b/conformance/src/Main.purs similarity index 100% rename from conformance/Main.purs rename to conformance/src/Main.purs diff --git a/flake.lock b/flake.lock index 44d3a55..0fa8481 100644 --- a/flake.lock +++ b/flake.lock @@ -1,36 +1,18 @@ { "nodes": { - "easy-purescript-nix": { - "inputs": { - "flake-utils": "flake-utils" - }, - "locked": { - "lastModified": 1685892271, - "narHash": "sha256-VgBowaSVbO9Uhw7lm//FiOvXXM4CT2Dfpth3pDqtaV8=", - "owner": "justinwoo", - "repo": "easy-purescript-nix", - "rev": "27e01251c981215afb3c04989ca9a6b0b8378c8b", - "type": "github" - }, - "original": { - "owner": "justinwoo", - "repo": "easy-purescript-nix", - "type": "github" - } - }, - "easy-purescript-nix_2": { + "flake-compat": { "flake": false, "locked": { - "lastModified": 1670198178, - "narHash": "sha256-5KkyNpPakv4xIP2ba0S5GX+dcmd3AcO9kPhwa482BbA=", - "owner": "justinwoo", - "repo": "easy-purescript-nix", - "rev": "7a4cb3cd6ca53566ea1675692eab0aa13907ff09", + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "type": "github" }, "original": { - "owner": "justinwoo", - "repo": "easy-purescript-nix", + "owner": "edolstra", + "repo": "flake-compat", "type": "github" } }, @@ -52,96 +34,69 @@ "type": "github" } }, - "flake-utils_2": { - "inputs": { - "systems": "systems_2" - }, - "locked": { - "lastModified": 1685518550, - "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_3": { - "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "nixpkgs": { "locked": { - "lastModified": 1685801374, - "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=", + "lastModified": 1728740863, + "narHash": "sha256-u+rxA79a0lyhG+u+oPBRtTDtzz8kvkc9a6SWSt9ekVc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c37ca420157f4abc31e26f436c1145f8951ff373", + "rev": "a3f9ad65a0bf298ed5847629a57808b97e6e8077", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-23.05", + "ref": "nixos-24.05", "repo": "nixpkgs", "type": "github" } }, - "nixpkgs_2": { + "purescript-overlay": { + "inputs": { + "flake-compat": "flake-compat", + "nixpkgs": [ + "nixpkgs" + ], + "slimlock": "slimlock" + }, "locked": { - "lastModified": 1670507980, - "narHash": "sha256-riNZa0xzM1it3pzxciwALeMs+0CsBMWIW2FqulzK8vM=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "2787fc7d1e51404678614bf0fe92fc296746eec0", + "lastModified": 1728546539, + "narHash": "sha256-Sws7w0tlnjD+Bjck1nv29NjC5DbL6nH5auL9Ex9Iz2A=", + "owner": "thomashoneyman", + "repo": "purescript-overlay", + "rev": "4ad4c15d07bd899d7346b331f377606631eb0ee4", "type": "github" }, "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", + "owner": "thomashoneyman", + "repo": "purescript-overlay", "type": "github" } }, "root": { "inputs": { - "easy-purescript-nix": "easy-purescript-nix", - "flake-utils": "flake-utils_2", + "flake-utils": "flake-utils", "nixpkgs": "nixpkgs", - "spago2nix": "spago2nix" + "purescript-overlay": "purescript-overlay" } }, - "spago2nix": { + "slimlock": { "inputs": { - "easy-purescript-nix": "easy-purescript-nix_2", - "flake-utils": "flake-utils_3", - "nixpkgs": "nixpkgs_2" + "nixpkgs": [ + "purescript-overlay", + "nixpkgs" + ] }, "locked": { - "lastModified": 1671225584, - "narHash": "sha256-h9r67pmvDuA3TV9299L4CN60XSm8RRtX1EwUoKu9Pyw=", - "owner": "justinwoo", - "repo": "spago2nix", - "rev": "1b8ec352bc7eac077b934d6b9f6efa0129926e59", + "lastModified": 1688756706, + "narHash": "sha256-xzkkMv3neJJJ89zo3o2ojp7nFeaZc2G0fYwNXNJRFlo=", + "owner": "thomashoneyman", + "repo": "slimlock", + "rev": "cf72723f59e2340d24881fd7bf61cb113b4c407c", "type": "github" }, "original": { - "owner": "justinwoo", - "repo": "spago2nix", + "owner": "thomashoneyman", + "repo": "slimlock", "type": "github" } }, @@ -159,21 +114,6 @@ "repo": "default", "type": "github" } - }, - "systems_2": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 8f5e08d..b50a351 100644 --- a/flake.nix +++ b/flake.nix @@ -1,174 +1,278 @@ { description = "PureScript Protobuf"; - - # for spago2nix - nixConfig.sandbox = "relaxed"; - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; - flake-utils.url = "github:numtide/flake-utils"; - easy-purescript-nix = { - url = "github:justinwoo/easy-purescript-nix"; - # inputs.nixpkgs.follow = "nixpkgs"; + nixpkgs.url = github:NixOS/nixpkgs/nixos-24.05; + flake-utils = { + url = "github:numtide/flake-utils"; }; - spago2nix = { - url = "github:justinwoo/spago2nix"; + purescript-overlay = { + url = "github:thomashoneyman/purescript-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; }; }; - outputs = { self, ... }@inputs: - inputs.flake-utils.lib.eachDefaultSystem (system: + outputs = { self, nixpkgs, ... }@inputs: let + supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]; - nixpkgs = inputs.nixpkgs.legacyPackages.${system}; - easy-purescript-nix = import inputs.easy-purescript-nix {pkgs = nixpkgs;}; - protobufs = (import ./nix/protobuf.nix {pkgs = nixpkgs;}); - protobuf = protobufs.protobuf_v23_2; + forAllSystems = nixpkgs.lib.genAttrs supportedSystems; - purs = easy-purescript-nix.purs-0_15_8; - nodejs = nixpkgs.nodejs-18_x; - - protoc-gen-purescript = nixpkgs.stdenv.mkDerivation { - name = "protoc-gen-purescript"; - nativeBuildInputs = [ - nodejs - purs - ] ++ ( - inputs.spago2nix.packages.${system}.spago2nix_nativeBuildInputs { - spago-dhall = "spago-plugin.dhall"; - srcs-dhall = [ - ./spago-plugin.dhall - ./spago.dhall - ./packages.dhall - ]; - }); - src = nixpkgs.nix-gitignore.gitignoreSource [ ".git" ] ./.; - unpackPhase = '' - cp -r $src/src . - cp -r $src/plugin . - ''; - buildPhase = '' - install-spago-style - build-spago-style "./src/**/*.purs" "./plugin/**/*.purs" - ''; - installPhase = '' - mkdir -p $out/bin - mv output $out/ - echo "#!/usr/bin/env bash" >> $out/bin/protoc-gen-purescript - echo "${nodejs}/bin/node --input-type=module -e \"import {main} from '$out/output/ProtocPlugin.Main/index.js'; main();\"" >> $out/bin/protoc-gen-purescript - chmod +x $out/bin/protoc-gen-purescript - ''; + library-overlay = prev: final: { + protobuf-library = prev.stdenv.mkDerivation { + name = "purescript-protobuf"; + src = ./library/spago.lock; + phases = ["installPhase"]; + # json = builtins.fromJSON (builtins.readFile src); + installPhase = '' + mkdir -p $out + cp -R $src $out/spago.lock + ls -l $out/ + echo "TEST" + ''; + }; }; - conformance-purescript = nixpkgs.stdenv.mkDerivation { - name = "conformance-purescript"; - nativeBuildInputs = [ - nodejs - purs - protoc-gen-purescript - protobuf - ] ++ ( - inputs.spago2nix.packages.${system}.spago2nix_nativeBuildInputs { - spago-dhall = "spago-conformance.dhall"; - srcs-dhall = [ - ./spago-conformance.dhall - ./spago.dhall - ./packages.dhall - ]; - }); - src = nixpkgs.nix-gitignore.gitignoreSource [ ".git" ] ./.; - unpackPhase = '' - cp -r $src/src . - cp -r $src/conformance . - ''; - buildPhase = '' - install-spago-style - mkdir generated - protoc --purescript_out=./generated --proto_path=${protobuf}/src --proto_path=${protobuf}/conformance ${protobuf}/conformance/conformance.proto - protoc --purescript_out=./generated --proto_path=${protobuf}/src --proto_path=${protobuf}/conformance ${protobuf}/src/google/protobuf/test_messages_proto3.proto - build-spago-style "./src/**/*.purs" "./conformance/**/*.purs" "./generated/**/*.purs" - ''; - installPhase = '' - mkdir -p $out/bin - mv output $out/ - echo "#!/usr/bin/env bash" >> $out/bin/conformance-purescript - echo "${nodejs}/bin/node --input-type=module --abort-on-uncaught-exception --trace-sigint --trace-uncaught --eval=\"import {main} from '$out/output/Conformance.Main/index.js'; main();\"" >> $out/bin/conformance-purescript - chmod +x $out/bin/conformance-purescript - ''; - }; + nixpkgsFor = forAllSystems (system: import nixpkgs { + inherit system; + config = { }; + overlays = builtins.attrValues self.overlays ++ [ + (prev: final: import ./nix/protobuf.nix {pkgs = prev;}) + (prev: final: { + # This plugin path won't work because it's relative to the pwd + protoc-gen-purescript = prev.writeScriptBin "protoc-gen-purescript" '' + ${prev.nodejs}/bin/node --input-type=module -e "import {main} from './plugin/output/ProtocPlugin.Main/index.js'; main();" + ''; + } + ) + library-overlay + ]; + }); in { - devShells.default = nixpkgs.mkShell { - nativeBuildInputs = [ - purs - nodejs - easy-purescript-nix.spago - easy-purescript-nix.pulp - protobuf - nixpkgs.nodePackages.bower - easy-purescript-nix.psc-package - nixpkgs.dhall - nixpkgs.dhall-json - protoc-gen-purescript - ]; - shellHook = '' - source <(spago --bash-completion-script `which spago`) - source <(node --completion-bash) - export PURS_IDE_SOURCES=$(${easy-purescript-nix.spago}/bin/spago -x spago-dev.dhall sources) - echo "PureScript Protobuf development environment" - protoc --version - echo -n "purs " - purs --version - echo -n "node " - node --version - echo "" - echo "To build the protoc compiler plugin, run:" - echo "" - echo " spago -x spago-plugin.dhall build" - echo "" - echo "To compile PureScript .purs files from .proto files, run for example:" - echo "" - echo " protoc --purescript_out=. google/protobuf/timestamp.proto" - echo "" - ''; - LC_ALL = "C.UTF-8"; # https://github.com/purescript/spago/issues/507 - # https://github.com/nwolverson/vscode-ide-purescript/issues/104 - # https://github.com/nwolverson/purescript-language-server/pull/75 - # https://github.com/nwolverson/purescript-language-server/issues/175 - # PURS_IDE_SOURCES = "'src/**/*.purs plugin/**/*.purs test/**/*.purs conformance/**/*.purs .spago/**/*.purs'"; - }; - packages = { - inherit protoc-gen-purescript; - inherit protobuf; - inherit (protobufs) protobuf_v21_10; - inherit (protobufs) protobuf_v23_2; + overlays = { + purescript = inputs.purescript-overlay.overlays.default; }; - apps = { - protoc = { - type = "app"; - program = "${protobuf}/bin/protoc"; - }; - protoc-gen-purescript = { - type = "app"; - program = "${protoc-gen-purescript}/bin/protoc-gen-purescript"; - }; - conformance_test_runner = { - type = "app"; - program = "${protobuf}/bin/conformance_test_runner"; - }; - conformance = - let - conformance-run = nixpkgs.writeScriptBin "conformance" '' - set -e - set -x - ${protobuf}/bin/conformance_test_runner --enforce_recommended ${conformance-purescript}/bin/conformance-purescript - ''; - in - { - type = "app"; - program = "${conformance-run}/bin/conformance"; + + packages = forAllSystems (system: + let pkgs = nixpkgsFor.${system}; in { + protobuf = pkgs.protobuf_v28_2; + }); + + devShells = forAllSystems (system: + # pkgs now has access to the standard PureScript toolchain + let pkgs = nixpkgsFor.${system}; in { + default = pkgs.mkShell { + name = "protobuf-dev"; + inputsFrom = builtins.attrValues self.packages.${system}; + buildInputs = with pkgs; [ + purs + spago-unstable + purs-tidy-bin.purs-tidy-0_10_0 + purs-backend-es + purescript-language-server + nodejs + protobuf_v28_2 + protoc-gen-purescript + protobuf-library + ]; + + shellHook = '' + source <(spago --bash-completion-script `which spago`) + source <(node --completion-bash) + export PURS_IDE_SOURCES=$(pushd plugin;${pkgs.spago-unstable}/bin/spago sources;popd) + echo "PureScript Protobuf development environment" + protoc --version + echo -n "purs " + purs --version + echo -n "node " + node --version + echo "" + echo "To build the protoc compiler plugin, run:" + echo "" + echo " cd plugin; spago build" + echo "" + echo "To compile PureScript .purs files from .proto files, run for example:" + echo "" + echo " protoc --purescript_out=. google/protobuf/timestamp.proto" + echo ""''; }; - }; - } - ); + }); + }; } + + +# { +# description = "PureScript Protobuf"; +# +# # for spago2nix +# nixConfig.sandbox = "relaxed"; +# +# inputs = { +# nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; +# flake-utils.url = "github:numtide/flake-utils"; +# easy-purescript-nix = { +# url = "github:justinwoo/easy-purescript-nix"; +# # inputs.nixpkgs.follow = "nixpkgs"; +# }; +# spago2nix = { +# url = "github:justinwoo/spago2nix"; +# }; +# }; +# +# outputs = { self, ... }@inputs: +# inputs.flake-utils.lib.eachDefaultSystem (system: +# let +# +# nixpkgs = inputs.nixpkgs.legacyPackages.${system}; +# easy-purescript-nix = import inputs.easy-purescript-nix {pkgs = nixpkgs;}; +# protobufs = (import ./nix/protobuf.nix {pkgs = nixpkgs;}); +# protobuf = protobufs.protobuf_v23_2; +# +# purs = easy-purescript-nix.purs-0_15_8; +# nodejs = nixpkgs.nodejs-18_x; +# +# protoc-gen-purescript = nixpkgs.stdenv.mkDerivation { +# name = "protoc-gen-purescript"; +# nativeBuildInputs = [ +# nodejs +# purs +# ] ++ ( +# inputs.spago2nix.packages.${system}.spago2nix_nativeBuildInputs { +# spago-dhall = "spago-plugin.dhall"; +# srcs-dhall = [ +# ./spago-plugin.dhall +# ./spago.dhall +# ./packages.dhall +# ]; +# }); +# src = nixpkgs.nix-gitignore.gitignoreSource [ ".git" ] ./.; +# unpackPhase = '' +# cp -r $src/src . +# cp -r $src/plugin . +# ''; +# buildPhase = '' +# install-spago-style +# build-spago-style "./src/**/*.purs" "./plugin/**/*.purs" +# ''; +# installPhase = '' +# mkdir -p $out/bin +# mv output $out/ +# echo "#!/usr/bin/env bash" >> $out/bin/protoc-gen-purescript +# echo "${nodejs}/bin/node --input-type=module -e \"import {main} from '$out/output/ProtocPlugin.Main/index.js'; main();\"" >> $out/bin/protoc-gen-purescript +# chmod +x $out/bin/protoc-gen-purescript +# ''; +# }; +# +# conformance-purescript = nixpkgs.stdenv.mkDerivation { +# name = "conformance-purescript"; +# nativeBuildInputs = [ +# nodejs +# purs +# protoc-gen-purescript +# protobuf +# ] ++ ( +# inputs.spago2nix.packages.${system}.spago2nix_nativeBuildInputs { +# spago-dhall = "spago-conformance.dhall"; +# srcs-dhall = [ +# ./spago-conformance.dhall +# ./spago.dhall +# ./packages.dhall +# ]; +# }); +# src = nixpkgs.nix-gitignore.gitignoreSource [ ".git" ] ./.; +# unpackPhase = '' +# cp -r $src/src . +# cp -r $src/conformance . +# ''; +# buildPhase = '' +# install-spago-style +# mkdir generated +# protoc --purescript_out=./generated --proto_path=${protobuf}/src --proto_path=${protobuf}/conformance ${protobuf}/conformance/conformance.proto +# protoc --purescript_out=./generated --proto_path=${protobuf}/src --proto_path=${protobuf}/conformance ${protobuf}/src/google/protobuf/test_messages_proto3.proto +# build-spago-style "./src/**/*.purs" "./conformance/**/*.purs" "./generated/**/*.purs" +# ''; +# installPhase = '' +# mkdir -p $out/bin +# mv output $out/ +# echo "#!/usr/bin/env bash" >> $out/bin/conformance-purescript +# echo "${nodejs}/bin/node --input-type=module --abort-on-uncaught-exception --trace-sigint --trace-uncaught --eval=\"import {main} from '$out/output/Conformance.Main/index.js'; main();\"" >> $out/bin/conformance-purescript +# chmod +x $out/bin/conformance-purescript +# ''; +# }; +# +# in { +# devShells.default = nixpkgs.mkShell { +# nativeBuildInputs = [ +# purs +# nodejs +# easy-purescript-nix.spago +# easy-purescript-nix.pulp +# protobuf +# nixpkgs.nodePackages.bower +# easy-purescript-nix.psc-package +# nixpkgs.dhall +# nixpkgs.dhall-json +# protoc-gen-purescript +# ]; +# shellHook = '' +# source <(spago --bash-completion-script `which spago`) +# source <(node --completion-bash) +# export PURS_IDE_SOURCES=$(${easy-purescript-nix.spago}/bin/spago -x spago-dev.dhall sources) +# echo "PureScript Protobuf development environment" +# protoc --version +# echo -n "purs " +# purs --version +# echo -n "node " +# node --version +# echo "" +# echo "To build the protoc compiler plugin, run:" +# echo "" +# echo " spago -x spago-plugin.dhall build" +# echo "" +# echo "To compile PureScript .purs files from .proto files, run for example:" +# echo "" +# echo " protoc --purescript_out=. google/protobuf/timestamp.proto" +# echo "" +# ''; +# LC_ALL = "C.UTF-8"; # https://github.com/purescript/spago/issues/507 +# # https://github.com/nwolverson/vscode-ide-purescript/issues/104 +# # https://github.com/nwolverson/purescript-language-server/pull/75 +# # https://github.com/nwolverson/purescript-language-server/issues/175 +# # PURS_IDE_SOURCES = "'src/**/*.purs plugin/**/*.purs test/**/*.purs conformance/**/*.purs .spago/**/*.purs'"; +# }; +# packages = { +# inherit protoc-gen-purescript; +# inherit protobuf; +# inherit (protobufs) protobuf_v21_10; +# inherit (protobufs) protobuf_v23_2; +# }; +# apps = { +# protoc = { +# type = "app"; +# program = "${protobuf}/bin/protoc"; +# }; +# protoc-gen-purescript = { +# type = "app"; +# program = "${protoc-gen-purescript}/bin/protoc-gen-purescript"; +# }; +# conformance_test_runner = { +# type = "app"; +# program = "${protobuf}/bin/conformance_test_runner"; +# }; +# conformance = +# let +# conformance-run = nixpkgs.writeScriptBin "conformance" '' +# set -e +# set -x +# ${protobuf}/bin/conformance_test_runner --enforce_recommended ${conformance-purescript}/bin/conformance-purescript +# ''; +# in +# { +# type = "app"; +# program = "${conformance-run}/bin/conformance"; +# }; +# }; +# } +# ); +# } +# \ No newline at end of file diff --git a/library/spago.lock b/library/spago.lock new file mode 100644 index 0000000..7524ec2 --- /dev/null +++ b/library/spago.lock @@ -0,0 +1,794 @@ +{ + "workspace": { + "packages": { + "protobuf": { + "path": "./", + "core": { + "dependencies": [ + { + "arraybuffer": ">=13.1.1 <14.0.0" + }, + { + "arraybuffer-builder": ">=3.1.0 <4.0.0" + }, + { + "arraybuffer-types": ">=3.0.2 <4.0.0" + }, + { + "arrays": ">=7.2.0 <8.0.0" + }, + { + "control": ">=6.0.0 <7.0.0" + }, + { + "effect": ">=4.0.0 <5.0.0" + }, + { + "either": ">=6.1.0 <7.0.0" + }, + { + "exceptions": ">=6.0.0 <7.0.0" + }, + { + "float32": ">=2.0.0 <3.0.0" + }, + { + "foldable-traversable": ">=6.0.0 <7.0.0" + }, + { + "functions": ">=6.0.0 <7.0.0" + }, + { + "int64": ">=3.0.0 <4.0.0" + }, + { + "lists": ">=7.0.0 <8.0.0" + }, + { + "maybe": ">=6.0.0 <7.0.0" + }, + { + "newtype": ">=5.0.0 <6.0.0" + }, + { + "parsing": ">=10.2.0 <11.0.0" + }, + { + "parsing-dataview": ">=3.2.4 <4.0.0" + }, + { + "prelude": ">=6.0.1 <7.0.0" + }, + { + "record": ">=4.0.0 <5.0.0" + }, + { + "strings": ">=6.0.1 <7.0.0" + }, + { + "tailrec": ">=6.1.0 <7.0.0" + }, + { + "transformers": ">=6.0.0 <7.0.0" + }, + { + "tuples": ">=7.0.0 <8.0.0" + }, + { + "uint": ">=7.0.0 <8.0.0" + }, + { + "web-encoding": ">=3.0.0 <4.0.0" + } + ], + "build_plan": [ + "arraybuffer", + "arraybuffer-builder", + "arraybuffer-types", + "arrays", + "bifunctors", + "const", + "contravariant", + "control", + "distributive", + "effect", + "either", + "enums", + "exceptions", + "exists", + "float32", + "foldable-traversable", + "foreign", + "functions", + "functors", + "gen", + "identity", + "int64", + "integers", + "invariant", + "lazy", + "lists", + "maybe", + "newtype", + "nonempty", + "nullable", + "numbers", + "orders", + "parsing", + "parsing-dataview", + "partial", + "prelude", + "profunctor", + "record", + "refs", + "safe-coerce", + "st", + "strings", + "tailrec", + "transformers", + "tuples", + "type-equality", + "uint", + "unfoldable", + "unicode", + "unsafe-coerce", + "web-encoding" + ] + }, + "test": { + "dependencies": [], + "build_plan": [] + } + } + }, + "extra_packages": {} + }, + "packages": { + "arraybuffer": { + "type": "registry", + "version": "13.2.0", + "integrity": "sha256-fNsR19aRqcUis9C28MpyMigIlfX6f6Hq1up4IcTOvDU=", + "dependencies": [ + "arraybuffer-types", + "arrays", + "effect", + "float32", + "functions", + "gen", + "maybe", + "nullable", + "prelude", + "tailrec", + "uint", + "unfoldable" + ] + }, + "arraybuffer-builder": { + "type": "registry", + "version": "3.1.0", + "integrity": "sha256-dsNYehLsY5xzp/h9hgbn4cMhS+2hVuLzHLg//aPPCs4=", + "dependencies": [ + "arraybuffer", + "arraybuffer-types", + "effect", + "float32", + "identity", + "lists", + "maybe", + "newtype", + "prelude", + "tailrec", + "transformers", + "uint" + ] + }, + "arraybuffer-types": { + "type": "registry", + "version": "3.0.2", + "integrity": "sha256-mQKokysYVkooS4uXbO+yovmV/s8b138Ws3zQvOwIHRA=", + "dependencies": [] + }, + "arrays": { + "type": "registry", + "version": "7.3.0", + "integrity": "sha256-tmcklBlc/muUtUfr9RapdCPwnlQeB3aSrC4dK85gQlc=", + "dependencies": [ + "bifunctors", + "control", + "foldable-traversable", + "functions", + "maybe", + "nonempty", + "partial", + "prelude", + "safe-coerce", + "st", + "tailrec", + "tuples", + "unfoldable", + "unsafe-coerce" + ] + }, + "bifunctors": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-/gZwC9YhNxZNQpnHa5BIYerCGM2jeX9ukZiEvYxm5Nw=", + "dependencies": [ + "const", + "either", + "newtype", + "prelude", + "tuples" + ] + }, + "const": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-tNrxDW8D8H4jdHE2HiPzpLy08zkzJMmGHdRqt5BQuTc=", + "dependencies": [ + "invariant", + "newtype", + "prelude" + ] + }, + "contravariant": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-TP+ooAp3vvmdjfQsQJSichF5B4BPDHp3wAJoWchip6c=", + "dependencies": [ + "const", + "either", + "newtype", + "prelude", + "tuples" + ] + }, + "control": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-sH7Pg9E96JCPF9PIA6oQ8+BjTyO/BH1ZuE/bOcyj4Jk=", + "dependencies": [ + "newtype", + "prelude" + ] + }, + "distributive": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-HTDdmEnzigMl+02SJB88j+gAXDx9VKsbvR4MJGDPbOQ=", + "dependencies": [ + "identity", + "newtype", + "prelude", + "tuples", + "type-equality" + ] + }, + "effect": { + "type": "registry", + "version": "4.0.0", + "integrity": "sha256-eBtZu+HZcMa5HilvI6kaDyVX3ji8p0W9MGKy2K4T6+M=", + "dependencies": [ + "prelude" + ] + }, + "either": { + "type": "registry", + "version": "6.1.0", + "integrity": "sha256-6hgTPisnMWVwQivOu2PKYcH8uqjEOOqDyaDQVUchTpY=", + "dependencies": [ + "control", + "invariant", + "maybe", + "prelude" + ] + }, + "enums": { + "type": "registry", + "version": "6.0.1", + "integrity": "sha256-HWaD73JFLorc4A6trKIRUeDMdzE+GpkJaEOM1nTNkC8=", + "dependencies": [ + "control", + "either", + "gen", + "maybe", + "newtype", + "nonempty", + "partial", + "prelude", + "tuples", + "unfoldable" + ] + }, + "exceptions": { + "type": "registry", + "version": "6.1.0", + "integrity": "sha256-K0T89IHtF3vBY7eSAO7eDOqSb2J9kZGAcDN5+IKsF8E=", + "dependencies": [ + "effect", + "either", + "maybe", + "prelude" + ] + }, + "exists": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-A0JQHpTfo1dNOj9U5/Fd3xndlRSE0g2IQWOGor2yXn8=", + "dependencies": [ + "unsafe-coerce" + ] + }, + "float32": { + "type": "registry", + "version": "2.0.0", + "integrity": "sha256-PRRdv0zNZ8JdohWTO3ZSLzt51ymxK4/NHtGTwuMWHtw=", + "dependencies": [ + "gen", + "maybe", + "prelude" + ] + }, + "foldable-traversable": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-fLeqRYM4jUrZD5H4WqcwUgzU7XfYkzO4zhgtNc3jcWM=", + "dependencies": [ + "bifunctors", + "const", + "control", + "either", + "functors", + "identity", + "maybe", + "newtype", + "orders", + "prelude", + "tuples" + ] + }, + "foreign": { + "type": "registry", + "version": "7.0.0", + "integrity": "sha256-1ORiqoS3HW+qfwSZAppHPWy4/6AQysxZ2t29jcdUMNA=", + "dependencies": [ + "either", + "functions", + "identity", + "integers", + "lists", + "maybe", + "prelude", + "strings", + "transformers" + ] + }, + "functions": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-adMyJNEnhGde2unHHAP79gPtlNjNqzgLB8arEOn9hLI=", + "dependencies": [ + "prelude" + ] + }, + "functors": { + "type": "registry", + "version": "5.0.0", + "integrity": "sha256-zfPWWYisbD84MqwpJSZFlvM6v86McM68ob8p9s27ywU=", + "dependencies": [ + "bifunctors", + "const", + "contravariant", + "control", + "distributive", + "either", + "invariant", + "maybe", + "newtype", + "prelude", + "profunctor", + "tuples", + "unsafe-coerce" + ] + }, + "gen": { + "type": "registry", + "version": "4.0.0", + "integrity": "sha256-f7yzAXWwr+xnaqEOcvyO3ezKdoes8+WXWdXIHDBCAPI=", + "dependencies": [ + "either", + "foldable-traversable", + "identity", + "maybe", + "newtype", + "nonempty", + "prelude", + "tailrec", + "tuples", + "unfoldable" + ] + }, + "identity": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-4wY0XZbAksjY6UAg99WkuKyJlQlWAfTi2ssadH0wVMY=", + "dependencies": [ + "control", + "invariant", + "newtype", + "prelude" + ] + }, + "int64": { + "type": "registry", + "version": "3.0.0", + "integrity": "sha256-IK5NkLmqjdyqHo7MC3W2loWnpIzTjjJgSyePGV0Jw+c=", + "dependencies": [ + "effect", + "foreign", + "functions", + "gen", + "integers", + "maybe", + "nullable", + "prelude", + "unsafe-coerce" + ] + }, + "integers": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-sf+sK26R1hzwl3NhXR7WAu9zCDjQnfoXwcyGoseX158=", + "dependencies": [ + "maybe", + "numbers", + "prelude" + ] + }, + "invariant": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-RGWWyYrz0Hs1KjPDA+87Kia67ZFBhfJ5lMGOMCEFoLo=", + "dependencies": [ + "control", + "prelude" + ] + }, + "lazy": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-lMsfFOnlqfe4KzRRiW8ot5ge6HtcU3Eyh2XkXcP5IgU=", + "dependencies": [ + "control", + "foldable-traversable", + "invariant", + "prelude" + ] + }, + "lists": { + "type": "registry", + "version": "7.0.0", + "integrity": "sha256-EKF15qYqucuXP2lT/xPxhqy58f0FFT6KHdIB/yBOayI=", + "dependencies": [ + "bifunctors", + "control", + "foldable-traversable", + "lazy", + "maybe", + "newtype", + "nonempty", + "partial", + "prelude", + "tailrec", + "tuples", + "unfoldable" + ] + }, + "maybe": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-5cCIb0wPwbat2PRkQhUeZO0jcAmf8jCt2qE0wbC3v2Q=", + "dependencies": [ + "control", + "invariant", + "newtype", + "prelude" + ] + }, + "newtype": { + "type": "registry", + "version": "5.0.0", + "integrity": "sha256-gdrQu8oGe9eZE6L3wOI8ql/igOg+zEGB5ITh2g+uttw=", + "dependencies": [ + "prelude", + "safe-coerce" + ] + }, + "nonempty": { + "type": "registry", + "version": "7.0.0", + "integrity": "sha256-54ablJZUHGvvlTJzi3oXyPCuvY6zsrWJuH/dMJ/MFLs=", + "dependencies": [ + "control", + "foldable-traversable", + "maybe", + "prelude", + "tuples", + "unfoldable" + ] + }, + "nullable": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-yiGBVl3AD+Guy4kNWWeN+zl1gCiJK+oeIFtZtPCw4+o=", + "dependencies": [ + "effect", + "functions", + "maybe" + ] + }, + "numbers": { + "type": "registry", + "version": "9.0.1", + "integrity": "sha256-/9M6aeMDBdB4cwYDeJvLFprAHZ49EbtKQLIJsneXLIk=", + "dependencies": [ + "functions", + "maybe" + ] + }, + "orders": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-nBA0g3/ai0euH8q9pSbGqk53W2q6agm/dECZTHcoink=", + "dependencies": [ + "newtype", + "prelude" + ] + }, + "parsing": { + "type": "registry", + "version": "10.2.0", + "integrity": "sha256-ZDIdMFAKkst57x6BVa1aUWJnS8smoZnXsZ339Aq1mPA=", + "dependencies": [ + "arrays", + "control", + "effect", + "either", + "enums", + "foldable-traversable", + "functions", + "identity", + "integers", + "lazy", + "lists", + "maybe", + "newtype", + "nullable", + "numbers", + "partial", + "prelude", + "st", + "strings", + "tailrec", + "transformers", + "tuples", + "unfoldable", + "unicode", + "unsafe-coerce" + ] + }, + "parsing-dataview": { + "type": "registry", + "version": "3.2.4", + "integrity": "sha256-Xi7UEBNDOvLh6KEoLHigXoeTeeINWVtBQzeFpm/9fa4=", + "dependencies": [ + "arraybuffer", + "arraybuffer-types", + "effect", + "enums", + "float32", + "maybe", + "parsing", + "prelude", + "strings", + "tailrec", + "transformers", + "tuples", + "uint" + ] + }, + "partial": { + "type": "registry", + "version": "4.0.0", + "integrity": "sha256-fwXerld6Xw1VkReh8yeQsdtLVrjfGiVuC5bA1Wyo/J4=", + "dependencies": [] + }, + "prelude": { + "type": "registry", + "version": "6.0.1", + "integrity": "sha256-o8p6SLYmVPqzXZhQFd2hGAWEwBoXl1swxLG/scpJ0V0=", + "dependencies": [] + }, + "profunctor": { + "type": "registry", + "version": "6.0.1", + "integrity": "sha256-E58hSYdJvF2Qjf9dnWLPlJKh2Z2fLfFLkQoYi16vsFk=", + "dependencies": [ + "control", + "distributive", + "either", + "exists", + "invariant", + "newtype", + "prelude", + "tuples" + ] + }, + "record": { + "type": "registry", + "version": "4.0.0", + "integrity": "sha256-Za5U85bTRJEfGK5Sk4hM41oXy84YQI0I8TL3WUn1Qzg=", + "dependencies": [ + "functions", + "prelude", + "unsafe-coerce" + ] + }, + "refs": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-Vgwne7jIbD3ZMoLNNETLT8Litw6lIYo3MfYNdtYWj9s=", + "dependencies": [ + "effect", + "prelude" + ] + }, + "safe-coerce": { + "type": "registry", + "version": "2.0.0", + "integrity": "sha256-a1ibQkiUcbODbLE/WAq7Ttbbh9ex+x33VCQ7GngKudU=", + "dependencies": [ + "unsafe-coerce" + ] + }, + "st": { + "type": "registry", + "version": "6.2.0", + "integrity": "sha256-z9X0WsOUlPwNx9GlCC+YccCyz8MejC8Wb0C4+9fiBRY=", + "dependencies": [ + "partial", + "prelude", + "tailrec", + "unsafe-coerce" + ] + }, + "strings": { + "type": "registry", + "version": "6.0.1", + "integrity": "sha256-WssD3DbX4OPzxSdjvRMX0yvc9+pS7n5gyPv5I2Trb7k=", + "dependencies": [ + "arrays", + "control", + "either", + "enums", + "foldable-traversable", + "gen", + "integers", + "maybe", + "newtype", + "nonempty", + "partial", + "prelude", + "tailrec", + "tuples", + "unfoldable", + "unsafe-coerce" + ] + }, + "tailrec": { + "type": "registry", + "version": "6.1.0", + "integrity": "sha256-Xx19ECVDRrDWpz9D2GxQHHV89vd61dnXxQm0IcYQHGk=", + "dependencies": [ + "bifunctors", + "effect", + "either", + "identity", + "maybe", + "partial", + "prelude", + "refs" + ] + }, + "transformers": { + "type": "registry", + "version": "6.1.0", + "integrity": "sha256-3Bm+Z6tsC/paG888XkywDngJ2JMos+JfOhRlkVfb7gI=", + "dependencies": [ + "control", + "distributive", + "effect", + "either", + "exceptions", + "foldable-traversable", + "identity", + "lazy", + "maybe", + "newtype", + "prelude", + "st", + "tailrec", + "tuples", + "unfoldable" + ] + }, + "tuples": { + "type": "registry", + "version": "7.0.0", + "integrity": "sha256-1rXgTomes9105BjgXqIw0FL6Fz1lqqUTLWOumhWec1M=", + "dependencies": [ + "control", + "invariant", + "prelude" + ] + }, + "type-equality": { + "type": "registry", + "version": "4.0.1", + "integrity": "sha256-Hs9D6Y71zFi/b+qu5NSbuadUQXe5iv5iWx0226vOHUw=", + "dependencies": [] + }, + "uint": { + "type": "registry", + "version": "7.0.0", + "integrity": "sha256-fQ30YjiKz9DS6yqRdmK+WARVbJhpZDDTRcpFw675b6M=", + "dependencies": [ + "effect", + "enums", + "gen", + "maybe", + "numbers", + "prelude" + ] + }, + "unfoldable": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-JtikvJdktRap7vr/K4ITlxUX1QexpnqBq0G/InLr6eg=", + "dependencies": [ + "foldable-traversable", + "maybe", + "partial", + "prelude", + "tuples" + ] + }, + "unicode": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-QJnTVZpmihEAUiMeYrfkusVoziJWp2hJsgi9bMQLue8=", + "dependencies": [ + "foldable-traversable", + "maybe", + "strings" + ] + }, + "unsafe-coerce": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-IqIYW4Vkevn8sI+6aUwRGvd87tVL36BBeOr0cGAE7t0=", + "dependencies": [] + }, + "web-encoding": { + "type": "registry", + "version": "3.0.0", + "integrity": "sha256-lqvbj4Rw9mqgSnKx5vSdeNz4vTGxuRQI/PdSK9+kmk0=", + "dependencies": [ + "arraybuffer-types", + "effect", + "newtype", + "prelude" + ] + } + } +} diff --git a/library/spago.yaml b/library/spago.yaml new file mode 100644 index 0000000..596fc94 --- /dev/null +++ b/library/spago.yaml @@ -0,0 +1,39 @@ + +# https://github.com/purescript/spago#polyrepo-support + +package: + name: protobuf + publish: + license: MIT + version: 4.4.0 + location: + githubOwner: rowtype-yoga + githubRepo: purescript-protobuf + dependencies: + - arraybuffer: ">=13.1.1 <14.0.0" + - arraybuffer-builder: ">=3.1.0 <4.0.0" + - arraybuffer-types: ">=3.0.2 <4.0.0" + - arrays: ">=7.2.0 <8.0.0" + - control: ">=6.0.0 <7.0.0" + - effect: ">=4.0.0 <5.0.0" + - either: ">=6.1.0 <7.0.0" + - exceptions: ">=6.0.0 <7.0.0" + - float32: ">=2.0.0 <3.0.0" + - foldable-traversable: ">=6.0.0 <7.0.0" + - functions: ">=6.0.0 <7.0.0" + - int64: ">=3.0.0 <4.0.0" + - lists: ">=7.0.0 <8.0.0" + - maybe: ">=6.0.0 <7.0.0" + - newtype: ">=5.0.0 <6.0.0" + - parsing: ">=10.2.0 <11.0.0" + - parsing-dataview: ">=3.2.4 <4.0.0" + - prelude: ">=6.0.1 <7.0.0" + - record: ">=4.0.0 <5.0.0" + - strings: ">=6.0.1 <7.0.0" + - tailrec: ">=6.1.0 <7.0.0" + - transformers: ">=6.0.0 <7.0.0" + - tuples: ">=7.0.0 <8.0.0" + - uint: ">=7.0.0 <8.0.0" + - web-encoding: ">=3.0.0 <4.0.0" + +workspace: {} \ No newline at end of file diff --git a/src/Protobuf/Internal/Common.purs b/library/src/Protobuf/Internal/Common.purs similarity index 100% rename from src/Protobuf/Internal/Common.purs rename to library/src/Protobuf/Internal/Common.purs diff --git a/src/Protobuf/Internal/Decode.js b/library/src/Protobuf/Internal/Decode.js similarity index 100% rename from src/Protobuf/Internal/Decode.js rename to library/src/Protobuf/Internal/Decode.js diff --git a/src/Protobuf/Internal/Decode.purs b/library/src/Protobuf/Internal/Decode.purs similarity index 100% rename from src/Protobuf/Internal/Decode.purs rename to library/src/Protobuf/Internal/Decode.purs diff --git a/src/Protobuf/Internal/Encode.purs b/library/src/Protobuf/Internal/Encode.purs similarity index 100% rename from src/Protobuf/Internal/Encode.purs rename to library/src/Protobuf/Internal/Encode.purs diff --git a/src/Protobuf/Internal/Prelude.purs b/library/src/Protobuf/Internal/Prelude.purs similarity index 100% rename from src/Protobuf/Internal/Prelude.purs rename to library/src/Protobuf/Internal/Prelude.purs diff --git a/src/Protobuf/Internal/Runtime.purs b/library/src/Protobuf/Internal/Runtime.purs similarity index 100% rename from src/Protobuf/Internal/Runtime.purs rename to library/src/Protobuf/Internal/Runtime.purs diff --git a/src/Protobuf/Library.purs b/library/src/Protobuf/Library.purs similarity index 100% rename from src/Protobuf/Library.purs rename to library/src/Protobuf/Library.purs diff --git a/nix/protobuf.nix b/nix/protobuf.nix index f06be13..094129b 100644 --- a/nix/protobuf.nix +++ b/nix/protobuf.nix @@ -74,6 +74,27 @@ let fetchSubmodules = true; }; }; + protobuf_repo_v24_4 = rec { + ref = "v24.4"; + src = pkgs.fetchFromGitHub { + owner = "protocolbuffers"; + repo = "protobuf"; + rev = "v24.4"; + hash = "sha256-7T6RfSJcKYPaUgmU9SWN99d4sdZDzRUg49cy7H6NWFI="; + fetchSubmodules = true; + }; + }; + protobuf_repo_v28_2= rec { + ref = "v28.2"; + src = pkgs.fetchFromGitHub { + owner = "protocolbuffers"; + repo = "protobuf"; + rev = "v28.2"; + hash = "sha256-oRomRjmxsil2XcAQ8jbeQ2f34/Uuxe6DIaAswKgbVWQ="; + fetchSubmodules = true; + }; + }; + # Builds `protoc`, plus the conformance test runners, and also copies # in the .proto files for the conformance test protocol, @@ -179,6 +200,8 @@ in protobuf_v3_21_0 = mkProtobuf protobuf_repo_v3_21_0; protobuf_v21_10 = mkProtobuf protobuf_repo_v21_10; protobuf_v23_2 = cmakeProtobuf protobuf_repo_v23_2; + protobuf_v24_4 = cmakeProtobuf protobuf_repo_v24_4; + protobuf_v28_2 = cmakeProtobuf protobuf_repo_v28_2; } diff --git a/plugin/spago.lock b/plugin/spago.lock new file mode 100644 index 0000000..14cc5c0 --- /dev/null +++ b/plugin/spago.lock @@ -0,0 +1,1547 @@ +{ + "workspace": { + "packages": { + "protoc-plugin": { + "path": "./", + "core": { + "dependencies": [ + "aff", + "console", + "node-buffer", + "node-path", + "node-process", + "node-streams", + "protobuf", + "unicode", + "unsafe-coerce" + ], + "build_plan": [ + "aff", + "arraybuffer", + "arraybuffer-builder", + "arraybuffer-types", + "arrays", + "bifunctors", + "console", + "const", + "contravariant", + "control", + "datetime", + "distributive", + "effect", + "either", + "enums", + "exceptions", + "exists", + "float32", + "foldable-traversable", + "foreign", + "foreign-object", + "functions", + "functors", + "gen", + "identity", + "int64", + "integers", + "invariant", + "lazy", + "lists", + "maybe", + "newtype", + "node-buffer", + "node-event-emitter", + "node-path", + "node-process", + "node-streams", + "nonempty", + "nullable", + "numbers", + "ordered-collections", + "orders", + "parallel", + "parsing", + "parsing-dataview", + "partial", + "posix-types", + "prelude", + "profunctor", + "protobuf", + "record", + "refs", + "safe-coerce", + "st", + "strings", + "tailrec", + "transformers", + "tuples", + "type-equality", + "typelevel-prelude", + "uint", + "unfoldable", + "unicode", + "unsafe-coerce", + "web-encoding" + ] + }, + "test": { + "dependencies": [ + "assert", + "console", + "minibench", + "numbers", + "unfoldable" + ], + "build_plan": [ + "assert", + "bifunctors", + "console", + "const", + "contravariant", + "control", + "distributive", + "effect", + "either", + "exists", + "foldable-traversable", + "functions", + "functors", + "identity", + "integers", + "invariant", + "maybe", + "minibench", + "newtype", + "numbers", + "orders", + "partial", + "prelude", + "profunctor", + "refs", + "safe-coerce", + "tuples", + "type-equality", + "unfoldable", + "unsafe-coerce" + ] + } + } + }, + "package_set": { + "address": { + "registry": "60.5.1" + }, + "compiler": ">=0.15.15 <0.16.0", + "content": { + "abc-parser": "2.0.1", + "ace": "9.1.0", + "address-rfc2821": "0.1.1", + "aff": "8.0.0", + "aff-bus": "6.0.0", + "aff-coroutines": "9.0.0", + "aff-promise": "4.0.0", + "aff-retry": "2.0.0", + "affjax": "13.0.0", + "affjax-node": "1.0.0", + "affjax-web": "1.0.0", + "ansi": "7.0.0", + "apexcharts": "0.5.0", + "applicative-phases": "1.0.0", + "argonaut": "9.0.0", + "argonaut-aeson-generic": "0.4.1", + "argonaut-codecs": "9.1.0", + "argonaut-core": "7.0.0", + "argonaut-generic": "8.0.0", + "argonaut-traversals": "10.0.0", + "argparse-basic": "2.0.0", + "array-builder": "0.1.2", + "array-search": "0.6.0", + "arraybuffer": "13.2.0", + "arraybuffer-builder": "3.1.0", + "arraybuffer-types": "3.0.2", + "arrays": "7.3.0", + "arrays-extra": "0.6.1", + "arrays-zipper": "2.0.1", + "ask": "1.0.0", + "assert": "6.0.0", + "assert-multiple": "0.4.0", + "avar": "5.0.0", + "b64": "0.0.8", + "barbies": "1.0.1", + "barlow-lens": "0.9.0", + "bifunctors": "6.0.0", + "bigints": "7.0.1", + "bolson": "0.3.9", + "bookhound": "0.1.7", + "bower-json": "3.0.0", + "call-by-name": "4.0.1", + "canvas": "6.0.0", + "canvas-action": "9.0.0", + "cartesian": "1.0.6", + "catenable-lists": "7.0.0", + "cbor-stream": "1.3.0", + "chameleon": "1.0.0", + "chameleon-halogen": "1.0.3", + "chameleon-react-basic": "1.1.0", + "chameleon-styled": "2.5.0", + "chameleon-transformers": "1.0.0", + "channel": "1.0.0", + "checked-exceptions": "3.1.1", + "choku": "1.0.1", + "classless": "0.1.1", + "classless-arbitrary": "0.1.1", + "classless-decode-json": "0.1.1", + "classless-encode-json": "0.1.3", + "classnames": "2.0.0", + "codec": "6.1.0", + "codec-argonaut": "10.0.0", + "codec-json": "2.0.0", + "colors": "7.0.1", + "concur-core": "0.5.0", + "concur-react": "0.5.0", + "concurrent-queues": "3.0.0", + "console": "6.1.0", + "const": "6.0.0", + "contravariant": "6.0.0", + "control": "6.0.0", + "convertable-options": "1.0.0", + "coroutines": "7.0.0", + "css": "6.0.0", + "css-frameworks": "1.0.1", + "csv-stream": "2.3.0", + "data-mvc": "0.0.2", + "datetime": "6.1.0", + "datetime-parsing": "0.2.0", + "debounce": "0.1.0", + "debug": "6.0.2", + "decimals": "7.1.0", + "default-values": "1.0.1", + "deku": "0.9.23", + "deno": "0.0.5", + "dissect": "1.0.0", + "distributive": "6.0.0", + "dom-filereader": "7.0.0", + "dom-indexed": "12.0.0", + "dom-simple": "0.4.0", + "dotenv": "4.0.3", + "droplet": "0.6.0", + "dts": "1.0.0", + "dual-numbers": "1.0.3", + "dynamic-buffer": "3.0.1", + "echarts-simple": "0.0.1", + "effect": "4.0.0", + "either": "6.1.0", + "elmish": "0.13.0", + "elmish-enzyme": "0.1.1", + "elmish-hooks": "0.10.3", + "elmish-html": "0.9.0", + "elmish-testing-library": "0.3.2", + "email-validate": "7.0.0", + "encoding": "0.0.9", + "enums": "6.0.1", + "env-names": "0.4.0", + "error": "2.0.0", + "eta-conversion": "0.3.2", + "exceptions": "6.1.0", + "exists": "6.0.0", + "exitcodes": "4.0.0", + "expect-inferred": "3.0.0", + "ezfetch": "1.0.0", + "fahrtwind": "2.0.0", + "fallback": "0.1.0", + "fast-vect": "1.2.0", + "fetch": "4.1.0", + "fetch-argonaut": "1.0.1", + "fetch-core": "5.1.0", + "fetch-yoga-json": "1.1.0", + "ffi-simple": "0.5.1", + "fft-js": "0.1.0", + "filterable": "5.0.0", + "fix-functor": "0.1.0", + "fixed-points": "7.0.0", + "fixed-precision": "5.0.0", + "flame": "1.3.0", + "float32": "2.0.0", + "fmt": "0.2.1", + "foldable-traversable": "6.0.0", + "foldable-traversable-extra": "0.0.6", + "foreign": "7.0.0", + "foreign-object": "4.1.0", + "foreign-readwrite": "3.4.0", + "forgetmenot": "0.1.0", + "fork": "6.0.0", + "form-urlencoded": "7.0.0", + "formatters": "7.0.0", + "framer-motion": "1.0.1", + "free": "7.1.0", + "freeap": "7.0.0", + "freer-free": "0.0.1", + "freet": "7.0.0", + "functions": "6.0.0", + "functor1": "3.0.0", + "functors": "5.0.0", + "fuzzy": "0.4.0", + "gen": "4.0.0", + "generate-values": "1.0.1", + "generic-router": "0.0.1", + "geojson": "0.0.5", + "geometria": "2.2.0", + "gojs": "0.1.1", + "grain": "3.0.0", + "grain-router": "3.0.0", + "grain-virtualized": "3.0.0", + "graphs": "8.1.0", + "group": "4.1.1", + "halogen": "7.0.0", + "halogen-bootstrap5": "5.3.2", + "halogen-canvas": "1.0.0", + "halogen-css": "10.0.0", + "halogen-echarts-simple": "0.0.4", + "halogen-formless": "4.0.3", + "halogen-helix": "1.0.1", + "halogen-hooks": "0.6.3", + "halogen-hooks-extra": "0.9.0", + "halogen-infinite-scroll": "1.1.0", + "halogen-store": "0.5.4", + "halogen-storybook": "2.0.0", + "halogen-subscriptions": "2.0.0", + "halogen-svg-elems": "8.0.0", + "halogen-typewriter": "1.0.4", + "halogen-vdom": "8.0.0", + "halogen-vdom-string-renderer": "0.5.0", + "halogen-xterm": "2.0.0", + "heckin": "2.0.1", + "heterogeneous": "0.6.0", + "homogeneous": "0.4.0", + "http-methods": "6.0.0", + "httpurple": "4.0.0", + "huffman": "0.4.0", + "humdrum": "0.0.1", + "hyrule": "2.3.8", + "identity": "6.0.0", + "identy": "4.0.1", + "indexed-db": "1.0.0", + "indexed-monad": "3.0.0", + "int64": "3.0.0", + "integers": "6.0.0", + "interpolate": "5.0.2", + "intersection-observer": "1.0.1", + "invariant": "6.0.0", + "jarilo": "1.0.1", + "jelly": "0.10.0", + "jelly-router": "0.3.0", + "jelly-signal": "0.4.0", + "jest": "1.0.0", + "js-abort-controller": "1.0.0", + "js-bigints": "2.2.1", + "js-date": "8.0.0", + "js-fetch": "0.2.1", + "js-fileio": "3.0.0", + "js-intl": "1.0.4", + "js-iterators": "0.1.1", + "js-maps": "0.1.2", + "js-promise": "1.0.0", + "js-promise-aff": "1.0.0", + "js-timers": "6.1.0", + "js-uri": "3.1.0", + "jsdom": "1.0.0", + "json": "1.1.0", + "json-codecs": "5.0.0", + "justifill": "0.5.0", + "jwt": "0.0.9", + "labeled-data": "0.2.0", + "language-cst-parser": "0.14.0", + "lazy": "6.0.0", + "lazy-joe": "1.0.0", + "lcg": "4.0.0", + "leibniz": "5.0.0", + "leveldb": "1.0.1", + "liminal": "1.0.1", + "linalg": "6.0.0", + "lists": "7.0.0", + "literals": "1.0.2", + "logging": "3.0.0", + "logging-journald": "0.4.0", + "lumi-components": "18.0.0", + "machines": "7.0.0", + "maps-eager": "0.5.0", + "marionette": "1.0.0", + "marionette-react-basic-hooks": "0.1.1", + "marked": "0.1.0", + "matrices": "5.0.1", + "matryoshka": "1.0.0", + "maybe": "6.0.0", + "media-types": "6.0.0", + "meowclient": "1.0.0", + "midi": "4.0.0", + "milkis": "9.0.0", + "minibench": "4.0.1", + "mmorph": "7.0.0", + "monad-control": "5.0.0", + "monad-logger": "1.3.1", + "monad-loops": "0.5.0", + "monad-unlift": "1.0.1", + "monoid-extras": "0.0.1", + "monoidal": "0.16.0", + "morello": "0.4.0", + "mote": "3.0.0", + "motsunabe": "2.0.0", + "mvc": "0.0.1", + "mysql": "6.0.1", + "n3": "0.1.0", + "nano-id": "1.1.0", + "nanoid": "0.1.0", + "naturals": "3.0.0", + "nested-functor": "0.2.1", + "newtype": "5.0.0", + "nextjs": "0.1.1", + "nextui": "0.2.0", + "node-buffer": "9.0.0", + "node-child-process": "11.1.0", + "node-event-emitter": "3.0.0", + "node-execa": "5.0.0", + "node-fs": "9.2.0", + "node-glob-basic": "1.3.0", + "node-http": "9.1.0", + "node-http2": "1.1.1", + "node-human-signals": "1.0.0", + "node-net": "5.1.0", + "node-os": "5.1.0", + "node-path": "5.0.0", + "node-process": "11.2.0", + "node-readline": "8.1.1", + "node-sqlite3": "8.0.0", + "node-stream-pipes": "2.1.6", + "node-streams": "9.0.0", + "node-tls": "0.3.1", + "node-url": "7.0.1", + "node-zlib": "0.4.0", + "nonempty": "7.0.0", + "now": "6.0.0", + "npm-package-json": "2.0.0", + "nullable": "6.0.0", + "numberfield": "0.2.2", + "numbers": "9.0.1", + "oak": "3.1.1", + "oak-debug": "1.2.2", + "object-maps": "0.3.0", + "ocarina": "1.5.4", + "oooooooooorrrrrrrmm-lib": "0.0.1", + "open-colors-scales-and-schemes": "1.0.0", + "open-folds": "6.4.0", + "open-foreign-generic": "11.0.3", + "open-memoize": "6.2.0", + "open-mkdirp-aff": "1.2.0", + "open-pairing": "6.2.0", + "open-smolder": "12.0.2", + "options": "7.0.0", + "optparse": "5.0.1", + "ordered-collections": "3.2.0", + "ordered-set": "0.4.0", + "orders": "6.0.0", + "owoify": "1.2.0", + "pairs": "9.0.1", + "parallel": "7.0.0", + "parsing": "10.2.0", + "parsing-dataview": "3.2.4", + "partial": "4.0.0", + "pathy": "9.0.0", + "pha": "0.13.0", + "phaser": "0.7.0", + "phylio": "1.1.2", + "pipes": "8.0.0", + "pirates-charm": "0.0.1", + "pmock": "0.9.0", + "point-free": "1.0.0", + "pointed-list": "0.5.1", + "polymorphic-vectors": "4.0.0", + "posix-types": "6.0.0", + "postgresql": "2.0.19", + "precise": "6.0.0", + "precise-datetime": "7.0.0", + "prelude": "6.0.1", + "prettier-printer": "3.0.0", + "priority-queue": "0.1.2", + "profunctor": "6.0.1", + "profunctor-lenses": "8.0.0", + "protobuf": "4.3.0", + "psa-utils": "8.0.0", + "psci-support": "6.0.0", + "punycode": "1.0.0", + "qualified-do": "2.2.0", + "quantities": "12.2.0", + "quickcheck": "8.0.1", + "quickcheck-combinators": "0.1.3", + "quickcheck-laws": "7.0.0", + "quickcheck-utf8": "0.0.0", + "random": "6.0.0", + "rationals": "6.0.0", + "rdf": "0.1.0", + "react": "11.0.0", + "react-aria": "0.2.0", + "react-basic": "17.0.0", + "react-basic-classic": "3.0.0", + "react-basic-dnd": "10.1.0", + "react-basic-dom": "6.1.0", + "react-basic-dom-beta": "0.1.1", + "react-basic-emotion": "7.1.0", + "react-basic-hooks": "8.2.0", + "react-basic-storybook": "2.0.0", + "react-dom": "8.0.0", + "react-halo": "3.0.0", + "react-icons": "1.1.5", + "react-markdown": "0.1.0", + "react-testing-library": "4.0.1", + "react-virtuoso": "1.0.0", + "reactix": "0.6.1", + "read": "1.0.1", + "recharts": "1.1.0", + "record": "4.0.0", + "record-extra": "5.0.1", + "record-ptional-fields": "0.1.2", + "record-studio": "1.0.4", + "refs": "6.0.0", + "remotedata": "5.0.1", + "repr": "0.5.0", + "resize-observer": "1.0.0", + "resource": "2.0.1", + "resourcet": "1.0.0", + "result": "1.0.3", + "return": "0.2.0", + "ring-modules": "5.0.1", + "rito": "0.3.4", + "roman": "0.4.0", + "rough-notation": "1.0.2", + "routing": "11.0.0", + "routing-duplex": "0.7.0", + "run": "5.0.0", + "safe-coerce": "2.0.0", + "safely": "4.0.1", + "school-of-music": "1.3.0", + "selection-foldable": "0.2.0", + "selective-functors": "1.0.1", + "semirings": "7.0.0", + "signal": "13.0.0", + "simple-emitter": "3.0.1", + "simple-i18n": "2.0.1", + "simple-json": "9.0.0", + "simple-json-generics": "0.2.1", + "simple-ulid": "3.0.0", + "sized-matrices": "1.0.0", + "sized-vectors": "5.0.2", + "slug": "3.1.0", + "small-ffi": "4.0.1", + "soundfonts": "4.1.0", + "sparse-matrices": "2.0.1", + "sparse-polynomials": "3.0.1", + "spec": "8.1.0", + "spec-discovery": "8.4.0", + "spec-mocha": "5.1.1", + "spec-node": "0.0.3", + "spec-quickcheck": "5.0.2", + "spec-reporter-xunit": "0.7.1", + "splitmix": "2.1.0", + "ssrs": "1.0.0", + "st": "6.2.0", + "statistics": "0.3.2", + "strictlypositiveint": "1.0.1", + "string-parsers": "8.0.0", + "strings": "6.0.1", + "strings-extra": "4.0.0", + "stringutils": "0.0.12", + "substitute": "0.2.3", + "supply": "0.2.0", + "svg-parser": "3.0.0", + "systemd-journald": "0.3.0", + "tagged": "4.0.2", + "tailrec": "6.1.0", + "tecton": "0.2.1", + "tecton-halogen": "0.2.0", + "test-unit": "17.0.0", + "thermite": "6.3.1", + "thermite-dom": "0.3.1", + "these": "6.0.0", + "threading": "0.0.3", + "tldr": "0.0.0", + "toestand": "0.9.0", + "transformation-matrix": "1.0.1", + "transformers": "6.1.0", + "tree-rose": "4.0.2", + "ts-bridge": "4.0.0", + "tuples": "7.0.0", + "two-or-more": "1.0.0", + "type-equality": "4.0.1", + "typedenv": "2.0.1", + "typelevel": "6.0.0", + "typelevel-lists": "2.1.0", + "typelevel-peano": "1.0.1", + "typelevel-prelude": "7.0.0", + "typelevel-regex": "0.0.3", + "typelevel-rows": "0.1.0", + "typisch": "0.4.0", + "uint": "7.0.0", + "ulid": "3.0.1", + "uncurried-transformers": "1.1.0", + "undefined": "2.0.0", + "undefined-is-not-a-problem": "1.1.0", + "unfoldable": "6.0.0", + "unicode": "6.0.0", + "unique": "0.6.1", + "unlift": "1.0.1", + "unordered-collections": "3.1.0", + "unsafe-coerce": "6.0.0", + "unsafe-reference": "5.0.0", + "untagged-to-tagged": "0.1.4", + "untagged-union": "1.0.0", + "uri": "9.0.0", + "url-immutable": "1.0.0", + "uuid": "9.0.0", + "uuidv4": "1.0.0", + "validation": "6.0.0", + "variant": "8.0.0", + "variant-encodings": "2.0.0", + "vectorfield": "1.0.1", + "vectors": "2.1.0", + "versions": "7.0.0", + "visx": "0.0.2", + "web-clipboard": "6.0.0", + "web-cssom": "2.0.0", + "web-cssom-view": "0.1.0", + "web-dom": "6.0.0", + "web-dom-parser": "8.0.0", + "web-dom-xpath": "3.0.0", + "web-encoding": "3.0.0", + "web-events": "4.0.0", + "web-fetch": "4.0.1", + "web-file": "4.0.0", + "web-geometry": "0.1.0", + "web-html": "4.1.0", + "web-pointerevents": "2.0.0", + "web-proletarian": "1.0.0", + "web-promise": "3.2.0", + "web-resize-observer": "2.1.0", + "web-router": "1.0.0", + "web-socket": "4.0.0", + "web-storage": "5.0.0", + "web-streams": "4.0.0", + "web-touchevents": "4.0.0", + "web-uievents": "5.0.0", + "web-url": "2.0.0", + "web-workers": "1.1.0", + "web-xhr": "5.0.1", + "webextension-polyfill": "0.1.0", + "webgpu": "0.0.1", + "which": "2.0.0", + "xterm": "1.0.0", + "yoga-fetch": "1.0.1", + "yoga-json": "5.1.0", + "yoga-om": "0.1.0", + "yoga-postgres": "6.0.0", + "yoga-tree": "1.0.0", + "z3": "0.0.2", + "zipperarray": "2.0.0" + } + }, + "extra_packages": { + "protobuf": { + "path": "../library" + } + } + }, + "packages": { + "aff": { + "type": "registry", + "version": "8.0.0", + "integrity": "sha256-5MmdI4+0RHBtSBy+YlU3/Cq4R5W2ih3OaRedJIrVHdk=", + "dependencies": [ + "bifunctors", + "control", + "datetime", + "effect", + "either", + "exceptions", + "foldable-traversable", + "functions", + "maybe", + "newtype", + "parallel", + "prelude", + "refs", + "tailrec", + "transformers", + "unsafe-coerce" + ] + }, + "arraybuffer": { + "type": "registry", + "version": "13.2.0", + "integrity": "sha256-fNsR19aRqcUis9C28MpyMigIlfX6f6Hq1up4IcTOvDU=", + "dependencies": [ + "arraybuffer-types", + "arrays", + "effect", + "float32", + "functions", + "gen", + "maybe", + "nullable", + "prelude", + "tailrec", + "uint", + "unfoldable" + ] + }, + "arraybuffer-builder": { + "type": "registry", + "version": "3.1.0", + "integrity": "sha256-dsNYehLsY5xzp/h9hgbn4cMhS+2hVuLzHLg//aPPCs4=", + "dependencies": [ + "arraybuffer", + "arraybuffer-types", + "effect", + "float32", + "identity", + "lists", + "maybe", + "newtype", + "prelude", + "tailrec", + "transformers", + "uint" + ] + }, + "arraybuffer-types": { + "type": "registry", + "version": "3.0.2", + "integrity": "sha256-mQKokysYVkooS4uXbO+yovmV/s8b138Ws3zQvOwIHRA=", + "dependencies": [] + }, + "arrays": { + "type": "registry", + "version": "7.3.0", + "integrity": "sha256-tmcklBlc/muUtUfr9RapdCPwnlQeB3aSrC4dK85gQlc=", + "dependencies": [ + "bifunctors", + "control", + "foldable-traversable", + "functions", + "maybe", + "nonempty", + "partial", + "prelude", + "safe-coerce", + "st", + "tailrec", + "tuples", + "unfoldable", + "unsafe-coerce" + ] + }, + "assert": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-hCSYcCw9kj3qujoDcriWhCdmrpPZoguSPDZhEMnTl3A=", + "dependencies": [ + "console", + "effect", + "prelude" + ] + }, + "bifunctors": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-/gZwC9YhNxZNQpnHa5BIYerCGM2jeX9ukZiEvYxm5Nw=", + "dependencies": [ + "const", + "either", + "newtype", + "prelude", + "tuples" + ] + }, + "console": { + "type": "registry", + "version": "6.1.0", + "integrity": "sha256-CxmAzjgyuGDmt9FZW51VhV6rBPwR6o0YeKUzA9rSzcM=", + "dependencies": [ + "effect", + "prelude" + ] + }, + "const": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-tNrxDW8D8H4jdHE2HiPzpLy08zkzJMmGHdRqt5BQuTc=", + "dependencies": [ + "invariant", + "newtype", + "prelude" + ] + }, + "contravariant": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-TP+ooAp3vvmdjfQsQJSichF5B4BPDHp3wAJoWchip6c=", + "dependencies": [ + "const", + "either", + "newtype", + "prelude", + "tuples" + ] + }, + "control": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-sH7Pg9E96JCPF9PIA6oQ8+BjTyO/BH1ZuE/bOcyj4Jk=", + "dependencies": [ + "newtype", + "prelude" + ] + }, + "datetime": { + "type": "registry", + "version": "6.1.0", + "integrity": "sha256-g/5X5BBegQWLpI9IWD+sY6mcaYpzzlW5lz5NBzaMtyI=", + "dependencies": [ + "bifunctors", + "control", + "either", + "enums", + "foldable-traversable", + "functions", + "gen", + "integers", + "lists", + "maybe", + "newtype", + "numbers", + "ordered-collections", + "partial", + "prelude", + "tuples" + ] + }, + "distributive": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-HTDdmEnzigMl+02SJB88j+gAXDx9VKsbvR4MJGDPbOQ=", + "dependencies": [ + "identity", + "newtype", + "prelude", + "tuples", + "type-equality" + ] + }, + "effect": { + "type": "registry", + "version": "4.0.0", + "integrity": "sha256-eBtZu+HZcMa5HilvI6kaDyVX3ji8p0W9MGKy2K4T6+M=", + "dependencies": [ + "prelude" + ] + }, + "either": { + "type": "registry", + "version": "6.1.0", + "integrity": "sha256-6hgTPisnMWVwQivOu2PKYcH8uqjEOOqDyaDQVUchTpY=", + "dependencies": [ + "control", + "invariant", + "maybe", + "prelude" + ] + }, + "enums": { + "type": "registry", + "version": "6.0.1", + "integrity": "sha256-HWaD73JFLorc4A6trKIRUeDMdzE+GpkJaEOM1nTNkC8=", + "dependencies": [ + "control", + "either", + "gen", + "maybe", + "newtype", + "nonempty", + "partial", + "prelude", + "tuples", + "unfoldable" + ] + }, + "exceptions": { + "type": "registry", + "version": "6.1.0", + "integrity": "sha256-K0T89IHtF3vBY7eSAO7eDOqSb2J9kZGAcDN5+IKsF8E=", + "dependencies": [ + "effect", + "either", + "maybe", + "prelude" + ] + }, + "exists": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-A0JQHpTfo1dNOj9U5/Fd3xndlRSE0g2IQWOGor2yXn8=", + "dependencies": [ + "unsafe-coerce" + ] + }, + "float32": { + "type": "registry", + "version": "2.0.0", + "integrity": "sha256-PRRdv0zNZ8JdohWTO3ZSLzt51ymxK4/NHtGTwuMWHtw=", + "dependencies": [ + "gen", + "maybe", + "prelude" + ] + }, + "foldable-traversable": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-fLeqRYM4jUrZD5H4WqcwUgzU7XfYkzO4zhgtNc3jcWM=", + "dependencies": [ + "bifunctors", + "const", + "control", + "either", + "functors", + "identity", + "maybe", + "newtype", + "orders", + "prelude", + "tuples" + ] + }, + "foreign": { + "type": "registry", + "version": "7.0.0", + "integrity": "sha256-1ORiqoS3HW+qfwSZAppHPWy4/6AQysxZ2t29jcdUMNA=", + "dependencies": [ + "either", + "functions", + "identity", + "integers", + "lists", + "maybe", + "prelude", + "strings", + "transformers" + ] + }, + "foreign-object": { + "type": "registry", + "version": "4.1.0", + "integrity": "sha256-q24okj6mT+yGHYQ+ei/pYPj5ih6sTbu7eDv/WU56JVo=", + "dependencies": [ + "arrays", + "foldable-traversable", + "functions", + "gen", + "lists", + "maybe", + "prelude", + "st", + "tailrec", + "tuples", + "typelevel-prelude", + "unfoldable" + ] + }, + "functions": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-adMyJNEnhGde2unHHAP79gPtlNjNqzgLB8arEOn9hLI=", + "dependencies": [ + "prelude" + ] + }, + "functors": { + "type": "registry", + "version": "5.0.0", + "integrity": "sha256-zfPWWYisbD84MqwpJSZFlvM6v86McM68ob8p9s27ywU=", + "dependencies": [ + "bifunctors", + "const", + "contravariant", + "control", + "distributive", + "either", + "invariant", + "maybe", + "newtype", + "prelude", + "profunctor", + "tuples", + "unsafe-coerce" + ] + }, + "gen": { + "type": "registry", + "version": "4.0.0", + "integrity": "sha256-f7yzAXWwr+xnaqEOcvyO3ezKdoes8+WXWdXIHDBCAPI=", + "dependencies": [ + "either", + "foldable-traversable", + "identity", + "maybe", + "newtype", + "nonempty", + "prelude", + "tailrec", + "tuples", + "unfoldable" + ] + }, + "identity": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-4wY0XZbAksjY6UAg99WkuKyJlQlWAfTi2ssadH0wVMY=", + "dependencies": [ + "control", + "invariant", + "newtype", + "prelude" + ] + }, + "int64": { + "type": "registry", + "version": "3.0.0", + "integrity": "sha256-IK5NkLmqjdyqHo7MC3W2loWnpIzTjjJgSyePGV0Jw+c=", + "dependencies": [ + "effect", + "foreign", + "functions", + "gen", + "integers", + "maybe", + "nullable", + "prelude", + "unsafe-coerce" + ] + }, + "integers": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-sf+sK26R1hzwl3NhXR7WAu9zCDjQnfoXwcyGoseX158=", + "dependencies": [ + "maybe", + "numbers", + "prelude" + ] + }, + "invariant": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-RGWWyYrz0Hs1KjPDA+87Kia67ZFBhfJ5lMGOMCEFoLo=", + "dependencies": [ + "control", + "prelude" + ] + }, + "lazy": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-lMsfFOnlqfe4KzRRiW8ot5ge6HtcU3Eyh2XkXcP5IgU=", + "dependencies": [ + "control", + "foldable-traversable", + "invariant", + "prelude" + ] + }, + "lists": { + "type": "registry", + "version": "7.0.0", + "integrity": "sha256-EKF15qYqucuXP2lT/xPxhqy58f0FFT6KHdIB/yBOayI=", + "dependencies": [ + "bifunctors", + "control", + "foldable-traversable", + "lazy", + "maybe", + "newtype", + "nonempty", + "partial", + "prelude", + "tailrec", + "tuples", + "unfoldable" + ] + }, + "maybe": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-5cCIb0wPwbat2PRkQhUeZO0jcAmf8jCt2qE0wbC3v2Q=", + "dependencies": [ + "control", + "invariant", + "newtype", + "prelude" + ] + }, + "minibench": { + "type": "registry", + "version": "4.0.1", + "integrity": "sha256-7jyxcklZI49q/otYvMV4f9YnJwEqQ3Me5buhDwAOydw=", + "dependencies": [ + "console", + "effect", + "integers", + "numbers", + "partial", + "prelude", + "refs" + ] + }, + "newtype": { + "type": "registry", + "version": "5.0.0", + "integrity": "sha256-gdrQu8oGe9eZE6L3wOI8ql/igOg+zEGB5ITh2g+uttw=", + "dependencies": [ + "prelude", + "safe-coerce" + ] + }, + "node-buffer": { + "type": "registry", + "version": "9.0.0", + "integrity": "sha256-PWE2DJ5ruBLCmeA/fUiuySEFmUJ/VuRfyrnCuVZBlu4=", + "dependencies": [ + "arraybuffer-types", + "effect", + "maybe", + "nullable", + "st", + "unsafe-coerce" + ] + }, + "node-event-emitter": { + "type": "registry", + "version": "3.0.0", + "integrity": "sha256-Qw0MjsT4xRH2j2i4K8JmRjcMKnH5z1Cw39t00q4LE4w=", + "dependencies": [ + "effect", + "either", + "functions", + "maybe", + "nullable", + "prelude", + "unsafe-coerce" + ] + }, + "node-path": { + "type": "registry", + "version": "5.0.0", + "integrity": "sha256-pd82nQ+2l5UThzaxPdKttgDt7xlsgIDLpPG0yxDEdyE=", + "dependencies": [ + "effect" + ] + }, + "node-process": { + "type": "registry", + "version": "11.2.0", + "integrity": "sha256-+2MQDYChjGbVbapCyJtuWYwD41jk+BntF/kcOTKBMVs=", + "dependencies": [ + "effect", + "foreign", + "foreign-object", + "maybe", + "node-event-emitter", + "node-streams", + "posix-types", + "prelude", + "unsafe-coerce" + ] + }, + "node-streams": { + "type": "registry", + "version": "9.0.0", + "integrity": "sha256-2n6dq7YWleTDmD1Kur/ul7Cn08IvWrScgPf+0PgX2TQ=", + "dependencies": [ + "aff", + "effect", + "either", + "exceptions", + "node-buffer", + "node-event-emitter", + "nullable", + "prelude" + ] + }, + "nonempty": { + "type": "registry", + "version": "7.0.0", + "integrity": "sha256-54ablJZUHGvvlTJzi3oXyPCuvY6zsrWJuH/dMJ/MFLs=", + "dependencies": [ + "control", + "foldable-traversable", + "maybe", + "prelude", + "tuples", + "unfoldable" + ] + }, + "nullable": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-yiGBVl3AD+Guy4kNWWeN+zl1gCiJK+oeIFtZtPCw4+o=", + "dependencies": [ + "effect", + "functions", + "maybe" + ] + }, + "numbers": { + "type": "registry", + "version": "9.0.1", + "integrity": "sha256-/9M6aeMDBdB4cwYDeJvLFprAHZ49EbtKQLIJsneXLIk=", + "dependencies": [ + "functions", + "maybe" + ] + }, + "ordered-collections": { + "type": "registry", + "version": "3.2.0", + "integrity": "sha256-o9jqsj5rpJmMdoe/zyufWHFjYYFTTsJpgcuCnqCO6PM=", + "dependencies": [ + "arrays", + "foldable-traversable", + "gen", + "lists", + "maybe", + "partial", + "prelude", + "st", + "tailrec", + "tuples", + "unfoldable" + ] + }, + "orders": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-nBA0g3/ai0euH8q9pSbGqk53W2q6agm/dECZTHcoink=", + "dependencies": [ + "newtype", + "prelude" + ] + }, + "parallel": { + "type": "registry", + "version": "7.0.0", + "integrity": "sha256-gUC9i4Txnx9K9RcMLsjujbwZz6BB1bnE2MLvw4GIw5o=", + "dependencies": [ + "control", + "effect", + "either", + "foldable-traversable", + "functors", + "maybe", + "newtype", + "prelude", + "profunctor", + "refs", + "transformers" + ] + }, + "parsing": { + "type": "registry", + "version": "10.2.0", + "integrity": "sha256-ZDIdMFAKkst57x6BVa1aUWJnS8smoZnXsZ339Aq1mPA=", + "dependencies": [ + "arrays", + "control", + "effect", + "either", + "enums", + "foldable-traversable", + "functions", + "identity", + "integers", + "lazy", + "lists", + "maybe", + "newtype", + "nullable", + "numbers", + "partial", + "prelude", + "st", + "strings", + "tailrec", + "transformers", + "tuples", + "unfoldable", + "unicode", + "unsafe-coerce" + ] + }, + "parsing-dataview": { + "type": "registry", + "version": "3.2.4", + "integrity": "sha256-Xi7UEBNDOvLh6KEoLHigXoeTeeINWVtBQzeFpm/9fa4=", + "dependencies": [ + "arraybuffer", + "arraybuffer-types", + "effect", + "enums", + "float32", + "maybe", + "parsing", + "prelude", + "strings", + "tailrec", + "transformers", + "tuples", + "uint" + ] + }, + "partial": { + "type": "registry", + "version": "4.0.0", + "integrity": "sha256-fwXerld6Xw1VkReh8yeQsdtLVrjfGiVuC5bA1Wyo/J4=", + "dependencies": [] + }, + "posix-types": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-ZfFz8RR1lee/o/Prccyeut3Q+9tYd08mlR72sIh6GzA=", + "dependencies": [ + "maybe", + "prelude" + ] + }, + "prelude": { + "type": "registry", + "version": "6.0.1", + "integrity": "sha256-o8p6SLYmVPqzXZhQFd2hGAWEwBoXl1swxLG/scpJ0V0=", + "dependencies": [] + }, + "profunctor": { + "type": "registry", + "version": "6.0.1", + "integrity": "sha256-E58hSYdJvF2Qjf9dnWLPlJKh2Z2fLfFLkQoYi16vsFk=", + "dependencies": [ + "control", + "distributive", + "either", + "exists", + "invariant", + "newtype", + "prelude", + "tuples" + ] + }, + "protobuf": { + "type": "local", + "path": "../library", + "dependencies": [ + "arraybuffer", + "arraybuffer-builder", + "arraybuffer-types", + "arrays", + "control", + "effect", + "either", + "exceptions", + "float32", + "foldable-traversable", + "functions", + "int64", + "lists", + "maybe", + "newtype", + "parsing", + "parsing-dataview", + "prelude", + "record", + "strings", + "tailrec", + "transformers", + "tuples", + "uint", + "web-encoding" + ] + }, + "record": { + "type": "registry", + "version": "4.0.0", + "integrity": "sha256-Za5U85bTRJEfGK5Sk4hM41oXy84YQI0I8TL3WUn1Qzg=", + "dependencies": [ + "functions", + "prelude", + "unsafe-coerce" + ] + }, + "refs": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-Vgwne7jIbD3ZMoLNNETLT8Litw6lIYo3MfYNdtYWj9s=", + "dependencies": [ + "effect", + "prelude" + ] + }, + "safe-coerce": { + "type": "registry", + "version": "2.0.0", + "integrity": "sha256-a1ibQkiUcbODbLE/WAq7Ttbbh9ex+x33VCQ7GngKudU=", + "dependencies": [ + "unsafe-coerce" + ] + }, + "st": { + "type": "registry", + "version": "6.2.0", + "integrity": "sha256-z9X0WsOUlPwNx9GlCC+YccCyz8MejC8Wb0C4+9fiBRY=", + "dependencies": [ + "partial", + "prelude", + "tailrec", + "unsafe-coerce" + ] + }, + "strings": { + "type": "registry", + "version": "6.0.1", + "integrity": "sha256-WssD3DbX4OPzxSdjvRMX0yvc9+pS7n5gyPv5I2Trb7k=", + "dependencies": [ + "arrays", + "control", + "either", + "enums", + "foldable-traversable", + "gen", + "integers", + "maybe", + "newtype", + "nonempty", + "partial", + "prelude", + "tailrec", + "tuples", + "unfoldable", + "unsafe-coerce" + ] + }, + "tailrec": { + "type": "registry", + "version": "6.1.0", + "integrity": "sha256-Xx19ECVDRrDWpz9D2GxQHHV89vd61dnXxQm0IcYQHGk=", + "dependencies": [ + "bifunctors", + "effect", + "either", + "identity", + "maybe", + "partial", + "prelude", + "refs" + ] + }, + "transformers": { + "type": "registry", + "version": "6.1.0", + "integrity": "sha256-3Bm+Z6tsC/paG888XkywDngJ2JMos+JfOhRlkVfb7gI=", + "dependencies": [ + "control", + "distributive", + "effect", + "either", + "exceptions", + "foldable-traversable", + "identity", + "lazy", + "maybe", + "newtype", + "prelude", + "st", + "tailrec", + "tuples", + "unfoldable" + ] + }, + "tuples": { + "type": "registry", + "version": "7.0.0", + "integrity": "sha256-1rXgTomes9105BjgXqIw0FL6Fz1lqqUTLWOumhWec1M=", + "dependencies": [ + "control", + "invariant", + "prelude" + ] + }, + "type-equality": { + "type": "registry", + "version": "4.0.1", + "integrity": "sha256-Hs9D6Y71zFi/b+qu5NSbuadUQXe5iv5iWx0226vOHUw=", + "dependencies": [] + }, + "typelevel-prelude": { + "type": "registry", + "version": "7.0.0", + "integrity": "sha256-uFF2ph+vHcQpfPuPf2a3ukJDFmLhApmkpTMviHIWgJM=", + "dependencies": [ + "prelude", + "type-equality" + ] + }, + "uint": { + "type": "registry", + "version": "7.0.0", + "integrity": "sha256-fQ30YjiKz9DS6yqRdmK+WARVbJhpZDDTRcpFw675b6M=", + "dependencies": [ + "effect", + "enums", + "gen", + "maybe", + "numbers", + "prelude" + ] + }, + "unfoldable": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-JtikvJdktRap7vr/K4ITlxUX1QexpnqBq0G/InLr6eg=", + "dependencies": [ + "foldable-traversable", + "maybe", + "partial", + "prelude", + "tuples" + ] + }, + "unicode": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-QJnTVZpmihEAUiMeYrfkusVoziJWp2hJsgi9bMQLue8=", + "dependencies": [ + "foldable-traversable", + "maybe", + "strings" + ] + }, + "unsafe-coerce": { + "type": "registry", + "version": "6.0.0", + "integrity": "sha256-IqIYW4Vkevn8sI+6aUwRGvd87tVL36BBeOr0cGAE7t0=", + "dependencies": [] + }, + "web-encoding": { + "type": "registry", + "version": "3.0.0", + "integrity": "sha256-lqvbj4Rw9mqgSnKx5vSdeNz4vTGxuRQI/PdSK9+kmk0=", + "dependencies": [ + "arraybuffer-types", + "effect", + "newtype", + "prelude" + ] + } + } +} diff --git a/plugin/spago.yaml b/plugin/spago.yaml new file mode 100644 index 0000000..65c8e1c --- /dev/null +++ b/plugin/spago.yaml @@ -0,0 +1,27 @@ +workspace: + packageSet: + registry: 60.5.1 + extraPackages: + protobuf: + path: ../library +package: + name: protoc-plugin + dependencies: + - protobuf + - aff + - node-buffer + - node-path + - node-process + - node-streams + - console + - unicode + - unsafe-coerce + + test: + main: Test.Main + dependencies: + - assert + - minibench + - console + - unfoldable + - numbers \ No newline at end of file diff --git a/plugin/ProtocPlugin/Main.purs b/plugin/src/ProtocPlugin/Main.purs similarity index 100% rename from plugin/ProtocPlugin/Main.purs rename to plugin/src/ProtocPlugin/Main.purs diff --git a/plugin/ProtocPlugin/descriptor.Google.Protobuf.purs b/plugin/src/ProtocPlugin/descriptor.Google.Protobuf.purs similarity index 100% rename from plugin/ProtocPlugin/descriptor.Google.Protobuf.purs rename to plugin/src/ProtocPlugin/descriptor.Google.Protobuf.purs diff --git a/plugin/ProtocPlugin/plugin.Google.Protobuf.Compiler.purs b/plugin/src/ProtocPlugin/plugin.Google.Protobuf.Compiler.purs similarity index 100% rename from plugin/ProtocPlugin/plugin.Google.Protobuf.Compiler.purs rename to plugin/src/ProtocPlugin/plugin.Google.Protobuf.Compiler.purs diff --git a/test/README.md b/plugin/test/README.md similarity index 90% rename from test/README.md rename to plugin/test/README.md index b956eff..44b8d12 100644 --- a/test/README.md +++ b/plugin/test/README.md @@ -10,7 +10,7 @@ of the repo, then: spago -x spago-plugin.dhall build ``` ```console -protoc --purescript_out=./test/generated test/*.proto +protoc --purescript_out=./Test/generated test/*.proto ``` ```console spago -x spago-test.dhall test diff --git a/test/Bench.purs b/plugin/test/Test/Bench.purs similarity index 100% rename from test/Bench.purs rename to plugin/test/Test/Bench.purs diff --git a/test/Main.purs b/plugin/test/Test/Main.purs similarity index 100% rename from test/Main.purs rename to plugin/test/Test/Main.purs diff --git a/test/generated/README.md b/plugin/test/Test/generated/README.md similarity index 100% rename from test/generated/README.md rename to plugin/test/Test/generated/README.md diff --git a/plugin/test/Test/generated/empty.Google.Protobuf.purs b/plugin/test/Test/generated/empty.Google.Protobuf.purs new file mode 100644 index 0000000..a530007 --- /dev/null +++ b/plugin/test/Test/generated/empty.Google.Protobuf.purs @@ -0,0 +1,61 @@ +-- | Generated by __protobuf__ from file `google/protobuf/empty.proto` +module Google.Protobuf.Empty +( Empty(..), EmptyRow, EmptyR, parseEmpty, putEmpty, defaultEmpty, mkEmpty, mergeEmpty +) +where +import Protobuf.Internal.Prelude +import Protobuf.Internal.Prelude as Prelude + + + + +-- | Message generated by __protobuf__ from `google.protobuf.Empty` +-- | +-- | A generic empty message that you can re-use to avoid defining duplicated +-- | empty messages in your APIs. A typical example is to use it as the request +-- | or the response type of an API method. For instance: +-- | +-- | service Foo { +-- | rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +-- | } +-- | +newtype Empty = Empty EmptyR +type EmptyRow = + ( __unknown_fields :: Array Prelude.UnknownField + ) +type EmptyR = Record EmptyRow +derive instance genericEmpty :: Prelude.Generic Empty _ +derive instance newtypeEmpty :: Prelude.Newtype Empty _ +derive instance eqEmpty :: Prelude.Eq Empty +instance showEmpty :: Prelude.Show Empty where show x = Prelude.genericShow x + +putEmpty :: forall m. Prelude.MonadEffect m => Prelude.MonadRec m => Empty -> Prelude.PutM m Prelude.Unit +putEmpty (Empty r) = do + + Prelude.foldRecM (\_ x -> Prelude.putFieldUnknown x) unit r.__unknown_fields + +parseEmpty :: forall m. Prelude.MonadEffect m => Prelude.MonadRec m => Prelude.ByteLength -> Prelude.ParserT Prelude.DataView m Empty +parseEmpty length = Prelude.label "Empty / " $ + Prelude.parseMessage Empty defaultEmpty parseField length + where + parseField + :: Prelude.FieldNumberInt + -> Prelude.WireType + -> Prelude.ParserT Prelude.DataView m (Prelude.Builder EmptyR EmptyR) + + parseField fieldNumber wireType = Prelude.parseFieldUnknown fieldNumber wireType + +defaultEmpty :: EmptyR +defaultEmpty = + { __unknown_fields: [] + } + +mkEmpty :: forall r1 r3. Prelude.Union r1 EmptyRow r3 => Prelude.Nub r3 EmptyRow => Record r1 -> Empty +mkEmpty r = Empty $ Prelude.merge r defaultEmpty + +mergeEmpty :: Empty -> Empty -> Empty +mergeEmpty (Empty l) (Empty r) = Empty + { __unknown_fields: r.__unknown_fields <> l.__unknown_fields + } + + diff --git a/plugin/test/Test/generated/msg1.Pack.purs b/plugin/test/Test/generated/msg1.Pack.purs new file mode 100644 index 0000000..e94173f --- /dev/null +++ b/plugin/test/Test/generated/msg1.Pack.purs @@ -0,0 +1,188 @@ +-- | Generated by __protobuf__ from file `test/msg1.proto` +module Pack.Msg1 +( Msg1(..), Msg1Row, Msg1R, parseMsg1, putMsg1, defaultMsg1, mkMsg1, mergeMsg1 +, Msg1_E1(..) +) +where +import Protobuf.Internal.Prelude +import Protobuf.Internal.Prelude as Prelude + + + + +-- | Message generated by __protobuf__ from `pack.msg1` +newtype Msg1 = Msg1 Msg1R +type Msg1Row = + ( f1 :: Prelude.Maybe Number + , f2 :: Prelude.Maybe Prelude.Float32 + , f3 :: Prelude.Maybe Int + , f4 :: Prelude.Maybe Prelude.Int64 + , f5 :: Prelude.Maybe Prelude.UInt + , f6 :: Prelude.Maybe Prelude.UInt64 + , f7 :: Prelude.Maybe Int + , f8 :: Prelude.Maybe Prelude.Int64 + , f9 :: Prelude.Maybe Prelude.UInt + , f10 :: Prelude.Maybe Prelude.UInt64 + , f11 :: Prelude.Maybe Prelude.Int64 + , f12 :: Prelude.Maybe Boolean + , f13 :: Prelude.Maybe String + , f14 :: Prelude.Maybe Prelude.Bytes + , f15 :: Prelude.Maybe Msg1_E1 + , __unknown_fields :: Array Prelude.UnknownField + ) +type Msg1R = Record Msg1Row +derive instance genericMsg1 :: Prelude.Generic Msg1 _ +derive instance newtypeMsg1 :: Prelude.Newtype Msg1 _ +derive instance eqMsg1 :: Prelude.Eq Msg1 +instance showMsg1 :: Prelude.Show Msg1 where show x = Prelude.genericShow x + +putMsg1 :: forall m. Prelude.MonadEffect m => Prelude.MonadRec m => Msg1 -> Prelude.PutM m Prelude.Unit +putMsg1 (Msg1 r) = do + Prelude.putOptional 1 r.f1 Prelude.isDefault Prelude.encodeDoubleField + Prelude.putOptional 2 r.f2 Prelude.isDefault Prelude.encodeFloatField + Prelude.putOptional 3 r.f3 Prelude.isDefault Prelude.encodeInt32Field + Prelude.putOptional 4 r.f4 Prelude.isDefault Prelude.encodeInt64Field + Prelude.putOptional 5 r.f5 Prelude.isDefault Prelude.encodeUint32Field + Prelude.putOptional 6 r.f6 Prelude.isDefault Prelude.encodeUint64Field + Prelude.putOptional 7 r.f7 Prelude.isDefault Prelude.encodeSint32Field + Prelude.putOptional 8 r.f8 Prelude.isDefault Prelude.encodeSint64Field + Prelude.putOptional 9 r.f9 Prelude.isDefault Prelude.encodeFixed32Field + Prelude.putOptional 10 r.f10 Prelude.isDefault Prelude.encodeFixed64Field + Prelude.putOptional 11 r.f11 Prelude.isDefault Prelude.encodeSfixed64Field + Prelude.putOptional 12 r.f12 Prelude.isDefault Prelude.encodeBoolField + Prelude.putOptional 13 r.f13 Prelude.isDefault Prelude.encodeStringField + Prelude.putOptional 14 r.f14 Prelude.isDefault Prelude.encodeBytesField + Prelude.putOptional 15 r.f15 Prelude.isDefault Prelude.putEnumField + Prelude.foldRecM (\_ x -> Prelude.putFieldUnknown x) unit r.__unknown_fields + +parseMsg1 :: forall m. Prelude.MonadEffect m => Prelude.MonadRec m => Prelude.ByteLength -> Prelude.ParserT Prelude.DataView m Msg1 +parseMsg1 length = Prelude.label "msg1 / " $ + Prelude.parseMessage Msg1 defaultMsg1 parseField length + where + parseField + :: Prelude.FieldNumberInt + -> Prelude.WireType + -> Prelude.ParserT Prelude.DataView m (Prelude.Builder Msg1R Msg1R) + parseField 1 Prelude.Bits64 = Prelude.label "F1 / " $ do + x <- Prelude.decodeDouble + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f1") $ \_ -> Prelude.Just x + parseField 2 Prelude.Bits32 = Prelude.label "F2 / " $ do + x <- Prelude.decodeFloat + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f2") $ \_ -> Prelude.Just x + parseField 3 Prelude.VarInt = Prelude.label "F3 / " $ do + x <- Prelude.decodeInt32 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f3") $ \_ -> Prelude.Just x + parseField 4 Prelude.VarInt = Prelude.label "F4 / " $ do + x <- Prelude.decodeInt64 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f4") $ \_ -> Prelude.Just x + parseField 5 Prelude.VarInt = Prelude.label "F5 / " $ do + x <- Prelude.decodeUint32 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f5") $ \_ -> Prelude.Just x + parseField 6 Prelude.VarInt = Prelude.label "F6 / " $ do + x <- Prelude.decodeUint64 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f6") $ \_ -> Prelude.Just x + parseField 7 Prelude.VarInt = Prelude.label "F7 / " $ do + x <- Prelude.decodeSint32 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f7") $ \_ -> Prelude.Just x + parseField 8 Prelude.VarInt = Prelude.label "F8 / " $ do + x <- Prelude.decodeSint64 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f8") $ \_ -> Prelude.Just x + parseField 9 Prelude.Bits32 = Prelude.label "F9 / " $ do + x <- Prelude.decodeFixed32 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f9") $ \_ -> Prelude.Just x + parseField 10 Prelude.Bits64 = Prelude.label "F10 / " $ do + x <- Prelude.decodeFixed64 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f10") $ \_ -> Prelude.Just x + parseField 11 Prelude.Bits64 = Prelude.label "F11 / " $ do + x <- Prelude.decodeSfixed64 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f11") $ \_ -> Prelude.Just x + parseField 12 Prelude.VarInt = Prelude.label "F12 / " $ do + x <- Prelude.decodeBool + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f12") $ \_ -> Prelude.Just x + parseField 13 Prelude.LenDel = Prelude.label "F13 / " $ do + x <- Prelude.decodeString + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f13") $ \_ -> Prelude.Just x + parseField 14 Prelude.LenDel = Prelude.label "f14 / " $ do + x <- Prelude.decodeBytes + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f14") $ \_ -> Prelude.Just x + parseField 15 Prelude.VarInt = Prelude.label "F15 / " $ do + x <- Prelude.parseEnum + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f15") $ \_ -> Prelude.Just x + parseField fieldNumber wireType = Prelude.parseFieldUnknown fieldNumber wireType + +defaultMsg1 :: Msg1R +defaultMsg1 = + { f1: Prelude.Nothing + , f2: Prelude.Nothing + , f3: Prelude.Nothing + , f4: Prelude.Nothing + , f5: Prelude.Nothing + , f6: Prelude.Nothing + , f7: Prelude.Nothing + , f8: Prelude.Nothing + , f9: Prelude.Nothing + , f10: Prelude.Nothing + , f11: Prelude.Nothing + , f12: Prelude.Nothing + , f13: Prelude.Nothing + , f14: Prelude.Nothing + , f15: Prelude.Nothing + , __unknown_fields: [] + } + +mkMsg1 :: forall r1 r3. Prelude.Union r1 Msg1Row r3 => Prelude.Nub r3 Msg1Row => Record r1 -> Msg1 +mkMsg1 r = Msg1 $ Prelude.merge r defaultMsg1 + +mergeMsg1 :: Msg1 -> Msg1 -> Msg1 +mergeMsg1 (Msg1 l) (Msg1 r) = Msg1 + { f1: Prelude.alt l.f1 r.f1 + , f2: Prelude.alt l.f2 r.f2 + , f3: Prelude.alt l.f3 r.f3 + , f4: Prelude.alt l.f4 r.f4 + , f5: Prelude.alt l.f5 r.f5 + , f6: Prelude.alt l.f6 r.f6 + , f7: Prelude.alt l.f7 r.f7 + , f8: Prelude.alt l.f8 r.f8 + , f9: Prelude.alt l.f9 r.f9 + , f10: Prelude.alt l.f10 r.f10 + , f11: Prelude.alt l.f11 r.f11 + , f12: Prelude.alt l.f12 r.f12 + , f13: Prelude.alt l.f13 r.f13 + , f14: Prelude.alt l.f14 r.f14 + , f15: Prelude.alt l.f15 r.f15 + , __unknown_fields: r.__unknown_fields <> l.__unknown_fields + } + + +-- | Enum generated by __protobuf__ from `pack.msg1.e1` +data Msg1_E1 + = Msg1_E1_One + | Msg1_E1_Two + | Msg1_E1_Three +derive instance genericMsg1_E1 :: Prelude.Generic Msg1_E1 _ +derive instance eqMsg1_E1 :: Prelude.Eq Msg1_E1 +instance showMsg1_E1 :: Prelude.Show Msg1_E1 where show = Prelude.genericShow +instance ordMsg1_E1 :: Prelude.Ord Msg1_E1 where compare = Prelude.genericCompare +instance boundedMsg1_E1 :: Prelude.Bounded Msg1_E1 + where + bottom = Prelude.genericBottom + top = Prelude.genericTop +instance enumMsg1_E1 :: Prelude.Enum Msg1_E1 + where + succ = Prelude.genericSucc + pred = Prelude.genericPred +instance boundedenumMsg1_E1 :: Prelude.BoundedEnum Msg1_E1 + where + cardinality = Prelude.genericCardinality + toEnum (0) = Prelude.Just Msg1_E1_One + toEnum (2) = Prelude.Just Msg1_E1_Two + toEnum (3) = Prelude.Just Msg1_E1_Three + toEnum _ = Prelude.Nothing + fromEnum Msg1_E1_One = (0) + fromEnum Msg1_E1_Two = (2) + fromEnum Msg1_E1_Three = (3) +instance defaultMsg1_E1 :: Prelude.Default Msg1_E1 + where + default = Msg1_E1_One + isDefault = eq Msg1_E1_One + diff --git a/plugin/test/Test/generated/msg2.Pack.purs b/plugin/test/Test/generated/msg2.Pack.purs new file mode 100644 index 0000000..35cb852 --- /dev/null +++ b/plugin/test/Test/generated/msg2.Pack.purs @@ -0,0 +1,227 @@ +-- | Generated by __protobuf__ from file `test/msg2.proto` +module Pack.Msg2 +( Msg2(..), Msg2Row, Msg2R, parseMsg2, putMsg2, defaultMsg2, mkMsg2, mergeMsg2 +, Msg2_E1(..) +) +where +import Protobuf.Internal.Prelude +import Protobuf.Internal.Prelude as Prelude + + + + +-- | Message generated by __protobuf__ from `pack.msg2` +newtype Msg2 = Msg2 Msg2R +type Msg2Row = + ( f1 :: Array Number + , f2 :: Array Prelude.Float32 + , f3 :: Array Int + , f4 :: Array Prelude.Int64 + , f5 :: Array Prelude.UInt + , f6 :: Array Prelude.UInt64 + , f7 :: Array Int + , f8 :: Array Prelude.Int64 + , f9 :: Array Prelude.UInt + , f10 :: Array Prelude.UInt64 + , f11 :: Array Prelude.Int64 + , f12 :: Array Boolean + , f13 :: Array String + , f14 :: Array Prelude.Bytes + , f15 :: Array Msg2_E1 + , __unknown_fields :: Array Prelude.UnknownField + ) +type Msg2R = Record Msg2Row +derive instance genericMsg2 :: Prelude.Generic Msg2 _ +derive instance newtypeMsg2 :: Prelude.Newtype Msg2 _ +derive instance eqMsg2 :: Prelude.Eq Msg2 +instance showMsg2 :: Prelude.Show Msg2 where show x = Prelude.genericShow x + +putMsg2 :: forall m. Prelude.MonadEffect m => Prelude.MonadRec m => Msg2 -> Prelude.PutM m Prelude.Unit +putMsg2 (Msg2 r) = do + Prelude.putPacked 1 r.f1 Prelude.encodeDouble + Prelude.putPacked 2 r.f2 Prelude.encodeFloat + Prelude.putPacked 3 r.f3 Prelude.encodeInt32 + Prelude.putPacked 4 r.f4 Prelude.encodeInt64 + Prelude.putPacked 5 r.f5 Prelude.encodeUint32 + Prelude.putPacked 6 r.f6 Prelude.encodeUint64 + Prelude.putPacked 7 r.f7 Prelude.encodeSint32 + Prelude.putPacked 8 r.f8 Prelude.encodeSint64 + Prelude.putPacked 9 r.f9 Prelude.encodeFixed32 + Prelude.putPacked 10 r.f10 Prelude.encodeFixed64 + Prelude.putPacked 11 r.f11 Prelude.encodeSfixed64 + Prelude.putPacked 12 r.f12 Prelude.encodeBool + Prelude.putRepeated 13 r.f13 Prelude.encodeStringField + Prelude.putRepeated 14 r.f14 $ Prelude.encodeBytesField + Prelude.putPacked 15 r.f15 Prelude.putEnum + Prelude.foldRecM (\_ x -> Prelude.putFieldUnknown x) unit r.__unknown_fields + +parseMsg2 :: forall m. Prelude.MonadEffect m => Prelude.MonadRec m => Prelude.ByteLength -> Prelude.ParserT Prelude.DataView m Msg2 +parseMsg2 length = Prelude.label "msg2 / " $ + Prelude.parseMessage Msg2 defaultMsg2 parseField length + where + parseField + :: Prelude.FieldNumberInt + -> Prelude.WireType + -> Prelude.ParserT Prelude.DataView m (Prelude.Builder Msg2R Msg2R) + parseField 1 Prelude.Bits64 = Prelude.label "f1 / " $ do + x <- Prelude.decodeDouble + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f1") $ Prelude.flip Prelude.snoc x + parseField 1 Prelude.LenDel = Prelude.label "f1 / " $ do + x <- Prelude.parseLenDel $ Prelude.decodeDoubleArray + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f1") $ Prelude.flip Prelude.append x + parseField 2 Prelude.Bits32 = Prelude.label "f2 / " $ do + x <- Prelude.decodeFloat + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f2") $ Prelude.flip Prelude.snoc x + parseField 2 Prelude.LenDel = Prelude.label "f2 / " $ do + x <- Prelude.parseLenDel $ Prelude.decodeFloatArray + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f2") $ Prelude.flip Prelude.append x + parseField 3 Prelude.VarInt = Prelude.label "f3 / " $ do + x <- Prelude.decodeInt32 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f3") $ Prelude.flip Prelude.snoc x + parseField 3 Prelude.LenDel = Prelude.label "f3 / " $ do + x <- Prelude.parseLenDel $ Prelude.manyLength Prelude.decodeInt32 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f3") $ Prelude.flip Prelude.append x + parseField 4 Prelude.VarInt = Prelude.label "f4 / " $ do + x <- Prelude.decodeInt64 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f4") $ Prelude.flip Prelude.snoc x + parseField 4 Prelude.LenDel = Prelude.label "f4 / " $ do + x <- Prelude.parseLenDel $ Prelude.manyLength Prelude.decodeInt64 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f4") $ Prelude.flip Prelude.append x + parseField 5 Prelude.VarInt = Prelude.label "f5 / " $ do + x <- Prelude.decodeUint32 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f5") $ Prelude.flip Prelude.snoc x + parseField 5 Prelude.LenDel = Prelude.label "f5 / " $ do + x <- Prelude.parseLenDel $ Prelude.manyLength Prelude.decodeUint32 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f5") $ Prelude.flip Prelude.append x + parseField 6 Prelude.VarInt = Prelude.label "f6 / " $ do + x <- Prelude.decodeUint64 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f6") $ Prelude.flip Prelude.snoc x + parseField 6 Prelude.LenDel = Prelude.label "f6 / " $ do + x <- Prelude.parseLenDel $ Prelude.manyLength Prelude.decodeUint64 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f6") $ Prelude.flip Prelude.append x + parseField 7 Prelude.VarInt = Prelude.label "f7 / " $ do + x <- Prelude.decodeSint32 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f7") $ Prelude.flip Prelude.snoc x + parseField 7 Prelude.LenDel = Prelude.label "f7 / " $ do + x <- Prelude.parseLenDel $ Prelude.manyLength Prelude.decodeSint32 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f7") $ Prelude.flip Prelude.append x + parseField 8 Prelude.VarInt = Prelude.label "f8 / " $ do + x <- Prelude.decodeSint64 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f8") $ Prelude.flip Prelude.snoc x + parseField 8 Prelude.LenDel = Prelude.label "f8 / " $ do + x <- Prelude.parseLenDel $ Prelude.manyLength Prelude.decodeSint64 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f8") $ Prelude.flip Prelude.append x + parseField 9 Prelude.Bits32 = Prelude.label "f9 / " $ do + x <- Prelude.decodeFixed32 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f9") $ Prelude.flip Prelude.snoc x + parseField 9 Prelude.LenDel = Prelude.label "f9 / " $ do + x <- Prelude.parseLenDel $ Prelude.decodeFixed32Array + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f9") $ Prelude.flip Prelude.append x + parseField 10 Prelude.Bits64 = Prelude.label "f10 / " $ do + x <- Prelude.decodeFixed64 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f10") $ Prelude.flip Prelude.snoc x + parseField 10 Prelude.LenDel = Prelude.label "f10 / " $ do + x <- Prelude.parseLenDel $ Prelude.decodeFixed64Array + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f10") $ Prelude.flip Prelude.append x + parseField 11 Prelude.Bits64 = Prelude.label "f11 / " $ do + x <- Prelude.decodeSfixed64 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f11") $ Prelude.flip Prelude.snoc x + parseField 11 Prelude.LenDel = Prelude.label "f11 / " $ do + x <- Prelude.parseLenDel $ Prelude.decodeSfixed64Array + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f11") $ Prelude.flip Prelude.append x + parseField 12 Prelude.VarInt = Prelude.label "f12 / " $ do + x <- Prelude.decodeBool + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f12") $ Prelude.flip Prelude.snoc x + parseField 12 Prelude.LenDel = Prelude.label "f12 / " $ do + x <- Prelude.parseLenDel $ Prelude.manyLength Prelude.decodeBool + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f12") $ Prelude.flip Prelude.append x + parseField 13 Prelude.LenDel = Prelude.label "f13 / " $ do + x <- Prelude.decodeString + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f13") $ Prelude.flip Prelude.snoc x + parseField 14 Prelude.LenDel = Prelude.label "f14 / " $ do + x <- Prelude.decodeBytes + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f14") $ Prelude.flip Prelude.snoc x + parseField 15 Prelude.VarInt = Prelude.label "f15 / " $ do + x <- Prelude.parseEnum + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f15") $ Prelude.flip Prelude.snoc x + parseField 15 Prelude.LenDel = Prelude.label "f15 / " $ do + x <- Prelude.parseLenDel $ Prelude.manyLength Prelude.parseEnum + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f15") $ Prelude.flip Prelude.append x + parseField fieldNumber wireType = Prelude.parseFieldUnknown fieldNumber wireType + +defaultMsg2 :: Msg2R +defaultMsg2 = + { f1: [] + , f2: [] + , f3: [] + , f4: [] + , f5: [] + , f6: [] + , f7: [] + , f8: [] + , f9: [] + , f10: [] + , f11: [] + , f12: [] + , f13: [] + , f14: [] + , f15: [] + , __unknown_fields: [] + } + +mkMsg2 :: forall r1 r3. Prelude.Union r1 Msg2Row r3 => Prelude.Nub r3 Msg2Row => Record r1 -> Msg2 +mkMsg2 r = Msg2 $ Prelude.merge r defaultMsg2 + +mergeMsg2 :: Msg2 -> Msg2 -> Msg2 +mergeMsg2 (Msg2 l) (Msg2 r) = Msg2 + { f1: r.f1 <> l.f1 + , f2: r.f2 <> l.f2 + , f3: r.f3 <> l.f3 + , f4: r.f4 <> l.f4 + , f5: r.f5 <> l.f5 + , f6: r.f6 <> l.f6 + , f7: r.f7 <> l.f7 + , f8: r.f8 <> l.f8 + , f9: r.f9 <> l.f9 + , f10: r.f10 <> l.f10 + , f11: r.f11 <> l.f11 + , f12: r.f12 <> l.f12 + , f13: r.f13 <> l.f13 + , f14: r.f14 <> l.f14 + , f15: r.f15 <> l.f15 + , __unknown_fields: r.__unknown_fields <> l.__unknown_fields + } + + +-- | Enum generated by __protobuf__ from `pack.msg2.e1` +data Msg2_E1 + = Msg2_E1_One + | Msg2_E1_Two + | Msg2_E1_Three +derive instance genericMsg2_E1 :: Prelude.Generic Msg2_E1 _ +derive instance eqMsg2_E1 :: Prelude.Eq Msg2_E1 +instance showMsg2_E1 :: Prelude.Show Msg2_E1 where show = Prelude.genericShow +instance ordMsg2_E1 :: Prelude.Ord Msg2_E1 where compare = Prelude.genericCompare +instance boundedMsg2_E1 :: Prelude.Bounded Msg2_E1 + where + bottom = Prelude.genericBottom + top = Prelude.genericTop +instance enumMsg2_E1 :: Prelude.Enum Msg2_E1 + where + succ = Prelude.genericSucc + pred = Prelude.genericPred +instance boundedenumMsg2_E1 :: Prelude.BoundedEnum Msg2_E1 + where + cardinality = Prelude.genericCardinality + toEnum (0) = Prelude.Just Msg2_E1_One + toEnum (2) = Prelude.Just Msg2_E1_Two + toEnum (3) = Prelude.Just Msg2_E1_Three + toEnum _ = Prelude.Nothing + fromEnum Msg2_E1_One = (0) + fromEnum Msg2_E1_Two = (2) + fromEnum Msg2_E1_Three = (3) +instance defaultMsg2_E1 :: Prelude.Default Msg2_E1 + where + default = Msg2_E1_One + isDefault = eq Msg2_E1_One + diff --git a/plugin/test/Test/generated/msg3.Pack3.purs b/plugin/test/Test/generated/msg3.Pack3.purs new file mode 100644 index 0000000..1f9a011 --- /dev/null +++ b/plugin/test/Test/generated/msg3.Pack3.purs @@ -0,0 +1,120 @@ +-- | Generated by __protobuf__ from file `test/msg3.proto` +module Pack3.Msg3 +( Msg3(..), Msg3Row, Msg3R, parseMsg3, putMsg3, defaultMsg3, mkMsg3, mergeMsg3 +, Msg3_Msg4(..), Msg3_Msg4Row, Msg3_Msg4R, parseMsg3_Msg4, putMsg3_Msg4, defaultMsg3_Msg4, mkMsg3_Msg4, mergeMsg3_Msg4 +) +where +import Protobuf.Internal.Prelude +import Protobuf.Internal.Prelude as Prelude + +import Pack.Msg1 as Pack +import Pack.Msg2 as Pack + + + +-- | Message generated by __protobuf__ from `pack3.msg3` +newtype Msg3 = Msg3 Msg3R +type Msg3Row = + ( f1 :: Array Pack.Msg1 + , f2 :: Array Pack.Msg2 + , f4 :: Array Msg3_Msg4 + , __unknown_fields :: Array Prelude.UnknownField + ) +type Msg3R = Record Msg3Row +derive instance genericMsg3 :: Prelude.Generic Msg3 _ +derive instance newtypeMsg3 :: Prelude.Newtype Msg3 _ +derive instance eqMsg3 :: Prelude.Eq Msg3 +instance showMsg3 :: Prelude.Show Msg3 where show x = Prelude.genericShow x + +putMsg3 :: forall m. Prelude.MonadEffect m => Prelude.MonadRec m => Msg3 -> Prelude.PutM m Prelude.Unit +putMsg3 (Msg3 r) = do + Prelude.putRepeated 1 r.f1 $ Prelude.putLenDel Pack.putMsg1 + Prelude.putRepeated 2 r.f2 $ Prelude.putLenDel Pack.putMsg2 + Prelude.putRepeated 4 r.f4 $ Prelude.putLenDel putMsg3_Msg4 + Prelude.foldRecM (\_ x -> Prelude.putFieldUnknown x) unit r.__unknown_fields + +parseMsg3 :: forall m. Prelude.MonadEffect m => Prelude.MonadRec m => Prelude.ByteLength -> Prelude.ParserT Prelude.DataView m Msg3 +parseMsg3 length = Prelude.label "msg3 / " $ + Prelude.parseMessage Msg3 defaultMsg3 parseField length + where + parseField + :: Prelude.FieldNumberInt + -> Prelude.WireType + -> Prelude.ParserT Prelude.DataView m (Prelude.Builder Msg3R Msg3R) + parseField 1 Prelude.LenDel = Prelude.label "f1 / " $ do + x <- Prelude.parseLenDel Pack.parseMsg1 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f1") $ Prelude.flip Prelude.snoc x + parseField 2 Prelude.LenDel = Prelude.label "f2 / " $ do + x <- Prelude.parseLenDel Pack.parseMsg2 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f2") $ Prelude.flip Prelude.snoc x + parseField 4 Prelude.LenDel = Prelude.label "f4 / " $ do + x <- Prelude.parseLenDel parseMsg3_Msg4 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f4") $ Prelude.flip Prelude.snoc x + parseField fieldNumber wireType = Prelude.parseFieldUnknown fieldNumber wireType + +defaultMsg3 :: Msg3R +defaultMsg3 = + { f1: [] + , f2: [] + , f4: [] + , __unknown_fields: [] + } + +mkMsg3 :: forall r1 r3. Prelude.Union r1 Msg3Row r3 => Prelude.Nub r3 Msg3Row => Record r1 -> Msg3 +mkMsg3 r = Msg3 $ Prelude.merge r defaultMsg3 + +mergeMsg3 :: Msg3 -> Msg3 -> Msg3 +mergeMsg3 (Msg3 l) (Msg3 r) = Msg3 + { f1: r.f1 <> l.f1 + , f2: r.f2 <> l.f2 + , f4: r.f4 <> l.f4 + , __unknown_fields: r.__unknown_fields <> l.__unknown_fields + } + + +-- | Message generated by __protobuf__ from `pack3.msg3.msg4` +newtype Msg3_Msg4 = Msg3_Msg4 Msg3_Msg4R +type Msg3_Msg4Row = + ( f1 :: Prelude.Maybe Int + , __unknown_fields :: Array Prelude.UnknownField + ) +type Msg3_Msg4R = Record Msg3_Msg4Row +derive instance genericMsg3_Msg4 :: Prelude.Generic Msg3_Msg4 _ +derive instance newtypeMsg3_Msg4 :: Prelude.Newtype Msg3_Msg4 _ +derive instance eqMsg3_Msg4 :: Prelude.Eq Msg3_Msg4 +instance showMsg3_Msg4 :: Prelude.Show Msg3_Msg4 where show x = Prelude.genericShow x + +putMsg3_Msg4 :: forall m. Prelude.MonadEffect m => Prelude.MonadRec m => Msg3_Msg4 -> Prelude.PutM m Prelude.Unit +putMsg3_Msg4 (Msg3_Msg4 r) = do + Prelude.putOptional 1 r.f1 Prelude.isDefault Prelude.encodeInt32Field + Prelude.foldRecM (\_ x -> Prelude.putFieldUnknown x) unit r.__unknown_fields + +parseMsg3_Msg4 :: forall m. Prelude.MonadEffect m => Prelude.MonadRec m => Prelude.ByteLength -> Prelude.ParserT Prelude.DataView m Msg3_Msg4 +parseMsg3_Msg4 length = Prelude.label "msg4 / " $ + Prelude.parseMessage Msg3_Msg4 defaultMsg3_Msg4 parseField length + where + parseField + :: Prelude.FieldNumberInt + -> Prelude.WireType + -> Prelude.ParserT Prelude.DataView m (Prelude.Builder Msg3_Msg4R Msg3_Msg4R) + parseField 1 Prelude.VarInt = Prelude.label "f1 / " $ do + x <- Prelude.decodeInt32 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f1") $ \_ -> Prelude.Just x + parseField fieldNumber wireType = Prelude.parseFieldUnknown fieldNumber wireType + +defaultMsg3_Msg4 :: Msg3_Msg4R +defaultMsg3_Msg4 = + { f1: Prelude.Nothing + , __unknown_fields: [] + } + +mkMsg3_Msg4 :: forall r1 r3. Prelude.Union r1 Msg3_Msg4Row r3 => Prelude.Nub r3 Msg3_Msg4Row => Record r1 -> Msg3_Msg4 +mkMsg3_Msg4 r = Msg3_Msg4 $ Prelude.merge r defaultMsg3_Msg4 + +mergeMsg3_Msg4 :: Msg3_Msg4 -> Msg3_Msg4 -> Msg3_Msg4 +mergeMsg3_Msg4 (Msg3_Msg4 l) (Msg3_Msg4 r) = Msg3_Msg4 + { f1: Prelude.alt l.f1 r.f1 + , __unknown_fields: r.__unknown_fields <> l.__unknown_fields + } + + diff --git a/plugin/test/Test/generated/msg4.Pack4.purs b/plugin/test/Test/generated/msg4.Pack4.purs new file mode 100644 index 0000000..fc1078b --- /dev/null +++ b/plugin/test/Test/generated/msg4.Pack4.purs @@ -0,0 +1,212 @@ +-- | Generated by __protobuf__ from file `test/msg4.proto` +module Pack4.Msg4 +( Msg2(..), Msg2Row, Msg2R, parseMsg2, putMsg2, defaultMsg2, mkMsg2, mergeMsg2 +, Msg1(..), Msg1Row, Msg1R, parseMsg1, putMsg1, defaultMsg1, mkMsg1, mergeMsg1 +, Msg1_Msg2(..), Msg1_Msg2Row, Msg1_Msg2R, parseMsg1_Msg2, putMsg1_Msg2, defaultMsg1_Msg2, mkMsg1_Msg2, mergeMsg1_Msg2 +, Msg1_MappyEntry(..), Msg1_MappyEntryRow, Msg1_MappyEntryR, parseMsg1_MappyEntry, putMsg1_MappyEntry, defaultMsg1_MappyEntry, mkMsg1_MappyEntry, mergeMsg1_MappyEntry +) +where +import Protobuf.Internal.Prelude +import Protobuf.Internal.Prelude as Prelude + + + + +-- | Message generated by __protobuf__ from `pack4.msg2` +newtype Msg2 = Msg2 Msg2R +type Msg2Row = + ( f1 :: Prelude.Maybe Msg1_Msg2 + , __unknown_fields :: Array Prelude.UnknownField + ) +type Msg2R = Record Msg2Row +derive instance genericMsg2 :: Prelude.Generic Msg2 _ +derive instance newtypeMsg2 :: Prelude.Newtype Msg2 _ +derive instance eqMsg2 :: Prelude.Eq Msg2 +instance showMsg2 :: Prelude.Show Msg2 where show x = Prelude.genericShow x + +putMsg2 :: forall m. Prelude.MonadEffect m => Prelude.MonadRec m => Msg2 -> Prelude.PutM m Prelude.Unit +putMsg2 (Msg2 r) = do + Prelude.putOptional 1 r.f1 (\_ -> false) $ Prelude.putLenDel putMsg1_Msg2 + Prelude.foldRecM (\_ x -> Prelude.putFieldUnknown x) unit r.__unknown_fields + +parseMsg2 :: forall m. Prelude.MonadEffect m => Prelude.MonadRec m => Prelude.ByteLength -> Prelude.ParserT Prelude.DataView m Msg2 +parseMsg2 length = Prelude.label "msg2 / " $ + Prelude.parseMessage Msg2 defaultMsg2 parseField length + where + parseField + :: Prelude.FieldNumberInt + -> Prelude.WireType + -> Prelude.ParserT Prelude.DataView m (Prelude.Builder Msg2R Msg2R) + parseField 1 Prelude.LenDel = Prelude.label "F1 / " $ do + x <- Prelude.parseLenDel parseMsg1_Msg2 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f1") $ Prelude.Just Prelude.<<< Prelude.maybe x (mergeMsg1_Msg2 x) + parseField fieldNumber wireType = Prelude.parseFieldUnknown fieldNumber wireType + +defaultMsg2 :: Msg2R +defaultMsg2 = + { f1: Prelude.Nothing + , __unknown_fields: [] + } + +mkMsg2 :: forall r1 r3. Prelude.Union r1 Msg2Row r3 => Prelude.Nub r3 Msg2Row => Record r1 -> Msg2 +mkMsg2 r = Msg2 $ Prelude.merge r defaultMsg2 + +mergeMsg2 :: Msg2 -> Msg2 -> Msg2 +mergeMsg2 (Msg2 l) (Msg2 r) = Msg2 + { f1: Prelude.mergeWith mergeMsg1_Msg2 l.f1 r.f1 + , __unknown_fields: r.__unknown_fields <> l.__unknown_fields + } + + +-- | Message generated by __protobuf__ from `pack4.msg1` +newtype Msg1 = Msg1 Msg1R +type Msg1Row = + ( nested :: Prelude.Maybe String + , mappy :: Array Msg1_MappyEntry + , __unknown_fields :: Array Prelude.UnknownField + ) +type Msg1R = Record Msg1Row +derive instance genericMsg1 :: Prelude.Generic Msg1 _ +derive instance newtypeMsg1 :: Prelude.Newtype Msg1 _ +derive instance eqMsg1 :: Prelude.Eq Msg1 +instance showMsg1 :: Prelude.Show Msg1 where show x = Prelude.genericShow x + +putMsg1 :: forall m. Prelude.MonadEffect m => Prelude.MonadRec m => Msg1 -> Prelude.PutM m Prelude.Unit +putMsg1 (Msg1 r) = do + Prelude.putOptional 1 r.nested Prelude.isDefault Prelude.encodeStringField + Prelude.putRepeated 2 r.mappy $ Prelude.putLenDel putMsg1_MappyEntry + Prelude.foldRecM (\_ x -> Prelude.putFieldUnknown x) unit r.__unknown_fields + +parseMsg1 :: forall m. Prelude.MonadEffect m => Prelude.MonadRec m => Prelude.ByteLength -> Prelude.ParserT Prelude.DataView m Msg1 +parseMsg1 length = Prelude.label "msg1 / " $ + Prelude.parseMessage Msg1 defaultMsg1 parseField length + where + parseField + :: Prelude.FieldNumberInt + -> Prelude.WireType + -> Prelude.ParserT Prelude.DataView m (Prelude.Builder Msg1R Msg1R) + parseField 1 Prelude.LenDel = Prelude.label "Nested / " $ do + x <- Prelude.decodeString + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "nested") $ \_ -> Prelude.Just x + parseField 2 Prelude.LenDel = Prelude.label "mappy / " $ do + x <- Prelude.parseLenDel parseMsg1_MappyEntry + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "mappy") $ Prelude.flip Prelude.snoc x + parseField fieldNumber wireType = Prelude.parseFieldUnknown fieldNumber wireType + +defaultMsg1 :: Msg1R +defaultMsg1 = + { nested: Prelude.Nothing + , mappy: [] + , __unknown_fields: [] + } + +mkMsg1 :: forall r1 r3. Prelude.Union r1 Msg1Row r3 => Prelude.Nub r3 Msg1Row => Record r1 -> Msg1 +mkMsg1 r = Msg1 $ Prelude.merge r defaultMsg1 + +mergeMsg1 :: Msg1 -> Msg1 -> Msg1 +mergeMsg1 (Msg1 l) (Msg1 r) = Msg1 + { nested: Prelude.alt l.nested r.nested + , mappy: r.mappy <> l.mappy + , __unknown_fields: r.__unknown_fields <> l.__unknown_fields + } + + +-- | Message generated by __protobuf__ from `pack4.msg1.msg2` +newtype Msg1_Msg2 = Msg1_Msg2 Msg1_Msg2R +type Msg1_Msg2Row = + ( nested :: Prelude.Maybe String + , __unknown_fields :: Array Prelude.UnknownField + ) +type Msg1_Msg2R = Record Msg1_Msg2Row +derive instance genericMsg1_Msg2 :: Prelude.Generic Msg1_Msg2 _ +derive instance newtypeMsg1_Msg2 :: Prelude.Newtype Msg1_Msg2 _ +derive instance eqMsg1_Msg2 :: Prelude.Eq Msg1_Msg2 +instance showMsg1_Msg2 :: Prelude.Show Msg1_Msg2 where show x = Prelude.genericShow x + +putMsg1_Msg2 :: forall m. Prelude.MonadEffect m => Prelude.MonadRec m => Msg1_Msg2 -> Prelude.PutM m Prelude.Unit +putMsg1_Msg2 (Msg1_Msg2 r) = do + Prelude.putOptional 1 r.nested Prelude.isDefault Prelude.encodeStringField + Prelude.foldRecM (\_ x -> Prelude.putFieldUnknown x) unit r.__unknown_fields + +parseMsg1_Msg2 :: forall m. Prelude.MonadEffect m => Prelude.MonadRec m => Prelude.ByteLength -> Prelude.ParserT Prelude.DataView m Msg1_Msg2 +parseMsg1_Msg2 length = Prelude.label "msg2 / " $ + Prelude.parseMessage Msg1_Msg2 defaultMsg1_Msg2 parseField length + where + parseField + :: Prelude.FieldNumberInt + -> Prelude.WireType + -> Prelude.ParserT Prelude.DataView m (Prelude.Builder Msg1_Msg2R Msg1_Msg2R) + parseField 1 Prelude.LenDel = Prelude.label "Nested / " $ do + x <- Prelude.decodeString + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "nested") $ \_ -> Prelude.Just x + parseField fieldNumber wireType = Prelude.parseFieldUnknown fieldNumber wireType + +defaultMsg1_Msg2 :: Msg1_Msg2R +defaultMsg1_Msg2 = + { nested: Prelude.Nothing + , __unknown_fields: [] + } + +mkMsg1_Msg2 :: forall r1 r3. Prelude.Union r1 Msg1_Msg2Row r3 => Prelude.Nub r3 Msg1_Msg2Row => Record r1 -> Msg1_Msg2 +mkMsg1_Msg2 r = Msg1_Msg2 $ Prelude.merge r defaultMsg1_Msg2 + +mergeMsg1_Msg2 :: Msg1_Msg2 -> Msg1_Msg2 -> Msg1_Msg2 +mergeMsg1_Msg2 (Msg1_Msg2 l) (Msg1_Msg2 r) = Msg1_Msg2 + { nested: Prelude.alt l.nested r.nested + , __unknown_fields: r.__unknown_fields <> l.__unknown_fields + } + + +-- | Message generated by __protobuf__ from `pack4.msg1.MappyEntry` +newtype Msg1_MappyEntry = Msg1_MappyEntry Msg1_MappyEntryR +type Msg1_MappyEntryRow = + ( key :: Prelude.Maybe String + , value :: Prelude.Maybe String + , __unknown_fields :: Array Prelude.UnknownField + ) +type Msg1_MappyEntryR = Record Msg1_MappyEntryRow +derive instance genericMsg1_MappyEntry :: Prelude.Generic Msg1_MappyEntry _ +derive instance newtypeMsg1_MappyEntry :: Prelude.Newtype Msg1_MappyEntry _ +derive instance eqMsg1_MappyEntry :: Prelude.Eq Msg1_MappyEntry +instance showMsg1_MappyEntry :: Prelude.Show Msg1_MappyEntry where show x = Prelude.genericShow x + +putMsg1_MappyEntry :: forall m. Prelude.MonadEffect m => Prelude.MonadRec m => Msg1_MappyEntry -> Prelude.PutM m Prelude.Unit +putMsg1_MappyEntry (Msg1_MappyEntry r) = do + Prelude.putOptional 1 r.key Prelude.isDefault Prelude.encodeStringField + Prelude.putOptional 2 r.value Prelude.isDefault Prelude.encodeStringField + Prelude.foldRecM (\_ x -> Prelude.putFieldUnknown x) unit r.__unknown_fields + +parseMsg1_MappyEntry :: forall m. Prelude.MonadEffect m => Prelude.MonadRec m => Prelude.ByteLength -> Prelude.ParserT Prelude.DataView m Msg1_MappyEntry +parseMsg1_MappyEntry length = Prelude.label "MappyEntry / " $ + Prelude.parseMessage Msg1_MappyEntry defaultMsg1_MappyEntry parseField length + where + parseField + :: Prelude.FieldNumberInt + -> Prelude.WireType + -> Prelude.ParserT Prelude.DataView m (Prelude.Builder Msg1_MappyEntryR Msg1_MappyEntryR) + parseField 1 Prelude.LenDel = Prelude.label "key / " $ do + x <- Prelude.decodeString + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "key") $ \_ -> Prelude.Just x + parseField 2 Prelude.LenDel = Prelude.label "value / " $ do + x <- Prelude.decodeString + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "value") $ \_ -> Prelude.Just x + parseField fieldNumber wireType = Prelude.parseFieldUnknown fieldNumber wireType + +defaultMsg1_MappyEntry :: Msg1_MappyEntryR +defaultMsg1_MappyEntry = + { key: Prelude.Nothing + , value: Prelude.Nothing + , __unknown_fields: [] + } + +mkMsg1_MappyEntry :: forall r1 r3. Prelude.Union r1 Msg1_MappyEntryRow r3 => Prelude.Nub r3 Msg1_MappyEntryRow => Record r1 -> Msg1_MappyEntry +mkMsg1_MappyEntry r = Msg1_MappyEntry $ Prelude.merge r defaultMsg1_MappyEntry + +mergeMsg1_MappyEntry :: Msg1_MappyEntry -> Msg1_MappyEntry -> Msg1_MappyEntry +mergeMsg1_MappyEntry (Msg1_MappyEntry l) (Msg1_MappyEntry r) = Msg1_MappyEntry + { key: Prelude.alt l.key r.key + , value: Prelude.alt l.value r.value + , __unknown_fields: r.__unknown_fields <> l.__unknown_fields + } + + diff --git a/plugin/test/Test/generated/msg5.Pack5.purs b/plugin/test/Test/generated/msg5.Pack5.purs new file mode 100644 index 0000000..c014b12 --- /dev/null +++ b/plugin/test/Test/generated/msg5.Pack5.purs @@ -0,0 +1,232 @@ +-- | Generated by __protobuf__ from file `test/msg5.proto` +module Pack5.Msg5 +( Msg1(..), Msg1Row, Msg1R, parseMsg1, putMsg1, defaultMsg1, mkMsg1, mergeMsg1, Msg1_Sum1(..) +, Msg2(..), Msg2Row, Msg2R, parseMsg2, putMsg2, defaultMsg2, mkMsg2, mergeMsg2, Msg2_Sum1(..) +, Msg1_E1(..) +) +where +import Protobuf.Internal.Prelude +import Protobuf.Internal.Prelude as Prelude + + + + +-- | Message generated by __protobuf__ from `pack5.Msg1` +newtype Msg1 = Msg1 Msg1R +type Msg1Row = + ( sum1 :: Prelude.Maybe Msg1_Sum1 + , __unknown_fields :: Array Prelude.UnknownField + ) +type Msg1R = Record Msg1Row +derive instance genericMsg1 :: Prelude.Generic Msg1 _ +derive instance newtypeMsg1 :: Prelude.Newtype Msg1 _ +derive instance eqMsg1 :: Prelude.Eq Msg1 +instance showMsg1 :: Prelude.Show Msg1 where show x = Prelude.genericShow x + +putMsg1 :: forall m. Prelude.MonadEffect m => Prelude.MonadRec m => Msg1 -> Prelude.PutM m Prelude.Unit +putMsg1 (Msg1 r) = do + case r.sum1 of + Prelude.Nothing -> pure Prelude.unit + Prelude.Just (Msg1_Sum1_F1 x) -> Prelude.putOptional 1 (Prelude.Just x) (\_ -> false) Prelude.encodeDoubleField + Prelude.Just (Msg1_Sum1_F2 x) -> Prelude.putOptional 2 (Prelude.Just x) (\_ -> false) Prelude.encodeFloatField + Prelude.Just (Msg1_Sum1_F3 x) -> Prelude.putOptional 3 (Prelude.Just x) (\_ -> false) Prelude.encodeInt32Field + Prelude.Just (Msg1_Sum1_F4 x) -> Prelude.putOptional 4 (Prelude.Just x) (\_ -> false) Prelude.encodeInt64Field + Prelude.Just (Msg1_Sum1_F5 x) -> Prelude.putOptional 5 (Prelude.Just x) (\_ -> false) Prelude.encodeUint32Field + Prelude.Just (Msg1_Sum1_F6 x) -> Prelude.putOptional 6 (Prelude.Just x) (\_ -> false) Prelude.encodeUint64Field + Prelude.Just (Msg1_Sum1_F7 x) -> Prelude.putOptional 7 (Prelude.Just x) (\_ -> false) Prelude.encodeSint32Field + Prelude.Just (Msg1_Sum1_F8 x) -> Prelude.putOptional 8 (Prelude.Just x) (\_ -> false) Prelude.encodeSint64Field + Prelude.Just (Msg1_Sum1_F9 x) -> Prelude.putOptional 9 (Prelude.Just x) (\_ -> false) Prelude.encodeFixed32Field + Prelude.Just (Msg1_Sum1_F10 x) -> Prelude.putOptional 10 (Prelude.Just x) (\_ -> false) Prelude.encodeFixed64Field + Prelude.Just (Msg1_Sum1_F11 x) -> Prelude.putOptional 11 (Prelude.Just x) (\_ -> false) Prelude.encodeSfixed64Field + Prelude.Just (Msg1_Sum1_F12 x) -> Prelude.putOptional 12 (Prelude.Just x) (\_ -> false) Prelude.encodeBoolField + Prelude.Just (Msg1_Sum1_F13 x) -> Prelude.putOptional 13 (Prelude.Just x) (\_ -> false) Prelude.encodeStringField + Prelude.Just (Msg1_Sum1_F15 x) -> Prelude.putOptional 15 (Prelude.Just x) (\_ -> false) Prelude.putEnumField + Prelude.foldRecM (\_ x -> Prelude.putFieldUnknown x) unit r.__unknown_fields + +parseMsg1 :: forall m. Prelude.MonadEffect m => Prelude.MonadRec m => Prelude.ByteLength -> Prelude.ParserT Prelude.DataView m Msg1 +parseMsg1 length = Prelude.label "Msg1 / " $ + Prelude.parseMessage Msg1 defaultMsg1 parseField length + where + parseField + :: Prelude.FieldNumberInt + -> Prelude.WireType + -> Prelude.ParserT Prelude.DataView m (Prelude.Builder Msg1R Msg1R) + parseField 1 Prelude.Bits64 = Prelude.label "F1 / " $ do + x <- Prelude.decodeDouble + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "sum1") $ \_ -> Prelude.Just (Msg1_Sum1_F1 x) + parseField 2 Prelude.Bits32 = Prelude.label "F2 / " $ do + x <- Prelude.decodeFloat + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "sum1") $ \_ -> Prelude.Just (Msg1_Sum1_F2 x) + parseField 3 Prelude.VarInt = Prelude.label "F3 / " $ do + x <- Prelude.decodeInt32 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "sum1") $ \_ -> Prelude.Just (Msg1_Sum1_F3 x) + parseField 4 Prelude.VarInt = Prelude.label "F4 / " $ do + x <- Prelude.decodeInt64 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "sum1") $ \_ -> Prelude.Just (Msg1_Sum1_F4 x) + parseField 5 Prelude.VarInt = Prelude.label "F5 / " $ do + x <- Prelude.decodeUint32 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "sum1") $ \_ -> Prelude.Just (Msg1_Sum1_F5 x) + parseField 6 Prelude.VarInt = Prelude.label "F6 / " $ do + x <- Prelude.decodeUint64 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "sum1") $ \_ -> Prelude.Just (Msg1_Sum1_F6 x) + parseField 7 Prelude.VarInt = Prelude.label "F7 / " $ do + x <- Prelude.decodeSint32 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "sum1") $ \_ -> Prelude.Just (Msg1_Sum1_F7 x) + parseField 8 Prelude.VarInt = Prelude.label "F8 / " $ do + x <- Prelude.decodeSint64 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "sum1") $ \_ -> Prelude.Just (Msg1_Sum1_F8 x) + parseField 9 Prelude.Bits32 = Prelude.label "F9 / " $ do + x <- Prelude.decodeFixed32 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "sum1") $ \_ -> Prelude.Just (Msg1_Sum1_F9 x) + parseField 10 Prelude.Bits64 = Prelude.label "F10 / " $ do + x <- Prelude.decodeFixed64 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "sum1") $ \_ -> Prelude.Just (Msg1_Sum1_F10 x) + parseField 11 Prelude.Bits64 = Prelude.label "F11 / " $ do + x <- Prelude.decodeSfixed64 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "sum1") $ \_ -> Prelude.Just (Msg1_Sum1_F11 x) + parseField 12 Prelude.VarInt = Prelude.label "F12 / " $ do + x <- Prelude.decodeBool + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "sum1") $ \_ -> Prelude.Just (Msg1_Sum1_F12 x) + parseField 13 Prelude.LenDel = Prelude.label "F13 / " $ do + x <- Prelude.decodeString + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "sum1") $ \_ -> Prelude.Just (Msg1_Sum1_F13 x) + parseField 15 Prelude.VarInt = Prelude.label "F15 / " $ do + x <- Prelude.parseEnum + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "sum1") $ \_ -> Prelude.Just (Msg1_Sum1_F15 x) + parseField fieldNumber wireType = Prelude.parseFieldUnknown fieldNumber wireType + +defaultMsg1 :: Msg1R +defaultMsg1 = + { sum1: Prelude.Nothing + , __unknown_fields: [] + } + +mkMsg1 :: forall r1 r3. Prelude.Union r1 Msg1Row r3 => Prelude.Nub r3 Msg1Row => Record r1 -> Msg1 +mkMsg1 r = Msg1 $ Prelude.merge r defaultMsg1 +data Msg1_Sum1 + = Msg1_Sum1_F1 Number + | Msg1_Sum1_F2 Prelude.Float32 + | Msg1_Sum1_F3 Int + | Msg1_Sum1_F4 Prelude.Int64 + | Msg1_Sum1_F5 Prelude.UInt + | Msg1_Sum1_F6 Prelude.UInt64 + | Msg1_Sum1_F7 Int + | Msg1_Sum1_F8 Prelude.Int64 + | Msg1_Sum1_F9 Prelude.UInt + | Msg1_Sum1_F10 Prelude.UInt64 + | Msg1_Sum1_F11 Prelude.Int64 + | Msg1_Sum1_F12 Boolean + | Msg1_Sum1_F13 String + | Msg1_Sum1_F15 Msg1_E1 + +derive instance genericMsg1_Sum1 :: Prelude.Generic Msg1_Sum1 _ +derive instance eqMsg1_Sum1 :: Prelude.Eq Msg1_Sum1 +instance showMsg1_Sum1 :: Prelude.Show Msg1_Sum1 where show = Prelude.genericShow + +mergeMsg1_Sum1 :: Prelude.Maybe Msg1_Sum1 -> Prelude.Maybe Msg1_Sum1 -> Prelude.Maybe Msg1_Sum1 +mergeMsg1_Sum1 l r = case Prelude.Tuple l r of + _ -> Prelude.alt l r + +mergeMsg1 :: Msg1 -> Msg1 -> Msg1 +mergeMsg1 (Msg1 l) (Msg1 r) = Msg1 + { sum1: mergeMsg1_Sum1 l.sum1 r.sum1 + , __unknown_fields: r.__unknown_fields <> l.__unknown_fields + } + + +-- | Message generated by __protobuf__ from `pack5.msg2` +newtype Msg2 = Msg2 Msg2R +type Msg2Row = + ( sum1 :: Prelude.Maybe Msg2_Sum1 + , __unknown_fields :: Array Prelude.UnknownField + ) +type Msg2R = Record Msg2Row +derive instance genericMsg2 :: Prelude.Generic Msg2 _ +derive instance newtypeMsg2 :: Prelude.Newtype Msg2 _ +derive instance eqMsg2 :: Prelude.Eq Msg2 +instance showMsg2 :: Prelude.Show Msg2 where show x = Prelude.genericShow x + +putMsg2 :: forall m. Prelude.MonadEffect m => Prelude.MonadRec m => Msg2 -> Prelude.PutM m Prelude.Unit +putMsg2 (Msg2 r) = do + case r.sum1 of + Prelude.Nothing -> pure Prelude.unit + Prelude.Just (Msg2_Sum1_F1 x) -> Prelude.putOptional 1 (Prelude.Just x) (\_ -> false) $ Prelude.putLenDel putMsg1 + Prelude.Just (Msg2_Sum1_F2 x) -> Prelude.putOptional 2 (Prelude.Just x) (\_ -> false) Prelude.encodeStringField + Prelude.foldRecM (\_ x -> Prelude.putFieldUnknown x) unit r.__unknown_fields + +parseMsg2 :: forall m. Prelude.MonadEffect m => Prelude.MonadRec m => Prelude.ByteLength -> Prelude.ParserT Prelude.DataView m Msg2 +parseMsg2 length = Prelude.label "msg2 / " $ + Prelude.parseMessage Msg2 defaultMsg2 parseField length + where + parseField + :: Prelude.FieldNumberInt + -> Prelude.WireType + -> Prelude.ParserT Prelude.DataView m (Prelude.Builder Msg2R Msg2R) + parseField 1 Prelude.LenDel = Prelude.label "f1 / " $ do + x <- Prelude.parseLenDel parseMsg1 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "sum1") $ mergeMsg2_Sum1 (Prelude.Just (Msg2_Sum1_F1 x)) + parseField 2 Prelude.LenDel = Prelude.label "f2 / " $ do + x <- Prelude.decodeString + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "sum1") $ \_ -> Prelude.Just (Msg2_Sum1_F2 x) + parseField fieldNumber wireType = Prelude.parseFieldUnknown fieldNumber wireType + +defaultMsg2 :: Msg2R +defaultMsg2 = + { sum1: Prelude.Nothing + , __unknown_fields: [] + } + +mkMsg2 :: forall r1 r3. Prelude.Union r1 Msg2Row r3 => Prelude.Nub r3 Msg2Row => Record r1 -> Msg2 +mkMsg2 r = Msg2 $ Prelude.merge r defaultMsg2 +data Msg2_Sum1 + = Msg2_Sum1_F1 Msg1 + | Msg2_Sum1_F2 String + +derive instance genericMsg2_Sum1 :: Prelude.Generic Msg2_Sum1 _ +derive instance eqMsg2_Sum1 :: Prelude.Eq Msg2_Sum1 +instance showMsg2_Sum1 :: Prelude.Show Msg2_Sum1 where show = Prelude.genericShow + +mergeMsg2_Sum1 :: Prelude.Maybe Msg2_Sum1 -> Prelude.Maybe Msg2_Sum1 -> Prelude.Maybe Msg2_Sum1 +mergeMsg2_Sum1 l r = case Prelude.Tuple l r of + Prelude.Tuple (Prelude.Just (Msg2_Sum1_F1 l')) (Prelude.Just (Msg2_Sum1_F1 r')) -> Prelude.map Msg2_Sum1_F1 $ Prelude.mergeWith mergeMsg1 (Prelude.Just l') (Prelude.Just r') + _ -> Prelude.alt l r + +mergeMsg2 :: Msg2 -> Msg2 -> Msg2 +mergeMsg2 (Msg2 l) (Msg2 r) = Msg2 + { sum1: mergeMsg2_Sum1 l.sum1 r.sum1 + , __unknown_fields: r.__unknown_fields <> l.__unknown_fields + } + + +-- | Enum generated by __protobuf__ from `pack5.Msg1.e1` +data Msg1_E1 + = Msg1_E1_One + | Msg1_E1_Two + | Msg1_E1_Three +derive instance genericMsg1_E1 :: Prelude.Generic Msg1_E1 _ +derive instance eqMsg1_E1 :: Prelude.Eq Msg1_E1 +instance showMsg1_E1 :: Prelude.Show Msg1_E1 where show = Prelude.genericShow +instance ordMsg1_E1 :: Prelude.Ord Msg1_E1 where compare = Prelude.genericCompare +instance boundedMsg1_E1 :: Prelude.Bounded Msg1_E1 + where + bottom = Prelude.genericBottom + top = Prelude.genericTop +instance enumMsg1_E1 :: Prelude.Enum Msg1_E1 + where + succ = Prelude.genericSucc + pred = Prelude.genericPred +instance boundedenumMsg1_E1 :: Prelude.BoundedEnum Msg1_E1 + where + cardinality = Prelude.genericCardinality + toEnum (0) = Prelude.Just Msg1_E1_One + toEnum (2) = Prelude.Just Msg1_E1_Two + toEnum (3) = Prelude.Just Msg1_E1_Three + toEnum _ = Prelude.Nothing + fromEnum Msg1_E1_One = (0) + fromEnum Msg1_E1_Two = (2) + fromEnum Msg1_E1_Three = (3) +instance defaultMsg1_E1 :: Prelude.Default Msg1_E1 + where + default = Msg1_E1_One + isDefault = eq Msg1_E1_One + diff --git a/plugin/test/Test/generated/msg5_1.Pack5.purs b/plugin/test/Test/generated/msg5_1.Pack5.purs new file mode 100644 index 0000000..3bc693b --- /dev/null +++ b/plugin/test/Test/generated/msg5_1.Pack5.purs @@ -0,0 +1,58 @@ +-- | Generated by __protobuf__ from file `test/msg5_1.proto` +module Pack5.Msg51 +( Msg2(..), Msg2Row, Msg2R, parseMsg2, putMsg2, defaultMsg2, mkMsg2, mergeMsg2 +) +where +import Protobuf.Internal.Prelude +import Protobuf.Internal.Prelude as Prelude + +import Pack5.Msg5 as Pack5 + + + +-- | Message generated by __protobuf__ from `pack5.Msg2` +newtype Msg2 = Msg2 Msg2R +type Msg2Row = + ( f1 :: Prelude.Maybe Pack5.Msg1 + , __unknown_fields :: Array Prelude.UnknownField + ) +type Msg2R = Record Msg2Row +derive instance genericMsg2 :: Prelude.Generic Msg2 _ +derive instance newtypeMsg2 :: Prelude.Newtype Msg2 _ +derive instance eqMsg2 :: Prelude.Eq Msg2 +instance showMsg2 :: Prelude.Show Msg2 where show x = Prelude.genericShow x + +putMsg2 :: forall m. Prelude.MonadEffect m => Prelude.MonadRec m => Msg2 -> Prelude.PutM m Prelude.Unit +putMsg2 (Msg2 r) = do + Prelude.putOptional 1 r.f1 (\_ -> false) $ Prelude.putLenDel Pack5.putMsg1 + Prelude.foldRecM (\_ x -> Prelude.putFieldUnknown x) unit r.__unknown_fields + +parseMsg2 :: forall m. Prelude.MonadEffect m => Prelude.MonadRec m => Prelude.ByteLength -> Prelude.ParserT Prelude.DataView m Msg2 +parseMsg2 length = Prelude.label "Msg2 / " $ + Prelude.parseMessage Msg2 defaultMsg2 parseField length + where + parseField + :: Prelude.FieldNumberInt + -> Prelude.WireType + -> Prelude.ParserT Prelude.DataView m (Prelude.Builder Msg2R Msg2R) + parseField 1 Prelude.LenDel = Prelude.label "f1 / " $ do + x <- Prelude.parseLenDel Pack5.parseMsg1 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "f1") $ Prelude.Just Prelude.<<< Prelude.maybe x (Pack5.mergeMsg1 x) + parseField fieldNumber wireType = Prelude.parseFieldUnknown fieldNumber wireType + +defaultMsg2 :: Msg2R +defaultMsg2 = + { f1: Prelude.Nothing + , __unknown_fields: [] + } + +mkMsg2 :: forall r1 r3. Prelude.Union r1 Msg2Row r3 => Prelude.Nub r3 Msg2Row => Record r1 -> Msg2 +mkMsg2 r = Msg2 $ Prelude.merge r defaultMsg2 + +mergeMsg2 :: Msg2 -> Msg2 -> Msg2 +mergeMsg2 (Msg2 l) (Msg2 r) = Msg2 + { f1: Prelude.mergeWith Pack5.mergeMsg1 l.f1 r.f1 + , __unknown_fields: r.__unknown_fields <> l.__unknown_fields + } + + diff --git a/plugin/test/Test/generated/msg6.Pack6.purs b/plugin/test/Test/generated/msg6.Pack6.purs new file mode 100644 index 0000000..1082de5 --- /dev/null +++ b/plugin/test/Test/generated/msg6.Pack6.purs @@ -0,0 +1,64 @@ +-- | Generated by __protobuf__ from file `test/msg6.proto` +module Pack6.Msg6 +( Msg6(..), Msg6Row, Msg6R, parseMsg6, putMsg6, defaultMsg6, mkMsg6, mergeMsg6 +) +where +import Protobuf.Internal.Prelude +import Protobuf.Internal.Prelude as Prelude + + + + +-- | Message generated by __protobuf__ from `pack6.Msg6` +newtype Msg6 = Msg6 Msg6R +type Msg6Row = + ( singular_int32 :: Prelude.Maybe Int + , optional_int32 :: Prelude.Maybe Int + , __unknown_fields :: Array Prelude.UnknownField + ) +type Msg6R = Record Msg6Row +derive instance genericMsg6 :: Prelude.Generic Msg6 _ +derive instance newtypeMsg6 :: Prelude.Newtype Msg6 _ +derive instance eqMsg6 :: Prelude.Eq Msg6 +instance showMsg6 :: Prelude.Show Msg6 where show x = Prelude.genericShow x + +putMsg6 :: forall m. Prelude.MonadEffect m => Prelude.MonadRec m => Msg6 -> Prelude.PutM m Prelude.Unit +putMsg6 (Msg6 r) = do + Prelude.putOptional 1 r.singular_int32 Prelude.isDefault Prelude.encodeInt32Field + Prelude.putOptional 2 r.optional_int32 (\_ -> false) Prelude.encodeInt32Field + Prelude.foldRecM (\_ x -> Prelude.putFieldUnknown x) unit r.__unknown_fields + +parseMsg6 :: forall m. Prelude.MonadEffect m => Prelude.MonadRec m => Prelude.ByteLength -> Prelude.ParserT Prelude.DataView m Msg6 +parseMsg6 length = Prelude.label "Msg6 / " $ + Prelude.parseMessage Msg6 defaultMsg6 parseField length + where + parseField + :: Prelude.FieldNumberInt + -> Prelude.WireType + -> Prelude.ParserT Prelude.DataView m (Prelude.Builder Msg6R Msg6R) + parseField 1 Prelude.VarInt = Prelude.label "singular_int32 / " $ do + x <- Prelude.decodeInt32 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "singular_int32") $ \_ -> Prelude.Just x + parseField 2 Prelude.VarInt = Prelude.label "optional_int32 / " $ do + x <- Prelude.decodeInt32 + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "optional_int32") $ \_ -> Prelude.Just x + parseField fieldNumber wireType = Prelude.parseFieldUnknown fieldNumber wireType + +defaultMsg6 :: Msg6R +defaultMsg6 = + { singular_int32: Prelude.Nothing + , optional_int32: Prelude.Nothing + , __unknown_fields: [] + } + +mkMsg6 :: forall r1 r3. Prelude.Union r1 Msg6Row r3 => Prelude.Nub r3 Msg6Row => Record r1 -> Msg6 +mkMsg6 r = Msg6 $ Prelude.merge r defaultMsg6 + +mergeMsg6 :: Msg6 -> Msg6 -> Msg6 +mergeMsg6 (Msg6 l) (Msg6 r) = Msg6 + { singular_int32: Prelude.alt l.singular_int32 r.singular_int32 + , optional_int32: Prelude.alt l.optional_int32 r.optional_int32 + , __unknown_fields: r.__unknown_fields <> l.__unknown_fields + } + + diff --git a/plugin/test/Test/generated/msg7.Pack7.purs b/plugin/test/Test/generated/msg7.Pack7.purs new file mode 100644 index 0000000..65529a7 --- /dev/null +++ b/plugin/test/Test/generated/msg7.Pack7.purs @@ -0,0 +1,58 @@ +-- | Generated by __protobuf__ from file `test/msg7.proto` +module Pack7.Msg7 +( Msg7(..), Msg7Row, Msg7R, parseMsg7, putMsg7, defaultMsg7, mkMsg7, mergeMsg7 +) +where +import Protobuf.Internal.Prelude +import Protobuf.Internal.Prelude as Prelude + +import Google.Protobuf.Empty as Google.Protobuf + + + +-- | Message generated by __protobuf__ from `pack7.Msg7` +newtype Msg7 = Msg7 Msg7R +type Msg7Row = + ( nothing :: Prelude.Maybe Google.Protobuf.Empty + , __unknown_fields :: Array Prelude.UnknownField + ) +type Msg7R = Record Msg7Row +derive instance genericMsg7 :: Prelude.Generic Msg7 _ +derive instance newtypeMsg7 :: Prelude.Newtype Msg7 _ +derive instance eqMsg7 :: Prelude.Eq Msg7 +instance showMsg7 :: Prelude.Show Msg7 where show x = Prelude.genericShow x + +putMsg7 :: forall m. Prelude.MonadEffect m => Prelude.MonadRec m => Msg7 -> Prelude.PutM m Prelude.Unit +putMsg7 (Msg7 r) = do + Prelude.putOptional 1 r.nothing (\_ -> false) $ Prelude.putLenDel Google.Protobuf.putEmpty + Prelude.foldRecM (\_ x -> Prelude.putFieldUnknown x) unit r.__unknown_fields + +parseMsg7 :: forall m. Prelude.MonadEffect m => Prelude.MonadRec m => Prelude.ByteLength -> Prelude.ParserT Prelude.DataView m Msg7 +parseMsg7 length = Prelude.label "Msg7 / " $ + Prelude.parseMessage Msg7 defaultMsg7 parseField length + where + parseField + :: Prelude.FieldNumberInt + -> Prelude.WireType + -> Prelude.ParserT Prelude.DataView m (Prelude.Builder Msg7R Msg7R) + parseField 1 Prelude.LenDel = Prelude.label "nothing / " $ do + x <- Prelude.parseLenDel Google.Protobuf.parseEmpty + pure $ Prelude.modify (Prelude.Proxy :: Prelude.Proxy "nothing") $ Prelude.Just Prelude.<<< Prelude.maybe x (Google.Protobuf.mergeEmpty x) + parseField fieldNumber wireType = Prelude.parseFieldUnknown fieldNumber wireType + +defaultMsg7 :: Msg7R +defaultMsg7 = + { nothing: Prelude.Nothing + , __unknown_fields: [] + } + +mkMsg7 :: forall r1 r3. Prelude.Union r1 Msg7Row r3 => Prelude.Nub r3 Msg7Row => Record r1 -> Msg7 +mkMsg7 r = Msg7 $ Prelude.merge r defaultMsg7 + +mergeMsg7 :: Msg7 -> Msg7 -> Msg7 +mergeMsg7 (Msg7 l) (Msg7 r) = Msg7 + { nothing: Prelude.mergeWith Google.Protobuf.mergeEmpty l.nothing r.nothing + , __unknown_fields: r.__unknown_fields <> l.__unknown_fields + } + + diff --git a/test/msg1.proto b/plugin/test/msg1.proto similarity index 100% rename from test/msg1.proto rename to plugin/test/msg1.proto diff --git a/test/msg2.proto b/plugin/test/msg2.proto similarity index 100% rename from test/msg2.proto rename to plugin/test/msg2.proto diff --git a/test/msg3.proto b/plugin/test/msg3.proto similarity index 100% rename from test/msg3.proto rename to plugin/test/msg3.proto diff --git a/test/msg4.proto b/plugin/test/msg4.proto similarity index 100% rename from test/msg4.proto rename to plugin/test/msg4.proto diff --git a/test/msg5.proto b/plugin/test/msg5.proto similarity index 100% rename from test/msg5.proto rename to plugin/test/msg5.proto diff --git a/test/msg5_1.proto b/plugin/test/msg5_1.proto similarity index 100% rename from test/msg5_1.proto rename to plugin/test/msg5_1.proto diff --git a/test/msg6.proto b/plugin/test/msg6.proto similarity index 100% rename from test/msg6.proto rename to plugin/test/msg6.proto diff --git a/test/msg7.proto b/plugin/test/msg7.proto similarity index 100% rename from test/msg7.proto rename to plugin/test/msg7.proto diff --git a/test/generated/.gitignore b/test/generated/.gitignore deleted file mode 100644 index cccd0d4..0000000 --- a/test/generated/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.purs