spl-core 4.1.0__tar.gz → 4.1.2__tar.gz

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.
Files changed (70) hide show
  1. {spl_core-4.1.0 → spl_core-4.1.2}/PKG-INFO +1 -1
  2. {spl_core-4.1.0 → spl_core-4.1.2}/pyproject.toml +1 -1
  3. spl_core-4.1.2/src/spl_core/__init__.py +1 -0
  4. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/test_utils/base_variant_test_runner.py +28 -5
  5. spl_core-4.1.2/src/spl_core/test_utils/spl_build.py +162 -0
  6. spl_core-4.1.0/src/spl_core/__init__.py +0 -1
  7. spl_core-4.1.0/src/spl_core/test_utils/spl_build.py +0 -77
  8. {spl_core-4.1.0 → spl_core-4.1.2}/LICENSE +0 -0
  9. {spl_core-4.1.0 → spl_core-4.1.2}/README.md +0 -0
  10. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/common/__init__.py +0 -0
  11. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/common/cmake.py +0 -0
  12. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/common/command_line_executor.py +0 -0
  13. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/common/path.py +0 -0
  14. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/gcov_maid/__init__.py +0 -0
  15. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/gcov_maid/gcov_maid.py +0 -0
  16. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/kconfig/__init__.py +0 -0
  17. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/kconfig/kconfig.py +0 -0
  18. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/__init__.py +0 -0
  19. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/creator.py +0 -0
  20. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/cookiecutter.json +0 -0
  21. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/.flake8 +0 -0
  22. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/.gitignore +0 -0
  23. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/.vscode/cmake-kits.json +0 -0
  24. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/.vscode/cmake-variants.json +0 -0
  25. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/.vscode/extensions.json +0 -0
  26. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/.vscode/launch.json +0 -0
  27. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/.vscode/settings.json +0 -0
  28. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/.vscode/tasks.json +0 -0
  29. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/CMakeLists.txt +0 -0
  30. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/KConfig +0 -0
  31. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/LICENSE +0 -0
  32. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/Pipfile +0 -0
  33. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/README.md +0 -0
  34. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/build.bat +0 -0
  35. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/build.ps1 +0 -0
  36. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/conf.py +0 -0
  37. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/doc/Doxyfile.in +0 -0
  38. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/doc/common/index.rst +0 -0
  39. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/doc/components/index.rst +0 -0
  40. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/doc/doxygen-awesome/LICENSE +0 -0
  41. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/doc/doxygen-awesome/doxygen-awesome.css +0 -0
  42. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/doc/software_architecture/index.rst +0 -0
  43. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/doc/software_requirements/index.rst +0 -0
  44. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/doc/test_report_template.txt +0 -0
  45. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/index.rst +0 -0
  46. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/install-mandatory.bat +0 -0
  47. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/pytest.ini +0 -0
  48. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/scoopfile.json +0 -0
  49. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/test/test_build.py +0 -0
  50. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/test/test_unittests.py +0 -0
  51. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/test/utils.py +0 -0
  52. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/tools/setup/git-config.ps1 +0 -0
  53. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/{% if cookiecutter.touch_components -%} components {%- endif %}/component/CMakeLists.txt +0 -0
  54. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/{% if cookiecutter.touch_components -%} components {%- endif %}/component/doc/_images/screenshot.png +0 -0
  55. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/{% if cookiecutter.touch_components -%} components {%- endif %}/component/doc/design.rst +0 -0
  56. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/{% if cookiecutter.touch_components -%} components {%- endif %}/component/doc/index.rst +0 -0
  57. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/{% if cookiecutter.touch_components -%} components {%- endif %}/component/src/component.c +0 -0
  58. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/{% if cookiecutter.touch_components -%} components {%- endif %}/component/src/component.h +0 -0
  59. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/{% if cookiecutter.touch_components -%} components {%- endif %}/component/test/test_component.cc +0 -0
  60. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/{% if cookiecutter.touch_components -%} components {%- endif %}/main/CMakeLists.txt +0 -0
  61. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/{% if cookiecutter.touch_components -%} components {%- endif %}/main/doc/index.rst +0 -0
  62. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/{% if cookiecutter.touch_components -%} components {%- endif %}/main/src/main.c +0 -0
  63. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/{% if cookiecutter.touch_tools -%} tools {%- endif %}/toolchains/clang/toolchain.cmake +0 -0
  64. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/project/{{cookiecutter.name}}/{% if cookiecutter.touch_tools -%} tools {%- endif %}/toolchains/gcc/toolchain.cmake +0 -0
  65. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/variant/cookiecutter.json +0 -0
  66. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/variant/{{cookiecutter.flavor}}/{{cookiecutter.subsystem}}/config.cmake +0 -0
  67. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/variant/{{cookiecutter.flavor}}/{{cookiecutter.subsystem}}/config.txt +0 -0
  68. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/templates/variant/{{cookiecutter.flavor}}/{{cookiecutter.subsystem}}/parts.cmake +0 -0
  69. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/variant.py +0 -0
  70. {spl_core-4.1.0 → spl_core-4.1.2}/src/spl_core/project_creator/workspace_artifacts.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: spl-core
