Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r49463 - in trunk/tools/build/v2: test tools
From: steven_at_[hidden]
Date: 2008-10-27 12:27:54


Author: steven_watanabe
Date: 2008-10-27 12:27:53 EDT (Mon, 27 Oct 2008)
New Revision: 49463
URL: http://svn.boost.org/trac/boost/changeset/49463

Log:
Make common.copy set the timestamp of the destination to the current time on windows
Added:
   trunk/tools/build/v2/test/copy_time.py (contents, props changed)
Text files modified:
   trunk/tools/build/v2/test/test_all.py | 1 +
   trunk/tools/build/v2/tools/common.jam | 9 +++++++--
   2 files changed, 8 insertions(+), 2 deletions(-)

Added: trunk/tools/build/v2/test/copy_time.py
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/test/copy_time.py 2008-10-27 12:27:53 EDT (Mon, 27 Oct 2008)
@@ -0,0 +1,76 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2008
+# Steven Watanabe
+#
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+# Test that the common.copy rule set the modification
+# date of the new file the current time.
+
+import BoostBuild
+
+tester = BoostBuild.Tester()
+
+tester.write("test1.cpp", """
+#include <iostream>
+template<bool, int M, class Next>
+struct time_waster {
+ typedef typename time_waster<true, M-1, time_waster>::type type1;
+ typedef typename time_waster<false, M-1, time_waster>::type type2;
+ typedef void type;
+};
+template<bool B, class Next>
+struct time_waster<B, 0, Next> {
+ typedef void type;
+};
+typedef time_waster<true, 10, void>::type type;
+int f() { return 0; }
+""")
+
+tester.write("test2.cpp", """
+#include <iostream>
+template<bool, int M, class Next>
+struct time_waster {
+ typedef typename time_waster<true, M-1, time_waster>::type type1;
+ typedef typename time_waster<false, M-1, time_waster>::type type2;
+ typedef void type;
+};
+template<bool B, class Next>
+struct time_waster<B, 0, Next> {
+ typedef void type;
+};
+typedef time_waster<true, 10, void>::type type;
+int g() { return 0; }
+""")
+
+tester.write("jamroot.jam", """
+obj test2 : test2.cpp ;
+obj test1 : test1.cpp : <dependency>test2 ;
+install test2i : test2 : <dependency>test1 ;
+""")
+
+tester.run_build_system()
+
+tester.expect_addition("bin/$toolset/debug/test2.obj")
+tester.expect_addition("bin/$toolset/debug/test1.obj")
+tester.expect_addition("test2i/test2.obj")
+tester.expect_nothing_more()
+
+test2src = tester.read("test2i/test2.obj")
+test2dest = tester.read("bin/$toolset/debug/test2.obj")
+
+if test2src != test2dest:
+ BoostBuild.annotation("failure", "The object file was not copied correctly")
+ tester.fail_test(1)
+
+del test2src
+del test2dest
+
+tester.run_build_system("-d1")
+tester.expect_output_line("common.copy*", expected_to_exist=False)
+tester.expect_nothing_more()
+
+tester.cleanup()

Modified: trunk/tools/build/v2/test/test_all.py
==============================================================================
--- trunk/tools/build/v2/test/test_all.py (original)
+++ trunk/tools/build/v2/test/test_all.py 2008-10-27 12:27:53 EDT (Mon, 27 Oct 2008)
@@ -109,6 +109,7 @@
           "conditionals3",
           "conditionals_multiple",
           "configuration",
+ "copy_time",
           "custom_generator",
           "default_build",
           "default_features",

Modified: trunk/tools/build/v2/tools/common.jam
==============================================================================
--- trunk/tools/build/v2/tools/common.jam (original)
+++ trunk/tools/build/v2/tools/common.jam 2008-10-27 12:27:53 EDT (Mon, 27 Oct 2008)
@@ -466,9 +466,14 @@
 if [ os.name ] = NT
 {
     RM = del /f /q ;
- CP = copy ;
+ CP = copy /b ;
     IGNORE = "2>nul >nul & setlocal" ;
     LN ?= $(CP) ;
+ # Ugly hack to convince copy to set the timestamp of the
+ # destination to the current time by concatenating the
+ # source with a nonexistent file. Note that this requires
+ # /b (binary) as the default when concatenating files is /a (ascii).
+ WINDOWS-CP-HACK = "+ this-file-does-not-exist-A698EE7806899E69" ;
 }
 else
 {
@@ -681,7 +686,7 @@
 
 actions copy
 {
- $(CP) "$(>)" "$(<)"
+ $(CP) "$(>)" $(WINDOWS-CP-HACK) "$(<)"
 }
 
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk