schema compile FEATURE introduction of dependency sets

Dependency sets are sets of modules that (may)
depend on each other. In practice that means that
whenever a module from the dep set is (re)compiled,
all the other implemented modules in the dep set
must also be (re)compiled.

Also, every compilation is now split into compiling
each dep set separately since all the modules cannot
depend on each other in any way. This resulted in
splitting unres into global one (that is actually
used only for reverting any changes) and specific
unres for dep sets, which is always resolved at the
end of a single dep set compilation.

Finally, functions for checking that a module needs
to be compiled or recompiled were added. These allow
to split dep sets and not drag a redundant dependent
module (such as ietf-inet-types or ietf-yang-types
that are imported in almost all modules, which would
always result in creating a single dep set).
diff --git a/tests/utests/basic/test_context.c b/tests/utests/basic/test_context.c
index ff755ad..4d392ed 100644
--- a/tests/utests/basic/test_context.c
+++ b/tests/utests/basic/test_context.c
@@ -216,7 +216,7 @@
 
     assert_int_equal(LY_SUCCESS, ly_in_new_memory("module x {namespace urn:x;prefix x;}", &in));
     assert_int_equal(LY_EINVAL, lys_parse_in(UTEST_LYCTX, in, 4, NULL, NULL, &unres.creating, &mod1));
-    lys_compile_unres_glob_erase(UTEST_LYCTX, &unres, 0);
+    lys_unres_glob_erase(&unres);
     ly_in_free(in, 0);
     CHECK_LOG_CTX("Invalid schema input format.", NULL);
 
@@ -235,7 +235,7 @@
     ly_ctx_set_module_imp_clb(UTEST_LYCTX, test_imp_clb, "submodule y {belongs-to a {prefix a;} revision 2018-10-30;}");
     assert_int_equal(LY_SUCCESS, ly_in_new_memory("module y {namespace urn:y;prefix y;include y;}", &in));
     assert_int_equal(LY_EVALID, lys_parse_in(UTEST_LYCTX, in, LYS_IN_YANG, NULL, NULL, &unres.creating, &mod1));
-    lys_compile_unres_glob_erase(UTEST_LYCTX, &unres, 0);
+    lys_unres_glob_erase(&unres);
     ly_in_free(in, 0);
     CHECK_LOG_CTX("Name collision between module and submodule of name \"y\".", "Line number 1.");
 
@@ -244,15 +244,15 @@
     ly_in_free(in, 0);
     assert_int_equal(LY_SUCCESS, ly_in_new_memory("module y {namespace urn:y;prefix y;}", &in));
     assert_int_equal(LY_EVALID, lys_parse_in(UTEST_LYCTX, in, LYS_IN_YANG, NULL, NULL, &unres.creating, &mod1));
-    lys_compile_unres_glob_erase(UTEST_LYCTX, &unres, 0);
+    lys_unres_glob_erase(&unres);
     ly_in_free(in, 0);
     CHECK_LOG_CTX("Name collision between module and submodule of name \"y\".", "Line number 1.");
 
     ly_ctx_set_module_imp_clb(UTEST_LYCTX, test_imp_clb, "submodule y {belongs-to b {prefix b;}}");
     assert_int_equal(LY_SUCCESS, ly_in_new_memory("module b {namespace urn:b;prefix b;include y;}", &in));
     assert_int_equal(LY_EVALID, lys_parse_in(UTEST_LYCTX, in, LYS_IN_YANG, NULL, NULL, &unres.creating, &mod1));
-    lys_compile_unres_glob_revert(UTEST_LYCTX, &unres);
-    lys_compile_unres_glob_erase(UTEST_LYCTX, &unres, 0);
+    lys_unres_glob_revert(UTEST_LYCTX, &unres);
+    lys_unres_glob_erase(&unres);
     ly_in_free(in, 0);
     CHECK_LOG_CTX("Including \"y\" submodule into \"b\" failed.", NULL,
             "Name collision between submodules of name \"y\".", "Line number 1.");
@@ -262,7 +262,7 @@
     ly_ctx_set_module_imp_clb(UTEST_LYCTX, test_imp_clb, "submodule y {belongs-to a {prefix a;} revision 2018-10-31;}");
     assert_int_equal(LY_SUCCESS, ly_in_new_memory("module a {namespace urn:a;prefix a;include y; revision 2018-10-31;}", &in));
     assert_int_equal(LY_SUCCESS, lys_parse_in(UTEST_LYCTX, in, LYS_IN_YANG, NULL, NULL, &unres.creating, &mod2));
-    lys_compile_unres_glob_erase(UTEST_LYCTX, &unres, 0);
+    lys_unres_glob_erase(&unres);
     ly_in_free(in, 0);
     assert_string_equal("2018-10-31", mod2->parsed->includes[0].submodule->revs[0].date);
 
