spl-core 7.14.0rc3.dev1__tar.gz → 7.14.0rc4.dev3__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 (71) hide show
  1. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/PKG-INFO +12 -11
  2. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/pyproject.toml +16 -16
  3. spl_core-7.14.0rc4.dev3/src/spl_core/__init__.py +1 -0
  4. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/test_utils/artifacts_archiver.py +157 -13
  5. spl_core-7.14.0rc3.dev1/src/spl_core/__init__.py +0 -1
  6. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/LICENSE +0 -0
  7. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/README.md +0 -0
  8. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/__run.py +0 -0
  9. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/common/__init__.py +0 -0
  10. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/common/path.py +0 -0
  11. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/common.cmake +0 -0
  12. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/conan.cmake +0 -0
  13. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/config/KConfig +0 -0
  14. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/gcov_maid/__init__.py +0 -0
  15. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/gcov_maid/gcov_maid.py +0 -0
  16. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kconfig/__init__.py +0 -0
  17. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kconfig/kconfig.py +0 -0
  18. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kconfig.cmake +0 -0
  19. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/__init__.py +0 -0
  20. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/create.py +0 -0
  21. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/application/.vscode/cmake-variants.json +0 -0
  22. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/application/KConfig +0 -0
  23. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/application/src/greeter/CMakeLists.txt +0 -0
  24. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/application/src/greeter/doc/_images/screenshot.png +0 -0
  25. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/application/src/greeter/doc/index.md +0 -0
  26. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/application/src/greeter/src/greeter.c +0 -0
  27. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/application/src/greeter/src/greeter.h +0 -0
  28. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/application/src/greeter/test/test_greeter.cc +0 -0
  29. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/application/src/main/CMakeLists.txt +0 -0
  30. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/application/src/main/doc/index.md +0 -0
  31. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/application/src/main/src/main.c +0 -0
  32. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/application/test/EnglishVariant/test__EnglishVariant.py +0 -0
  33. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/application/test/German/test__GermanVariant.py +0 -0
  34. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/application/variants/EnglishVariant/config.cmake +0 -0
  35. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/application/variants/EnglishVariant/parts.cmake +0 -0
  36. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/application/variants/GermanVariant/config.cmake +0 -0
  37. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/application/variants/GermanVariant/config.txt +0 -0
  38. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/application/variants/GermanVariant/parts.cmake +0 -0
  39. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/project/.gitignore +0 -0
  40. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/project/.vscode/cmake-kits.json +0 -0
  41. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/project/.vscode/extensions.json +0 -0
  42. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/project/.vscode/launch.json +0 -0
  43. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/project/.vscode/settings.json +0 -0
  44. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/project/.vscode/tasks.json +0 -0
  45. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/project/CMakeLists.txt +0 -0
  46. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/project/README.md +0 -0
  47. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/project/bootstrap.json +0 -0
  48. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/project/build.bat +0 -0
  49. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/project/build.ps1 +0 -0
  50. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/project/conf.py +0 -0
  51. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/project/doc/Doxyfile.in +0 -0
  52. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/project/doc/common/index.md +0 -0
  53. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/project/doc/components/index.md +0 -0
  54. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/project/doc/doxygen-awesome/LICENSE +0 -0
  55. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/project/doc/doxygen-awesome/doxygen-awesome.css +0 -0
  56. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/project/doc/software_architecture/index.md +0 -0
  57. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/project/doc/software_requirements/index.md +0 -0
  58. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/project/doc/test_report_template.txt +0 -0
  59. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/project/index.md +0 -0
  60. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/project/pypeline.yaml +0 -0
  61. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/project/pyproject.toml +0 -0
  62. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/project/pytest.ini +0 -0
  63. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/project/scoopfile.json +0 -0
  64. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/project/tools/toolchains/clang/toolchain.cmake +0 -0
  65. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/kickstart/templates/project/tools/toolchains/gcc/toolchain.cmake +0 -0
  66. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/main.py +0 -0
  67. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/spl.cmake +0 -0
  68. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/steps/collect_pr_changes.py +0 -0
  69. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/test_utils/archive_artifacts_collection.py +0 -0
  70. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/test_utils/base_variant_test_runner.py +0 -0
  71. {spl_core-7.14.0rc3.dev1 → spl_core-7.14.0rc4.dev3}/src/spl_core/test_utils/spl_build.py +0 -0
