Skip to content

Commit

Permalink
Add support for runtime dependencies with use-runtime attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
SanderMertens committed Sep 30, 2019
1 parent 22b3d94 commit 9539dec
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/bake/project.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ struct bake_project {
ut_ll use; /* Project dependencies */
ut_ll use_private; /* Local dependencies (not visible to dependees) */
ut_ll use_build; /* Packages only required by the build */
ut_ll use_runtime; /* Packages required when running the project */
ut_ll link; /* All resolved dependencies package must link with */
ut_ll sources; /* Paths to source files */
ut_ll includes; /* Paths to include files */
Expand Down
8 changes: 8 additions & 0 deletions src/crawler.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ int16_t bake_crawler_walk_dependencies(
p->unresolved_dependencies = ut_ll_count(p->use);
p->unresolved_dependencies += ut_ll_count(p->use_build);
p->unresolved_dependencies += ut_ll_count(p->use_private);
p->unresolved_dependencies += ut_ll_count(p->use_runtime);

/* Add project to dependent lists of dependencies */
ut_iter it = ut_ll_iter(p->use);
Expand All @@ -241,6 +242,13 @@ int16_t bake_crawler_walk_dependencies(
ut_try( action(config, p, use), NULL);
}

/* Add project to dependent lists of runtime dependencies */
it = ut_ll_iter(p->use_runtime);
while (ut_iter_hasNext(&it)) {
char *use = ut_iter_next(&it);
ut_try( action(config, p, use), NULL);
}

return 0;
error:
return -1;
Expand Down
1 change: 1 addition & 0 deletions src/git.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ int16_t bake_update_dependencies(
{
ut_try(bake_update_dependency_list(config, base_url, project->use, to_env, always_clone, notify_state), NULL);
ut_try(bake_update_dependency_list(config, base_url, project->use_private, to_env, always_clone, notify_state), NULL);
ut_try(bake_update_dependency_list(config, base_url, project->use_runtime, to_env, always_clone, notify_state), NULL);
return 0;
error:
return -1;
Expand Down
7 changes: 7 additions & 0 deletions src/project.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,9 @@ int16_t bake_project_parse_value(
if (!strcmp(member, "use_private") || !strcmp(member, "use-private")) {
ut_try (bake_json_set_array(&p->use_private, member, v), NULL);
} else
if (!strcmp(member, "use_runtime") || !strcmp(member, "use-runtime")) {
ut_try (bake_json_set_array(&p->use_runtime, member, v), NULL);
} else
if (!strcmp(member, "use_bundle") || !strcmp(member, "use-bundle")) {
ut_try (bake_json_set_array(&p->use_bundle, member, v), NULL);
} else
Expand Down Expand Up @@ -831,6 +834,9 @@ int16_t bake_project_init(
if (!project->use_build) {
project->use_build = ut_ll_new();
}
if (!project->use_runtime) {
project->use_runtime = ut_ll_new();
}
if (!project->link) {
project->link = ut_ll_new();
}
Expand Down Expand Up @@ -950,6 +956,7 @@ void bake_project_free(
bake_attr_free_string_array(project->use);
bake_attr_free_string_array(project->use_private);
bake_attr_free_string_array(project->use_build);
bake_attr_free_string_array(project->use_runtime);
bake_attr_free_string_array(project->sources);
bake_attr_free_string_array(project->includes);
bake_attr_free_string_array(project->link);
Expand Down

0 comments on commit 9539dec

Please sign in to comment.