~ubuntu-branches/ubuntu/karmic/codelite/karmic

« back to all changes in this revision

Viewing changes to Plugin/clean_request.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Chow Loong Jin
  • Date: 2009-08-15 17:42:43 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20090815174243-nlb9ikgigbiybz12
Tags: 1.0.2893+dfsg-0ubuntu1
* debian/rules:
  + Tidy up get-orig-source rule
* debian/control:
  + Bump Standards-Version
  + Change Maintainer email address to @ubuntu.com
  + Drop cdbs build-dependency
* debian/copyright:
  + Update to DEP-5 format
* debian/patches/00_add-fPIC.patch:
  + Dropped, fix upstream
* Closes LP: #413992

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
//////////////////////////////////////////////////////////////////////////////
2
2
//////////////////////////////////////////////////////////////////////////////
3
3
//
4
 
// copyright            : (C) 2008 by Eran Ifrah                            
5
 
// file name            : clean_request.cpp              
6
 
//                                                                          
 
4
// copyright            : (C) 2008 by Eran Ifrah
 
5
// file name            : clean_request.cpp
 
6
//
7
7
// -------------------------------------------------------------------------
8
 
// A                                                                        
9
 
//              _____           _      _     _ _                            
10
 
//             /  __ \         | |    | |   (_) |                           
11
 
//             | /  \/ ___   __| | ___| |    _| |_ ___                      
12
 
//             | |    / _ \ / _  |/ _ \ |   | | __/ _ )                     
13
 
//             | \__/\ (_) | (_| |  __/ |___| | ||  __/                     
14
 
//              \____/\___/ \__,_|\___\_____/_|\__\___|                     
15
 
//                                                                          
16
 
//                                                  F i l e                 
17
 
//                                                                          
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.                                   
22
 
//                                                                          
 
8
// A
 
9
//              _____           _      _     _ _
 
10
//             /  __ \         | |    | |   (_) |
 
11
//             | /  \/ ___   __| | ___| |    _| |_ ___
 
12
//             | |    / _ \ / _  |/ _ \ |   | | __/ _ )
 
13
//             | \__/\ (_) | (_| |  __/ |___| | ||  __/
 
14
//              \____/\___/ \__,_|\___\_____/_|\__\___|
 
15
//
 
16
//                                                  F i l e
 
17
//
 
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.
 
22
//
23
23
//////////////////////////////////////////////////////////////////////////////
24
24
//////////////////////////////////////////////////////////////////////////////
25
25
#include "build_settings_config.h"
33
33
#include "wx/process.h"
34
34
#include "dirsaver.h"
35
35
#include "workspace.h"
 
36
#include "plugin.h"
36
37
 
37
38
CleanRequest::CleanRequest(wxEvtHandler *owner, const QueueCommand &info)
38
39
                : ShellCommand(owner, info)
51
52
        wxString cmd;
52
53
        wxString errMsg;
53
54
        StringMap om;
54
 
        
 
55
 
55
56
        SetBusy(true);
56
 
        
57
 
        BuildSettingsConfig *bsc(manager ? manager->GetBuildSettingsConfigManager() : BuildSettingsConfigST::Get());    
58
 
        BuildManager *bm(manager ? manager->GetBuildManager() : BuildManagerST::Get());
59
 
        Workspace *w(manager ? manager->GetWorkspace() : WorkspaceST::Get());
60
 
        
 
57
 
 
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;
 
62
 
 
63
 
61
64
        ProjectPtr proj = w->FindProjectByName(m_info.GetProject(), errMsg);
62
65
        if (!proj) {
63
66
                AppendLine(wxT("Cant find project: ") + m_info.GetProject());
64
67
                SetBusy(false);
65
68
                return;
66
69
        }
67
 
        
 
70
        wxString             pname (proj->GetName());
 
71
 
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());
95
99
                return;
96
100
        }
97
101
 
 
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() );
 
106
 
 
107
        if (app->ProcessEvent(event)) {
 
108
 
 
109
                // the build is being handled by some plugin, no need to build it
 
110
                // using the standard way
 
111
                SetBusy(false);
 
112
                return;
 
113
        }
98
114
        SendStartMsg();
99
115
 
100
116
        //expand the variables of the command
105
121
 
106
122
                DirSaver ds;
107
123
                DoSetWorkingDirectory(proj, false, false);
108
 
                
 
124
 
109
125
                if (m_info.GetProjectOnly() ) {
110
126
                        //need to change directory to project dir
111
127
                        wxSetWorkingDirectory(proj->GetFileName().GetPath());
112
128
                }
113
129
                //print the build command
114
130
                AppendLine(cmd + wxT("\n"));
115
 
                
116
 
                // print the prefix message of the build start. This is important since the parser relies 
117
 
                // on this message 
 
131
 
 
132
                // print the prefix message of the build start. This is important since the parser relies
 
133
                // on this message
118
134
                if(m_info.GetProjectOnly()){
119
135
                        wxString configName(m_info.GetConfiguration());
120
 
                        
 
136
 
121
137
                        //also, send another message to the main frame, indicating which project is being built
122
138
                        //and what configuration
123
139
                        wxString text;
125
141
                        text << wxT("----------\n");
126
142
                        AppendLine(text);
127
143
                }
128
 
                
 
144
 
129
145
                //apply environment settings
130
146
                EnvironmentConfig::Instance()->ApplyEnv( &om );
131
 
                
 
147
 
132
148
                if (m_proc->Start() == 0) {
133
 
                        
 
149
 
134
150
                        //remove environment settings applied
135
151
                        EnvironmentConfig::Instance()->UnApplyEnv();
136
 
                        
 
152
 
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);