<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[170905] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/170905">170905</a></dd>
<dt>Author</dt> <dd>bfulgham@apple.com</dd>
<dt>Date</dt> <dd>2014-07-08 17:01:02 -0700 (Tue, 08 Jul 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Win] Implement auto-version as a Perl program
https://bugs.webkit.org/show_bug.cgi?id=134745
&lt;rdar://problem/17597801&gt;

Reviewed by David Kilzer.


Source/WebKit: 
Modify build commands to use new Perl version of the
auto-version script.

* WebKit.vcxproj/Interfaces/InterfacesPreBuild.cmd:
* WebKit.vcxproj/WebKit/WebKitPreBuild.cmd:

WebKitLibraries: 
Translate the auto-version.sh bash script into an equivalent
Perl script.

* win/tools/scripts/auto-version.pl: Added.
* win/tools/scripts/auto-version.sh: Removed.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitWebKitvcxprojInterfacesInterfacesPreBuildcmd">trunk/Source/WebKit/WebKit.vcxproj/Interfaces/InterfacesPreBuild.cmd</a></li>
<li><a href="#trunkSourceWebKitWebKitvcxprojWebKitWebKitPreBuildcmd">trunk/Source/WebKit/WebKit.vcxproj/WebKit/WebKitPreBuild.cmd</a></li>
<li><a href="#trunkWebKitLibrariesChangeLog">trunk/WebKitLibraries/ChangeLog</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkWebKitLibrarieswintoolsscriptsautoversionpl">trunk/WebKitLibraries/win/tools/scripts/auto-version.pl</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkWebKitLibrarieswintoolsscriptsautoversionsh">trunk/WebKitLibraries/win/tools/scripts/auto-version.sh</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (170904 => 170905)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog        2014-07-08 23:58:05 UTC (rev 170904)
+++ trunk/Source/WebKit/ChangeLog        2014-07-09 00:01:02 UTC (rev 170905)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-07-08  Brent Fulgham  &lt;bfulgham@apple.com&gt;
+
+        [Win] Implement auto-version as a Perl program
+        https://bugs.webkit.org/show_bug.cgi?id=134745
+        &lt;rdar://problem/17597801&gt;
+
+        Reviewed by David Kilzer.
+
+        Modify build commands to use new Perl version of the
+        auto-version script.
+
+        * WebKit.vcxproj/Interfaces/InterfacesPreBuild.cmd:
+        * WebKit.vcxproj/WebKit/WebKitPreBuild.cmd:
+
</ins><span class="cx"> 2014-07-06  Yoav Weiss  &lt;yoav@yoav.ws&gt;
</span><span class="cx"> 
</span><span class="cx">         Turn on img@sizes compile flag
</span></span></pre></div>
<a id="trunkSourceWebKitWebKitvcxprojInterfacesInterfacesPreBuildcmd"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebKit.vcxproj/Interfaces/InterfacesPreBuild.cmd (170904 => 170905)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebKit.vcxproj/Interfaces/InterfacesPreBuild.cmd        2014-07-08 23:58:05 UTC (rev 170904)
+++ trunk/Source/WebKit/WebKit.vcxproj/Interfaces/InterfacesPreBuild.cmd        2014-07-09 00:01:02 UTC (rev 170905)
</span><span class="lines">@@ -6,4 +6,4 @@
</span><span class="cx"> echo XX%PROJECTNAME%XX &gt; &quot;%CONFIGURATIONBUILDDIR%\buildfailed&quot;
</span><span class="cx"> 
</span><span class="cx"> mkdir 2&gt;NUL &quot;%CONFIGURATIONBUILDDIR%\obj%PlatformArchitecture%\WebKit\%PROJECTNAME%&quot;
</span><del>-bash &quot;%WEBKIT_LIBRARIES%\tools\scripts\auto-version.sh&quot; &quot;%INTDIR%&quot;
</del><ins>+perl &quot;%WEBKIT_LIBRARIES%\tools\scripts\auto-version.pl&quot; &quot;%INTDIR%&quot;
</ins></span></pre></div>
<a id="trunkSourceWebKitWebKitvcxprojWebKitWebKitPreBuildcmd"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebKit.vcxproj/WebKit/WebKitPreBuild.cmd (170904 => 170905)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebKit.vcxproj/WebKit/WebKitPreBuild.cmd        2014-07-08 23:58:05 UTC (rev 170904)
+++ trunk/Source/WebKit/WebKit.vcxproj/WebKit/WebKitPreBuild.cmd        2014-07-09 00:01:02 UTC (rev 170905)
</span><span class="lines">@@ -8,4 +8,4 @@
</span><span class="cx"> mkdir 2&gt;NUL &quot;%CONFIGURATIONBUILDDIR%\include\JavaScriptCore&quot;
</span><span class="cx"> xcopy /y /d &quot;%WEBKIT_LIBRARIES%\include\JavaScriptCore\*&quot; &quot;%CONFIGURATIONBUILDDIR%\include\JavaScriptCore&quot;
</span><span class="cx"> 
</span><del>-bash &quot;%WEBKIT_LIBRARIES%\tools\scripts\auto-version.sh&quot; &quot;%INTDIR%&quot;
</del><ins>+perl &quot;%WEBKIT_LIBRARIES%\tools\scripts\auto-version.pl&quot; &quot;%INTDIR%&quot;
</ins></span></pre></div>
<a id="trunkWebKitLibrariesChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebKitLibraries/ChangeLog (170904 => 170905)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKitLibraries/ChangeLog        2014-07-08 23:58:05 UTC (rev 170904)
+++ trunk/WebKitLibraries/ChangeLog        2014-07-09 00:01:02 UTC (rev 170905)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-07-08  Brent Fulgham  &lt;bfulgham@apple.com&gt;
+
+        [Win] Implement auto-version as a Perl program
+        https://bugs.webkit.org/show_bug.cgi?id=134745
+        &lt;rdar://problem/17597801&gt;
+
+        Reviewed by David Kilzer.
+
+        Translate the auto-version.sh bash script into an equivalent
+        Perl script.
+
+        * win/tools/scripts/auto-version.pl: Added.
+        * win/tools/scripts/auto-version.sh: Removed.
+
</ins><span class="cx"> 2014-07-06  Yoav Weiss  &lt;yoav@yoav.ws&gt;
</span><span class="cx"> 
</span><span class="cx">         Turn on img@sizes compile flag
</span></span></pre></div>
<a id="trunkWebKitLibrarieswintoolsscriptsautoversionpl"></a>
<div class="addfile"><h4>Added: trunk/WebKitLibraries/win/tools/scripts/auto-version.pl (0 => 170905)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKitLibraries/win/tools/scripts/auto-version.pl                                (rev 0)
+++ trunk/WebKitLibraries/win/tools/scripts/auto-version.pl        2014-07-09 00:01:02 UTC (rev 170905)
</span><span class="lines">@@ -0,0 +1,139 @@
</span><ins>+#!/usr/bin/perl -w
+
+use strict;
+use File::Path qw(make_path);
+use File::Spec;
+use Win32;
+
+# Copyright (C) 2007, 2009, 2014 Apple Inc.  All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+
+die &quot;You must supply an output path as the argument.\n&quot; if ($#ARGV &lt; 0);
+
+my $WEBKIT_LIBRARIES = $ENV{'WEBKIT_LIBRARIES'};
+
+my ($COPYRIGHT_END_YEAR, $FALLBACK_VERSION);
+if (defined $WEBKIT_LIBRARIES) {
+    my $FALLBACK_VERSION_PATH = File::Spec-&gt;catfile($WEBKIT_LIBRARIES, 'tools', 'scripts', 'VERSION');
+    open(FALLBACK_VERSION_FILE, '&lt;', $FALLBACK_VERSION_PATH) or die &quot;Unable to open $FALLBACK_VERSION_PATH: $!&quot;;
+    $FALLBACK_VERSION = &lt;FALLBACK_VERSION_FILE&gt;;
+    close FALLBACK_VERSION_FILE;
+    chomp($FALLBACK_VERSION);
+
+    my $COPYRIGHT_END_YEAR_PATH = File::Spec-&gt;catfile($WEBKIT_LIBRARIES, 'tools', 'scripts', 'COPYRIGHT-END-YEAR');
+    open(COPYRIGHT_END_YEAR_FILE, '&lt;', $COPYRIGHT_END_YEAR_PATH) or die &quot;Unable to open $COPYRIGHT_END_YEAR_PATH: $!&quot;;
+    $COPYRIGHT_END_YEAR = &lt;COPYRIGHT_END_YEAR_FILE&gt;;
+    close COPYRIGHT_END_YEAR_FILE;
+    chomp($COPYRIGHT_END_YEAR);
+}
+
+my $OUTPUT_DIR = File::Spec-&gt;catdir($ARGV[0], 'include');
+my $OUTPUT_FILE = File::Spec-&gt;catfile($OUTPUT_DIR, 'autoversion.h');
+
+unless (-d $OUTPUT_DIR) {
+    make_path($OUTPUT_DIR) or die &quot;Couldn't create $OUTPUT_DIR: $!&quot;;
+}
+
+# Take the initial version number from RC_ProjectSourceVersion if it
+# exists, otherwise fall back to the version number stored in the source.
+my $ENVIRONMENT_VERSION = $ENV{'RC_ProjectSourceVersion'};
+if (!defined $ENVIRONMENT_VERSION) {
+    $ENVIRONMENT_VERSION = $ENV{'RC_PROJECTSOURCEVERSION'};
+}
+
+my $PROPOSED_VERSION = (defined $ENVIRONMENT_VERSION) ? $ENVIRONMENT_VERSION : $FALLBACK_VERSION;
+chomp($PROPOSED_VERSION);
+
+# Split out the three components of the dotted version number.  We pad
+# the input with trailing dots to handle the case where the input version
+# has fewer components than we expect.
+$PROPOSED_VERSION =~ m/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/ or die &quot;Couldn't parse $PROPOSED_VERSION&quot;;
+my $BUILD_MAJOR_VERSION = $1;
+my $BUILD_MINOR_VERSION = $2;
+my $BUILD_TINY_VERSION = $3;
+
+# Cut the major component down to three characters by dropping any
+# extra leading digits, then adjust the major version portion of the
+# version string to match.
+$BUILD_MAJOR_VERSION =~ s/^.*(\d\d\d+)$/$1/;
+
+# Have the minor and tiny components default to zero if not present.
+if (!defined $BUILD_MINOR_VERSION) {
+    $BUILD_MINOR_VERSION = 0;
+}
+if (!defined $BUILD_TINY_VERSION) {
+    $BUILD_TINY_VERSION = 0;
+}
+
+$PROPOSED_VERSION = &quot;$BUILD_MAJOR_VERSION.$BUILD_MINOR_VERSION.$BUILD_TINY_VERSION&quot;;
+
+# Split the first component further by using the first digit for the
+# major version and the remaining two characters as the minor version.
+# The minor version is shifted down to the tiny version, with the tiny
+# version becoming the variant version.
+$BUILD_MAJOR_VERSION =~ m/^.*(\d)(\d\d)/;
+my $MAJOR_VERSION = $1;
+my $MINOR_VERSION = $2;
+my $TINY_VERSION = $BUILD_MINOR_VERSION;
+my $VARIANT_VERSION = $BUILD_TINY_VERSION;
+
+my $VERSION_TEXT = $PROPOSED_VERSION;
+my $VERSION_TEXT_SHORT = $VERSION_TEXT;
+
+my $SVN_REVISION = '';
+if (!$ENVIRONMENT_VERSION) {
+    # If we didn't pull the version number from the environment then we're doing
+    # an engineering build and we'll stamp the build with some more information.
+
+    my $BUILD_DATE = localtime(time);
+    my $SVN_REVISION = `svn info`;
+    $SVN_REVISION =~ m/Revision: (\d+)/;
+    $SVN_REVISION= $1;
+
+    chomp($BUILD_DATE);
+    chomp($SVN_REVISION);
+
+    $VERSION_TEXT_SHORT .= &quot;+&quot;;
+    my $USER = Win32::LoginName;
+    $VERSION_TEXT = &quot;$VERSION_TEXT_SHORT $USER - $BUILD_DATE - r$SVN_REVISION&quot;;
+}
+
+open(OUTPUT_FILE, '&gt;', $OUTPUT_FILE) or die &quot;Couldn't open $OUTPUT_FILE: $!&quot;;
+print OUTPUT_FILE &lt;&lt;EOF;
+#define __VERSION_TEXT__ &quot;$VERSION_TEXT&quot;
+#define __BUILD_NUMBER__ &quot;$VERSION_TEXT&quot;
+#define __BUILD_NUMBER_SHORT__ &quot;$VERSION_TEXT_SHORT&quot;
+#define __VERSION_MAJOR__ $MAJOR_VERSION
+#define __VERSION_MINOR__ $MINOR_VERSION
+#define __VERSION_TINY__ $TINY_VERSION
+#define __VERSION_BUILD__ $VARIANT_VERSION
+#define __BUILD_NUMBER_MAJOR__ $BUILD_MAJOR_VERSION
+#define __BUILD_NUMBER_MINOR__ $BUILD_MINOR_VERSION
+#define __BUILD_NUMBER_VARIANT__ $BUILD_TINY_VERSION
+#define __SVN_REVISION__ $SVN_REVISION
+EOF
+
+if (defined $COPYRIGHT_END_YEAR) {
+    print OUTPUT_FILE &quot;#define __COPYRIGHT_YEAR_END_TEXT__ \&quot;$COPYRIGHT_END_YEAR\&quot;\n&quot;;
+}
+close(OUTPUT_FILE);
</ins><span class="cx">Property changes on: trunk/WebKitLibraries/win/tools/scripts/auto-version.pl
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnexecutable"></a>
<div class="addfile"><h4>Added: svn:executable</h4></div>
<a id="trunkWebKitLibrarieswintoolsscriptsautoversionsh"></a>
<div class="delfile"><h4>Deleted: trunk/WebKitLibraries/win/tools/scripts/auto-version.sh (170904 => 170905)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKitLibraries/win/tools/scripts/auto-version.sh        2014-07-08 23:58:05 UTC (rev 170904)
+++ trunk/WebKitLibraries/win/tools/scripts/auto-version.sh        2014-07-09 00:01:02 UTC (rev 170905)
</span><span class="lines">@@ -1,116 +0,0 @@
</span><del>-#!/usr/bin/bash
-
-# Copyright (C) 2007, 2009 Apple Inc.  All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-#    notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-#    notice, this list of conditions and the following disclaimer in the
-#    documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-
-
-# Trim any trailing \r or \n from the given variable.
-chomp()
-{
-    local old_value=$(eval echo &quot;\$$1&quot;);
-    local value=$(echo &quot;$old_value&quot; | sed 's/[\r\n]*$//')
-    eval $1=\$value;
-}
-
-if [[ -n &quot;$WEBKIT_LIBRARIES&quot; ]]; then
-    FALLBACK_VERSION_PATH=`cygpath -u &quot;$WEBKIT_LIBRARIES\\tools\\scripts\\VERSION&quot;`
-    FALLBACK_VERSION=$(cat &quot;$FALLBACK_VERSION_PATH&quot;);
-
-    COPYRIGHT_END_YEAR_PATH=`cygpath -u &quot;$WEBKIT_LIBRARIES\\tools\\scripts\\COPYRIGHT-END-YEAR&quot;`
-    COPYRIGHT_END_YEAR=$(cat &quot;$COPYRIGHT_END_YEAR_PATH&quot;);
-    chomp COPYRIGHT_END_YEAR
-fi
-
-OUTPUT_FILE=$(cygpath -u &quot;$1&quot;)/include/autoversion.h
-mkdir -p &quot;$(dirname &quot;$OUTPUT_FILE&quot;)&quot;
-
-# Take the initial version number from RC_ProjectSourceVersion if it
-# exists, otherwise fall back to the version number stored in the source.
-ENVIRONMENT_VERSION=${RC_ProjectSourceVersion:-$RC_PROJECTSOURCEVERSION};
-
-PROPOSED_VERSION=${ENVIRONMENT_VERSION:-$FALLBACK_VERSION}
-chomp PROPOSED_VERSION
-
-# Split out the three components of the dotted version number.  We pad
-# the input with trailing dots to handle the case where the input version
-# has fewer components than we expect.
-BUILD_MAJOR_VERSION=$(echo &quot;$PROPOSED_VERSION..&quot; | cut -d '.' -f 1)
-BUILD_MINOR_VERSION=$(echo &quot;$PROPOSED_VERSION..&quot; | cut -d '.' -f 2)
-BUILD_TINY_VERSION=$(echo &quot;$PROPOSED_VERSION..&quot; | cut -d '.' -f 3)
-
-# Cut the major component down to three characters by dropping any
-# extra leading digits, then adjust the major version portion of the
-# version string to match.
-CHARACTERS_TO_DROP=$(( ${#BUILD_MAJOR_VERSION} &gt; 3 ? ${#BUILD_MAJOR_VERSION} - 3 : 0 ))
-BUILD_MAJOR_VERSION=${BUILD_MAJOR_VERSION:$CHARACTERS_TO_DROP}
-PROPOSED_VERSION=${PROPOSED_VERSION:$CHARACTERS_TO_DROP}
-
-# Have the minor and tiny components default to zero if not present.
-BUILD_MINOR_VERSION=${BUILD_MINOR_VERSION:-0}
-BUILD_TINY_VERSION=${BUILD_TINY_VERSION:-0}
-
-# Split the first component further by using the first digit for the
-# major version and the remaining two characters as the minor version.
-# The minor version is shifted down to the tiny version, with the tiny
-# version becoming the variant version.
-MAJOR_VERSION=${BUILD_MAJOR_VERSION:0:1}
-MINOR_VERSION=${BUILD_MAJOR_VERSION:1}
-TINY_VERSION=${BUILD_MINOR_VERSION}
-VARIANT_VERSION=${BUILD_TINY_VERSION}
-
-VERSION_TEXT=${PROPOSED_VERSION}
-VERSION_TEXT_SHORT=${VERSION_TEXT}
-
-if [ -z ${ENVIRONMENT_VERSION} ]; then
-    # If we didn't pull the version number from the environment then we're doing
-    # an engineering build and we'll stamp the build with some more information.
-
-    BUILD_DATE=$(date)
-    SVN_REVISION=$(svn info | grep '^Revision' | sed 's/^Revision: //')
-
-    chomp BUILD_DATE
-    chomp SVN_REVISION
-
-    VERSION_TEXT_SHORT=&quot;${VERSION_TEXT_SHORT}+&quot;
-    VERSION_TEXT=&quot;${VERSION_TEXT_SHORT} ${USER} - ${BUILD_DATE} - r${SVN_REVISION}&quot;
-fi
-
-cat &gt; &quot;$OUTPUT_FILE&quot; &lt;&lt;EOF
-#define __VERSION_TEXT__ &quot;${VERSION_TEXT}&quot;
-#define __BUILD_NUMBER__ &quot;${VERSION_TEXT}&quot;
-#define __BUILD_NUMBER_SHORT__ &quot;${VERSION_TEXT_SHORT}&quot;
-#define __VERSION_MAJOR__ ${MAJOR_VERSION}
-#define __VERSION_MINOR__ ${MINOR_VERSION}
-#define __VERSION_TINY__ ${TINY_VERSION}
-#define __VERSION_BUILD__ ${VARIANT_VERSION}
-#define __BUILD_NUMBER_MAJOR__ ${BUILD_MAJOR_VERSION}
-#define __BUILD_NUMBER_MINOR__ ${BUILD_MINOR_VERSION}
-#define __BUILD_NUMBER_VARIANT__ ${BUILD_TINY_VERSION}
-#define __SVN_REVISION__ ${SVN_REVISION}
-EOF
-
-if [[ -n &quot;${COPYRIGHT_END_YEAR}&quot; ]]; then
-cat &gt;&gt; &quot;$OUTPUT_FILE&quot; &lt;&lt;EOF
-#define __COPYRIGHT_YEAR_END_TEXT__ &quot;${COPYRIGHT_END_YEAR}&quot;
-EOF
-fi
</del></span></pre>
</div>
</div>

</body>
</html>