Skip to content

Commit 7249b12

Browse files
authored
tooling: integrate header service (#793)
* tooling: header service adapted to new structure Modify header service to support new structure * tooling: small corrections after review Remove redundant setup function Correct argument type in function register Simplify integration tests * tooling: fix small error in metamodel Fix a small error introduced during merge conflict resolution. --------- Signed-off-by: Michael Müller <42868757+mmr1909@users.noreply.github.com>
1 parent 1a67919 commit 7249b12

11 files changed

Lines changed: 1175 additions & 5 deletions

File tree

tooling/docs/_tooling/docs.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ def _docs():
143143
"**/*.html",
144144
"**/*.css",
145145
"**/*.puml",
146+
"**/*.need",
146147
# Include the docs tooling itself
147148
# Note: we don't use py_library here to make it as close as possible to docs:incremental.
148149
"**/*.py",
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Automatic Header Generation Service
2+
3+
## Purpose
4+
The service *header-service* generates a table with review and approver informations.
5+
It uses the template *header.need* to generate this table.
6+
7+
## Extraction Methods
8+
This modules can use two different methods to extract the needed information.
9+
* GitHub data
10+
* Merge commit log
11+
12+
The used method can be configured as a configuration parameter in *conf.py*.
13+
14+
header_service_use_github_data = True
15+
16+
GitHub data is used if parameter is not set.
17+
18+
19+
## Environment variables
20+
This module uses the following environment variables if the extraction method **Github data** is configured:
21+
22+
GH_TOKEN: Github access token
23+
GITHUB_REF_NAME: Github reference name (<pull request no>/merge)
24+
GITHUB_REPOSITORY: Github repository <org>/<repo>
25+
26+
## Excecution
27+
The document generation has to be executed as follows:
28+
29+
GH_TOKEN=$GH_TOKEN bazel run //docs:incremental
30+
31+
Sphinx cannot acess the environment variables when started via bazel build.
32+
33+
If extraction method **Merge commit info** is used the document generation can be executed as follows:
34+
35+
bazel run //docs:incremental
36+
37+
38+
## Usage
39+
Add the descriptor *header_service* to a RST file to fill out review and approver informations.
40+
41+
.. needservice:: header-service
42+
43+
This generates the following Table:
44+
45+
| Document Identification | |
46+
| ----------------------- | ----------------------------- |
47+
| Document Type | Checklist |
48+
| Document ID | DPX-CONTR-REVIEW-CHECKLIST |
49+
| Project Name | dependix |
50+
| ASIL | B |
51+
| Security Classification | CONFIDENTIAL |
52+
| Author | [Author of the PR] |
53+
| Reviewer | [List of PR reviewers] |
54+
| Approver | [List of PR approvers] |
55+
| Version | [Merge commit hash of the PR] |
56+
| Status | RELEASED |
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2025 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
from sphinx.application import Sphinx
14+
from score_header_service.header_service import register
15+
16+
17+
def setup(app: Sphinx) -> dict[str, str | bool]:
18+
"""Register the header service with the Sphinx application.
19+
20+
:param app: The Sphinx application instance.
21+
"""
22+
app.connect("env-before-read-docs", register)
23+
return {
24+
"version": "0.1",
25+
"parallel_read_safe": True,
26+
"parallel_write_safe": True,
27+
}

0 commit comments

Comments
 (0)