How Craftsman Bootstrap Works
For those interested, the boostrap works like this:
Bootstrap Startup
- When the <cmbootstrap> task is found in the bootstrap.xml file, bootstrap is executed. It will only execute once. So if the bootstrap detects the execution of another bootstrap process, it will simply skip execution. This allows you to build complex Ant build.xml files without having to worry about bootstrap stepping on itself.
- Upon starting, the bootstrap loads the properties from the local environment. This includes the System environment, the build.properties file, and the craftsman.properties file, where the files are in the current working directory.
- Bootstrap looks in the settings from these three sources for a Craftsman home property (either CRAFTSMAN_HOME in the environment or craftsman.home in the properties files).
- if bootstrap finds the Craftsman home, it attempts to load Craftsman from that directory. If it succeeds, exectuion is finished. If it fails and starts with the next stage.
- if bootstrap does not find a Craftsman home, it goes to the next stage.
Bootstrap Installation Wizard
- With no Craftsman home (or no valid Craftsman home), bootstrap asks if Craftsman is installed on the local machine. If answered yes, bootstrap prompts the user for an alternate location. This is to catch situations like Eclipse, where environment settings may not automatically be exposed to the Ant process. Bootstrap will try to load from the specified location. If it succeeds, it will load craftsman and bootstrap execution is finished. If it doesn't succeed, it will prompt for another location until it succeeds or the user enters nothing.
- If the user answers no to whether there is another Craftsman installation or if bootstrap is unable to find a vallid one, bootstrap will then ask the use if they want to install Craftsman. If the user answers no, the build aborts and the project will not be built. The user will be prompted by bootstrap again the next time they try to build. If they answer yes, execution continues.
- Bootstrap will now ask for a location to install Craftsman to. This will be a Craftsman home directory when finished. If the directory specified doesn't exist, the bootstrap will create it.
- Bootstrap will now download an installation manifest. This file contains all the current modules that make up craftsman. It will automatically download the core module (the module that makes up the essential components of Craftsman that allow it to function).
- After downloading the core module, bootstrap will prompt the user for whether to install any of the optional support modules. It is recommended the user answer "All" (the letter "A") at this point, as the modules are small and easily downloaded over any broadband connection. If the user does not choose "All", bootstrap will prompt the user for which modules.
- Once the user is finished downloading modules, choose "None" (the letter "N") to exit.
- After all the downloads are complete, bootstrap will attempt to load Craftsman from the downloaded components. If it fails, the build aborts. If it succeeds, bootstrap records the new location as craftsman.home in the build.properties file. The build then continues normally.