[gnome-builder] context: fix access to project file in plugins



commit 3bce918f27a87c134e14debca05f012bbd60f046
Author: Christian Hergert <chergert redhat com>
Date:   Thu Jan 10 12:44:00 2019 -0800

    context: fix access to project file in plugins

 src/plugins/cargo/cargo_plugin.py   | 6 +-----
 src/plugins/gradle/gradle_plugin.py | 4 ++--
 src/plugins/maven/maven_plugin.py   | 2 +-
 3 files changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/src/plugins/cargo/cargo_plugin.py b/src/plugins/cargo/cargo_plugin.py
index 13c377556..7e34c1cd7 100644
--- a/src/plugins/cargo/cargo_plugin.py
+++ b/src/plugins/cargo/cargo_plugin.py
@@ -172,11 +172,7 @@ class CargoBuildTarget(Ide.Object, Ide.BuildTarget):
 
         # Pass the Cargo.toml path so that we don't
         # need to run from the project directory.
-        project_file = context.get_project_file()
-        if project_file.get_basename() == 'Cargo.toml':
-            cargo_toml = project_file.get_path()
-        else:
-            cargo_toml = project_file.get_child('Cargo.toml')
+        cargo_toml = context.ref_workdir().get_child('Cargo.toml')
 
         return [cargo, 'run', '--manifest-path', cargo_toml]
 
diff --git a/src/plugins/gradle/gradle_plugin.py b/src/plugins/gradle/gradle_plugin.py
index 9bf1ada92..7ea71c430 100755
--- a/src/plugins/gradle/gradle_plugin.py
+++ b/src/plugins/gradle/gradle_plugin.py
@@ -114,12 +114,12 @@ class GradleBuildTarget(Ide.Object, Ide.BuildTarget):
 
     def do_get_cwd(self):
         context = self.get_context()
-        project_file = context.get_project_file()
+        project_file = Ide.BuildSystem.from_context(context).project_file
         return project_file.get_parent().get_path()
 
     def do_get_argv(self):
         context = self.get_context()
-        project_file = context.get_project_file()
+        project_file = Ide.BuildSystem.from_context(context).project_file
         path = project_file.get_parent().get_path()
         return [path + "/gradlew", "run"]
 
diff --git a/src/plugins/maven/maven_plugin.py b/src/plugins/maven/maven_plugin.py
index c0c7db4b8..f49fca56d 100755
--- a/src/plugins/maven/maven_plugin.py
+++ b/src/plugins/maven/maven_plugin.py
@@ -116,7 +116,7 @@ class MavenBuildTarget(Ide.Object, Ide.BuildTarget):
 
     def do_get_cwd(self):
         context = self.get_context()
-        project_file = context.get_project_file()
+        project_file = Ide.BuildSystem.from_context(context).project_file
         return project_file.get_parent().get_path()
 
     def do_get_argv(self):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]