3
- Version: 4.1.0
3
+ Version: 4.1.2
4
4
  Summary: Software Product Line Support for CMake
5
5
  Home-page: https://github.com/avengineers/spl-core
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "spl-core"
3
- version = "4.1.0"
3
+ version = "4.1.2"
4
4
  description = "Software Product Line Support for CMake"
5
5
  authors = ["Avengineers <karsten.guenther@kamg.de>"]
6
6
  license = "MIT"
@@ -0,0 +1 @@
1
+ __version__ = "4.1.2"
@@ -27,7 +27,7 @@ class BaseVariantTestRunner(ABC):
27
27
 
28
28
  @property
29
29
  def expected_variant_report_artifacts(self) -> List[Path]:
30
- return [Path("reports/reports/index.html")]
30
+ return [Path("reports/html/index.html")]
31
31
 
32
32
  @property
33
33
  def expected_component_report_artifacts(self) -> List[Path]:
@@ -39,23 +39,46 @@ class BaseVariantTestRunner(ABC):
39
39
  Path("coverage/index.html"),
40
40
  ]
41
41
 
42
+ @property
43
+ def create_artifacts_archive(self) -> bool:
44
+ return True
45
+
46
+ @property
47
+ def create_artifacts_json(self) -> bool:
48
+ return True
49
+
50
+ @property
51
+ def expected_archive_artifacts(self) -> List[Path]:
52
+ return self.expected_build_artifacts
53
+
54
+ def assert_artifact_exists(self, dir: Path, artifact: Path) -> None:
55
+ if artifact.is_absolute():
56
+ assert artifact.exists(), f"Artifact {artifact} does not exist" # noqa: S101
57
+ else:
58
+ assert Path.joinpath(dir, artifact).exists(), f"Artifact {Path.joinpath(dir, artifact)} does not exist" # noqa: S101
59
+
42
60
  def test_build(self) -> None:
43
61
  spl_build: SplBuild = SplBuild(variant=self.variant, build_kit="prod")
44
62
  assert 0 == spl_build.execute(target="all") # noqa: S101
45
63
  for artifact in self.expected_build_artifacts:
46
- assert artifact.exists() or Path.joinpath(spl_build.build_dir, artifact).exists() # noqa: S101
64
+ self.assert_artifact_exists(dir=spl_build.build_dir, artifact=artifact)
65
+ if self.create_artifacts_archive:
66
+ # create artifacts archive
67
+ spl_build.create_artifacts_archive(self.expected_archive_artifacts)
68
+ if self.create_artifacts_json:
69
+ spl_build.create_artifacts_json(self.expected_archive_artifacts)
47
70
 
48
71
  def test_unittest(self) -> None:
49
72
  spl_build: SplBuild = SplBuild(variant=self.variant, build_kit="test")
50
73
  assert 0 == spl_build.execute(target="unittests") # noqa: S101
51
74
  for artifact in self.expected_test_artifacts:
52
- assert artifact.exists() # noqa: S101
75
+ self.assert_artifact_exists(dir=spl_build.build_dir, artifact=artifact)
53
76
 
54
77
  def test_reports(self) -> None:
55
78
  spl_build: SplBuild = SplBuild(variant=self.variant, build_kit="test")
56
79
  assert 0 == spl_build.execute(target="all") # noqa: S101
57
80
  for artifact in self.expected_variant_report_artifacts:
58
- assert Path.joinpath(spl_build.build_dir, artifact).exists() # noqa: S101
81
+ self.assert_artifact_exists(dir=spl_build.build_dir, artifact=artifact)
59
82
  for component in self.component_paths:
