aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/functions-process-path.cxx
blob: 6746623b19249714ad5ec453bfd55ef7530b7ffa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// file      : libbuild2/functions-process-path.cxx -*- C++ -*-
// license   : MIT; see accompanying LICENSE file

#include <libbuild2/function.hxx>
#include <libbuild2/variable.hxx>

using namespace std;

namespace build2
{
  void
  process_path_functions (function_map& m)
  {
    function_family f (m, "process_path");

    // $recall(<process-path>)
    //
    // Return the recall path of an executable, that is, a path that is not
    // necessarily absolute but which nevertheless can be used to re-run the
    // executable in the current environment. This path, for example, could be
    // used in diagnostics when printing the failing command line.
    //

    // As discussed in value_traits<process_path>, we always have recall.
    //
    f["recall"] += &process_path::recall;


    // $effect(<process-path>)
    //
    // Return the effective path of an executable, that is, the absolute path
    // to the executable that will also include any omitted extensions, etc.
    //
    f["effect"] += [] (process_path p)
    {
      return move (p.effect.empty () ? p.recall : p.effect);
    };

    // $name(<process-path-ex>)
    //
    // Return the stable process name for diagnostics.
    //
    f["name"] += &process_path_ex::name;

    // $checksum(<process-path-ex>)
    //
    // Return the executable checksum for change tracking.
    //
    f["checksum"] += &process_path_ex::checksum;

    // $env_checksum(<process-path-ex>)
    //
    // Return the environment checksum for change tracking.
    //
    f["env_checksum"] += &process_path_ex::env_checksum;
  }
}