@@ -1,43 +1,44 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: spl-core
3
- Version: 7.14.0rc3.dev1
3
+ Version: 7.14.0rc4.dev3
4
4
  Summary: Software Product Line Support for CMake
5
5
  License: MIT
6
6
  License-File: LICENSE
7
7
  Author: Avengineers
8
8
  Author-email: karsten.guenther@kamg.de
9
- Requires-Python: >=3.11,<3.12
9
+ Requires-Python: >=3.10,<3.12
10
10
  Classifier: Development Status :: 2 - Pre-Alpha
11
11
  Classifier: Intended Audience :: Developers
12
12
  Classifier: License :: OSI Approved :: MIT License
13
13
  Classifier: Natural Language :: English
14
14
  Classifier: Operating System :: OS Independent
15
15
  Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
16
17
  Classifier: Programming Language :: Python :: 3.11
17
18
  Classifier: Topic :: Software Development :: Libraries
18
- Requires-Dist: cookiecutter (>=2.6,<3.0)
19
+ Requires-Dist: cookiecutter (==2.6.0)
19
20
  Requires-Dist: doxysphinx (>=3.3,<4.0)
20
21
  Requires-Dist: gcovr (>=8.3,<9.0)
21
22
  Requires-Dist: hammocking (>=0.8,<0.10)
22
23
  Requires-Dist: kconfiglib (>=14.1,<15.0)
23
- Requires-Dist: mlx-traceability (>=10,<13)
24
+ Requires-Dist: mlx-traceability (>=10,<12)
24
25
  Requires-Dist: myst-parser (>=0.16)
25
26
  Requires-Dist: py-app-dev (>=2.1,<3.0)
26
27
  Requires-Dist: py7zr (>=1.0.0,<2.0.0)
27
28
  Requires-Dist: pypeline-runner (>=1,<=2)
28
29
  Requires-Dist: pypeline-semantic-release (>=0.4.1,<=0.5.0)
29
- Requires-Dist: sphinx (>=8.2,<9.0)
30
+ Requires-Dist: sphinx (>=7.3,<8.0)
30
31
  Requires-Dist: sphinx-book-theme (>=1.1,<2.0)
31
32
  Requires-Dist: sphinx-copybutton (>=0.5,<0.6)
32
- Requires-Dist: sphinx-design (>=0.5,<0.8)
33
- Requires-Dist: sphinx-needs (>=2,<7)
34
- Requires-Dist: sphinx-new-tab-link (>=0.4,<0.10)
33
+ Requires-Dist: sphinx-design (>=0.5,<0.7)
34
+ Requires-Dist: sphinx-needs (>=2.0,<3.0)
35
+ Requires-Dist: sphinx-new-tab-link (>=0.4,<0.9)
35
36
  Requires-Dist: sphinx-rtd-size (>=0.2,<0.3)
36
- Requires-Dist: sphinx-rtd-theme (>=2,<4)
37
+ Requires-Dist: sphinx-rtd-theme (>=2.0,<3.0)
37
38
  Requires-Dist: sphinx-test-reports (>=1.0,<2.0)
38
39
  Requires-Dist: sphinxcontrib-datatemplates (>=0.11,<0.12)
39
- Requires-Dist: sphinxcontrib-mermaid (>=1.1,<2.0)
40
- Requires-Dist: sphinxcontrib-plantuml (>=0.29,<0.33)
40
+ Requires-Dist: sphinxcontrib-mermaid (>=0.9,<0.10)
41
+ Requires-Dist: sphinxcontrib-plantuml (>=0.29,<0.31)
41
42
  Requires-Dist: typer (>=0,<1)
42
43
  Project-URL: Bug Tracker, https://github.com/avengineers/spl-core/issues
43
44
  Project-URL: Changelog, https://github.com/avengineers/spl-core/blob/develop/CHANGELOG.md
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "spl-core"
3
- version = "7.14.0-rc3.dev.1"
3
+ version = "7.14.0-rc4.dev.3"
4
4
  description = "Software Product Line Support for CMake"
5
5
  authors = ["Avengineers <karsten.guenther@kamg.de>"]
6
6
  license = "MIT"
@@ -24,37 +24,37 @@ please = "spl_core.main:main"
24
24
  "Changelog" = "https://github.com/avengineers/spl-core/blob/develop/CHANGELOG.md"
25
25
 
26
26
  [tool.poetry.dependencies]
