Implemented multi-binary app packaging (#648)
This commit is contained in:
committed by
GitHub
parent
2496dea5c2
commit
8556103eb1
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <app/instance.h>
|
||||
#include <app/manifest.h>
|
||||
#include <app/package_manifest.h>
|
||||
#include <app/stream.h>
|
||||
|
||||
#include <tactility/error.h>
|
||||
@@ -44,6 +45,48 @@ error_t app_manager_find_manifest(const char* id, struct AppManifest* out_manife
|
||||
typedef void (*AppManifestVisitorFn)(const struct AppManifest* manifest, void* context);
|
||||
void app_manager_for_each_manifest(AppManifestVisitorFn visitor, void* context);
|
||||
|
||||
/**
|
||||
* Registers a package for enumeration via app_manager_for_each_package(). Separate from
|
||||
* registering its apps - the caller still calls app_manager_add() for each AppManifest.
|
||||
* @param[in] app_ids the ids of the AppManifest(s) this package registered
|
||||
* @retval ERROR_INVALID_ARGUMENT a package with the same id is already registered
|
||||
* @retval ERROR_NONE on success
|
||||
*/
|
||||
error_t app_manager_add_package(const struct PackageManifest* package, const char* const* app_ids, size_t app_id_count);
|
||||
|
||||
/**
|
||||
* Unregisters a previously-added package. Does not touch its apps' own registrations.
|
||||
* @retval ERROR_NOT_FOUND no package with this id is registered
|
||||
* @retval ERROR_NONE on success
|
||||
*/
|
||||
error_t app_manager_remove_package(const char* package_id);
|
||||
|
||||
/**
|
||||
* @param[out] out_package set to a copy of the package on success
|
||||
* @retval ERROR_NOT_FOUND no package with this id is registered
|
||||
* @retval ERROR_NONE on success
|
||||
*/
|
||||
error_t app_manager_find_package(const char* package_id, struct PackageManifest* out_package);
|
||||
|
||||
/** One registered package, handed to AppPackageVisitorFn - see app_manager_for_each_package(). */
|
||||
struct AppPackage {
|
||||
struct PackageManifest package;
|
||||
/** How many entries @a app_ids points to. */
|
||||
size_t app_id_count;
|
||||
/** Valid only for the duration of the app_manager_for_each_package() call that produced
|
||||
* this - copy out what's needed before returning from the visitor. */
|
||||
const char* const* app_ids;
|
||||
};
|
||||
|
||||
typedef void (*AppPackageVisitorFn)(const struct AppPackage* pkg, void* context);
|
||||
|
||||
/**
|
||||
* Calls @a visitor once for every registered package. Iteration order is unspecified.
|
||||
* @warning Same threading contract as app_manager_for_each_manifest(): runs with an internal
|
||||
* lock held - do not call any app_manager_*() function from inside @a visitor.
|
||||
*/
|
||||
void app_manager_for_each_package(AppPackageVisitorFn visitor, void* context);
|
||||
|
||||
/** One fd-to-stream binding for app_start_with_streams() (app/start.h). Every field is passed
|
||||
* through to app_stream_subscribe() as-is; see its own doc for the ownership contracts. */
|
||||
struct AppStreamBinding {
|
||||
@@ -90,8 +133,8 @@ error_t app_manager_get_topmost_app_id(char* buffer, size_t buffer_size);
|
||||
|
||||
/**
|
||||
* Registers @a path as a directory to scan for app manifests - each direct subdirectory of
|
||||
* @a path is expected to hold a manifest.properties (see app/metadata.h), matching the layout
|
||||
* app_install() creates ({install dir}/{app_id}/manifest.properties), though this is not
|
||||
* @a path is expected to hold a manifest.properties (see app/package_manifest.h), matching the
|
||||
* layout app_install() creates ({install dir}/{package id}/manifest.properties), though this is not
|
||||
* install/uninstall - it only ever adds/removes manifest registrations, never touches files on
|
||||
* disk or running instances. No-op if @a path is already registered. Does not scan immediately -
|
||||
* call app_manager_install_path_scan() to do that.
|
||||
|
||||
Reference in New Issue
Block a user