Removing junk. Backward compatibility destroyed. Who cares, I am the only one who uses this nonsense
This commit is contained in:
parent
ce6a9e2e4c
commit
269e76f59c
@ -681,11 +681,9 @@ std::string prettyprint_outofboundness(size_t ind, size_t sz) {
|
|||||||
|
|
||||||
/* circular_dependency_result is filled in case of circular dependency */
|
/* circular_dependency_result is filled in case of circular dependency */
|
||||||
void topsort(std::vector<size_t>& result, std::vector<size_t>& circular_dependency_result,
|
void topsort(std::vector<size_t>& result, std::vector<size_t>& circular_dependency_result,
|
||||||
const std::vector<size_t>& entry_points, const std::vector<std::vector<size_t>>& depgraph)
|
const std::vector<std::vector<size_t>>& depgraph)
|
||||||
{
|
{
|
||||||
size_t N = depgraph.size();
|
size_t N = depgraph.size();
|
||||||
for (size_t e: entry_points)
|
|
||||||
ASSERT(e < N, "bad entry point to tosorted task list " + prettyprint_outofboundness(e, N));
|
|
||||||
for (size_t i = 0; i < N; i++)
|
for (size_t i = 0; i < N; i++)
|
||||||
for (size_t ch: depgraph[i])
|
for (size_t ch: depgraph[i])
|
||||||
ASSERT(ch < N, "bad dependency point to tosorted task list " + prettyprint_outofboundness(ch, N));
|
ASSERT(ch < N, "bad dependency point to tosorted task list " + prettyprint_outofboundness(ch, N));
|
||||||
@ -701,7 +699,7 @@ void topsort(std::vector<size_t>& result, std::vector<size_t>& circular_dependen
|
|||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
explicit topsortDfsFrame(size_t v): v(v){}
|
explicit topsortDfsFrame(size_t v): v(v){}
|
||||||
};
|
};
|
||||||
for (size_t st: entry_points) {
|
for (size_t st = 0; st < N; st++) {
|
||||||
if (status[st] == 2)
|
if (status[st] == 2)
|
||||||
continue;
|
continue;
|
||||||
std::vector<topsortDfsFrame> callStack = {topsortDfsFrame(st)};
|
std::vector<topsortDfsFrame> callStack = {topsortDfsFrame(st)};
|
||||||
@ -842,35 +840,32 @@ std::string prettyprint_cyclic_dependency(const std::vector<std::string>& lines)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct BuildUnitsArray {
|
typedef std::vector<uptr<BuildUnit>> BuildUnitsArray;
|
||||||
std::vector<uptr<BuildUnit>> tasks;
|
|
||||||
std::vector<size_t> entry_points;
|
|
||||||
};
|
|
||||||
|
|
||||||
void complete_tasks_of_build_units (const BuildUnitsArray& arr)
|
void complete_tasks_of_build_units (const BuildUnitsArray& arr)
|
||||||
{
|
{
|
||||||
size_t N = arr.tasks.size();
|
size_t N = arr.size();
|
||||||
std::vector<size_t> execution_order;
|
std::vector<size_t> execution_order;
|
||||||
std::vector<size_t> cyc_dep_problem;
|
std::vector<size_t> cyc_dep_problem;
|
||||||
std::vector<std::vector<size_t>> depgraph(N);
|
std::vector<std::vector<size_t>> depgraph(N);
|
||||||
for (size_t i = 0; i < N; i++)
|
for (size_t i = 0; i < N; i++)
|
||||||
depgraph[i] = arr.tasks[i]->bu_dependencies;
|
depgraph[i] = arr[i]->bu_dependencies;
|
||||||
topsort(execution_order, cyc_dep_problem, arr.entry_points, depgraph);
|
topsort(execution_order, cyc_dep_problem, depgraph);
|
||||||
if (!cyc_dep_problem.empty()) {
|
if (!cyc_dep_problem.empty()) {
|
||||||
std::vector<std::string> bad_units(cyc_dep_problem.size());
|
std::vector<std::string> bad_units(cyc_dep_problem.size());
|
||||||
for (size_t i = 0; i < cyc_dep_problem.size(); i++) {
|
for (size_t i = 0; i < cyc_dep_problem.size(); i++) {
|
||||||
bad_units[i] = prettyprint_build_unit(*arr.tasks[cyc_dep_problem[i]]) + " ";
|
bad_units[i] = prettyprint_build_unit(*arr[cyc_dep_problem[i]]) + " ";
|
||||||
}
|
}
|
||||||
THROW("Cyclic dependency of build units was found:\n" + prettyprint_cyclic_dependency(bad_units));
|
THROW("Cyclic dependency of build units was found:\n" + prettyprint_cyclic_dependency(bad_units));
|
||||||
}
|
}
|
||||||
ASSERT(execution_order.size() == N, std::to_string(N - execution_order.size()) + " build units are unreachable in dependency tree");
|
ASSERT(execution_order.size() == N, std::to_string(N - execution_order.size()) + " build units are unreachable in dependency tree");
|
||||||
|
|
||||||
for (size_t I: execution_order) {
|
for (size_t I: execution_order) {
|
||||||
printf("Executing %s\n", prettyprint_build_unit(*arr.tasks[I]).c_str());
|
printf("Executing %s\n", prettyprint_build_unit(*arr[I]).c_str());
|
||||||
for (auto& rqd: arr.tasks[I]->all_fs_dependencies)
|
for (auto& rqd: arr[I]->all_fs_dependencies)
|
||||||
checkFsEntity(rqd);
|
checkFsEntity(rqd);
|
||||||
arr.tasks[I]->execute();
|
arr[I]->execute();
|
||||||
for (auto& rqr: arr.tasks[I]->all_fs_results)
|
for (auto& rqr: arr[I]->all_fs_results)
|
||||||
checkFsEntity(rqr);
|
checkFsEntity(rqr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -940,8 +935,6 @@ struct CTarget {
|
|||||||
std::string description;
|
std::string description;
|
||||||
std::string version = "0.1";
|
std::string version = "0.1";
|
||||||
|
|
||||||
bool entry_point = true;
|
|
||||||
|
|
||||||
CTarget(const std::string& name, const std::string& type): name(name), type(type){}
|
CTarget(const std::string& name, const std::string& type): name(name), type(type){}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1015,8 +1008,6 @@ void load_ctargets_on_building_and_installing(
|
|||||||
const std::string& install_bin_dir_path,
|
const std::string& install_bin_dir_path,
|
||||||
const std::string& install_pkgconfig_dir_path)
|
const std::string& install_pkgconfig_dir_path)
|
||||||
{
|
{
|
||||||
ret_at_build.tasks.clear();
|
|
||||||
ret_at_build.entry_points.clear();
|
|
||||||
std::map<std::string, ExternalLibraryData> ext_libs_map;
|
std::map<std::string, ExternalLibraryData> ext_libs_map;
|
||||||
for (auto& e: ext_lib_targs) {
|
for (auto& e: ext_lib_targs) {
|
||||||
check_target_name(e.name);
|
check_target_name(e.name);
|
||||||
@ -1038,12 +1029,12 @@ void load_ctargets_on_building_and_installing(
|
|||||||
};
|
};
|
||||||
std::map<std::string, S> before;
|
std::map<std::string, S> before;
|
||||||
auto add_bbu = [&](BuildUnit* obj) -> size_t {
|
auto add_bbu = [&](BuildUnit* obj) -> size_t {
|
||||||
ret_at_build.tasks.emplace_back(obj);
|
ret_at_build.emplace_back(obj);
|
||||||
return ret_at_build.tasks.size() - 1;
|
return ret_at_build.size() - 1;
|
||||||
};
|
};
|
||||||
auto add_ibu = [&](BuildUnit* obj) -> size_t {
|
auto add_ibu = [&](BuildUnit* obj) -> size_t {
|
||||||
ret_at_install.tasks.emplace_back(obj);
|
ret_at_install.emplace_back(obj);
|
||||||
return ret_at_install.tasks.size() - 1;
|
return ret_at_install.size() - 1;
|
||||||
};
|
};
|
||||||
for (auto& tg: proj_targs) {
|
for (auto& tg: proj_targs) {
|
||||||
check_target_name(tg.name);
|
check_target_name(tg.name);
|
||||||
@ -1203,7 +1194,7 @@ void load_ctargets_on_building_and_installing(
|
|||||||
"-l:" + tg.name + ".so"
|
"-l:" + tg.name + ".so"
|
||||||
});
|
});
|
||||||
/* Determining how to create pkg-config file at installation stage */
|
/* Determining how to create pkg-config file at installation stage */
|
||||||
if (!tg.pc_output_path.empty() && tg.entry_point) {
|
if (!tg.pc_output_path.empty()) {
|
||||||
check_pkg_conf_rel_install_path(tg.pc_output_path);
|
check_pkg_conf_rel_install_path(tg.pc_output_path);
|
||||||
// todo: ESCAPE THESE VALUES
|
// todo: ESCAPE THESE VALUES
|
||||||
size_t pkg_conf_install_ibu = add_ibu(new FileWriteBuildUnit(
|
size_t pkg_conf_install_ibu = add_ibu(new FileWriteBuildUnit(
|
||||||
@ -1213,7 +1204,7 @@ void load_ctargets_on_building_and_installing(
|
|||||||
"Version: " + tg.version + "\n" +
|
"Version: " + tg.version + "\n" +
|
||||||
"Cflags: " + join_string_arr(s.emitted_compilation_flags_PASSED_FORWARD, " ") + "\n" +
|
"Cflags: " + join_string_arr(s.emitted_compilation_flags_PASSED_FORWARD, " ") + "\n" +
|
||||||
"Libs: " + join_string_arr(s.emitted_linkage_flags_PASSED_FORWARD, " ") + "\n"));
|
"Libs: " + join_string_arr(s.emitted_linkage_flags_PASSED_FORWARD, " ") + "\n"));
|
||||||
ret_at_install.tasks[blank_ibu_for_tg_FINAL]->bu_dependencies.push_back(pkg_conf_install_ibu);
|
ret_at_install[blank_ibu_for_tg_FINAL]->bu_dependencies.push_back(pkg_conf_install_ibu);
|
||||||
}
|
}
|
||||||
/* s.end_BU... fields allow us to establish dependency relations between BUs of ctargets with such relation */
|
/* s.end_BU... fields allow us to establish dependency relations between BUs of ctargets with such relation */
|
||||||
s.end_BBU_id = targ_FINAL_bbu_id;
|
s.end_BBU_id = targ_FINAL_bbu_id;
|
||||||
@ -1221,10 +1212,6 @@ void load_ctargets_on_building_and_installing(
|
|||||||
} else {
|
} else {
|
||||||
THROW("Unknown C-target type " + tg.type);
|
THROW("Unknown C-target type " + tg.type);
|
||||||
}
|
}
|
||||||
if (tg.entry_point) {
|
|
||||||
ret_at_build.entry_points.push_back(targ_FINAL_bbu_id);
|
|
||||||
ret_at_install.entry_points.push_back(blank_ibu_for_tg_FINAL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1308,20 +1295,15 @@ std::string text_formatting_break_spaces(const std::string& text) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void draw_bu_arr_in_dot(const BuildUnitsArray& taskSet, std::string& output) {
|
void draw_bu_arr_in_dot(const BuildUnitsArray& taskSet, std::string& output) {
|
||||||
size_t N = taskSet.tasks.size();
|
size_t N = taskSet.size();
|
||||||
std::vector<bool> turningRed(N, false);
|
|
||||||
for (size_t eid: taskSet.entry_points) {
|
|
||||||
ASSERT_pl(eid < N && !turningRed[eid]);
|
|
||||||
turningRed[eid] = true;
|
|
||||||
}
|
|
||||||
output += "digraph BUs { \n"
|
output += "digraph BUs { \n"
|
||||||
"graph [rankdir=LR]"
|
"graph [rankdir=LR]"
|
||||||
"node [fontcolor = black color = black fillcolor = white margin = \"0.2,0.2\""
|
"node [fontcolor = black color = black fillcolor = white margin = \"0.2,0.2\""
|
||||||
" shape=rect ]\n";
|
" shape=rect ]\n";
|
||||||
for (size_t i = 0; i < N; i++) {
|
for (size_t i = 0; i < N; i++) {
|
||||||
const BuildUnit& bu = *(taskSet.tasks[i]);
|
const BuildUnit& bu = *(taskSet[i]);
|
||||||
output += std::string("N_") + std::to_string(i) + " [ color = " + (turningRed[i] ? "red" : "black")
|
output += std::string("N_") + std::to_string(i) + " [ label = "
|
||||||
+ " label = " + escape_with_doublequoting("[" + std::to_string(i) + "] " + prettyprint_build_unit(bu))
|
+ escape_with_doublequoting("[" + std::to_string(i) + "] " + prettyprint_build_unit(bu))
|
||||||
+ "]\n";
|
+ "]\n";
|
||||||
for (size_t j: bu.bu_dependencies) {
|
for (size_t j: bu.bu_dependencies) {
|
||||||
output += "N_" + std::to_string(i) + " -> N_" + std::to_string(j) + "\n";
|
output += "N_" + std::to_string(i) + " -> N_" + std::to_string(j) + "\n";
|
||||||
|
Loading…
Reference in New Issue
Block a user