Pharos 0.7.23
Modern Web Framework & Web App Hosting Service.
Loading...
Searching...
No Matches
native_artifact_emit.h
Go to the documentation of this file.
1/**
2 * @file
3 * @brief Declares helpers that build native artifact and report payload strings.
4 */
5
6#ifndef PHAROS_NATIVE_ARTIFACT_EMIT_H
7#define PHAROS_NATIVE_ARTIFACT_EMIT_H
8
9/** @name Artifact emission helpers
10 * @{
11 */
12/**
13 * @brief Counts how many times a substring occurs in a string.
14 * @param text Text to scan.
15 * @param needle Substring to count.
16 * @return Number of occurrences found.
17 */
18int count_substring_occurrences(const char *text, const char *needle);
19/**
20 * @brief Duplicates a string while escaping it for JSON string output.
21 * @param value Source string value.
22 * @return Newly allocated JSON-escaped string payload, or NULL on failure.
23 */
24char *json_string_dup_native(const char *value);
25/**
26 * @brief Builds the artifact directory path for a generated website target.
27 * @param build_dir Base build directory.
28 * @param target_id Website target identifier.
29 * @return Newly allocated artifact directory path, or NULL on failure.
30 */
31char *native_website_artifact_dir(const char *build_dir, const char *target_id);
32/**
33 * @brief Builds the report file path for a website build or status operation.
34 * @param build_dir Base build directory.
35 * @param verb Report verb such as build or status.
36 * @param target_id Website target identifier.
37 * @return Newly allocated report path, or NULL on failure.
38 */
39char *native_website_report_path(const char *build_dir, const char *verb, const char *target_id);
40/**
41 * @brief Builds a JSON status report for a native website artifact.
42 * @param report_id Stable report identifier.
43 * @param verb Report verb such as status.
44 * @param target_id Website target identifier.
45 * @param artifact_dir Website artifact directory.
46 * @return Newly allocated JSON report text, or NULL on failure.
47 */
48char *build_native_website_status_report_json(const char *report_id, const char *verb, const char *target_id, const char *artifact_dir);
49/**
50 * @brief Builds the default index.html payload for a native app artifact.
51 * @param app_id App identifier to embed.
52 * @return Newly allocated HTML text, or NULL on failure.
53 */
54char *build_native_app_index_html(const char *app_id);
55/**
56 * @brief Builds an artifact-localized copy of the app-owned manifest.
57 * @param manifest_text Source app manifest JSON text.
58 * @param artifact_generated_by Generator identifier to stamp into the artifact section.
59 * @param state_path Effective state file path.
60 * @param base_path Effective base path.
61 * @param log_path Effective log path.
62 * @param log_format Effective log format.
63 * @param error_report_path Effective error report path.
64 * @param debug Effective debug setting.
65 * @param compiled_entrypoint Compiled runtime entrypoint path.
66 * @param route_count Number of emitted routes.
67 * @param surface_count Number of emitted surfaces.
68 * @param workflow_count Number of emitted workflows.
69 * @return Newly allocated JSON text, or NULL on failure.
70 */
72 const char *manifest_text,
73 const char *artifact_generated_by,
74 const char *state_path,
75 const char *base_path,
76 const char *log_path,
77 const char *log_format,
78 const char *error_report_path,
79 const char *debug,
80 const char *compiled_entrypoint,
81 int route_count,
82 int surface_count,
83 int workflow_count
84);
85/**
86 * @brief Builds a JSON report describing a native app build result.
87 * @param artifact_dir Emitted artifact directory.
88 * @param app_id App identifier.
89 * @param state_path Effective state file path.
90 * @param base_path Effective base path.
91 * @param log_path Effective log path.
92 * @param log_format Effective log format.
93 * @param error_report_path Effective error report path.
94 * @param debug Effective debug setting.
95 * @param host_profile Host profile selected for the app.
96 * @param compiled_entrypoint Compiled runtime entrypoint path.
97 * @return Newly allocated JSON report text, or NULL on failure.
98 */
100 const char *artifact_dir,
101 const char *app_id,
102 const char *state_path,
103 const char *base_path,
104 const char *log_path,
105 const char *log_format,
106 const char *error_report_path,
107 const char *debug,
108 const char *host_profile,
109 const char *compiled_entrypoint
110);
111
112
113/** @} */
114#endif
char * build_native_app_index_html(const char *app_id)
Builds the default index.html payload for a native app artifact.
char * native_website_artifact_dir(const char *build_dir, const char *target_id)
Builds the artifact directory path for a generated website target.
char * json_string_dup_native(const char *value)
Duplicates a string while escaping it for JSON string output.
char * native_website_report_path(const char *build_dir, const char *verb, const char *target_id)
Builds the report file path for a website build or status operation.
int count_substring_occurrences(const char *text, const char *needle)
Counts how many times a substring occurs in a string.
char * build_native_app_build_report_json(const char *artifact_dir, const char *app_id, const char *state_path, const char *base_path, const char *log_path, const char *log_format, const char *error_report_path, const char *debug, const char *host_profile, const char *compiled_entrypoint)
Builds a JSON report describing a native app build result.
char * build_artifact_local_app_manifest_json(const char *manifest_text, const char *artifact_generated_by, const char *state_path, const char *base_path, const char *log_path, const char *log_format, const char *error_report_path, const char *debug, const char *compiled_entrypoint, int route_count, int surface_count, int workflow_count)
Builds an artifact-localized copy of the app-owned manifest.
char * build_native_website_status_report_json(const char *report_id, const char *verb, const char *target_id, const char *artifact_dir)
Builds a JSON status report for a native website artifact.