diff options
author | elliott_c <ocielliottc@users.noreply.github.com> | 2004-09-01 17:57:15 +0000 |
---|---|---|
committer | elliott_c <ocielliottc@users.noreply.github.com> | 2004-09-01 17:57:15 +0000 |
commit | 2d9ce56035853fe43b88b60dcdc5c8536eb69c55 (patch) | |
tree | 1552f3de83ee408b3779726ad04262aef7bb63a0 | |
parent | a62f12f2fa050f04512b7e5ede1333cf95c509ba (diff) | |
download | MPC-2d9ce56035853fe43b88b60dcdc5c8536eb69c55.tar.gz |
ChangeLogTag: Wed Sep 1 12:54:06 2004 Chad Elliott <elliott_c@ociweb.com>
-rw-r--r-- | ChangeLog | 20 | ||||
-rw-r--r-- | modules/AutomakeWorkspaceCreator.pm | 73 | ||||
-rw-r--r-- | modules/WorkspaceCreator.pm | 26 | ||||
-rw-r--r-- | modules/WorkspaceHelper.pm | 67 |
4 files changed, 108 insertions, 78 deletions
@@ -1,3 +1,23 @@ +Wed Sep 1 12:54:06 2004 Chad Elliott <elliott_c@ociweb.com> + + * modules/WorkspaceCreator.pm: + + Fixed a bug where the toplevel workspace would be created twice in + the event that the -hierarchy option was used or the subclassed + workspace creator defined the workspace_per_project method to + return 1. + + * modules/WorkspaceHelper.pm: + + Added the base class and factory for all WorkspaceHelpers. It + will dynamically locate, load and allocate the helper based on the + workspace creator type. + + * modules/AutomakeWorkspaceCreator.pm: + + Uncommented the unlink() and split the ACE specific portion into a + helper under ACE_wrappers/bin/MakeProjectCreator/modules. + Tue Aug 31 08:00:20 2004 Chad Elliott <elliott_c@ociweb.com> * modules/TemplateParser.pm: diff --git a/modules/AutomakeWorkspaceCreator.pm b/modules/AutomakeWorkspaceCreator.pm index 64909a62..3f59b47e 100644 --- a/modules/AutomakeWorkspaceCreator.pm +++ b/modules/AutomakeWorkspaceCreator.pm @@ -14,6 +14,7 @@ use strict; use AutomakeProjectCreator; use WorkspaceCreator; +use WorkspaceHelper; use vars qw(@ISA); @ISA = qw(WorkspaceCreator); @@ -141,70 +142,10 @@ sub write_comps { ## Print out the Makefile.am. if (@locals) { - my($seen_ace_root) = 0; - my($seen_tao_root) = 0; - my($seen_ace_builddir) = 0; - my($seen_tao_builddir) = 0; - my($seen_tao_idl) = 0; - - foreach my $local (reverse @locals) { - my($pfh) = new FileHandle(); - if (!open($pfh,$local)) { - $self->error("Unable to open $local for reading."); - } - - while(<$pfh>) { - if (/ACE_ROOT/) { - $seen_ace_root = 1; - } - if (/TAO_ROOT/) { - $seen_tao_root = 1; - } - if (/ACE_BUILDDIR/) { - $seen_ace_builddir = 1; - } - if (/TAO_BUILDDIR/) { - $seen_tao_builddir = 1; - } - if (/TAO_IDL/) { - $seen_tao_idl = 1; - } - } - - close($pfh); - } - - if ($seen_ace_root || $seen_ace_builddir || - $seen_tao_root || $seen_tao_builddir) { - - if ($seen_ace_root) { - if ($seen_tao_root || $seen_tao_builddir) { - print $fh "ACE_ROOT = \$(top_srcdir)/..", $crlf; - } else { - print $fh "ACE_ROOT = \$(top_srcdir)", $crlf; - } - } - if ($seen_ace_builddir) { - if ($seen_tao_root || $seen_tao_builddir) { - print $fh "ACE_BUILDDIR = \$(top_builddir)/..", $crlf; - } else { - print $fh "ACE_BUILDDIR = \$(top_builddir)", $crlf; - } - } - if ($seen_tao_root) { - print $fh "TAO_ROOT = \$(top_srcdir)", $crlf; - } - if ($seen_tao_builddir) { - print $fh "TAO_BUILDDIR = \$(top_builddir)", $crlf; - } - - print $fh $crlf; - } - - if ($seen_tao_idl) { - print $fh "TAO_IDL = ACE_ROOT=\$(ACE_ROOT) TAO_ROOT=\$(TAO_ROOT) \$(TAO_BUILDDIR)/TAO_IDL/tao_idl", $crlf; - print $fh "TAO_IDLFLAGS = -Ge 1 -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I\$(TAO_ROOT) -I\$(srcdir) -g \$(ACE_BUILDDIR)/apps/gperf/src/gperf", $crlf; - print $fh $crlf; + my($wsHelper) = WorkspaceHelper::get($self); + my($status, $error) = $wsHelper->write_settings($self, $fh, @locals); + if (!$status) { + $self->error($error); } } @@ -245,8 +186,8 @@ sub write_comps { ## Take the local Makefile.<project>.am files and insert each one here, ## then delete it. if (@locals) { + my($pfh) = new FileHandle(); foreach my $local (reverse @locals) { - my($pfh) = new FileHandle(); if (open($pfh,$local)) { print $fh "## $local $crlf"; @@ -320,7 +261,7 @@ sub write_comps { } close($pfh); -## unlink($local); + unlink($local); print $fh $crlf; } else { diff --git a/modules/WorkspaceCreator.pm b/modules/WorkspaceCreator.pm index 7d8e002f..d60907f7 100644 --- a/modules/WorkspaceCreator.pm +++ b/modules/WorkspaceCreator.pm @@ -869,19 +869,21 @@ sub generate_hierarchy { $sinfo{$rest} = $projinfo{$prj}; } elsif ($top ne $current) { - ## Write out the hierachical workspace - $self->cd($current); - $self->generate_hierarchy($creator, \@saved, \%sinfo); - - $self->{'projects'} = \@saved; - $self->{'project_info'} = \%sinfo; - $self->{'workspace_name'} = $self->base_directory(); - - my($status, $error) = $self->write_workspace($creator); - if (!$status) { - $self->error($error); + if ($current ne '.') { + ## Write out the hierachical workspace + $self->cd($current); + $self->generate_hierarchy($creator, \@saved, \%sinfo); + + $self->{'projects'} = \@saved; + $self->{'project_info'} = \%sinfo; + $self->{'workspace_name'} = $self->base_directory(); + + my($status, $error) = $self->write_workspace($creator); + if (!$status) { + $self->error($error); + } + $self->cd($cwd); } - $self->cd($cwd); ## Start the next one $current = $top; diff --git a/modules/WorkspaceHelper.pm b/modules/WorkspaceHelper.pm new file mode 100644 index 00000000..c17d2398 --- /dev/null +++ b/modules/WorkspaceHelper.pm @@ -0,0 +1,67 @@ +package WorkspaceHelper; + +# ************************************************************ +# Description : Base class and factory for all workspace helpers +# Author : Chad Elliott +# Create Date : 9/01/2004 +# ************************************************************ + +# ************************************************************ +# Pragmas +# ************************************************************ + +use strict; + +# ************************************************************ +# Data Section +# ************************************************************ + +my(%required) = (); + +# ************************************************************ +# Subroutine Section +# ************************************************************ + +sub get { + my($type) = shift; + + ## Create the helper name + $type =~ s/Creator/Helper/; + $type =~ s/=HASH.*//; + + ## If we can find a helper with this name, we will + ## create a singleton of that type and return it. + if (!$required{$type}) { + foreach my $inc (@INC) { + if (-r "$inc/$type.pm") { + require "$type.pm"; + $required{$type} = $type->new(); + last; + } + } + + ## If we can't find the helper, we just create an + ## empty helper and return that. + if (!$required{$type}) { + $required{$type} = new WorkspaceHelper(); + } + } + + return $required{$type}; +} + + +sub new { + my($class) = shift; + my($self) = bless { + }, $class; + return $self; +} + + +sub write_settings { + return 1, undef; +} + + +1; |