Skip to content

Commit c231777

Browse files
committed
Cache release metadata on disk
1 parent 7dd8f94 commit c231777

2 files changed

Lines changed: 29 additions & 5 deletions

File tree

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,20 @@
1717

1818
## Introduction
1919

20-
This repository is meant to hold lightweight metadata for shared Nabla assets and CI references without forcing large binary payloads into normal Git history.
20+
This repository provides the NAM consumer module together with the first-party
21+
Nabla manifest registry and release-backed payload channels, without forcing
22+
large binary payloads into normal Git history.
2123

2224
The repository itself is first-party Nabla infrastructure, but the consumer
2325
module is not meant to be Nabla-only. Other projects can vendor
2426
`nam.cmake`, keep their own `.dvc`-based manifest repository, publish payloads
2527
through `GitHub Release assets`, and reuse the same build-time materialization
2628
model.
2729

30+
Current scope is intentionally narrow. For now the only supported remote
31+
payload backend is `GitHub Release assets`, and no additional backends are
32+
planned in the near term.
33+
2834
The current Nabla examples layout at:
2935

3036
- `https://github.com/Devsh-Graphics-Programming/Nabla-Example-And-Tests-Media`

cmake/NablaAssetManifests.cmake

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,11 +347,29 @@ function(_nam_get_github_release_json OUT_JSON_VAR)
347347
set(_meta_dir "${_cache_root}/meta/${NAM_REPO}")
348348
file(MAKE_DIRECTORY "${_meta_dir}")
349349
set(_json_file "${_meta_dir}/${NAM_TAG}.json")
350+
if (EXISTS "${_json_file}")
351+
file(READ "${_json_file}" _cached_file_json)
352+
if (NOT _cached_file_json STREQUAL "")
353+
set_property(GLOBAL PROPERTY "${_cache_key}" "${_cached_file_json}")
354+
set(${OUT_JSON_VAR} "${_cached_file_json}" PARENT_SCOPE)
355+
return()
356+
endif()
357+
endif()
358+
350359
set(_api_url "https://api.github.com/repos/${NAM_REPO}/releases/tags/${NAM_TAG}")
351-
file(DOWNLOAD "${_api_url}" "${_json_file}" STATUS _status)
352-
list(GET _status 0 _status_code)
353-
if (NOT _status_code EQUAL 0)
354-
message(FATAL_ERROR "NablaAssetManifests: failed to query release metadata for `${NAM_REPO}` tag `${NAM_TAG}`")
360+
set(_download_ok OFF)
361+
set(_last_status_code "")
362+
foreach(_attempt RANGE 1 3)
363+
file(DOWNLOAD "${_api_url}" "${_json_file}" STATUS _status TLS_VERIFY ON)
364+
list(GET _status 0 _status_code)
365+
set(_last_status_code "${_status_code}")
366+
if (_status_code EQUAL 0)
367+
set(_download_ok ON)
368+
break()
369+
endif()
370+
endforeach()
371+
if (NOT _download_ok)
372+
message(FATAL_ERROR "NablaAssetManifests: failed to query release metadata for `${NAM_REPO}` tag `${NAM_TAG}` after 3 attempts, last status `${_last_status_code}`")
355373
endif()
356374
file(READ "${_json_file}" _json)
357375
if (_json STREQUAL "")

0 commit comments

Comments
 (0)