spl-core 4.1.2__py3-none-any.whl → 4.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- spl_core/__init__.py +1 -1
- spl_core/__run.py +12 -0
- spl_core/common/command_line_executor.py +3 -1
- spl_core/kickstart/create.py +66 -0
- spl_core/kickstart/templates/application/.vscode/cmake-variants.json +20 -0
- spl_core/{project_creator/templates/project/{{cookiecutter.name}} → kickstart/templates/application}/KConfig +2 -2
- spl_core/kickstart/templates/application/src/greeter/CMakeLists.txt +3 -0
- spl_core/kickstart/templates/application/src/greeter/doc/_images/screenshot.png +0 -0
- spl_core/kickstart/templates/application/src/greeter/doc/index.rst +26 -0
- spl_core/kickstart/templates/application/src/greeter/src/greeter.c +24 -0
- spl_core/kickstart/templates/application/src/greeter/src/greeter.h +6 -0
- spl_core/kickstart/templates/application/src/greeter/test/test_greeter.cc +27 -0
- spl_core/{project_creator/templates/project/{{cookiecutter.name}}/{% if cookiecutter.touch_components -%} components {%- endif %}/main/doc/index.rst → kickstart/templates/application/src/main/doc/index.rst} +6 -2
- spl_core/kickstart/templates/application/src/main/src/main.c +13 -0
- spl_core/kickstart/templates/application/test/EnglishVariant/test__EnglishVariant.py +16 -0
- spl_core/kickstart/templates/application/test/German/test__GermanVariant.py +16 -0
- spl_core/kickstart/templates/application/variants/EnglishVariant/parts.cmake +2 -0
- spl_core/kickstart/templates/application/variants/GermanVariant/config.cmake +1 -0
- spl_core/kickstart/templates/application/variants/GermanVariant/config.txt +13 -0
- spl_core/kickstart/templates/application/variants/GermanVariant/parts.cmake +2 -0
- spl_core/{project_creator/templates/project/{{cookiecutter.name}} → kickstart/templates/project}/.gitignore +3 -0
- spl_core/kickstart/templates/project/.vscode/extensions.json +20 -0
- spl_core/{project_creator/templates/project/{{cookiecutter.name}} → kickstart/templates/project}/.vscode/tasks.json +24 -4
- spl_core/{project_creator/templates/project/{{cookiecutter.name}} → kickstart/templates/project}/CMakeLists.txt +9 -1
- spl_core/{project_creator/templates/project/{{cookiecutter.name}} → kickstart/templates/project}/build.ps1 +47 -17
- spl_core/{project_creator/templates/project/{{cookiecutter.name}} → kickstart/templates/project}/conf.py +8 -6
- spl_core/{project_creator/templates/project/{{cookiecutter.name}} → kickstart/templates/project}/doc/Doxyfile.in +2 -2
- spl_core/{project_creator/templates/project/{{cookiecutter.name}} → kickstart/templates/project}/doc/common/index.rst +1 -1
- spl_core/{project_creator/templates/project/{{cookiecutter.name}} → kickstart/templates/project}/doc/components/index.rst +2 -3
- spl_core/{project_creator/templates/project/{{cookiecutter.name}} → kickstart/templates/project}/doc/doxygen-awesome/doxygen-awesome.css +16 -16
- spl_core/{project_creator/templates/project/{{cookiecutter.name}} → kickstart/templates/project}/doc/test_report_template.txt +0 -2
- spl_core/{project_creator/templates/project/{{cookiecutter.name}} → kickstart/templates/project}/index.rst +1 -0
- spl_core/kickstart/templates/project/pipfile +6 -0
- spl_core/{project_creator/templates/project/{{cookiecutter.name}} → kickstart/templates/project}/pytest.ini +2 -1
- spl_core/kickstart/templates/project/scoopfile.json +14 -0
- spl_core/{project_creator/templates/project/{{cookiecutter.name}}/{% if cookiecutter.touch_tools -%} tools {%- endif %}/toolchains/clang/toolchain.cmake → kickstart/templates/project/tools/toolchains/clang/toolchain.cmake} +1 -1
- spl_core/main.py +44 -0
- {spl_core-4.1.2.dist-info → spl_core-4.3.0.dist-info}/METADATA +14 -2
- spl_core-4.3.0.dist-info/RECORD +61 -0
- spl_core-4.3.0.dist-info/entry_points.txt +3 -0
- spl_core/common/cmake.py +0 -52
- spl_core/project_creator/creator.py +0 -133
- spl_core/project_creator/templates/project/cookiecutter.json +0 -14
- spl_core/project_creator/templates/project/{{cookiecutter.name}}/.flake8 +0 -2
- spl_core/project_creator/templates/project/{{cookiecutter.name}}/.vscode/cmake-variants.json +0 -18
- spl_core/project_creator/templates/project/{{cookiecutter.name}}/.vscode/extensions.json +0 -18
- spl_core/project_creator/templates/project/{{cookiecutter.name}}/LICENSE +0 -21
- spl_core/project_creator/templates/project/{{cookiecutter.name}}/Pipfile +0 -30
- spl_core/project_creator/templates/project/{{cookiecutter.name}}/README.md +0 -7
- spl_core/project_creator/templates/project/{{cookiecutter.name}}/install-mandatory.bat +0 -1
- spl_core/project_creator/templates/project/{{cookiecutter.name}}/scoopfile.json +0 -47
- spl_core/project_creator/templates/project/{{cookiecutter.name}}/test/test_build.py +0 -39
- spl_core/project_creator/templates/project/{{cookiecutter.name}}/test/test_unittests.py +0 -28
- spl_core/project_creator/templates/project/{{cookiecutter.name}}/test/utils.py +0 -26
- spl_core/project_creator/templates/project/{{cookiecutter.name}}/tools/setup/git-config.ps1 +0 -8
- spl_core/project_creator/templates/project/{{cookiecutter.name}}/{% if cookiecutter.touch_components -%} components {%- endif %}/component/CMakeLists.txt +0 -3
- spl_core/project_creator/templates/project/{{cookiecutter.name}}/{% if cookiecutter.touch_components -%} components {%- endif %}/component/doc/_images/screenshot.png +0 -0
- spl_core/project_creator/templates/project/{{cookiecutter.name}}/{% if cookiecutter.touch_components -%} components {%- endif %}/component/doc/design.rst +0 -25
- spl_core/project_creator/templates/project/{{cookiecutter.name}}/{% if cookiecutter.touch_components -%} components {%- endif %}/component/doc/index.rst +0 -8
- spl_core/project_creator/templates/project/{{cookiecutter.name}}/{% if cookiecutter.touch_components -%} components {%- endif %}/component/src/component.c +0 -31
- spl_core/project_creator/templates/project/{{cookiecutter.name}}/{% if cookiecutter.touch_components -%} components {%- endif %}/component/src/component.h +0 -1
- spl_core/project_creator/templates/project/{{cookiecutter.name}}/{% if cookiecutter.touch_components -%} components {%- endif %}/component/test/test_component.cc +0 -60
- spl_core/project_creator/templates/project/{{cookiecutter.name}}/{% if cookiecutter.touch_components -%} components {%- endif %}/main/src/main.c +0 -17
- spl_core/project_creator/templates/variant/cookiecutter.json +0 -4
- spl_core/project_creator/templates/variant/{{cookiecutter.flavor}}/{{cookiecutter.subsystem}}/config.txt +0 -1
- spl_core/project_creator/templates/variant/{{cookiecutter.flavor}}/{{cookiecutter.subsystem}}/parts.cmake +0 -2
- spl_core/project_creator/variant.py +0 -23
- spl_core/project_creator/workspace_artifacts.py +0 -36
- spl_core-4.1.2.dist-info/RECORD +0 -68
- /spl_core/{project_creator → kickstart}/__init__.py +0 -0
- /spl_core/{project_creator/templates/project/{{cookiecutter.name}}/{% if cookiecutter.touch_components -%} components {%- endif %} → kickstart/templates/application/src}/main/CMakeLists.txt +0 -0
- /spl_core/{project_creator/templates/variant/{{cookiecutter.flavor}}/{{cookiecutter.subsystem}} → kickstart/templates/application/variants/EnglishVariant}/config.cmake +0 -0
- /spl_core/{project_creator/templates/project/{{cookiecutter.name}} → kickstart/templates/project}/.vscode/cmake-kits.json +0 -0
- /spl_core/{project_creator/templates/project/{{cookiecutter.name}} → kickstart/templates/project}/.vscode/launch.json +0 -0
- /spl_core/{project_creator/templates/project/{{cookiecutter.name}} → kickstart/templates/project}/.vscode/settings.json +0 -0
- /spl_core/{project_creator/templates/project/{{cookiecutter.name}} → kickstart/templates/project}/build.bat +0 -0
- /spl_core/{project_creator/templates/project/{{cookiecutter.name}} → kickstart/templates/project}/doc/doxygen-awesome/LICENSE +0 -0
- /spl_core/{project_creator/templates/project/{{cookiecutter.name}} → kickstart/templates/project}/doc/software_architecture/index.rst +0 -0
- /spl_core/{project_creator/templates/project/{{cookiecutter.name}} → kickstart/templates/project}/doc/software_requirements/index.rst +0 -0
- /spl_core/{project_creator/templates/project/{{cookiecutter.name}}/{% if cookiecutter.touch_tools -%} tools {%- endif %} → kickstart/templates/project/tools}/toolchains/gcc/toolchain.cmake +0 -0
- {spl_core-4.1.2.dist-info → spl_core-4.3.0.dist-info}/LICENSE +0 -0
- {spl_core-4.1.2.dist-info → spl_core-4.3.0.dist-info}/WHEEL +0 -0
spl_core/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "4.
|
|
1
|
+
__version__ = "4.3.0"
|
spl_core/__run.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Used to run spl-core from the command line when run from this repository.
|
|
3
|
+
|
|
4
|
+
This is required because the spl-core Python module is not visible when running from the repository.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import runpy
|
|
8
|
+
import sys
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
sys.path.insert(0, Path(__file__).parent.parent.absolute().as_posix())
|
|
12
|
+
runpy.run_module("spl_core.main", run_name="__main__")
|
|
@@ -30,7 +30,9 @@ class CommandLineExecutor:
|
|
|
30
30
|
command = " ".join([cmd] if isinstance(cmd, str) else cmd)
|
|
31
31
|
output = ""
|
|
32
32
|
try:
|
|
33
|
-
print(
|
|
33
|
+
print("=" * 120)
|
|
34
|
+
print(f"= Running command: {command}")
|
|
35
|
+
print("=" * 120)
|
|
34
36
|
with subprocess.Popen(
|
|
35
37
|
command,
|
|
36
38
|
cwd=str(self.current_working_directory or Path.cwd()),
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import shutil
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
from typing import List, Optional, Union
|
|
4
|
+
|
|
5
|
+
from py_app_dev.core.exceptions import UserNotificationException
|
|
6
|
+
from py_app_dev.core.logging import logger
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ProjectBuilder:
|
|
10
|
+
def __init__(self, project_dir: Path, input_dir: Optional[Path] = None) -> None:
|
|
11
|
+
self.project_dir = project_dir
|
|
12
|
+
self.input_dir = input_dir if input_dir else Path(__file__).parent.joinpath("templates")
|
|
13
|
+
|
|
14
|
+
self.dirs: List[Path] = []
|
|
15
|
+
self.check_target_directory_flag = True
|
|
16
|
+
|
|
17
|
+
def with_disable_target_directory_check(self) -> "ProjectBuilder":
|
|
18
|
+
self.check_target_directory_flag = False
|
|
19
|
+
return self
|
|
20
|
+
|
|
21
|
+
def with_dir(self, dir: Union[Path, str]) -> "ProjectBuilder":
|
|
22
|
+
self.dirs.append(self.resolve_file_path(dir))
|
|
23
|
+
return self
|
|
24
|
+
|
|
25
|
+
def resolve_file_paths(self, files: List[Path | str]) -> List[Path]:
|
|
26
|
+
return [self.resolve_file_path(file) for file in files]
|
|
27
|
+
|
|
28
|
+
def resolve_file_path(self, file: Union[Path, str]) -> Path:
|
|
29
|
+
return self.input_dir.joinpath(file) if isinstance(file, str) else file
|
|
30
|
+
|
|
31
|
+
@staticmethod
|
|
32
|
+
def _check_target_directory(project_dir: Path) -> None:
|
|
33
|
+
if project_dir.is_dir() and any(project_dir.iterdir()):
|
|
34
|
+
raise UserNotificationException(f"Project directory '{project_dir}' is not empty. Use --force to override.")
|
|
35
|
+
|
|
36
|
+
def build(self) -> None:
|
|
37
|
+
if self.check_target_directory_flag:
|
|
38
|
+
self._check_target_directory(self.project_dir)
|
|
39
|
+
for dir in self.dirs:
|
|
40
|
+
shutil.copytree(dir, self.project_dir, dirs_exist_ok=True)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class KickstartProject:
|
|
44
|
+
"""Kickstart a new project in the given directory.
|
|
45
|
+
|
|
46
|
+
Args:
|
|
47
|
+
project_dir (Path): The directory where the project should be created.
|
|
48
|
+
force (bool, optional): If True, the project directory will be overridden if it is not empty. Defaults to False.
|
|
49
|
+
no_application (bool, optional): If True, the project will not contain variants and components.
|
|
50
|
+
"""
|
|
51
|
+
|
|
52
|
+
def __init__(self, project_dir: Path, force: bool = False, no_application: bool = False) -> None:
|
|
53
|
+
self.logger = logger.bind()
|
|
54
|
+
self.project_dir = project_dir
|
|
55
|
+
self.force = force
|
|
56
|
+
self.no_application = no_application
|
|
57
|
+
|
|
58
|
+
def run(self) -> None:
|
|
59
|
+
self.logger.info(f"Kickstart new project in '{self.project_dir.absolute().as_posix()}'")
|
|
60
|
+
project_builder = ProjectBuilder(self.project_dir)
|
|
61
|
+
if self.force:
|
|
62
|
+
project_builder.with_disable_target_directory_check()
|
|
63
|
+
project_builder.with_dir("project")
|
|
64
|
+
if not self.no_application:
|
|
65
|
+
project_builder.with_dir("application")
|
|
66
|
+
project_builder.build()
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"variant": {
|
|
3
|
+
"choices": {"EnglishVariant": {
|
|
4
|
+
"buildType": "EnglishVariant",
|
|
5
|
+
"long": "select to build variant 'EnglishVariant'",
|
|
6
|
+
"settings": {
|
|
7
|
+
"VARIANT": "EnglishVariant"
|
|
8
|
+
},
|
|
9
|
+
"short": "EnglishVariant"
|
|
10
|
+
}, "GermanVariant": {
|
|
11
|
+
"buildType": "GermanVariant",
|
|
12
|
+
"long": "select to build variant 'GermanVariant'",
|
|
13
|
+
"settings": {
|
|
14
|
+
"VARIANT": "GermanVariant"
|
|
15
|
+
},
|
|
16
|
+
"short": "GermanVariant"
|
|
17
|
+
}},
|
|
18
|
+
"default": "EnglishVariant"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Software Detailed Design
|
|
2
|
+
========================
|
|
3
|
+
|
|
4
|
+
.. figure:: _images/screenshot.png
|
|
5
|
+
|
|
6
|
+
.. mermaid::
|
|
7
|
+
|
|
8
|
+
graph TD
|
|
9
|
+
A[Start] --> B{Language}
|
|
10
|
+
B -->|DE| C[Hallo Welt]
|
|
11
|
+
B -->|EN| D[Hello World]
|
|
12
|
+
C --> E[End]
|
|
13
|
+
D --> E
|
|
14
|
+
|
|
15
|
+
Requirements
|
|
16
|
+
------------
|
|
17
|
+
|
|
18
|
+
.. spec:: Say Hello
|
|
19
|
+
:id: SWDD_GREETER-001
|
|
20
|
+
:integrity: QM
|
|
21
|
+
|
|
22
|
+
{% if config.LANG_DE %}
|
|
23
|
+
It shall greet the user with ``Hallo Welt``.
|
|
24
|
+
{% else %}
|
|
25
|
+
It shall greet the user with ``Hello World``.
|
|
26
|
+
{% endif %}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file greeter.c
|
|
3
|
+
* @brief Greeter implementation.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
#include "greeter.h"
|
|
8
|
+
#include "autoconf.h"
|
|
9
|
+
|
|
10
|
+
/*!
|
|
11
|
+
* @rst
|
|
12
|
+
*
|
|
13
|
+
* .. impl:: Select the greeting message
|
|
14
|
+
* :id: SWIMPL_GREETER-001
|
|
15
|
+
* :implements: SWDD_GREETER-001
|
|
16
|
+
* @endrst
|
|
17
|
+
*/
|
|
18
|
+
const char* get_greeting() {
|
|
19
|
+
#if defined(CONFIG_LANG_DE) && CONFIG_LANG_DE == 1
|
|
20
|
+
return "Hallo, Welt!";
|
|
21
|
+
#else
|
|
22
|
+
return "Hello, world!";
|
|
23
|
+
#endif
|
|
24
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file
|
|
3
|
+
*/
|
|
4
|
+
#include <gtest/gtest.h>
|
|
5
|
+
|
|
6
|
+
extern "C" {
|
|
7
|
+
#include "greeter.h"
|
|
8
|
+
#include "autoconf.h"
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
#if defined(CONFIG_LANG_DE) && CONFIG_LANG_DE == 1
|
|
12
|
+
const char *greeting = "Hallo, Welt!";
|
|
13
|
+
#else
|
|
14
|
+
const char *greeting = "Hello, world!";
|
|
15
|
+
#endif
|
|
16
|
+
/*!
|
|
17
|
+
* @rst
|
|
18
|
+
*
|
|
19
|
+
* .. test:: greeter.test_get_greeting
|
|
20
|
+
* :id: TS_GREETER-001
|
|
21
|
+
* :tests: SWDD_GREETER-001
|
|
22
|
+
*
|
|
23
|
+
* @endrst
|
|
24
|
+
*/
|
|
25
|
+
TEST(greeter, test_get_greeting) {
|
|
26
|
+
EXPECT_STREQ(greeting, get_greeting());
|
|
27
|
+
}
|
|
@@ -9,6 +9,10 @@ Introduction
|
|
|
9
9
|
|
|
10
10
|
This is the documentation for the ``Main`` component.
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
The application will say
|
|
13
|
+
{% if config.LANG_DE %}
|
|
14
|
+
``Hallo Welt``
|
|
15
|
+
{% else %}
|
|
16
|
+
``Hello World``
|
|
14
17
|
{% endif %}
|
|
18
|
+
.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
from typing import List
|
|
3
|
+
|
|
4
|
+
from spl_core.test_utils.base_variant_test_runner import BaseVariantTestRunner
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Test_EnglishVariant(BaseVariantTestRunner):
|
|
8
|
+
@property
|
|
9
|
+
def component_paths(self) -> List[Path]:
|
|
10
|
+
return [
|
|
11
|
+
Path("src/greeter"),
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
@property
|
|
15
|
+
def expected_build_artifacts(self) -> List[Path]:
|
|
16
|
+
return [Path("my_main.exe"), Path("compile_commands.json")]
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
from typing import List
|
|
3
|
+
|
|
4
|
+
from spl_core.test_utils.base_variant_test_runner import BaseVariantTestRunner
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Test_GermanVariant(BaseVariantTestRunner):
|
|
8
|
+
@property
|
|
9
|
+
def component_paths(self) -> List[Path]:
|
|
10
|
+
return [
|
|
11
|
+
Path("src/greeter"),
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
@property
|
|
15
|
+
def expected_build_artifacts(self) -> List[Path]:
|
|
16
|
+
return [Path("my_main.exe"), Path("compile_commands.json")]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
set(CMAKE_TOOLCHAIN_FILE tools/toolchains/clang/toolchain.cmake CACHE PATH "toolchain file")
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"recommendations": [
|
|
3
|
+
"mhutchie.git-graph",
|
|
4
|
+
"ms-vscode.cmake-tools",
|
|
5
|
+
"twxs.cmake",
|
|
6
|
+
"ms-vscode.cpptools",
|
|
7
|
+
"ms-vscode.cpptools-themes",
|
|
8
|
+
"visualstudioexptteam.intellicode-api-usage-examples",
|
|
9
|
+
"visualstudioexptteam.vscodeintellicode",
|
|
10
|
+
"haugerbr.project-tasks",
|
|
11
|
+
"avengineers.show-link-list",
|
|
12
|
+
"ms-python.vscode-pylance",
|
|
13
|
+
"ms-python.python",
|
|
14
|
+
"donjayamanne.python-environment-manager",
|
|
15
|
+
"felipecaputo.git-project-manager",
|
|
16
|
+
"ms-vscode.powershell",
|
|
17
|
+
"waderyan.gitblame",
|
|
18
|
+
"sandcastle.vscode-open"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -69,13 +69,25 @@
|
|
|
69
69
|
"label": "Configure variant",
|
|
70
70
|
"detail": "Feature configuration using KConfig",
|
|
71
71
|
"type": "shell",
|
|
72
|
-
"command": "
|
|
72
|
+
"command": ".venv/Scripts/poetry run guiconfig",
|
|
73
73
|
"options": {
|
|
74
74
|
"env": {
|
|
75
75
|
"KCONFIG_CONFIG": "variants/${input:variant}/config.txt"
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
78
|
"problemMatcher": []
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"label": "open report html",
|
|
82
|
+
"command": "${workspaceFolder}/build/${input:variant}/test/src/${input:component}/reports/html/index.html",
|
|
83
|
+
"type": "shell",
|
|
84
|
+
"presentation": {
|
|
85
|
+
"reveal": "always"
|
|
86
|
+
},
|
|
87
|
+
"group": {
|
|
88
|
+
"kind": "build",
|
|
89
|
+
"isDefault": false
|
|
90
|
+
}
|
|
79
91
|
}
|
|
80
92
|
],
|
|
81
93
|
"inputs": [
|
|
@@ -84,9 +96,17 @@
|
|
|
84
96
|
"id": "variant",
|
|
85
97
|
"description": "Which variant do you want to select?",
|
|
86
98
|
"options": [
|
|
87
|
-
|
|
88
|
-
"
|
|
89
|
-
|
|
99
|
+
"EnglishVariant",
|
|
100
|
+
"GermanVariant"
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"type": "pickString",
|
|
105
|
+
"id": "component",
|
|
106
|
+
"description": "Which component do you want to select?",
|
|
107
|
+
"options": [
|
|
108
|
+
"greeter",
|
|
109
|
+
"main"
|
|
90
110
|
]
|
|
91
111
|
}
|
|
92
112
|
]
|
|
@@ -2,15 +2,23 @@
|
|
|
2
2
|
cmake_minimum_required(VERSION 3.24.0)
|
|
3
3
|
cmake_policy(VERSION 3.24)
|
|
4
4
|
|
|
5
|
+
# configure the current variant to be build
|
|
5
6
|
set(BUILD_KIT prod CACHE STRING "Target Group to build.")
|
|
6
7
|
|
|
7
8
|
include(${CMAKE_SOURCE_DIR}/variants/${VARIANT}/config.cmake)
|
|
8
9
|
|
|
9
10
|
if(BUILD_KIT STREQUAL prod)
|
|
10
11
|
project(${VARIANT} C ASM)
|
|
12
|
+
set(VARIANT_ADDITIONAL_COMPILE_C_FLAGS -Dstatic_scope_file=static)
|
|
11
13
|
else()
|
|
14
|
+
# In case of test the project is a C++ project due to GTest usage
|
|
12
15
|
project(${VARIANT} C ASM CXX)
|
|
13
|
-
|
|
16
|
+
|
|
17
|
+
# define static to nothing on file scope to allow access to
|
|
18
|
+
# static variables and function in unit test cases.
|
|
19
|
+
# Furthermore store temporary files during compilation to
|
|
20
|
+
# get preprocessed files.
|
|
21
|
+
set(VARIANT_ADDITIONAL_COMPILE_C_FLAGS -Dstatic_scope_file= -save-temps)
|
|
14
22
|
endif()
|
|
15
23
|
|
|
16
24
|
# Fetch all external dependencies into modules directory
|
|
@@ -15,6 +15,8 @@ https://go.microsoft.com/fwlink/?LinkID=135170
|
|
|
15
15
|
param(
|
|
16
16
|
[Parameter(Mandatory = $false, HelpMessage = 'Install all dependencies required to build. (Switch, default: false)')]
|
|
17
17
|
[switch]$install = $false,
|
|
18
|
+
[Parameter(Mandatory = $false, HelpMessage = 'Build the target.')]
|
|
19
|
+
[switch]$build = $false,
|
|
18
20
|
[Parameter(Mandatory = $false, HelpMessage = 'Clean build, wipe out all build artifacts. (Switch, default: false)')]
|
|
19
21
|
[switch]$clean = $false,
|
|
20
22
|
[Parameter(Mandatory = $false, HelpMessage = 'Build kit to be used. (String, default: "prod")')]
|
|
@@ -74,6 +76,38 @@ function Test-RunningInCIorTestEnvironment {
|
|
|
74
76
|
return [Boolean]($Env:JENKINS_URL -or $Env:PYTEST_CURRENT_TEST -or $Env:GITHUB_ACTIONS)
|
|
75
77
|
}
|
|
76
78
|
|
|
79
|
+
# Consider CI environment variables (e.g. on Jenkins BRANCH_NAME and CHANGE_TARGET) to filter tests in release branch builds
|
|
80
|
+
function Get-ReleaseBranchPytestFilter {
|
|
81
|
+
$ChangeId = $env:CHANGE_ID
|
|
82
|
+
$BranchName = $env:BRANCH_NAME
|
|
83
|
+
$ChangeTarget = $env:CHANGE_TARGET
|
|
84
|
+
|
|
85
|
+
$targetBranch = ''
|
|
86
|
+
|
|
87
|
+
if (-not $ChangeId -and $BranchName -and $BranchName.StartsWith("release/")) {
|
|
88
|
+
$targetBranch = $BranchName
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if ($ChangeId -and $ChangeTarget -and $ChangeTarget.StartsWith("release/") ) {
|
|
92
|
+
$targetBranch = $ChangeTarget
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
$filter = ''
|
|
96
|
+
if ($targetBranch -and ($targetBranch -match 'release/([^/]+/[^/]+)(.*)')) {
|
|
97
|
+
$filter = $Matches[1]
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return $filter
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function Invoke-Bootstrap {
|
|
104
|
+
# Download bootstrap scripts from external repository
|
|
105
|
+
Invoke-RestMethod https://raw.githubusercontent.com/avengineers/bootstrap-installer/v1.5.0/install.ps1 | Invoke-Expression
|
|
106
|
+
# Execute bootstrap script
|
|
107
|
+
. .\.bootstrap\bootstrap.ps1
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
|
|
77
111
|
# Build with given parameters
|
|
78
112
|
Function Invoke-Build {
|
|
79
113
|
param (
|
|
@@ -110,9 +144,9 @@ Function Invoke-Build {
|
|
|
110
144
|
|
|
111
145
|
# Filter pytest test cases
|
|
112
146
|
$filterCmd = ''
|
|
113
|
-
|
|
114
|
-
if ($
|
|
115
|
-
$filterCmd = "-k "
|
|
147
|
+
$releaseBranchFilter = Get-ReleaseBranchPytestFilter
|
|
148
|
+
if ($releaseBranchFilter) {
|
|
149
|
+
$filterCmd = "-k '$releaseBranchFilter'"
|
|
116
150
|
}
|
|
117
151
|
# otherwise consider command line option '-filter' if given
|
|
118
152
|
elseif ($filter) {
|
|
@@ -135,7 +169,7 @@ Function Invoke-Build {
|
|
|
135
169
|
$dirs = Get-Childitem -Include config.cmake -Path variants -Recurse | Resolve-Path -Relative
|
|
136
170
|
$variantsList = @()
|
|
137
171
|
Foreach ($dir in $dirs) {
|
|
138
|
-
$variant = (get-item $dir).Directory.
|
|
172
|
+
$variant = (get-item $dir).Directory.BaseName
|
|
139
173
|
$variantsList += $variant
|
|
140
174
|
}
|
|
141
175
|
$variantsSelected = @()
|
|
@@ -158,7 +192,7 @@ Function Invoke-Build {
|
|
|
158
192
|
}
|
|
159
193
|
|
|
160
194
|
# Select 'test' build kit based on target
|
|
161
|
-
if ($target.Contains("unittests") -or $target.Contains("reports")) {
|
|
195
|
+
if ($target.Contains("unittests") -or $target.Contains("reports") -or $target.Contains("docs")) {
|
|
162
196
|
$buildKit = "test"
|
|
163
197
|
}
|
|
164
198
|
|
|
@@ -211,21 +245,17 @@ Push-Location $PSScriptRoot
|
|
|
211
245
|
Write-Output "Running in ${pwd}"
|
|
212
246
|
|
|
213
247
|
try {
|
|
248
|
+
if (Test-RunningInCIorTestEnvironment -or $Env:USER_PATH_FIRST) {
|
|
249
|
+
Initialize-EnvPath
|
|
250
|
+
}
|
|
251
|
+
|
|
214
252
|
if ($install) {
|
|
215
|
-
#
|
|
216
|
-
|
|
217
|
-
New-Item -ItemType Directory '.bootstrap'
|
|
218
|
-
}
|
|
219
|
-
Invoke-RestMethod "https://raw.githubusercontent.com/avengineers/bootstrap/v1.3.0/bootstrap.ps1" -OutFile ".\.bootstrap\bootstrap.ps1"
|
|
220
|
-
Invoke-CommandLine ". .\.bootstrap\bootstrap.ps1" -Silent $true
|
|
221
|
-
Write-Output "For installation changes to take effect, please close and re-open your current shell."
|
|
253
|
+
# bootstrap environment
|
|
254
|
+
Invoke-Bootstrap
|
|
222
255
|
}
|
|
223
|
-
|
|
256
|
+
|
|
257
|
+
if ($build) {
|
|
224
258
|
# Call build system
|
|
225
|
-
if (Test-RunningInCIorTestEnvironment -or $Env:USER_PATH_FIRST) {
|
|
226
|
-
Initialize-EnvPath
|
|
227
|
-
}
|
|
228
|
-
# Call CMake
|
|
229
259
|
Invoke-Build `
|
|
230
260
|
-target $target `
|
|
231
261
|
-buildKit $buildKit `
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
1
|
""" Configuration """
|
|
3
2
|
|
|
3
|
+
import datetime
|
|
4
4
|
import json
|
|
5
5
|
import os
|
|
6
|
-
import datetime
|
|
7
6
|
import re
|
|
8
7
|
|
|
9
8
|
day = datetime.date.today()
|
|
10
9
|
# meta data #################################################################
|
|
11
10
|
|
|
12
|
-
project = "
|
|
11
|
+
project = "Hello SPL"
|
|
13
12
|
copyright = f"{day.year} Avengineers"
|
|
14
13
|
release = f"{day}"
|
|
15
14
|
|
|
@@ -64,8 +63,11 @@ html_theme_options = {
|
|
|
64
63
|
}
|
|
65
64
|
|
|
66
65
|
# EXTENSIONS AND THEIR CONFIGS ##############################################
|
|
67
|
-
extensions = ["sphinx_rtd_size"]
|
|
68
66
|
|
|
67
|
+
# extensions and their configuration #########################################
|
|
68
|
+
extensions = []
|
|
69
|
+
|
|
70
|
+
extensions.append("sphinx_rtd_size")
|
|
69
71
|
sphinx_rtd_size_width = "90%"
|
|
70
72
|
|
|
71
73
|
# mermaid config - @see https://pypi.org/project/sphinxcontrib-mermaid/ #####
|
|
@@ -170,14 +172,14 @@ html_context = {
|
|
|
170
172
|
# Check if the SPHINX_BUILD_CONFIGURATION_FILE environment variable exists
|
|
171
173
|
# and if so, load the JSON file and set the 'html_context' variable
|
|
172
174
|
if "SPHINX_BUILD_CONFIGURATION_FILE" in os.environ:
|
|
173
|
-
with open(os.environ["SPHINX_BUILD_CONFIGURATION_FILE"]
|
|
175
|
+
with open(os.environ["SPHINX_BUILD_CONFIGURATION_FILE"]) as file:
|
|
174
176
|
html_context["build_config"] = json.load(file)
|
|
175
177
|
include_patterns.extend(html_context["build_config"].get("include_patterns", []))
|
|
176
178
|
|
|
177
179
|
# Check if the SPHINX_BUILD_CONFIGURATION_FILE environment variable exists
|
|
178
180
|
# and if so, load the JSON file and set the 'html_context' variable
|
|
179
181
|
if "AUTOCONF_JSON_FILE" in os.environ:
|
|
180
|
-
with open(os.environ["AUTOCONF_JSON_FILE"]
|
|
182
|
+
with open(os.environ["AUTOCONF_JSON_FILE"]) as file:
|
|
181
183
|
html_context["config"] = json.load(file)["features"]
|
|
182
184
|
|
|
183
185
|
if "VARIANT" in os.environ:
|
|
@@ -1316,7 +1316,7 @@ HTML_FILE_EXTENSION = .html
|
|
|
1316
1316
|
# of the possible markers and block names see the documentation.
|
|
1317
1317
|
# This tag requires that the tag GENERATE_HTML is set to YES.
|
|
1318
1318
|
|
|
1319
|
-
HTML_HEADER =
|
|
1319
|
+
HTML_HEADER =
|
|
1320
1320
|
|
|
1321
1321
|
# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
|
|
1322
1322
|
# generated HTML page. If the tag is left blank doxygen will generate a standard
|
|
@@ -2356,7 +2356,7 @@ INCLUDE_FILE_PATTERNS =
|
|
|
2356
2356
|
# recursively expanded use the := operator instead of the = operator.
|
|
2357
2357
|
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
|
|
2358
2358
|
|
|
2359
|
-
PREDEFINED =
|
|
2359
|
+
PREDEFINED = "static_scope_file=static"
|
|
2360
2360
|
|
|
2361
2361
|
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
|
|
2362
2362
|
# tag can be used to specify a list of macro names that should be expanded. The
|
|
@@ -4,15 +4,14 @@ Components
|
|
|
4
4
|
{% for component_info in build_config.components_info %}
|
|
5
5
|
{% if component_info.has_docs %}
|
|
6
6
|
|
|
7
|
-
{{ component_info.long_name }}
|
|
8
|
-
|
|
7
|
+
{{ component_info.long_name or component_info.name }}
|
|
8
|
+
-----------------------------------------------------
|
|
9
9
|
|
|
10
10
|
.. toctree::
|
|
11
11
|
:maxdepth: 2
|
|
12
12
|
|
|
13
13
|
/{{ component_info.path }}/doc/index
|
|
14
14
|
{% if (build_config.target == 'reports') and component_info.has_reports %}
|
|
15
|
-
/{{ component_info.reports_output_dir }}/unit_test_spec
|
|
16
15
|
/{{ component_info.reports_output_dir }}/unit_test_results
|
|
17
16
|
/{{ component_info.reports_output_dir }}/doxygen/html/index
|
|
18
17
|
/{{ component_info.reports_output_dir }}/coverage
|