Example #1
0
  def _construct_options(options_bootstrapper, build_configuration):
    """Parse and register options.

    :returns: An Options object representing the full set of runtime options.
    """
    # Now that plugins and backends are loaded, we can gather the known scopes.

    # Gather the optionables that are not scoped to any other.  All known scopes are reachable
    # via these optionables' known_scope_infos() methods.
    top_level_optionables = (
      {GlobalOptionsRegistrar} |
      GlobalSubsystems.get() |
      build_configuration.subsystems() |
      set(Goal.get_optionables())
    )

    known_scope_infos = sorted({
      si for optionable in top_level_optionables for si in optionable.known_scope_infos()
    })

    # Now that we have the known scopes we can get the full options.
    options = options_bootstrapper.get_full_options(known_scope_infos)

    distinct_optionable_classes = sorted({si.optionable_cls for si in known_scope_infos},
                                         key=lambda o: o.options_scope)
    for optionable_cls in distinct_optionable_classes:
      optionable_cls.register_options_on_scope(options)

    return options
Example #2
0
    def _construct_options(options_bootstrapper, build_configuration):
        """Parse and register options.

    :returns: An Options object representing the full set of runtime options.
    """
        # Now that plugins and backends are loaded, we can gather the known scopes.

        # Gather the optionables that are not scoped to any other.  All known scopes are reachable
        # via these optionables' known_scope_infos() methods.
        top_level_optionables = ({GlobalOptionsRegistrar}
                                 | GlobalSubsystems.get()
                                 | build_configuration.subsystems()
                                 | set(Goal.get_optionables()))

        known_scope_infos = sorted({
            si
            for optionable in top_level_optionables
            for si in optionable.known_scope_infos()
        })

        # Now that we have the known scopes we can get the full options.
        options = options_bootstrapper.get_full_options(known_scope_infos)

        distinct_optionable_classes = sorted(
            {si.optionable_cls
             for si in known_scope_infos},
            key=lambda o: o.options_scope)
        for optionable_cls in distinct_optionable_classes:
            optionable_cls.register_options_on_scope(options)

        return options
  def _install_options(self, options_bootstrapper, build_configuration):
    """Parse and register options.

    :returns: An Options object representing the full set of runtime options.
    """
    # TODO: This inline import is currently necessary to resolve a ~legitimate cycle between
    # `GoalRunner`->`EngineInitializer`->`OptionsInitializer`->`GoalRunner`.
    from pants.bin.goal_runner import GoalRunner

    # Now that plugins and backends are loaded, we can gather the known scopes.

    # Gather the optionables that are not scoped to any other.  All known scopes are reachable
    # via these optionables' known_scope_infos() methods.
    top_level_optionables = ({GlobalOptionsRegistrar} |
                             GoalRunner.subsystems() |
                             build_configuration.subsystems() |
                             set(Goal.get_optionables()))

    known_scope_infos = sorted({
      si for optionable in top_level_optionables for si in optionable.known_scope_infos()
    })

    # Now that we have the known scopes we can get the full options.
    options = options_bootstrapper.get_full_options(known_scope_infos)

    distinct_optionable_classes = sorted({si.optionable_cls for si in known_scope_infos},
                                         key=lambda o: o.options_scope)
    for optionable_cls in distinct_optionable_classes:
      optionable_cls.register_options_on_scope(options)

    # Make the options values available to all subsystems.
    Subsystem.set_options(options)

    return options
Example #4
0
    def _construct_options(options_bootstrapper, build_configuration):
        """Parse and register options.

        :returns: An Options object representing the full set of runtime options.
        """
        # Now that plugins and backends are loaded, we can gather the known scopes.

        # Gather the optionables that are not scoped to any other.  All known scopes are reachable
        # via these optionables' known_scope_infos() methods.
        top_level_optionables = ({GlobalOptions}
                                 | GlobalSubsystems.get()
                                 | build_configuration.optionables()
                                 | set(Goal.get_optionables()))

        # Now that we have the known scopes we can get the full options. `get_full_options` will
        # sort and de-duplicate these for us.
        known_scope_infos = [
            si for optionable in top_level_optionables
            for si in optionable.known_scope_infos()
        ]
        return options_bootstrapper.get_full_options(known_scope_infos)
  def _construct_options(options_bootstrapper, build_configuration):
    """Parse and register options.

    :returns: An Options object representing the full set of runtime options.
    """
    # Now that plugins and backends are loaded, we can gather the known scopes.

    # Gather the optionables that are not scoped to any other.  All known scopes are reachable
    # via these optionables' known_scope_infos() methods.
    top_level_optionables = (
      {GlobalOptionsRegistrar} |
      GlobalSubsystems.get() |
      build_configuration.optionables() |
      set(Goal.get_optionables())
    )

    # Now that we have the known scopes we can get the full options. `get_full_options` will
    # sort and de-duplicate these for us.
    known_scope_infos = [si
                         for optionable in top_level_optionables
                         for si in optionable.known_scope_infos()]
    return options_bootstrapper.get_full_options(known_scope_infos)
Example #6
0
    def _install_options(self, options_bootstrapper, build_configuration):
        """Parse and register options.

    :returns: An Options object representing the full set of runtime options.
    """
        # TODO: This inline import is currently necessary to resolve a ~legitimate cycle between
        # `GoalRunner`->`EngineInitializer`->`OptionsInitializer`->`GoalRunner`.
        from pants.bin.goal_runner import GoalRunner

        # Now that plugins and backends are loaded, we can gather the known scopes.

        # Gather the optionables that are not scoped to any other.  All known scopes are reachable
        # via these optionables' known_scope_infos() methods.
        top_level_optionables = ({GlobalOptionsRegistrar}
                                 | GoalRunner.subsystems()
                                 | build_configuration.subsystems()
                                 | set(Goal.get_optionables()))

        known_scope_infos = sorted({
            si
            for optionable in top_level_optionables
            for si in optionable.known_scope_infos()
        })

        # Now that we have the known scopes we can get the full options.
        options = options_bootstrapper.get_full_options(known_scope_infos)

        distinct_optionable_classes = sorted(
            {si.optionable_cls
             for si in known_scope_infos},
            key=lambda o: o.options_scope)
        for optionable_cls in distinct_optionable_classes:
            optionable_cls.register_options_on_scope(options)

        # Make the options values available to all subsystems.
        Subsystem.set_options(options)

        return options