Skip to content

Commit

Permalink
Update xbuild and Microsoft.Build.* from trunk.
Browse files Browse the repository at this point in the history
In tools/xbuild:
2010-02-19  Ankit Jain  <jankit@novell.com>

	* SolutionParser.cs (GetAllProjectFileNames): New.
	* Parameters.cs (ParseArguments): When no project file is specified,
	if the cur dir has a single sln and >1 project files, and all the
	project files are referenced by the sln, the pick the sln.

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

	* GenerateResource.cs (CompileResourceFile): Check File.Exists
	for source file.
	Don't build if the target is newer than the source file.
	(Execute): Continue building all the resources, even if there
	are failures for some files.

2010-02-10  Ankit Jain  <jankit@novell.com>

	Fix bug #558739.
	* GenerateResource (Resgen): New. Internal task to run resgen
	with MONO_IOMAP=drive .
	(Execute): Use the new Resgen task to compile the resources.

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

	* ImportTest.cs (TestMissingImport*): Add new tests for missing
	import projects.

2010-02-11  Ankit Jain  <jankit@novell.com>

	* ImportTest.cs (Add1): Fix test on windows.

In class/Microsoft.Build.Engine/Test/various:
2010-02-19  Ankit Jain  <jankit@novell.com>

	* Items.cs (TestItemsWithWildcards): Check for RecursiveDir metadata also.

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

	* BuildItem.cs: Track api changes.
	(SetMetadata): Allow RecursiveDir to be set, this is set by
	DirectoryScanner.
	* DirectoryScanner.cs (ProcessInclude): Set RecursiveDir metadata.

2010-02-19  Ankit Jain  <jankit@novell.com>

	* Import.cs (Evaluate): Add param @ignoreMissingImports.
	* Project.cs (Load*): Add overloads with param @projectLoadSettings.
	(Log*): Mark internal.
	* ProjectLoadSettings.cs: New.

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

	* Microsoft.Build.Engine.dll.sources: Add ProjectLoadSettings.cs .

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

	* Microsoft.Build.Utilities.dll.sources: Add ProcessStringDictionary.cs
	from class/System/System.Collections.Specialized . This is required as
	the StringDictionary in ToolTask, used for EnvironmentOverrides, is
	inadequate, because environment vars are case sensitive on unix.

In class/Microsoft.Build.Utilities/Mono.XBuild.Utilities:
2010-02-19  Ankit Jain  <jankit@novell.com>

	* ReservedNameUtils.cs (GetReservedMetadata): Add dictionary param
	@metadata. Use this to check for existing value of "RecursiveDir"
	metadata, use that if present.

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

	* TaskItem.cs: Track api changes.

2010-02-10  Ankit Jain  <jankit@novell.com>

	* ProcessService.cs (globalEnvironmentVariablesOverride): Use
	ProcessStringDictionary instead of StringDictionary.
	ProcessStringDictionary retains the case of the keys (env vars
	here).
	* ToolTask.cs (environmentOverride): Likewise.

2010-02-10  Ankit Jain  <jankit@novell.com>

	* ToolTask.cs (ExecuteTool): Use the virtual method
	Standard*LoggingImportance, instead of the underlying field.
	(LogEventsFromTextOutput): Use @importance argument for LogMessage.
	(LogToolCommand): Remove MonoTODO.


svn path=/branches/mono-2-6/mcs/; revision=152128
  • Loading branch information
radical committed Feb 20, 2010
1 parent bc36966 commit 2b1392c
Show file tree
Hide file tree
Showing 25 changed files with 374 additions and 75 deletions.
4 changes: 4 additions & 0 deletions mcs/class/Microsoft.Build.Engine/ChangeLog
@@ -1,3 +1,7 @@
2010-02-19 Ankit Jain <jankit@novell.com>

* Microsoft.Build.Engine.dll.sources: Add ProjectLoadSettings.cs .

