The scope defined for a component determines both the code
generation scope and roundtripping scope. Code is generated for modified
elements only if the files that contain them are included in the component
scope, and changes to files are roundtripped into the model only if
the modified files are included in the component scope.
About this task
To modify the scope of code-centric projects:
- Reverse engineer files and all those files are
added to the scope automatically.
- If you specified a folder in the Reverse Engineering
window, then any files you create in that folder are automatically
added to the scope. Similarly, if you delete any files from that folder,
the corresponding elements are removed from the model when you run
roundtrip.
- If you add a file (in C) / class (in C++) to the
project and update the code, the generated file is added to the scope.
This structure occurs even if you generate the file to a folder that
is not defined as part of the scope.
- To modify the scope manually, add files/folders
in the Roundtrip Settings window using /.
When modifying the scope, it is important to
keep in mind that in code-centric mode the package structure in IBM® Rational® Rhapsody® following
roundtripping is always identical to the directory structure of your
source code. This rule has a number of implications:
- If you would like to reverse engineer files in
increments, make sure that all the directories containing your code
are underneath a single directory that can be specified as the root
directory on the Mapping tab of the Reverse Engineering Advanced Options
window. You can then import any directories under this root directory,
and Rational Rhapsody creates
a package structure that matches your directory structure. If you
are using this type of incremental approach, you set the value of
the UseCalculatedRootDirectoryRational Rhapsody to Never before
carrying out reverse engineering.
- If you change the root directory, the package structure
in your model is different following roundtrip. It is possible that
some packages are removed from the model and then recreated. If one
of these packages contains elements not reflected in your code, for
example requirements, then these elements no longer exist in the model
following roundtripping since they do not have any representation
in the code that was roundtripped.
Note: These consequences
of changes to the package structure in the product apply also when
you are manually changing the hierarchy of the folders that contain
your source code. Before roundtripping code changes after such folder
adjustments, you make similar changes to the package structure in
your model to ensure that no code-less elements disappear.
This "remove and recreate" approach is also used if you rename individual
elements in your code such as classes. Since classes in your model
might contain significant information that is not represented in your
code, make sure that such renaming is not going to result in loss
of information from your model.
- If you are importing code from directories that
do not have a common ancestor directory directly above them, you need
to import them into different product components.