Installing and Building Your SourcePro® C++ Products : Chapter 4 Working with Buildspaces : Cleaning Up Buildspaces
Cleaning Up Buildspaces
The rwclean Java utility cleans a buildspace by deleting files created during the build process. Deleting build artifacts — such as buildspecs, object files, makefiles, build results, and other files associated with a buildspec — can be done manually; however, you may not detect all the files that need to be deleted to ensure a clean buildspace. Using rwclean ensures that files are removed from your buildspace, coherently and completely, according to your command-line arguments.
The rest of this section explains how to use rwclean.
Invoking rwclean
Run the rwclean launch scripts, located in <installdir>\rcb\bin:
rwclean.bat for Windows
rwclean for UNIX
Deleting All Buildspace Files
The easiest and most complete way to use rwclean is to use the argument ‑‑clean‑buildspace, as shown here:
 
rwclean --jre -b full_buildspace_path --clean-buildspace
The --clean-buildspace argument removes all build artifacts in all modules for each buildspec (*.bsf) file that exists within a buildspace. It does not, however, remove the buildspec.bsf file itself.
Deleting Buildspace Files According to Buildtype and Module
For more specific needs, the rwclean utility also includes an extended set of arguments that allow you to specify particular files, buildtypes, and modules to be cleaned from the buildspec. The following example is based on the Essential Tools Module and Threads trace package example, which we have used throughout this chapter:
 
rwclean --jre -b c:\rwav [-a clean] -t 12s -p tools trace
This command line deletes the following for the tools module and the trace package: example and source build artifacts, libraries, build results, build logs, characterization files, and configuration-specific header files, but NOT the buildspec, from the 12s build in c:\rwav. The -a argument is optional; if no -a argument is provided, rwclean uses -a clean by default. See Table 6 for a complete list and description of rwclean arguments.
NOTE >> For a complete list of module and package specifiers, see the products.properties file, located at:
rcb_install/admin/rwclean/products.properties.
In other words, the above invocation of rwclean deletes:
Example and source build artifacts from c:\rwav\examples\trace\12s and c:\rwav\examples\tools\12s
Libraries from c:\rwav\lib
Build results from c:\rwav\records\results\12s
NOTE >> If there are also results for other modules or packages in c:\rwav\records\results\12s, those results will be deleted, even though we did not specify those modules or packages.
Build logs from rcb_install\admin\logs
Characterization files from c:\rwav\records\ch13n\12s
Configuration header files from c:\rwav\rw\config
This command is useful if you run a buildspec that fails. In this case, you can delete the files generated by the failed build, but you still have the buildspec, which you can run again once the cause of the build problem has been corrected.
Command Line Syntax
 
NOTE >> We recommend that you use rwclean in the way described in “Deleting All Buildspace Files.” This section, “Command Line Syntax”, explains additional ways to use rwclean, but some of these options may lead to undesired results.
The rwclean syntax is:
 
rwclean --jre [--preview] -b full_buildspace_path [-a action]
-t buildtype1 [buildtype2] -p module1 [module2]
Table 6 describes the rwclean command line arguments.
Table 6 – rwclean command line arguments 
Argument
Description
--jre
Specifies the Java2 JRE that is installed with RCB. Does not require that the PATH environment variable point to the JRE. If no --jre argument is provided, rwclean assumes that a Java2 JRE location is specified in the PATH environment variable.
--preview
For the given arguments, show files to be deleted without actually deleting them.
--clean-buildspace
Removes all build artifacts in all modules for each buildspec that exists within a buildspace, except the buildspec itself. Using this argument removes the need for any further arguments.
-b
The absolute path to the root of the buildspace that contains the build or builds where you intend to use rwclean.
-a
Optional. The -a argument specifies which files to delete. If no ‑a argument is provided, rwclean uses ‑a clean by default. The complete list of parameters for -a includes:
clean
Deletes all build artifacts except the buildspec. Files deleted include example and source build artifacts, libraries, build results, build logs, characterization files, and configuration-specific header files.
clean-all
Deletes all build artifacts including the buildspec.
clean-examples
Deletes all build artifacts (object files, executables, makefiles) in buildspace\examples\buildtype.
clean-source
Deletes all build artifacts (object files, makefiles) in buildspace\source\buildtype.
-t (buildtype)
One or more buildtype specifiers indicating which build type to “clean.” Includes both the build tag and a user tag, if provided, as explained in “Build Tags”. Examples: 12s, 12s_solaris, rms_solaris, _NoStdLib_Win32ThrLib_Static_Release.
-p (module)
One or more module or package specifiers. For example, in examples/trace/12s, the specifier is trace. The complete list of module and package specifiers is located in the products.properties file, located at: rcb_install/admin/rwclean/products.properties
These specifiers can be placed in any order on the command line. In other words, dependencies are not an issue, so, for instance, tools does not need to appear before trace.
Each module or package specifier is paired with each buildtype specifier. The “Examples” example labeled “two build types, two components,” shows how these two specifiers work together.
Examples
Here are some examples of using rwclean.
All build types, all components
rwclean --jre -b full_buildspace_path --clean-buildspace
Deletes all build artifacts in all modules for each buildspec within a buildspace, but does not remove the buildspec itself. The --jre argument specifies that the RCB-installed JRE will be used.
One build type, one component
rwclean --jre -b c:\rwav -a clean-all -t 12s -p tools
Deletes all of the tools 12s build artifacts, including the buildspec, from the c:\rwav buildspace. The --jre argument specifies that the RCB-installed JRE will be used.
One build type, two components
rwclean -b c:\rwav -a clean-examples -t 8d -p tools
Deletes the 8d build artifacts for the Essential Tools Module examples. The absence of the --jre argument assumes that the PATH environment variable points to a JRE location.
Two build types, two components
rwclean -b c:\rwav -a clean-examples
-t 12s 15s -p tools net
Deletes the example artifacts for these builds in this order: 12s tools, then 12s net, then 15s tools, then 15s net. The absence of the --jre argument assumes that the PATH environment variable points to a JRE location.