Pharos 0.7.23
Modern Web Framework & Web App Hosting Service.
Loading...
Searching...
No Matches
native_artifact_emit.h File Reference

Declares helpers that build native artifact and report payload strings. More...

Go to the source code of this file.

Functions

Artifact emission helpers
int count_substring_occurrences (const char *text, const char *needle)
 Counts how many times a substring occurs in a string.
char * json_string_dup_native (const char *value)
 Duplicates a string while escaping it for JSON string output.
char * native_website_artifact_dir (const char *build_dir, const char *target_id)
 Builds the artifact directory path for a generated website target.
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.
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.
char * build_native_app_index_html (const char *app_id)
 Builds the default index.html payload for a native app artifact.
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_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.

Detailed Description

Declares helpers that build native artifact and report payload strings.

Definition in file native_artifact_emit.h.

Function Documentation

◆ build_artifact_local_app_manifest_json()

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.

Parameters
manifest_textSource app manifest JSON text.
artifact_generated_byGenerator identifier to stamp into the artifact section.
state_pathEffective state file path.
base_pathEffective base path.
log_pathEffective log path.
log_formatEffective log format.
error_report_pathEffective error report path.
debugEffective debug setting.
compiled_entrypointCompiled runtime entrypoint path.
route_countNumber of emitted routes.
surface_countNumber of emitted surfaces.
workflow_countNumber of emitted workflows.
Returns
Newly allocated JSON text, or NULL on failure.

Definition at line 125 of file native_artifact_emit.c.

References native_json_doc_free(), native_json_doc_load_text(), yyjson_doc_mut_copy(), yyjson_mut_doc_free(), yyjson_mut_doc_get_root(), yyjson_mut_is_obj(), yyjson_mut_obj(), yyjson_mut_obj_add_int(), yyjson_mut_obj_add_strcpy(), yyjson_mut_obj_get(), yyjson_mut_obj_put(), yyjson_mut_obj_remove_key(), yyjson_mut_strcpy(), yyjson_mut_write(), YYJSON_WRITE_ESCAPE_UNICODE, and YYJSON_WRITE_PRETTY.

Referenced by build_app_from_root_native().

◆ build_native_app_build_report_json()

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.

Parameters
artifact_dirEmitted artifact directory.
app_idApp identifier.
state_pathEffective state file path.
base_pathEffective base path.
log_pathEffective log path.
log_formatEffective log format.
error_report_pathEffective error report path.
debugEffective debug setting.
host_profileHost profile selected for the app.
compiled_entrypointCompiled runtime entrypoint path.
Returns
Newly allocated JSON report text, or NULL on failure.

Definition at line 244 of file native_artifact_emit.c.

References json_string_dup_native().

Referenced by build_app_from_root_native(), and handle_native_runtime_app_command().

◆ build_native_app_index_html()

char * build_native_app_index_html ( const char * app_id)

Builds the default index.html payload for a native app artifact.

Parameters
app_idApp identifier to embed.
Returns
Newly allocated HTML text, or NULL on failure.

Definition at line 115 of file native_artifact_emit.c.

Referenced by build_app_from_root_native().

◆ build_native_website_status_report_json()

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.

Parameters
report_idStable report identifier.
verbReport verb such as status.
target_idWebsite target identifier.
artifact_dirWebsite artifact directory.
Returns
Newly allocated JSON report text, or NULL on failure.

Definition at line 100 of file native_artifact_emit.c.

Referenced by emit_website_status_native().

◆ count_substring_occurrences()

int count_substring_occurrences ( const char * text,
const char * needle )

Counts how many times a substring occurs in a string.

Parameters
textText to scan.
needleSubstring to count.
Returns
Number of occurrences found.

Definition at line 21 of file native_artifact_emit.c.

Referenced by build_app_from_root_native().

◆ json_string_dup_native()

◆ native_website_artifact_dir()

char * native_website_artifact_dir ( const char * build_dir,
const char * target_id )

Builds the artifact directory path for a generated website target.

Parameters
build_dirBase build directory.
target_idWebsite target identifier.
Returns
Newly allocated artifact directory path, or NULL on failure.

Definition at line 83 of file native_artifact_emit.c.

References path_join().

Referenced by emit_website_status_native().

◆ native_website_report_path()

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.

Parameters
build_dirBase build directory.
verbReport verb such as build or status.
target_idWebsite target identifier.
Returns
Newly allocated report path, or NULL on failure.

Definition at line 87 of file native_artifact_emit.c.

References path_join().

Referenced by build_app_from_root_native(), emit_website_status_native(), and handle_native_runtime_command().