My application (during a non-offline build) downloads one or more data files that are used as inputs to code generation.
The CMake logic looks something like this:
set(CACHE_DIR "${PROJECT_BINARY_DIR}/../caches CACHE PATH "Location of shared cache of downloaded files")
set(COMPONENT_CACHE "${CACHE_DIR}/ComponentName" CACHE PATH "Location for Component's downloaded data")
if (ENABLE_NETWORK_DOWNLOADS)
my_file_download_helper_func("some url" "${COMPONENT_CACHE}/some_file.dat")
else()
message(STATUS "Skipping download of some url, expecting it to be at ${COMPONENT_CACHE}/some_file.dat")
endif()
my_custom_command_helper("my_code_generator" "${COMPONENT_CACHE}" "Component.h" "Component.cpp")
When translating to a flatpak manifest for offline builds, I handle this with two steps:
- add a file source for the downloaded data file(s)
- add a step to generate an initial CMake cache file to be loaded via -C (cmake(1) — CMake 4.1.0-rc3 Documentation)
However, when building the project via Builder (i.e. opening the folder with my local flatpak manifest that has these two source entries + a “dir” file source as the final module), The two sources for downloading the file and for running the shell script are not run when building the project.
It looks like so:
"sources": [
{
"type": "file",
"url": "https://raw.githubusercontent.com/publicsuffix/list/32c68ce9d52e12df5b914b2b248cb893147301f7/public_suffix_list.dat",
"dest": "Caches/PublicSuffix/",
"sha256": "e79e372bcc6fcdb51f7a31e3c0c504530838432669af2ac544d2491de0a86030"
},
{
"type": "shell",
"commands": [
"# FIXME Is there an easier way to set an absolute path in config-opts?",
"echo set\\(LADYBIRD_CACHE_DIR \"$PWD/Caches\" CACHE STRING \\\"\\\"\\) > Cache.cmake"
]
},
{
"type": "dir",
"path": "../../../",
"skip": [
"Build",
"Tests/LibWeb/WPT"
]
}
],
After configuring and hitting the build button, neither of those two files can be found via a find ~/Projects/.gnome-builder.
Multiple sources for the dependency modules works just fine.
Is this a known issue? Is there another approach I should use? This works just fine with the flatpak-builder CLI tool.