Skip to content

Commit 6277624

Browse files
authored
dev: add definitions.json generation script (#772)
1 parent c20e5da commit 6277624

File tree

5 files changed

+461
-42
lines changed

5 files changed

+461
-42
lines changed

CONTRIBUTING.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,16 +179,21 @@ In order to test how a change in docs configuration looks like on ReadTheDocs be
179179

180180
Examples can be found in subfolders of [tests/integrations](https://github.com/XRPLF/xrpl-py/tree/main/tests/integration)
181181

182-
## Updating `definitions.json`
182+
## Updating `definitions.json` and models
183183

184-
This should almost always be done using the [`xrpl-codec-gen`](https://github.com/RichardAH/xrpl-codec-gen) script - if the output needs manual intervention afterwards, consider updating the script instead.
184+
To update just the `definitions.json` file:
185+
```bash
186+
poetry run poe definitions https://github.com/XRPLF/rippled/tree/develop
187+
```
188+
189+
Any Github branch link or local path to rippled will work here.
185190

186-
1. Clone / pull the latest changes from [rippled](https://github.com/XRPLF/rippled) - Specifically the `develop` branch is usually the right one.
187-
2. Clone / pull the latest changes from [`xrpl-codec-gen`](https://github.com/RichardAH/xrpl-codec-gen)
188-
3. From the `xrpl-codec-gen` tool, follow the steps in the `README.md` to generate a new `definitions.json` file.
189-
4. Replace the `definitions.json` file in the `ripple-binary-codec` with the newly generated file.
190-
5. Verify that the changes make sense by inspection before submitting, as there may be updates required for the `xrpl-codec-gen` tool depending on the latest amendments we're updating to match.
191+
To update the models as well:
192+
```bash
193+
poetry run poe generate https://github.com/XRPLF/rippled/tree/develop
194+
```
191195

196+
Verify that the changes make sense by inspection before submitting, as there may be updates required for the `xrpl-codec-gen` tool depending on the latest amendments we're updating to match.
192197

193198
## Release process
194199

pyproject.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,20 @@ precision = 2
9090
test_unit = "coverage run -m unittest discover tests/unit"
9191
test_integration = "coverage run -m unittest discover tests/integration"
9292
lint = "poetry run flake8 xrpl tests snippets"
93+
definitions = "poetry run python3 tools/generate_definitions.py"
9394

9495
[tool.poe.tasks.test]
9596
cmd = "python3 -m unittest ${FILE_PATHS}"
9697
args = [{ name = "FILE_PATHS", positional = true, multiple = true }]
9798

99+
[tool.poe.tasks.generate]
100+
help = "Generate the models and definitions for a new amendment"
101+
sequence = [
102+
{ cmd = "python3 tools/generate_definitions.py ${FILE_OR_GITHUB_PATH}" },
103+
{ cmd = "python3 tools/generate_tx_models.py ${FILE_OR_GITHUB_PATH}" },
104+
]
105+
args = [{ name = "FILE_OR_GITHUB_PATH", positional = true, required = true }]
106+
98107
[tool.poe.tasks.test_coverage]
99108
sequence = [
100109
{ cmd = "coverage run -m unittest discover" },

0 commit comments

Comments
 (0)