27
- python = ">=3.11,<3.12"
27
+ python = ">=3.10,<3.12"
28
28
  py-app-dev = "^2.1"
29
- cookiecutter = "^2.6"
29
+ cookiecutter = "==2.6.0"
30
30
  gcovr = "^8.3"
31
31
  hammocking = ">=0.8,<0.10"
32
32
  kconfiglib = "^14.1"
33
33
  typer = "^0"
34
34
  doxysphinx = "^3.3"
35
- sphinx = "^8.2"
36
- sphinx-rtd-theme = ">=2,<4"
37
- sphinxcontrib-mermaid = "^1.1"
38
- sphinx-needs = ">=2,<7"
35
+ sphinx = "^7.3"
36
+ sphinx-rtd-theme = "^2.0"
37
+ sphinxcontrib-mermaid = "^0.9"
38
+ sphinx-needs = "^2.0"
39
39
  sphinx-test-reports = "^1.0"
40
40
  sphinx-rtd-size = "^0.2"
41
41
  sphinxcontrib-datatemplates = "^0.11"
42
- sphinxcontrib-plantuml = ">=0.29,<0.33"
42
+ sphinxcontrib-plantuml = ">=0.29,<0.31"
43
43
  sphinx-copybutton = "^0.5"
44
- sphinx-new-tab-link = ">=0.4,<0.10"
44
+ sphinx-new-tab-link = ">=0.4,<0.9"
45
45
  myst-parser = ">=0.16"
46
- mlx-traceability = ">=10,<13"
46
+ mlx-traceability = ">=10,<12"
47
47
  sphinx-book-theme = "^1.1"
48
- sphinx-design = ">=0.5,<0.8"
48
+ sphinx-design = ">=0.5,<0.7"
49
49
  pypeline-semantic-release = ">=0.4.1,<=0.5.0"
50
50
  pypeline-runner = ">=1,<=2"
51
51
  py7zr = "^1.0.0"
52
52
 
53
53
  [tool.poetry.group.dev.dependencies]
54
- pytest = ">=7,<11"
55
- pytest-cov = ">=4,<9"
56
- pre-commit = "^4.4"
57
- ruff = ">=0.5,<0.20"
54
+ pytest = ">=7,<9"
55
+ pytest-cov = "^4.0"
56
+ pre-commit = "^3.1.1"
57
+ ruff = ">=0.5,<0.13"
58
58
  jinja2 = "*"
59
59
  testfixtures = "*"
60
60
  junitparser = "*"
@@ -62,7 +62,7 @@ mashumaro = "*"
62
62
  loguru = "*"
63
63
  flake8 = "*"
64
64
  pipenv = "*"
65
- python-semantic-release = "^9.21"
65
+ python-semantic-release = "^9.16.1"
66
66
 
67
67
  [tool.semantic_release]
68
68
  version_toml = ["pyproject.toml:tool.poetry.version"]
@@ -0,0 +1 @@
1
+ __version__ = "7.14.0-rc4.dev.3"
@@ -1,6 +1,7 @@
1
1
  import json
2
2
  import os
3
3
  from dataclasses import dataclass
4
+ from datetime import datetime, timezone
4
5
  from pathlib import Path
5
6
  from typing import Dict, List, Optional
6
7
 
@@ -122,6 +123,7 @@ class ArtifactsArchiver:
122
123
  def __init__(self) -> None:
123
124
  self.archives: Dict[str, ArtifactsArchive] = {}
124
125
  self._target_repos: Dict[str, str] = {}
126
+ # self._artifacts_metadata: Dict[str, Dict[str, Dict[str, str]]] = {} # variant -> category -> artifacts
125
127
 
126
128
  def add_archive(self, out_dir: Path, archive_filename: str, target_repo: Optional[str] = None, archive_name: str = "default") -> ArtifactsArchive:
