Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add support for ToolsVersion and correctly build msbuild+xbuild assem…

…blies

for 3.5 and 4.0 profiles.

2010-04-03  Ankit Jain  <jankit@novell.com>

	* Makefile: Process tools/xbuild for 3.5 also.

In class/Microsoft.Build.Engine:
2010-04-03  Ankit Jain  <jankit@novell.com>

	* Makefile: Use the correct assembly name for MS.Build.Utilities*
	for 3.5 and 4.0 profiles. Copy the .config files for the test
	assembly.
	Import tools/xbuild/xbuild_targets.make, which copies the target
	and tasks file in the correct place, to allow running tests
	with different toolsversion.
	* Microsoft.Build.Engine.dll.sources: Add LogExtensions.cs,
	Toolset.cs, ToolsetDefinitionLocations.cs and ToolsetCollection.cs .
	* Test/test-config-file-net-3.5: New.
	* Test/test-config-file-net-4.0: New.

In class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine:
2010-04-03  Ankit Jain  <jankit@novell.com>

	* BuildEngine.cs: Implement IBuildEngine2 instead of
	IBuildEngine.
	* BuildTasks.cs: Use the new extension methods for logging.
	(InitializeTask): Emit a message informing about the assembly
	from which the task is being loaded. Emit a useful debug message
	incase of a InvalidCastException.
	* Engine.cs: Add missing methods, constructors and properties related
	to ToolsVersion support. Setup a default set of Toolsets.
	Keep separate taskdbs' per ToolsVersion. The common tasks
	would come from different *.tasks file, and use different
	task assemblies.
	(DefaultToolsVersion): Correctly set this based on the profile.
	* LogExtensions.cs: New. Extension methods on Engine, for logging.
	* Project.cs: Add missing methods/contructors/properties related
	to ToolsVersion support. Add reserved properties -
	MSBuildToolsPath and MSBuildToolsVersion .
	* Toolset.cs: New.
	* ToolsetCollection.cs: New.
	* ToolsetDefinitionLocations.cs: New.

In class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine:
2010-04-06  Ankit Jain  <jankit@novell.com>

	* Consts.cs (ToolsVersionString): New.
	(GetTasksAsmPath): New.
	* EngineTest.cs: Use the direct path to the tasks assembly
	in the UsingTasks.
	* ProjectTest.cs: Set ToolsVersion to the current profile.

In class/Microsoft.Build.Framework:
2010-04-03  Ankit Jain  <jankit@novell.com>

	* Makefile: Import tools/xbuild/xbuild_targets.make, which copies
	the target and tasks file in the correct place, to allow running
	tests with different toolsversion.
	* Microsoft.Build.Framework.dll.sources: Add IBuildEngine2.cs .

In class/Microsoft.Build.Framework/Microsoft.Build.Framework:
2010-04-03  Ankit Jain  <jankit@novell.com>

	* IBuildEngine2.cs: New.

In class/Microsoft.Build.Tasks:
2010-04-03  Ankit Jain  <jankit@novell.com>

	* Makefile: Import tools/xbuild/xbuild_targets.make, which copies
	the target and tasks file in the correct place, to allow running
	tests with different toolsversion. Copy the config file for the
	test assembly. Clean the generated test.dll .
	Use the correct target assembly name for 4.0 profile
	(ms.build.tasks.v4.0.dll), and for Utilities assembly.
	* Microsoft.Build.Tasks_test.dll.sources: Use Consts.cs from Engine
	instead of maintaining a copy here.

In class/Microsoft.Build.Tasks/Microsoft.Build.Tasks:
2010-04-03  Ankit Jain  <jankit@novell.com>

	* Csc.cs: Use dmcs as the compiler for 4.0 profile.
	* MSBuild.cs (ToolsVersion): New.
	Use toolsVersion for building.

In class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks:
2010-04-06  Ankit Jain  <jankit@novell.com>

	* Consts.cs: Remove.
	* AssignProjectConfigurationTest.cs:
	* CreateCSharpManifestResourceNameTest.cs:
	* CreateVisualBasicManifestResourceNameTest.cs:
	* CreateItemTest.cs:
	* FindAppConfigFileTest.cs:
	* RemoveDuplicatesTest.cs:
	* TaskBatchingTest.cs:
	* WriteLinesToFileTest.cs:
	Set the ToolsVersion to match the profile. Use the
	full path to the tasks assembly for UsingTasks.

In class/Microsoft.Build.Utilities:
2010-04-03  Ankit Jain  <jankit@novell.com>

	* Makefile: Import tools/xbuild/xbuild_targets.make, which copies
	the target and tasks file in the correct place, to allow running
	tests with different toolsversion.
	Use the correct target assembly name for 4.0 profile.

In class/Microsoft.Build.Utilities/Microsoft.Build.Utilities:
2010-04-03  Ankit Jain  <jankit@novell.com>

	* TargetDotNetFrameworkVersion.cs: Add Version40 .
	* Task.cs (BuildEngine2): New.
	* ToolLocationHelper.cs: Use class/linet_* as the path
	for the assemblies and targets when running tests.
	Environment variable TESTING_MONO is set for testing.
	This allows a 4.0 xbuild to build 2.0/3.5 projects.

In tools:
2010-04-03  Ankit Jain  <jankit@novell.com>

	* Makefile: Move xbuild from net_4_0_dirs to per_profile_dirs.

In tools/xbuild:
2010-04-03  Ankit Jain  <jankit@novell.com>

	* Main.cs (Execute): If toolsversion is specified on the command line,
	then use that.
	* Parameters.cs: Read toolsversion from the command line ('/tv:..') .
	* SolutionParser.cs: Infer ToolsVersion from the sln version.
	Set ToolsVersion property of the MSBuild tasks, in the generated
	.sln.proj file, for building the projects.

	* xbuild/Microsoft.Common.tasks: Move to ..
	* xbuild/2.0/Microsoft.Common.tasks: .. here.
	* xbuild/3.5/Microsoft.Common.tasks: New.
	* xbuild/4.0/Microsoft.Common.tasks: New.
	Use the corresponding 3.5/4.0 tasks assembly.

	* xbuild_targets.make: Copies the target and tasks file in the correct
	place, to allow running tests with different toolsversion.
	* Makefile: Import xbuild_targets.make . Use correct assembly names for
	Utilities assembly, for 3.5/4.0 profiles.
	Install the correct Microsoft.Common.tasks file for the profile.
	Copy xbuild.exe to class/li$(PROFILE), so that it can find other
	profile dirs as relative path.
	(EXTRA_DISTFILES): Add the new Microsoft.Common.tasks files.

svn path=/trunk/mcs/; revision=154835
  • Loading branch information...
commit 4427a6008078a25c50102da747cd2319cfd6192a 2 parents b5aa5ab + ad6c760
Ankit Jain radical authored
Showing with 1,246 additions and 164 deletions.
  1. +4 −0 mcs/ChangeLog
  2. +1 −1  mcs/Makefile
  3. +13 −0 mcs/class/Microsoft.Build.Engine/ChangeLog
  4. +38 −4 mcs/class/Microsoft.Build.Engine/Makefile
  5. +26 −2 mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildEngine.cs
  6. +13 −9 mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildTask.cs
  7. +22 −0 mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ChangeLog
  8. +123 −30 mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Engine.cs
  9. +183 −0 mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/LogExtensions.cs
  10. +50 −5 mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
  11. +53 −0 mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Toolset.cs
  12. +99 −0 mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ToolsetCollection.cs
  13. +11 −18 ...ld.Tasks/Consts.cs → Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ToolsetDefinitionLocations.cs}
  14. +4 −0 mcs/class/Microsoft.Build.Engine/Microsoft.Build.Engine.dll.sources
  15. +8 −0 mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ChangeLog
  16. +24 −0 mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/Consts.cs
  17. +61 −50 mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/EngineTest.cs
  18. +3 −3 mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ProjectTest.cs
  19. +15 −0 mcs/class/Microsoft.Build.Engine/Test/test-config-file-net-3.5
  20. +15 −0 mcs/class/Microsoft.Build.Engine/Test/test-config-file-net-4.0
  21. +7 −0 mcs/class/Microsoft.Build.Framework/ChangeLog
  22. +4 −0 mcs/class/Microsoft.Build.Framework/Makefile
  23. +1 −0  mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework.dll.sources
  24. +4 −0 mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ChangeLog
  25. +59 −0 mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/IBuildEngine2.cs
  26. +11 −0 mcs/class/Microsoft.Build.Tasks/ChangeLog
  27. +30 −2 mcs/class/Microsoft.Build.Tasks/Makefile
  28. +6 −0 mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/ChangeLog
  29. +4 −0 mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Csc.cs
  30. +18 −1 mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/MSBuild.cs
  31. +1 −1  mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks_test.dll.sources
  32. +7 −1 mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/AssignProjectConfigurationTest.cs
  33. +14 −0 mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/ChangeLog
  34. +8 −3 mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/CreateCSharpManifestResourceNameTest.cs
  35. +3 −1 mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/CreateItemTest.cs
  36. +8 −3 mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/CreateVisualBasicManifestResourceNameTest.cs
  37. +4 −2 mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/FindAppConfigFileTest.cs
  38. +1 −1  mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/RemoveDuplicatesTest.cs
  39. +14 −8 mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/TaskBatchingTest.cs
  40. +1 −1  mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/WriteLinesToFileTest.cs
  41. +15 −0 mcs/class/Microsoft.Build.Tasks/Test/test-config-file-net-3.5
  42. +15 −0 mcs/class/Microsoft.Build.Tasks/Test/test-config-file-net-4.0
  43. +7 −0 mcs/class/Microsoft.Build.Utilities/ChangeLog
  44. +8 −0 mcs/class/Microsoft.Build.Utilities/Makefile
  45. +9 −0 mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/ChangeLog
  46. +5 −0 mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/TargetDotNetFrameworkVersion.cs
  47. +4 −0 mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/Task.cs
  48. +17 −6 mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/ToolLocationHelper.cs
  49. +4 −0 mcs/tools/ChangeLog
  50. +2 −2 mcs/tools/Makefile
  51. +24 −0 mcs/tools/xbuild/ChangeLog
  52. +11 −5 mcs/tools/xbuild/Main.cs
  53. +21 −4 mcs/tools/xbuild/Makefile
  54. +9 −1 mcs/tools/xbuild/Parameters.cs
  55. +35 −0 mcs/tools/xbuild/SolutionParser.cs
  56. 0  mcs/tools/xbuild/xbuild/{ → 2.0}/Microsoft.Common.tasks
  57. +34 −0 mcs/tools/xbuild/xbuild/3.5/Microsoft.Common.tasks
  58. +34 −0 mcs/tools/xbuild/xbuild/4.0/Microsoft.Common.tasks
  59. +21 −0 mcs/tools/xbuild/xbuild_targets.make
