From: Eran I. <no...@so...> - 2014-01-10 11:41:00
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "codelite". The branch, master has been updated via 5c7e4747d0d4e8d4b31884d1cc69273fd32e9733 (commit) via 9e1d381a8c2a693880bb50f2ed9ca9e2ef9f1b13 (commit) via f2e94071f3a714ae463c6486016f972e8ce05bba (commit) from 01e9ad1445f85649660e086e0c53ead90d453f4e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://sourceforge.net/p/codelite/codelitegit/ci/5c7e4747d0d4e8d4b31884d1cc69273fd32e9733 commit 5c7e4747d0d4e8d4b31884d1cc69273fd32e9733 Author: Eran <era...@gm...> Date: Fri Jan 10 13:40:40 2014 +0200 Add dependency to sqlite to CMakePlugin OSX: Include CMake plugin diff --git a/CMakePlugin/CMakeLists.txt b/CMakePlugin/CMakeLists.txt index d4be049..d11720c 100644 --- a/CMakePlugin/CMakeLists.txt +++ b/CMakePlugin/CMakeLists.txt @@ -30,6 +30,7 @@ include_directories( # Define some macros about DLL add_definitions(-DWXUSINGDLL_CL) add_definitions(-DWXUSINGDLL_SDK) +add_definitions(-DWXUSINGDLL_SDK) # Only with precompiled headers if (USE_PCH) @@ -54,7 +55,8 @@ target_link_libraries(${PLUGIN_NAME} -L"${CL_LIBPATH}" -llibcodelite -lplugin - + -lwxsqlite3 + -lsqlite3lib ) # The plugin library is required diff --git a/CMakePlugin/CMakePlugin.project b/CMakePlugin/CMakePlugin.project index 8aca785..1a3ea17 100644 --- a/CMakePlugin/CMakePlugin.project +++ b/CMakePlugin/CMakePlugin.project @@ -20,6 +20,7 @@ <File Name="CMake.cpp"/> <File Name="CMakeSettingsManager.cpp"/> <File Name="CMakeParser.cpp"/> + <File Name="CMakeLists.txt"/> </VirtualDirectory> <VirtualDirectory Name="include"> <File Name="CMakePlugin.h"/> diff --git a/Gizmos/Gizmos.project b/Gizmos/Gizmos.project index 864e4b3..74d92a9 100644 --- a/Gizmos/Gizmos.project +++ b/Gizmos/Gizmos.project @@ -12,6 +12,7 @@ <File Name="newplugindata.h"/> <File Name="new_class_dlg_data.h"/> <File Name="new_class_dlg_data.cpp"/> + <File Name="CMakeLists.txt"/> </VirtualDirectory> <VirtualDirectory Name="Wizard"> <File Name="PluginWizard.h"/> diff --git a/Runtime/make_mac_bundle.sh b/Runtime/make_mac_bundle.sh index 7170d15..fbe5143 100755 --- a/Runtime/make_mac_bundle.sh +++ b/Runtime/make_mac_bundle.sh @@ -218,10 +218,10 @@ cp ../lib/cppchecker.dylib ./codelite.app/Contents/SharedSupport/plugins/ cp ../lib/MacBundler.dylib ./codelite.app/Contents/SharedSupport/plugins/ cp ../lib/DatabaseExplorer.dylib ./codelite.app/Contents/SharedSupport/plugins/ cp ../lib/Tweaks.dylib ./codelite.app/Contents/SharedSupport/plugins/ -##cp ../lib/CallGraph.dylib ./codelite.app/Contents/SharedSupport/plugins/ cp ../lib/git.dylib ./codelite.app/Contents/SharedSupport/plugins/ cp ../lib/ZoomNavigator.dylib ./codelite.app/Contents/SharedSupport/plugins/ cp ../lib/SFTP.dylib ./codelite.app/Contents/SharedSupport/plugins/ +cp ../lib/CMakePlugin.dylib ./codelite.app/Contents/SharedSupport/plugins/ if [ -f ../lib/wxcrafter.dylib ]; then cp ../lib/wxcrafter.dylib ./codelite.app/Contents/SharedSupport/plugins/ https://sourceforge.net/p/codelite/codelitegit/ci/9e1d381a8c2a693880bb50f2ed9ca9e2ef9f1b13 commit 9e1d381a8c2a693880bb50f2ed9ca9e2ef9f1b13 Author: Eran <era...@gm...> Date: Fri Jan 10 13:32:02 2014 +0200 Updated CMakePlugin to the latest from GitHub diff --git a/CMakePlugin/CMake.cpp b/CMakePlugin/CMake.cpp new file mode 100644 index 0000000..0d29802 --- /dev/null +++ b/CMakePlugin/CMake.cpp @@ -0,0 +1,501 @@ +/* ************************************************************************ */ +/* */ +/* CMakePlugin for Codelite */ +/* Copyright (C) 2013 JiÅÃ Fatka <nt...@gm...> */ +/* */ +/* This program is free software: you can redistribute it and/or modify */ +/* it under the terms of the GNU General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or */ +/* (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* ************************************************************************ */ + +/* ************************************************************************ */ +/* INCLUDES */ +/* ************************************************************************ */ + +// Declaration +#include "CMake.h" + +// C++ +#include <utility> + +// wxWidgets +#include <wx/regex.h> +#include <wx/event.h> +#include <wx/thread.h> +#include <wx/scopedptr.h> + +// Codelite +#include "procutils.h" +#include "workspace.h" +#include "globals.h" +#include "file_logger.h" + +/* ************************************************************************ */ +/* FUNCTIONS */ +/* ************************************************************************ */ + +/** + * @brief Joins array of strings into single string. + * + * @param array Input array. + * + * @return Result string. + */ +static wxString CreateHtml(const wxArrayString& array) +{ + wxString result; + + for (wxArrayString::const_iterator it = array.begin(), ite = array.end(); it != ite; ++it) { + if (it != array.begin()) { + result += "<br />"; + } + wxString esc = *it; + // Escape + esc.Replace("<", "<"); + esc.Replace(">", ">"); + result += esc; + } + + return result; +} + +/* ************************************************************************ */ +/* CLASSES */ +/* ************************************************************************ */ + +CMake::CMake(const wxFileName& path) + : m_path(path) + , m_version("?") + , m_dbFileName(wxStandardPaths::Get().GetUserDataDir(), "cmake.db") +{ + // Prepare database + PrepareDatabase(); +} + +/* ************************************************************************ */ + +wxArrayString +CMake::GetVersions() +{ + static const wxString VERSIONS[] = { + "2.8.11", + "2.8.10", + "2.8.9", + "2.8.8", + "2.8.7", + "2.8.6", + "2.8.5", + "2.8.4", + "2.8.3", + "2.8.2", + "2.8.1", + "2.8.0", + "2.6.4", + "2.6.3", + "2.6.2", + "2.6.1", + "2.6.0", + "2.4.8", + "2.4.7", + "2.4.6", + "2.4.5", + "2.4.4", + "2.4.3", + "2.2.3", + "2.0.6", + "1.8.3" + }; + + return wxArrayString(sizeof(VERSIONS) / sizeof(VERSIONS[0]), VERSIONS); +} + +/* ************************************************************************ */ + +bool +CMake::IsOk() const +{ + wxArrayString output; + ProcUtils::SafeExecuteCommand(GetPath().GetFullPath() + " -h", output); + + // SafeExecuteCommand doesn't return status code so the only way + // to test the success is the output emptiness. + return !output.empty(); +} + +/* ************************************************************************ */ + +bool +CMake::LoadData(bool force, LoadNotifier* notifier) +{ + // Clear old data + m_version.clear(); + m_commands.clear(); + m_modules.clear(); + m_properties.clear(); + m_variables.clear(); + + if (notifier) { + notifier->Start(); + } + + // Load data from database + if (!force && m_dbInitialized && LoadFromDatabase()) { + // Loading is done + if (notifier) { + notifier->Done(); + } + return true; + } + + // Unable to use CMake + if (!IsOk()) + return false; + + // Request to stop + if (notifier && notifier->RequestStop()) { + return false; + } + + // Get cmake program path + const wxString program = GetPath().GetFullPath(); + + // Version + { + wxArrayString output; + ProcUtils::SafeExecuteCommand(program + " --version", output); + + // Unable to find version + if (!output.IsEmpty()) { + const wxString& versionLine = output[0]; + wxRegEx expression("cmake version (.+)"); + + if (expression.IsValid() && expression.Matches(versionLine)) { + m_version = expression.GetMatch(versionLine, 1).Trim().Trim(false); + } + } + } + + // Request to stop + if (notifier && notifier->RequestStop()) { + return false; + } + + // Load data + LoadFromCMake(notifier); + + // Request to stop + if (notifier && notifier->RequestStop()) { + return false; + } + + // Database is open so we can store result into database + if (m_dbInitialized) { + StoreIntoDatabase(); + } + + // Loading is done + if (notifier) { + notifier->Update(100); + notifier->Done(); + } + + return true; +} + +/* ************************************************************************ */ + +void +CMake::PrepareDatabase() +{ + m_dbInitialized = false; + + try { + + /// Open database only for initializing + wxSQLite3Database db; + + // Try to open database + db.Open(GetDatabaseFileName().GetFullPath()); + + // Not opened + if (!db.IsOpen()) + return; + + // Create tables + db.ExecuteUpdate("CREATE TABLE IF NOT EXISTS commands (name TEXT, desc TEXT)"); + db.ExecuteUpdate("CREATE TABLE IF NOT EXISTS modules (name TEXT, desc TEXT)"); + db.ExecuteUpdate("CREATE TABLE IF NOT EXISTS properties (name TEXT, desc TEXT)"); + db.ExecuteUpdate("CREATE TABLE IF NOT EXISTS variables (name TEXT, desc TEXT)"); + db.ExecuteUpdate("CREATE TABLE IF NOT EXISTS strings (name TEXT, desc TEXT)"); + + // Create indices + db.ExecuteUpdate("CREATE UNIQUE INDEX IF NOT EXISTS commands_idx ON commands(name)"); + db.ExecuteUpdate("CREATE UNIQUE INDEX IF NOT EXISTS modules_idx ON modules(name)"); + db.ExecuteUpdate("CREATE UNIQUE INDEX IF NOT EXISTS properties_idx ON properties(name)"); + db.ExecuteUpdate("CREATE UNIQUE INDEX IF NOT EXISTS variables_idx ON variables(name)"); + db.ExecuteUpdate("CREATE UNIQUE INDEX IF NOT EXISTS strings_idx ON strings(name)"); + + // Everything is OK + m_dbInitialized = true; + + } catch (const wxSQLite3Exception& e) { + // Unable to use SQLite database + CL_ERROR("CMake DoPrepareDatabase error: %s", e.GetMessage()); + } +} + +/* ************************************************************************ */ + +bool +CMake::LoadFromCMake(LoadNotifier* notifier) +{ + // Possible types + static const std::pair<wxString, HelpMap*> types[] = { + std::make_pair("command", &m_commands), + std::make_pair("module", &m_modules), + std::make_pair("property", &m_properties), + std::make_pair("variable", &m_variables) + // make_pair("policy", &m_policies) + }; + static const int typesCount = sizeof(types) / sizeof(types[0]); + static const int PROGRESS = 90; + static const int STEP = PROGRESS / typesCount; + + // Foreach all types + for (int i = 0; i < typesCount; ++i) { + // Notify?? + if (notifier) { + // Stop request? + if (notifier->RequestStop()) + return false; + + notifier->Update(STEP * i); + } + + // Load + LoadList(types[i].first, *types[i].second, notifier, STEP); + } + + return true; +} + +/* ************************************************************************ */ + +bool +CMake::LoadFromDatabase() +{ + if (!m_dbInitialized) { + return false; + } + + try + { + /// Open database only for reading + wxSQLite3Database db; + + // Open + db.Open(GetDatabaseFileName().GetFullPath()); + + // Not opened + if (!db.IsOpen()) + return false; + + // Strings - Version + { + wxSQLite3ResultSet res = db.ExecuteQuery("SELECT desc FROM strings WHERE name = 'version'"); + if (res.NextRow()) { + m_version = res.GetAsString(0); + } + } + + // No data stored + if (m_version.IsEmpty()) + return false; + + // Commands + { + wxSQLite3ResultSet res = db.ExecuteQuery("SELECT name, desc FROM commands"); + while (res.NextRow()) { + m_commands[res.GetAsString(0)] = res.GetAsString(1); + } + } + + // Modules + { + wxSQLite3ResultSet res = db.ExecuteQuery("SELECT name, desc FROM modules"); + while (res.NextRow()) { + m_modules[res.GetAsString(0)] = res.GetAsString(1); + } + } + + // Properties + { + wxSQLite3ResultSet res = db.ExecuteQuery("SELECT name, desc FROM properties"); + while (res.NextRow()) { + m_properties[res.GetAsString(0)] = res.GetAsString(1); + } + } + + // Variables + { + wxSQLite3ResultSet res = db.ExecuteQuery("SELECT name, desc FROM variables"); + while (res.NextRow()) { + m_variables[res.GetAsString(0)] = res.GetAsString(1); + } + } + + } catch (const wxSQLite3Exception& e) { + CL_ERROR("Error occured while loading data from CMake database: %s", e.GetMessage()); + } + + // Everything is loaded + return true; +} + +/* ************************************************************************ */ + +void +CMake::StoreIntoDatabase() +{ + if (!m_dbInitialized) { + CL_WARNING("CMake: can't store data into database. Database was not initialized properly"); + return; + } + + try + { + /// Open database only for writing + wxSQLite3Database db; + + // Open + db.Open(GetDatabaseFileName().GetFullPath()); + + // Not opened + if (!db.IsOpen()) + return; + + db.Begin(); + + // Commands + { + db.ExecuteUpdate("DELETE FROM commands"); + wxSQLite3Statement stmt = db.PrepareStatement("INSERT INTO commands (name, desc) VALUES(?, ?)"); + for (HelpMap::const_iterator it = m_commands.begin(), ite = m_commands.end(); it != ite; ++it) { + stmt.Bind(1, it->first); + stmt.Bind(2, it->second); + stmt.ExecuteUpdate(); + } + } + + // Modules + { + db.ExecuteUpdate("DELETE FROM modules"); + wxSQLite3Statement stmt = db.PrepareStatement("INSERT INTO modules (name, desc) VALUES(?, ?)"); + for (HelpMap::const_iterator it = m_modules.begin(), ite = m_modules.end(); it != ite; ++it) { ... 25432 lines suppressed ... hooks/post-receive -- codelite |