127
129
  """
@@ -177,6 +179,34 @@ class ArtifactsArchiver:
177
179
 
178
180
  return self.archives[archive_name]
179
181
 
182
+ def get_archive_url(self, archive_name: str = "default") -> Optional[str]:
183
+ """
184
+ Get the Artifactory URL for a specific archive.
185
+
186
+ Args:
187
+ archive_name: Name of the archive (defaults to "default")
188
+
189
+ Returns:
190
+ The full Artifactory URL for the archive, or None if no target repo configured
191
+
192
+ Example:
193
+ "https://artifactory.marquardt.de/artifactory/spled-generic-snapshot-rietheim/develop/123/Disco.7z"
194
+ """
195
+ if archive_name not in self.archives:
196
+ return None
197
+
198
+ if archive_name not in self._target_repos:
199
+ return None
200
+
201
+ archive = self.archives[archive_name]
202
+ target_repo = self._target_repos[archive_name]
203
+ branch_name, build_number, _ = self._get_build_metadata()
204
+
205
+ # Construct the URL following the same pattern as create_rt_upload_json
206
+ archive_url = f"https://artifactory.marquardt.de/artifactory/{target_repo}/{branch_name}/{build_number}/{archive.archive_name}"
207
+
208
+ return archive_url
209
+
180
210
  def create_all_archives(self) -> Dict[str, Path]:
181
211
  """
182
212
  Create all registered archives.
@@ -214,28 +244,24 @@ class ArtifactsArchiver:
214
244
  else:
215
245
  return 28 # 4 weeks for PRs, feature branches, and other branches
216
246
 
217
- def create_rt_upload_json(self, out_dir: Path) -> Path:
247
+ @staticmethod
248
+ def _get_build_metadata() -> tuple[str, str, bool]:
218
249
  """
219
- Create a single rt-upload.json file containing all archives.
250
+ Get build metadata from environment variables or defaults.
220
251
 
221
- This function replicates the logic from the Jenkinsfile for determining the RT_TARGET
222
- and creating the upload specification file. It uses Jenkins environment variables
223
- when available, otherwise falls back to default values.
224
-
225
- Args:
226
- output_dir: Directory where the rt-upload.json file will be created
252
+ Detects Jenkins environment variables when available, otherwise falls back
253
+ to local development defaults.
227
254
 
228
255
  Returns:
229
- Path to the created rt-upload.json file
256
+ Tuple of (branch_name, build_number, is_tag):
257
+ - branch_name: The branch or PR identifier
258
+ - build_number: The build number or "local_build"
259
+ - is_tag: Whether this is a tag build
230
260
  """
231
- # Set local defaults first
232
- change_id = None
233
261
  branch_name = "local_branch"
234
262
  build_number = "local_build"
235
263
  is_tag = False
236
264
 
237
- # Adapt values when Jenkins environment is detected
238
- # TODO: check if an existing library can be used for CI context detection
239
265
  if os.environ.get("JENKINS_URL"):
240
266
  change_id = os.environ.get("CHANGE_ID")
241
267
  jenkins_branch_name = os.environ.get("BRANCH_NAME")
@@ -256,6 +282,25 @@ class ArtifactsArchiver:
256
282
  if jenkins_build_number:
257
283
  build_number = jenkins_build_number
258
284
 
285
+ return branch_name, build_number, is_tag
286
+
287
+ def create_rt_upload_json(self, out_dir: Path) -> Path:
288
+ """
289
+ Create a single rt-upload.json file containing all archives.
290
+
291
+ This function replicates the logic from the Jenkinsfile for determining the RT_TARGET
292
+ and creating the upload specification file. It uses Jenkins environment variables
293
+ when available, otherwise falls back to default values.
294
+
295
+ Args:
296
+ output_dir: Directory where the rt-upload.json file will be created
297
+
298
+ Returns:
299
+ Path to the created rt-upload.json file
300
+ """
301
+ # Get build metadata from environment or defaults
302
+ branch_name, build_number, is_tag = self._get_build_metadata()
303
+
259
304
  # Calculate retention period based on branch/tag
260
305
  retention_period = self.calculate_retention_period(branch_name, is_tag)
261
306
 
@@ -291,6 +336,94 @@ class ArtifactsArchiver:
291
336
 
292
337
  return json_path
293
338
 
