diff options
author | elliott_c <ocielliottc@users.noreply.github.com> | 2007-01-18 19:58:19 +0000 |
---|---|---|
committer | elliott_c <ocielliottc@users.noreply.github.com> | 2007-01-18 19:58:19 +0000 |
commit | 133a5f2d72f76c382fb9bed9b0ebcc5c12f1b8c1 (patch) | |
tree | 55e38ccd2555f4c7672601a588519c2e75537255 | |
parent | 5e254b97f11e5b5aca71178b8d18ab347e9343cb (diff) | |
download | MPC-133a5f2d72f76c382fb9bed9b0ebcc5c12f1b8c1.tar.gz |
ChangeLogTag: Thu Jan 18 19:57:42 UTC 2007 Chad Elliott <elliott_c@ociweb.com>
-rw-r--r-- | ChangeLog | 19 | ||||
-rw-r--r-- | modules/TemplateParser.pm | 59 | ||||
-rw-r--r-- | templates/vc8csharp.mpd | 24 |
3 files changed, 101 insertions, 1 deletions
@@ -1,3 +1,22 @@ +Thu Jan 18 19:57:42 UTC 2007 Chad Elliott <elliott_c@ociweb.com> + + * modules/TemplateParser.pm: + + Provide a new tmeplate function, remove_from, that will find a + particular name in any of the valid component sets (e.g., + source_files, header_files, etc.) and remove it from the list. + This is used in the change below. + + * templates/vc8csharp.mpd: + + If a source file is of the 'subtype' Form or Component, there may + be corresponding .Designer.cs and .resx files that are dependent + upon the source file. If this is the case, the .Designer.cs and + .resx files will automatically be marked as dependent upon the + originating source file. In order for this to happen though, the + .Designer.cs and .resx files must be in the MPC project either + implicitly or explicitly. + Thu Jan 18 16:44:51 UTC 2007 Chad Elliott <elliott_c@ociweb.com> * modules/Creator.pm: diff --git a/modules/TemplateParser.pm b/modules/TemplateParser.pm index 173393fc..17d515d0 100644 --- a/modules/TemplateParser.pm +++ b/modules/TemplateParser.pm @@ -56,6 +56,7 @@ my(%keywords) = ('if' => 0, 'starts_with' => 5, 'ends_with' => 5, 'contains' => 5, + 'remove_from' => 5, 'compares' => 5, 'duplicate_index' => 5, 'transdir' => 5, @@ -925,6 +926,64 @@ sub handle_contains { } +sub get_remove_from { + my($self) = shift; + my($str) = shift; + return $self->doif_remove_from([$str]); +} + + +sub doif_remove_from { + my($self) = shift; + my($val) = shift; + + if (defined $val) { + ## $source should be a component name (e.g., source_files, + ## header_files, etc.) $target is a variable name + ## $pattern and $replace are optional; $pattern is a regular + ## expression and $replace is what to replace the regular expression + ## with if a match is made. + my($source, $target, + $pattern, $replace) = $self->split_parameters("@$val"); + if (defined $source && defined $target && + defined $self->{'values'}->{$source}) { + my($tval) = $self->get_value_with_default($target); + if (defined $tval) { + if (defined $pattern) { + $replace = '' if (!defined $replace); + $tval =~ s/$pattern/$replace/; + } + my($max) = scalar(@{$self->{'values'}->{$source}}); + for(my $i = 0; $i < $max; $i++) { + if ($self->{'values'}->{$source}->[$i] eq $tval) { + splice(@{$self->{'values'}->{$source}}, $i, 1); + return 1; + } + } + } + } + } + return undef; +} + + +sub handle_remove_from { + my($self) = shift; + my($str) = shift; + + if (defined $str) { + my($val) = $self->doif_remove_from([$str]); + + if (defined $val) { + $self->append_current($val); + } + else { + $self->append_current(0); + } + } +} + + sub get_compares { my($self) = shift; my($str) = shift; diff --git a/templates/vc8csharp.mpd b/templates/vc8csharp.mpd index adac4559..efa2d871 100644 --- a/templates/vc8csharp.mpd +++ b/templates/vc8csharp.mpd @@ -90,12 +90,34 @@ </ItemGroup> <ItemGroup> <%foreach(source_files)%> +<%if(contains(flag_overrides(source_file, subtype), ^(Form|Component)$))%> <Compile Include="<%source_file%>"> - <SubType><%if(flag_overrides(source_file, subtype))%><%flag_overrides(source_file, subtype)%><%else%>Code<%endif%></SubType> + <SubType><%flag_overrides(source_file, subtype)%></SubType> <%if(flag_overrides(source_file, dependent_upon))%> <DependentUpon><%flag_overrides(source_file, dependent_upon)%></DependentUpon> <%endif%> </Compile> +<%if(remove_from(source_files, source_file, \.cs, .Designer.cs))%> + <Compile Include="<%noextension(source_file)%>.Designer.cs"> + <DependentUpon><%basename(source_file)%></DependentUpon> + </Compile> +<%endif%> +<%if(remove_from(resx_files, source_file, \.cs, .resx))%> + <EmbeddedResource Include="<%noextension(source_file)%>.resx"> + <SubType>Designer</SubType> + <DependentUpon><%basename(source_file)%></DependentUpon> + </EmbeddedResource> +<%endif%> +<%endif%> +<%endfor%> +<%foreach(source_files)%> +<%if(!contains(flag_overrides(source_file, subtype), ^(Form|Component)$))%> + <Compile Include="<%source_file%>"> +<%if(flag_overrides(source_file, dependent_upon))%> + <DependentUpon><%flag_overrides(source_file, dependent_upon)%></DependentUpon> +<%endif%> + </Compile> +<%endif%> <%endfor%> <%foreach(custom_types)%> <%foreach(custom_type->input_files)%> |