- Revision
- 171903
- Author
- [email protected]
- Date
- 2014-07-31 18:15:56 -0700 (Thu, 31 Jul 2014)
Log Message
[Win] Use RC_PROJECTBUILDVERSION as build portion of version
https://bugs.webkit.org/show_bug.cgi?id=135478
Reviewed by David Kilzer.
Tools:
Add new test suite for the version-stamp program.
* Scripts/webkitperl/auto-version_unittest/versionStampTests.pl: Added.
WebKitLibraries:
* win/tools/scripts/version-stamp.pl: Check environment for
RC_PROJECTBUILDVERSION, and use it for the build portion of
the file version resource. Otherwise, use the __VERSION_BUILD__
value we calculated from the version string.
Modified Paths
Added Paths
Diff
Modified: trunk/Tools/ChangeLog (171902 => 171903)
--- trunk/Tools/ChangeLog 2014-08-01 01:01:00 UTC (rev 171902)
+++ trunk/Tools/ChangeLog 2014-08-01 01:15:56 UTC (rev 171903)
@@ -1,3 +1,14 @@
+2014-07-31 Brent Fulgham <[email protected]>
+
+ [Win] Use RC_PROJECTBUILDVERSION as build portion of version
+ https://bugs.webkit.org/show_bug.cgi?id=135478
+
+ Reviewed by David Kilzer.
+
+ Add new test suite for the version-stamp program.
+
+ * Scripts/webkitperl/auto-version_unittest/versionStampTests.pl: Added.
+
2014-07-31 Dan Bernstein <[email protected]>
Reverted r171893, because it broke http/tests/appcache/different-https-origin-resource-main.html,
Added: trunk/Tools/Scripts/webkitperl/auto-version_unittest/versionStampTests.pl (0 => 171903)
--- trunk/Tools/Scripts/webkitperl/auto-version_unittest/versionStampTests.pl (rev 0)
+++ trunk/Tools/Scripts/webkitperl/auto-version_unittest/versionStampTests.pl 2014-08-01 01:15:56 UTC (rev 171903)
@@ -0,0 +1,93 @@
+#!/usr/bin/perl -w
+
+# Copyright (C) 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+
+use strict;
+use warnings;
+
+use File::Spec;
+use File::Temp qw/ tempdir /;
+
+use Test::More;
+
+my @testCases =
+(
+ {
+ 'RC_ProjectSourceVersion' => '5300.4.3.2.1',
+ 'RC_PROJECTBUILDVERSION' => undef,
+ expectedVersionResult => '300.4003.2001',
+ expectedBuildVersionResult => 1,
+ },
+
+ {
+ 'RC_ProjectSourceVersion' => '5300.4.3.2.1',
+ 'RC_PROJECTBUILDVERSION' => 156,
+ expectedVersionResult => '300.4003.2001',
+ expectedBuildVersionResult => 156,
+ },
+);
+
+# This test should only be run on Windows
+if ($^O ne 'MSWin32' && $^O ne 'cygwin') {
+ plan(tests => 1);
+ is(1, 1, 'do nothing for non-Windows builds.');
+ exit 0;
+}
+
+my $testCasesCount = scalar(@testCases) * 2;
+plan(tests => $testCasesCount);
+
+my $TOOLS_PATH = $ENV{'WEBKIT_LIBRARIES'};
+my $AUTO_VERSION_SCRIPT = File::Spec->catfile($TOOLS_PATH, 'tools', 'scripts', 'auto-version.pl');
+my $VERSION_STAMP_SCRIPT = File::Spec->catfile($TOOLS_PATH, 'tools', 'scripts', 'version-stamp.pl');
+
+foreach my $testCase (@testCases) {
+ my $testOutputDir = tempdir(CLEANUP => 1);
+ `RC_ProjectSourceVersion="$testCase->{'RC_ProjectSourceVersion'}" perl $AUTO_VERSION_SCRIPT $testOutputDir`;
+
+ my $command;
+ if (defined($testCase->{'RC_PROJECTBUILDVERSION'})) {
+ $command="RC_PROJECTBUILDVERSION=\"$testCase->{'RC_PROJECTBUILDVERSION'}\" ";
+ }
+ $command .= "perl $VERSION_STAMP_SCRIPT $testOutputDir $testOutputDir";
+
+ my @versionStamperOutput = qx($command 2>&1);
+
+ foreach my $line (@versionStamperOutput) {
+ if ($line !~ m/RC_PROJECTBUILDVERSION/) {
+ next;
+ }
+
+ chomp($line);
+
+ $line =~ m/RC_PROJECTSOURCEVERSION=([^\s]+) and RC_PROJECTBUILDVERSION=(.*)$/;
+
+ my $projectSourceResult=$1;
+ my $buildVersionResult=$2;
+
+ is($projectSourceResult, $testCase->{expectedVersionResult}, "$testCase->{'RC_ProjectSourceVersion'}: $testCase->{expectedVersionResult}");
+
+ my $testCaseInput = $testCase->{'RC_PROJECTBUILDVERSION'} || 'undefined';
+ is($buildVersionResult, $testCase->{expectedBuildVersionResult}, "$testCaseInput: $testCase->{expectedBuildVersionResult}");
+ }
+}
Property changes on: trunk/Tools/Scripts/webkitperl/auto-version_unittest/versionStampTests.pl
___________________________________________________________________
Added: svn:executable
Modified: trunk/WebKitLibraries/ChangeLog (171902 => 171903)
--- trunk/WebKitLibraries/ChangeLog 2014-08-01 01:01:00 UTC (rev 171902)
+++ trunk/WebKitLibraries/ChangeLog 2014-08-01 01:15:56 UTC (rev 171903)
@@ -1,5 +1,17 @@
2014-07-31 Brent Fulgham <[email protected]>
+ [Win] Use RC_PROJECTBUILDVERSION as build portion of version
+ https://bugs.webkit.org/show_bug.cgi?id=135478
+
+ Reviewed by David Kilzer.
+
+ * win/tools/scripts/version-stamp.pl: Check environment for
+ RC_PROJECTBUILDVERSION, and use it for the build portion of
+ the file version resource. Otherwise, use the __VERSION_BUILD__
+ value we calculated from the version string.
+
+2014-07-31 Brent Fulgham <[email protected]>
+
[Win] Fix build failure when using 5-tuple build versions.
https://bugs.webkit.org/show_bug.cgi?id=135464
<rdar://problem/17872507>
Modified: trunk/WebKitLibraries/win/tools/scripts/version-stamp.pl (171902 => 171903)
--- trunk/WebKitLibraries/win/tools/scripts/version-stamp.pl 2014-08-01 01:01:00 UTC (rev 171902)
+++ trunk/WebKitLibraries/win/tools/scripts/version-stamp.pl 2014-08-01 01:15:56 UTC (rev 171903)
@@ -2,6 +2,7 @@
use strict;
use File::Spec;
+use POSIX;
# Copyright (C) 2007, 2009, 2014 Apple Inc. All rights reserved.
#
@@ -90,17 +91,17 @@
print "Adjusting RC_PROJECTSOURCEVERSION and RC_ProjectSourceVersion to be safe for VersionStamper.\n";
my $SAFE_PROJECT_VERSION = "$components{'__VERSION_MAJOR__'}.$components{'__VERSION_MINOR__'}.$components{'__VERSION_TINY__'}";
+my $SAFE_BUILD_VERSION = $ENV{RC_PROJECTBUILDVERSION} || $components{'__VERSION_BUILD__'};
-print "Using RC_PROJECTSOURCEVERSION=$SAFE_PROJECT_VERSION and RC_PROJECTBUILDVERSION=$components{'__VERSION_BUILD__'}\n";
+print "Using RC_PROJECTSOURCEVERSION=$SAFE_PROJECT_VERSION and RC_PROJECTBUILDVERSION=$SAFE_BUILD_VERSION\n";
# Note: These environment settings only affect this script and its child processes:
$ENV{RC_PROJECTSOURCEVERSION} = $SAFE_PROJECT_VERSION;
$ENV{RC_ProjectSourceVersion} = $SAFE_PROJECT_VERSION;
-$ENV{RC_PROJECTBUILDVERSION} = $components{'__VERSION_BUILD__'};
my $rc = system($VERSION_STAMPER, '--verbose', $TARGET_PATH, '--fileMajor', $components{'__VERSION_MAJOR__'},
'--fileMinor', $components{'__VERSION_MINOR__'}, '--fileRevision', $components{'__VERSION_TINY__'},
- '--fileBuild', $components{'__VERSION_BUILD__'}, '--productMajor', $components{'__VERSION_MAJOR__'},
+ '--fileBuild', $SAFE_BUILD_VERSION, '--productMajor', $components{'__VERSION_MAJOR__'},
'--productMinor', $components{'__VERSION_MINOR__'}, '--productRevision', $components{'__VERSION_TINY__'},
'--productBuild', $components{'__VERSION_BUILD__'});