339
+ def create_artifacts_json(self, variant: str, out_dir: Path) -> Path:
340
+ """
341
+ Create an initial artifacts.json file with build metadata structure.
342
+
343
+ This function creates a fresh artifacts.json file with build metadata
344
+ but no artifacts. Use update_artifacts_json() to add artifact categories.
345
+ It uses Jenkins environment variables when available, otherwise falls back to default values.
346
+
347
+ Args:
348
+ variant: The variant name (e.g., "Disco")
349
+ out_dir: Directory where the artifacts.json file will be created
350
+
351
+ Returns:
352
+ Path to the created artifacts.json file
353
+
354
+ Raises:
355
+ ValueError: If variant is empty or None
356
+ """
357
+ # Input validation
358
+ if not variant or not variant.strip():
359
+ raise ValueError("Variant name cannot be empty or None")
360
+
361
+ # Get build metadata from environment or defaults
362
+ branch_name, build_number, _ = self._get_build_metadata()
363
+
364
+ # Create the initial artifacts.json structure
365
+ artifacts_data = {"variant": variant, "build_timestamp": datetime.now(timezone.utc).isoformat(timespec="seconds") + "Z", "build_number": build_number, "branch_name": branch_name, "artifacts": {}}
366
+
367
+ # Create the artifacts.json file
368
+ json_path = out_dir / "artifacts.json"
369
+ json_path.parent.mkdir(parents=True, exist_ok=True)
370
+
371
+ with open(json_path, "w") as f:
372
+ json.dump(artifacts_data, f, indent=2)
373
+
374
+ return json_path
375
+
376
+ def update_artifacts_json(self, category: str, artifacts: Dict[str, str], artifacts_json_path: Path) -> Path:
377
+ """
378
+ Add or update artifacts in a specific category for the artifacts.json file.
379
+
380
+ Args:
381
+ category: The artifact category (e.g., "test_reports", "sca_reports", "build_binaries")
382
+ artifacts: Dictionary mapping artifact names to their URLs/paths
383
+ artifacts_json_path: Path to the artifacts.json file to be updated
384
+
385
+ Returns:
386
+ Path to the updated artifacts.json file
387
+
388
+ Raises:
389
+ ValueError: If category is empty, artifacts dictionary is empty, or JSON structure is invalid
390
+ FileNotFoundError: If artifacts.json file does not exist
391
+ """
392
+ # Input validation
393
+ if not category or not category.strip():
394
+ raise ValueError("Category name cannot be empty or None")
395
+ if not artifacts:
396
+ raise ValueError("Artifacts dictionary cannot be empty")
397
+
398
+ # Check if artifacts.json file exists
399
+ if not artifacts_json_path.exists():
400
+ raise FileNotFoundError(f"artifacts.json file does not exist at {artifacts_json_path}. Please create it first using create_artifacts_json().")
401
+
402
+ # Read existing artifacts.json file
403
+ try:
404
+ with open(artifacts_json_path) as f:
405
+ artifacts_data = json.load(f)
406
+ except json.JSONDecodeError as e:
407
+ raise ValueError(f"Could not parse artifacts.json: {e}") from e
408
+ except OSError as e:
409
+ raise ValueError(f"Could not read artifacts.json: {e}") from e
410
+
411
+ # Validate that the file has the expected structure
412
+ if not artifacts_data or "artifacts" not in artifacts_data:
413
+ raise ValueError("artifacts.json file has invalid structure. Expected 'artifacts' section not found.")
414
+
415
+ # Update the specific category with new artifacts
416
+ if category in artifacts_data["artifacts"]:
417
+ artifacts_data["artifacts"][category].update(artifacts)
418
+ else:
419
+ artifacts_data["artifacts"][category] = artifacts.copy()
420
+
421
+ # Write the updated data back to the file
422
+ with open(artifacts_json_path, "w") as f:
423
+ json.dump(artifacts_data, f, indent=2)
424
+
425
+ return artifacts_json_path
426
+
294
427
  def list_archives(self) -> List[str]:
295
428
  """
296
429
  Get a list of all archive names.
@@ -347,3 +480,14 @@ class ArtifactsArchiver:
347
480
  #
348
481
  # created_files = archiver.create_all_archives()
349
482
  # upload_json = archiver.create_rt_upload_json(Path("./build/output")) # only includes archives with target repos
483
+ #
484
+ # ## Artifacts.json use case (variant-specific metadata):
485
+ # archiver = ArtifactsArchiver()
486
+ # variant = "Disco"
487
+ # out_dir = Path("./build/output")
488
+ #
489
+ # # Create initial artifacts.json file first, then add categories
490
+ # artifacts_json_path = archiver.create_artifacts_json(variant, out_dir)
491
+ # archiver.update_artifacts_json("test_reports", test_reports, artifacts_json_path)
492
+ # archiver.update_artifacts_json("sca_reports", sca_reports, artifacts_json_path)
493
+ # archiver.update_artifacts_json("build_binaries", build_binaries, artifacts_json_path)
@@ -1 +0,0 @@
1
- __version__ = "7.14.0-rc3.dev.1"