static void add_dep(struct manifest ***deps, const char *modname) { unsigned int i; struct manifest *m; char *errstr; if (have_mod(*deps, modname)) return; m = get_manifest(*deps, tal_fmt(*deps, "%s/ccan/%s", ccan_dir, modname)); errstr = build_submodule(m, cflags, COMPILE_NORMAL); if (errstr) errx(1, "%s", errstr); add_mod(deps, m); /* Get that modules depends as well... */ assert(!safe_mode); if (m->info_file) { char **infodeps; infodeps = get_deps(m, m->dir, "depends", false, get_or_compile_info); for (i = 0; infodeps[i]; i++) { if (strstarts(infodeps[i], "ccan/")) add_dep(deps, infodeps[i] + strlen("ccan/")); } } }
void schema_flat_map_impl< K, V >::get_str_schema( std::string& s ) { if( str_schema != "" ) { s = str_schema; return; } std::vector< std::shared_ptr< abstract_schema > > deps; get_deps( deps ); std::string k_name, v_name; deps[0]->get_name(k_name); deps[1]->get_name(v_name); std::string my_name; get_name( my_name ); fc::mutable_variant_object mvo; mvo("name", my_name) ("type", "map") ("ktype", k_name) ("vtype", v_name) ; str_schema = fc::json::to_string( mvo ); s = str_schema; return; }
void schema_optional_impl< E >::get_str_schema( std::string& s ) { if( str_schema != "" ) { s = str_schema; return; } std::vector< std::shared_ptr< abstract_schema > > deps; get_deps( deps ); std::string e_type; deps[0]->get_name(e_type); std::string my_name; get_name( my_name ); fc::mutable_variant_object mvo; mvo("name", my_name) ("type", "optional") ("etype", e_type) ; str_schema = fc::json::to_string( mvo ); s = str_schema; return; }
void schema_static_variant_impl<Types...>::get_str_schema(std::string &s) { if (str_schema != "") { s = str_schema; return; } std::vector<std::shared_ptr<abstract_schema>> deps; get_deps(deps); std::vector<std::string> e_types; for (std::shared_ptr<abstract_schema> &schema : deps) { e_types.emplace_back(); schema->get_name(e_types.back()); } std::string my_name; get_name(my_name); fc::mutable_variant_object mvo; mvo("name", my_name) ("type", "static_variant") ("etypes", e_types); str_schema = fc::json::to_string(mvo); s = str_schema; return; }
static void check_depends_exist(struct manifest *m, bool keep, unsigned int *timeleft, struct score *score) { unsigned int i; char **deps; char *updir = talloc_strdup(m, m->dir); *strrchr(updir, '/') = '\0'; if (safe_mode) deps = get_safe_ccan_deps(m, m->dir, true, &m->info_file->compiled); else deps = get_deps(m, m->dir, true, &m->info_file->compiled); for (i = 0; deps[i]; i++) { if (!strstarts(deps[i], "ccan/")) continue; if (!add_dep(m, deps[i], score)) return; } /* We may need libtap for testing, unless we're "tap" */ if (!streq(m->basename, "tap") && (!list_empty(&m->run_tests) || !list_empty(&m->api_tests))) { if (!add_dep(m, "ccan/tap", score)) return; } score->pass = true; score->score = score->total; }
static gfc_dependency gfc_check_section_vs_section (gfc_ref * lref, gfc_ref * rref, int n) { gfc_expr *l_start; gfc_expr *l_end; gfc_expr *l_stride; gfc_expr *r_start; gfc_expr *r_stride; gfc_array_ref l_ar; gfc_array_ref r_ar; mpz_t no_of_elements; mpz_t X1, X2; gfc_dependency dep; l_ar = lref->u.ar; r_ar = rref->u.ar; l_start = l_ar.start[n]; l_end = l_ar.end[n]; l_stride = l_ar.stride[n]; r_start = r_ar.start[n]; r_stride = r_ar.stride[n]; /* if l_start is NULL take it from array specifier */ if (NULL == l_start && IS_ARRAY_EXPLICIT(l_ar.as)) l_start = l_ar.as->lower[n]; /* if l_end is NULL take it from array specifier */ if (NULL == l_end && IS_ARRAY_EXPLICIT(l_ar.as)) l_end = l_ar.as->upper[n]; /* if r_start is NULL take it from array specifier */ if (NULL == r_start && IS_ARRAY_EXPLICIT(r_ar.as)) r_start = r_ar.as->lower[n]; mpz_init (X1); mpz_init (X2); mpz_init (no_of_elements); if (transform_sections (X1, X2, no_of_elements, l_start, l_end, l_stride, r_start, r_stride)) dep = GFC_DEP_OVERLAP; else dep = get_deps (X1, X2, no_of_elements); mpz_clear (no_of_elements); mpz_clear (X1); mpz_clear (X2); return dep; }
int main(int argc, char *argv[]) { char **deps; unsigned int i; bool compile = false; bool recurse = true; bool ccan = true; const char *style = "depends"; if (argv[1] && streq(argv[1], "--direct")) { argv++; argc--; recurse = false; } if (argv[1] && streq(argv[1], "--compile")) { argv++; argc--; compile = true; } if (argv[1] && streq(argv[1], "--non-ccan")) { argv++; argc--; ccan = false; } if (argv[1] && streq(argv[1], "--tests")) { argv++; argc--; style = "testdepends"; } if (argc != 2) errx(1, "Usage: ccan_depends [--direct] [--compile] [--non-ccan] [--tests] <dir>\n" "Spits out all the ccan dependencies (recursively unless --direct)"); /* We find depends without compiling by looking for ccan/ */ if (!ccan && !compile) errx(1, "--non-ccan needs --compile"); if (compile) deps = get_deps(NULL, argv[1], style, recurse, compile_info); else deps = get_safe_ccan_deps(NULL, argv[1], style, recurse); for (i = 0; deps[i]; i++) if (strstarts(deps[i], "ccan/") == ccan) printf("%s\n", deps[i]); return 0; }
/** * Resolve native and culture assembly directories based on "asset_type" parameter. */ bool deps_resolver_t::resolve_probe_dirs( deps_entry_t::asset_types asset_type, pal::string_t* output, std::unordered_set<pal::string_t>* breadcrumb) { bool is_resources = asset_type == deps_entry_t::asset_types::resources; assert(is_resources || asset_type == deps_entry_t::asset_types::native); // For resources assemblies, we need to provide the base directory of the resources path. // For example: .../Foo/en-US/Bar.dll, then, the resolved path is .../Foo std::function<pal::string_t(const pal::string_t&)> resources = [] (const pal::string_t& str) { return get_directory(get_directory(str)); }; // For native assemblies, obtain the directory path from the file path std::function<pal::string_t(const pal::string_t&)> native = [] (const pal::string_t& str) { return get_directory(str); }; // Action for post processing the resolved path std::function<pal::string_t(const pal::string_t&)>& action = is_resources ? resources : native; // Set for de-duplication std::unordered_set<pal::string_t> items; pal::string_t core_servicing = m_core_servicing; pal::realpath(&core_servicing, true); // Filter out non-serviced assets so the paths can be added after servicing paths. pal::string_t non_serviced; std::vector<deps_entry_t> empty(0); pal::string_t candidate; auto add_package_cache_entry = [&](const deps_entry_t& entry, const pal::string_t& deps_dir, int fx_level) -> bool { if (breadcrumb != nullptr && entry.is_serviceable) { breadcrumb->insert(entry.library_name + _X(",") + entry.library_version); breadcrumb->insert(entry.library_name); } if (items.count(entry.asset.name)) { return true; } // Ignore placeholders if (ends_with(entry.asset.relative_path, _X("/_._"), false)) { return true; } trace::verbose(_X("Processing native/culture for deps entry [%s, %s, %s]"), entry.library_name.c_str(), entry.library_version.c_str(), entry.asset.relative_path.c_str()); if (probe_deps_entry(entry, deps_dir, fx_level, &candidate)) { init_known_entry_path(entry, candidate); add_unique_path(asset_type, action(candidate), &items, output, &non_serviced, core_servicing); } else { // For self-contained apps do not use the full package name // because of rid-fallback could happen (ex: CentOS falling back to RHEL) if ((entry.asset.name == _X("apphost")) && ends_with(entry.library_name, _X(".Microsoft.NETCore.DotNetAppHost"), false)) { return report_missing_assembly_in_manifest(entry, true); } return report_missing_assembly_in_manifest(entry); } return true; }; // Add app entries const auto& entries = get_deps().get_entries(asset_type); for (const auto& entry : entries) { if (!add_package_cache_entry(entry, m_app_dir, 0)) { return false; } } // If the deps file is missing add known locations. if (!get_deps().exists()) { // App local path add_unique_path(asset_type, m_app_dir, &items, output, &non_serviced, core_servicing); (void) library_exists_in_dir(m_app_dir, LIBCORECLR_NAME, &m_coreclr_path); (void) library_exists_in_dir(m_app_dir, LIBCLRJIT_NAME, &m_clrjit_path); } // Handle any additional deps.json that were specified. for (const auto& additional_deps : m_additional_deps) { const auto additional_deps_entries = additional_deps->get_entries(asset_type); for (const auto entry : additional_deps_entries) { if (!add_package_cache_entry(entry, m_app_dir, 0)) { return false; } } } // Add fx package locations to fx_dir for (int i = 1; i < m_fx_definitions.size(); ++i) { const auto& fx_entries = m_fx_definitions[i]->get_deps().get_entries(asset_type); for (const auto& entry : fx_entries) { if (!add_package_cache_entry(entry, m_fx_definitions[i]->get_dir(), i)) { return false; } } } output->append(non_serviced); return true; }
/** * Resolve the TPA assembly locations */ bool deps_resolver_t::resolve_tpa_list( pal::string_t* output, std::unordered_set<pal::string_t>* breadcrumb, bool ignore_missing_assemblies) { const std::vector<deps_entry_t> empty(0); name_to_resolved_asset_map_t items; auto process_entry = [&](const pal::string_t& deps_dir, const deps_entry_t& entry, int fx_level) -> bool { if (breadcrumb != nullptr && entry.is_serviceable) { breadcrumb->insert(entry.library_name + _X(",") + entry.library_version); breadcrumb->insert(entry.library_name); } // Ignore placeholders if (ends_with(entry.asset.relative_path, _X("/_._"), false)) { return true; } trace::info(_X("Processing TPA for deps entry [%s, %s, %s]"), entry.library_name.c_str(), entry.library_version.c_str(), entry.asset.relative_path.c_str()); pal::string_t resolved_path; name_to_resolved_asset_map_t::iterator existing = items.find(entry.asset.name); if (existing == items.end()) { if (probe_deps_entry(entry, deps_dir, fx_level, &resolved_path)) { deps_resolved_asset_t resolved_asset(entry.asset, resolved_path); add_tpa_asset(resolved_asset, &items); return true; } return report_missing_assembly_in_manifest(entry, ignore_missing_assemblies); } else { // Verify the extension is the same as the previous verified entry if (get_deps_filename(entry.asset.relative_path) != get_filename(existing->second.resolved_path)) { trace::error( DuplicateAssemblyWithDifferentExtensionMessage.c_str(), entry.deps_file.c_str(), entry.library_name.c_str(), entry.library_version.c_str(), entry.asset.relative_path.c_str(), existing->second.resolved_path.c_str()); return false; } deps_resolved_asset_t* existing_entry = &existing->second; // If deps entry is same or newer than existing, then see if it should be replaced if (entry.asset.assembly_version > existing_entry->asset.assembly_version || (entry.asset.assembly_version == existing_entry->asset.assembly_version && entry.asset.file_version >= existing_entry->asset.file_version)) { if (probe_deps_entry(entry, deps_dir, fx_level, &resolved_path)) { // If the path is the same, then no need to replace if (resolved_path != existing_entry->resolved_path) { trace::verbose(_X("Replacing deps entry [%s, AssemblyVersion:%s, FileVersion:%s] with [%s, AssemblyVersion:%s, FileVersion:%s]"), existing_entry->resolved_path.c_str(), existing_entry->asset.assembly_version.as_str().c_str(), existing_entry->asset.file_version.as_str().c_str(), resolved_path.c_str(), entry.asset.assembly_version.as_str().c_str(), entry.asset.file_version.as_str().c_str()); existing_entry = nullptr; items.erase(existing); deps_asset_t asset(entry.asset.name, entry.asset.relative_path, entry.asset.assembly_version, entry.asset.file_version); deps_resolved_asset_t resolved_asset(asset, resolved_path); add_tpa_asset(resolved_asset, &items); } } else if (fx_level != 0) { // The framework is missing a newer package, so this is an error. // For compat, it is not an error for the app; this can occur for the main application assembly when using --depsfile // and the app assembly does not exist with the deps file. return report_missing_assembly_in_manifest(entry); } } return true; } }; // We do not support self-contained in a libhost scenario since in the self-contained scenario, // we cannot determine what assemblies are framework assemblies, and what assemblies are app-local assemblies. if (m_host_mode != host_mode_t::libhost) { // First add managed assembly to the TPA. // TODO: Remove: the deps should contain the managed DLL. // Workaround for: csc.deps.json doesn't have the csc.dll deps_asset_t asset(get_filename_without_ext(m_managed_app), get_filename(m_managed_app), version_t(), version_t()); deps_resolved_asset_t resolved_asset(asset, m_managed_app); add_tpa_asset(resolved_asset, &items); // Add the app's entries const auto& deps_entries = get_deps().get_entries(deps_entry_t::asset_types::runtime); for (const auto& entry : deps_entries) { if (!process_entry(m_app_dir, entry, 0)) { return false; } } // If the deps file wasn't present or has missing entries, then // add the app local assemblies to the TPA. This is only valid // in non-libhost scenarios (e.g. comhost). if (!get_deps().exists()) { // Obtain the local assemblies in the app dir. get_dir_assemblies(m_app_dir, _X("local"), &items); } } // There should be no additional deps files in a libhost scenario. // See comments during additional deps.json resolution. assert(m_additional_deps.empty() || m_host_mode != host_mode_t::libhost); // If additional deps files were specified that need to be treated as part of the // application, then add them to the mix as well. for (const auto& additional_deps : m_additional_deps) { auto additional_deps_entries = additional_deps->get_entries(deps_entry_t::asset_types::runtime); for (auto entry : additional_deps_entries) { if (!process_entry(m_app_dir, entry, 0)) { return false; } } } // Probe FX deps entries after app assemblies are added. for (int i = 1; i < m_fx_definitions.size(); ++i) { const auto& deps_entries = m_is_framework_dependent ? m_fx_definitions[i]->get_deps().get_entries(deps_entry_t::asset_types::runtime) : empty; for (const auto& entry : deps_entries) { if (!process_entry(m_fx_definitions[i]->get_dir(), entry, i)) { return false; } } } // Convert the paths into a string and return it for (const auto& item : items) { // Workaround for CoreFX not being able to resolve sym links. pal::string_t real_asset_path = item.second.resolved_path; pal::realpath(&real_asset_path); output->append(real_asset_path); output->push_back(PATH_SEPARATOR); } return true; }