This patch refactors the cargo-build-system builder code to correctly build imported Rust crates. Specifically the changes: * Do not rely on a Cargo.lock presence to determine installation. Cargo will automatically create the file at its first invocation, so instead we check the manifest for any executable targets before attempting an installation * Do not attempt to modify the Cargo.toml file. There are many system specific package in crates.io (e.g. for Windows, Redox, Fuschia, WASM, etc.) and attempting to keep up with what crates must be patched out is futile. * The build phases will honor a skip-build? flag which allows for short-circuiting for optional packages which require nightly features or cannot be built for the current platform. Changes which still need to be done: * Update the host-side code to expand transitive inputs: cargo requires that all transitive crate dependencies are present in its (vendored) index, but doing so by hand in the package definitions will become unwieldy. * Update the host-side code to detect any "circular" dependencies which can result from a naive import Unfortunately there isn't a good way to test this patch at the moment. Importing a non-trivial crate requires a lot of manual resolution, especially with the points above remaining unimplemented. If someone would really like to see the input package definitions I was using to test, I'd be happy to share, though I'd advise that it's pretty hacked up for my own convoluted testing at the moment. —Ivan