aboutsummaryrefslogtreecommitdiff
path: root/build2/test/rule.hxx
blob: b3312636c665c2d1a1c0742420d8c658a6827915 (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
58
59
60
61
62
63
64
// file      : build2/test/rule.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
// license   : MIT; see accompanying LICENSE file

#ifndef BUILD2_TEST_RULE_HXX
#define BUILD2_TEST_RULE_HXX

#include <build2/types.hxx>
#include <build2/utility.hxx>

#include <build2/rule.hxx>
#include <build2/operation.hxx>

#include <build2/test/common.hxx>

namespace build2
{
  namespace test
  {
    class rule: public build2::rule, protected virtual common
    {
    public:
      explicit
      rule (common_data&& d): common (move (d)) {}

      virtual bool
      match (action, target&, const string&) const override;

      virtual recipe
      apply (action, target&) const override;

      static target_state
      perform_update (action, const target&);

      target_state
      perform_test (action, const target&, size_t) const;

      target_state
      perform_script (action, const target&, size_t) const;
    };

    class default_rule: public rule // For disambiguation in module.
    {
    public:
      explicit
      default_rule (common_data&& d): common (move (d)), rule (move (d)) {}
    };

    // In addition to the above rule's semantics, this rule sees through to
    // the group's members.
    //
    class group_rule: public rule
    {
    public:
      explicit
      group_rule (common_data&& d): common (move (d)), rule (move (d)) {}

      virtual recipe
      apply (action, target&) const override;
    };
  }
}

#endif // BUILD2_TEST_RULE_HXX