aboutsummaryrefslogtreecommitdiff
path: root/bdep/sync.cli
blob: ab01dffc09b5f19f786a5fa3be90b6f57b8fa034 (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
// file      : bdep/sync.cli
// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
// license   : MIT; see accompanying LICENSE file

include <bdep/project.cli>;

"\section=1"
"\name=bdep-sync"
"\summary=synchronize project and build configurations"

namespace bdep
{
  {
    "<options>
     <prj-spec> <prj-dir>
     <pkg-spec> <pkg-dir>
     <cfg-spec> <cfg-name> <cfg-dir>
     <dep-spec> <pkg> <ver>",

    "\h|SYNOPSIS|

     \c{\b{bdep sync} [<options>] [<pkg-spec>] [<cfg-spec>]\n
        \b{bdep sync} [<options>] [<pkg-spec>] [<cfg-spec>] \ \b{--upgrade}|\b{-u} | \b{--patch}|\b{-p}\n
        \b{bdep sync} [<options>] [<pkg-spec>] [<cfg-spec>] [\b{--upgrade}|\b{-u} | \b{--patch}|\b{-p}]\n
        \ \ \ \ \ \ \ \ \ \ <dep-spec>...
        }

     \c{<dep-spec> = <pkg>[\b{/}<ver>]\n
        <cfg-spec> = (\b{@}<cfg-name> | \b{--config}|\b{-c} <cfg-dir>)... | \b{--all}|\b{-a}\n
        <pkg-spec> = (\b{--directory}|\b{-d} <pkg-dir>)... | <prj-spec>\n
        <prj-spec> = \b{--directory}|\b{-d} <prj-dir>}

     \h|DESCRIPTION|

     The \cb{sync} command synchronizes a project with its build
     configurations. The first form (no arguments nor \cb{--upgrade} or
     \cb{--patch} are specified) upgrades the project packages to the latest
     iteration, adjusts their dependencies according to the latest manifest
     information, and updates the lockfile.

     The second form (no arguments but either \cb{--upgrade} or \cb{--patch}
     is specified), in addition to the first form's functionality, also
     upgrades or patches immediate (by default or if
     \c{\b{--immediate}|\b{-i}} is specified) or all (if
     \c{\b{--recursive}|\b{-r}} is specified) dependencies of the specified
     project packages.

     The third form (one or more arguments are specified), in addition to the
     first form's functionality, also upgrades (by default or if
     \cb{--upgrade} is specified) or patches (if \cb{--patch} is specified)
     the specified dependencies. If \c{\b{--immediate}|\b{-i}} or
     \c{\b{--recursive}|\b{-r}} is specified, then it also upgrades or patches
     the immediate or all dependencies of the specified dependencies,
     respectively. Alternative to \cb{--upgrade} and \cb{--patch}, the desired
     upgrade (or downgrade) version can be specified explicitly.

     Note also that \c{\b{--immediate}|\b{-i}} or \c{\b{--recursive}|\b{-r}}
     can only be specified with an explicit \cb{--upgrade} or \cb{--patch}.

     As an example, consider project \cb{prj} with two packages, \cb{foo}
     and \cb{libfoo}:

     \
     prj/
    ├── foo/
    └── libfoo/
     \

     The following invocations illustrate the common \cb{sync} use cases (the
     current working directory is shown before the shell prompt):

     \
     prj/$ bdep sync        # Synchronize foo/ and libfoo/ with the
                            # default configuration.

     prj/$ cd foo
     foo/$ bdep sync        # The same (all packages in a project are
                            # always synchronized together).

     foo/$ edit manifest    # Add 'depends: libx >= 1.0.0'
     foo/$ bdep sync        # Fetch and configure suitable libx version.

     foo/$ bdep sync -u     # Upgrade all immediate dependencies of foo.
     foo/$ cd ../
     prj/$ bdep sync -u -r  # Upgrade all dependencies of all packages in
                            # a project recursively.

     prj/$ bdep sync    libx           # Upgrade libx to the latest version.
     prj/$ bdep sync -i libx           # ...and its immediate dependecies.

     prj/$ bdep sync -p    libx        # Upgrade libx to the latest patch.
     prj/$ bdep sync -p -r libx        # ...and its dependecies recursively.

     prj/$ bdep sync       libx/1.2.3  # Upgrade libx to version 1.2.3.
     prj/$ bdep sync -p -r libx/1.2.3  # ...and patch its dependecies,
                                       # recursively.
     \

     "
  }

  // Note that not all project/configuration options are valid for all
  // subcommands.
  //
  class cmd_sync_options: project_options
  {
    "\h|SYNC OPTIONS|"

    bool --upgrade|-u
    {
      "Upgrade dependencies to the latest available version that satisfies
       all the constraints."
    }

    bool --patch|-p
    {
      "Upgrade dependencies to the latest available patch version that
       satisfies all the constraints."
    }

    bool --immediate|-i
    {
      "Also upgrade or patch immediate dependencies."
    }

    bool --recursive|-r
    {
      "Also upgrade or patch all dependencies, recursively."
    }

    bool --fetch|-f
    {
      "Perform the \cb{fetch} command prior to synchronization."
    }

    bool --fetch-full|-F
    {
      "Perform the \cb{fetch --full} command prior to synchronization."
    }

    bool --yes|-y
    {
      "Don't prompt for confirmation when up/down-grading dependencies."
    }
  };
}