Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Duniter v2S
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
rust
Duniter v2S
Commits
b7df75cc
Commit
b7df75cc
authored
11 months ago
by
Benoit Lavenier
Committed by
Hugo Trentesaux
8 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Generate runtime-error.po
parent
6dec13d1
No related branches found
No related tags found
1 merge request
!269
Resolve "Generate runtime-error.po"
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
xtask/README.md
+3
-1
3 additions, 1 deletion
xtask/README.md
xtask/res/templates/runtime-errors.po
+7
-0
7 additions, 0 deletions
xtask/res/templates/runtime-errors.po
xtask/src/gen_doc.rs
+12
-3
12 additions, 3 deletions
xtask/src/gen_doc.rs
with
22 additions
and
4 deletions
xtask/README.md
+
3
−
1
View file @
b7df75cc
...
...
@@ -15,9 +15,11 @@ Usage: xtask <COMMAND>
Commands:
build Build duniter binary
gen-
calls-doc
Generate
calls
documentation
gen-
doc
Generate documentation
(calls and events)
inject-runtime-code Inject runtime code in raw specs
release-runtime Release a new runtime
update-raw-specs Update raw specs locally with the files published on a Release
create-asset-link Create asset in a release
test Execute unit tests and integration tests End2tests are skipped
help Print this message or the help of the given subcommand(s)
...
...
This diff is collapsed.
Click to expand it.
xtask/res/templates/runtime-errors.po
0 → 100644
+
7
−
0
View file @
b7df75cc
{% for pallet in pallets -%}
{% for error in pallet.errors -%}
msgid "{{ pallet.name }}.{{ error.name }}"
msgstr "{{ error.documentation }}"
{% endfor -%}
{% endfor -%}
This diff is collapsed.
Click to expand it.
xtask/src/gen_doc.rs
+
12
−
3
View file @
b7df75cc
...
...
@@ -43,6 +43,7 @@ where
const
CALLS_DOC_FILEPATH
:
&
str
=
"docs/api/runtime-calls.md"
;
const
EVENTS_DOC_FILEPATH
:
&
str
=
"docs/api/runtime-events.md"
;
const
ERRORS_DOC_FILEPATH
:
&
str
=
"docs/api/runtime-errors.md"
;
const
ERRORS_PO_FILEPATH
:
&
str
=
"docs/api/runtime-errors.po"
;
const
TEMPLATES_GLOB
:
&
str
=
"xtask/res/templates/*.md"
;
const
WEIGHT_FILEPATH
:
&
str
=
"runtime/gdev/src/weights/"
;
...
...
@@ -306,7 +307,7 @@ pub(super) fn gen_doc() -> Result<()> {
})
});
let
(
call_doc
,
event_doc
,
error_doc
)
=
print_runtime
(
runtime
);
let
(
call_doc
,
event_doc
,
error_doc
,
error_po
)
=
print_runtime
(
runtime
);
// Generate docs from rust code
Command
::
new
(
"cargo"
)
...
...
@@ -348,6 +349,10 @@ pub(super) fn gen_doc() -> Result<()> {
.with_context
(||
format!
(
"Failed to create file '{}'"
,
ERRORS_DOC_FILEPATH
))
?
;
file
.write_all
(
error_doc
.as_bytes
())
.with_context
(||
format!
(
"Failed to write to file '{}'"
,
ERRORS_DOC_FILEPATH
))
?
;
let
mut
file
=
File
::
create
(
ERRORS_PO_FILEPATH
)
.with_context
(||
format!
(
"Failed to create file '{}'"
,
ERRORS_PO_FILEPATH
))
?
;
file
.write_all
(
error_po
.as_bytes
())
.with_context
(||
format!
(
"Failed to write to file '{}'"
,
ERRORS_PO_FILEPATH
))
?
;
Ok
(())
}
...
...
@@ -469,7 +474,7 @@ fn get_weights(max_weight: u128) -> Result<HashMap<String, HashMap<String, Weigh
}
/// use template to render markdown file with runtime calls documentation
fn
print_runtime
(
pallets
:
RuntimePallets
)
->
(
String
,
String
,
String
)
{
fn
print_runtime
(
pallets
:
RuntimePallets
)
->
(
String
,
String
,
String
,
String
)
{
// init variables
let
mut
user_calls_counter
=
0
;
let
user_calls_pallets
:
RuntimePallets
=
pallets
...
...
@@ -568,5 +573,9 @@ fn print_runtime(pallets: RuntimePallets) -> (String, String, String) {
.render
(
"runtime-errors.md"
,
&
context
)
.expect
(
"template error"
);
(
call_doc
,
event_doc
,
error_doc
)
let
error_po
=
tera
.render
(
"runtime-errors.po"
,
&
context
)
.expect
(
"template error"
);
(
call_doc
,
event_doc
,
error_doc
,
error_po
)
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment