[xbuild] Fix the xbuild 12 tests
authorMichael Hutchinson <m.j.hutchinson@gmail.com>
Tue, 7 Jan 2014 22:09:51 +0000 (17:09 -0500)
committerMichael Hutchinson <m.j.hutchinson@gmail.com>
Tue, 7 Jan 2014 23:39:34 +0000 (18:39 -0500)
13 files changed:
mcs/class/Microsoft.Build.Engine/Makefile
mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/Consts.cs
mcs/class/Microsoft.Build.Engine/Test/test-config-file-net-3.5 [deleted file]
mcs/class/Microsoft.Build.Engine/Test/test-config-file-net-4.0 [deleted file]
mcs/class/Microsoft.Build.Framework/Makefile
mcs/class/Microsoft.Build.Tasks/Makefile
mcs/class/Microsoft.Build.Utilities/Makefile
mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/ToolLocationHelper.cs
mcs/class/Microsoft.Build/Makefile
mcs/class/Mono.XBuild.Tasks/Makefile
mcs/tools/xbuild/Makefile
mcs/tools/xbuild/xbuild_targets.make [deleted file]
mcs/tools/xbuild/xbuild_test.make [new file with mode: 0644]

index 2bf7d9b8c66991349d2e265aa01c4c4f008d30ed..04f9e66dac5c2a9487a6869fc26e0fa10acf1b1d 100644 (file)
@@ -23,34 +23,17 @@ TEST_MCS_FLAGS = \
 EXTRA_DISTFILES = \
        Test/resources/TestTasks.cs             \
        Test/resources/*.*proj  \
-       Test/resources/*.csproj \
-       Test/test-config-file*
+       Test/resources/*.csproj
 
 Test/resources/TestTasks.dll: Test/resources/TestTasks.cs
        $(CSCOMPILE) Test/resources/TestTasks.cs /r:$(XBUILD_FRAMEWORK) /r:$(XBUILD_UTILITIES) /target:library
 
-clean-local: clean-test-tasks
-
-clean-test-tasks:
+clean-test-resources:
        rm -f Test/resources/TestTasks.dll      
 
-test-local: copy-config
-
-ifeq (net_4_0, $(PROFILE))
-copy-config:
-       cp Test/test-config-file-net-4.0 $(test_lib).config
-else
-ifeq (net_3_5, $(PROFILE))
-copy-config:
-       cp Test/test-config-file-net-3.5 $(test_lib).config
-else
-copy-config:
-endif
-endif
-
-export TESTING_MONO=a
-include $(XBUILD_DIR)/xbuild_targets.make
-
 test-local: Test/resources/TestTasks.dll
 
+clean-local: clean-test-resources
+
+include $(XBUILD_DIR)/xbuild_test.make
 include ../../build/library.make
index 31a160850a170cd7bbc08aaa2667bfddfd8078c2..8db3be70a9df673c0ef434dd73d96699152a3b57 100644 (file)
@@ -38,16 +38,42 @@ public static class Consts {
        
        public static string BinPath {
                get {
-                       if (RunningOnMono ())
-                               return "../../tools/xbuild/xbuild";
-                       else
+                       if (RunningOnMono ()) {
+#if XBUILD_12
+                               string profile = "xbuild_12";
+#elif NET_4_5
+                               string profile = "net_4_5";
+#elif NET_4_0
+                               string profile = "net_4_0";
+#elif NET_3_5
+                               string profile = "net_3_5";
+#else
+                               string profile = "net_2_0";
+#endif
+                               var corlib = typeof (object).Assembly.Location;
+                               var lib = Path.GetDirectoryName (Path.GetDirectoryName (corlib));
+                               return Path.Combine (lib, profile);
+                       } else {
+#if XBUILD_12
+                               return ToolLocationHelper.GetPathToBuildTools ("12.0");
+#elif NET_4_5
+                               return ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version45);
+#elif NET_4_0
+                               return ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version40);
+#elif NET_3_5
+                               return ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version35);
+#else
                                return ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version20);
+#endif
+                       }
                }
        }
 
        public static string ToolsVersionString {
                get {
-#if NET_4_0
+#if XBUILD_12
+                       return " ToolsVersion='12.0'";
+#elif NET_4_0
                        return " ToolsVersion='4.0'";
 #elif NET_3_5
                        return " ToolsVersion='3.5'";
@@ -59,12 +85,14 @@ public static class Consts {
 
        public static string GetTasksAsmPath ()
        {
-#if NET_4_0
-               return Path.Combine (ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version40), "Microsoft.Build.Tasks.v4.0.dll");
+#if XBUILD_12
+               return Path.Combine (BinPath, "Microsoft.Build.Tasks.v12.0.dll");
+#elif NET_4_0
+               return Path.Combine (BinPath, "Microsoft.Build.Tasks.v4.0.dll");
 #elif NET_3_5
-               return Path.Combine (ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version35), "Microsoft.Build.Tasks.v3.5.dll");
+               return Path.Combine (BinPath, "Microsoft.Build.Tasks.v3.5.dll");
 #else
-               return Path.Combine (ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version20), "Microsoft.Build.Tasks.dll");
+               return Path.Combine (BinPath, "Microsoft.Build.Tasks.dll");
 #endif
        }
 }
diff --git a/mcs/class/Microsoft.Build.Engine/Test/test-config-file-net-3.5 b/mcs/class/Microsoft.Build.Engine/Test/test-config-file-net-3.5
deleted file mode 100644 (file)
index 7756bca..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version ="1.0"?>
-<configuration>
-    <runtime>
-        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
-            <dependentAssembly>
-                <assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
-                <bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="3.5.0.0"/>
-            </dependentAssembly>
-            <dependentAssembly>
-                <assemblyIdentity name="Microsoft.Build.Engine" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
-                <bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="3.5.0.0"/>
-            </dependentAssembly>
-        </assemblyBinding>
-    </runtime>
-</configuration>
diff --git a/mcs/class/Microsoft.Build.Engine/Test/test-config-file-net-4.0 b/mcs/class/Microsoft.Build.Engine/Test/test-config-file-net-4.0
deleted file mode 100644 (file)
index 3c78f3b..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version ="1.0"?>
-<configuration>
-    <runtime>
-        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
-            <dependentAssembly>
-                <assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
-                <bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="4.0.0.0"/>
-            </dependentAssembly>
-            <dependentAssembly>
-                <assemblyIdentity name="Microsoft.Build.Engine" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
-                <bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="4.0.0.0"/>
-            </dependentAssembly>
-        </assemblyBinding>
-    </runtime>
-</configuration>
index b7b6a37ebfce4dff66be5e065d252d24d0c2c7f8..73f43fb74c773eab3c4c6617c6f2c3c6ede45f52 100644 (file)
@@ -11,10 +11,8 @@ LIB_MCS_FLAGS = \
        /r:$(corlib)                            \
        /r:System.dll
 
-include ../../build/library.make
-
-export TESTING_MONO=a
-include $(XBUILD_DIR)/xbuild_targets.make
-
 EXTRA_DISTFILES = \
        Mono.XBuild.Framework/AssemblyLoadInfo.cs
+
+include ../../build/library.make
+include $(XBUILD_DIR)/xbuild_test.make
index c3d0cb19f366a79addd858da355b5ab492d42ece..d8e93372f455a7ed6d829a1ae0b9c51a3e9906c7 100644 (file)
@@ -7,9 +7,6 @@ include $(XBUILD_DIR)/xbuild.make
 
 LIBRARY = Microsoft.Build.Tasks.dll
 
-# Some tests are explicitly testing Microsoft.Build.Tasks.v3.5.dll
-TEST_MONO_PATH = $(topdir)/class/lib/net_3_5$(PLATFORM_PATH_SEPARATOR)$(topdir)/class/lib/net_2_0
-
 LIBRARY_NAME = Microsoft.Build.Tasks$(NAME_SUFFIX).dll
 
 LIB_MCS_FLAGS = \
@@ -37,36 +34,15 @@ EXTRA_DISTFILES = \
        Test/resources/junk.txt \
        Test/test-config-file*
 
-test-local: Test/resources/test.dll
-
 Test/resources/test.dll: Test/resources/test.cs
        $(CSCOMPILE) -target:library Test/resources/test.cs
 
-clean-local: clean-test-dll
-
-clean-test-dll:
+clean-test-resources:
        rm -f Test/resources/test.dll
 
-test-local: copy-config
-
-ifeq (net_4_5, $(PROFILE))
-copy-config:
-       cp Test/test-config-file-net-4.0 $(test_lib).config
-else
-ifeq (net_4_0, $(PROFILE))
-copy-config:
-       cp Test/test-config-file-net-4.0 $(test_lib).config
-else
-ifeq (net_3_5, $(PROFILE))
-copy-config:
-       cp Test/test-config-file-net-3.5 $(test_lib).config
-else
-copy-config:
-endif
-endif
-endif
+test-local: Test/resources/test.dll
 
-export TESTING_MONO=a
-include $(XBUILD_DIR)/xbuild_targets.make
+clean-local: clean-test-resources
 
+include $(XBUILD_DIR)/xbuild_test.make
 include ../../build/library.make
index 8e8cdaddd6d2c7f7caf1cea4ecd1774726cec8d8..79888a2a3b4491391527253aa3414c3178094379 100644 (file)
@@ -15,7 +15,5 @@ LIB_MCS_FLAGS = \
 
 TEST_MCS_FLAGS = /r:$(XBUILD_FRAMEWORK) -r:System.dll -r:System.Core.dll
 
-export TESTING_MONO=a
-include $(XBUILD_DIR)/xbuild_targets.make
-
+include $(XBUILD_DIR)/xbuild_test.make
 include ../../build/library.make
index 35226c1a8b190e074b5e23b67bd4343983a9c5bd..9a2ed2c6f9629dd0ff39444b389c478410232459 100644 (file)
@@ -161,6 +161,9 @@ namespace Microsoft.Build.Utilities
                        if (toolsVersion != "12.0")
                                return null;
 
+                       if (Environment.GetEnvironmentVariable ("TESTING_MONO") != null)
+                               return Path.Combine (lib_mono_dir, "xbuild_12");
+
                        if (runningOnDotNet) {
                                //see http://msdn.microsoft.com/en-us/library/vstudio/bb397428(v=vs.120).aspx
                                var programFiles = Environment.GetFolderPath (Environment.SpecialFolder.ProgramFilesX86);
index 8f7fc060c94dce7ad182d40b35a4eaf4b8ffe9b2..931b9fc7e57482e278392af95aabd5ab397d55c8 100644 (file)
@@ -34,6 +34,5 @@ BUILT_SOURCES = $(EXPR_PARSER).cs
 
 include ../../build/library.make
 
-export TESTING_MONO=a
 XBUILD_FRAMEWORK_FOLDERS_PATH=xbuild-testing
-include $(XBUILD_DIR)/xbuild_targets.make
+include $(XBUILD_DIR)/xbuild_test.make
index 23aabb41c4295fc93bb80807f0e827e3b4fb8fe4..7135c45e3c73202b0b0188ba0ffd22e5077d71b7 100644 (file)
@@ -12,7 +12,6 @@ LIB_MCS_FLAGS = \
        /r:System.dll                           \
        /r:System.Xml.dll
 
-export TESTING_MONO=a
-include $(XBUILD_DIR)/xbuild_targets.make
+include $(XBUILD_DIR)/xbuild_test.make
 
 include ../../build/library.make
index ded2498e72bd6919ac2d476e03ae86003bb33179..81a6bcd4ad6ce39cbed6e4435d4559d6143d9c94 100644 (file)
@@ -13,7 +13,7 @@ include ../../build/executable.make
 XBUILD_DIR=.
 XBUILD_FRAMEWORKS_DIR=$(mono_libdir)/mono/xbuild-frameworks/.NETFramework/
 REDISTLIST_DIR=$(XBUILD_FRAMEWORKS_DIR)/v$(FRAMEWORK_VERSION)/RedistList
-include $(XBUILD_DIR)/xbuild_targets.make
+include $(XBUILD_DIR)/xbuild_test.make
 
 install-local: install-extras
 
diff --git a/mcs/tools/xbuild/xbuild_targets.make b/mcs/tools/xbuild/xbuild_targets.make
deleted file mode 100644 (file)
index af1140f..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-XBUILD_TARGETS_DIR=$(topdir)/tools/xbuild/xbuild
-
-test-local: copy-targets
-
-copy-targets:
-       for p in net_2_0 net_3_5 net_4_0; do \
-               cp $(XBUILD_TARGETS_DIR)/Microsoft.CSharp.targets $(topdir)/class/lib/$$p; \
-               cp $(XBUILD_TARGETS_DIR)/Microsoft.VisualBasic.targets $(topdir)/class/lib/$$p; \
-       done
-       cp $(XBUILD_TARGETS_DIR)/2.0/Microsoft.Common.* $(topdir)/class/lib/net_2_0
-       cp $(XBUILD_TARGETS_DIR)/3.5/Microsoft.Common.* $(topdir)/class/lib/net_3_5
-       cp $(XBUILD_TARGETS_DIR)/4.0/Microsoft.Common.* $(topdir)/class/lib/net_4_0
-
-clean-local: clean-target-files
-
-clean-target-files:
-       for p in net_2_0 net_3_5 net_4_0; do \
-               rm -f $(topdir)/class/lib/$$p/Microsoft.Common.targets; \
-               rm -f $(topdir)/class/lib/$$p/Microsoft.CSharp.targets; \
-               rm -f $(topdir)/class/lib/$$p/Microsoft.VisualBasic.targets; \
-               rm -f $(topdir)/class/lib/$$p/Microsoft.Common.tasks; \
-       done
diff --git a/mcs/tools/xbuild/xbuild_test.make b/mcs/tools/xbuild/xbuild_test.make
new file mode 100644 (file)
index 0000000..1917f88
--- /dev/null
@@ -0,0 +1,38 @@
+XBUILD_TARGETS_DIR=$(topdir)/tools/xbuild/xbuild
+XBUILD_PROFILE_DIR=$(topdir)/class/lib/$(PROFILE)
+
+# makes xbuild look in the class/lib/$PROFILE build directories for targets etc
+export TESTING_MONO=a
+
+test-local: copy-targets $(test_lib).config
+
+copy-targets:
+       cp $(XBUILD_TARGETS_DIR)/$(XBUILD_VERSION)/Microsoft.Common.targets $(XBUILD_PROFILE_DIR)
+       cp $(XBUILD_TARGETS_DIR)/$(XBUILD_VERSION)/Microsoft.Common.tasks $(XBUILD_PROFILE_DIR)
+       cp $(XBUILD_TARGETS_DIR)/Microsoft.CSharp.targets $(XBUILD_PROFILE_DIR)
+       cp $(XBUILD_TARGETS_DIR)/Microsoft.VisualBasic.targets $(XBUILD_PROFILE_DIR)
+
+clean-local: clean-target-files clean-test-config
+
+clean-target-files:
+       rm -f $(XBUILD_PROFILE_DIR)/Microsoft.Common.targets
+       rm -f $(XBUILD_PROFILE_DIR)/Microsoft.Common.tasks
+       rm -f $(XBUILD_PROFILE_DIR)/Microsoft.CSharp.targets
+       rm -f $(XBUILD_PROFILE_DIR)/Microsoft.VisualBasic.targets
+
+$(test_lib).config: $(XBUILD_DIR)/xbuild.exe.config.in
+       sed -e 's/@XBUILD_ASSEMBLY_VERSION@/$(XBUILD_ASSEMBLY_VERSION)/g' $(XBUILD_DIR)/xbuild.exe.config.in > $(test_lib).config
+
+clean-test-config:
+       rm -f $(test_lib).config
+
+#allow tests to find older versions of libs
+ifneq (2.0, $(XBUILD_VERSION))
+TEST_MONO_PATH := $(topdir)/class/lib/net_2_0
+ifneq (3.5, $(XBUILD_VERSION))
+TEST_MONO_PATH := $(topdir)/class/lib/net_3_5$(PLATFORM_PATH_SEPARATOR)$(TEST_MONO_PATH)
+ifneq (4.0, $(XBUILD_VERSION))
+TEST_MONO_PATH := $(topdir)/class/lib/net_4_5$(PLATFORM_PATH_SEPARATOR)$(TEST_MONO_PATH)
+endif
+endif
+endif