Skip to content

Commit

Permalink
chore(cargo): Be explicit about the defintion file to query metadata for
Browse files Browse the repository at this point in the history
Do not rely on the working directory to contain a `Cargo.toml` file.

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
  • Loading branch information
sschuberth committed Jan 8, 2025
1 parent 37ec0b1 commit 6c7b108
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plugins/package-managers/cargo/src/main/kotlin/Cargo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ class Cargo(

override fun resolveDependencies(definitionFile: File, labels: Map<String, String>): List<ProjectAnalyzerResult> {
val workingDir = definitionFile.parentFile
val metadataProcess = CargoCommand.run(workingDir, "metadata", "--format-version=1").requireSuccess()
val metadataProcess = CargoCommand.run("metadata", "--format-version=1", "--manifest-path=$definitionFile")
.requireSuccess()
val metadata = json.decodeFromString<CargoMetadata>(metadataProcess.stdout)

val projectId = requireNotNull(metadata.resolve.root) {
Expand Down

0 comments on commit 6c7b108

Please sign in to comment.