fpm_backend_output Module

Build Backend Progress Output

This module provides a derived type build_progress_t for printing build status and progress messages to the console while the backend is building the package.

The build_progress_t type supports two modes: normal and plain where the former does ‘pretty’ output and the latter does not. The normal mode is intended for typical interactive usage whereas ‘plain’ mode is used with the --verbose flag or when stdout is not attached to a terminal (e.g. when piping or redirecting stdout). In these cases, the pretty output must be suppressed to avoid control codes being output.



Interfaces

public interface build_progress_t

Constructor for build_progress_t

  • private function new_build_progress(target_queue, plain_mode) result(progress)

    Initialise a new build progress object

    Arguments

    Type IntentOptional Attributes Name
    type(build_target_ptr), intent(in), target :: target_queue(:)

    The queue of scheduled targets

    logical, intent(in), optional :: plain_mode

    Enable ‘plain’ output for progress object

    Return Value type(build_progress_t)

    Progress object to initialise


Derived Types

type, public ::  build_progress_t

Build progress object

Components

Type Visibility Attributes Name Initial
type(console_t), public :: console

Console object for updating console lines

integer, public :: n_complete

Number of completed targets

integer, public :: n_target

Total number of targets scheduled

integer, public, allocatable :: output_lines(:)

Store needed when updating previous console lines

logical, public :: plain_mode = .true.

‘Plain’ output (no colors or updating)

type(build_target_ptr), public, pointer :: target_queue(:)

Queue of scheduled build targets

Constructor

Constructor for build_progress_t

private function new_build_progress (target_queue, plain_mode)

Initialise a new build progress object

Type-Bound Procedures

procedure, public :: compiling_status => output_status_compiling ../../

Output ‘compiling’ status for build target

procedure, public :: completed_status => output_status_complete ../../

Output ‘complete’ status for build target

procedure, public :: success => output_progress_success ../../

Output finished status for whole package