| 2013 | } ObjectScriptExportObservation; |
| 2014 | |
| 2015 | static ObjectScriptExportObservation observe_objectscript_export(const char *repo_path, |
| 2016 | const char *db_name) { |
| 2017 | ObjectScriptExportObservation observation = { |
| 2018 | .run_rc = -1, |
| 2019 | .store_opened = false, |
| 2020 | .run_nodes = -1, |
| 2021 | .execute_nodes = -1, |
| 2022 | .run_execute_calls = -1, |
| 2023 | .shared_payload_nodes = -1, |
| 2024 | .run_shared_payload_usages = -1, |
| 2025 | }; |
| 2026 | char db_path[512]; |
| 2027 | snprintf(db_path, sizeof(db_path), "%s/%s", repo_path, db_name); |
| 2028 | cbm_pipeline_t *pipeline = cbm_pipeline_new(repo_path, db_path, CBM_MODE_FULL); |
| 2029 | if (!pipeline) { |
| 2030 | return observation; |
| 2031 | } |
| 2032 | |
| 2033 | observation.run_rc = cbm_pipeline_run(pipeline); |
| 2034 | const char *project = cbm_pipeline_project_name(pipeline); |
| 2035 | cbm_store_t *store = cbm_store_open_path(db_path); |
| 2036 | observation.store_opened = store != NULL; |
| 2037 | if (store && project) { |
| 2038 | observation.run_nodes = named_node_count(store, project, "Run"); |
| 2039 | observation.execute_nodes = named_node_count(store, project, "Execute"); |
| 2040 | observation.run_execute_calls = named_edge_count(store, project, "CALLS", "Run", "Execute"); |
| 2041 | observation.shared_payload_nodes = named_node_count(store, project, "SharedPayload"); |
| 2042 | observation.run_shared_payload_usages = |
| 2043 | named_edge_count(store, project, "USAGE", "Run", "SharedPayload"); |
| 2044 | } |
| 2045 | if (store) { |
| 2046 | cbm_store_close(store); |
| 2047 | } |
| 2048 | cbm_pipeline_free(pipeline); |
| 2049 | return observation; |
| 2050 | } |
| 2051 | |
| 2052 | /* Studio Export XML is transformed into ObjectScript UDL during extraction. |
| 2053 | * The transformed definitions already survive, but the old sequential and |
no test coverage detected