Skip to content

Commit

Permalink
(CARGO): use --all-features in cargo metadata
Browse files Browse the repository at this point in the history
closes #651
  • Loading branch information
matklad committed Sep 5, 2016
1 parent 67d2e7f commit ecce3fa
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/main/kotlin/org/rust/cargo/commands/Cargo.kt
Expand Up @@ -46,7 +46,12 @@ class Cargo(
*/
@Throws(ExecutionException::class)
fun fullProjectDescription(listener: ProcessListener? = null): CargoProjectDescription {
val output = metadataCommandline.execute(listener)
val hasAllFeatures = "--all-features" in generalCommand("metadata", listOf("--help")).execute().stdout
val command = generalCommand("metadata", listOf("--verbose", "--format-version", "1")).apply {
if (hasAllFeatures) addParameter("--all-features")
}

val output = command.execute(listener)
val rawData = parse(output.stdout)
val projectDescriptionData = CargoMetadata.clean(rawData)
return CargoProjectDescription.deserialize(projectDescriptionData)
Expand Down Expand Up @@ -76,9 +81,6 @@ class Cargo(
.withEnvironment(CargoConstants.RUSTC_ENV_VAR, pathToRustExecutable)
.withEnvironment(environmentVariables)

private val metadataCommandline: GeneralCommandLine get() =
generalCommand("metadata", listOf("--verbose", "--format-version", "1"))

private fun rustfmtCommandline(filePath: String) =
generalCommand("fmt").withParameters("--", "--write-mode=overwrite", "--skip-children", filePath)

Expand Down

0 comments on commit ecce3fa

Please sign in to comment.