Skip to content

Commit a3eae67

Browse files
committed
[codelite-make] Need to make working dir first in custom build
fixes: eranif#1892
1 parent 757cc23 commit a3eae67

File tree

3 files changed

+24
-20
lines changed

3 files changed

+24
-20
lines changed

Plugin/custombuildrequest.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,23 @@
2222
//
2323
//////////////////////////////////////////////////////////////////////////////
2424
//////////////////////////////////////////////////////////////////////////////
25-
#include <wx/app.h>
26-
#include <wx/log.h>
27-
#include "buildmanager.h"
28-
#include "event_notifier.h"
2925
#include "asyncprocess.h"
30-
#include "imanager.h"
31-
#include <wx/ffile.h>
32-
#include "environmentconfig.h"
33-
#include "globals.h"
34-
#include "dirsaver.h"
3526
#include "build_settings_config.h"
27+
#include "buildmanager.h"
28+
#include "cl_command_event.h"
3629
#include "compiler.h"
3730
#include "custombuildrequest.h"
38-
#include "workspace.h"
39-
#include "plugin.h"
31+
#include "dirsaver.h"
32+
#include "environmentconfig.h"
33+
#include "event_notifier.h"
34+
#include "globals.h"
35+
#include "imanager.h"
4036
#include "macros.h"
41-
#include "cl_command_event.h"
37+
#include "plugin.h"
38+
#include "workspace.h"
39+
#include <wx/app.h>
40+
#include <wx/ffile.h>
41+
#include <wx/log.h>
4242

4343
#ifdef __WXMSW__
4444
#define ECHO_CMD wxT("@echo ")
@@ -91,7 +91,7 @@ void CustomBuildRequest::Process(IManager* manager)
9191
BuildConfigPtr bldConf = w->GetProjBuildConf(m_info.GetProject(), m_info.GetConfiguration());
9292
if(!bldConf) {
9393
wxLogMessage(wxString::Format(wxT("Failed to find build configuration for project '%s' and configuration '%s'"),
94-
m_info.GetProject().c_str(), m_info.GetConfiguration().c_str()));
94+
m_info.GetProject().c_str(), m_info.GetConfiguration().c_str()));
9595
return;
9696
}
9797

@@ -227,8 +227,8 @@ void CustomBuildRequest::Process(IManager* manager)
227227
}
228228
}
229229

230-
bool CustomBuildRequest::DoUpdateCommand(
231-
IManager* manager, wxString& cmd, ProjectPtr proj, BuildConfigPtr bldConf, bool isClean)
230+
bool CustomBuildRequest::DoUpdateCommand(IManager* manager, wxString& cmd, ProjectPtr proj, BuildConfigPtr bldConf,
231+
bool isClean)
232232
{
233233
BuildCommandList preBuildCmds, postBuildCmds;
234234
wxArrayString pre, post;

codelite_make/cl_make_generator_app.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,19 @@ bool clMakeGeneratorApp::OnInit()
117117
<< " is using a custom build - will not generate makefile");
118118
Notice(wxString() << "Instead, here is the command line to use:");
119119
wxString command;
120+
wxString workingDirectory = MacroManager::Instance()->Expand(
121+
bldConf->GetCustomBuildWorkingDir(), NULL, m_project, bldConf->GetName());
122+
if(wxFileName::DirExists(workingDirectory) == false) {
123+
Info(wxString() << "-- Creating build directory: " << workingDirectory);
124+
wxFileName::Mkdir(workingDirectory, wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL);
125+
}
120126
command << "cd "
121-
<< MacroManager::Instance()->Expand(
122-
bldConf->GetCustomBuildWorkingDir(), NULL, m_project, bldConf->GetName())
127+
<< workingDirectory
123128
<< " && "
124129
<< MacroManager::Instance()->Expand(bldConf->GetCustomBuildCmd(), NULL, m_project, bldConf->GetName());
125130
Out(command);
126131
if(m_executeCommand) {
127132
CallAfter(&clMakeGeneratorApp::DoExecCommand, command);
128-
129133
} else {
130134
CallAfter(&clMakeGeneratorApp::DoExitApp);
131135
}

codelite_make/codelite_make.workspace

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
<Environment/>
1010
<Project Name="codelite_make" ConfigName="Debug"/>
1111
</WorkspaceConfiguration>
12-
<WorkspaceConfiguration Name="Release" Selected="yes">
12+
<WorkspaceConfiguration Name="Release" Selected="no">
1313
<Environment/>
1414
<Project Name="codelite_make" ConfigName="Release"/>
1515
</WorkspaceConfiguration>
16-
<WorkspaceConfiguration Name="Debug_Linux" Selected="no">
16+
<WorkspaceConfiguration Name="Debug_Linux" Selected="yes">
1717
<Environment/>
1818
<Project Name="codelite_make" ConfigName="Debug_Linux"/>
1919
</WorkspaceConfiguration>

0 commit comments

Comments
 (0)