def _init_engine(self, local_store_dir: Optional[str] = None) -> None: if self._scheduler is not None: return options_bootstrapper = OptionsBootstrapper.create( args=["--pants-config-files=[]"]) local_store_dir = (local_store_dir or options_bootstrapper.bootstrap_options. for_global_scope().local_store_dir) # NB: This uses the long form of initialization because it needs to directly specify # `cls.alias_groups` rather than having them be provided by bootstrap options. graph_session = EngineInitializer.setup_legacy_graph_extended( pants_ignore_patterns=[], local_store_dir=local_store_dir, build_file_imports_behavior=BuildFileImportsBehavior.error, native=init_native(), options_bootstrapper=options_bootstrapper, build_root=self.build_root, build_configuration=self.build_config(), build_ignore_patterns=None, ).new_session(zipkin_trace_v2=False, build_id="buildid_for_test") self._scheduler = graph_session.scheduler_session self._build_graph, self._address_mapper = graph_session.create_build_graph( Specs(address_specs=AddressSpecs([]), filesystem_specs=FilesystemSpecs([])), self._build_root(), )
def _init_engine(self, local_store_dir: Optional[str] = None) -> None: if self._scheduler is not None: return options_bootstrapper = OptionsBootstrapper.create( env={}, args=["--pants-config-files=[]", *self.additional_options], allow_pantsrc=False ) global_options = options_bootstrapper.bootstrap_options.for_global_scope() local_store_dir = local_store_dir or global_options.local_store_dir local_execution_root_dir = global_options.local_execution_root_dir named_caches_dir = global_options.named_caches_dir # NB: This uses the long form of initialization because it needs to directly specify # `cls.alias_groups` rather than having them be provided by bootstrap options. graph_session = EngineInitializer.setup_legacy_graph_extended( pants_ignore_patterns=[], use_gitignore=False, local_store_dir=local_store_dir, local_execution_root_dir=local_execution_root_dir, named_caches_dir=named_caches_dir, build_file_prelude_globs=(), glob_match_error_behavior=GlobMatchErrorBehavior.error, native=init_native(), options_bootstrapper=options_bootstrapper, build_root=self.build_root, build_configuration=self.build_config(), execution_options=ExecutionOptions.from_bootstrap_options(global_options), ).new_session(build_id="buildid_for_test", should_report_workunits=True) self._scheduler = graph_session.scheduler_session
def _init_engine(cls): if cls._scheduler is not None: return # NB: This uses the long form of initialization because it needs to directly specify # `cls.alias_groups` rather than having them be provided by bootstrap options. graph_session = EngineInitializer.setup_legacy_graph_extended( pants_ignore_patterns=None, workdir=cls._pants_workdir(), build_file_imports_behavior='allow', native=init_native(), build_configuration=cls.build_config(), build_ignore_patterns=None, ).new_session() cls._scheduler = graph_session.scheduler_session cls._build_graph, cls._address_mapper = graph_session.create_build_graph( TargetRoots([]), cls._build_root())
def graph_helper(self, build_configuration=None, build_file_imports_behavior='allow', include_trace_on_error=True, path_ignore_patterns=None): with temporary_dir() as work_dir: path_ignore_patterns = path_ignore_patterns or [] build_config = build_configuration or self._default_build_config() # TODO: This test should be swapped to using TestBase. graph_helper = EngineInitializer.setup_legacy_graph_extended( path_ignore_patterns, work_dir, build_file_imports_behavior, build_configuration=build_config, native=self._native, include_trace_on_error=include_trace_on_error) yield graph_helper
def _init_engine(cls): if cls._scheduler is not None: return # NB: This uses the long form of initialization because it needs to directly specify # `cls.alias_groups` rather than having them be provided by bootstrap options. graph_session = EngineInitializer.setup_legacy_graph_extended( pants_ignore_patterns=None, workdir=cls._pants_workdir(), build_file_imports_behavior='allow', native=init_native(), build_configuration=cls.build_config(), build_ignore_patterns=None, ).new_session() cls._scheduler = graph_session.scheduler_session cls._build_graph, cls._address_mapper = graph_session.create_build_graph( TargetRoots([]), cls._build_root() )
def graph_helper(self, build_configuration=None, build_file_imports_behavior='allow', include_trace_on_error=True, path_ignore_patterns=None): with temporary_dir() as work_dir: path_ignore_patterns = path_ignore_patterns or [] build_config = build_configuration or self._default_build_config() # TODO: This test should be swapped to using TestBase. graph_helper = EngineInitializer.setup_legacy_graph_extended( path_ignore_patterns, work_dir, build_file_imports_behavior, build_configuration=build_config, native=self._native, include_trace_on_error=include_trace_on_error ) yield graph_helper
def _init_engine(cls): if cls._scheduler is not None: return cls._local_store_dir = os.path.realpath(safe_mkdtemp()) safe_mkdir(cls._local_store_dir) # NB: This uses the long form of initialization because it needs to directly specify # `cls.alias_groups` rather than having them be provided by bootstrap options. graph_session = EngineInitializer.setup_legacy_graph_extended( pants_ignore_patterns=None, local_store_dir=cls._local_store_dir, build_file_imports_behavior='allow', native=init_native(), options_bootstrapper=OptionsBootstrapper.create( args=['--pants-config-files=[]']), build_configuration=cls.build_config(), build_ignore_patterns=None, ).new_session(zipkin_trace_v2=False) cls._scheduler = graph_session.scheduler_session cls._build_graph, cls._address_mapper = graph_session.create_build_graph( TargetRoots([]), cls._build_root())
def _init_engine(cls): if cls._scheduler is not None: return cls._local_store_dir = os.path.realpath(safe_mkdtemp()) safe_mkdir(cls._local_store_dir) # NB: This uses the long form of initialization because it needs to directly specify # `cls.alias_groups` rather than having them be provided by bootstrap options. graph_session = EngineInitializer.setup_legacy_graph_extended( pants_ignore_patterns=None, workdir=cls._pants_workdir(), local_store_dir=cls._local_store_dir, build_file_imports_behavior='allow', native=init_native(), options_bootstrapper=OptionsBootstrapper.create(args=['--pants-config-files=[]']), build_configuration=cls.build_config(), build_ignore_patterns=None, ).new_session(zipkin_trace_v2=False) cls._scheduler = graph_session.scheduler_session cls._build_graph, cls._address_mapper = graph_session.create_build_graph( TargetRoots([]), cls._build_root() )