anjuta r4085 - in trunk: . plugins/build-basic-autotools
- From: sgranjoux svn gnome org
- To: svn-commits-list gnome org
- Subject: anjuta r4085 - in trunk: . plugins/build-basic-autotools
- Date: Sat, 19 Jul 2008 09:18:04 +0000 (UTC)
Author: sgranjoux
Date: Sat Jul 19 09:18:04 2008
New Revision: 4085
URL: http://svn.gnome.org/viewvc/anjuta?rev=4085&view=rev
Log:
* plugins/build-basic-autotools/build-basic-autotools.c,
plugins/build-basic-autotools/anjuta-build-basic-autotools-plugin.glade:
Add more options for build command: parallel make, keep going on error
and keep message untranslated
Modified:
trunk/ChangeLog
trunk/plugins/build-basic-autotools/anjuta-build-basic-autotools-plugin.glade
trunk/plugins/build-basic-autotools/build-basic-autotools.c
Modified: trunk/plugins/build-basic-autotools/anjuta-build-basic-autotools-plugin.glade
==============================================================================
--- trunk/plugins/build-basic-autotools/anjuta-build-basic-autotools-plugin.glade (original)
+++ trunk/plugins/build-basic-autotools/anjuta-build-basic-autotools-plugin.glade Sat Jul 19 09:18:04 2008
@@ -144,30 +144,96 @@
<widget class="GtkWindow" id="preferences_dialog_build">
<property name="title" translatable="yes">window1</property>
<child>
- <widget class="GtkFrame" id="Build">
+ <widget class="GtkVBox" id="preferences_build_container">
<property name="visible">True</property>
- <property name="border_width">10</property>
- <property name="label_xalign">0</property>
- <property name="label_yalign">0</property>
- <property name="shadow_type">GTK_SHADOW_NONE</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
- <widget class="GtkAlignment" id="alignment1">
+ <widget class="GtkFrame" id="frame3">
<property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="left_padding">12</property>
+ <property name="border_width">10</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
- <widget class="GtkVBox" id="vbox2">
+ <widget class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="left_padding">12</property>
<child>
<widget class="GtkVBox" id="vbox3">
<property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkCheckButton" id="preferences_toggle:bool:0:0:build.parallel.make">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Run several commands at a time:</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkSpinButton" id="preferences_spin:int:1:0:build.parallel.make.job">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="xalign">1</property>
+ <property name="adjustment">4 1 30 1 10 10</property>
+ <property name="snap_to_ticks">True</property>
+ <property name="numeric">True</property>
+ <property name="wrap">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="preferences_toggle:bool:0:0:build.continue.error">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Continue on errors</property>
+ <property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="preferences_toggle:bool:1:0:build.translate.message">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Translate messages</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
<child>
<widget class="GtkCheckButton" id="preferences_toggle:bool:0:0:indicators.automatic">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="border_width">5</property>
- <property name="label" translatable="yes">Highlight build message locations in editor</property>
+ <property name="label" translatable="yes">Highlight message locations in editor</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
@@ -175,16 +241,55 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
+ <property name="position">3</property>
</packing>
</child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes"><b>Build</b></property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkFrame" id="frame2">
+ <property name="visible">True</property>
+ <property name="border_width">10</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">GTK_SHADOW_NONE</property>
+ <child>
+ <widget class="GtkAlignment" id="alignment4">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="left_padding">12</property>
+ <child>
+ <widget class="GtkVBox" id="vbox5">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
<child>
- <widget class="GtkHBox" id="hbox28">
+ <widget class="GtkHBox" id="hbox3">
<property name="visible">True</property>
+ <property name="spacing">6</property>
<child>
<widget class="GtkCheckButton" id="preferences_toggle:bool:0:0:build.install.root">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="border_width">5</property>
<property name="label" translatable="yes">Install as root:</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
@@ -210,29 +315,29 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">1</property>
</packing>
</child>
</widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
</child>
</widget>
</child>
- </widget>
- </child>
- <child>
- <widget class="GtkLabel" id="label106">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="label" translatable="yes"><b>Build</b></property>
- <property name="use_markup">True</property>
+ <child>
+ <widget class="GtkLabel" id="label8">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes"><b>Install</b></property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
</widget>
<packing>
- <property name="type">label_item</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
</packing>
</child>
</widget>
Modified: trunk/plugins/build-basic-autotools/build-basic-autotools.c
==============================================================================
--- trunk/plugins/build-basic-autotools/build-basic-autotools.c (original)
+++ trunk/plugins/build-basic-autotools/build-basic-autotools.c Sat Jul 19 09:18:04 2008
@@ -53,9 +53,17 @@
#define PREF_INDICATORS_AUTOMATIC "indicators.automatic"
#define PREF_INSTALL_ROOT "build.install.root"
#define PREF_INSTALL_ROOT_COMMAND "build.install.root.command"
-
-#define CHECK_BUTTON "preferences_toggle:bool:0:0:build.install.root"
-#define ENTRY "preferences_entry:text:sudo:0:build.install.root.command"
+#define PREF_PARALLEL_MAKE "build.parallel.make"
+#define PREF_PARALLEL_MAKE_JOB "build.parallel.make.job"
+#define PREF_TRANSLATE_MESSAGE "build.translate.message"
+#define PREF_CONTINUE_ON_ERROR "build.continue.error"
+
+#define BUILD_PREFS_DIALOG "preferences_dialog_build"
+#define BUILD_PREFS_ROOT "preferences_build_container"
+#define INSTALL_ROOT_CHECK "preferences_toggle:bool:0:0:build.install.root"
+#define INSTALL_ROOT_ENTRY "preferences_entry:text:sudo:0:build.install.root.command"
+#define PARALLEL_MAKE_CHECK "preferences_toggle:bool:0:0:build.parallel.make"
+#define PARALLEL_MAKE_SPIN "preferences_spin:int:1:0:build.parallel.make.job"
#define DEFAULT_COMMAND_COMPILE "make"
#define DEFAULT_COMMAND_BUILD "make"
@@ -237,6 +245,24 @@
return var;
}
+static gchar **
+build_add_arg (gchar **argv, const gchar *argument)
+{
+ gchar **new_argv;
+ guint len;
+
+ len = g_strv_length (argv);
+
+ /* Need to create a new variable */
+ new_argv = g_new (gchar *, len + 2);
+ new_argv[0] = argv[0];
+ new_argv[1] = g_strdup (argument);
+ memcpy (&new_argv[2], &argv[1], len * sizeof (gchar *));
+ g_free (argv);
+
+ return new_argv;
+}
+
/* Allow installation as root (#321455) */
static void on_root_check_toggled(GtkWidget* toggle_button, GtkWidget* entry)
{
@@ -1228,7 +1254,7 @@
GError **err)
{
gchar *real_dir;
-
+
g_return_val_if_fail (argv != NULL, FALSE);
real_dir = g_strdup (dir);
@@ -1296,15 +1322,40 @@
{
AnjutaPlugin* plugin = ANJUTA_PLUGIN(bplugin);
BuildContext *context;
+ AnjutaPreferences* prefs = anjuta_shell_get_preferences (plugin->shell, NULL);
+ gboolean ok;
+
if (save_file)
save_all_files (ANJUTA_PLUGIN (plugin));
context = build_get_context (bplugin, dir, with_view);
- if (build_execute_command_in_context (context, dir, argv, envp, callback, user_data, NULL))
+ /* Send options to make */
+ if (strcmp (argv[0], "make") == 0)
{
+ if (!anjuta_preferences_get_int (prefs , PREF_TRANSLATE_MESSAGE))
+ {
+ envp = build_add_env_variable (envp, "LANGUAGE", "C");
+ }
+ if (anjuta_preferences_get_int (prefs , PREF_PARALLEL_MAKE))
+ {
+ gchar *arg = g_strdup_printf ("-j%d", anjuta_preferences_get_int (prefs , PREF_PARALLEL_MAKE_JOB));
+ argv = build_add_arg (argv, arg);
+ g_free (arg);
+ }
+ if (anjuta_preferences_get_int (prefs , PREF_CONTINUE_ON_ERROR))
+ {
+ argv = build_add_arg (argv, "-k");
+ }
+ }
+
+ ok = build_execute_command_in_context (context, dir, argv, envp, callback, user_data, NULL);
+ g_strfreev (argv);
+
+ if (ok)
+ {
return context;
}
else
@@ -1329,8 +1380,6 @@
ok = build_execute_command_full (bplugin, dir, argv, save_file, TRUE, NULL, NULL, NULL, NULL) != NULL;
- g_strfreev (argv);
-
return ok;
}
@@ -1478,8 +1527,6 @@
return;
build_execute_command_full (plugin, plugin->project_build_dir, argv, TRUE, TRUE, NULL, build_remove_build_dir, plugin, NULL);
-
- g_strfreev (argv);
}
static void
@@ -1580,8 +1627,6 @@
{
g_free (filename);
filename = g_build_filename (link->build_dir, "config.log", NULL);
- stat (filename, &log_stat);
- DEBUG_PRINT("log %d conf %d", log_stat.st_mtime, conf_stat.st_mtime);
if ((stat (filename, &log_stat) != 0) ||
(log_stat.st_mtime < conf_stat.st_mtime))
{
@@ -1666,7 +1711,6 @@
build_execute_command_full (plugin, build_dir,
argv, TRUE, TRUE, NULL,
callback, user_data, NULL);
- g_strfreev (argv);
g_free (build_dir);
}
}
@@ -2938,7 +2982,6 @@
context = build_execute_command_full (plugin, dirname, argv,
TRUE, FALSE, NULL,
callback, user_data, err);
- g_strfreev (argv);
g_free (dirname);
return (IAnjutaBuilderHandle)context;
@@ -2968,8 +3011,6 @@
context = build_execute_command_full (plugin, dirname, argv,
TRUE, TRUE, NULL,
callback, user_data, err);
-
- g_strfreev (argv);
g_free (dirname);
return (IAnjutaBuilderHandle)context;
@@ -3003,13 +3044,17 @@
GtkWidget *entry;
/* Create the preferences page */
- gxml = glade_xml_new (GLADE_FILE, "preferences_dialog_build", NULL);
- root_check = glade_xml_get_widget(gxml, CHECK_BUTTON);
- entry = glade_xml_get_widget(gxml, ENTRY);
-
+ gxml = glade_xml_new (GLADE_FILE, BUILD_PREFS_DIALOG, NULL);
+ root_check = glade_xml_get_widget(gxml, INSTALL_ROOT_CHECK);
+ entry = glade_xml_get_widget(gxml, INSTALL_ROOT_ENTRY);
+ g_signal_connect(G_OBJECT(root_check), "toggled", G_CALLBACK(on_root_check_toggled), entry);
+ on_root_check_toggled (root_check, entry);
+ root_check = glade_xml_get_widget(gxml, PARALLEL_MAKE_CHECK);
+ entry = glade_xml_get_widget(gxml, PARALLEL_MAKE_SPIN);
g_signal_connect(G_OBJECT(root_check), "toggled", G_CALLBACK(on_root_check_toggled), entry);
+ on_root_check_toggled (root_check, entry);
- anjuta_preferences_add_page (prefs, gxml, "Build", _("Build Autotools"), ICON_FILE);
+ anjuta_preferences_add_page (prefs, gxml, BUILD_PREFS_ROOT, _("Build Autotools"), ICON_FILE);
}
static void
@@ -3018,8 +3063,12 @@
GtkWidget *root_check;
GtkWidget *entry;
- root_check = glade_xml_get_widget(gxml, CHECK_BUTTON);
- entry = glade_xml_get_widget(gxml, ENTRY);
+ root_check = glade_xml_get_widget(gxml, INSTALL_ROOT_CHECK);
+ entry = glade_xml_get_widget(gxml, INSTALL_ROOT_ENTRY);
+ g_signal_handlers_disconnect_by_func(G_OBJECT(root_check),
+ G_CALLBACK(on_root_check_toggled), entry);
+ root_check = glade_xml_get_widget(gxml, PARALLEL_MAKE_CHECK);
+ entry = glade_xml_get_widget(gxml, PARALLEL_MAKE_SPIN);
g_signal_handlers_disconnect_by_func(G_OBJECT(root_check),
G_CALLBACK(on_root_check_toggled), entry);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]