1
1
//////////////////////////////////////////////////////////////////////////////
2
2
//////////////////////////////////////////////////////////////////////////////
4
// copyright : (C) 2008 by Eran Ifrah
5
// file name : clean_request.cpp
4
// copyright : (C) 2008 by Eran Ifrah
5
// file name : clean_request.cpp
7
7
// -------------------------------------------------------------------------
10
// / __ \ | | | | (_) |
11
// | / \/ ___ __| | ___| | _| |_ ___
12
// | | / _ \ / _ |/ _ \ | | | __/ _ )
13
// | \__/\ (_) | (_| | __/ |___| | || __/
14
// \____/\___/ \__,_|\___\_____/_|\__\___|
18
// This program is free software; you can redistribute it and/or modify
19
// it under the terms of the GNU General Public License as published by
20
// the Free Software Foundation; either version 2 of the License, or
21
// (at your option) any later version.
10
// / __ \ | | | | (_) |
11
// | / \/ ___ __| | ___| | _| |_ ___
12
// | | / _ \ / _ |/ _ \ | | | __/ _ )
13
// | \__/\ (_) | (_| | __/ |___| | || __/
14
// \____/\___/ \__,_|\___\_____/_|\__\___|
18
// This program is free software; you can redistribute it and/or modify
19
// it under the terms of the GNU General Public License as published by
20
// the Free Software Foundation; either version 2 of the License, or
21
// (at your option) any later version.
23
23
//////////////////////////////////////////////////////////////////////////////
24
24
//////////////////////////////////////////////////////////////////////////////
25
25
#include "build_settings_config.h"
57
BuildSettingsConfig *bsc(manager ? manager->GetBuildSettingsConfigManager() : BuildSettingsConfigST::Get());
58
BuildManager *bm(manager ? manager->GetBuildManager() : BuildManagerST::Get());
59
Workspace *w(manager ? manager->GetWorkspace() : WorkspaceST::Get());
58
BuildSettingsConfig *bsc(manager ? manager->GetBuildSettingsConfigManager() : BuildSettingsConfigST::Get());
59
BuildManager * bm(manager ? manager->GetBuildManager() : BuildManagerST::Get());
60
Workspace * w(manager ? manager->GetWorkspace() : WorkspaceST::Get());
61
wxApp * app = manager ? manager->GetTheApp() : wxTheApp;
61
64
ProjectPtr proj = w->FindProjectByName(m_info.GetProject(), errMsg);
63
66
AppendLine(wxT("Cant find project: ") + m_info.GetProject());
70
wxString pname (proj->GetName());
68
72
BuilderPtr builder = bm->GetBuilder(wxT("GNU makefile for g++/gcc"));
69
73
if (m_info.GetProjectOnly()) {
70
74
cmd = builder->GetPOCleanCommand(m_info.GetProject(), m_info.GetConfiguration());
102
// Notify plugins that a compile process is going to start
103
wxCommandEvent event(wxEVT_BUILD_STARTING);
104
event.SetClientData((void*)&pname);
105
event.SetString( m_info.GetConfiguration() );
107
if (app->ProcessEvent(event)) {
109
// the build is being handled by some plugin, no need to build it
110
// using the standard way
100
116
//expand the variables of the command
107
123
DoSetWorkingDirectory(proj, false, false);
109
125
if (m_info.GetProjectOnly() ) {
110
126
//need to change directory to project dir
111
127
wxSetWorkingDirectory(proj->GetFileName().GetPath());
113
129
//print the build command
114
130
AppendLine(cmd + wxT("\n"));
116
// print the prefix message of the build start. This is important since the parser relies
132
// print the prefix message of the build start. This is important since the parser relies
118
134
if(m_info.GetProjectOnly()){
119
135
wxString configName(m_info.GetConfiguration());
121
137
//also, send another message to the main frame, indicating which project is being built
122
138
//and what configuration
125
141
text << wxT("----------\n");
126
142
AppendLine(text);
129
145
//apply environment settings
130
146
EnvironmentConfig::Instance()->ApplyEnv( &om );
132
148
if (m_proc->Start() == 0) {
134
150
//remove environment settings applied
135
151
EnvironmentConfig::Instance()->UnApplyEnv();
137
153
wxString message;
138
154
message << wxT("Failed to start clean process, command: ") << cmd << wxT(", process terminated with exit code: 0");
139
155
AppendLine(message);