@@ -387,15 +387,15 @@
     assert_int_equal(LY_SUCCESS, lys_parse_in(UTEST_LYCTX, in2, LYS_IN_YANG, NULL, NULL, &unres.creating, &mod2));
     assert_int_equal(LY_EDENIED, lys_implement(mod2, NULL, &unres));
     CHECK_LOG_CTX("Module \"a@2018-10-24\" is present in the context in other implemented revision (2018-10-23).", NULL);
-    lys_compile_unres_glob_erase(UTEST_LYCTX, &unres, 0);
+    lys_unres_glob_erase(&unres);
     ly_in_reset(in1);
     /* it is already there, fine */
     assert_int_equal(LY_SUCCESS, lys_parse_in(UTEST_LYCTX, in1, LYS_IN_YANG, NULL, NULL, &unres.creating, NULL));
     /* insert the second module only as imported, not implemented */
-    lys_compile_unres_glob_erase(UTEST_LYCTX, &unres, 0);
+    lys_unres_glob_erase(&unres);
     ly_in_reset(in2);
     assert_int_equal(LY_SUCCESS, lys_parse_in(UTEST_LYCTX, in2, LYS_IN_YANG, NULL, NULL, &unres.creating, &mod2));
-    lys_compile_unres_glob_erase(UTEST_LYCTX, &unres, 0);
+    lys_unres_glob_erase(&unres);
     assert_non_null(mod2);
     assert_ptr_not_equal(mod, mod2);
     mod = ly_ctx_get_module_latest(UTEST_LYCTX, "a");
@@ -404,7 +404,7 @@
     assert_ptr_equal(mod, mod2);
     /* work with module with no revision */
     assert_int_equal(LY_SUCCESS, lys_parse_in(UTEST_LYCTX, in0, LYS_IN_YANG, NULL, NULL, &unres.creating, &mod));
-    lys_compile_unres_glob_erase(UTEST_LYCTX, &unres, 0);
+    lys_unres_glob_erase(&unres);
     assert_ptr_equal(mod, ly_ctx_get_module(UTEST_LYCTX, "a", NULL));
     assert_ptr_not_equal(mod, ly_ctx_get_module_latest(UTEST_LYCTX, "a"));
 
@@ -413,7 +413,7 @@
     assert_int_equal(LY_SUCCESS, ly_in_new_memory(str1, &in1));
     assert_int_equal(LY_EINVAL, lys_parse_in(UTEST_LYCTX, in1, LYS_IN_YANG, NULL, NULL, &unres.creating, &mod));
     CHECK_LOG_CTX("Input data contains submodule which cannot be parsed directly without its main module.", NULL);
-    lys_compile_unres_glob_erase(UTEST_LYCTX, &unres, 0);
+    lys_unres_glob_erase(&unres);
 
     while ((mod = (struct lys_module *)ly_ctx_get_module_iter(UTEST_LYCTX, &index))) {
         assert_string_equal(names[index - 1], mod->name);
diff --git a/tests/utests/schema/test_tree_schema_compile.c b/tests/utests/schema/test_tree_schema_compile.c
index efbff1b..b635fb4 100644
--- a/tests/utests/schema/test_tree_schema_compile.c
+++ b/tests/utests/schema/test_tree_schema_compile.c
@@ -78,7 +78,7 @@
             "feature f1;feature f2 {if-feature f1;}}";
     assert_int_equal(LY_SUCCESS, ly_in_new_memory(str, &in));
     assert_int_equal(LY_SUCCESS, lys_parse_in(UTEST_LYCTX, in, LYS_IN_YANG, NULL, NULL, &unres.creating, &mod));
-    lys_compile_unres_glob_erase(UTEST_LYCTX, &unres, 0);
+    lys_unres_glob_erase(&unres);
     ly_in_free(in, 0);
     assert_int_equal(0, mod->implemented);
     assert_int_equal(LY_SUCCESS, lys_set_implemented(mod, NULL));
@@ -102,7 +102,7 @@
     str = "submodule test {belongs-to xxx {prefix x;}}";
     assert_int_equal(LY_SUCCESS, ly_in_new_memory(str, &in));
     assert_int_equal(LY_EINVAL, lys_parse_in(UTEST_LYCTX, in, LYS_IN_YANG, NULL, NULL, &unres.creating, NULL));
-    lys_compile_unres_glob_erase(UTEST_LYCTX, &unres, 0);
+    lys_unres_glob_erase(&unres);
     ly_in_free(in, 0);
     CHECK_LOG_CTX("Input data contains submodule which cannot be parsed directly without its main module.", NULL);