summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelliott_c <ocielliottc@users.noreply.github.com>2010-10-28 11:44:52 +0000
committerelliott_c <ocielliottc@users.noreply.github.com>2010-10-28 11:44:52 +0000
commita95af766bb526c5a8a4c19d8dcef737ac0faf3f9 (patch)
tree834f951665bb1e2c2cbdfeac58411d5e11673587
parentfb7488d75b034c1e975343474526982f31c91cda (diff)
downloadMPC-a95af766bb526c5a8a4c19d8dcef737ac0faf3f9.tar.gz
ChangeLogTag: Thu Oct 28 11:44:02 UTC 2010 Chad Elliott <elliott_c@ociweb.com>
-rw-r--r--ChangeLog31
-rw-r--r--docs/USAGE4
-rw-r--r--docs/html/MakeProjectCreator.html6
-rw-r--r--modules/Creator.pm13
-rw-r--r--modules/DirectoryManager.pm10
-rw-r--r--modules/Options.pm142
-rw-r--r--modules/WorkspaceCreator.pm1
-rwxr-xr-xmpc.pl17
-rwxr-xr-xmwc.pl17
9 files changed, 162 insertions, 79 deletions
diff --git a/ChangeLog b/ChangeLog
index 0092d056..51828eb4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,34 @@
+Thu Oct 28 11:44:02 UTC 2010 Chad Elliott <elliott_c@ociweb.com>
+
+ * docs/USAGE:
+ * modules/Options.pm:
+
+ Added information to the -into option description that desribes
+ behavior when a project is referenced via a full path.
+
+ * docs/html/MakeProjectCreator.html:
+
+ Fixed the wording of the -base option description. And, added
+ information to the -into option description that desribes behavior
+ when a project is referenced via a full path.
+
+ * modules/Creator.pm:
+
+ Added code to warn the user that using the -into option with a
+ project that is referenced via a full path will not work properly.
+
+ * modules/DirectoryManager.pm:
+ * modules/WorkspaceCreator.pm:
+
+ Modified to append a slash to directories that are only a drive
+ letter and colon.
+
+ * mpc.pl:
+ * mwc.pl:
+
+ Modified these scripts to pull in ACE specific modules and config
+ files if the ACE_ROOT environment variable is set and MPC is
+ located underneath the directory to which ACE_ROOT points.
Wed Oct 20 09:18:05 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl>
* config/nddsmonitor.mpb:
diff --git a/docs/USAGE b/docs/USAGE
index 45c04844..930f4ab3 100644
--- a/docs/USAGE
+++ b/docs/USAGE
@@ -54,7 +54,9 @@ Usage: mwc.pl [-global <file>] [-include <directory>] [-recurse]
option can be used multiple times to add directories.
-into Place all output files in a mirrored directory
structure starting at <directory>. This should be a
- full path.
+ full path. If any project within the workspace is
+ referenced via a full path, use of this option is
+ likely to cause problems.
-language Specify the language preference; possible values are
[cplusplus, csharp, java, vb]. The default is
cplusplus.
diff --git a/docs/html/MakeProjectCreator.html b/docs/html/MakeProjectCreator.html
index e1d425fb..68e7fed6 100644
--- a/docs/html/MakeProjectCreator.html
+++ b/docs/html/MakeProjectCreator.html
@@ -411,7 +411,7 @@
<td rowspan="1" colspan="1">
<p class="Tbl-Body">This option allows the user to force
- any project to inherit from a specified base project. This
+ every project to inherit from a specified base project. This
option can be used multiple times to force multiple
inheritance upon a project.</p>
</td>
@@ -601,7 +601,9 @@
<td rowspan="1" colspan="1">
<p class="Tbl-Body">This option specifies that all
generated project files will be placed in a mirrored
- directory structure.</p>
+ directory structure. If any project within the
+ workspace is referenced via a full path, use of this
+ option is likely to cause problems.</p>
</td>
</tr>
diff --git a/modules/Creator.pm b/modules/Creator.pm
index 8ffc178f..55285092 100644
--- a/modules/Creator.pm
+++ b/modules/Creator.pm
@@ -946,10 +946,21 @@ sub get_language {
sub get_outdir {
my $self = shift;
if (defined $self->{'into'}) {
+ ## First, try to remove our starting directory from the current
+ ## working directory.
my $outdir = $self->getcwd();
my $re = $self->escape_regex_special($self->getstartdir());
+ if ($outdir !~ s/^$re//) {
+ ## If that fails and we're running on an OS that supports drive
+ ## letters, we need to try to remove the drive letter. We also
+ ## warn the user that it's not likely to work properly.
+ my $orig = $outdir;
+ if ((($^O eq 'MSWin32' || $^O eq 'cygwin') &&
+ $outdir =~ s/^[a-z]://i) || $outdir =~ m!^/!) {
+ $self->warning("Unable to use $orig with the -into option");
+ }
+ }
- $outdir =~ s/^$re//;
return $self->{'into'} . $outdir;
}
else {
diff --git a/modules/DirectoryManager.pm b/modules/DirectoryManager.pm
index cd9aa993..2e2ed64c 100644
--- a/modules/DirectoryManager.pm
+++ b/modules/DirectoryManager.pm
@@ -123,7 +123,15 @@ sub mpc_dirname {
}
}
else {
- return dirname($dir);
+ ## Get the directory portion of the original directory or file path.
+ $dir = dirname($dir);
+
+ ## If the result is just a drive specification, we need to append a
+ ## slash to the end of the path so that cygwin perl can use this
+ ## return value within a chdir() call.
+ $dir .= '/' if ($dir =~ /^[a-z]:$/i);
+
+ return $dir;
}
}
diff --git a/modules/Options.pm b/modules/Options.pm
index 0dc91de0..c799310a 100644
--- a/modules/Options.pm
+++ b/modules/Options.pm
@@ -96,77 +96,79 @@ sub printUsage {
$spaces . "[files]\n\n";
print STDERR
-" -base Add <project> as a base project to each generated\n" .
-" project file. Do not provide a file extension, the\n" .
-" .mpb extension will be tried first; if that fails the\n" .
-" .mpc extension will be tried.\n" .
-" -exclude Use this option to exclude directories or files when\n" .
-" searching for input files.\n" .
-" -expand_vars Perform direct expansion, instead of performing relative\n" .
-" replacement with either -use_env or -relative options.\n" .
-" -feature_file Specifies the feature file to read before processing.\n" .
-" The default feature file is default.features under the\n" .
-" config directory.\n" .
-" -features Specifies the feature list to set before processing.\n" .
-" -for_eclipse Generate files for use with eclipse. This is only\n" .
-" useful for make based project types.\n" .
-" -gendot Generate .dot files for use with Graphviz.\n" .
-" -genins Generate .ins files for use with prj_install.pl.\n" .
-" -gfeature_file Specifies the global feature file. The\n" .
-" default value is global.features under the\n" .
-" config directory.\n" .
-" -global Specifies the global input file. Values stored\n" .
-" within this file are applied to all projects.\n" .
-" -hierarchy Generate a workspace in a hierarchical fashion.\n" .
-" -include Specifies a directory to search when looking for base\n" .
-" projects, template input files and templates. This\n" .
-" option can be used multiple times to add directories.\n" .
-" -into Place all output files in a mirrored directory\n" .
-" structure starting at <directory>. This should be a\n" .
-" full path.\n" .
+" -base Add <project> as a base project to each generated\n",
+" project file. Do not provide a file extension, the\n",
+" .mpb extension will be tried first; if that fails the\n",
+" .mpc extension will be tried.\n",
+" -exclude Use this option to exclude directories or files when\n",
+" searching for input files.\n",
+" -expand_vars Perform direct expansion, instead of performing relative\n",
+" replacement with either -use_env or -relative options.\n",
+" -feature_file Specifies the feature file to read before processing.\n",
+" The default feature file is default.features under the\n",
+" config directory.\n",
+" -features Specifies the feature list to set before processing.\n",
+" -for_eclipse Generate files for use with eclipse. This is only\n",
+" useful for make based project types.\n",
+" -gendot Generate .dot files for use with Graphviz.\n",
+" -genins Generate .ins files for use with prj_install.pl.\n",
+" -gfeature_file Specifies the global feature file. The\n",
+" default value is global.features under the\n",
+" config directory.\n",
+" -global Specifies the global input file. Values stored\n",
+" within this file are applied to all projects.\n",
+" -hierarchy Generate a workspace in a hierarchical fashion.\n",
+" -include Specifies a directory to search when looking for base\n",
+" projects, template input files and templates. This\n",
+" option can be used multiple times to add directories.\n",
+" -into Place all output files in a mirrored directory\n",
+" structure starting at <directory>. This should be a\n",
+" full path. If any project within the workspace is\n",
+" referenced via a full path, use of this option is\n",
+" likely to cause problems.\n",
" -language Specify the language preference; possible values are\n",
-" [", join(', ', sort(Creator::validLanguages())), "]. The default is\n".
-" " . Creator::defaultLanguage() . ".\n",
-" -make_coexistence If multiple 'make' based project types are\n" .
-" generated, they will be named such that they can coexist.\n" .
-" -name_modifier Modify output names. The pattern passed to this\n" .
-" parameter will have the '*' portion replaced with the\n" .
-" actual output name. Ex. *_Static\n" .
-" -apply_project When used in conjunction with -name_modifier, it applies\n" .
-" the name modifier to the project name also.\n" .
-" -nocomments Do not place comments in the generated files.\n" .
-" -noreldefs Do not try to generate default relative definitions.\n" .
-" -notoplevel Do not generate the top level target file. Files\n" .
-" are still processed, but no top level file is created.\n" .
-" -recurse Recurse from the current directory and generate from\n" .
-" all found input files.\n" .
-" -relative Any \$() variable in an mpc file that is matched to NAME\n" .
-" is replaced by VAL only if VAL can be made into a\n" .
-" relative path based on the current working directory.\n" .
-" This option can be used multiple times to add multiple\n" .
-" variables.\n" .
-" -relative_file Specifies the relative file to read before processing.\n" .
-" The default relative file is default.rel under the\n" .
-" config directory.\n" .
-" -static Specifies that only static projects will be generated.\n" .
-" By default, only dynamic projects are generated.\n" .
-" -template Specifies the template name (with no extension).\n" .
-" -ti Specifies the template input file (with no extension)\n" .
-" for the specific type (ex. -ti dll_exe:vc8exe).\n" .
-" -type Specifies the type of project file to generate. This\n" .
-" option can be used multiple times to generate multiple\n" .
-" types. There is no longer a default.\n" .
-" -use_env Use environment variables for all uses of \$() instead\n" .
-" of the relative replacement values.\n" .
-" -value_project This option allows modification of a project variable\n" .
-" assignment . Use += to add VAL to the NAME's value.\n" .
-" Use -= to subtract and = to override the value.\n" .
-" This can be used to introduce new name value pairs to\n" .
-" a project. However, it must be a valid project\n" .
-" assignment.\n" .
-" -value_template This option allows modification of a template input\n" .
-" name value pair. Use += to add VAL to the NAME's\n" .
-" value. Use -= to subtract and = to override the value.\n" .
+" [", join(', ', sort(Creator::validLanguages())), "]. The default is\n",
+" ", Creator::defaultLanguage(), ".\n",
+" -make_coexistence If multiple 'make' based project types are\n",
+" generated, they will be named such that they can coexist.\n",
+" -name_modifier Modify output names. The pattern passed to this\n",
+" parameter will have the '*' portion replaced with the\n",
+" actual output name. Ex. *_Static\n",
+" -apply_project When used in conjunction with -name_modifier, it applies\n",
+" the name modifier to the project name also.\n",
+" -nocomments Do not place comments in the generated files.\n",
+" -noreldefs Do not try to generate default relative definitions.\n",
+" -notoplevel Do not generate the top level target file. Files\n",
+" are still processed, but no top level file is created.\n",
+" -recurse Recurse from the current directory and generate from\n",
+" all found input files.\n",
+" -relative Any \$() variable in an mpc file that is matched to NAME\n",
+" is replaced by VAL only if VAL can be made into a\n",
+" relative path based on the current working directory.\n",
+" This option can be used multiple times to add multiple\n",
+" variables.\n",
+" -relative_file Specifies the relative file to read before processing.\n",
+" The default relative file is default.rel under the\n",
+" config directory.\n",
+" -static Specifies that only static projects will be generated.\n",
+" By default, only dynamic projects are generated.\n",
+" -template Specifies the template name (with no extension).\n",
+" -ti Specifies the template input file (with no extension)\n",
+" for the specific type (ex. -ti dll_exe:vc8exe).\n",
+" -type Specifies the type of project file to generate. This\n",
+" option can be used multiple times to generate multiple\n",
+" types. There is no longer a default.\n",
+" -use_env Use environment variables for all uses of \$() instead\n",
+" of the relative replacement values.\n",
+" -value_project This option allows modification of a project variable\n",
+" assignment . Use += to add VAL to the NAME's value.\n",
+" Use -= to subtract and = to override the value.\n",
+" This can be used to introduce new name value pairs to\n",
+" a project. However, it must be a valid project\n",
+" assignment.\n",
+" -value_template This option allows modification of a template input\n",
+" name value pair. Use += to add VAL to the NAME's\n",
+" value. Use -= to subtract and = to override the value.\n",
" -version Print the MPC version and exit.\n";
}
diff --git a/modules/WorkspaceCreator.pm b/modules/WorkspaceCreator.pm
index 1c0ba1d8..d4e28e55 100644
--- a/modules/WorkspaceCreator.pm
+++ b/modules/WorkspaceCreator.pm
@@ -1141,6 +1141,7 @@ sub topname {
if ($file =~ /^([^\/\\]+)[\/\\](.*)/) {
$dir = $1;
$rest = $2;
+ $dir .= '/' if ($dir =~ /^[a-z]:$/i);
}
return $dir, $rest;
}
diff --git a/mpc.pl b/mpc.pl
index 547acf70..8e09e6b2 100755
--- a/mpc.pl
+++ b/mpc.pl
@@ -27,7 +27,20 @@ use File::Basename;
my $basePath = (defined $FindBin::RealBin && $FindBin::RealBin ne '' ?
$FindBin::RealBin : File::Spec->rel2abs(dirname($0)));
$basePath = VMS::Filespec::unixify($basePath) if ($^O eq 'VMS');
-unshift(@INC, $basePath . '/modules');
+
+## Add the full path to the MPC modules to the Perl include path
+my $mpcpath = $basePath;
+unshift(@INC, $mpcpath . '/modules');
+
+## If the ACE_ROOT environment variable is defined and this version of
+## MPC is located inside the directory to which ACE_ROOT points, we will
+## assume that the user wanted the ACE specific version of this script.
+## We will change the $basePath to what it would have been had the user
+## run this script out of $ACE_ROOT/bin.
+my $aceroot = $ENV{ACE_ROOT};
+$aceroot =~ s!\\!/!g if (defined $aceroot);
+$basePath = $aceroot . '/bin/MakeProjectCreator'
+ if (defined $aceroot && $aceroot eq dirname($basePath));
require Driver;
@@ -36,7 +49,7 @@ require Driver;
# ************************************************************
sub getBasePath {
- return $basePath;
+ return $mpcpath;
}
# ************************************************************
diff --git a/mwc.pl b/mwc.pl
index f2d9187e..7b8ce205 100755
--- a/mwc.pl
+++ b/mwc.pl
@@ -27,7 +27,20 @@ use File::Basename;
my $basePath = (defined $FindBin::RealBin && $FindBin::RealBin ne '' ?
$FindBin::RealBin : File::Spec->rel2abs(dirname($0)));
$basePath = VMS::Filespec::unixify($basePath) if ($^O eq 'VMS');
-unshift(@INC, $basePath . '/modules');
+
+## Add the full path to the MPC modules to the Perl include path
+my $mpcpath = $basePath;
+unshift(@INC, $mpcpath . '/modules');
+
+## If the ACE_ROOT environment variable is defined and this version of
+## MPC is located inside the directory to which ACE_ROOT points, we will
+## assume that the user wanted the ACE specific version of this script.
+## We will change the $basePath to what it would have been had the user
+## run this script out of $ACE_ROOT/bin.
+my $aceroot = $ENV{ACE_ROOT};
+$aceroot =~ s!\\!/!g if (defined $aceroot);
+$basePath = $aceroot . '/bin/MakeProjectCreator'
+ if (defined $aceroot && $aceroot eq dirname($basePath));
require Driver;
@@ -36,7 +49,7 @@ require Driver;
# ************************************************************
sub getBasePath {
- return $basePath;
+ return $mpcpath;
}
# ************************************************************