rimmed pushed a commit to branch master. http://git.enlightenment.org/tools/eflete.git/commit/?id=29401b6f1192cc57df04835f0713ea305a51fdcd
commit 29401b6f1192cc57df04835f0713ea305a51fdcd Author: Vyacheslav Reutskiy <v.reuts...@samsung.com> Date: Mon Oct 10 18:38:48 2016 +0300 exporter: add option -u/--update This option make posible write to the end of generated.edc. Now exporter can export any groups into one folder and update denerated.edc file, without rewriting all data. Change-Id: I0567f038e0a67d71d0ee64ac264589f08c9cbae6 --- src/bin/exporter/eflete_exporter.c | 32 +++++++++++++++++++++++++----- src/bin/project_manager/project_manager2.c | 2 +- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/bin/exporter/eflete_exporter.c b/src/bin/exporter/eflete_exporter.c index 90da2ad..c17e41d 100644 --- a/src/bin/exporter/eflete_exporter.c +++ b/src/bin/exporter/eflete_exporter.c @@ -26,6 +26,7 @@ static char *edj = NULL; static char *path = NULL; static Eina_List *groups = NULL; static Eina_Bool source = false; +static Eina_Bool update = false; static Eina_Bool info_only = false; static Eina_Bool ignore = false; static Eina_Bool deps = false; @@ -43,6 +44,7 @@ static Ecore_Job *source_job = NULL; static PM_Project_Result exit_status = PM_PROJECT_SUCCESS; +#define GEN_FILE_NAME "generated.edc" #define EDC_HEADER "Generated by "PACKAGE_NAME" "VERSION static const Ecore_Getopt options = { @@ -62,6 +64,7 @@ static const Ecore_Getopt options = { ECORE_GETOPT_STORE_TRUE('s', "source", "Export surce code for given group(s)"), ECORE_GETOPT_STORE_TRUE('i', "ignore", "Ignore missing groups"), ECORE_GETOPT_STORE_TRUE('d', "dependencies", "Export group with dependencies"), + ECORE_GETOPT_STORE_TRUE('u', "update", "Update existing genereted.edc file and write groups"), ECORE_GETOPT_VERSION ('v', "version"), ECORE_GETOPT_COPYRIGHT('c', "copyright"), ECORE_GETOPT_LICENSE ('l', "license"), @@ -377,10 +380,11 @@ _source_code_export(void *data __UNUSED__) FILE *f; Eina_List *l; const char *g; + Eina_List *files; fprintf(stdout, "Generate source code"); - snprintf(buf, strlen(spath) + strlen("/generated.edc") + 1, - "%s/generated.edc", spath); + snprintf(buf, strlen(spath) + strlen("/"GEN_FILE_NAME) + 1, + "%s/"GEN_FILE_NAME, spath); f = fopen(buf, "w+"); if (!f) { @@ -388,6 +392,7 @@ _source_code_export(void *data __UNUSED__) _terminate(PM_PROJECT_EXPORT_CREATE_FILE_FAILED); return; } + rewind(f); fputs(_edc_header_get(), f); if (!groups) @@ -401,11 +406,27 @@ _source_code_export(void *data __UNUSED__) { EINA_LIST_FOREACH(groups, l, g) { - fputs("#include \"", f); char *name = _group_source_code_export(g); - fputs(name, f); + if (!update) + { + fputs("#include \"", f); + fputs(name, f); + fputs("\"\n", f); + } free(name); - fputs("\"\n", f); + } + if (update) + { + files = ecore_file_ls(path); + EINA_LIST_FOREACH(files, l, g) + { + if (eina_str_has_suffix(g, ".edc") && strcmp(g, GEN_FILE_NAME)) + { + fputs("#include \"", f); + fputs(g, f); + fputs("\"\n", f); + } + } } } fclose(f); @@ -432,6 +453,7 @@ int main(int argc, char **argv) ECORE_GETOPT_VALUE_BOOL(source), ECORE_GETOPT_VALUE_BOOL(ignore), ECORE_GETOPT_VALUE_BOOL(deps), + ECORE_GETOPT_VALUE_BOOL(update), ECORE_GETOPT_VALUE_BOOL(info_only), ECORE_GETOPT_VALUE_BOOL(info_only), ECORE_GETOPT_VALUE_BOOL(info_only), diff --git a/src/bin/project_manager/project_manager2.c b/src/bin/project_manager/project_manager2.c index 8cee860..e2bf98f 100644 --- a/src/bin/project_manager/project_manager2.c +++ b/src/bin/project_manager/project_manager2.c @@ -1229,7 +1229,7 @@ pm_group_source_code_export(Project *project, ppd->data = (void *)data; cmd = eina_strbuf_new(); - eina_strbuf_append_printf(cmd, "%s --edj %s --path %s -s", ap.path.exporter, project->saved_edj, path); + eina_strbuf_append_printf(cmd, "%s --edj %s --path %s -s -u", ap.path.exporter, project->saved_edj, path); EINA_LIST_FOREACH(groups, l, group) eina_strbuf_append_printf(cmd, " -g %s", group->common.name); --