4 mcs/ChangeLog
View
@@ -1,3 +1,7 @@
+2010-04-03 Ankit Jain <jankit@novell.com>
+
+ * Makefile: Process tools/xbuild for 3.5 also.
+
2010-03-16 Jb Evain <jbevain@novell.com>
* Makefile: rename the net_2_1 profile to moonlight.
2  mcs/Makefile
View
@@ -10,7 +10,7 @@ moonlight_raw_SUBDIRS := build mcs class tools
moonlight_SUBDIRS := tools tests errors
monotouch_SUBDIRS := build mcs class
monotouch_bootstrap_SUBDIRS := build mcs class
-net_3_5_SUBDIRS := build class
+net_3_5_SUBDIRS := build class tools/xbuild
net_4_0_bootstrap_SUBDIRS := build mcs class tools
net_4_0_SUBDIRS := build mcs class nunit24 ilasm tools tests errors docs
13 mcs/class/Microsoft.Build.Engine/ChangeLog
View
@@ -1,3 +1,16 @@
+2010-04-03 Ankit Jain <jankit@novell.com>
+
+ * Makefile: Use the correct assembly name for MS.Build.Utilities*
+ for 3.5 and 4.0 profiles. Copy the .config files for the test
+ assembly.
+ Import tools/xbuild/xbuild_targets.make, which copies the target
+ and tasks file in the correct place, to allow running tests
+ with different toolsversion.
+ * Microsoft.Build.Engine.dll.sources: Add LogExtensions.cs,
+ Toolset.cs, ToolsetDefinitionLocations.cs and ToolsetCollection.cs .
+ * Test/test-config-file-net-3.5: New.
+ * Test/test-config-file-net-4.0: New.
+
2010-02-19 Ankit Jain <jankit@novell.com>
* Microsoft.Build.Engine.dll.sources: Add ProjectLoadSettings.cs .
42 mcs/class/Microsoft.Build.Engine/Makefile
View
@@ -11,23 +11,57 @@ NO_TEST = yes
NO_SIGN_ASSEMBLY = yes
endif
+ifeq (3.5, $(FRAMEWORK_VERSION))
+NAME_SUFFIX = .v3.5
+else
+ifeq (4.0, $(FRAMEWORK_VERSION))
+NAME_SUFFIX = .v4.0
+endif
+endif
+
LIB_MCS_FLAGS = \
/r:$(corlib) \
/r:System.dll \
+ /r:System.Core.dll \
/r:System.Xml.dll \
/r:Microsoft.Build.Framework.dll \
- /r:Microsoft.Build.Utilities.dll
+ /r:Microsoft.Build.Utilities$(NAME_SUFFIX).dll
TEST_MCS_FLAGS = \
/r:Microsoft.Build.Framework.dll \
- /r:Microsoft.Build.Utilities.dll
+ /r:Microsoft.Build.Utilities$(NAME_SUFFIX).dll
EXTRA_DISTFILES = \
Test/resources/TestTasks.cs \
- Test/resources/*.*proj
+ Test/resources/*.*proj \
+ Test/resources/TestTasks.dll.config \
+ Test/test-config-file*
Test/resources/TestTasks.dll: Test/resources/TestTasks.cs
- $(CSCOMPILE) Test/resources/TestTasks.cs /r:Microsoft.Build.Framework.dll /r:Microsoft.Build.Utilities.dll /target:library
+ $(CSCOMPILE) Test/resources/TestTasks.cs /r:Microsoft.Build.Framework.dll /r:Microsoft.Build.Utilities$(NAME_SUFFIX).dll /target:library
+
+clean-local: clean-test-tasks
+
+clean-test-tasks:
+ 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
+XBUILD_DIR=../../tools/xbuild
+include $(XBUILD_DIR)/xbuild_targets.make
test-local: Test/resources/TestTasks.dll
28 mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildEngine.cs
View
@@ -32,7 +32,7 @@
using Microsoft.Build.Framework;
namespace Microsoft.Build.BuildEngine {
- internal class BuildEngine : IBuildEngine {
+ internal class BuildEngine : IBuildEngine2 {
Engine engine;
int columnNumberOfTaskNode;
@@ -60,7 +60,16 @@ internal class BuildEngine : IBuildEngine {
IDictionary globalProperties,
IDictionary targetOutputs)
{
+ return BuildProjectFile (projectFileName, targetNames, globalProperties, targetOutputs, null);
+ }
+
+ public bool BuildProjectFile (string projectFileName,
+ string[] targetNames,
+ IDictionary globalProperties,
+ IDictionary targetOutputs, string toolsVersion)
+ {
if (String.IsNullOrEmpty (projectFileName)) {
+ project.ToolsVersion = toolsVersion;
return engine.BuildProject (project, targetNames, targetOutputs,
BuildSettings.DoNotResetPreviouslyBuiltTargets);
} else {
@@ -71,10 +80,21 @@ internal class BuildEngine : IBuildEngine {
(string) de.Key, (string) de.Value,
PropertyType.Global));
return engine.BuildProjectFile (projectFileName,
- targetNames, bpg, targetOutputs, BuildSettings.DoNotResetPreviouslyBuiltTargets);
+ targetNames, bpg, targetOutputs, BuildSettings.DoNotResetPreviouslyBuiltTargets, toolsVersion);
}
}
+ public bool BuildProjectFilesInParallel (string[] projectFileNames,
+ string [] targetNames,
+ IDictionary[] globalProperties,
+ IDictionary[] targetOutputsPerProject,
+ string[] toolsVersion,
+ bool useResultsCache,
+ bool unloadProjectsOnCompletion)
+ {
+ throw new NotImplementedException ();
+ }
+
// Raises a custom event to all registered loggers.
public void LogCustomEvent (CustomBuildEventArgs e)
{
@@ -128,6 +148,10 @@ public void LogWarningEvent (BuildWarningEventArgs e)
public string ProjectFileOfTaskNode {
get { return taskfile; }
}
+
+ public bool IsRunningMultipleNodes {
+ get { return false; }
+ }
}
}
22 mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildTask.cs
View
@@ -176,27 +176,31 @@ void LogTaskFinished (bool succeeded)
void LogError (string message,
params object[] messageArgs)
{
- BuildErrorEventArgs beea = new BuildErrorEventArgs (
- null, null, null, 0, 0, 0, 0, String.Format (message, messageArgs),
- null, null);
- parentTarget.Project.ParentEngine.EventSource.FireErrorRaised (this, beea);
+ parentTarget.Project.ParentEngine.LogError (message, messageArgs);
}
void LogMessage (MessageImportance importance,
string message,
params object[] messageArgs)
{
- BuildMessageEventArgs bmea = new BuildMessageEventArgs (
- String.Format (message, messageArgs), null,
- null, importance);
- parentTarget.Project.ParentEngine.EventSource.FireMessageRaised (this, bmea);
+ parentTarget.Project.ParentEngine.LogMessage (importance, message, messageArgs);
}
ITask InitializeTask ()
{
ITask task;
- task = (ITask)Activator.CreateInstance (this.Type);
+ try {
+ task = (ITask)Activator.CreateInstance (this.Type);
+ } catch (InvalidCastException) {
+ LogMessage (MessageImportance.Low, "InvalidCastException, ITask: {0} Task type: {1}",
+ typeof (ITask).AssemblyQualifiedName, this.Type.AssemblyQualifiedName);
+ throw;
+ }
+ parentTarget.Project.ParentEngine.LogMessage (
+ MessageImportance.Low,
+ "Using task {0} from {1}", Name, this.Type.AssemblyQualifiedName);
+
task.BuildEngine = new BuildEngine (parentTarget.Project.ParentEngine, parentTarget.Project,
parentTarget.TargetFile, 0, 0, ContinueOnError);
task_logger = new TaskLoggingHelper (task);
22 mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ChangeLog
View
@@ -1,3 +1,25 @@
+2010-04-03 Ankit Jain <jankit@novell.com>
+
+ * BuildEngine.cs: Implement IBuildEngine2 instead of
+ IBuildEngine.
+ * BuildTasks.cs: Use the new extension methods for logging.
+ (InitializeTask): Emit a message informing about the assembly
+ from which the task is being loaded. Emit a useful debug message
+ incase of a InvalidCastException.
+ * Engine.cs: Add missing methods, constructors and properties related
+ to ToolsVersion support. Setup a default set of Toolsets.
+ Keep separate taskdbs' per ToolsVersion. The common tasks
+ would come from different *.tasks file, and use different
+ task assemblies.
+ (DefaultToolsVersion): Correctly set this based on the profile.
+ * LogExtensions.cs: New. Extension methods on Engine, for logging.
+ * Project.cs: Add missing methods/contructors/properties related
+ to ToolsVersion support. Add reserved properties -
+ MSBuildToolsPath and MSBuildToolsVersion .
+ * Toolset.cs: New.
+ * ToolsetCollection.cs: New.
+ * ToolsetDefinitionLocations.cs: New.
+
2010-03-04 Ankit Jain <jankit@novell.com>
* BuildEngine.cs (LogErrorEvent): Log as warning, if
153 mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Engine.cs
View
@@ -40,16 +40,17 @@ public class Engine {
string binPath;
bool buildEnabled;
- TaskDatabase defaultTasks;
- bool defaultTasksRegistered;
+ Dictionary<string, TaskDatabase> defaultTasksTableByToolsVersion;
const string defaultTasksProjectName = "Microsoft.Common.tasks";
EventSource eventSource;
bool buildStarted;
+ ToolsetDefinitionLocations toolsetLocations;
BuildPropertyGroup global_properties;
//IDictionary importedProjects;
List <ILogger> loggers;
//bool onlyLogCriticalEvents;
Dictionary <string, Project> projects;
+ string defaultToolsVersion;
// the key here represents the project+target+global_properties set
Dictionary <string, ITaskItem[]> builtTargetsOutputByName;
@@ -68,6 +69,25 @@ public Engine ()
{
}
+ public Engine (ToolsetDefinitionLocations locations)
+ : this (ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version20))
+ {
+ toolsetLocations = locations;
+ }
+
+ public Engine (BuildPropertyGroup globalProperties)
+ : this (ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version20))
+ {
+ this.global_properties = globalProperties;
+ }
+
+ public Engine (BuildPropertyGroup globalProperties, ToolsetDefinitionLocations locations)
+ : this (ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version20))
+ {
+ this.global_properties = globalProperties;
+ toolsetLocations = locations;
+ }
+
// engine should be invoked with path where binary files are
// to find microsoft.build.tasks
public Engine (string binPath)
@@ -81,8 +101,25 @@ public Engine (string binPath)
this.global_properties = new BuildPropertyGroup ();
this.builtTargetsOutputByName = new Dictionary<string, ITaskItem[]> ();
this.currentlyBuildingProjectsStack = new Stack<Project> ();
-
- RegisterDefaultTasks ();
+ this.Toolsets = new ToolsetCollection ();
+ LoadDefaultToolsets ();
+ defaultTasksTableByToolsVersion = new Dictionary<string, TaskDatabase> ();
+ GetDefaultTasks (DefaultToolsVersion);
+ }
+
+ //FIXME: should be loaded from config file
+ void LoadDefaultToolsets ()
+ {
+ Toolsets.Add (new Toolset ("2.0",
+ ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version20)));
+ Toolsets.Add (new Toolset ("3.0",
+ ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version30)));
+ Toolsets.Add (new Toolset ("3.5",
+ ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version35)));
+#if NET_4_0
+ Toolsets.Add (new Toolset ("4.0",
+ ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version40)));
+#endif
}
[MonoTODO]
@@ -128,27 +165,31 @@ public bool BuildProject (Project project, string[] targetNames)
if (targetNames == null)
return false;
+ if (defaultToolsVersion != null)
+ // it has been explicitly set, xbuild does this..
+ project.ToolsVersion = defaultToolsVersion;
return project.Build (targetNames, targetOutputs, buildFlags);
}
[MonoTODO]
public bool BuildProjectFile (string projectFile)
{
- throw new NotImplementedException ();
+ return BuildProjectFile (projectFile, new string [0]);
}
[MonoTODO]
public bool BuildProjectFile (string projectFile,
string targetName)
{
- throw new NotImplementedException ();
+ return BuildProjectFile (projectFile,
+ targetName == null ? new string [0] : new string [] {targetName});
}
[MonoTODO]
public bool BuildProjectFile (string projectFile,
string[] targetNames)
{
- throw new NotImplementedException ();
+ return BuildProjectFile (projectFile, targetNames, null);
}
[MonoTODO]
@@ -174,6 +215,16 @@ public bool BuildProjectFile (string projectFile)
IDictionary targetOutputs,
BuildSettings buildFlags)
{
+ return BuildProjectFile (projectFile, targetNames, globalProperties, targetOutputs, buildFlags, null);
+ }
+
+ //FIXME: add a test for null @toolsVersion
+ public bool BuildProjectFile (string projectFile,
+ string[] targetNames,
+ BuildPropertyGroup globalProperties,
+ IDictionary targetOutputs,
+ BuildSettings buildFlags, string toolsVersion)
+ {
Project project;
if (projects.ContainsKey (projectFile)) {
@@ -197,6 +248,13 @@ public bool BuildProjectFile (string projectFile)
}
try {
+ if (String.IsNullOrEmpty (toolsVersion) && defaultToolsVersion != null)
+ // it has been explicitly set, xbuild does this..
+ //FIXME: should this be cleared after building?
+ project.ToolsVersion = defaultToolsVersion;
+ else
+ project.ToolsVersion = toolsVersion;
+
return project.Build (targetNames, targetOutputs, buildFlags);
} finally {
if (globalProperties != null) {
@@ -217,8 +275,6 @@ void CheckBinPath ()
public Project CreateNewProject ()
{
- if (defaultTasksRegistered)
- CheckBinPath ();
return new Project (this);
}
@@ -358,23 +414,44 @@ void LogBuildFinished (bool succeeded)
bfea = new BuildFinishedEventArgs ("Build finished.", null, succeeded);
eventSource.FireBuildFinished (this, bfea);
}
+
+ internal TaskDatabase GetDefaultTasks (string toolsVersion)
+ {
+ TaskDatabase db;
+ if (defaultTasksTableByToolsVersion.TryGetValue (toolsVersion, out db))
+ return db;
+
+ var toolset = Toolsets [toolsVersion];
+ if (toolset == null)
+ throw new Exception ("Unknown toolsversion: " + toolsVersion);
+
+ string toolsPath = toolset.ToolsPath;
+ string tasksFile = Path.Combine (toolsPath, defaultTasksProjectName);
+ this.LogMessage (MessageImportance.Low, "Loading default tasks for ToolsVersion: {0} from {1}", toolsVersion, tasksFile);
+
+ // set a empty taskdb here, because the project loading the tasks
+ // file will try to get the default task db
+ defaultTasksTableByToolsVersion [toolsVersion] = new TaskDatabase ();
+
+ db = defaultTasksTableByToolsVersion [toolsVersion] = RegisterDefaultTasks (tasksFile);
+
+ return db;
+ }
- void RegisterDefaultTasks ()
+ TaskDatabase RegisterDefaultTasks (string tasksFile)
{
- this.defaultTasksRegistered = false;
-
Project defaultTasksProject = CreateNewProject ();
+ TaskDatabase db;
- if (binPath != null) {
- if (File.Exists (Path.Combine (binPath, defaultTasksProjectName))) {
- defaultTasksProject.Load (Path.Combine (binPath, defaultTasksProjectName));
- defaultTasks = defaultTasksProject.TaskDatabase;
- } else
- defaultTasks = new TaskDatabase ();
- } else
- defaultTasks = new TaskDatabase ();
-
- this.defaultTasksRegistered = true;
+ if (File.Exists (tasksFile)) {
+ defaultTasksProject.Load (tasksFile);
+ db = defaultTasksProject.TaskDatabase;
+ } else {
+ this.LogWarning ("Default tasks file {0} not found, ignoring.", tasksFile);
+ db = new TaskDatabase ();
+ }
+
+ return db;
}
public string BinPath {
@@ -403,7 +480,31 @@ void RegisterDefaultTasks ()
get { return global_properties; }
set { global_properties = value; }
}
+
+ public ToolsetCollection Toolsets {
+ get; private set;
+ }
+ public string DefaultToolsVersion {
+ get {
+ if (String.IsNullOrEmpty (defaultToolsVersion))
+#if NET_4_0
+ return "4.0";
+#elif NET_3_5
+ return "3.5";
+#else
+ return "2.0";
+#endif
+
+ return defaultToolsVersion;
+ }
+ set { defaultToolsVersion = value; }
+ }
+
+ public bool IsBuilding {
+ get { return buildStarted; }
+ }
+
public bool OnlyLogCriticalEvents {
get { return eventSource.OnlyLogCriticalEvents; }
set { eventSource.OnlyLogCriticalEvents = value; }
@@ -413,14 +514,6 @@ void RegisterDefaultTasks ()
get { return eventSource; }
}
- internal bool DefaultTasksRegistered {
- get { return defaultTasksRegistered; }
- }
-
- internal TaskDatabase DefaultTasks {
- get { return defaultTasks; }
- }
-
internal Dictionary<string, ITaskItem[]> BuiltTargetsOutputByName {
get { return builtTargetsOutputByName; }
}
183 mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/LogExtensions.cs
View
@@ -0,0 +1,183 @@
+//
+// LogExtensions.cs: Extension methods for logging on Engine
+//
+// Author:
+// Ankit Jain (jankit@novell.com)
+//
+// Copyright 2010 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+#if NET_2_0
+
+using System;
+using System.IO;
+using System.Text;
+using Microsoft.Build.Framework;
+
+namespace Microsoft.Build.BuildEngine
+{
+ static class LogExtensions
+ {
+ public static string FormatString (string unformatted,
+ params object[] args)
+ {
+ if (unformatted == null)
+ throw new ArgumentNullException ("unformatted");
+
+ if (args == null || args.Length == 0)
+ return unformatted;
+ else
+ return String.Format (unformatted, args);
+ }
+
+ public static void LogError (this Engine engine, string message,
+ params object[] messageArgs)
+ {
+ if (message == null)
+ throw new ArgumentNullException ("message");
+
+ BuildErrorEventArgs beea = new BuildErrorEventArgs (
+ null, null, null, 0, 0, 0, 0, FormatString (message, messageArgs),
+ null, null);
+ engine.EventSource.FireErrorRaised (engine, beea);
+ }
+
+ public static void LogError (this Engine engine, string subcategory, string errorCode,
+ string helpKeyword, string file,
+ int lineNumber, int columnNumber,
+ int endLineNumber, int endColumnNumber,
+ string message,
+ params object[] messageArgs)
+ {
+ if (message == null)
+ throw new ArgumentNullException ("message");
+
+ BuildErrorEventArgs beea = new BuildErrorEventArgs (
+ subcategory, errorCode, file, lineNumber,
+ columnNumber, endLineNumber, endColumnNumber,
+ FormatString (message, messageArgs), helpKeyword /*it's helpKeyword*/,
+ null /*it's senderName*/);
+
+ engine.EventSource.FireErrorRaised (engine, beea);
+ }
+
+ public static void LogErrorFromException (this Engine engine, Exception e)
+ {
+ LogErrorFromException (engine, e, true);
+ }
+
+ public static void LogErrorFromException (this Engine engine, Exception e,
+ bool showStackTrace)
+ {
+ LogErrorFromException (engine, e, showStackTrace, true, String.Empty);
+ }
+
+ [MonoTODO ("Arguments @showDetail and @file are not honored")]
+ public static void LogErrorFromException (this Engine engine, Exception e,
+ bool showStackTrace, bool showDetail, string file)
+ {
+ if (e == null)
+ throw new ArgumentNullException ("e");
+
+ StringBuilder sb = new StringBuilder ();
+ sb.Append (e.Message);
+ if (showStackTrace == true)
+ sb.Append (e.StackTrace);
+ BuildErrorEventArgs beea = new BuildErrorEventArgs (
+ null, null, null, 0, 0, 0, 0, sb.ToString (),
+ e.HelpLink, e.Source);
+ engine.EventSource.FireErrorRaised (engine, beea);
+ }
+
+ public static void LogMessage (this Engine engine, string message,
+ params object[] messageArgs)
+ {
+ LogMessage (engine, MessageImportance.Normal, message, messageArgs);
+ }
+
+ public static void LogMessage (this Engine engine, MessageImportance importance,
+ string message,
+ params object[] messageArgs)
+ {
+ if (message == null)
+ throw new ArgumentNullException ("message");
+
+ LogMessageFromText (engine, FormatString (message, messageArgs), importance);
+ }
+
+ public static bool LogMessageFromText (this Engine engine, string lineOfText,
+ MessageImportance importance)
+ {
+ if (lineOfText == null)
+ throw new ArgumentNullException ("lineOfText");
+
+ BuildMessageEventArgs bmea = new BuildMessageEventArgs (
+ lineOfText, null,
+ null, importance);
+
+ engine.EventSource.FireMessageRaised (engine, bmea);
+
+ return true;
+ }
+
+ public static void LogWarning (this Engine engine, string message,
+ params object[] messageArgs)
+ {
+ // FIXME: what about all the parameters?
+ BuildWarningEventArgs bwea = new BuildWarningEventArgs (
+ null, null, null, 0, 0, 0, 0, FormatString (message, messageArgs),
+ null, null);
+ engine.EventSource.FireWarningRaised (engine, bwea);
+ }
+
+ public static void LogWarning (this Engine engine, string subcategory, string warningCode,
+ string helpKeyword, string file,
+ int lineNumber, int columnNumber,
+ int endLineNumber, int endColumnNumber,
+ string message,
+ params object[] messageArgs)
+ {
+ BuildWarningEventArgs bwea = new BuildWarningEventArgs (
+ subcategory, warningCode, file, lineNumber,
+ columnNumber, endLineNumber, endColumnNumber,
+ FormatString (message, messageArgs), helpKeyword, null);
+ engine.EventSource.FireWarningRaised (engine, bwea);
+ }
+
+ public static void LogWarningFromException (this Engine engine, Exception e)
+ {
+ LogWarningFromException (engine, e, false);
+ }
+
+ public static void LogWarningFromException (this Engine engine, Exception e,
+ bool showStackTrace)
+ {
+ StringBuilder sb = new StringBuilder ();
+ sb.Append (e.Message);
+ if (showStackTrace)
+ sb.Append (e.StackTrace);
+ LogWarning (engine, null, null, null, null, 0, 0, 0, 0,
+ sb.ToString (), null);
+ }
+ }
+}
+
+#endif
55 mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
View
@@ -89,9 +89,14 @@ public Project ()
{
}
- public Project (Engine engine)
+ public Project (Engine engine) : this (engine, null)
+ {
+ }
+
+ public Project (Engine engine, string toolsVersion)
{
parentEngine = engine;
+ ToolsVersion = toolsVersion;
buildEnabled = ParentEngine.BuildEnabled;
xmlDocument = new XmlDocument ();
@@ -116,6 +121,7 @@ public Project (Engine engine)
GlobalProperties.AddProperty (bp.Clone (true));
ProcessXml ();
+
}
[MonoTODO ("Not tested")]
@@ -793,8 +799,7 @@ void ProcessXml ()
last_item_group_containing = new Dictionary <string, BuildItemGroup> ();
taskDatabase = new TaskDatabase ();
- if (ParentEngine.DefaultTasksRegistered)
- taskDatabase.CopyTasks (ParentEngine.DefaultTasks);
+ taskDatabase.CopyTasks (ParentEngine.GetDefaultTasks (GetToolsVersionToUse ()));
initialTargets = new List<string> ();
defaultTargets = new string [0];
@@ -860,7 +865,7 @@ internal void ProcessElements (XmlElement rootElement, ImportedProject ip)
AddChoose (xe);
break;
default:
- throw new InvalidProjectFileException ("Invalid element in project file.");
+ throw new InvalidProjectFileException (String.Format ("Invalid element '{0}' in project file.", xe.Name));
}
}
}
@@ -928,7 +933,12 @@ void InitializeProperties ()
Path.GetFileNameWithoutExtension (fullFileName),
PropertyType.Reserved));
EvaluatedProperties.AddProperty (new BuildProperty ("MSBuildBinPath", parentEngine.BinPath, PropertyType.Reserved));
- EvaluatedProperties.AddProperty (new BuildProperty ("MSBuildToolsPath", parentEngine.BinPath, PropertyType.Reserved));
+ string toolsVersionToUse = GetToolsVersionToUse ();
+ string toolsPath = parentEngine.Toolsets [toolsVersionToUse].ToolsPath;
+ if (toolsPath == null)
+ throw new Exception ("Unknown toolsVersion: " + toolsVersionToUse);
+ EvaluatedProperties.AddProperty (new BuildProperty ("MSBuildToolsPath", toolsPath, PropertyType.Reserved));
+ EvaluatedProperties.AddProperty (new BuildProperty ("MSBuildToolsVersion", toolsVersionToUse, PropertyType.Reserved));
EvaluatedProperties.AddProperty (new BuildProperty ("MSBuildExtensionsPath", ExtensionsPath, PropertyType.Reserved));
EvaluatedProperties.AddProperty (new BuildProperty ("MSBuildProjectDefaultTargets", DefaultTargets, PropertyType.Reserved));
EvaluatedProperties.AddProperty (new BuildProperty ("OS", OS, PropertyType.Environment));
@@ -942,6 +952,18 @@ void InitializeProperties ()
EvaluatedProperties.AddProperty (new BuildProperty ("MSBuildProjectDirectory", projectDir, PropertyType.Reserved));
}
+
+ string GetToolsVersionToUse ()
+ {
+ if (String.IsNullOrEmpty (ToolsVersion)) {
+ if (HasToolsVersionAttribute)
+ return DefaultToolsVersion;
+ else
+ return parentEngine.DefaultToolsVersion;
+ } else {
+ return ToolsVersion;
+ }
+ }
void AddProjectExtensions (XmlElement xmlElement)
{
@@ -1316,6 +1338,29 @@ internal void LogWarning (string filename, string message, params object[] messa
get { return xmlDocument.InnerXml; }
}
+ // corresponds to the xml attribute
+ public string DefaultToolsVersion {
+ get {
+ if (xmlDocument != null)
+ return xmlDocument.DocumentElement.GetAttribute ("ToolsVersion");
+ return null;
+ }
+ set {
+ if (xmlDocument != null)
+ xmlDocument.DocumentElement.SetAttribute ("ToolsVersion", value);
+ }
+ }
+
+ public bool HasToolsVersionAttribute {
+ get {
+ return xmlDocument != null && xmlDocument.DocumentElement.HasAttribute ("ToolsVersion");
+ }
+ }
+
+ public string ToolsVersion {
+ get; internal set;
+ }
+
internal List<string> BuiltTargetKeys {
get { return builtTargetKeys; }
}
53 mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Toolset.cs
View
@@ -0,0 +1,53 @@
+//
+// Toolset.cs
+//
+// Author:
+// Ankit Jain (jankit@novell.com)
+//
+// Copyright 2010 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+#if NET_2_0
+using System;
+
+namespace Microsoft.Build.BuildEngine
+{
+ public class Toolset
+ {
+ public Toolset (string toolsVersion, string toolsPath, BuildPropertyGroup buildProperties)
+ {
+ ToolsVersion = toolsVersion;
+ ToolsPath = toolsPath;
+ BuildProperties = buildProperties;
+ }
+
+ public Toolset (string toolsVersion, string toolsPath)
+ : this (toolsVersion, toolsPath, null)
+ {
+ }
+
+ public BuildPropertyGroup BuildProperties { get; private set; }
+
+ public string ToolsVersion { get; private set; }
+ public string ToolsPath { get; private set; }
+ }
+}
+#endif
99 mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ToolsetCollection.cs
View
@@ -0,0 +1,99 @@
+//
+// ToolsetCollection.cs
+//
+// Author:
+// Ankit Jain (jankit@novell.com)
+//
+// Copyright 2010 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+#if NET_2_0
+
+using System;
+using System.Collections.Generic;
+using System.Collections;
+
+namespace Microsoft.Build.BuildEngine
+{
+
+ public class ToolsetCollection : ICollection<Toolset>, IEnumerable<Toolset>, IEnumerable
+ {
+ List<Toolset> toolsets;
+
+ internal ToolsetCollection ()
+ {
+ toolsets = new List<Toolset> ();
+ }
+
+ public int Count
+ {
+ get { return toolsets.Count; }
+ }
+
+ public bool IsReadOnly { get { return false; } }
+
+ public Toolset this [string toolsVersion]
+ {
+ get { return toolsets.Find (item => item.ToolsVersion == toolsVersion); }
+ }
+
+ public void Add (Toolset item)
+ {
+ toolsets.Add (item);
+ }
+
+ public void Clear ()
+ {
+ toolsets.Clear ();
+ }
+
+ public bool Contains (string toolsVersion)
+ {
+ return toolsets.Exists (item => item.ToolsVersion == toolsVersion);
+ }
+
+ public bool Contains (Toolset item)
+ {
+ return toolsets.Contains (item);
+ }
+
+ public void CopyTo (Toolset[] array, int arrayIndex)
+ {
+ toolsets.CopyTo (array, arrayIndex);
+ }
+
+ public IEnumerator<Toolset> GetEnumerator ()
+ {
+ return toolsets.GetEnumerator ();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return toolsets.GetEnumerator ();
+ }
+
+ public bool Remove (Toolset item)
+ {
+ return toolsets.Remove (item);
+ }
+ }
+}
+#endif
29 ....Build.Tasks/Test/Microsoft.Build.Tasks/Consts.cs → ...t.Build.BuildEngine/ToolsetDefinitionLocations.cs
View
@@ -1,10 +1,10 @@
//
-// Consts.cs
+// ToolsetDefinitionLocations.cs
//
// Author:
-// Marek Sieradzki (marek.sieradzki@gmail.com)
+// Ankit Jain (jankit@novell.com)
//
-// (C) 2006 Marek Sieradzki
+// Copyright 2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -25,22 +25,15 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-using System;
-using Microsoft.Build.Utilities;
+#if NET_2_0
-public static class Consts {
-
- static bool RunningOnMono ()
+namespace Microsoft.Build.BuildEngine
+{
+ public enum ToolsetDefinitionLocations
{
- return Type.GetType ("Mono.Runtime") != null;
- }
-
- public static string BinPath {
- get {
- if (RunningOnMono ())
- return "../../tools/xbuild/xbuild";
- else
- return ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version20);
- }
+ None,
+ ConfigurationFile,
+ Registry
}
}
+#endif
4 mcs/class/Microsoft.Build.Engine/Microsoft.Build.Engine.dll.sources
View
@@ -46,6 +46,7 @@ Microsoft.Build.BuildEngine/InternalLoggerException.cs
Microsoft.Build.BuildEngine/InvalidProjectFileException.cs
Microsoft.Build.BuildEngine/IReference.cs
Microsoft.Build.BuildEngine/ItemReference.cs
+Microsoft.Build.BuildEngine/LogExtensions.cs
Microsoft.Build.BuildEngine/MetadataReference.cs
Microsoft.Build.BuildEngine/Project.cs
Microsoft.Build.BuildEngine/ProjectLoadSettings.cs
@@ -56,6 +57,9 @@ Microsoft.Build.BuildEngine/Target.cs
Microsoft.Build.BuildEngine/TaskDatabase.cs
Microsoft.Build.BuildEngine/TaskEngine.cs
Microsoft.Build.BuildEngine/Token.cs
+Microsoft.Build.BuildEngine/Toolset.cs
+Microsoft.Build.BuildEngine/ToolsetCollection.cs
+Microsoft.Build.BuildEngine/ToolsetDefinitionLocations.cs
Microsoft.Build.BuildEngine/UsingTask.cs
Microsoft.Build.BuildEngine/UsingTaskCollection.cs
Microsoft.Build.BuildEngine/Utilities.cs
8 mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ChangeLog
View
@@ -1,3 +1,11 @@
+2010-04-06 Ankit Jain <jankit@novell.com>
+
+ * Consts.cs (ToolsVersionString): New.
+ (GetTasksAsmPath): New.
+ * EngineTest.cs: Use the direct path to the tasks assembly
+ in the UsingTasks.
+ * ProjectTest.cs: Set ToolsVersion to the current profile.
+
2010-02-19 Ankit Jain <jankit@novell.com>
* ImportTest.cs (TestMissingImport*): Add new tests for missing
24 mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/Consts.cs
View
@@ -26,6 +26,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
using System;
+using System.IO;
using Microsoft.Build.Utilities;
public static class Consts {
@@ -43,4 +44,27 @@ public static bool RunningOnMono ()
return ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version20);
}
}
+
+ public static string ToolsVersionString {
+ get {
+#if NET_4_0
+ return " ToolsVersion='4.0'";
+#elif NET_3_5
+ return " ToolsVersion='3.5'";
+#else
+ return String.Empty;
+#endif
+ }
+ }
+
+ public static string GetTasksAsmPath ()
+ {
+#if NET_4_0
+ return Path.Combine (ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version40), "Microsoft.Build.Tasks.v4.0.dll");
+#elif NET_3_5
+ return Path.Combine (ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version35), "Microsoft.Build.Tasks.v3.5.dll");
+#else
+ return Path.Combine (ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version20), "Microsoft.Build.Tasks.dll");
+#endif
+ }
}
111 mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/EngineTest.cs
View
@@ -324,8 +324,9 @@ public void TestBuildProjectNull2 ()
[Test]
public void TestGlobalProperties1 ()
{
- string mainProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
- <UsingTask TaskName=""Microsoft.Build.Tasks.MSBuild"" AssemblyName=""Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"" />
+ string mainProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">"
+ + GetUsingTask ("MSBuild")
+ + @"
<Target Name=""main"">
<MSBuild Projects=""first.proj"" Targets = ""1;2""/>
<Message Text=""second""/>
@@ -333,9 +334,9 @@ public void TestGlobalProperties1 ()
</Target>
</Project>";
- string firstProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
- <UsingTask TaskName=""Microsoft.Build.Tasks.MSBuild""
- AssemblyName=""Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"" />
+ string firstProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">"
+ + GetUsingTask ("MSBuild")
+ + @"
<Target Name = ""1"">
<MSBuild Projects=""second.proj"" Properties=""foo=bar""/>
<MSBuild Projects=""second.proj"" Targets = ""TargetB"" Properties=""foo=foofoo""/>
@@ -363,8 +364,9 @@ public void TestGlobalProperties1 ()
public void TestGlobalProperties1a ()
{
Directory.CreateDirectory ("Test/resources/foo");
- string mainProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
- <UsingTask TaskName=""Microsoft.Build.Tasks.MSBuild"" AssemblyName=""Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"" />
+ string mainProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">"
+ + GetUsingTask ("MSBuild")
+ + @"
<Target Name=""main"">
<MSBuild Projects=""first.proj"" Targets = ""1;2""/>
<Message Text=""second""/>
@@ -372,9 +374,9 @@ public void TestGlobalProperties1a ()
</Target>
</Project>";
- string firstProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
- <UsingTask TaskName=""Microsoft.Build.Tasks.MSBuild""
- AssemblyName=""Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"" />
+ string firstProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">"
+ + GetUsingTask ("MSBuild")
+ + @"
<Target Name = ""1"">
<MSBuild Projects=""second.proj"" Properties=""foo=bar""/>
<MSBuild Projects=""second.proj"" Targets = ""TargetB"" Properties=""foo=foofoo""/>
@@ -401,8 +403,9 @@ public void TestGlobalProperties1a ()
[Test]
public void TestGlobalProperties1b ()
{
- string mainProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
- <UsingTask TaskName=""Microsoft.Build.Tasks.MSBuild"" AssemblyName=""Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"" />
+ string mainProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">"
+ + GetUsingTask ("MSBuild")
+ + @"
<Target Name=""main"">
<MSBuild Projects=""first.proj"" Targets = ""1;2""/>
<Message Text=""second""/>
@@ -410,9 +413,9 @@ public void TestGlobalProperties1b ()
</Target>
</Project>";
- string firstProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
- <UsingTask TaskName=""Microsoft.Build.Tasks.MSBuild""
- AssemblyName=""Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"" />
+ string firstProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">"
+ + GetUsingTask ("MSBuild")
+ + @"
<Target Name = ""1"">
<MSBuild Projects=""second.proj"" Properties=""foo=bar""/>
<MSBuild Projects=""second.proj""/>
@@ -439,8 +442,9 @@ public void TestGlobalProperties1b ()
[Test]
public void TestGlobalProperties2 ()
{
- string mainProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
- <UsingTask TaskName=""Microsoft.Build.Tasks.MSBuild"" AssemblyName=""Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"" />
+ string mainProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">"
+ + GetUsingTask ("MSBuild")
+ + @"
<Target Name=""main"">
<MSBuild Projects=""first.proj"" Targets = ""1""/>
<MSBuild Projects=""first.proj"" Targets = ""2""/>
@@ -449,9 +453,9 @@ public void TestGlobalProperties2 ()
</Target>
</Project>";
- string firstProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
- <UsingTask TaskName=""Microsoft.Build.Tasks.MSBuild""
- AssemblyName=""Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"" />
+ string firstProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">"
+ + GetUsingTask ("MSBuild")
+ + @"
<Target Name = ""1"">
<MSBuild Projects=""second.proj"" Properties=""foo=bar""/>
<MSBuild Projects=""second.proj"" Targets = ""TargetB"" Properties=""foo=foofoo""/>
@@ -478,8 +482,9 @@ public void TestGlobalProperties2 ()
[Test]
public void TestGlobalProperties3 ()
{
- string mainProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
- <UsingTask TaskName=""Microsoft.Build.Tasks.MSBuild"" AssemblyName=""Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"" />
+ string mainProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">"
+ + GetUsingTask ("MSBuild")
+ + @"
<Target Name=""main"">
<MSBuild Projects=""first.proj"" Targets = ""1""/>
<CallTarget Targets=""Call2""/>
@@ -491,9 +496,9 @@ public void TestGlobalProperties3 ()
</Target>
</Project>";
- string firstProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
- <UsingTask TaskName=""Microsoft.Build.Tasks.MSBuild""
- AssemblyName=""Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"" />
+ string firstProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">"
+ + GetUsingTask ("MSBuild")
+ + @"
<Target Name = ""1"">
<MSBuild Projects=""second.proj"" Properties=""foo=bar""/>
<MSBuild Projects=""second.proj"" Targets = ""TargetB"" Properties=""foo=foofoo""/>
@@ -521,8 +526,9 @@ public void TestGlobalProperties3 ()
[Test]
public void TestGlobalProperties4 ()
{
- string mainProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
- <UsingTask TaskName=""Microsoft.Build.Tasks.MSBuild"" AssemblyName=""Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"" />
+ string mainProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">"
+ + GetUsingTask ("MSBuild")
+ + @"
<Target Name=""main"">
<MSBuild Projects=""first.proj"" Targets = ""1""/>
<CallTarget Targets=""Call2""/>
@@ -534,9 +540,9 @@ public void TestGlobalProperties4 ()
</Target>
</Project>";
- string firstProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
- <UsingTask TaskName=""Microsoft.Build.Tasks.MSBuild""
- AssemblyName=""Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"" />
+ string firstProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">"
+ + GetUsingTask ("MSBuild")
+ + @"
<Target Name = ""1"">
<MSBuild Projects=""second.proj"" Properties=""foo=bar""/>
<MSBuild Projects=""second.proj"" Targets = ""TargetB"" Properties=""foo=foofoo""/>
@@ -568,8 +574,9 @@ public void TestGlobalProperties4 ()
[Test]
public void TestGlobalProperties4a ()
{
- string mainProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
- <UsingTask TaskName=""Microsoft.Build.Tasks.MSBuild"" AssemblyName=""Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"" />
+ string mainProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">"
+ + GetUsingTask ("MSBuild")
+ + @"
<Target Name=""main"">
<MSBuild Projects=""first.proj"" Targets = ""1""/>
<CallTarget Targets=""Call2""/>
@@ -581,9 +588,9 @@ public void TestGlobalProperties4a ()
</Target>
</Project>";
- string firstProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
- <UsingTask TaskName=""Microsoft.Build.Tasks.MSBuild""
- AssemblyName=""Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"" />
+ string firstProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">"
+ + GetUsingTask ("MSBuild")
+ + @"
<Target Name = ""1"">
<MSBuild Projects=""second.proj"" Properties=""foo=bar""/>
<MSBuild Projects=""second.proj"" Targets = ""TargetB"" Properties=""foo=foofoo""/>
@@ -615,8 +622,9 @@ public void TestGlobalProperties4a ()
[Test]
public void TestGlobalProperties4b ()
{
- string mainProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
- <UsingTask TaskName=""Microsoft.Build.Tasks.MSBuild"" AssemblyName=""Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"" />
+ string mainProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">"
+ + GetUsingTask ("MSBuild")
+ + @"
<Target Name=""main"">
<MSBuild Projects=""first.proj"" Targets = ""1""/>
<CallTarget Targets=""Call2""/>
@@ -628,9 +636,9 @@ public void TestGlobalProperties4b ()
</Target>
</Project>";
- string firstProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
- <UsingTask TaskName=""Microsoft.Build.Tasks.MSBuild""
- AssemblyName=""Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"" />
+ string firstProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">"
+ + GetUsingTask ("MSBuild")
+ + @"
<Target Name = ""1"">
<MSBuild Projects=""second.proj"" Properties=""foo=bar""/>
<MSBuild Projects=""second.proj"" Targets = ""TargetB"" Properties=""foo=foofoo""/>
@@ -666,8 +674,9 @@ public void TestGlobalProperties4b ()
[Test]
public void TestGlobalProperties4c ()
{
- string mainProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
- <UsingTask TaskName=""Microsoft.Build.Tasks.MSBuild"" AssemblyName=""Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"" />
+ string mainProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">"
+ + GetUsingTask ("MSBuild")
+ + @"
<Target Name=""main"">
<MSBuild Projects=""first.proj"" Targets = ""1""/>
<CallTarget Targets=""Call2""/>
@@ -679,9 +688,9 @@ public void TestGlobalProperties4c ()
</Target>
</Project>";
- string firstProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
- <UsingTask TaskName=""Microsoft.Build.Tasks.MSBuild""
- AssemblyName=""Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"" />
+ string firstProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">"
+ + GetUsingTask ("MSBuild")
+ + @"
<Target Name = ""1"">
<MSBuild Projects=""second.proj"" Properties=""foo=bar""/>
<MSBuild Projects=""second.proj"" Targets = ""TargetB"" Properties=""foo=foofoo""/>
@@ -714,10 +723,9 @@ public void TestGlobalProperties4c ()
[Test]
public void TestMSBuildOutputs ()
{
- string mainProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
- <UsingTask TaskName=""Microsoft.Build.Tasks.MSBuild""
- AssemblyName=""Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"" />
-
+ string mainProject = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">"
+ + GetUsingTask ("MSBuild")
+ + @"
<ItemGroup>
<ProjectRef Include=""first.proj"">
<Prop3>value</Prop3>
@@ -889,6 +897,9 @@ void WriteGlobalPropertiesProjects (string mainProject, string firstProject, str
}
}
-
+ public static string GetUsingTask (string taskName)
+ {
+ return "<UsingTask TaskName='Microsoft.Build.Tasks." + taskName + "' AssemblyFile='" + Consts.GetTasksAsmPath () + "' />";
+ }
}
}
6 mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ProjectTest.cs
View
@@ -1779,7 +1779,7 @@ public void TestPropertiesFromImportedProjects ()
Engine engine = new Engine (Consts.BinPath);
Project project = engine.CreateNewProject ();
- string second = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" ToolsVersion=""3.5"">
+ string second = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" " + Consts.ToolsVersionString + @">
<PropertyGroup>
<Prop1>InitialVal</Prop1>
</PropertyGroup>
@@ -1797,7 +1797,7 @@ public void TestPropertiesFromImportedProjects ()
sw.Write (second);
}
- string third = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" ToolsVersion=""3.5"">
+ string third = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" " + Consts.ToolsVersionString + @">
<PropertyGroup>
<ThirdProp>Third Value</ThirdProp>
</PropertyGroup>
@@ -1972,7 +1972,7 @@ public void TestRequiredTask_TaskItemArray3 ()
[Test]
public void TestCaseSensitivityOfProjectElements ()
{
- string projectXml = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" ToolsVersion=""3.5"">
+ string projectXml = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" " + Consts.ToolsVersionString + @">
<ItemGroup>
<Abc Include=""foo"">
<MetaDaTA1>md1</MetaDaTA1>
15 mcs/class/Microsoft.Build.Engine/Test/test-config-file-net-3.5
View
@@ -0,0 +1,15 @@
+<?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>
15 mcs/class/Microsoft.Build.Engine/Test/test-config-file-net-4.0
View
@@ -0,0 +1,15 @@
+<?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>
7 mcs/class/Microsoft.Build.Framework/ChangeLog
View
@@ -1,3 +1,10 @@
+2010-04-03 Ankit Jain <jankit@novell.com>
+
+ * Makefile: Import tools/xbuild/xbuild_targets.make, which copies
+ the target and tasks file in the correct place, to allow running
+ tests with different toolsversion.
+ * Microsoft.Build.Framework.dll.sources: Add IBuildEngine2.cs .
+
2006-04-19 Marek Sieradzki <marek.sieradzki@gmail.com>
* Microsoft.Build.Framework.targets: Removed.
4 mcs/class/Microsoft.Build.Framework/Makefile
View
@@ -17,5 +17,9 @@ LIB_MCS_FLAGS = \
include ../../build/library.make
+export TESTING_MONO=a
+XBUILD_DIR=../../tools/xbuild
+include $(XBUILD_DIR)/xbuild_targets.make
+
EXTRA_DISTFILES = \
Mono.XBuild.Framework/AssemblyLoadInfo.cs
1  mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework.dll.sources
View
@@ -20,6 +20,7 @@ Microsoft.Build.Framework/CustomBuildEventHandler.cs
Microsoft.Build.Framework/ExternalProjectFinishedEventArgs.cs
Microsoft.Build.Framework/ExternalProjectStartedEventArgs.cs
Microsoft.Build.Framework/IBuildEngine.cs
+Microsoft.Build.Framework/IBuildEngine2.cs
Microsoft.Build.Framework/IEventSource.cs
Microsoft.Build.Framework/ILogger.cs
Microsoft.Build.Framework/ITask.cs
4 mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ChangeLog
View
@@ -1,3 +1,7 @@
+2010-04-03 Ankit Jain <jankit@novell.com>
+
+ * IBuildEngine2.cs: New.
+
2006-12-19 Marek Sieradzki <marek.sieradzi@gmail.com>
* LoggerException.cs: Changed serialization names.
59 mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/IBuildEngine2.cs
View
@@ -0,0 +1,59 @@
+//
+// IBuildEngine2.cs: Provides a way for task authors to use the functionality
+// of the MSBuild engine.
+//
+// Author:
+// Ankit Jain (jankit@novell.com)
+//
+// Copyright 2010 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+
+namespace Microsoft.Build.Framework
+{
+ public interface IBuildEngine2 : IBuildEngine
+ {
+ // Initiates a build of a project file. If the build is
+ // successful, the outputs (if any) of the specified targets
+ // are returned.
+ bool BuildProjectFile (string projectFileName,
+ string[] targetNames,
+ IDictionary globalProperties,
+ IDictionary targetOutputs, string toolsVersion);
+
+ bool BuildProjectFilesInParallel (string[] projectFileNames,
+ string [] targetNames,
+ IDictionary[] globalProperties,
+ IDictionary[] targetOutputsPerProject,
+ string[] toolsVersion,
+ bool useResultsCache,
+ bool unloadProjectsOnCompletion);
+
+ bool IsRunningMultipleNodes { get; }
+
+ }
+}
+
+#endif
11 mcs/class/Microsoft.Build.Tasks/ChangeLog
View
@@ -1,3 +1,14 @@
+2010-04-03 Ankit Jain <jankit@novell.com>
+
+ * Makefile: Import tools/xbuild/xbuild_targets.make, which copies
+ the target and tasks file in the correct place, to allow running
+ tests with different toolsversion. Copy the config file for the
+ test assembly. Clean the generated test.dll .
+ Use the correct target assembly name for 4.0 profile
+ (ms.build.tasks.v4.0.dll), and for Utilities assembly.
+ * Microsoft.Build.Tasks_test.dll.sources: Use Consts.cs from Engine
+ instead of maintaining a copy here.
+
2010-03-02 Ankit Jain <jankit@novell.com>
Fix tests.
32 mcs/class/Microsoft.Build.Tasks/Makefile
View
@@ -14,6 +14,10 @@ else
ifeq (3.5, $(FRAMEWORK_VERSION))
NAME_SUFFIX = .v3.5
+else
+ifeq (4.0, $(FRAMEWORK_VERSION))
+NAME_SUFFIX = .v4.0
+endif
endif
LIBRARY_NAME = Microsoft.Build.Tasks$(NAME_SUFFIX).dll
@@ -26,7 +30,7 @@ LIB_MCS_FLAGS = \
/r:System.Core.dll \
/r:System.Xml.dll \
/r:System.Windows.Forms.dll \
- /r:Microsoft.Build.Utilities.dll \
+ /r:Microsoft.Build.Utilities$(NAME_SUFFIX).dll \
/r:Microsoft.Build.Framework.dll \
/r:Microsoft.Build.Engine.dll
@@ -39,11 +43,35 @@ EXTRA_DISTFILES = \
Test/resources/test.cs \
Test/resources/Sample.cs \
Test/resources/Sample.vb \
- Test/resources/junk.txt
+ 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:
+ rm -f Test/resources/test.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
+XBUILD_DIR=../../tools/xbuild
+include $(XBUILD_DIR)/xbuild_targets.make
+
include ../../build/library.make
6 mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/ChangeLog
View
@@ -1,3 +1,9 @@
+2010-04-03 Ankit Jain <jankit@novell.com>
+
+ * Csc.cs: Use dmcs as the compiler for 4.0 profile.
+ * MSBuild.cs (ToolsVersion): New.
+ Use toolsVersion for building.
+
2010-02-10 Ankit Jain <jankit@novell.com>
* GenerateResource.cs (CompileResourceFile): Check File.Exists
4 mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Csc.cs
View
@@ -187,7 +187,11 @@ protected override HostObjectInitializationStatus InitializeHostObject ()
protected override string ToolName {
get {
+#if NET_4_0
+ return Utilities.RunningOnWindows ? "dmcs.bat" : "dmcs";
+#else
return Utilities.RunningOnWindows ? "gmcs.bat" : "gmcs";
+#endif
}
}
19 mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/MSBuild.cs
View
@@ -82,7 +82,14 @@ public override bool Execute ()
outputs = new Hashtable ();
try {
- result = BuildEngine.BuildProjectFile (filename, targets, global_properties, outputs);
+ // Order of precedence:
+ // %(Project.ToolsVersion) , ToolsVersion property
+ string tv = project.GetMetadata ("ToolsVersion");
+ if (String.IsNullOrEmpty (tv))
+ tv = ToolsVersion;
+ ThrowIfNotValidToolsVersion (tv);
+
+ result = BuildEngine2.BuildProjectFile (filename, targets, global_properties, outputs, tv);
} catch (InvalidProjectFileException e) {
Log.LogError ("Error building project {0}: {1}", filename, e.Message);
result = false;
@@ -127,6 +134,12 @@ public override bool Execute ()
return result;
}
+ void ThrowIfNotValidToolsVersion (string toolsVersion)
+ {
+ if (!String.IsNullOrEmpty (toolsVersion) && Engine.GlobalEngine.Toolsets [toolsVersion] == null)
+ throw new Exception (String.Format ("Unknown ToolsVersion : {0}", toolsVersion));
+ }
+
[Required]
public ITaskItem [] Projects {
get { return projects; }
@@ -170,6 +183,10 @@ public override bool Execute ()
set { buildInParallel = value; }
}
+ public string ToolsVersion {
+ get; set;
+ }
+
Dictionary<string, string> SplitPropertiesToDictionary ()
{
if (properties == null)
2  mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks_test.dll.sources
View
@@ -4,7 +4,7 @@ Microsoft.Build.Tasks/AssignProjectConfigurationTest.cs
Microsoft.Build.Tasks/AssignTargetPathTest.cs
Microsoft.Build.Tasks/CombinePathTest.cs
Microsoft.Build.Tasks/CopyTest.cs
-Microsoft.Build.Tasks/Consts.cs
+../../Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/Consts.cs
Microsoft.Build.Tasks/CreateCSharpManifestResourceNameTest.cs
Microsoft.Build.Tasks/CreateVisualBasicManifestResourceNameTest.cs
Microsoft.Build.Tasks/CreateItemTest.cs
8 mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/AssignProjectConfigurationTest.cs
View
@@ -136,7 +136,7 @@ string CreateProject (string[] guids, string[] project_ref_guids)
{
StringBuilder sb = new StringBuilder ();
sb.Append (@"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">");
- sb.Append ("\n<UsingTask TaskName=\"Microsoft.Build.Tasks.AssignProjectConfiguration\" AssemblyName=\"Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" />\n");
+ sb.Append ("\n" + GetUsingTask ("AssignProjectConfiguration"));
sb.AppendFormat (@"<PropertyGroup>{0}</PropertyGroup>", CreateSolutionConfigurationProperty (guids, "Release|AnyCPU"));
sb.Append (CreateProjectReferencesItemGroup (project_ref_guids));
@@ -179,5 +179,11 @@ string CreateProjectReferencesItemGroup (string[] guids)
sb.Append ("</ItemGroup>\n");
return sb.ToString ();
}
+
+ string GetUsingTask (string taskName)
+ {
+ return "<UsingTask TaskName='Microsoft.Build.Tasks." + taskName + "' AssemblyFile='" + Consts.GetTasksAsmPath () + "' />";
+ }
+
}
}
14 mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/ChangeLog
View
@@ -1,3 +1,17 @@
+2010-04-06 Ankit Jain <jankit@novell.com>
+
+ * Consts.cs: Remove.
+ * AssignProjectConfigurationTest.cs:
+ * CreateCSharpManifestResourceNameTest.cs:
+ * CreateVisualBasicManifestResourceNameTest.cs:
+ * CreateItemTest.cs:
+ * FindAppConfigFileTest.cs:
+ * RemoveDuplicatesTest.cs:
+ * TaskBatchingTest.cs:
+ * WriteLinesToFileTest.cs:
+ Set the ToolsVersion to match the profile. Use the
+ full path to the tasks assembly for UsingTasks.
+
2010-03-04 Ankit Jain <jankit@novell.com>
* AssignTargetPathTest.cs (CreateProjectString): Remove the
11 mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/CreateCSharpManifestResourceNameTest.cs
View
@@ -235,9 +235,9 @@ void CheckResourceNames (string [,] files, string [] names, string rootNamespace
Project project = engine.CreateNewProject ();
TestMessageLogger logger = new TestMessageLogger ();
engine.RegisterLogger (logger);
- Console.WriteLine (projectText);
project.LoadXml (projectText);
if (!project.Build ("1")) {
+ Console.WriteLine (projectText);
logger.DumpMessages ();
Assert.Fail ("Build failed");
}
@@ -283,11 +283,16 @@ string CreateProject (string [,] files, string rootNamespace)
sb.AppendFormat (" RootNamespace = \"{0}\"", rootNamespace);
sb.Append (">\n \t\t\t<Output TaskParameter=\"ManifestResourceNames\" ItemName=\"ResourceNames\" />\n");
sb.Append ("\t\t</CreateCSharpManifestResourceName>\n\t</Target>\n");
- sb.Append ("\t<UsingTask TaskName=\"Microsoft.Build.Tasks.CreateCSharpManifestResourceName\" " +
- "AssemblyName=\"Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\"/>\n");
+ sb.Append ("\t" + GetUsingTask ("CreateCSharpManifestResourceName"));
sb.Append ("</Project>");
return sb.ToString ();
}
+
+ string GetUsingTask (string taskName)
+ {
+ return "<UsingTask TaskName='Microsoft.Build.Tasks." + taskName + "' AssemblyFile='" + Consts.GetTasksAsmPath () + "' />";
+ }
+
}
}
4 mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/CreateItemTest.cs
View
@@ -252,6 +252,7 @@ public void TestVariableExpansion ()
}
+#if NET_3_5 || NET_4_0
[Test]
public void TestItemsWithWildcards () {
Engine engine = new Engine (Consts.BinPath);
@@ -274,7 +275,7 @@ public void TestVariableExpansion ()
};
string documentString = @"
- <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" ToolsVersion=""3.5"">
+ <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" " + Consts.ToolsVersionString + @">
<PropertyGroup>
<WC>dir\**\*.dll</WC>
<ExWC>*\x*.dll</ExWC>
@@ -318,6 +319,7 @@ public void TestVariableExpansion ()
Directory.Delete (basedir, true);
}
}
+#endif
void CreateDirectoriesAndFiles (string basedir, string[] dirs, string[] files) {
foreach (string dir in dirs)
11 mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/CreateVisualBasicManifestResourceNameTest.cs
View
@@ -235,9 +235,9 @@ void CheckResourceNames (string [,] files, string [] names, string rootNamespace
Project project = engine.CreateNewProject ();
TestMessageLogger logger = new TestMessageLogger ();
engine.RegisterLogger (logger);
- Console.WriteLine (projectText);
project.LoadXml (projectText);
if (!project.Build ("1")) {
+ Console.WriteLine (projectText);
logger.DumpMessages ();
Assert.Fail ("Build failed");
}
@@ -283,11 +283,16 @@ string CreateProject (string [,] files, string rootNamespace)
sb.AppendFormat (" RootNamespace = \"{0}\"", rootNamespace);
sb.Append (">\n \t\t\t<Output TaskParameter=\"ManifestResourceNames\" ItemName=\"ResourceNames\" />\n");
sb.Append ("\t\t</CreateVisualBasicManifestResourceName>\n\t</Target>\n");
- sb.Append ("\t<UsingTask TaskName=\"Microsoft.Build.Tasks.CreateVisualBasicManifestResourceName\" " +
- "AssemblyName=\"Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\"/>\n");
+ sb.Append ("\t" + GetUsingTask ("CreateVisualBasicManifestResourceName"));
sb.Append ("</Project>");
return sb.ToString ();
}
+
+ string GetUsingTask (string taskName)
+ {
+ return "<UsingTask TaskName='Microsoft.Build.Tasks." + taskName + "' AssemblyFile='" + Consts.GetTasksAsmPath () + "' />";
+ }
+
}
}
6 mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/FindAppConfigFileTest.cs
View
@@ -25,6 +25,8 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#if NET_3_5
+
using System;
using System.Collections;
using Microsoft.Build.BuildEngine;
@@ -85,7 +87,7 @@ public void TestExecution6 ()
void CheckOutput (string[] primary_list, string[] secondary_list, string expected) {
StringBuilder sb = new StringBuilder ();
- sb.Append (@"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" ToolsVersion=""3.5"">");
+ sb.Append (@"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" " + Consts.ToolsVersionString + ">");
sb.Append ("\t<ItemGroup>");
if (primary_list != null)
foreach (string s in primary_list)
@@ -124,4 +126,4 @@ public void TestExecution6 ()
}
}
}
-
+#endif
2  mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/RemoveDuplicatesTest.cs
View
@@ -44,7 +44,7 @@ public class RemoveDuplicatesTest
public void Test1 ()
{
string documentString = @"
- <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" ToolsVersion='3.5'>
+ <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" " + Consts.ToolsVersionString + @">
<ItemGroup>
<Items Include='A'>
22 mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/TaskBatchingTest.cs
View
@@ -40,6 +40,12 @@ namespace MonoTests.Microsoft.Build.Tasks
[TestFixture]
public class TaskBatchingTest
{
+ string projectHeader;
+ public TaskBatchingTest ()
+ {
+ projectHeader = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" " + Consts.ToolsVersionString + ">";
+ }
+
[Test]
public void Test1 ()
{
@@ -548,7 +554,7 @@ public void TestFilter ()
// batching should happen only on basis of the task attributes,
// and not the resolved expression values
public void TestBatching1 () {
- string projectString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" ToolsVersion=""3.5"">
+ string projectString = projectHeader + @"
<ItemGroup>
<item3 Include=""foo""/>
<item2 Include=""%(item3.Identity)""/>
@@ -584,7 +590,7 @@ public void TestFilter ()
// batching should happen only on basis of the task attributes,
// and not the resolved expression values
public void TestConditionalBatching2 () {
- string projectString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" ToolsVersion=""3.5"">
+ string projectString = projectHeader + @"
<ItemGroup>
<item2 Include=""%(item3.Identity)""/>
<item4 Include=""%(item2.Identity);@(item3)""/>
@@ -614,7 +620,7 @@ public void TestFilter ()
[Test]
public void TestBatchingWithUnbatchedItems () {
- string projectString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" ToolsVersion=""3.5"">
+ string projectString = projectHeader + @"
<ItemGroup>
<Item1 Include=""One""/>
<Item1 Include=""Two""/>
@@ -651,7 +657,7 @@ public void TestFilter ()
[Test]
public void TestPropertiesWithBatchedReferences () {
- string projectString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" ToolsVersion=""3.5"">
+ string projectString = projectHeader + @"
<ItemGroup>
<Item1 Include=""One""/>
<Item1 Include=""Two""/>
@@ -693,7 +699,7 @@ public void TestFilter ()
[Test]
public void TestPropertiesWithDynamicItems () {
- string projectString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" ToolsVersion=""3.5"">
+ string projectString = projectHeader + @"
<ItemGroup>
<Item1 Include=""One""/>
<Item1 Include=""Two""/>
@@ -748,7 +754,7 @@ public void TestFilter ()
[Test]
public void TestTargetInvocationFromBatchedTask () {
- string projectString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" ToolsVersion=""3.5"">
+ string projectString = projectHeader + @"
<ItemGroup>
<Item1 Include=""One""/>
<Item1 Include=""Two""/>
@@ -799,7 +805,7 @@ public void TestFilter ()
[Test]
public void TestTargetInvocationFromBatchedTarget () {
- string projectString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" ToolsVersion=""3.5"">
+ string projectString = projectHeader + @"
<ItemGroup>
<Item1 Include=""One""/>
<Item1 Include=""Two""/>
@@ -864,7 +870,7 @@ public void TestFilter ()
[Test]
public void TestBatchingWithUnqualifiedMetadataReference () {
- string projectString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" ToolsVersion=""3.5"">
+ string projectString = projectHeader + @"
<ItemGroup>
<Item1 Include=""One""><Md>1</Md></Item1>
<Item1 Include=""Two""><Md>2</Md></Item1>
2  mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/WriteLinesToFileTest.cs
View
@@ -159,7 +159,7 @@ void CreateProjectAndCheck (string file, string[] lines, bool overwrite, bool us
Project project;
StringBuilder sb = new StringBuilder ();
- sb.Append (@"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" ToolsVersion='3.5'>
+ sb.Append (@"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" " + Consts.ToolsVersionString + @">
<ItemGroup>
");
15 mcs/class/Microsoft.Build.Tasks/Test/test-config-file-net-3.5
View
@@ -0,0 +1,15 @@
+<?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>
15 mcs/class/Microsoft.Build.Tasks/Test/test-config-file-net-4.0
View
@@ -0,0 +1,15 @@
+<?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>
7 mcs/class/Microsoft.Build.Utilities/ChangeLog
View
@@ -1,3 +1,10 @@
+2010-04-03 Ankit Jain <jankit@novell.com>
+
+ * Makefile: Import tools/xbuild/xbuild_targets.make, which copies
+ the target and tasks file in the correct place, to allow running
+ tests with different toolsversion.
+ Use the correct target assembly name for 4.0 profile.
+
2010-02-10 Ankit Jain <jankit@novell.com>
* Microsoft.Build.Utilities.dll.sources: Add ProcessStringDictionary.cs
8 mcs/class/Microsoft.Build.Utilities/Makefile
View
@@ -12,6 +12,10 @@ endif
ifeq (3.5, $(FRAMEWORK_VERSION))
LIBRARY_NAME = Microsoft.Build.Utilities.v3.5.dll
+else
+ifeq (4.0, $(FRAMEWORK_VERSION))
+LIBRARY_NAME = Microsoft.Build.Utilities.v4.0.dll
+endif
endif
LIB_MCS_FLAGS = \
@@ -21,4 +25,8 @@ LIB_MCS_FLAGS = \
TEST_MCS_FLAGS = /r:Microsoft.Build.Framework.dll
+export TESTING_MONO=a
+XBUILD_DIR=../../tools/xbuild
+include $(XBUILD_DIR)/xbuild_targets.make
+
include ../../build/library.make
9 mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/ChangeLog
View
@@ -1,3 +1,12 @@
+2010-04-03 Ankit Jain <jankit@novell.com>
+
+ * TargetDotNetFrameworkVersion.cs: Add Version40 .
+ * Task.cs (BuildEngine2): New.
+ * ToolLocationHelper.cs: Use class/lib/net_* as the path
+ for the assemblies and targets when running tests.
+ Environment variable TESTING_MONO is set for testing.
+ This allows a 4.0 xbuild to build 2.0/3.5 projects.
+
2010-02-19 Ankit Jain <jankit@novell.com>
* TaskItem.cs: Track api changes.
5 mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/TargetDotNetFrameworkVersion.cs
View
@@ -37,7 +37,12 @@ public enum TargetDotNetFrameworkVersion
Version20,
Version30,
Version35,
+#if NET_4_0
+ Version40,
+ VersionLatest = Version40
+#else
VersionLatest = Version35
+#endif
}
}
4 mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/Task.cs
View
@@ -70,6 +70,10 @@ protected Task(ResourceManager taskResources)
}
}
+ public IBuildEngine2 BuildEngine2 {
+ get { return buildEngine as IBuildEngine2; }
+ }
+
protected string HelpKeywordPrefix {
get {
return helpKeywordPrefix;
23 mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/ToolLocationHelper.cs
View
@@ -50,13 +50,24 @@ static ToolLocationHelper ()
t2 = t1.Parent;
lib_mono_dir = t2.FullName;
+ if (Environment.GetEnvironmentVariable ("TESTING_MONO") != null) {
+ mono_dir = new string [] {
+ Path.Combine (lib_mono_dir, "net_1_0"),
+ Path.Combine (lib_mono_dir, "net_2_0"),
+ Path.Combine (lib_mono_dir, "net_2_0"),
+ Path.Combine (lib_mono_dir, "net_3_5"),
+ Path.Combine (lib_mono_dir, "net_4_0")
+ };
+ } else {
+ mono_dir = new string [] {
+ Path.Combine (lib_mono_dir, "1.0"),
+ Path.Combine (lib_mono_dir, "2.0"),
+ Path.Combine (lib_mono_dir, "2.0"),
+ Path.Combine (lib_mono_dir, "3.5"),
+ Path.Combine (lib_mono_dir, "4.0")
+ };
+ }
- mono_dir = new string [] {
- Path.Combine (lib_mono_dir, "1.0"),
- Path.Combine (lib_mono_dir, "2.0"),
- Path.Combine (lib_mono_dir, "2.0"),
- Path.Combine (lib_mono_dir, "3.5")
- };
}
[MonoTODO]
4 mcs/tools/ChangeLog
View
@@ -1,3 +1,7 @@
+2010-04-03 Ankit Jain <jankit@novell.com>
+
+ * Makefile: Move xbuild from net_4_0_dirs to per_profile_dirs.
+
2010-03-16 Jb Evain <jbevain@novell.com>
* Makefile: rename the net_2_1 profile to moonlight.
4 mcs/tools/Makefile
View
@@ -13,13 +13,13 @@ per_profile_dirs = \
mono-service \
mono-xsd \
resgen \
- wsdl
+ wsdl \
+ xbuild
net_4_0_dirs := \
$(per_profile_dirs) \
corcompare \
mono-xmltool \
- xbuild \
mdoc \
mono-shlib-cop \
sgen \
24 mcs/tools/xbuild/ChangeLog
View
@@ -1,3 +1,27 @@
+2010-04-03 Ankit Jain <jankit@novell.com>
+
+ * Main.cs (Execute): If toolsversion is specified on the command line,
+ then use that.
+ * Parameters.cs: Read toolsversion from the command line ('/tv:..') .
+ * SolutionParser.cs: Infer ToolsVersion from the sln version.
+ Set ToolsVersion property of the MSBuild tasks, in the generated
+ .sln.proj file, for building the projects.
+
+ * xbuild/Microsoft.Common.tasks: Move to ..
+ * xbuild/2.0/Microsoft.Common.tasks: .. here.
+ * xbuild/3.5/Microsoft.Common.tasks: New.
+ * xbuild/4.0/Microsoft.Common.tasks: New.
+ Use the corresponding 3.5/4.0 tasks assembly.
+