60
83
  for artifact in self.expected_component_report_artifacts:
61
- assert Path.joinpath(spl_build.build_dir, component, artifact).exists() # noqa: S101
84
+ self.assert_artifact_exists(dir=Path.joinpath(spl_build.build_dir, "reports", "html", spl_build.build_dir, component, "reports"), artifact=artifact)
@@ -0,0 +1,162 @@
1
+ import json
2
+ import time
3
+ import zipfile
4
+ from dataclasses import dataclass
5
+ from pathlib import Path
6
+ from typing import List, Optional
7
+
8
+ from py_app_dev.core.logging import time_it
9
+
10
+ from spl_core.common.command_line_executor import CommandLineExecutor
11
+
12
+
13
+ @dataclass
14
+ class ArchiveArtifact:
15
+ archive_path: Path
16
+ absolute_path: Path
17
+
18
+
19
+ class ArtifactsCollection:
20
+ def __init__(self, artifacts: List[Path], build_dir: Path):
21
+ self.archive_artifacts: List[ArchiveArtifact] = []
22
+ for artifact in artifacts:
23
+ if artifact.is_absolute():
24
+ artifact_path = artifact
25
+ else:
26
+ artifact_path = Path.joinpath(build_dir.absolute(), artifact)
27
+ if artifact_path.is_dir():
28
+ for artifact in artifact_path.glob("**/*"):
29
+ if artifact.is_file():
30
+ if artifact_path.is_relative_to(build_dir.absolute()):
31
+ self.archive_artifacts.append(ArchiveArtifact(archive_path=artifact.relative_to(build_dir.absolute()), absolute_path=artifact.absolute()))
32
+ else:
33
+ self.archive_artifacts.append(ArchiveArtifact(archive_path=Path(artifact.name), absolute_path=artifact.absolute()))
34
+ else:
35
+ if artifact_path.is_relative_to(build_dir.absolute()):
36
+ self.archive_artifacts.append(ArchiveArtifact(archive_path=artifact_path.relative_to(build_dir.absolute()), absolute_path=artifact_path.absolute()))
37
+ else:
38
+ self.archive_artifacts.append(ArchiveArtifact(archive_path=Path(artifact_path.name), absolute_path=artifact_path.absolute()))
39
+
40
+
41
+ class SplBuild:
42
+ """Class for building an SPL repository."""
43
+
44
+ def __init__(self, variant: str, build_kit: str):
45
+ """
46
+ Initialize a SplBuild instance.
47
+
48
+ Args:
49
+ variant (str): The build variant.
50
+ build_kit (str): The build kit.
51
+
52
+ """
53
+ self.variant = variant
54
+ self.build_kit = build_kit
55
+
56
+ @property
57
+ def build_dir(self) -> Path:
58
+ """
59
+ Get the build directory.
60
+
61
+ Returns:
62
+ Path: The build directory path.
63
+
64
+ """
65
+ return Path(f"build/{self.variant}/{self.build_kit}")
66
+
67
+ @time_it()
68
+ def execute(self, target: str, additional_args: Optional[List[str]] = None) -> int:
69
+ """
70
+ Build the target
71
+
72
+ Args:
73
+ target (str): The build target.
74
+ additional_args (List[str], optional): Additional arguments for building. Defaults to ["-build"].
75
+
76
+ Returns:
77
+ int: 0 in case of success.
78
+
79
+ """
80
+ if additional_args is None:
81
+ additional_args = ["-build"]
82
+ return_code = -1
83
+ while True:
84
+ cmd = [
85
+ "build.bat",
86
+ "-buildKit",
87
+ self.build_kit,
88
+ "-variants",
89
+ self.variant,
90
+ "-target",
91
+ target,
92
+ "-reconfigure",
93
+ ]
94
+ cmd.extend(additional_args)
95
+ result = CommandLineExecutor().execute(cmd)
96
+ return_code = result.returncode
97
+ if result.returncode:
98
+ if result.stdout:
99
+ if any(error in str(result.stdout) for error in ["No valid floating license", "No valid license", "GHS_LMHOST = N/A"]):
100
+ print("Probably a license issue, retrying ...")
101
+ time.sleep(10)
102
+ else:
103
+ break
104
+ else:
105
+ break
106
+ else:
107
+ break
108
+ return return_code
109
+
110
+ def create_artifacts_archive(self, expected_artifacts: List[Path]) -> Path:
111
+ """
112
+ Create a zip file containing the collected artifacts.
113
+
114
+ Args:
115
+ expected_artifacts: List of Path of artifacts which should be archived
116
+
117
+ Returns:
118
+ Path: The path to the created zip file.
119
+
120
+ Raises:
121
+ Exception: If there is an error creating the zip file.
122
+
123
+ """
124
+ zip_path = self.build_dir / "artifacts.zip"
125
+
126
+ # Delete the file if it already exists
127
+ if zip_path.exists():
128
+ zip_path.unlink()
129
+
130
+ try:
131
+ with zipfile.ZipFile(zip_path, "w") as zip_file:
132
+ artifacts_collection = ArtifactsCollection(artifacts=expected_artifacts, build_dir=self.build_dir)
133
+ for artifact in artifacts_collection.archive_artifacts:
134
+ zip_file.write(artifact.absolute_path, arcname=artifact.archive_path)
135
+ print(f"Zip file created at: {zip_path}")
136
+ return zip_path
137
+ except Exception as e:
138
+ print(f"Error creating artifacts zip file: {e}")
139
+ raise e
140
+
141
+ def create_artifacts_json(self, expected_artifacts: List[Path]) -> Path:
142
+ """
143
+ Create a JSON file listing the collected artifacts.
144
+
145
+ Returns:
146
+ Path: The path to the created JSON file.
147
+
148
+ Raises:
149
+ Exception: If there is an error creating the JSON file.
150
+
151
+ """
152
+ artifacts_collection = ArtifactsCollection(artifacts=expected_artifacts, build_dir=self.build_dir)
153
+ json_content = {
154
+ "variant": self.variant,
155
+ "build_kit": self.build_kit,
156
+ "artifacts": [str(artifact.archive_path.as_posix()) for artifact in artifacts_collection.archive_artifacts],
157
+ }
158
+ json_path = self.build_dir / "artifacts.json"
159
+
160
+ json_path.write_text(json.dumps(json_content, indent=4))
161
+
162
+ return json_path
@@ -1 +0,0 @@
1
- __version__ = "4.1.0"
@@ -1,77 +0,0 @@
1
- import time
2
- from pathlib import Path
3
- from typing import List, Optional
4
-
5
- from py_app_dev.core.logging import time_it
6
-
7
- from spl_core.common.command_line_executor import CommandLineExecutor
8
-
9
-
10
- class SplBuild:
11
- """Class for building an SPL repository."""
12
-
13
- def __init__(self, variant: str, build_kit: str):
14
- """
15
- Initialize a SplBuild instance.
16
-
17
- Args:
18
- variant (str): The build variant.
19
- build_kit (str): The build kit.
20
-
21
- """
22
- self.variant = variant
23
- self.build_kit = build_kit
24
-
25
- @property
26
- def build_dir(self) -> Path:
27
- """
28
- Get the build directory.
29
-
30
- Returns:
31
- Path: The build directory path.
32
-
33
- """
34
- return Path(f"build/{self.variant}/{self.build_kit}")
35
-
36
- @time_it()
37
- def execute(self, target: str, additional_args: Optional[List[str]] = None) -> int:
38
- """
39
- Build the target
40
-
41
- Args:
42
- target (str): The build target.
43
- additional_args (List[str], optional): Additional arguments for building. Defaults to ["-build"].
44
-
45
- Returns:
46
- int: 0 in case of success.
47
-
48
- """
49
- if additional_args is None:
50
- additional_args = ["-build"]
51
- return_code = -1
52
- while True:
53
- cmd = [
54
- "build.bat",
55
- "-buildKit",
56
- self.build_kit,
57
- "-variants",
58
- self.variant,
59
- "-target",
60
- target,
61
- "-reconfigure",
62
- ]
63
- cmd.extend(additional_args)
64
- result = CommandLineExecutor().execute(cmd)
65
- return_code = result.returncode
66
- if result.returncode:
67
- if result.stdout:
68
- if any(error in str(result.stdout) for error in ["No valid floating license", "No valid license", "GHS_LMHOST = N/A"]):
69
- print("Probably a license issue, retrying ...")
70
- time.sleep(10)
71
- else:
72
- break
73
- else:
74
- break
75
- else:
76
- break
77
- return return_code
File without changes
File without changes