This commit is contained in:
2025-08-12 14:52:04 -04:00
parent 3dcccf3de9
commit af1b5805b6

View File

@@ -8,6 +8,7 @@
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <limits.h>
#include <stdlib.h> #include <stdlib.h>
#include <time.h> #include <time.h>
#include <string.h> #include <string.h>
@@ -272,73 +273,80 @@ int create_project(manifest_t manifest)
manifest.path = ""; manifest.path = "";
} }
status = create_makefile(manifest); // status = create_makefile(manifest);
if (status != 0) { // if (status != 0) {
fprintf(stderr, // fprintf(stderr,
"create_project: failed to create Makefile: %s\n", // "create_project: failed to create Makefile: %s\n",
strerror(status)); // strerror(status));
return status; // return status;
// }
//
// status = create_configure(manifest);
// if (status != 0) {
// fprintf(stderr,
// "create_project: failed to create configure: %s\n",
// strerror(status));
// return status;
// }
//
// status = maybe_create_clang_format(manifest);
// if (status != 0) {
// fprintf(stderr,
// "create_project: warning: clang-format setup failed: %s\n",
// strerror(status));
// }
//
// char *licence_line = malloc(1024);
// if (!licence_line) {
// fprintf(stderr,
// "create_project: failed to allocate memory for licence line\n");
// return ENOMEM;
// }
//
// status = create_licence(manifest, &licence_line);
// if (status != 0) {
// fprintf(stderr,
// "create_project: failed to create licence: %s\n",
// strerror(status));
// free(licence_line);
// return status;
// }
//
// status = generate_source_code(manifest, licence_line);
// if (status != 0) {
// fprintf(stderr,
// "create_project: failed to generate source code: %s\n",
// strerror(status));
// free(licence_line);
// return status;
// }
//
// free(licence_line);
//
// status = create_libraries(manifest);
// if (status != 0) {
// printfn("failed to get libraries: %s", strerror(status));
// return status;
// }
//
// status = setup_git(manifest);
// if (status != 0) {
// printfn("warning: git initialization failed: %s",
// strerror(status));
// }
char *resolved;
resolved = malloc(PATH_MAX);
if (!resolved) {
printfn("Failed to alloc");
return 2;
} }
if (!realpath(manifest.path, resolved)) {
status = create_configure(manifest); printfn("Failed to get realpath");
if (status != 0) { free(resolved);
fprintf(stderr, return 2;
"create_project: failed to create configure: %s\n",
strerror(status));
return status;
} }
fprintf(stderr, "Created %s at\n %s\n", manifest.project, resolved);
status = maybe_create_clang_format(manifest);
if (status != 0) {
fprintf(stderr,
"create_project: warning: clang-format setup failed: %s\n",
strerror(status));
}
char *licence_line = malloc(1024);
if (!licence_line) {
fprintf(stderr,
"create_project: failed to allocate memory for licence line\n");
return ENOMEM;
}
status = create_licence(manifest, &licence_line);
if (status != 0) {
fprintf(stderr,
"create_project: failed to create licence: %s\n",
strerror(status));
free(licence_line);
return status;
}
status = generate_source_code(manifest, licence_line);
if (status != 0) {
fprintf(stderr,
"create_project: failed to generate source code: %s\n",
strerror(status));
free(licence_line);
return status;
}
free(licence_line);
status = create_libraries(manifest);
if (status != 0) {
fprintf(stderr, "create_project: failed to get libraries: %s\n",
strerror(status));
return status;
}
status = setup_git(manifest);
if (status != 0) {
fprintf(stderr,
"create_project: warning: git initialization failed: %s\n",
strerror(status));
}
// TODO(vx-clutch): Make path absolute.
fprintf(stderr, "Created %s at\n %s", manifest.project,
realpath(manifest.path, NULL));
return 0; return 0;
} }