[anjuta] am-project: Remove data target
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] am-project: Remove data target
- Date: Sun, 2 Jan 2011 21:16:07 +0000 (UTC)
commit 7d6682bf47d3b9744acf5b7775be628f7a8c6f42
Author: Sébastien Granjoux <seb sfo free fr>
Date: Sun Jan 2 13:17:55 2011 +0100
am-project: Remove data target
libanjuta/anjuta-token-list.c | 50 ++++++++++++
libanjuta/anjuta-token-list.h | 1 +
plugins/am-project/am-parser.y | 15 ++--
plugins/am-project/am-project.c | 34 ++-------
plugins/am-project/am-properties.c | 4 +-
plugins/am-project/am-properties.h | 2 +-
plugins/am-project/am-scanner.l | 6 +-
plugins/am-project/am-writer.c | 64 +++++++++++-----
plugins/am-project/amp-group.c | 8 +-
plugins/am-project/amp-module.c | 16 ++--
plugins/am-project/amp-target.c | 58 +++++++++++++-
plugins/am-project/tests/Makefile.am | 3 +-
plugins/am-project/tests/data_target.at | 125 +++++++++++++++++++++++++++++++
plugins/am-project/tests/testsuite.at | 1 +
14 files changed, 311 insertions(+), 76 deletions(-)
---
diff --git a/libanjuta/anjuta-token-list.c b/libanjuta/anjuta-token-list.c
index 5b211af..120bc18 100644
--- a/libanjuta/anjuta-token-list.c
+++ b/libanjuta/anjuta-token-list.c
@@ -648,6 +648,56 @@ anjuta_token_remove_word (AnjutaToken *token)
}
AnjutaToken *
+anjuta_token_remove_list (AnjutaToken *token)
+{
+ AnjutaToken *list;
+ AnjutaToken *next;
+ AnjutaToken *prev;
+
+ list = anjuta_token_list (token);
+ anjuta_token_set_flags (list, ANJUTA_TOKEN_REMOVED);
+
+ prev = anjuta_token_previous_item (list);
+ if (anjuta_token_get_type (prev) == ANJUTA_TOKEN_EOL)
+ {
+ /* Remove line above if empty */
+ if (anjuta_token_get_type (anjuta_token_previous_item (prev)) == ANJUTA_TOKEN_EOL)
+ {
+ anjuta_token_set_flags (prev, ANJUTA_TOKEN_REMOVED);
+ }
+ }
+ else if (anjuta_token_get_type (prev) == ANJUTA_TOKEN_COMMENT)
+ {
+ /* Remove comment above if there is an empty line after it */
+ do
+ {
+ prev = anjuta_token_previous_item (prev);
+ }
+ while ((prev != NULL) && (anjuta_token_get_type (prev) == ANJUTA_TOKEN_COMMENT));
+
+ if ((prev != NULL) && (anjuta_token_get_type (prev) == ANJUTA_TOKEN_EOL))
+ {
+ prev = list;
+ do
+ {
+ anjuta_token_set_flags (prev, ANJUTA_TOKEN_REMOVED);
+ prev = anjuta_token_previous_item (prev);
+ }
+ while ((prev != NULL) && (anjuta_token_get_type (prev) == ANJUTA_TOKEN_COMMENT));
+ }
+ }
+
+ next = anjuta_token_next_item (list);
+ if (anjuta_token_get_type (next) == ANJUTA_TOKEN_EOL)
+ {
+ anjuta_token_set_flags (next, ANJUTA_TOKEN_REMOVED);
+ }
+ next = anjuta_token_next_item (next);
+
+ return next;
+}
+
+AnjutaToken *
anjuta_token_insert_token_list (gboolean after, AnjutaToken *pos,...)
{
AnjutaToken *first = NULL;
diff --git a/libanjuta/anjuta-token-list.h b/libanjuta/anjuta-token-list.h
index cffb55d..87b260f 100644
--- a/libanjuta/anjuta-token-list.h
+++ b/libanjuta/anjuta-token-list.h
@@ -53,6 +53,7 @@ AnjutaToken *anjuta_token_replace_nth_word (AnjutaToken *list, guint n, AnjutaTo
AnjutaToken *anjuta_token_insert_word_before (AnjutaToken *list, AnjutaToken *sibling, AnjutaToken *baby);
AnjutaToken *anjuta_token_insert_word_after (AnjutaToken *list, AnjutaToken *sibling, AnjutaToken *baby);
AnjutaToken *anjuta_token_remove_word (AnjutaToken *token);
+AnjutaToken *anjuta_token_remove_list (AnjutaToken *name);
AnjutaToken *anjuta_token_insert_token_list (gboolean after, AnjutaToken *list,...);
AnjutaToken *anjuta_token_find_type (AnjutaToken *list, gint flags, AnjutaTokenType* types);
diff --git a/plugins/am-project/am-parser.y b/plugins/am-project/am-parser.y
index 252e819..f3ae674 100644
--- a/plugins/am-project/am-parser.y
+++ b/plugins/am-project/am-parser.y
@@ -35,7 +35,7 @@
%token END_OF_LINE '\n'
%token SPACE
%token TAB '\t'
-%token HASH '#'
+%token COMMENT '#'
%token MACRO
%token VARIABLE
%token COLON ':'
@@ -257,20 +257,18 @@ line:
end_of_line:
END_OF_LINE {
+ anjuta_token_set_type ($1, ANJUTA_TOKEN_EOL);
$$ = NULL;
}
| END_OF_FILE {
$$ = NULL;
}
- | comment {
+ | COMMENT {
+ anjuta_token_set_type ($1, ANJUTA_TOKEN_COMMENT);
$$ = NULL;
}
;
-comment:
- HASH not_eol_list END_OF_LINE
- ;
-
not_eol_list:
/* empty */
| not_eol_list not_eol_token
@@ -471,6 +469,7 @@ command_token:
| rule_token
| depend_token
| space_token
+ | comment_token
;
value_token:
@@ -492,6 +491,10 @@ space_token:
| TAB
;
+comment_token:
+ COMMENT
+ ;
+
equal_token:
EQUAL
| IMMEDIATE_EQUAL
diff --git a/plugins/am-project/am-project.c b/plugins/am-project/am-project.c
index b1aac88..bc9a7dd 100644
--- a/plugins/am-project/am-project.c
+++ b/plugins/am-project/am-project.c
@@ -143,35 +143,35 @@ static AmpNodeInfo AmpNodeInformations[] = {
"_JAVA",
NULL},
- {{ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_UNKNOWN,
+ {{ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_LISP,
N_("Lisp Module"),
"text/plain"},
AM_TOKEN__LISP,
"_LISP",
"lisp"},
- {{ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_UNKNOWN,
+ {{ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_HEADER,
N_("Header Files"),
"text/x-chdr"},
AM_TOKEN__HEADERS,
"_HEADERS",
"include"},
- {{ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_UNKNOWN,
+ {{ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_MAN,
N_("Man Documentation"),
"text/x-troff-man"},
AM_TOKEN__MANS,
"_MANS",
"man"},
- {{ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_UNKNOWN,
+ {{ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_INFO,
N_("Info Documentation"),
"application/x-tex-info"},
AM_TOKEN__TEXINFOS,
"_TEXINFOS",
"info"},
- {{ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_UNKNOWN,
+ {{ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_DATA,
N_("Miscellaneous Data"),
"application/octet-stream"},
AM_TOKEN__DATA,
@@ -1136,6 +1136,7 @@ project_load_data (AmpProject *project, AnjutaToken *name, AnjutaToken *list, An
{
GFile *parent_file = g_object_ref (anjuta_project_node_get_file (parent));
+ amp_target_node_add_token (AMP_TARGET_NODE (target), AM_TOKEN__DATA, name);
for (arg = anjuta_token_first_word (list); arg != NULL; arg = anjuta_token_next_word (arg))
{
gchar *value;
@@ -2223,28 +2224,7 @@ amp_remove_property_setup (PmJob *job)
static gboolean
amp_remove_property_work (PmJob *job)
{
- switch (anjuta_project_node_get_node_type (job->node))
- {
- case ANJUTA_PROJECT_GROUP:
- amp_group_node_delete_token (AMP_PROJECT (job->user_data), AMP_GROUP_NODE (job->node), &job->error);
- break;
- case ANJUTA_PROJECT_TARGET:
- amp_target_node_delete_token (AMP_PROJECT (job->user_data), AMP_TARGET_NODE (job->node), &job->error);
- break;
- case ANJUTA_PROJECT_SOURCE:
- amp_source_node_delete_token (AMP_PROJECT (job->user_data), AMP_SOURCE_NODE (job->node), &job->error);
- break;
- case ANJUTA_PROJECT_MODULE:
- amp_module_node_delete_token (AMP_PROJECT (job->user_data), AMP_MODULE_NODE (job->node), &job->error);
- break;
- case ANJUTA_PROJECT_PACKAGE:
- amp_package_node_delete_token (AMP_PROJECT (job->user_data), AMP_PACKAGE_NODE (job->node), &job->error);
- break;
- default:
- break;
- }
-
- return TRUE;
+ return FALSE;
}
static gboolean
diff --git a/plugins/am-project/am-properties.c b/plugins/am-project/am-properties.c
index 90b7e54..e32137e 100644
--- a/plugins/am-project/am-properties.c
+++ b/plugins/am-project/am-properties.c
@@ -939,7 +939,7 @@ amp_node_property_set (AnjutaProjectNode *node, AnjutaProjectProperty *prop, con
}
AnjutaProjectProperty *
-amp_node_get_property_from_token (AnjutaProjectNode *node, gint token)
+amp_node_get_property_from_token (AnjutaProjectNode *node, gint token, gint pos)
{
GList *item;
@@ -947,7 +947,7 @@ amp_node_get_property_from_token (AnjutaProjectNode *node, gint token)
{
AmpProperty *prop = (AmpProperty *)item->data;
- if (prop->token_type == token)
+ if ((prop->token_type == token) && (prop->position == pos))
{
return anjuta_project_node_get_property (node, (AnjutaProjectProperty *)prop);
}
diff --git a/plugins/am-project/am-properties.h b/plugins/am-project/am-properties.h
index d98da2e..7836c0a 100644
--- a/plugins/am-project/am-properties.h
+++ b/plugins/am-project/am-properties.h
@@ -34,7 +34,7 @@ void amp_property_free (AnjutaProjectProperty *prop);
gboolean amp_node_property_load (AnjutaProjectNode *target, gint token_type, gint position, const gchar *value, AnjutaToken *token);
gboolean amp_node_property_add (AnjutaProjectNode *node, AnjutaProjectProperty *prop);
AnjutaProjectProperty *amp_node_property_set (AnjutaProjectNode *node, AnjutaProjectProperty *prop, const gchar* value);
-AnjutaProjectProperty *amp_node_get_property_from_token (AnjutaProjectNode *node, gint token);
+AnjutaProjectProperty *amp_node_get_property_from_token (AnjutaProjectNode *node, gint token, gint pos);
gboolean amp_node_property_has_flags (AnjutaProjectNode *node, AnjutaProjectProperty *prop, const gchar *value);
AnjutaProjectProperty *amp_node_property_remove_flags (AnjutaProjectNode *node, AnjutaProjectProperty *prop, const gchar *value);
diff --git a/plugins/am-project/am-scanner.l b/plugins/am-project/am-scanner.l
index 0f25c05..280be8b 100644
--- a/plugins/am-project/am-scanner.l
+++ b/plugins/am-project/am-scanner.l
@@ -83,11 +83,7 @@ NAME [^ \t\n\r:#=$"'`&@\\]*
<INITIAL>([ ]|\\\n)([ \t]|\\\n)* { RETURN (SPACE); }
-<INITIAL># { RETURN (HASH); }
-
-<INITIAL>([ ]|\\\n)([ \t]|\\\n)* { RETURN (SPACE); }
-
-<INITIAL>([ \t])*#.*\n { RETURN (END_OF_LINE); }
+<INITIAL>([ \t])*#.*\n { RETURN (COMMENT); }
<INITIAL>\t { RETURN (TAB); }
diff --git a/plugins/am-project/am-writer.c b/plugins/am-project/am-writer.c
index 0f7ec43..3a73792 100644
--- a/plugins/am-project/am-writer.c
+++ b/plugins/am-project/am-writer.c
@@ -401,6 +401,7 @@ amp_project_write_target (AmpGroupNode *group, gint type, const gchar *name, gbo
ANJUTA_TOKEN_SPACE, " ",
NULL);
token = anjuta_token_last_item (token);
+ amp_group_node_update_makefile (group, token);
return token;
}
@@ -509,30 +510,43 @@ amp_target_node_create_token (AmpProject *project, AmpTargetNode *target, GErro
}
g_free (targetname);
- if (args != NULL)
+ switch (anjuta_project_node_get_full_type (ANJUTA_PROJECT_NODE (target)) & ANJUTA_PROJECT_ID_MASK)
{
- AnjutaTokenStyle *style;
+ case ANJUTA_PROJECT_SHAREDLIB:
+ case ANJUTA_PROJECT_STATICLIB:
+ case ANJUTA_PROJECT_PROGRAM:
+ if (args != NULL)
+ {
+ AnjutaTokenStyle *style;
- style = anjuta_token_style_new_from_base (project->am_space_list);
- anjuta_token_style_update (style, args);
+ style = anjuta_token_style_new_from_base (project->am_space_list);
+ anjuta_token_style_update (style, args);
- token = anjuta_token_new_string (ANJUTA_TOKEN_ARGUMENT | ANJUTA_TOKEN_ADDED, name);
- if (after)
- {
- anjuta_token_insert_word_after (args, prev, token);
- }
- else
- {
- anjuta_token_insert_word_before (args, prev, token);
- }
+ token = anjuta_token_new_string (ANJUTA_TOKEN_ARGUMENT | ANJUTA_TOKEN_ADDED, name);
+ if (after)
+ {
+ anjuta_token_insert_word_after (args, prev, token);
+ }
+ else
+ {
+ anjuta_token_insert_word_before (args, prev, token);
+ }
- /* Try to use the same style than the current target list */
- anjuta_token_style_format (style, args);
- anjuta_token_style_free (style);
+ /* Try to use the same style than the current target list */
+ anjuta_token_style_format (style, args);
+ anjuta_token_style_free (style);
- amp_group_node_update_makefile (parent, token);
+ amp_group_node_update_makefile (parent, token);
- amp_target_node_add_token (target, ANJUTA_TOKEN_ARGUMENT, token);
+ amp_target_node_add_token (target, ANJUTA_TOKEN_ARGUMENT, token);
+ }
+ break;
+ default:
+ if (args != NULL)
+ {
+ amp_target_node_add_token (target, AM_TOKEN__SOURCES, args);
+ }
+ break;
}
return TRUE;
@@ -547,6 +561,15 @@ amp_target_node_delete_token (AmpProject *project, AmpTargetNode *target, GErro
/* Get parent target */
parent = AMP_GROUP_NODE (anjuta_project_node_parent (ANJUTA_PROJECT_NODE (target)));
+ /* Remove list for data target */
+ for (item = amp_target_node_get_token (target, AM_TOKEN__DATA); item != NULL; item = g_list_next (item))
+ {
+ AnjutaToken *token = (AnjutaToken *)item->data;
+
+ anjuta_token_remove_list (token);
+ amp_group_node_update_makefile (parent, token);
+ }
+
for (item = amp_target_node_get_token (target, ANJUTA_TOKEN_ARGUMENT); item != NULL; item = g_list_next (item))
{
AnjutaToken *token = (AnjutaToken *)item->data;
@@ -570,6 +593,11 @@ amp_target_node_delete_token (AmpProject *project, AmpTargetNode *target, GErro
return TRUE;
}
+
+
+/* Source objects
+ *---------------------------------------------------------------------------*/
+
static AnjutaToken *
amp_project_write_source_list (AmpGroupNode *group, const gchar *name, gboolean after, AnjutaToken* sibling)
{
diff --git a/plugins/am-project/amp-group.c b/plugins/am-project/amp-group.c
index d9a4f12..a70c6f3 100644
--- a/plugins/am-project/amp-group.c
+++ b/plugins/am-project/amp-group.c
@@ -93,7 +93,7 @@ project_load_group_module (AmpProject *project, AmpGroupNode *group)
AnjutaProjectProperty *prop;
gchar **group_cpp = NULL;
- prop = amp_node_get_property_from_token (ANJUTA_PROJECT_NODE (group), AM_TOKEN__CPPFLAGS);
+ prop = amp_node_get_property_from_token (ANJUTA_PROJECT_NODE (group), AM_TOKEN__CPPFLAGS, 0);
if (prop && (prop->value != NULL)) group_cpp = g_strsplit_set (prop->value, " \t", 0);
/* Check all targets */
@@ -107,11 +107,11 @@ project_load_group_module (AmpProject *project, AmpGroupNode *group)
switch (type)
{
case ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_PROGRAM:
- prop = amp_node_get_property_from_token (target, AM_TOKEN_TARGET_LDADD);
+ prop = amp_node_get_property_from_token (target, AM_TOKEN_TARGET_LDADD, 0);
break;
case ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_STATICLIB:
case ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_SHAREDLIB:
- prop = amp_node_get_property_from_token (target, AM_TOKEN_TARGET_LIBADD);
+ prop = amp_node_get_property_from_token (target, AM_TOKEN_TARGET_LIBADD, 0);
break;
default:
break;
@@ -123,7 +123,7 @@ project_load_group_module (AmpProject *project, AmpGroupNode *group)
{
AnjutaProjectNode *module;
- prop = amp_node_get_property_from_token (target, AM_TOKEN_TARGET_CPPFLAGS);
+ prop = amp_node_get_property_from_token (target, AM_TOKEN_TARGET_CPPFLAGS, 0);
if (prop && (prop->value != NULL)) target_cpp = g_strsplit_set (prop->value, " \t", 0);
for (module = anjuta_project_node_first_child (ANJUTA_PROJECT_NODE (project)); module != NULL; module = anjuta_project_node_next_sibling (module))
diff --git a/plugins/am-project/amp-module.c b/plugins/am-project/amp-module.c
index 380b66c..2a131cf 100644
--- a/plugins/am-project/amp-module.c
+++ b/plugins/am-project/amp-module.c
@@ -126,22 +126,22 @@ amp_module_node_write (AmpNode *node, AmpNode *amp_parent, AmpProject *project,
gchar *cpp_flags;
gint type;
- group_cpp = amp_node_get_property_from_token (group, AM_TOKEN__CPPFLAGS);
+ group_cpp = amp_node_get_property_from_token (group, AM_TOKEN__CPPFLAGS, 0);
type = anjuta_project_node_get_full_type (parent) & (ANJUTA_PROJECT_ID_MASK | ANJUTA_PROJECT_TYPE_MASK);
switch (type)
{
case ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_PROGRAM:
- target_lib = amp_node_get_property_from_token (parent, AM_TOKEN_TARGET_LDADD);
+ target_lib = amp_node_get_property_from_token (parent, AM_TOKEN_TARGET_LDADD, 0);
break;
case ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_STATICLIB:
case ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_SHAREDLIB:
- target_lib = amp_node_get_property_from_token (parent, AM_TOKEN_TARGET_LIBADD);
+ target_lib = amp_node_get_property_from_token (parent, AM_TOKEN_TARGET_LIBADD, 0);
break;
default:
break;
}
- target_cpp = amp_node_get_property_from_token (parent, AM_TOKEN_TARGET_CPPFLAGS);
+ target_cpp = amp_node_get_property_from_token (parent, AM_TOKEN_TARGET_CPPFLAGS, 0);
lib_flags = g_strconcat ("$(", anjuta_project_node_get_name (ANJUTA_PROJECT_NODE (node)), "_LIBS)", NULL);
cpp_flags = g_strconcat ("$(", anjuta_project_node_get_name (ANJUTA_PROJECT_NODE (node)), "_CFLAGS)", NULL);
@@ -190,7 +190,7 @@ amp_module_node_erase (AmpNode *node, AmpNode *amp_parent, AmpProject *project,
lib_flags = g_strconcat ("$(", anjuta_project_node_get_name (ANJUTA_PROJECT_NODE (node)), "_LIBS)", NULL);
cpp_flags = g_strconcat ("$(", anjuta_project_node_get_name (ANJUTA_PROJECT_NODE (node)), "_CFLAGS)", NULL);
- group_cpp = amp_node_get_property_from_token (group, AM_TOKEN__CPPFLAGS);
+ group_cpp = amp_node_get_property_from_token (group, AM_TOKEN__CPPFLAGS, 0);
if (amp_node_property_has_flags (group, group_cpp, cpp_flags))
{
/* Remove flags in group variable if not more target has this module */
@@ -230,17 +230,17 @@ amp_module_node_erase (AmpNode *node, AmpNode *amp_parent, AmpProject *project,
switch (type)
{
case ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_PROGRAM:
- target_lib = amp_node_get_property_from_token (parent, AM_TOKEN_TARGET_LDADD);
+ target_lib = amp_node_get_property_from_token (parent, AM_TOKEN_TARGET_LDADD, 0);
break;
case ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_STATICLIB:
case ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_SHAREDLIB:
- target_lib = amp_node_get_property_from_token (parent, AM_TOKEN_TARGET_LIBADD);
+ target_lib = amp_node_get_property_from_token (parent, AM_TOKEN_TARGET_LIBADD, 0);
break;
default:
target_lib = NULL;
break;
}
- target_cpp = amp_node_get_property_from_token (parent, AM_TOKEN_TARGET_CPPFLAGS);
+ target_cpp = amp_node_get_property_from_token (parent, AM_TOKEN_TARGET_CPPFLAGS, 0);
prop = amp_node_property_remove_flags (parent, target_cpp, cpp_flags);
if (prop != NULL) amp_project_update_am_property (project, parent, prop);
diff --git a/plugins/am-project/amp-target.c b/plugins/am-project/amp-target.c
index 23c48bd..487f663 100644
--- a/plugins/am-project/amp-target.c
+++ b/plugins/am-project/amp-target.c
@@ -30,6 +30,7 @@
#include "am-scanner.h"
#include "am-properties.h"
#include "am-writer.h"
+#include "amp-group.h"
#include <libanjuta/interfaces/ianjuta-project.h>
@@ -181,10 +182,11 @@ tagged_token_list_free (GList *list)
return NULL;
}
+/* Public functions
+ *---------------------------------------------------------------------------*/
-
-/* Target object
+/* Public functions
*---------------------------------------------------------------------------*/
void
@@ -319,9 +321,57 @@ amp_target_node_write (AmpNode *node, AmpNode *parent, AmpProject *project, GErr
}
static gboolean
-amp_target_node_erase (AmpNode *node, AmpNode *parent, AmpProject *project, GError **error)
+amp_target_node_erase (AmpNode *target, AmpNode *parent, AmpProject *project, GError **error)
{
- return amp_target_node_delete_token (project, AMP_TARGET_NODE (node), error);
+ gboolean ok;
+
+ ok = amp_target_node_delete_token (project, AMP_TARGET_NODE (target), error);
+
+ /* Remove installation directory variable if the removed target was the
+ * only one using it */
+ if (ok)
+ {
+ AnjutaProjectNode *node;
+ const gchar *installdir;
+ AnjutaProjectProperty *prop;
+ gboolean used = FALSE;
+
+ prop = amp_node_get_property_from_token (ANJUTA_PROJECT_NODE (target), AM_TOKEN__PROGRAMS, 6);
+ installdir = prop->value;
+
+ for (node = anjuta_project_node_first_child (ANJUTA_PROJECT_NODE (parent)); node != NULL; node = anjuta_project_node_next_sibling (node))
+ {
+ if (node != ANJUTA_PROJECT_NODE (target))
+ {
+ prop = amp_node_get_property_from_token (node, AM_TOKEN__PROGRAMS, 6);
+ if (g_strcmp0 (installdir, prop->value) == 0)
+ {
+ used = TRUE;
+ break;
+ }
+ }
+ }
+
+ if (!used)
+ {
+ GList *item;
+
+ for (item = ANJUTA_PROJECT_NODE (parent)->custom_properties; item != NULL; item = g_list_next (item))
+ {
+ AmpProperty *prop = (AmpProperty *)item->data;
+
+ if ((prop->token_type == AM_TOKEN_DIR) && (g_strcmp0 (prop->base.name, installdir) == 0))
+ {
+ /* Remove directory variable */
+ anjuta_token_remove_list (prop->token);
+ amp_group_node_update_makefile (AMP_GROUP_NODE (parent), prop->token);
+ break;
+ }
+ }
+ }
+ };
+
+ return ok;
}
diff --git a/plugins/am-project/tests/Makefile.am b/plugins/am-project/tests/Makefile.am
index b049874..53c338e 100644
--- a/plugins/am-project/tests/Makefile.am
+++ b/plugins/am-project/tests/Makefile.am
@@ -28,7 +28,8 @@ TESTSUITE_AT = \
$(srcdir)/properties.at \
$(srcdir)/module.at \
$(srcdir)/package.at \
- $(srcdir)/target_module.at
+ $(srcdir)/target_module.at \
+ $(srcdir)/data_target.at
TESTSUITE = $(srcdir)/testsuite
diff --git a/plugins/am-project/tests/data_target.at b/plugins/am-project/tests/data_target.at
new file mode 100644
index 0000000..2376da0
--- /dev/null
+++ b/plugins/am-project/tests/data_target.at
@@ -0,0 +1,125 @@
+AT_SETUP([Add and Remove data target])
+AS_MKDIR_P([data])
+AT_DATA([data/configure.ac],
+[[AC_CONFIG_FILES(Makefile)
+]])
+AT_DATA([data/Makefile.am],
+[[## Process this file with automake to produce Makefile.in
+
+# Target comment
+target1dir = $(target_dir)
+target1_DATA = data1.txt
+
+target2dir = $(target_dir)
+target2_DATA = data2.txt \
+ data3.txt
+]])
+
+
+
+AT_DATA([expect],
+[[ GROUP (0): data
+ PROPERTY (Installation directories): target1dir = $(target_dir) target2dir = $(target_dir)
+ TARGET (0:0): target1
+ PROPERTY (Installation directory): target1dir
+ SOURCE (0:0:0): data1.txt
+ TARGET (0:1): target2
+ PROPERTY (Installation directory): target2dir
+ SOURCE (0:1:0): data2.txt
+ SOURCE (0:1:1): data3.txt
+]])
+AT_PARSER_CHECK([load data \
+ list \
+ save])
+AT_CHECK([diff -b output expect])
+
+
+
+AT_DATA([expect],
+[[ GROUP (0): data1
+ PROPERTY (Installation directories): target1dir = $(target_dir)
+ TARGET (0:0): target1
+ PROPERTY (Installation directory): target1dir
+ SOURCE (0:0:0): data1.txt
+]])
+AT_DATA([reference],
+[[## Process this file with automake to produce Makefile.in
+
+# Target comment
+target1dir = $(target_dir)
+target1_DATA = data1.txt
+]])
+AT_PARSER_CHECK([load data \
+ move data1 \
+ remove 0:1 \
+ list \
+ save])
+AT_CHECK([diff -b data1/Makefile.am reference])
+AT_PARSER_CHECK([load data1 \
+ list])
+AT_CHECK([diff -b output expect])
+
+
+
+AT_DATA([expect],
+[[ GROUP (0): data2
+ PROPERTY (Installation directories): target1dir = $(target_dir)
+ TARGET (0:0): target1
+ PROPERTY (Installation directory): target1dir
+ SOURCE (0:0:0): data1.txt
+ TARGET (0:1): data
+ PROPERTY (Installation directory): datadir
+ SOURCE (0:1:0): data4.txt
+ SOURCE (0:1:1): data5.txt
+]])
+AT_DATA([reference],
+[[## Process this file with automake to produce Makefile.in
+
+# Target comment
+target1dir = $(target_dir)
+target1_DATA = data1.txt
+
+data_DATA = data4.txt \
+ data5.txt
+]])
+AT_PARSER_CHECK([load data1 \
+ move data2 \
+ add target 0 target3 data \
+ add source 0:1 data4.txt \
+ add source 0:1 data5.txt \
+ list \
+ save])
+AT_CHECK([diff -b data2/Makefile.am reference])
+AT_PARSER_CHECK([load data2 \
+ list])
+AT_CHECK([diff -b output expect])
+
+
+
+AT_DATA([expect],
+[[ GROUP (0): data3
+ TARGET (0:0): data
+ PROPERTY (Installation directory): datadir
+ SOURCE (0:0:0): data4.txt
+ SOURCE (0:0:1): data5.txt
+]])
+AT_DATA([reference],
+[[## Process this file with automake to produce Makefile.in
+
+
+data_DATA = data4.txt \
+ data5.txt
+]])
+AT_PARSER_CHECK([load data2 \
+ move data3 \
+ remove 0:0 \
+ list \
+ save])
+AT_CHECK([diff -b data3/Makefile.am reference])
+AT_PARSER_CHECK([load data3 \
+ list])
+AT_CHECK([diff -b output expect])
+
+
+
+AT_CLEANUP
diff --git a/plugins/am-project/tests/testsuite.at b/plugins/am-project/tests/testsuite.at
index 97a7a27..f543f3f 100644
--- a/plugins/am-project/tests/testsuite.at
+++ b/plugins/am-project/tests/testsuite.at
@@ -11,3 +11,4 @@ m4_include([properties.at])
m4_include([module.at])
m4_include([package.at])
m4_include([target_module.at])
+m4_include([data_target.at])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]