Bug 413306

Summary: Build Plugin: wrong effective working directory if kate working dir is not path of .kateproject file
Product: [Applications] kate Reporter: Markus Pister <info>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: VERIFIED FIXED    
Severity: normal CC: christoph, kare.sars
Priority: NOR    
Version First Reported In: Git   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Markus Pister 2019-10-22 09:38:55 UTC
SUMMARY
When using target settings imported from the kate project specification, the kate working directory seems to be used instead of the one specified in the project specification.

In my setup, the make file is located in the same folder as the .kateproject file. 
Thus I specified 
    "directory": "."
in the build section of the kate project file.
Trying to build fails because the make file is not found.
Patching the build command to print $PWD shows that kate's working dir is used.


STEPS TO REPRODUCE
1. Prepare kate build directory as described in https://kate-editor.org/build-it/
2. Open kate such that its working dir is not the git clone's top-level dir (e.g. using krunner or the main KDE menu)
3. Open an arbitrary file from the kate git clone
4. Try to build using build plugin

OBSERVED RESULT
The build fails and the build output window shows the following content:
> make: *** No targets specified and no makefile found.  Stop.

EXPECTED RESULT
The build process starts and succeeds.


SOFTWARE/OS VERSIONS

Linux/KDE Plasma: openSUSE Tumbleweed 20190814
KDE Plasma Version: 
KDE Frameworks Version: 5.60.0
Qt Version: Qt 5.13.0 (built against 5.13.0)
Comment 1 Christoph Cullmann 2019-11-02 20:02:13 UTC
Kåre, should we alter the code to make relative paths from .kateproject absolute in relation to the project file location?
Comment 2 Kåre Särs 2019-11-02 20:20:55 UTC
Christoph,

Yes, I think that is the right solution.
Comment 3 Christoph Cullmann 2019-11-04 06:31:35 UTC
Git commit 98a6cb9bec29c90e96ae705f29ad903ef2287ee9 by Christoph Cullmann.
Committed on 04/11/2019 at 06:30.
Pushed by cullmann into branch 'master'.

handle build path as relative to project path

M  +7    -1    addons/katebuild-plugin/plugin_katebuild.cpp

https://invent.kde.org/kde/kate/commit/98a6cb9bec29c90e96ae705f29ad903ef2287ee9
Comment 4 Christoph Cullmann 2019-11-04 06:31:38 UTC
Git commit 98a6cb9bec29c90e96ae705f29ad903ef2287ee9 by Christoph Cullmann.
Committed on 04/11/2019 at 06:30.
Pushed by scmsync into branch 'master'.

handle build path as relative to project path

M  +7    -1    addons/katebuild-plugin/plugin_katebuild.cpp

https://commits.kde.org/kate/98a6cb9bec29c90e96ae705f29ad903ef2287ee9
Comment 5 Markus Pister 2019-11-05 05:47:48 UTC
Just tried it out with the current master version. Works perfect, thx for the fix!