diff options
author | elliott_c <ocielliottc@users.noreply.github.com> | 2003-05-09 13:04:48 +0000 |
---|---|---|
committer | elliott_c <ocielliottc@users.noreply.github.com> | 2003-05-09 13:04:48 +0000 |
commit | 97988b3a17fc0d039c04df87e988b43165682095 (patch) | |
tree | db9250a24fbd796d0e9c5d51b4f2a94ae40c8635 | |
parent | 09792e4a20a15ffeef4dfff9c6bb2eff643e35bc (diff) | |
download | ATCD-97988b3a17fc0d039c04df87e988b43165682095.tar.gz |
ChangeLogTag: Fri May 9 08:01:59 2003 Chad Elliott <elliott_c@ociweb.com>
-rw-r--r-- | ChangeLog | 114 | ||||
-rw-r--r-- | bin/MakeProjectCreator/README | 103 | ||||
-rw-r--r-- | bin/MakeProjectCreator/modules/Creator.pm | 8 | ||||
-rw-r--r-- | bin/MakeProjectCreator/modules/ProjectCreator.pm | 749 | ||||
-rw-r--r-- | bin/MakeProjectCreator/modules/TemplateParser.pm | 102 | ||||
-rw-r--r-- | bin/MakeProjectCreator/modules/WorkspaceCreator.pm | 14 | ||||
-rw-r--r-- | bin/MakeProjectCreator/templates/bor.mpd | 14 | ||||
-rw-r--r-- | bin/MakeProjectCreator/templates/em3vcp.mpd | 45 | ||||
-rw-r--r-- | bin/MakeProjectCreator/templates/gnu.mpd | 20 | ||||
-rw-r--r-- | bin/MakeProjectCreator/templates/make.mpd | 20 | ||||
-rw-r--r-- | bin/MakeProjectCreator/templates/nmake.mpd | 39 | ||||
-rw-r--r-- | bin/MakeProjectCreator/templates/vc6dsp.mpd | 43 | ||||
-rw-r--r-- | bin/MakeProjectCreator/templates/vc7.mpd | 21 |
13 files changed, 995 insertions, 297 deletions
diff --git a/ChangeLog b/ChangeLog index 33e7c2a909b..0cced8b9f69 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,22 +1,50 @@ +Fri May 9 08:01:59 2003 Chad Elliott <elliott_c@ociweb.com> + + * bin/MakeProjectCreator/README: + + Added documentation on the Custom File Definitions. + + * bin/MakeProjectCreator/modules/Creator.pm: + * bin/MakeProjectCreator/modules/WorkspaceCreator.pm: + + Fixed bad error handling. + + * bin/MakeProjectCreator/modules/ProjectCreator.pm: + * bin/MakeProjectCreator/modules/TemplateParser.pm: + + Added support for custom build definitions. See the + "Custom File Definitions" section of the README for more + information. + + * bin/MakeProjectCreator/templates/bor.mpd: + * bin/MakeProjectCreator/templates/em3vcp.mpd: + * bin/MakeProjectCreator/templates/gnu.mpd: + * bin/MakeProjectCreator/templates/make.mpd: + * bin/MakeProjectCreator/templates/nmake.mpd: + * bin/MakeProjectCreator/templates/vc6dsp.mpd: + * bin/MakeProjectCreator/templates/vc7.mpd: + + Utilize the custom types in the supported template files. + Thu May 8 18:50:24 2003 Steve Huston <shuston@riverace.com> - * tests/run_test.lst: Moved Cached_Accept_Conn_Test down the list - to put some time between it and Cached_Conn_Test. They both suck up - all available sockets and one after the other is a guaranteed fail - on Windows XP due to socket starvation. + * tests/run_test.lst: Moved Cached_Accept_Conn_Test down the list + to put some time between it and Cached_Conn_Test. They both suck up + all available sockets and one after the other is a guaranteed fail + on Windows XP due to socket starvation. Thu May 8 16:57:18 2003 Steve Huston <shuston@riverace.com> - * ace/Date_Time.i (update): WinCE doesn't do localtime(), so extract - the FILETIME value from ACE_Time_Value and convert it to system time. - Fixes Bugzilla #1502. + * ace/Date_Time.i (update): WinCE doesn't do localtime(), so extract + the FILETIME value from ACE_Time_Value and convert it to system time. + Fixes Bugzilla #1502. - * ace/OS.cpp (uname): Added proper sensing of Windows CE at runtime - as well as the ARM processor type. + * ace/OS.cpp (uname): Added proper sensing of Windows CE at runtime + as well as the ARM processor type. - * tests/Enum_Interfaces_Test.cpp: Convert the interface address - strings to ACE_TCHAR for logging. Makes them legible on wide-char - builds. Fixes Bugzilla #1501. + * tests/Enum_Interfaces_Test.cpp: Convert the interface address + strings to ACE_TCHAR for logging. Makes them legible on wide-char + builds. Fixes Bugzilla #1501. Thu May 08 15:03:17 2003 Simon McQueen <sm@prismtechnologies.com> @@ -28,8 +56,8 @@ Thu May 08 15:03:17 2003 Simon McQueen <sm@prismtechnologies.com> Thu May 8 06:44:19 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu> - * bin/topinfo_iorsize_stats.sh (FILES): Fixed a typo in the - script! + * bin/topinfo_iorsize_stats.sh (FILES): Fixed a typo in the + script! Wed May 7 17:51:51 2003 Jeff Parsons <j.parsons@vanderbilt.edu> @@ -42,34 +70,34 @@ Wed May 7 17:51:51 2003 Jeff Parsons <j.parsons@vanderbilt.edu> Wed May 7 18:32:45 2003 Steve Huston <shuston@riverace.com> - * tests/FIFO_Test.cpp: Fix the version of main() that was actually - causing the problem (see: Tue May 6 18:06:39 2003 Steve Huston) + * tests/FIFO_Test.cpp: Fix the version of main() that was actually + causing the problem (see: Tue May 6 18:06:39 2003 Steve Huston) Wed May 7 17:02:44 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu> - * bin/MakeProjectCreator/config/ciao_component.mpb: Added the - required libraries to build the server. This was necessitated by - the recent subsetting in TAO. + * bin/MakeProjectCreator/config/ciao_component.mpb: Added the + required libraries to build the server. This was necessitated by + the recent subsetting in TAO. Wed May 7 17:25:49 2003 Steve Huston <shuston@riverace.com> - * ace/Service_Config.h: Added description of the -s option to - ACE_Service_Config::open(). Also clarified -f, -k, -n, -y and -S. + * ace/Service_Config.h: Added description of the -s option to + ACE_Service_Config::open(). Also clarified -f, -k, -n, -y and -S. Wed May 7 14:00:31 2003 Steve Huston <shuston@riverace.com> - * ace/Basic_Types.h: In ACE_LONGLONG_TO_PTR macro, replace use - of ptr_arith_t with ptrdiff_t. Thanks to Ossama for noticing this. + * ace/Basic_Types.h: In ACE_LONGLONG_TO_PTR macro, replace use + of ptr_arith_t with ptrdiff_t. Thanks to Ossama for noticing this. Wed May 7 12:03:28 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu> - * bin/topinfo_iorsize_stats.sh (FILES): Removed the memory - tracking on the client side since its of no use. Added code to - collect the actual size of the server growth once data is - marshalled. + * bin/topinfo_iorsize_stats.sh (FILES): Removed the memory + tracking on the client side since its of no use. Added code to + collect the actual size of the server growth once data is + marshalled. - * bin/generate_topinfo_stats.sh: Used the 4th argument to plot - information on the y axis. + * bin/generate_topinfo_stats.sh: Used the 4th argument to plot + information on the y axis. Wed May 7 08:22:12 UTC 2003 Johnny Willemsen <jwillemsen@remedy.nl> @@ -78,26 +106,26 @@ Wed May 7 08:22:12 UTC 2003 Johnny Willemsen <jwillemsen@remedy.nl> Tue May 6 18:06:39 2003 Steve Huston <shuston@riverace.com> - * ace/Basic_Types.h: Add typedef of ptrdiff_t for WinCE 3. Follow-up: - Tue May 6 13:39:27 2003 Steve Huston <shuston@riverace.com> + * ace/Basic_Types.h: Add typedef of ptrdiff_t for WinCE 3. Follow-up: + Tue May 6 13:39:27 2003 Steve Huston <shuston@riverace.com> - * tests/FIFO_Test.cpp: Changed main() to ACE_TMAIN() to fix WinCE - (wide char) build error. + * tests/FIFO_Test.cpp: Changed main() to ACE_TMAIN() to fix WinCE + (wide char) build error. - * bin/PerlACE/Process_Win32.pm: Corrected comments about what the - PocketPC script is doing. + * bin/PerlACE/Process_Win32.pm: Corrected comments about what the + PocketPC script is doing. Tue May 6 13:39:27 2003 Steve Huston <shuston@riverace.com> - * ace/Functor.i (ACE_Hash<void*>::operator()): - * ace/OS_Memory.h (ACE_align_binary): Replace ptr_arith_t with - the standard type ptrdiff_t. + * ace/Functor.i (ACE_Hash<void*>::operator()): + * ace/OS_Memory.h (ACE_align_binary): Replace ptr_arith_t with + the standard type ptrdiff_t. - * ace/Basic_Types.h: Removed all the conditionals for trying to figure - out how to define ptr_arith_t. Replaced it with a typedef - ptrdiff_t ptr_arith_t. This is a temporary placeholder until all - ptr_arith_t usage can be expunged from TAO. Required adding - #include <stddef.h> to pick up the ptrdiff_t type. + * ace/Basic_Types.h: Removed all the conditionals for trying to figure + out how to define ptr_arith_t. Replaced it with a typedef + ptrdiff_t ptr_arith_t. This is a temporary placeholder until all + ptr_arith_t usage can be expunged from TAO. Required adding + #include <stddef.h> to pick up the ptrdiff_t type. Tue May 6 11:50:18 2003 Chad Elliott <elliott_c@ociweb.com> diff --git a/bin/MakeProjectCreator/README b/bin/MakeProjectCreator/README index 0eb83f7d76e..9e50383e094 100644 --- a/bin/MakeProjectCreator/README +++ b/bin/MakeProjectCreator/README @@ -123,7 +123,7 @@ verbatim This allows arbitrary information to be place in a generated When MPC is generating a project of type <project type> and comes upon a marker that matches the <location> name, it will place the text found inside the construct directly into - the generated project. If you need to preserve whitespace, + the generated project. If you need to preserve white space, the line or lines should be placed inside double quotes. The Following are GNU only: @@ -135,6 +135,102 @@ tagname Specifies the make macro to check before building the target tagchecks Specifies the values for tagname to check +Custom File Definitions +----------------------- +In order to support a variety of custom build rules, MPC allows you to +define your own custom file types. Below is an example of a custom +definition. + +project { + Define_Custom(MOC) { + automatic = 0 + command = $(QTDIR)/bin/moc + output_option = -o + inputext = .h + pre_extension = _moc + source_outputext = .cpp + } + + MOC_Files { + QtReactor.h + } + + Source_Files { + QtReactor_moc.cpp + } +} + +The above example defines a custom file type "MOC" which describes basic +information about how to process the input files and what output files are +created. Once the custom file type is defined, MOC_Files can be defined in +order to specify the input files for this new file type. + +Here is a list of keywords that can be used within the scope of +Define_Custom: + +automatic If set to 1, then attempt to automatically determine + which files belong to the set of input files for the + custom type. If set to 0, then no files are + automatically added to the input files. If omitted, + then automatic is assumed to be 1. Custom file types + that are automatic will have the side effect of possibly + adding files to Source_Files, Inline_Files, Header_Files + Template_Files, Resource_Files and Documenation_Files + depending on which extension types the command generates. +command The name of the command that should be used to process + the input files for the custom type. +commandflags Any options that should be passed to the command go here. +inputext This is a comma separated list of input file extensions + that belong to the command. +output_option If the command takes an option to specify a single file + output name, then set it here. Otherwise, this should be + omitted. +pre_extension If the command produces multiple files of the same + extension, this comma separated list can be used to + specify them. For example, tao_idl creates two types of + files per extension (C.h, S.h, C.cpp, S.cpp, etc). +pre_filename This is similar to pre_extension except that the values + are prepended to the file name instead of the extension. +source_outputext This is a comma separated list of possible source file + output extensions. If the command does not produce + source files, then this can be omitted. +inline_outputext This is a comma separated list of possible inline file + output extensions. If the command does not produce + inline files, then this can be omitted. +header_outputext This is a comma separated list of possible header file + output extensions. If the command does not produce + header files, then this can be omitted. +template_outputext This is a comma separated list of possible template file + output extensions. If the command does not produce + template files, then this can be omitted. +resource_outputext This is a comma separated list of possible resource file + output extensions. If the command does not produce + resource files, then this can be omitted. +documenation_outputext This is a comma separated list of possible + documentation file output extensions. If the + command does not produce documenation files, then + this can be omitted. + +For custom file types, there are two keywords that can be used within the +custom file type input lists: commandflags and gendir. The commandflags can +be used to augment or override the commandflags defined in the Define_Custom +section. gendir can be used (only if output_option is set in Define_Custom) +to specify the directory in which the generated output will go. Below is an +example: + + MOC_Files { + commandflags += -nw + gendir = moc_generated + QtReactor.h + } + + Source_Files { + moc_generated/QtReactor_moc.cpp + } + +In the above example, the generated file (QtReactor_moc.cpp) is placed in +the moc_generated directory and the -nw option is added to commandflags. + Special Keywords Available to Templates --------------------------------------- project_name This contains the name of the project. @@ -143,9 +239,10 @@ guid This is used by the VC7 project and workspace creator. configurations When used within a foreach context, this info (each configuration) is gathered for use with the VC7 workspace creator. -flag_overrides Used to determine flags that have been overriden on a per +flag_overrides Used to determine flags that have been overridden on a per file basis. - +custom_types The list of custom file types that may have been defined + in the mpc file or a base project. Defaulting Behavior ------------------- diff --git a/bin/MakeProjectCreator/modules/Creator.pm b/bin/MakeProjectCreator/modules/Creator.pm index 15a7c0f7abc..5f03e567eb4 100644 --- a/bin/MakeProjectCreator/modules/Creator.pm +++ b/bin/MakeProjectCreator/modules/Creator.pm @@ -102,11 +102,13 @@ sub generate_default_input { my($status) = 0; my($error) = ''; - ## We are throwing away the error string. In both Workspace and - ## Project creators, we don't care about this error string just the - ## status. ($status, $error) = $self->parse_line(undef, "$self->{'grammar_type'} {"); ($status, $error) = $self->parse_line(undef, '}'); + + if (!$status) { + print STDERR "$error\n"; + } + return $status; } diff --git a/bin/MakeProjectCreator/modules/ProjectCreator.pm b/bin/MakeProjectCreator/modules/ProjectCreator.pm index a90c60ee9e9..59a31c7405d 100644 --- a/bin/MakeProjectCreator/modules/ProjectCreator.pm +++ b/bin/MakeProjectCreator/modules/ProjectCreator.pm @@ -63,9 +63,57 @@ my(%validNames) = ('exename' => 1, 'idlgendir' => 1, ); +## Custom definitions only +my(%customDefined) = ('automatic' => 1, + 'command' => 1, + 'commandflags' => 1, + 'inputext' => 1, + 'output_option' => 1, + 'pre_extension' => 1, + 'pre_filename' => 1, + 'source_outputext' => 1, + 'template_outputext' => 1, + 'header_outputext' => 1, + 'inline_outputext' => 1, + 'documentation_outputext' => 1, + 'resource_outputext' => 1, + ); + +## Custom sections as well as definitions +my(%custom) = ('commandflags' => 1, + 'gendir' => 1, + ); + ## Deal with these components in a special way my(@specialComponents) = ('header_files', 'inline_files'); +## Valid component names within a project along with the valid file extensions +my(%vc) = ('source_files' => [ "\\.cpp", "\\.cxx", "\\.cc", "\\.c", "\\.C", ], + 'template_files' => [ "_T\\.cpp", "_T\\.cxx", "_T\\.cc", "_T\\.c", "_T\\.C", ], + 'header_files' => [ "\\.h", "\\.hxx", "\\.hh", ], + 'inline_files' => [ "\\.i", "\\.inl", ], + 'idl_files' => [ "\\.idl", ], + 'documentation_files' => [ "README", "readme", "\\.doc", "\\.txt", ], + 'resource_files' => [ "\\.rc", ], + ); + +## Exclude these extensions when auto generating the component values +my(%ec) = ('source_files' => [ "_T\\.cpp", "_T\\.cxx", "_T\\.cc", "_T\\.C", ], + ); + +## Match up assignments with the valid components +my(%ma) = ('idl_files' => [ 'idlgendir', 'idlflags' ], + ); + +my(%genext) = ('idl_files' => {'automatic' => 1, + 'pre_filename' => [ '' ], + 'pre_extension' => [ 'C', 'S' ], + 'source_files' => [ '\\.cpp', '\\.cxx', '\\.cc', '\\.C', ], + 'inline_files' => [ '\\.i', '\\.inl', ], + 'header_files' => [ '\\.h', '\\.hxx', '\\.hh', ], + }, + ); + # ************************************************************ # Subroutine Section # ************************************************************ @@ -97,42 +145,16 @@ sub new { $self->{'lexe_template_input'} = undef; $self->{'lib_template_input'} = undef; $self->{'dll_template_input'} = undef; - $self->{'idl_defaulted'} = 0; - $self->{'source_defaulted'} = 0; $self->{'writing_type'} = 0; $self->{'flag_overrides'} = {}; $self->{'special_supplied'} = {}; + $self->{'verbatim'} = {}; + $self->{'type_specific_assign'} = {}; + $self->{'pctype'} = $self->extractType("$self"); + $self->{'defaulted'} = {}; + $self->{'custom_types'} = {}; - ## Set up the verbatim constructs - $self->{'verbatim'} = {}; - - ## Valid component names within a project along with the valid file extensions - my(%vc) = ('source_files' => [ "\\.cpp", "\\.cxx", "\\.cc", "\\.c", "\\.C", ], - 'template_files' => [ "_T\\.cpp", "_T\\.cxx", "_T\\.cc", "_T\\.c", "_T\\.C", ], - 'header_files' => [ "\\.h", "\\.hxx", "\\.hh", ], - 'inline_files' => [ "\\.i", "\\.inl", ], - 'idl_files' => [ "\\.idl", ], - 'documentation_files' => [ "README", "readme", "\\.doc", "\\.txt", ], - 'resource_files' => [ "\\.rc", ], - ); - - ## Exclude these extensions when auto generating the component values - my(%ec) = ('source_files' => [ "_T\\.cpp", "_T\\.cxx", "_T\\.cc", "_T\\.C", ], - ); - - ## Match up assignments with the valid components - my(%ma) = ('source_files' => [ 'includes' ], - 'idl_files' => [ 'idlgendir', 'idlflags' ], - ); - $self->{'matching_assignments'} = \%ma; - $self->{'valid_components'} = \%vc; - $self->{'exclude_components'} = \%ec; - $self->{'skeleton_endings'} = [ 'C', 'S' ]; - $self->{'type_specific_assign'} = {}; - $self->{'pctype'} = $self->extractType("$self"); - - ## Allow subclasses to override the default extensions - $self->set_component_extensions(); + $self->reset_generating_types(); return $self; } @@ -212,21 +234,21 @@ sub parse_line { if ($status) { ## End of project; Write out the file. - $self->write_project(); + ($status, $errorString) = $self->write_project(); foreach my $key (keys %{$self->{'valid_components'}}) { delete $self->{$key}; + $self->{'defaulted'}->{$key} = 0; } - $self->{'assign'} = {}; - $self->{'verbatim'} = {}; + $self->{'assign'} = {}; + $self->{'verbatim'} = {}; + $self->{'special_supplied'} = {}; $self->{'type_specific_assign'} = {}; + $self->{'flag_overrides'} = {}; + $self->reset_generating_types(); } } - $self->{$typecheck} = 0; - $self->{'idl_defaulted'} = 0; - $self->{'flag_overrides'} = {}; - $self->{'source_defaulted'} = 0; - $self->{'special_supplied'} = {}; + $self->{$typecheck} = 0; } else { ## Project Beginning @@ -373,6 +395,9 @@ sub parse_line { $ih, $values[1], $values[2], \%validNames, $self->{'type_specific_assign'}->{$self->{'pctype'}}); } + elsif ($comp eq 'define_custom') { + ($status, $errorString) = $self->parse_define_custom($ih, $name); + } else { $errorString = "ERROR: Invalid component name: $comp"; $status = 0; @@ -392,6 +417,62 @@ sub parse_line { } +sub parse_scoped_assignment { + my($self) = shift; + my($tag) = shift; + my($type) = shift; + my($name) = shift; + my($value) = shift; + my($flags) = shift; + my($over) = {}; + my($status) = 0; + + if (defined $self->{'matching_assignments'}->{$tag}) { + foreach my $possible (@{$self->{'matching_assignments'}->{$tag}}) { + if ($possible eq $name) { + $status = 1; + last; + } + } + } + + if ($status) { + if (defined $self->{'flag_overrides'}->{$tag}) { + $over = $self->{'flag_overrides'}->{$tag}; + } + else { + $self->{'flag_overrides'}->{$tag} = $over; + } + + if ($type eq 'assignment') { + $self->process_assignment($name, + $value, $flags); + } + elsif ($type eq 'assign_add') { + ## If there is no value in $$flags, then we need to get + ## the outer scope value and put it in there. + if (!defined $self->get_assignment($name, $flags)) { + my($outer) = $self->get_assignment($name); + $self->process_assignment($name, $outer, $flags); + } + $self->process_assignment_add($name, + $value, $flags); + } + elsif ($type eq 'assign_sub') { + ## If there is no value in $$flags, then we need to get + ## the outer scope value and put it in there. + if (!defined $self->get_assignment($name, $flags)) { + my($outer) = $self->get_assignment($name); + $self->process_assignment($name, $outer, $flags); + } + $self->process_assignment_sub($name, + $value, $flags); + } + } + return $status; +} + + sub parse_components { my($self) = shift; my($fh) = shift; @@ -466,37 +547,9 @@ sub parse_components { my(@values) = (); ## If this returns true, then we've found an assignment if ($self->parse_assignment($line, \@values)) { - my($over) = {}; - if (defined $self->{'flag_overrides'}->{$tag}) { - $over = $self->{'flag_overrides'}->{$tag}; - } - else { - $self->{'flag_overrides'}->{$tag} = $over; - } - - if ($values[0] eq 'assignment') { - $self->process_assignment($values[1], - $values[2], \%flags); - } - elsif ($values[0] eq 'assign_add') { - ## If there is no value in %flags, then we need to get - ## the outer scope value and put it in there. - if (!defined $self->get_assignment($values[1], \%flags)) { - my($outer) = $self->get_assignment($values[1]); - $self->process_assignment($values[1], $outer, \%flags); - } - $self->process_assignment_add($values[1], - $values[2], \%flags); - } - elsif ($values[0] eq 'assign_sub') { - ## If there is no value in %flags, then we need to get - ## the outer scope value and put it in there. - if (!defined $self->get_assignment($values[1], \%flags)) { - my($outer) = $self->get_assignment($values[1]); - $self->process_assignment($values[1], $outer, \%flags); - } - $self->process_assignment_sub($values[1], - $values[2], \%flags); + $status = $self->parse_scoped_assignment($tag, @values, \%flags); + if (!$status) { + last; } } else { @@ -553,6 +606,147 @@ sub parse_verbatim { } +sub process_array_assignment { + my($self) = shift; + my($aref) = shift; + my($type) = shift; + my($array) = shift; + + if (!defined $$aref || $type eq 'assignment') { + if ($type ne 'assign_sub') { + $$aref = $array; + } + } + else { + if ($type eq 'assign_add') { + push(@{$$aref}, @$array); + } + elsif ($type eq 'assign_sub') { + my($count) = scalar(@{$$aref}); + for(my $i = 0; $i < $count; ++$i) { + foreach my $val (@$array) { + if ($$aref->[$i] eq $val) { + splice(@{$$aref}, $i, 1); + --$i; + --$count; + last; + } + } + } + } + } +} + + +sub parse_define_custom { + my($self) = shift; + my($fh) = shift; + my($tag) = shift; + my($status) = 0; + my($errorString) = "ERROR: Unable to process $tag"; + my(%flags) = (); + + ## Make the tag something _files + $tag = lc($tag) . '_files'; + + if (defined $self->{'valid_components'}->{$tag}) { + $errorString = "ERROR: $tag has already been defined"; + } + else { + ## Update the custom_types assignment + $self->process_assignment_add('custom_types', $tag); + + if (!defined $self->{'matching_assignments'}->{$tag}) { + my(@keys) = keys %custom; + $self->{'matching_assignments'}->{$tag} = \@keys; + } + + while(<$fh>) { + my($line) = $self->strip_line($_); + + if ($line eq '') { + } + elsif ($line =~ /^}/) { + $status = 1; + $errorString = ''; + if (!defined $self->{'generated_exts'}->{$tag}->{'pre_filename'}) { + $self->{'generated_exts'}->{$tag}->{'pre_filename'} = [ '' ]; + } + if (!defined $self->{'generated_exts'}->{$tag}->{'pre_extension'}) { + $self->{'generated_exts'}->{$tag}->{'pre_extension'} = [ '' ]; + } + if (!defined $self->{'generated_exts'}->{$tag}->{'automatic'}) { + $self->{'generated_exts'}->{$tag}->{'automatic'} = 1; + } + last; + } + else { + my(@values) = (); + ## If this returns true, then we've found an assignment + if ($self->parse_assignment($line, \@values)) { + my($type) = $values[0]; + my($name) = $values[1]; + my($value) = $values[2]; + if (defined $customDefined{$name}) { + if ($name eq 'inputext') { + $value = $self->escape_regex_special($value); + my(@array) = split(/\s*,\s*/, $value); + $self->process_array_assignment( + \$self->{'valid_components'}->{$tag}, $type, \@array); + } + else { + if (!defined $self->{'generated_exts'}->{$tag}) { + $self->{'generated_exts'}->{$tag} = {}; + } + if ($name eq 'command' || $name eq 'automatic' || + $name eq 'commandflags' || $name eq 'output_option') { + if ($type eq 'assignment') { + $self->process_assignment( + $name, $value, + $self->{'generated_exts'}->{$tag}); + } + elsif ($type eq 'assign_add') { + $self->process_assignment_add( + $name, $value, + $self->{'generated_exts'}->{$tag}); + } + elsif ($type eq 'assign_sub') { + $self->process_assignment_sub( + $name, $value, + $self->{'generated_exts'}->{$tag}); + } + } + else { + ## Transform the name from something outputext to + ## something files. We expect this to match the + ## names of valid_assignments. + $name =~ s/outputext/files/g; + + ## Get it ready for regular expressions + $value = $self->escape_regex_special($value); + + ## Process the array assignment + my(@array) = split(/\s*,\s*/, $value); + $self->process_array_assignment( + \$self->{'generated_exts'}->{$tag}->{$name}, + $type, \@array); + } + } + } + else { + $status = 0; + $errorString = "ERROR: Invalid assignment name: $name"; + last; + } + } + } + } + } + + return $status, $errorString; +} + + sub handle_scoped_end { my($self) = shift; my($type) = shift; @@ -690,34 +884,29 @@ sub already_added { } -sub add_idl_generated { +sub add_generated_files { my($self) = shift; + my($gentype) = shift; my($tag) = shift; - my($idl) = shift; + my($arr) = shift; my($names) = $self->{$tag}; - my($vc) = $self->{'valid_components'}; - my($wanted) = $$vc{$tag}->[0]; - my(@added) = (); + my($wanted) = $self->{'valid_components'}->{$gentype}->[0]; - $wanted =~ s/\\//; foreach my $name (keys %$names) { my($comps) = $$names{$name}; foreach my $key (keys %$comps) { + my(@added) = (); my($array) = $$comps{$key}; - foreach my $i (@$idl) { + foreach my $i (@$arr) { my($file) = $i; - $file =~ s/\.idl$//; - foreach my $ending (@{$self->{'skeleton_endings'}}) { - my($created) = "$file$ending$wanted"; - if (!$self->already_added($array, $created)) { - push(@added, $created); + $file =~ s/$wanted$//; + foreach my $pf (@{$self->{'generated_exts'}->{$gentype}->{'pre_filename'}}) { + foreach my $pe (@{$self->{'generated_exts'}->{$gentype}->{'pre_extension'}}) { + $self->list_generated_file($gentype, $tag, \@added, "$pf$file$pe"); } } } - ## Put the generated files at the front - if (defined $added[0]) { - unshift(@$array, @added); - } + unshift(@$array, @added); } } } @@ -893,12 +1082,7 @@ sub escape_regex_special { my($self) = shift; my($name) = shift; - $name =~ s/\\/\\\\/g; - $name =~ s/\$/\\\$/g; - $name =~ s/\[/\\\[/g; - $name =~ s/\]/\\\]/g; - $name =~ s/\(/\\\(/g; - $name =~ s/\)/\\\)/g; + $name =~ s/([\\\$\[\]\(\)\.])/\\$1/g; return $name; } @@ -1022,39 +1206,43 @@ sub generate_default_components { if (!$self->is_special_tag($tag)) { $self->sift_files($files, $exts, $pchh, $pchc, $tag, $array); - if ($tag eq 'idl_files' && defined $$array[0]) { - $self->{'idl_defaulted'} = 1; + if (defined $self->{'generated_exts'}->{$tag}) { + if (defined $$array[0]) { + $self->{'defaulted'}->{$tag} = 1; + } } elsif ($tag eq 'source_files') { - ## If we are auto-generating the source_files, then - ## we need to make sure that any idl generated source - ## files that are added are put at the front of the list. - my(@front) = (); - my(@copy) = @$array; - my(@exts) = $self->generated_source_extensions($tag); - - $self->{'source_defaulted'} = 1; - @$array = (); - foreach my $file (@copy) { - my($found) = 0; - foreach my $ext (@exts) { - if ($file =~ /$ext$/) { + foreach my $gentype (keys %{$self->{'generated_exts'}}) { + ## If we are auto-generating the source_files, then + ## we need to make sure that any generated source + ## files that are added are put at the front of the list. + my(@front) = (); + my(@copy) = @$array; + my(@exts) = $self->generated_extensions($gentype, $tag); + + $self->{'defaulted'}->{$tag} = 1; + @$array = (); + foreach my $file (@copy) { + my($found) = 0; + foreach my $ext (@exts) { + if ($file =~ /$ext$/) { + ## No need to check for previously added files + ## here since there are none. + push(@front, $file); + $found = 1; + last; + } + } + if (!$found) { ## No need to check for previously added files ## here since there are none. - push(@front, $file); - $found = 1; - last; + push(@$array, $file); } } - if (!$found) { - ## No need to check for previously added files - ## here since there are none. - push(@$array, $file); - } - } - if (defined $front[0]) { - unshift(@$array, @front); + if (defined $front[0]) { + unshift(@$array, @front); + } } } } @@ -1079,7 +1267,7 @@ sub remove_duplicated_files { my($count) = scalar(@$array); for(my $i = 0; $i < $count; ++$i) { foreach my $sfile (@slist) { - ## Is the source file is in the component array? + ## Is the source file in the component array? if ($$array[$i] eq $sfile) { ## Remove the element and fix the index and count splice(@$array, $i, 1); @@ -1094,28 +1282,31 @@ sub remove_duplicated_files { } -sub generated_source_extensions { +sub generated_extensions { my($self) = shift; + my($name) = shift; my($tag) = shift; - my($vc) = $self->{'valid_components'}; - my($gc) = $$vc{$tag}; - my(@gen) = (); + my(@exts) = (); + my($gen) = $self->{'generated_exts'}->{$name}; - foreach my $e (@$gc) { - foreach my $ending (@{$self->{'skeleton_endings'}}) { - push(@gen, "$ending$e"); + if (defined $gen->{$tag}) { + foreach my $pe (@{$gen->{'pre_extension'}}) { + foreach my $ext (@{$gen->{$tag}}) { + push(@exts, "$pe$ext"); + } } } - return @gen; + return @exts; } sub generated_source_listed { my($self) = shift; + my($gent) = shift; my($tag) = shift; - my($idl) = shift; + my($arr) = shift; my($names) = $self->{$tag}; - my(@gen) = $self->generated_source_extensions($tag); + my(@gen) = $self->generated_extensions($gent, $tag); my(@found) = (); ## Find out which generated source files are listed @@ -1125,7 +1316,7 @@ sub generated_source_listed { my($array) = $$comps{$key}; foreach my $val (@$array) { foreach my $ext (@gen) { - foreach my $i (@$idl) { + foreach my $i (@$arr) { my($ifile) = $self->escape_regex_special($i); if ($val =~ /$ifile$ext$/) { push(@found, $val); @@ -1139,32 +1330,35 @@ sub generated_source_listed { } -sub generate_default_idl_generated { - my($self) = shift; - my($tags) = shift; +sub list_default_generated { + my($self) = shift; + my($gentype) = shift; + my($tags) = shift; - if ($self->{'idl_defaulted'}) { + if ($self->{'defaulted'}->{$gentype} && + $self->{'generated_exts'}->{$gentype}->{'automatic'}) { ## After all source and headers have been defaulted, see if we - ## need to add the idl generated .h, .i and .cpp files - if (defined $self->{'idl_files'}) { - ## Build up the list of idl files - my(@idl) = (); - my($names) = $self->{'idl_files'}; + ## need to add the generated .h, .i and .cpp files + if (defined $self->{$gentype}) { + ## Build up the list of files + my(@arr) = (); + my($wanted) = $self->{'valid_components'}->{$gentype}->[0]; + my($names) = $self->{$gentype}; foreach my $name (keys %$names) { my($comps) = $$names{$name}; foreach my $key (keys %$comps) { my($array) = $$comps{$key}; foreach my $val (@$array) { my($f) = $val; - $f =~ s/\.idl$//; - push(@idl, $f); + $f =~ s/$wanted$//; + push(@arr, $f); } } } foreach my $type (@$tags) { - if (!$self->generated_source_listed($type, \@idl)) { - $self->add_idl_generated($type, \@idl); + if (!$self->generated_source_listed($gentype, $type, \@arr)) { + $self->add_generated_files($gentype, $type, \@arr); } } } @@ -1172,13 +1366,57 @@ sub generate_default_idl_generated { } -sub add_source_corresponding_component_files { +sub list_generated_file { + my($self) = shift; + my($gentype) = shift; + my($tag) = shift; + my($array) = shift; + my($file) = shift; + + if (defined $self->{'generated_exts'}->{$gentype}->{$tag}) { + my(@gen) = $self->get_component_list($gentype); + my(@genexts) = $self->generated_extensions($gentype, $tag); + foreach my $gen (@gen) { + ## If we are converting slashes, then we need to + ## convert the component back to forward slashes + if ($self->convert_slashes()) { + $gen =~ s/\\/\//g; + } + + ## Remove the extension + my($start) = $gen; + foreach my $ext (@{$self->{'valid_components'}->{$gentype}}) { + $gen =~ s/$ext$//; + if ($gen ne $start) { + last; + } + } + + ## See if we need to add the file + foreach my $pf (@{$self->{'generated_exts'}->{$gentype}->{'pre_filename'}}) { + foreach my $genext (@genexts) { + if ("$pf$gen$genext" =~ /$file(.*)?$/) { + my($created) = "$file$1"; + $created =~ s/\\//g; + if (!$self->already_added($array, $created)) { + push(@$array, $created); + } + last; + } + } + } + } + } +} + + +sub add_corresponding_component_files { my($self) = shift; + my($ftags) = shift; my($tag) = shift; my(@all) = (); - my($vc) = $self->{'valid_components'}; - foreach my $filetag ('source_files', 'template_files') { + foreach my $filetag (@$ftags) { my($names) = $self->{$filetag}; foreach my $name (keys %$names) { my($comps) = $$names{$name}; @@ -1188,74 +1426,47 @@ sub add_source_corresponding_component_files { } } - ## We need to cross-check the idl files. But we need to remove - ## the idl extension first. - my(@idl) = $self->get_component_list('idl_files'); - for(my $i = 0; $i <= $#idl; $i++) { - $idl[$i] =~ s/\.idl$//; + my(@exts) = (); + my($names) = $self->{$tag}; + + foreach my $ext (@{$self->{'valid_components'}->{$tag}}) { + $ext =~ s/\\//g; + push(@exts, $ext); } - ## for each cpp file, we add a corresponding header or inline file - ## if it exists and is not already in the list of headers - my($names) = $self->{$tag}; foreach my $name (keys %$names) { my($comps) = $$names{$name}; foreach my $comp (keys %$comps) { my($array) = $$comps{$comp}; - foreach my $cpp (@all) { + foreach my $sfile (@all) { my($found) = 0; - my($c) = $cpp; - $c =~ s/\.[^\.]+$//; + my($scopy) = $sfile; + $scopy =~ s/\.[^\.]+$//; foreach my $file (@$array) { - my($added) = $c; - if ($file =~ /(\.[^\.]+)$/) { - $added .= $1; - } - - if ($added eq $file) { - $found = 1; - last; + foreach my $ext (@exts) { + if ("$scopy$ext" eq $file) { + $found = 1; + last; + } + if ($found) { + last; + } } } if (!$found) { - my($added) = 0; - foreach my $e (@{$$vc{$tag}}) { - my($ext) = $e; - $ext =~ s/\\//g; - - ## If the file is readable - my($file) = "$c$ext"; - if (-r $file) { - if (!$self->already_added($array, $file)) { - push(@$array, $file); - } - $added = 1; - last; + foreach my $ext (@exts) { + my($built) = "$scopy$ext"; + if (-r $built) { + push(@$array, $built); + $found = 1; + last; } } - if (!$added) { - ## If we did not add the file in the above loop, - ## we must check to see if the file *would be* generated - ## from idl. If so, we will add the file with the default - ## (i.e. first) file extension. - foreach my $idlfile (@idl) { - my($idl) = $self->escape_regex_special($idlfile); - if ($c =~ /^$idl/) { - foreach my $ending (@{$self->{'skeleton_endings'}}) { - if ($c =~ /^$idl$ending$/) { - my($ext) = $$vc{$tag}->[0]; - $ext =~ s/\\//g; - my($file) = "$c$ext"; - if (!$self->already_added($array, $file)) { - push(@$array, $file); - } - $added = 1; - last; - } - } - } - last; + + if (!$found) { + foreach my $gentype (keys %{$self->{'generated_exts'}}) { + $self->list_generated_file($gentype, $tag, $array, $scopy); } } } @@ -1309,14 +1520,17 @@ sub generate_defaults { ## once, we need to remove the extras $self->remove_extra_pch_listings(); - ## Generate the default idl generated list of source files - ## only if we defaulted the idl file list - $self->generate_default_idl_generated(['source_files']); + ## Generate the default generated list of source files + ## only if we defaulted the generated file list + foreach my $gentype (keys %{$self->{'generated_exts'}}) { + $self->list_default_generated($gentype, ['source_files']); + } ## Add @specialComponents files based on the ## source_components (i.e. .h and .i or .inl based on .cpp) foreach my $tag (@specialComponents) { - $self->add_source_corresponding_component_files($tag); + $self->add_corresponding_component_files(['source_files', + 'template_files'], $tag); } ## Now, if the @specialComponents are still empty @@ -1329,7 +1543,8 @@ sub generate_defaults { my($comps) = $$names{$name}; foreach my $comp (keys %$comps) { my($array) = $$comps{$comp}; - if (!defined $$array[0] || $self->{'source_defaulted'}) { + if (!defined $$array[0] || + $self->{'defaulted'}->{'source_files'}) { $self->generate_default_components(\@files, $tag); } } @@ -1390,12 +1605,101 @@ sub get_component_list { } +sub check_custom_output { + my($self) = shift; + my($based) = shift; + my($pf) = shift; + my($cinput) = shift; + my($type) = shift; + my($comps) = shift; + my(@outputs) = (); + my($gen) = $self->{'generated_exts'}->{$based}; + + if (defined $gen->{$type}) { + foreach my $pe (@{$gen->{'pre_extension'}}) { + foreach my $ext (@{$gen->{$type}}) { + my($ge) = "$pe$ext"; + $ge =~ s/\\//g; + my($built) = "$pf$cinput$ge"; + if (@$comps == 0) { + push(@outputs, $built); + last; + } + else { + foreach my $c (@$comps) { + if ($c =~ /$built$/) { + push(@outputs, $built); + last; + } + } + } + } + } + } + + return @outputs; +} + + +sub get_custom_value { + my($self) = shift; + my($cmd) = shift; + my($based) = shift; + my($value) = undef; + + if ($cmd eq 'input_files') { + my(@array) = $self->get_component_list($based); + $value = \@array; + + $self->{'custom_output_files'} = {}; + my(%vcomps) = (); + foreach my $vc (keys %{$self->{'valid_components'}}) { + my(@comps) = $self->get_component_list($vc); + $vcomps{$vc} = \@comps; + } + foreach my $input (@array) { + my(@outputs) = (); + my($cinput) = $input; + $cinput =~ s/\.[^\.]+$//; + foreach my $pf (@{$self->{'generated_exts'}->{$based}->{'pre_filename'}}) { + foreach my $vc (keys %{$self->{'valid_components'}}) { + push(@outputs, + $self->check_custom_output($based, $pf, + $cinput, $vc, $vcomps{$vc})); + } + } + $self->{'custom_output_files'}->{$input} = \@outputs; + } + } + elsif ($cmd eq 'output_files') { + # Generate output files based on $based + if (defined $self->{'custom_output_files'}) { + $value = $self->{'custom_output_files'}->{$based}; + } + } + elsif ($cmd eq 'inputexts') { + my(@array) = @{$self->{'valid_components'}->{$based}}; + foreach my $val (@array) { + $val =~ s/\\\.//g; + } + $value = \@array; + } + elsif ($cmd eq 'command' || + $cmd eq 'output_option' || defined $custom{$cmd}) { + $value = $self->get_assignment($cmd, + $self->{'generated_exts'}->{$based}); + } + + return $value; +} + + sub need_to_write_project { my($self) = shift; - foreach my $key ('source_files', 'idl_files') { + foreach my $key ('source_files', keys %{$self->{'generated_exts'}}) { my($names) = $self->{$key}; foreach my $name (keys %$names) { - foreach my $key (sort keys %{$names->{$name}}) { + foreach my $key (keys %{$names->{$name}}) { if (defined $names->{$name}->{$key}->[0]) { return 1; } @@ -1497,13 +1801,9 @@ sub write_project { $prjname . $self->get_type_append()); ($status, $error) = $self->write_output_file($name); } - - if (!$status) { - print STDERR "$error\n"; - } } - return $status; + return $status, $error; } @@ -1546,6 +1846,29 @@ sub reset_values { } +sub reset_generating_types { + my($self) = shift; + + foreach my $key (keys %ma) { + $self->{'matching_assignments'}->{$key} = $ma{$key}; + } + foreach my $key (keys %vc) { + $self->{'valid_components'}->{$key} = $vc{$key}; + } + foreach my $key (keys %genext) { + $self->{'generated_exts'}->{$key} = $genext{$key}; + } + foreach my $key (keys %ec) { + $self->{'exclude_components'}->{$key} = $ec{$key}; + } + + $self->{'custom_types'} = {}; + + ## Allow subclasses to override the default extensions + $self->set_component_extensions(); +} + + sub get_template_input { my($self) = shift; diff --git a/bin/MakeProjectCreator/modules/TemplateParser.pm b/bin/MakeProjectCreator/modules/TemplateParser.pm index affbea00a04..6fe8f1986f1 100644 --- a/bin/MakeProjectCreator/modules/TemplateParser.pm +++ b/bin/MakeProjectCreator/modules/TemplateParser.pm @@ -218,7 +218,7 @@ sub relative { my($rel) = $self->{'prjc'}->get_relative(); my(@keys) = keys %$rel; - if (defined $value && defined $keys[0] && $value =~ /\$/) { + if (defined $value && defined $keys[0]) { if (UNIVERSAL::isa($value, 'ARRAY')) { my(@built) = (); foreach my $val (@$value) { @@ -226,7 +226,7 @@ sub relative { } $value = \@built; } - else { + elsif ($value =~ /\$/) { my($cwd) = $self->getcwd(); my($start) = 0; my($fixed) = 0; @@ -289,6 +289,24 @@ sub relative { } +sub get_nested_value { + my($self) = shift; + my($name) = shift; + my($value) = undef; + + if ($name =~ /^(.*)\->(\w+)/) { + my($pre) = $1; + my($post) = $2; + my($base) = $self->get_value($pre); + if (defined $base) { + $value = $self->{'prjc'}->get_custom_value($post, $base); + } + } + + return $value; +} + + sub get_value { my($self) = shift; my($name) = shift; @@ -306,9 +324,8 @@ sub get_value { if (!defined $value) { ## Next, check for a template value - my($ti) = $self->{'ti'}; - if (defined $ti) { - $value = $ti->get_value($name); + if (defined $self->{'ti'}) { + $value = $self->{'ti'}->get_value($name); if (defined $value) { $value = $self->adjust_value($name, $value); } @@ -333,6 +350,9 @@ sub get_value { ## Call back onto the project creator to allow ## it to fill in the value before defaulting to undef. $value = $self->{'prjc'}->fill_value($name); + if (!defined $value && $name =~ /\->/) { + $value = $self->get_nested_value($name); + } } } } @@ -501,32 +521,43 @@ sub get_flag_overrides { my($prjc) = $self->{'prjc'}; my($fo) = $prjc->{'flag_overrides'}; - foreach my $key (keys %$fo) { - if ($key =~ /^$name/) { - foreach my $of (keys %{$$fo{$key}}) { - my($cv) = $of; - if ($prjc->convert_slashes()) { - $cv = $prjc->slash_to_backslash($of); - } - if ($cv eq $file) { - foreach my $ma (keys %{$prjc->{'matching_assignments'}}) { - if ($ma eq $key) { - foreach my $aname (@{$prjc->{'matching_assignments'}->{$ma}}) { - if ($aname eq $type && - defined $$fo{$key}->{$of}->{$aname}) { - $value = $$fo{$key}->{$of}->{$aname}; - last; + if (defined $file) { + ## Replace the custom_type key with the actual custom type + if ($name =~ /^custom_type\->/) { + my($ct) = $self->get_value('custom_type'); + if (defined $ct) { + $name = $ct; + } + } + + foreach my $key (keys %$fo) { + if ($key =~ /^$name/) { + foreach my $of (keys %{$$fo{$key}}) { + my($cv) = $of; + if ($prjc->convert_slashes()) { + $cv = $prjc->slash_to_backslash($of); + } + if ($cv eq $file) { + foreach my $ma (keys %{$prjc->{'matching_assignments'}}) { + if ($ma eq $key) { + foreach my $aname (@{$prjc->{'matching_assignments'}->{$ma}}) { + if ($aname eq $type && + defined $$fo{$key}->{$of}->{$aname}) { + $value = $$fo{$key}->{$of}->{$aname}; + last; + } } + last; } - last; } + last; } - last; } + last; } - last; } } + return $value; } @@ -580,9 +611,11 @@ sub handle_else { sub handle_foreach { - my($self) = shift; - my($val) = shift; - my($name) = 'endfor'; + my($self) = shift; + my($val) = shift; + my($name) = 'endfor'; + my($status) = 1; + my($errorString) = ''; push(@{$self->{'lstack'}}, $self->line_number()); if (!$self->{'if_skip'}) { @@ -594,6 +627,15 @@ sub handle_foreach { $vname =~ s/\s+$//; $val =~ s/^\s+//; $val =~ s/\s+$//; + + ## Due to the way flag_overrides works, we can't allow + ## the user to name the foreach variable when dealing + ## with custom types. + if ($val =~ /^custom_type\->/ || $val eq 'custom_types') { + $status = 0; + $errorString = 'ERROR: The foreach variable can not be ' . + 'named when dealing with custom types'; + } } push(@{$self->{'sstack'}}, $name); @@ -608,6 +650,8 @@ sub handle_foreach { else { push(@{$self->{'sstack'}}, "*$name"); } + + return $status, $errorString; } @@ -750,7 +794,7 @@ sub process_name { if ($line eq '') { } - elsif ($line =~ /^(\w+)(\(([^\)]+|\".*\"|flag_overrides\([^\)]+,\s*[^\)]+\))\))?%>/) { + elsif ($line =~ /^(\w+)(\(([^\)]+|\".*\"|flag_overrides\([^\)]+,\s*[^\)]+\))\)|\->\w+([\w\-\>]+)?)?%>/) { my($name, $val) = $self->split_name_value($line); $length += length($name); @@ -769,7 +813,7 @@ sub process_name { $self->handle_else(); } elsif ($name eq 'foreach') { - $self->handle_foreach($val); + ($status, $errorString) = $self->handle_foreach($val); } elsif ($name eq 'fornotlast' || $name eq 'forlast' || $name eq 'fornotfirst' || $name eq 'forfirst') { @@ -994,7 +1038,7 @@ sub parse_file { if (!$status) { my($linenumber) = $self->line_number(); - $errorString = "$input: line $linenumber: $errorString\n"; + $errorString = "$input: line $linenumber:\n$errorString\n"; } return $status, $errorString; diff --git a/bin/MakeProjectCreator/modules/WorkspaceCreator.pm b/bin/MakeProjectCreator/modules/WorkspaceCreator.pm index cfd41aa0e81..1ca72a4e15e 100644 --- a/bin/MakeProjectCreator/modules/WorkspaceCreator.pm +++ b/bin/MakeProjectCreator/modules/WorkspaceCreator.pm @@ -118,7 +118,7 @@ sub parse_line { ## Generate the project files my($gstat, $generator) = $self->generate_project_files(); if ($gstat) { - $self->write_workspace($generator, 1); + ($status, $errorString) = $self->write_workspace($generator, 1); $self->{'assign'} = {}; } else { @@ -455,6 +455,7 @@ sub write_workspace { my($generator) = shift; my($addfile) = shift; my($status) = 1; + my($error) = ''; if ($self->get_toplevel()) { my($name) = $self->transform_file_name($self->workspace_file_name()); @@ -481,7 +482,8 @@ sub write_workspace { } } else { - print STDERR "ERROR: Unable to open $name for output\n"; + $error = 'ERROR: Unable to open ' . $self->getcwd() . + "/$name for output"; $status = 0; } } @@ -491,7 +493,7 @@ sub write_workspace { } } - return $status; + return $status, $error; } @@ -615,7 +617,11 @@ sub generate_project_files { $self->{'project_info'} = \%perpi; ## Write our per project workspace - $self->write_workspace($generator); + my($error) = ''; + ($status, $error) = $self->write_workspace($generator); + if (!$status) { + print STDERR "$error\n"; + } ## Reset our project information to empty $self->{'projects'} = []; diff --git a/bin/MakeProjectCreator/templates/bor.mpd b/bin/MakeProjectCreator/templates/bor.mpd index 2bb6f2583fd..298ddfc76e8 100644 --- a/bin/MakeProjectCreator/templates/bor.mpd +++ b/bin/MakeProjectCreator/templates/bor.mpd @@ -148,3 +148,17 @@ $(IDLDIR)\<%basenoextension(idl_file)%>S.cpp $(IDLDIR)\<%basenoextension(idl_fil <%endif%> <%endfor%> <%endif%> +<%foreach(custom_types)%> + +# +# <%custom_type%> rules +# + +<%foreach(custom_type->input_files)%> +<%foreach(custom_type->input_file->output_files)%> +<%if(custom_type->output_option)%><%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>\<%endif%><%endif%><%custom_type->input_file->output_file%>: <%custom_type->input_file%> + <%custom_type->command%> <%if(flag_overrides(custom_type->input_file, commandflags))%><%flag_overrides(custom_type->input_file, commandflags)%><%else%><%custom_type->commandflags%><%endif%> $** <%if(custom_type->output_option)%><%custom_type->output_option%> <%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>\<%endif%><%custom_type->input_file->output_file%><%endif%> + +<%endfor%> +<%endfor%> +<%endfor%> diff --git a/bin/MakeProjectCreator/templates/em3vcp.mpd b/bin/MakeProjectCreator/templates/em3vcp.mpd index 3dfd2349c29..2363d1ebd5f 100644 --- a/bin/MakeProjectCreator/templates/em3vcp.mpd +++ b/bin/MakeProjectCreator/templates/em3vcp.mpd @@ -227,5 +227,50 @@ BuildCmds= \ <%endfor%> # End Group <%endif%> +<%foreach(custom_types)%> +# Begin Group "<%custom_type%>" + +# PROP Default_Filter "<%foreach(custom_type->inputexts)%><%custom_type->inputext%><%fornotlast(";")%><%endfor%>" +<%foreach(custom_type->input_files)%> +# Begin Source File + +SOURCE=.\<%custom_type->input_file%> + +<%foreach(platform_longs)%> +<%foreach(configurations)%> +!<%fornotfirst("ELSE")%>IF "$(CFG)" == "<%project_name%> - <%platform%> (<%platform_long%>) <%configuration%>" + +# PROP Ignore_Default_Tool 1 +# Begin Custom Build - Invoking <%custom_type->command%> on $(InputPath) +InputPath=.\<%custom_type->input_file%> +InputName=<%basenoextension(custom_type->input_file)%> +InputDir=<%dirname(custom_type->input_file)%> + +<%if(custom_type->output_option)%> +<%foreach(custom_type->input_file->output_files)%> +".\<%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>\<%endif%><%custom_type->input_file->output_file%>" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + <%custom_type->command%> <%if(flag_overrides(custom_type->input_file, commandflags))%><%flag_overrides(custom_type->input_file, commandflags)%><%else%><%custom_type->commandflags%><%endif%> $(InputPath) <%custom_type->output_option%> <%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>\<%endif%><%custom_type->input_file->output_file%> + +<%endfor%> +<%else%> +BuildCmds= \ + <%custom_type->command%> <%if(flag_overrides(custom_type->input_file, commandflags))%><%flag_overrides(custom_type->input_file, commandflags)%><%else%><%custom_type->commandflags%><%endif%> $(InputPath) + +<%foreach(custom_type->input_file->output_files)%> +".\<%custom_type->input_file->output_file%>" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +<%endfor%> +<%endif%> +# End Custom Build + +<%endfor%> +<%endfor%> +!ENDIF + +# End Source File +<%endfor%> +# End Group +<%endfor%> # End Target # End Project diff --git a/bin/MakeProjectCreator/templates/gnu.mpd b/bin/MakeProjectCreator/templates/gnu.mpd index ce952944a77..106fb0e7db4 100644 --- a/bin/MakeProjectCreator/templates/gnu.mpd +++ b/bin/MakeProjectCreator/templates/gnu.mpd @@ -228,6 +228,23 @@ TAO_IDLFLAGS += <%idlflags%> # Local targets #---------------------------------------------------------------------------- <%marker(local)%> +<%if(custom_types)%> +<%foreach(custom_types)%> +<%foreach(custom_type->input_files)%> +GENERATED_DIRTY += <%foreach(custom_type->input_file->output_files)%><%if(custom_type->output_option)%><%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>/<%endif%><%endif%><%custom_type->input_file->output_file%><%endfor%> +<%foreach(custom_type->input_file->output_files)%> +<%if(custom_type->output_option)%><%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>/<%endif%><%endif%><%custom_type->input_file->output_file%>: <%custom_type->input_file%> + <%custom_type->command%> <%if(flag_overrides(custom_type->input_file, commandflags))%><%flag_overrides(custom_type->input_file, commandflags)%><%else%><%custom_type->commandflags%><%endif%> $^ <%if(custom_type->output_option)%><%custom_type->output_option%> $@<%endif%> + +<%endfor%> +<%endfor%> +<%endfor%> +ifneq ($(GENERATED_DIRTY),) +.PRECIOUS: $(GENERATED_DIRTY) +all: $(GENERATED_DIRTY) +endif + +<%endif%> <%comptarget%> <%if(idl_files)%> @@ -286,5 +303,8 @@ realclean: clean <%compclean%> <%if(idl_files)%> -$(RM) $(foreach ext, $(IDL_EXT), $(foreach file, $(IDL_FILES), $(file)$(ext))) <%endif%> +ifneq ($(GENERATED_DIRTY),) + -$(RM) $(GENERATED_DIRTY) +endif <%marker(bottom)%> diff --git a/bin/MakeProjectCreator/templates/make.mpd b/bin/MakeProjectCreator/templates/make.mpd index 1d0ca066262..0af89d3c5f5 100644 --- a/bin/MakeProjectCreator/templates/make.mpd +++ b/bin/MakeProjectCreator/templates/make.mpd @@ -42,7 +42,7 @@ LDFLAGS +=<%foreach(libpaths)%> -L<%libpath%><%endfor%> <%endif%> <%foreach(configurations)%> <%if(linkflags)%> -LDFLAGS += <%linkflags%> +LDFLAGS += <%linkflags%> <%endif%> <%endfor%> <%foreach(platforms)%> @@ -68,6 +68,21 @@ OUTPUT_OPTION = -o $@ #---------------------------------------------------------------------------- <%marker(local)%> +<%if(custom_types)%> +<%foreach(custom_types)%> +<%foreach(custom_type->input_files)%> +GENERATED_DIRTY += <%foreach(custom_type->input_file->output_files)%><%if(custom_type->output_option)%><%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>/<%endif%><%endif%><%custom_type->input_file->output_file%><%endfor%> +<%foreach(custom_type->input_file->output_files)%> +<%if(custom_type->output_option)%><%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>/<%endif%><%endif%><%custom_type->input_file->output_file%>: <%custom_type->input_file%> + <%custom_type->command%> <%if(flag_overrides(custom_type->input_file, commandflags))%><%flag_overrides(custom_type->input_file, commandflags)%><%else%><%custom_type->commandflags%><%endif%> $^ <%if(custom_type->output_option)%><%custom_type->output_option%> $@<%endif%> + +<%endfor%> +<%endfor%> +<%endfor%> +.PRECIOUS: $(GENERATED_DIRTY) +all: $(GENERATED_DIRTY) + +<%endif%> <%if(exename)%> all: $(BIN) <%if(install)%>install<%endif%> @@ -114,6 +129,9 @@ clean: realclean: clean -$(RM) <%if(exename)%>$(BIN)<%else%>$(SHLIB) $(LIB)<%endif%><%if(install)%> <%install%>/$(INSTARGET)<%endif%> +<%if(custom_types)%> + -$(RM) $(GENERATED_DIRTY) +<%endif%> #---------------------------------------------------------------------------- # Dependencies diff --git a/bin/MakeProjectCreator/templates/nmake.mpd b/bin/MakeProjectCreator/templates/nmake.mpd index 9d74863efc6..9ce35527cbc 100644 --- a/bin/MakeProjectCreator/templates/nmake.mpd +++ b/bin/MakeProjectCreator/templates/nmake.mpd @@ -48,7 +48,7 @@ OUTDIR=<%libout%> <%endif%> INTDIR=<%intermediate_dir%>\<%noextension(project_file)%> -ALL : <%if(exename)%><%if(install)%>"$(INSTALLDIR)" <%endif%><%endif%>"<%if(type_is_dynamic)%><%dllout%>\<%sharedname%><%lib_modifier%>.dll<%endif%><%if(type_is_static)%>$(OUTDIR)\<%staticname%><%lib_modifier%>.lib<%endif%><%if(exename)%>$(INSTALLDIR)\<%exename%>.exe<%endif%>" +ALL : <%if(exename)%><%if(install)%>"$(INSTALLDIR)" <%endif%><%endif%>"<%if(type_is_dynamic)%><%dllout%>\<%sharedname%><%lib_modifier%>.dll<%endif%><%if(type_is_static)%>$(OUTDIR)\<%staticname%><%lib_modifier%>.lib<%endif%><%if(exename)%>$(INSTALLDIR)\<%exename%>.exe<%endif%>"<%foreach(custom_types)%><%foreach(custom_type->input_files)%><%foreach(custom_type->input_file->output_files)%> ".\<%if(custom_type->output_option)%><%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>\<%endif%><%endif%><%custom_type->input_file->output_file%>"<%endfor%><%endfor%><%endfor%> DEPEND : depgen.pl<%foreach(includes)%> -I"<%include%>"<%endfor%><%foreach(defines cpu_defines common_defines)%> -D<%define%>=1<%endfor%><%if(type_is_dynamic)%><%foreach(dllflags)%> -D<%dllflag%>=1<%endfor%><%endif%><%if(need_libflags)%><%foreach(libflags)%> -D<%libflag%>=1<%endfor%><%endif%><%if(pch_header)%><%foreach(pch_defines)%> -D<%pch_define%>=1<%endfor%><%endif%> -f "<%noextension(project_file)%>.dep"<%foreach(source_files)%> <%source_file%><%endfor%> @@ -89,6 +89,13 @@ REALCLEAN : CLEAN <%if(idl_files)%> -@erase<%foreach(idl_files)%> "<%if(flag_overrides(idl_file, idlgendir))%><%flag_overrides(idl_file, idlgendir)%><%else%><%if(idlgendir)%><%idlgendir%><%else%><%dirname(idl_file)%><%endif%><%endif%>\<%basenoextension(idl_file)%>C.*" "<%if(flag_overrides(idl_file, idlgendir))%><%flag_overrides(idl_file, idlgendir)%><%else%><%if(idlgendir)%><%idlgendir%><%else%><%dirname(idl_file)%><%endif%><%endif%>\<%basenoextension(idl_file)%>S.*"<%endfor%> <%endif%> +<%foreach(custom_types)%> +<%foreach(custom_type->input_files)%> +<%foreach(custom_type->input_file->output_files)%> + -@erase "<%if(custom_type->output_option)%><%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>\<%endif%><%endif%><%custom_type->input_file->output_file%>" +<%endfor%> +<%endfor%> +<%endfor%> <%if(install)%> "$(INSTALLDIR)" : @@ -239,6 +246,36 @@ InputDir=<%dirname(idl_file)%> <%endfor%> <%endfor%> +<%foreach(custom_types)%> +<%foreach(custom_type->input_files)%> +SOURCE=<%custom_type->input_file%> + +<%foreach(platforms)%> +<%foreach(configurations)%> +!<%fornotfirst("ELSE")%>IF "$(CFG)" == "<%platform%> <%configuration%>" + +InputPath=.\<%custom_type->input_file%> +InputName=<%basenoextension(custom_type->input_file)%> +InputDir=<%dirname(custom_type->input_file)%> + +<%foreach(custom_type->input_file->output_files)%>".\<%if(custom_type->output_option)%><%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>\<%endif%><%endif%><%custom_type->input_file->output_file%>" <%endfor%>: $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + <<tempfile.bat + @echo off +<%if(custom_type->output_option)%> +<%foreach(custom_type->input_file->output_files)%> + <%custom_type->command%> <%if(flag_overrides(custom_type->input_file, commandflags))%><%flag_overrides(custom_type->input_file, commandflags)%><%else%><%custom_type->commandflags%><%endif%> $(InputPath) <%custom_type->output_option%> <%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>\<%endif%><%custom_type->input_file->output_file%> +<%endfor%> +<%else%> + <%custom_type->command%> <%if(flag_overrides(custom_type->input_file, commandflags))%><%flag_overrides(custom_type->input_file, commandflags)%><%else%><%custom_type->commandflags%><%endif%> $(InputPath) +<%endif%> +<< + +<%endfor%> +!ENDIF +<%endfor%> + +<%endfor%> +<%endfor%> <%foreach(resource_files)%> SOURCE=.\<%resource_file%> diff --git a/bin/MakeProjectCreator/templates/vc6dsp.mpd b/bin/MakeProjectCreator/templates/vc6dsp.mpd index bd08c6a73d1..0786e8b2a49 100644 --- a/bin/MakeProjectCreator/templates/vc6dsp.mpd +++ b/bin/MakeProjectCreator/templates/vc6dsp.mpd @@ -213,5 +213,48 @@ BuildCmds= \ <%endfor%> # End Group <%endif%> +<%foreach(custom_types)%> +# Begin Group "<%custom_type%>" + +# PROP Default_Filter "<%foreach(custom_type->inputexts)%><%custom_type->inputext%><%fornotlast(";")%><%endfor%>" +<%foreach(custom_type->input_files)%> +# Begin Source File + +SOURCE=.\<%custom_type->input_file%> + +<%foreach(configurations)%> +!<%fornotfirst("ELSE")%>IF "$(CFG)" == "<%project_name%> - <%platform%> <%configuration%>" + +# PROP Ignore_Default_Tool 1 +# Begin Custom Build - Invoking <%custom_type->command%> on $(InputPath) +InputPath=.\<%custom_type->input_file%> +InputName=<%basenoextension(custom_type->input_file)%> +InputDir=<%dirname(custom_type->input_file)%> + +<%if(custom_type->output_option)%> +<%foreach(custom_type->input_file->output_files)%> +".\<%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>\<%endif%><%custom_type->input_file->output_file%>" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + <%custom_type->command%> <%if(flag_overrides(custom_type->input_file, commandflags))%><%flag_overrides(custom_type->input_file, commandflags)%><%else%><%custom_type->commandflags%><%endif%> $(InputPath) <%custom_type->output_option%> <%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>\<%endif%><%custom_type->input_file->output_file%> + +<%endfor%> +<%else%> +BuildCmds= \ + <%custom_type->command%> <%if(flag_overrides(custom_type->input_file, commandflags))%><%flag_overrides(custom_type->input_file, commandflags)%><%else%><%custom_type->commandflags%><%endif%> $(InputPath) + +<%foreach(custom_type->input_file->output_files)%> +".\<%custom_type->input_file->output_file%>" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +<%endfor%> +<%endif%> +# End Custom Build + +<%endfor%> +!ENDIF + +# End Source File +<%endfor%> +# End Group +<%endfor%> # End Target # End Project diff --git a/bin/MakeProjectCreator/templates/vc7.mpd b/bin/MakeProjectCreator/templates/vc7.mpd index a507d174c2a..7a8591ccd97 100644 --- a/bin/MakeProjectCreator/templates/vc7.mpd +++ b/bin/MakeProjectCreator/templates/vc7.mpd @@ -176,6 +176,27 @@ <%endfor%> </Filter> <%endif%> +<%foreach(custom_types)%> + <Filter + Name="<%custom_type%>" + Filter="<%foreach(custom_type->inputexts)%><%custom_type->inputext%><%fornotlast(";")%><%endfor%>"> +<%foreach(custom_type->input_files)%> + <File + RelativePath=".\<%custom_type->input_file%>"> +<%foreach(configurations)%> + <FileConfiguration + Name="<%configuration%>|<%platform%>"> + <Tool + Name="VCCustomBuildTool" + Description="Invoking <%custom_type->command%> on <%custom_type->input_file%>" + CommandLine="<%custom_type->command%> <%if(flag_overrides(custom_type->input_file, commandflags))%><%flag_overrides(custom_type->input_file, commandflags)%><%else%><%custom_type->commandflags%><%endif%> <%custom_type->input_file%> <%if(custom_type->output_option)%><%custom_type->output_option%> <%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>\<%endif%><%custom_type->input_file->output_files%><%endif%>" + Outputs="<%foreach(custom_type->input_file->output_files)%><%if(custom_type->output_option)%><%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>\<%endif%><%endif%><%custom_type->input_file->output_file%><%fornotlast(";")%><%endfor%>"/> + </FileConfiguration> +<%endfor%> + </File> +<%endfor%> + </Filter> +<%endfor%> <%if(inline_files)%> <Filter Name="Inline Files" |