def _load_graph(self, root_node, check_updates, update, build_mode, remotes, recorder, profile_host, profile_build, apply_build_requires, graph_lock): assert isinstance(build_mode, BuildMode) profile_host_build_requires = profile_host.build_requires builder = DepsGraphBuilder(self._proxy, self._output, self._loader, self._resolver, recorder) graph = builder.load_graph(root_node, check_updates, update, remotes, profile_host, profile_build, graph_lock) self._recurse_build_requires(graph, builder, check_updates, update, build_mode, remotes, profile_host_build_requires, recorder, profile_host, profile_build, graph_lock, apply_build_requires=apply_build_requires) # Sort of closures, for linking order inverse_levels = { n: i for i, level in enumerate(graph.inverse_levels()) for n in level } for node in graph.nodes: node.public_closure.pop(node.name, context=node.context) # List sort is stable, will keep the original order of closure, but prioritize levels node.public_closure.sort(key_fn=lambda n: inverse_levels[n]) return graph
def _load_graph(self, root_node, check_updates, update, build_mode, remote_name, profile_build_requires, recorder, processed_profile, apply_build_requires): assert isinstance(build_mode, BuildMode) builder = DepsGraphBuilder(self._proxy, self._output, self._loader, self._resolver, recorder) graph = builder.load_graph(root_node, check_updates, update, remote_name, processed_profile) binaries_analyzer = GraphBinariesAnalyzer(self._cache, self._output, self._remote_manager) self._recurse_build_requires(graph, builder, binaries_analyzer, check_updates, update, build_mode, remote_name, profile_build_requires, recorder, processed_profile, apply_build_requires=apply_build_requires) # Sort of closures, for linking order inverse_levels = {n: i for i, level in enumerate(graph.inverse_levels()) for n in level} for node in graph.nodes: closure = node.public_closure closure.pop(node.name) node_order = list(closure.values()) # List sort is stable, will keep the original order of the closure, but prioritize levels node_order.sort(key=lambda n: inverse_levels[n]) node.public_closure = node_order return graph
def _load_graph(self, root_node, check_updates, update, build_mode, remote_name, profile_build_requires, recorder, workspace, processed_profile): builder = DepsGraphBuilder(self._proxy, self._output, self._loader, self._resolver, workspace, recorder) graph = builder.load_graph(root_node, check_updates, update, remote_name, processed_profile) if build_mode is None: return graph binaries_analyzer = GraphBinariesAnalyzer(self._cache, self._output, self._remote_manager, workspace) binaries_analyzer.evaluate_graph(graph, build_mode, update, remote_name) self._recurse_build_requires(graph, check_updates, update, build_mode, remote_name, profile_build_requires, recorder, workspace, processed_profile) return graph
def load_simple_graph(self, reference, profile, recorder): # Loads a graph without computing the binaries. It is necessary for # export-pkg command, not hitting the server # # https://github.com/conan-io/conan/issues/3432 builder = DepsGraphBuilder(self._proxy, self._output, self._loader, self._resolver, workspace=None, recorder=recorder) processed_profile = ProcessedProfile(profile, create_reference=None) conanfile = self._loader.load_virtual([reference], processed_profile) root_node = Node(None, conanfile, recipe=RECIPE_VIRTUAL) graph = builder.load_graph(root_node, check_updates=False, update=False, remote_name=None, processed_profile=processed_profile) return graph
def setUp(self): self.output = TestBufferConanOutput() self.loader = ConanFileLoader(None, Settings.loads(""), Profile()) self.retriever = Retriever(self.loader, self.output) self.remote_search = MockSearchRemote() paths = SimplePaths(self.retriever.folder) self.resolver = RangeResolver(self.output, paths, self.remote_search) self.builder = DepsGraphBuilder(self.retriever, self.output, self.loader, self.resolver) for v in ["0.1", "0.2", "0.3", "1.1", "1.1.2", "1.2.1", "2.1", "2.2.1"]: say_content = """ from conans import ConanFile class SayConan(ConanFile): name = "Say" version = "%s" """ % v say_ref = ConanFileReference.loads("Say/%s@memsharded/testing" % v) self.retriever.conan(say_ref, say_content)
def load_simple_graph(self, reference, profile, recorder): # Loads a graph without computing the binaries. It is necessary for # export-pkg command, not hitting the server # # https://github.com/conan-io/conan/issues/3432 builder = DepsGraphBuilder(self._proxy, self._output, self._loader, self._resolver, workspace=None, recorder=recorder) cache_settings = self._client_cache.settings.copy() cache_settings.values = profile.settings_values settings_preprocessor.preprocess(cache_settings) processed_profile = ProcessedProfile(cache_settings, profile, create_reference=None) conanfile = self._loader.load_virtual([reference], processed_profile) graph = builder.load_graph(conanfile, check_updates=False, update=False, remote_name=None, processed_profile=processed_profile) return graph
def load_graph(self, conanfile, check_updates, update, build_mode, remote_name=None, profile_build_requires=None): builder = DepsGraphBuilder(self._proxy, self._output, self._loader, self._resolver, self._workspace) graph = builder.load_graph(conanfile, check_updates, update, remote_name) if build_mode is None: return graph binaries_analyzer = GraphBinariesAnalyzer(self._client_cache, self._output, self._remote_manager, self._registry, self._workspace) binaries_analyzer.evaluate_graph(graph, build_mode, update, remote_name) self._recurse_build_requires(graph, check_updates, update, build_mode, remote_name, profile_build_requires) return graph
def _get_graph_builder(self, loader, remote_proxy): resolver = RangeResolver(self._user_io.out, self._client_cache, remote_proxy) graph_builder = DepsGraphBuilder(remote_proxy, self._user_io.out, loader, resolver) return graph_builder
def _get_graph_builder(self, loader, remote_proxy): local_search = self._search_manager resolver = RequireResolver(self._user_io.out, local_search, remote_proxy) graph_builder = DepsGraphBuilder(remote_proxy, self._user_io.out, loader, resolver) return graph_builder