[gnome-builder] cargo: handle project file other than Cargo.toml
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] cargo: handle project file other than Cargo.toml
- Date: Mon, 21 Jan 2019 07:04:21 +0000 (UTC)
commit d980a0374b99f96c7ab2ef8e239079b1c8494f91
Author: Christian Hergert <chergert redhat com>
Date: Sun Jan 20 23:03:45 2019 -0800
cargo: handle project file other than Cargo.toml
This can be a directory now, which breaks the normal Cargo.toml expectation
we had previously.
Fixes #770
src/plugins/cargo/cargo_plugin.py | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/cargo/cargo_plugin.py b/src/plugins/cargo/cargo_plugin.py
index 29edab457..690725354 100644
--- a/src/plugins/cargo/cargo_plugin.py
+++ b/src/plugins/cargo/cargo_plugin.py
@@ -89,7 +89,11 @@ class CargoPipelineAddin(Ide.Object, Ide.PipelineAddin):
if type(build_system) != CargoBuildSystem:
return
- cargo_toml = build_system.props.project_file.get_path()
+ project_file = build_system.props.project_file
+ if project_file.get_basename() != 'Cargo.toml':
+ project_file = project_file.get_child('Cargo.toml')
+
+ cargo_toml = project_file.get_path()
config = pipeline.get_config()
builddir = pipeline.get_builddir()
runtime = config.get_runtime()
@@ -227,7 +231,10 @@ class CargoDependencyUpdater(Ide.Object, Ide.DependencyUpdater):
config = config_manager.get_current()
cargo = locate_cargo_from_config(config)
- cargo_toml = build_system.props.project_file.get_path()
+ project_file = build_system.props.project_file
+ if project_file.get_basename() != 'Cargo.toml':
+ project_file = project_file.get_child('Cargo.toml')
+ cargo_toml = project_file.get_path()
launcher = pipeline.create_launcher()
launcher.setenv('CARGO_TARGET_DIR', pipeline.get_builddir(), True)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]