summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames H. Hill <hilljh82@gmail.com>2010-03-23 12:17:18 +0000
committerJames H. Hill <hilljh82@gmail.com>2010-03-23 12:17:18 +0000
commit7ee745c95ccea7607967b28660c969086c610540 (patch)
tree4a429ea254fdd6da07ed9b97ca6c46074a940769
parent6c410b9918eb7e185b825f9ef9af96e45562ed86 (diff)
downloadMPC-7ee745c95ccea7607967b28660c969086c610540.tar.gz
Tue Mar 23 12:16:11 UTC 2010 James H. Hill <hillj at cs dot iupui dot edu>
-rw-r--r--ChangeLog9
-rw-r--r--docs/README28
-rw-r--r--modules/WorkspaceCreator.pm67
3 files changed, 84 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index 5a0b80e6..dc796a67 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Tue Mar 23 12:16:11 UTC 2010 James H. Hill <hillj at cs dot iupui dot edu>
+
+ * docs/README:
+ * modules/WorkspaceCreator.pm:
+
+ Added support for properties in the exclude section of
+ a workspace definition. Also, updated the README to reflect
+ the changes.
+
Mon Mar 22 00:47:56 UTC 2010 Chad Elliott <elliott_c@ociweb.com>
* modules/AutomakeWorkspaceCreator.pm:
diff --git a/docs/README b/docs/README
index fc6cc00c..f3e87100 100644
--- a/docs/README
+++ b/docs/README
@@ -79,6 +79,16 @@ workspace {
dir2/unix_only
}
+ // exclude non_window for every windows project type
+ exclude(prop:windows) {
+ dir2/non_windows
+ }
+
+ // exclude microsoft_only for all non-microsoft project types
+ exclude(!prop:microsoft) {
+ dir2/microsoft_only
+ }
+
dir3
// Associate the name "other" with dir3
@@ -87,14 +97,20 @@ workspace {
}
}
-The associate scope associates a name with one or more directories. This
-does not add directories to a workspace, it only makes an association. This
-may or may not have an effect on the generated workspace; it depends solely
-upon whether the project type supports associations.
+The associate scope associates a name with one or more directories.
+This does not add directories to a workspace, it only makes an
+association. This may or may not have an effect on the generated
+workspace; it depends solely upon whether the project type supports
+associations.
Currently automake is the only project type that supports associations.
-Each directory listed under an association is grouped together and built
-conditionally based on the association name.
+Each directory listed under an association is grouped together and
+built conditionally based on the association name.
+
+Finally, prop:value are properties in MPC. They are used to group
+together common workspace/project types. More details on properties
+in MPC can be found in the section on the 'specific' keywork in the
+Project Declarations section below.
Project Declarations
--------------------
diff --git a/modules/WorkspaceCreator.pm b/modules/WorkspaceCreator.pm
index 2b31a401..ac29ff51 100644
--- a/modules/WorkspaceCreator.pm
+++ b/modules/WorkspaceCreator.pm
@@ -378,36 +378,75 @@ sub parse_scope {
sub process_types {
my($self, $typestr) = @_;
+ my $wcprops = $self->get_properties();
my %types;
+ my %props;
@types{split(/\s*,\s*/, $typestr)} = ();
- ## If there is a negation at all, add our
- ## current type, it may be removed below
- if (index($typestr, '!') >= 0) {
- $types{$self->{wctype}} = 1;
-
- ## Process negated exclusions
+ ## If there is a property in the typestr, i.e., prop:, then
+ ## we need to extract it into its own collection while removing
+ ## it from the types collection.
+ if (index($typestr, 'prop:') >= 0) {
foreach my $key (keys %types) {
- if ($key =~ /^!\s*(\w+)/) {
+ if ($key =~ /^prop:\s*(\w+)/) {
+ ## Add the property to the prop hash.
+ $props{$1} = 1;
+
+ ## Remove the original property from the types.
+ delete $types{$key};
+ }
+ elsif ($key =~ /^!prop:\s*(\w+)/) {
+ ## Negate the property.
+ $props{$1} = 0;
+
+ ## Remove the original property from the types.
+ delete $types{$key};
+ }
+ }
+ }
+
+ ## Now, process the properties and determine if this project
+ ## type should be excluded. This will be the case if the property
+ ## is valid and there exists a match between the listed properties
+ ## and the workspace properties.
+ while (my ($key, $val) = each %props) {
+ if (exists $$wcprops{$key}) {
+ if ($$wcprops{$key} == 1 and $$wcprops{$key} == $val) {
+ $types{$self->{wctype}} = 1;
+ }
+ else {
+ delete $types{$self->{wctype}};
+ }
+ }
+ elsif ($val == 0) {
+ $types{$self->{wctype}} = 1;
+ }
+ }
+
+ ## Remove all negated types from the collection.
+ foreach my $key (keys %types) {
+ if ($key =~ /^!\s*(\w+)/) {
+ if ($1 == $self->{wctype}) {
## Remove the negated key
delete $types{$key};
- ## Then delete the key that was negated in the exclusion.
+ ## Then delete the key that was negated in the exclusion
delete $types{$1};
}
}
}
+
return \%types;
}
sub parse_exclude {
my($self, $fh, $typestr, $flags) = @_;
- my $status = 0;
- my $errorString = 'Unable to process exclude';
- my $negated = (index($typestr, '!') >= 0);
+ my $status = 0;
+ my $errorString = 'Unable to process exclude';
+ my $negated = (index($typestr, '!') >= 0);
+ my $types = $self->process_types($typestr);
+ my $count = 1;
my @exclude;
- my $types = $self->process_types($typestr);
- my $count = 1;
if (exists $$types{$self->{wctype}}) {
while(<$fh>) {
@@ -2212,7 +2251,7 @@ sub create_command_line_string {
if ($arg =~ /\$/ && $^O ne 'MSWin32') {
## If we're not running on Windows and the command line argument
## contains a dollar sign, we need to wrap the argument in single
- ## quotes so that the UNIX shell does not interpret it.
+ ## quotes so that the UNIX shell does not interpret it.
$arg = "'$arg'";
}
else {