1 file changed
+15
-9
+15
-9
@@ -186,15 +186,21 @@ impl CrateConfig {
|
|||||||
|
|
||||||
let manifest = cargo_toml::Manifest::from_path(&cargo_def).unwrap();
|
let manifest = cargo_toml::Manifest::from_path(&cargo_def).unwrap();
|
||||||
|
|
||||||
// We just assume they're using a 'main.rs'
|
let output_filename = {
|
||||||
// Anyway, we've already parsed the manifest, so it should be easy to change the type
|
match &manifest.package.as_ref().unwrap().default_run {
|
||||||
let output_filename = manifest
|
Some(default_run_target) => {
|
||||||
.bin
|
default_run_target.to_owned()
|
||||||
.first()
|
},
|
||||||
.or(manifest.lib.as_ref())
|
None => {
|
||||||
.and_then(|product| product.name.clone())
|
manifest.bin.iter().find(|b| b.name == manifest.package.as_ref().map(|pkg| pkg.name.clone()))
|
||||||
.or_else(|| manifest.package.as_ref().map(|pkg| pkg.name.clone()))
|
.or(manifest.bin.iter().find(|b| b.path == Some("src/main.rs".to_owned())))
|
||||||
.expect("No lib found from cargo metadata");
|
.or(manifest.bin.first())
|
||||||
|
.or(manifest.lib.as_ref())
|
||||||
|
.and_then(|prod| prod.name.clone())
|
||||||
|
.expect("No executable or library found from cargo metadata.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
let executable = ExecutableType::Binary(output_filename);
|
let executable = ExecutableType::Binary(output_filename);
|
||||||
|
|
||||||
let release = false;
|
let release = false;
|
||||||
|
|||||||
Reference in new issue
Block a user