2010-01-21 Rodrigo B. de Oliveira <rodrigo@unity3d.com>

* Microsoft.Build.BuildEngine/BuildWhen.cs
Expand Down
Expand Up @@ -126,7 +126,7 @@ public BuildItem Clone ()
public string GetEvaluatedMetadata (string metadataName)
{
if (ReservedNameUtils.IsReservedMetadataName (metadataName)) {
string metadata = ReservedNameUtils.GetReservedMetadata (FinalItemSpec, metadataName);
string metadata = ReservedNameUtils.GetReservedMetadata (FinalItemSpec, metadataName, evaluatedMetadata);
return (metadataName.ToLower () == "fullpath") ? Utilities.Escape (metadata) : metadata;
}

Expand All @@ -139,7 +139,7 @@ public string GetEvaluatedMetadata (string metadataName)
public string GetMetadata (string metadataName)
{
if (ReservedNameUtils.IsReservedMetadataName (metadataName)) {
string metadata = ReservedNameUtils.GetReservedMetadata (FinalItemSpec, metadataName);
string metadata = ReservedNameUtils.GetReservedMetadata (FinalItemSpec, metadataName, unevaluatedMetadata);
return (metadataName.ToLower () == "fullpath") ? Utilities.Escape (metadata) : metadata;
} else if (unevaluatedMetadata.Contains (metadataName))
return (string) unevaluatedMetadata [metadataName];
Expand Down
@@ -1,3 +1,17 @@
2010-02-19 Ankit Jain <jankit@novell.com>

* BuildItem.cs: Track api changes.
(SetMetadata): Allow RecursiveDir to be set, this is set by
DirectoryScanner.
* DirectoryScanner.cs (ProcessInclude): Set RecursiveDir metadata.

2010-02-19 Ankit Jain <jankit@novell.com>

* Import.cs (Evaluate): Add param @ignoreMissingImports.
* Project.cs (Load*): Add overloads with param @projectLoadSettings.
(Log*): Mark internal.
* ProjectLoadSettings.cs: New.

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

Fix bug #576589.
Expand Down
Expand Up @@ -106,12 +106,18 @@ public void Scan ()
offset = 1;
}

string full_path = Path.GetFullPath (Path.Combine (Environment.CurrentDirectory, include_item.ItemSpec));
fileInfo = ParseIncludeExclude (separatedPath, offset, baseDirectory);

int wildcard_offset = full_path.IndexOf ("**");
foreach (FileInfo fi in fileInfo) {
if (!excludedItems.ContainsKey (fi.FullName)) {
TaskItem item = new TaskItem (include_item);
item.ItemSpec = fi.FullName;
string rec_dir = Path.GetDirectoryName (fi.FullName.Substring (wildcard_offset));
if (rec_dir.Length > 0)
rec_dir += Path.DirectorySeparatorChar;
item.SetMetadata ("RecursiveDir", rec_dir);
includedItems.Add (item);
}
}
Expand Down
Expand Up @@ -58,15 +58,20 @@ internal Import (XmlElement importElement, Project project, ImportedProject orig
}

// FIXME: condition
internal void Evaluate ()
internal void Evaluate (bool ignoreMissingImports)
{
string filename = evaluatedProjectPath;
// NOTE: it's a hack to transform Microsoft.CSharp.Targets to Microsoft.CSharp.targets
if (Path.HasExtension (filename))
filename = Path.ChangeExtension (filename, Path.GetExtension (filename));

if (!File.Exists (filename)) {
throw new InvalidProjectFileException (String.Format ("Imported project: \"{0}\" does not exist.", filename));
if (ignoreMissingImports) {
project.LogWarning (project.FullFileName, "Could not find project file {0}, to import. Ignoring.", filename);
return;
} else {
throw new InvalidProjectFileException (String.Format ("Imported project: \"{0}\" does not exist.", filename));
}
}

ImportedProject importedProject = new ImportedProject ();
Expand Down
Expand Up @@ -77,6 +77,7 @@ public class Project {
bool building;
BuildSettings current_settings;
Stack<Batch> batches;
ProjectLoadSettings project_load_settings;


static string extensions_path;
Expand All @@ -101,6 +102,8 @@ public Project (Engine engine)
fullFileName = String.Empty;
timeOfLastDirty = DateTime.Now;
current_settings = BuildSettings.None;
project_load_settings = ProjectLoadSettings.None;

encoding = null;

builtTargetKeys = new List<string> ();
Expand Down Expand Up @@ -422,6 +425,12 @@ public string GetProjectExtensions (string id)

public void Load (string projectFileName)
{
Load (projectFileName, ProjectLoadSettings.None);
}

public void Load (string projectFileName, ProjectLoadSettings settings)
{
project_load_settings = settings;
if (String.IsNullOrEmpty (projectFileName))
throw new ArgumentNullException ("projectFileName");

Expand Down Expand Up @@ -455,12 +464,24 @@ public void Load (string projectFileName)
[MonoTODO ("Not tested")]
public void Load (TextReader textReader)
{
Load (textReader, ProjectLoadSettings.None);
}

public void Load (TextReader textReader, ProjectLoadSettings projectLoadSettings)
{
project_load_settings = projectLoadSettings;
fullFileName = String.Empty;
DoLoad (textReader);
}

public void LoadXml (string projectXml)
{
LoadXml (projectXml, ProjectLoadSettings.None);
}

public void LoadXml (string projectXml, ProjectLoadSettings projectLoadSettings)
{
project_load_settings = projectLoadSettings;
fullFileName = String.Empty;
DoLoad (new StringReader (projectXml));
MarkProjectAsDirty ();
Expand Down Expand Up @@ -974,7 +995,7 @@ void AddImport (XmlElement xmlElement, ImportedProject importingProject)
}

Imports.Add (import);
import.Evaluate ();
import.Evaluate (project_load_settings == ProjectLoadSettings.IgnoreMissingImports);
}

void AddItemGroup (XmlElement xmlElement, ImportedProject importedProject)
Expand Down Expand Up @@ -1172,15 +1193,15 @@ T GetFirst<T> (ICollection<T> list)
return default (T);
}

void LogWarning (string filename, string message, params object[] messageArgs)
internal void LogWarning (string filename, string message, params object[] messageArgs)
{
BuildWarningEventArgs bwea = new BuildWarningEventArgs (
null, null, filename, 0, 0, 0, 0, String.Format (message, messageArgs),
null, null);
ParentEngine.EventSource.FireWarningRaised (this, bwea);
}

void LogError (string filename, string message,
internal void LogError (string filename, string message,
params object[] messageArgs)
{
BuildErrorEventArgs beea = new BuildErrorEventArgs (
Expand Down
@@ -0,0 +1,38 @@
//
// ProjectLoadSettings.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

namespace Microsoft.Build.BuildEngine {

public enum ProjectLoadSettings {
None,
IgnoreMissingImports
}
}

#endif
Expand Up @@ -48,6 +48,7 @@ Microsoft.Build.BuildEngine/IReference.cs
Microsoft.Build.BuildEngine/ItemReference.cs
Microsoft.Build.BuildEngine/MetadataReference.cs
Microsoft.Build.BuildEngine/Project.cs
Microsoft.Build.BuildEngine/ProjectLoadSettings.cs
Microsoft.Build.BuildEngine/PropertyPosition.cs
Microsoft.Build.BuildEngine/PropertyReference.cs
Microsoft.Build.BuildEngine/TargetCollection.cs
Expand Down
@@ -1,3 +1,12 @@
2010-02-19 Ankit Jain <jankit@novell.com>

* ImportTest.cs (TestMissingImport*): Add new tests for missing
import projects.

2010-02-11 Ankit Jain <jankit@novell.com>

* ImportTest.cs (Add1): Fix test on windows.

2010-01-21 Rodrigo B. de Oliveira <rodrigo@unity3d.com>

* BuildChooseTest.cs
Expand Down
Expand Up @@ -62,8 +62,8 @@ public void TestAdd1 ()

string documentString = @"
<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
<Import Project='Test/resources/first.proj'/>
<Import Project='Test/resources/Import.csproj' Condition='false'/>
<Import Project='Test\resources\first.proj'/>
<Import Project='Test\resources\Import.csproj' Condition='false'/>
</Project>
";

Expand All @@ -81,7 +81,7 @@ public void TestAdd1 ()
Assert.IsNull (t [0].Condition, "A1");

Assert.AreEqual (false, t[0].IsImported, "A5");
Assert.AreEqual ("Test/resources/first.proj", t[0].ProjectPath, "A6");
Assert.AreEqual ("Test\\resources\\first.proj", t[0].ProjectPath, "A6");
Assert.AreEqual (Path.Combine (base_dir, "first.proj"), t[0].EvaluatedProjectPath, "A7");

Assert.AreEqual (true, t[1].IsImported, "A2");
Expand Down Expand Up @@ -160,5 +160,54 @@ public void TestItems1 ()
Assert.IsTrue (groups [0].IsImported, "A1");
Assert.AreEqual (1, groups [0].Count, "A2");
}

[Test]
[ExpectedException (typeof (InvalidProjectFileException))]
public void TestMissingImport1 ()
{
string documentString = @"
<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
<Import Project='Test/resources/NonExistantProject.proj'/>
</Project>";

engine = new Engine (Consts.BinPath);

project = engine.CreateNewProject ();
project.LoadXml (documentString, ProjectLoadSettings.None);
}

[Test]
public void TestMissingImport2 ()
{
string documentString = @"
<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
<Import Project='Test/resources/NonExistantProject.proj'/>
</Project>
";

engine = new Engine (Consts.BinPath);

project = engine.CreateNewProject ();
project.LoadXml (documentString, ProjectLoadSettings.IgnoreMissingImports);

Assert.AreEqual (1, project.Imports.Count, "A1");
}

[Test]
[ExpectedException (typeof (InvalidProjectFileException))]
public void TestMissingImportDefault ()
{
string documentString = @"
<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
<Import Project='Test/resources/NonExistantProject.proj'/>
</Project>
";

engine = new Engine (Consts.BinPath);

project = engine.CreateNewProject ();
project.LoadXml (documentString);
}

}
}
4 changes: 4 additions & 0 deletions mcs/class/Microsoft.Build.Engine/Test/various/ChangeLog
@@ -1,3 +1,7 @@
2010-02-19 Ankit Jain <jankit@novell.com>

* Items.cs (TestItemsWithWildcards): Check for RecursiveDir metadata also.

2009-12-22 Ankit Jain <jankit@novell.com>

* Items.cs (TestItemsWithWildcards): Add Exclude also, update
Expand Down
34 changes: 25 additions & 9 deletions mcs/class/Microsoft.Build.Engine/Test/various/Items.cs
Expand Up @@ -865,6 +865,8 @@ public void TestItemsInTarget1 ()
CheckItems (proj, "I2", "A7", "A A", "B B", "C C");
}



[Test]
[Category ("NotWorking")]
public void TestItemsInTarget2 ()
Expand Down Expand Up @@ -1420,12 +1422,13 @@ public void TestItemsWithWildcards ()
<ItemGroup>
<ItemsRel Include='dir\**\*.dll' Exclude='*\x*.dll' />
<ItemsRelExpanded Include=""@(ItemsRel->'%(FullPath)')"" />
<ItemsAbs Include='$(MSBuildProjectDirectory)\dir\**\*.dll' Exclude='*\x*.dll' />
<ItemsAbs Include='$(MSBuildProjectDirectory)\dir\**\*.dll'/>
</ItemGroup>
<Target Name='Main'>
<Message Text=""ItemsRel: %(ItemsRel.FullPath) RecDir: %(ItemsRel.RecursiveDir)""/>
<Message Text=""ItemsRelExpanded: %(ItemsRelExpanded.Identity)""/>
<Message Text='ItemsAbs: %(ItemsAbs.Identity)'/>
<Message Text='ItemsAbs: %(ItemsAbs.Identity) RecDir: %(ItemsAbs.RecursiveDir)'/>
</Target>
</Project>";

Expand All @@ -1434,16 +1437,29 @@ public void TestItemsWithWildcards ()
string projectdir = Path.Combine ("Test", "resources");
File.WriteAllText (Path.Combine (projectdir, "wild1.proj"), documentString);
proj.Load (Path.Combine (projectdir, "wild1.proj"));
if (!proj.Build ("Main"))
if (!proj.Build ("Main")) {
logger.DumpMessages ();
Assert.Fail ("Build failed");

}
string full_base_dir = Path.GetFullPath (basedir);

foreach (string prefix in new string[] { "ItemsRelExpanded: ", "ItemsAbs: " }) {
logger.CheckLoggedAny (prefix + PathCombine (full_base_dir, aaa, "foo.dll"),
MessageImportance.Normal, "A1");
logger.CheckLoggedAny (prefix + PathCombine (full_base_dir, bb, "bar.dll"), MessageImportance.Normal, "A2");
}
logger.CheckLoggedAny (@"ItemsRel: "+ PathCombine (full_base_dir, aaa, "foo.dll") +
" RecDir: " + aaa + Path.DirectorySeparatorChar, MessageImportance.Normal, "A1");

logger.CheckLoggedAny (@"ItemsRel: " + PathCombine (full_base_dir, bb, "bar.dll") +
" RecDir: " + bb + Path.DirectorySeparatorChar, MessageImportance.Normal, "A2");

logger.CheckLoggedAny (@"ItemsRelExpanded: " + PathCombine (full_base_dir, aaa, "foo.dll"), MessageImportance.Normal, "A3");
logger.CheckLoggedAny (@"ItemsRelExpanded: " + PathCombine (full_base_dir, bb, "bar.dll"), MessageImportance.Normal, "A4");

logger.CheckLoggedAny (@"ItemsAbs: " + PathCombine (full_base_dir, aaa, "foo.dll") +
@" RecDir: " + aaa + Path.DirectorySeparatorChar, MessageImportance.Normal, "A5");
logger.CheckLoggedAny (@"ItemsAbs: " + PathCombine (full_base_dir, bb, "bar.dll") +
@" RecDir: " + bb + Path.DirectorySeparatorChar, MessageImportance.Normal, "A6");
logger.CheckLoggedAny (@"ItemsAbs: " + PathCombine (full_base_dir, "xyz.dll") +
@" RecDir: ", MessageImportance.Normal, "A7");

Assert.AreEqual (0, logger.NormalMessageCount, "Unexpected extra messages found");
} catch (AssertionException) {
logger.DumpMessages ();
throw;
Expand Down
15 changes: 15 additions & 0 deletions mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/ChangeLog
@@ -1,3 +1,18 @@
2010-02-10 Ankit Jain <jankit@novell.com>

* GenerateResource.cs (CompileResourceFile): Check File.Exists
for source file.
Don't build if the target is newer than the source file.
(Execute): Continue building all the resources, even if there
are failures for some files.

2010-02-10 Ankit Jain <jankit@novell.com>

Fix bug #558739.
* GenerateResource (Resgen): New. Internal task to run resgen
with MONO_IOMAP=drive .
(Execute): Use the new Resgen task to compile the resources.

2010-02-06 Ankit Jain <jankit@novell.com>

* LC.cs: New.
Expand Down

0 comments on commit 2b1392c

Please sign in to comment.