cordova build is two stages. prepare is pure file work in Node.js 2,131 : it restores missing platforms and plugins from package.json, merges config.xml into the platform, copies www and writes native resources. compile hands the finished Gradle 19,597 project to gradlew (Gradle). --verbose shows each prepare step:
cordova prepare android --verboseNo scripts found for hook "before_prepare". ... Generating platform-specific config.xml from defaults for android at .../res/xml/config.xml Merging project's config.xml into platform-specific android config.xml ... Merging and updating files from [www, platforms/android/platform_www] to .../assets/www Wrote out android application name "BookNest" to .../res/values/cdv_strings.xml ... android-versionCode not found in config.xml. Generating a code based on version in config.xml (1.0.0): 10000 This app does not have launcher icons defined ... No scripts found for hook "after_prepare".
The platform's config.xml is regenerated from defaults plus your file and every plugin's <config-file>, so an edit inside platforms/ is lost on the next prepare. The www copy merges platform_www (which holds cordova.js) with your files, and the app name, versionCode (1.0.0 becomes 10000) and icons come from config.xml (www, index.html, config.xml and package.json and Icons).
The hook lines are the extension points. A Node script registered in config.xml, such as <hook type="before_prepare" src="scripts/build-css.js" />, runs at that moment; before_ and after_ hooks exist for prepare, compile, build, run and plugin and platform changes. A failing hook aborts the command.