/usr/share/doc/gnat-gps/html/Scenarios-and-Configuration-Variables.html is in gnat-gps-doc 5.0-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | <html lang="en">
<head>
<title>Scenarios and Configuration Variables - Using the GNAT Programming Studio</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Using the GNAT Programming Studio">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Project-Handling.html#Project-Handling" title="Project Handling">
<link rel="prev" href="Supported-Languages.html#Supported-Languages" title="Supported Languages">
<link rel="next" href="Extending-Projects.html#Extending-Projects" title="Extending Projects">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 2002-2010 AdaCore.
This document is free; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This document is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, see `http://www.gnu.org/licenses/'.-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
pre.smallexample {background-color:rgb(240,240,240);
font-family: courier new,courier,fixed;
font-size: 14px;
margin: 0px 40px 0px 40px;
border-width: 1px 2px 2px 1px;
border-top-style: dotted;
border-left-style: dotted;
border-right-style: solid;
border-bottom-style: solid;
border-color: black;}
code {color:black;
font-family: courier new,courier,fixed;
font-size: 14px;}
body {font-family: arial,helvetica,sans-serif;
font-size: 16px;
max-width: 800px;
text-align: justify}
samp {font-family: courier new,courier,fixed;
font-size: 14px}
--></style>
</head>
<body>
<div class="node">
<a name="Scenarios-and-Configuration-Variables"></a>
<p>
Next: <a rel="next" accesskey="n" href="Extending-Projects.html#Extending-Projects">Extending Projects</a>,
Previous: <a rel="previous" accesskey="p" href="Supported-Languages.html#Supported-Languages">Supported Languages</a>,
Up: <a rel="up" accesskey="u" href="Project-Handling.html#Project-Handling">Project Handling</a>
<hr>
</div>
<h3 class="section">7.3 Scenarios and Configuration Variables</h3>
<p><a name="index-configuration-variable-337"></a><a name="index-project-variable-338"></a><a name="index-variable-339"></a><!-- -->
<p class="noindent">The behavior of projects can be further tailored by the use of
scenarios.
<p><a name="index-project-attribute-340"></a>All the attributes of a project, except its list of imported projects,
can be chosen based on the value of external variables, whose value is
generally coming from the host computer environment, or directly set in
GPS. The interface to manipulate these scenarios is the scenario view, which
can be displayed by selecting the menu <code>Tools->Views->Scenario</code>.
It can be convenient to drag this window with your mouse, and drop it above
the project view, so that you can see both at the same time.
<p>This area allows you to select new values for the scenario variables defined
in your project, and thus change dynamically the view GPS has of your project
and your source files.
<p><a name="index-compile-341"></a><a name="index-debug-342"></a>This facility can for instance be used to compile all the sources either
in debug mode (so that the executables can be run in the debugger), or
in optimized mode (to reduce the space and increase the speed when
delivering the software). In this configuration scenario, all the
attributes (source directories, tools, <small class="dots">...</small>) remain the same, except
for the compilation switches. It would be more difficult to maintain a
completely separate hierarchy of project, and it is much more efficient
to create a new configuration variable and edit the switches for the
appropriate scenario (<a href="The-Project-Properties-Editor.html#The-Project-Properties-Editor">The Project Properties Editor</a>).
<p>There is one limitation in what GPS can do with scenario variables: although
gnatmake and gprbuild have no problem dealing with scenario variables
whose default value is not a static string (for instance a concatenation, or
the value of another scenario variable), GPS will not be able to edit such
a project graphically. Such projects will load fine in GPS though.
<h4 class="subsection">7.3.1 Creating new configuration variables</h4>
<p><a name="index-creating-configuration-variable-343"></a>
Creating a new scenario variable is done through the contextual menu
(right-click) in the Project View or the Scenario View itself. Select the
menu <code>Project->Add Configuration Variable</code>. This opens the following
dialog:
<p><a name="index-screen-shot-344"></a><img src="scenarios.jpg" alt="scenarios.jpg">
<p>There are two main areas in this dialog: in the top line, you specify
the name of the variable. This name is used for two purposes:
<ul>
<li>It is displayed in the scenario view
<a name="index-scenario-view-345"></a>
<li>This is the name of the environment variable from which the
initial value is read. When GPS is started, all configuration
variables are initialized from the host computer environment, although
you can of course change its value later on inside GPS. Note that
selecting a new value for the scenario variable does not change the
actual value of the environment variable, which is only used to get the
default initial value of the scenario variable.
<p>When you spawn external tools like gnatmake for instance, you can
also specify the value they will use for the scenario variable by
using a command line switch, typically <code>-X</code>.
</ul>
<p>If you click on the arrow on the right of this name area, GPS will
display the list of all the environment variables that are currently
defined. However, you don't need to pick the name of an existing
variable, neither must the variable exist when GPS is started.
<p>The second part of this dialog is the list of authorized value for
this variable. Any other value will generate an error reported by
GPS, and the project won't be loaded as a result.
<p>One of these values is the default value (the one whose button in the
Default column is selected). This means that if the environment
variable doesn't exist when GPS is started, GPS will behave as if it
did exist with this default value.
<p>The list of possible values can be edited by right-clicking on the name
of the variable, and selecting one of <code>Edit properties</code> or
<code>Delete variable</code>.
<h4 class="subsection">7.3.2 Editing existing configuration variables</h4>
<p><a name="index-editing-configuration-variable-346"></a>
If at least one configuration variable is defined in your project, the
scenario view will contain something similar to:
<p><a name="index-screen-shot-347"></a><img src="explorer-scenario.jpg" alt="explorer-scenario.jpg">
<p><a name="index-Unix-348"></a>This screen shot shows two configuration variables, named <code>Build</code>
and <code>OS</code>, with their current value (resp. <code>Debug</code> and
<code>Unix</code>).
<p>You can easily change the current value of any of these variables by
clicking on the arrow on the right of the value. This will display a
pop-up window with the list of possible values, from which you select
the one you wish to use.
<p>As soon as a new value is selected, GPS will recompute the project
view (in case source directories, object directories or list
of source files have changed). A number of things will also be updated
(like the list of executables in the <code>Compile</code>, <code>Run</code> and
<code>Debug</code> menus).
<p><a name="index-browsers-349"></a><a name="index-call-graph-350"></a>Currently, GPS will not recompute the contents of the various browsers
(call graph, dependencies, <small class="dots">...</small>) for this updated project. This would be too
expensive to do every time the value changes, and therefore you need
to explicitly request an update.
<!-- ??? Need to explain how to force an update, once this is implemented -->
<p>You can change the list of possible values for a configuration
variable at any time by clicking on the button to the far left of the
variable's name. This will pop up the same dialog that is used to create
new variables. This dialog also allows you to change the name of the
scenario variable. This name is the same as the environment variable that
is used to set the initial value of the scenario variable.
<p><a name="index-removing-variable-351"></a>Removing a variable is done by clicking on the button immediately to
the left of the variable's name. GPS will then display a confirmation
dialog.
<p>If you confirm that you want to delete the variable, GPS will simply
remove the variable, and from now on act as if the variable always had
the value it had when it was deleted.
<!-- -->
</body></html>
|