mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-18 03:51:19 -10:00
Compare commits
42
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43e34e9221 | ||
|
|
69154db126 | ||
|
|
1f7a1c183c | ||
|
|
beb7543392 | ||
|
|
d0dbad9ad7 | ||
|
|
4f8c33af39 | ||
|
|
90c46b9308 | ||
|
|
8082e15625 | ||
|
|
58864d7fca | ||
|
|
c79c91c80c | ||
|
|
8973515d9d | ||
|
|
9346c56300 | ||
|
|
5a4e4d261b | ||
|
|
259bc42379 | ||
|
|
9b28a1de73 | ||
|
|
1eb27e1f63 | ||
|
|
7edb572581 | ||
|
|
364a5d0b74 | ||
|
|
3aa9628276 | ||
|
|
bcc8b6fb2d | ||
|
|
eefca1d2f0 | ||
|
|
075b2246c4 | ||
|
|
70390d5989 | ||
|
|
08a3283160 | ||
|
|
f65e2f5bde | ||
|
|
89a11d5206 | ||
|
|
cd1791a956 | ||
|
|
06bce6170a | ||
|
|
6eb53dd31a | ||
|
|
329316a6c6 | ||
|
|
cb768e733f | ||
|
|
d1973e174d | ||
|
|
fd3fd2455f | ||
|
|
7944cbd726 | ||
|
|
ef0ea82263 | ||
|
|
2de8607599 | ||
|
|
ca5715e665 | ||
|
|
774fd03e78 | ||
|
|
8b8d58705b | ||
|
|
c5cbb9cb4b | ||
|
|
95ab6bc64d | ||
|
|
2403930b66 |
No files matched your search
@@ -1,3 +1,7 @@
|
||||
2009-09-29 Ankit Jain <[email protected]>
|
||||
|
||||
* mono-core.spec.in: Add Microsoft.WebApplication.targets
|
||||
|
||||
2009-08-29 Jonathan Pryor <[email protected]>
|
||||
|
||||
* man/mdoc-export-html.1: Document --with-profile, --with-version.
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ AC_CANONICAL_SYSTEM
|
||||
m4_ifdef([_A][M_PROG_TAR],[_A][M_SET_OPTION([tar-ustar])])
|
||||
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_INIT_AUTOMAKE(mono,2.5)
|
||||
AM_INIT_AUTOMAKE(mono,2.6)
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
API_VER=1.0
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
2009-09-26 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* test/queue.c: new tests.
|
||||
* src/gqueue.c: fixed pop_head.
|
||||
|
||||
2009-09-26 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* src/gqueue.c: add g_queue_push_tail.
|
||||
|
||||
2009-06-20 Zoltan Varga <[email protected]>
|
||||
|
||||
* src/glib.h: Add GUINT32_FROM/TO_BE macros.
|
||||
|
||||
@@ -469,6 +469,8 @@ typedef struct {
|
||||
gpointer g_queue_pop_head (GQueue *queue);
|
||||
void g_queue_push_head (GQueue *queue,
|
||||
gpointer data);
|
||||
void g_queue_push_tail (GQueue *queue,
|
||||
gpointer data);
|
||||
gboolean g_queue_is_empty (GQueue *queue);
|
||||
GQueue *g_queue_new (void);
|
||||
void g_queue_free (GQueue *queue);
|
||||
|
||||
+31
-15
@@ -3,6 +3,7 @@
|
||||
*
|
||||
* Author:
|
||||
* Duncan Mak ([email protected])
|
||||
* Gonzalo Paniagua Javier ([email protected])
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
@@ -23,7 +24,7 @@
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
* Copyright (c) 2006-2009 Novell, Inc.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -33,19 +34,23 @@
|
||||
gpointer
|
||||
g_queue_pop_head (GQueue *queue)
|
||||
{
|
||||
gpointer head = NULL;
|
||||
gpointer result;
|
||||
GList *old_head;
|
||||
|
||||
if (queue->length != 0){
|
||||
GList *old_head;
|
||||
if (!queue || queue->length == 0)
|
||||
return NULL;
|
||||
|
||||
old_head = queue->head;
|
||||
head = old_head->data;
|
||||
queue->head = old_head->next;
|
||||
queue->length--;
|
||||
g_list_free_1 (old_head);
|
||||
}
|
||||
result = queue->head->data;
|
||||
old_head = queue->head;
|
||||
queue->head = old_head->next;
|
||||
g_list_free_1 (old_head);
|
||||
|
||||
return head;
|
||||
if (--queue->length)
|
||||
queue->head->prev = NULL;
|
||||
else
|
||||
queue->tail = NULL;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
gboolean
|
||||
@@ -71,13 +76,24 @@ g_queue_push_head (GQueue *queue, gpointer head)
|
||||
queue->length ++;
|
||||
}
|
||||
|
||||
void
|
||||
g_queue_push_tail (GQueue *queue, gpointer data)
|
||||
{
|
||||
if (!queue)
|
||||
return;
|
||||
|
||||
queue->tail = g_list_append (queue->tail, data);
|
||||
if (queue->head == NULL)
|
||||
queue->head = queue->tail;
|
||||
else
|
||||
queue->tail = queue->tail->next;
|
||||
queue->length++;
|
||||
}
|
||||
|
||||
GQueue *
|
||||
g_queue_new (void)
|
||||
{
|
||||
GQueue *queue = g_new0 (GQueue, 1);
|
||||
queue->length = 0;
|
||||
|
||||
return queue;
|
||||
return g_new0 (GQueue, 1);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -15,6 +15,66 @@ test_queue_push ()
|
||||
if (queue->length != 3)
|
||||
return FAILED ("push failed");
|
||||
|
||||
if (NULL != queue->head->prev)
|
||||
return FAILED ("HEAD: prev is wrong");
|
||||
if (strcmp ("baz", queue->head->data))
|
||||
return FAILED ("HEAD: First element is wrong");
|
||||
if (strcmp ("bar", queue->head->next->data))
|
||||
return FAILED ("HEAD: Second element is wrong");
|
||||
if (strcmp ("foo", queue->head->next->next->data))
|
||||
return FAILED ("HEAD: Third element is wrong");
|
||||
if (NULL != queue->head->next->next->next)
|
||||
return FAILED ("HEAD: End is wrong");
|
||||
|
||||
if (NULL != queue->tail->next)
|
||||
return FAILED ("TAIL: next is wrong");
|
||||
if (strcmp ("foo", queue->tail->data))
|
||||
return FAILED ("TAIL: Third element is wrong");
|
||||
if (strcmp ("bar", queue->tail->prev->data))
|
||||
return FAILED ("TAIL: Second element is wrong");
|
||||
if (strcmp ("baz", queue->tail->prev->prev->data))
|
||||
return FAILED ("TAIL: First element is wrong");
|
||||
if (NULL != queue->tail->prev->prev->prev)
|
||||
return FAILED ("TAIL: End is wrong");
|
||||
|
||||
g_queue_free (queue);
|
||||
return OK;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_queue_push_tail ()
|
||||
{
|
||||
GQueue *queue = g_queue_new ();
|
||||
|
||||
g_queue_push_tail (queue, "baz");
|
||||
g_queue_push_tail (queue, "bar");
|
||||
g_queue_push_tail (queue, "foo");
|
||||
|
||||
if (queue->length != 3)
|
||||
return FAILED ("push failed");
|
||||
|
||||
if (NULL != queue->head->prev)
|
||||
return FAILED ("HEAD: prev is wrong");
|
||||
if (strcmp ("baz", queue->head->data))
|
||||
return FAILED ("HEAD: First element is wrong");
|
||||
if (strcmp ("bar", queue->head->next->data))
|
||||
return FAILED ("HEAD: Second element is wrong");
|
||||
if (strcmp ("foo", queue->head->next->next->data))
|
||||
return FAILED ("HEAD: Third element is wrong");
|
||||
if (NULL != queue->head->next->next->next)
|
||||
return FAILED ("HEAD: End is wrong");
|
||||
|
||||
if (NULL != queue->tail->next)
|
||||
return FAILED ("TAIL: next is wrong");
|
||||
if (strcmp ("foo", queue->tail->data))
|
||||
return FAILED ("TAIL: Third element is wrong");
|
||||
if (strcmp ("bar", queue->tail->prev->data))
|
||||
return FAILED ("TAIL: Second element is wrong");
|
||||
if (strcmp ("baz", queue->tail->prev->prev->data))
|
||||
return FAILED ("TAIL: First element is wrong");
|
||||
if (NULL != queue->tail->prev->prev->prev)
|
||||
return FAILED ("TAIL: End is wrong");
|
||||
|
||||
g_queue_free (queue);
|
||||
return OK;
|
||||
}
|
||||
@@ -47,6 +107,30 @@ test_queue_pop ()
|
||||
if (queue->length != 0)
|
||||
return FAILED ("expect 0 length .");
|
||||
|
||||
g_queue_push_head (queue, "foo");
|
||||
g_queue_push_head (queue, "bar");
|
||||
g_queue_push_head (queue, "baz");
|
||||
|
||||
g_queue_pop_head (queue);
|
||||
|
||||
if (NULL != queue->head->prev)
|
||||
return FAILED ("HEAD: prev is wrong");
|
||||
if (strcmp ("bar", queue->head->data))
|
||||
return FAILED ("HEAD: Second element is wrong");
|
||||
if (strcmp ("foo", queue->head->next->data))
|
||||
return FAILED ("HEAD: Third element is wrong");
|
||||
if (NULL != queue->head->next->next)
|
||||
return FAILED ("HEAD: End is wrong");
|
||||
|
||||
if (NULL != queue->tail->next)
|
||||
return FAILED ("TAIL: next is wrong");
|
||||
if (strcmp ("foo", queue->tail->data))
|
||||
return FAILED ("TAIL: Second element is wrong");
|
||||
if (strcmp ("bar", queue->tail->prev->data))
|
||||
return FAILED ("TAIL: First element is wrong");
|
||||
if (NULL != queue->tail->prev->prev)
|
||||
return FAILED ("TAIL: End is wrong");
|
||||
|
||||
g_queue_free (queue);
|
||||
return OK;
|
||||
}
|
||||
@@ -89,6 +173,7 @@ test_queue_is_empty ()
|
||||
|
||||
static Test queue_tests [] = {
|
||||
{ "push", test_queue_push},
|
||||
{"push_tail", test_queue_push_tail},
|
||||
{ "pop", test_queue_pop},
|
||||
{ "new", test_queue_new},
|
||||
{"is_empty", test_queue_is_empty},
|
||||
|
||||
@@ -44,6 +44,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
GroupingCollection parentCollection;
|
||||
Project parentProject;
|
||||
bool read_only;
|
||||
bool evaluated;
|
||||
|
||||
public BuildItemGroup ()
|
||||
: this (null, null, null, false)
|
||||
@@ -237,6 +238,8 @@ namespace Microsoft.Build.BuildEngine {
|
||||
|
||||
internal void Evaluate ()
|
||||
{
|
||||
if (evaluated)
|
||||
return;
|
||||
foreach (BuildItem bi in buildItems) {
|
||||
if (bi.Condition == String.Empty)
|
||||
bi.Evaluate (parentProject, true);
|
||||
@@ -245,6 +248,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
bi.Evaluate (parentProject, ce.BoolEvaluate (parentProject));
|
||||
}
|
||||
}
|
||||
evaluated = true;
|
||||
}
|
||||
|
||||
internal void ReplaceWith (BuildItem item, List <BuildItem> list)
|
||||
|
||||
@@ -44,6 +44,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
Project parentProject;
|
||||
List <BuildProperty> properties;
|
||||
Dictionary <string, BuildProperty> propertiesByName;
|
||||
bool evaluated;
|
||||
|
||||
public BuildPropertyGroup ()
|
||||
: this (null, null, null, false)
|
||||
@@ -221,9 +222,14 @@ namespace Microsoft.Build.BuildEngine {
|
||||
|
||||
internal void Evaluate ()
|
||||
{
|
||||
if (evaluated)
|
||||
return;
|
||||
|
||||
foreach (BuildProperty bp in properties)
|
||||
if (ConditionParser.ParseAndEvaluate (bp.Condition, parentProject))
|
||||
bp.Evaluate ();
|
||||
|
||||
evaluated = true;
|
||||
}
|
||||
|
||||
public string Condition {
|
||||
|
||||
@@ -1,3 +1,45 @@
|
||||
2009-09-29 Ankit Jain <[email protected]>
|
||||
|
||||
* GroupingCollection.cs (Evaluate): Mark internal.
|
||||
* Project.cs (AddImport): Only evaluate the properties,
|
||||
till before the import.
|
||||
|
||||
2009-09-29 Ankit Jain <[email protected]>
|
||||
|
||||
* Project.cs (DoLoad): Don't use XmlReader.Create, for loading
|
||||
the project xml, as returned Xml*Reader normalizes the newlines.
|
||||
Instead directly use the TextReader with XmlDocument.Load ().
|
||||
|
||||
2009-09-27 Ankit Jain <[email protected]>
|
||||
|
||||
* ConditionParser.cs: Show the condition being parsed in the
|
||||
exception message.
|
||||
|
||||
2009-09-26 Ankit Jain <[email protected]>
|
||||
|
||||
* Expression.cs: Allow '-' in item, property and metadata names.
|
||||
|
||||
2009-09-26 Ankit Jain <[email protected]>
|
||||
|
||||
* Project.cs (Evaluate): Split into this and ..
|
||||
(PrepareForEvaluate): .. this.
|
||||
(AddImport): Evaluate the current set of properties/items etc,
|
||||
before processing the imported project. Honor the Condition
|
||||
for the Import.
|
||||
(ProcessProjectAttributes): Update MSBuildProjectDefaultTargets
|
||||
property.
|
||||
* GroupingCollection.cs (Evaluate): Don't evaluate Imports here.
|
||||
* BuildItemGroup.cs (Evaluate): Evaluate only once.
|
||||
* BuildPropertyGroup.cs (Evaluate): Evaluate only once.
|
||||
|
||||
2009-09-26 Ankit Jain <[email protected]>
|
||||
|
||||
* Project.cs: Get InitialTargets from the imported projects also.
|
||||
The combined list of targets are executed, in the order they were
|
||||
found.
|
||||
DefaultTargets are also read in from imported projects, and the first
|
||||
non-empty DefaultTargets found is used.
|
||||
|
||||
2009-09-25 Ankit Jain <[email protected]>
|
||||
|
||||
* Project.cs (BuildTarget): Handle skipped targets.
|
||||
|
||||
@@ -39,11 +39,13 @@ namespace Microsoft.Build.BuildEngine {
|
||||
internal class ConditionParser {
|
||||
|
||||
ConditionTokenizer tokenizer;
|
||||
string conditionStr;
|
||||
|
||||
ConditionParser (string condition)
|
||||
{
|
||||
tokenizer = new ConditionTokenizer ();
|
||||
tokenizer.Tokenize (condition);
|
||||
conditionStr = condition;
|
||||
}
|
||||
|
||||
public static bool ParseAndEvaluate (string condition, Project context)
|
||||
@@ -171,7 +173,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
} else if (token.Type == TokenType.Not) {
|
||||
e = ParseNotExpression ();
|
||||
} else
|
||||
throw new ExpressionParseException (String.Format ("Unexpected token type {0}.", token.Type));
|
||||
throw new ExpressionParseException (String.Format ("Unexpected token type {0}, while parsing {1}", token.Type, conditionStr));
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -244,7 +246,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
{
|
||||
if (tokenizer.Token.Type != type)
|
||||
throw new ExpressionParseException ("Expected token type of type: " + type + ", got " +
|
||||
tokenizer.Token.Type + " (" + tokenizer.Token.Value + ") .");
|
||||
tokenizer.Token.Type + " (" + tokenizer.Token.Value + "), while parsing " + conditionStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,7 +299,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
if (item_regex == null)
|
||||
item_regex = new Regex (
|
||||
@"@\(\s*"
|
||||
+ @"(?<itemname>[_A-Za-z][_0-9a-zA-Z]*)"
|
||||
+ @"(?<itemname>[_A-Za-z][_\-0-9a-zA-Z]*)"
|
||||
+ @"(?<has_transform>\s*->\s*'(?<transform>[^']*)')?"
|
||||
+ @"(?<has_separator>\s*,\s*'(?<separator>[^']*)')?"
|
||||
+ @"\s*\)");
|
||||
@@ -312,7 +312,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
if (property_regex == null)
|
||||
property_regex = new Regex (
|
||||
@"\$\(\s*"
|
||||
+ @"(?<name>[_a-zA-Z][_0-9a-zA-Z]*)"
|
||||
+ @"(?<name>[_a-zA-Z][_\-0-9a-zA-Z]*)"
|
||||
+ @"\s*\)");
|
||||
return property_regex;
|
||||
}
|
||||
@@ -323,8 +323,8 @@ namespace Microsoft.Build.BuildEngine {
|
||||
if (metadata_regex == null)
|
||||
metadata_regex = new Regex (
|
||||
@"%\(\s*"
|
||||
+ @"((?<name>[_a-zA-Z][_0-9a-zA-Z]*)\.)?"
|
||||
+ @"(?<meta>[_a-zA-Z][_0-9a-zA-Z]*)"
|
||||
+ @"((?<name>[_a-zA-Z][_\-0-9a-zA-Z]*)\.)?"
|
||||
+ @"(?<meta>[_a-zA-Z][_\-0-9a-zA-Z]*)"
|
||||
+ @"\s*\)");
|
||||
return metadata_regex;
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
Evaluate (EvaluationType.Choose);
|
||||
}
|
||||
|
||||
void Evaluate (EvaluationType type)
|
||||
internal void Evaluate (EvaluationType type)
|
||||
{
|
||||
BuildItemGroup big;
|
||||
BuildPropertyGroup bpg;
|
||||
@@ -183,10 +183,6 @@ namespace Microsoft.Build.BuildEngine {
|
||||
bpg = (BuildPropertyGroup) evaluate_iterator.Value;
|
||||
if (ConditionParser.ParseAndEvaluate (bpg.Condition, project))
|
||||
bpg.Evaluate ();
|
||||
} else if (evaluate_iterator.Value is Import) {
|
||||
import = (Import) evaluate_iterator.Value;
|
||||
if (ConditionParser.ParseAndEvaluate (import.Condition, project))
|
||||
import.Evaluate ();
|
||||
}
|
||||
|
||||
// if it wasn't moved by adding anything because of evaluating a Import shift it
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
bool isValidated;
|
||||
BuildItemGroupCollection itemGroups;
|
||||
ImportCollection imports;
|
||||
string[] initialTargets;
|
||||
List<string> initialTargets;
|
||||
Dictionary <string, BuildItemGroup> last_item_group_containing;
|
||||
bool needToReevaluate;
|
||||
Engine parentEngine;
|
||||
@@ -101,6 +101,8 @@ namespace Microsoft.Build.BuildEngine {
|
||||
current_settings = BuildSettings.None;
|
||||
|
||||
builtTargetKeys = new List<string> ();
|
||||
initialTargets = new List<string> ();
|
||||
defaultTargets = new string [0];
|
||||
|
||||
globalProperties = new BuildPropertyGroup (null, this, null, false);
|
||||
foreach (BuildProperty bp in parentEngine.GlobalProperties)
|
||||
@@ -298,7 +300,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!initialTargetsBuilt && initialTargets != null && initialTargets.Length > 0) {
|
||||
if (!initialTargetsBuilt) {
|
||||
foreach (string target in initialTargets) {
|
||||
if (!BuildTarget (target.Trim (), targetOutputs))
|
||||
return false;
|
||||
@@ -707,16 +709,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
try {
|
||||
ParentEngine.RemoveLoadedProject (this);
|
||||
|
||||
XmlReaderSettings settings = new XmlReaderSettings ();
|
||||
|
||||
if (SchemaFile != null) {
|
||||
settings.Schemas.Add (null, SchemaFile);
|
||||
settings.ValidationType = ValidationType.Schema;
|
||||
settings.ValidationEventHandler += new ValidationEventHandler (ValidationCallBack);
|
||||
}
|
||||
|
||||
XmlReader xmlReader = XmlReader.Create (textReader, settings);
|
||||
xmlDocument.Load (xmlReader);
|
||||
xmlDocument.Load (textReader);
|
||||
|
||||
if (xmlDocument.DocumentElement.Name == "VisualStudioProject")
|
||||
throw new InvalidProjectFileException (String.Format (
|
||||
@@ -724,6 +717,12 @@ namespace Microsoft.Build.BuildEngine {
|
||||
"supported by xbuild. You need to convert it to msbuild " +
|
||||
"format to build with xbuild.", fullFileName));
|
||||
|
||||
if (SchemaFile != null) {
|
||||
xmlDocument.Schemas.Add (XmlSchema.Read (
|
||||
new StreamReader (SchemaFile), ValidationCallBack));
|
||||
xmlDocument.Validate (ValidationCallBack);
|
||||
}
|
||||
|
||||
if (xmlDocument.DocumentElement.Name != "Project") {
|
||||
throw new InvalidProjectFileException (String.Format (
|
||||
"The element <{0}> is unrecognized, or not supported in this context.", xmlDocument.DocumentElement.Name));
|
||||
@@ -766,12 +765,9 @@ namespace Microsoft.Build.BuildEngine {
|
||||
if (ParentEngine.DefaultTasksRegistered)
|
||||
taskDatabase.CopyTasks (ParentEngine.DefaultTasks);
|
||||
|
||||
if (xmlDocument.DocumentElement.GetAttributeNode ("DefaultTargets") != null)
|
||||
defaultTargets = xmlDocument.DocumentElement.GetAttribute ("DefaultTargets").Split (';');
|
||||
else
|
||||
defaultTargets = new string [0];
|
||||
|
||||
ProcessProjectAttributes (xmlDocument.DocumentElement.Attributes);
|
||||
initialTargets = new List<string> ();
|
||||
defaultTargets = new string [0];
|
||||
PrepareForEvaluate ();
|
||||
ProcessElements (xmlDocument.DocumentElement, null);
|
||||
|
||||
isDirty = false;
|
||||
@@ -783,12 +779,17 @@ namespace Microsoft.Build.BuildEngine {
|
||||
foreach (XmlAttribute attr in attributes) {
|
||||
switch (attr.Name) {
|
||||
case "InitialTargets":
|
||||
initialTargets = attr.Value.Split (new char [] {';'},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
initialTargets.AddRange (attr.Value.Split (
|
||||
new char [] {';', ' '},
|
||||
StringSplitOptions.RemoveEmptyEntries));
|
||||
break;
|
||||
case "DefaultTargets":
|
||||
defaultTargets = attr.Value.Split (new char [] {';'},
|
||||
// first non-empty DefaultTargets found is used
|
||||
if (defaultTargets == null || defaultTargets.Length == 0)
|
||||
defaultTargets = attr.Value.Split (new char [] {';', ' '},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
EvaluatedProperties.AddProperty (new BuildProperty ("MSBuildProjectDefaultTargets",
|
||||
DefaultTargets, PropertyType.Reserved));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -796,6 +797,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
|
||||
internal void ProcessElements (XmlElement rootElement, ImportedProject ip)
|
||||
{
|
||||
ProcessProjectAttributes (rootElement.Attributes);
|
||||
foreach (XmlNode xn in rootElement.ChildNodes) {
|
||||
if (xn is XmlElement) {
|
||||
XmlElement xe = (XmlElement) xn;
|
||||
@@ -833,7 +835,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
}
|
||||
}
|
||||
|
||||
void Evaluate ()
|
||||
void PrepareForEvaluate ()
|
||||
{
|
||||
evaluatedItems = new BuildItemGroup (null, this, null, true);
|
||||
evaluatedItemsIgnoringCondition = new BuildItemGroup (null, this, null, true);
|
||||
@@ -843,7 +845,10 @@ namespace Microsoft.Build.BuildEngine {
|
||||
RemoveBuiltTargets ();
|
||||
|
||||
InitializeProperties ();
|
||||
}
|
||||
|
||||
void Evaluate ()
|
||||
{
|
||||
groupingCollection.Evaluate ();
|
||||
|
||||
//FIXME: UsingTasks aren't really evaluated. (shouldn't use expressions or anything)
|
||||
@@ -933,10 +938,14 @@ namespace Microsoft.Build.BuildEngine {
|
||||
|
||||
void AddImport (XmlElement xmlElement, ImportedProject importingProject)
|
||||
{
|
||||
Import import;
|
||||
|
||||
import = new Import (xmlElement, this, importingProject);
|
||||
// eval all the properties etc till the import
|
||||
groupingCollection.Evaluate (EvaluationType.Property);
|
||||
|
||||
Import import = new Import (xmlElement, this, importingProject);
|
||||
Imports.Add (import);
|
||||
|
||||
if (ConditionParser.ParseAndEvaluate (import.Condition, this))
|
||||
import.Evaluate ();
|
||||
}
|
||||
|
||||
void AddItemGroup (XmlElement xmlElement, ImportedProject importedProject)
|
||||
@@ -978,11 +987,13 @@ namespace Microsoft.Build.BuildEngine {
|
||||
|
||||
public string DefaultTargets {
|
||||
get {
|
||||
return xmlDocument.DocumentElement.GetAttribute ("DefaultTargets");
|
||||
return String.Join ("; ", defaultTargets);
|
||||
}
|
||||
set {
|
||||
xmlDocument.DocumentElement.SetAttribute ("DefaultTargets", value);
|
||||
defaultTargets = value.Split (new char [] {';'}, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (value != null)
|
||||
defaultTargets = value.Split (new char [] {';', ' '},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1177,11 +1188,14 @@ namespace Microsoft.Build.BuildEngine {
|
||||
|
||||
public string InitialTargets {
|
||||
get {
|
||||
return xmlDocument.DocumentElement.GetAttribute ("InitialTargets");
|
||||
return String.Join ("; ", initialTargets.ToArray ());
|
||||
}
|
||||
set {
|
||||
initialTargets.Clear ();
|
||||
xmlDocument.DocumentElement.SetAttribute ("InitialTargets", value);
|
||||
initialTargets = value.Split (new char [] {';'}, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (value != null)
|
||||
initialTargets.AddRange (value.Split (
|
||||
new char [] {';', ' '}, StringSplitOptions.RemoveEmptyEntries));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
2009-09-29 Ankit Jain <[email protected]>
|
||||
|
||||
* ProjectTest.cs (TestPropertiesFromImportedProjects): New.
|
||||
|
||||
2009-09-26 Ankit Jain <[email protected]>
|
||||
|
||||
* TargetTest.cs (TestOverridingTargets): New.
|
||||
|
||||
2009-09-26 Ankit Jain <[email protected]>
|
||||
|
||||
* ProjectTest.cs (TestInitialTargetsWithImports):
|
||||
(TestDefaultTargets):
|
||||
(TestDefaultTargetsWithImports):
|
||||
(TestNoDefaultTargetsWithImports):
|
||||
(TestNoDefaultTargets): New tests.
|
||||
|
||||
2009-08-29 Ankit Jain <[email protected]>
|
||||
|
||||
* BuildItemTest.cs (TestSetMetadata5a): New.
|
||||
|
||||
@@ -1514,15 +1514,282 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
try {
|
||||
Assert.IsTrue (project.Build (), "Build failed");
|
||||
|
||||
Assert.AreEqual (0, logger.CheckHead ("Executing pre target", MessageImportance.Normal), "A1");
|
||||
Assert.AreEqual (0, logger.CheckHead ("Executing boo target", MessageImportance.Normal), "A2");
|
||||
Assert.AreEqual (0, logger.Count, "A3");
|
||||
logger.CheckLoggedMessageHead ("Executing pre target", "A1");
|
||||
logger.CheckLoggedMessageHead ("Executing boo target", "A2");
|
||||
|
||||
Assert.AreEqual (0, logger.NormalMessageCount, "Unexpected extra messages found");
|
||||
} catch {
|
||||
logger.DumpMessages ();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestInitialTargetsWithImports () {
|
||||
Engine engine = new Engine (Consts.BinPath);
|
||||
Project project = engine.CreateNewProject ();
|
||||
|
||||
string second = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" InitialTargets=""One "">
|
||||
<Target Name=""One"">
|
||||
<Message Text='Executing Second::One target'/>
|
||||
</Target>
|
||||
<Import Project='third.proj'/>
|
||||
</Project>
|
||||
";
|
||||
using (StreamWriter sw = new StreamWriter (Path.Combine ("Test", Path.Combine ("resources", "second.proj")))) {
|
||||
sw.Write (second);
|
||||
}
|
||||
|
||||
string third = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" InitialTargets=""Two"">
|
||||
<Target Name=""Two"">
|
||||
<Message Text='Executing Third::Two target'/>
|
||||
</Target>
|
||||
</Project>
|
||||
";
|
||||
using (StreamWriter sw = new StreamWriter (Path.Combine ("Test", Path.Combine ("resources", "third.proj")))) {
|
||||
sw.Write (third);
|
||||
}
|
||||
|
||||
project.LoadXml (@"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" InitialTargets=""pre"">
|
||||
<Target Name=""boo"">
|
||||
<Message Text=""Executing boo target""/>
|
||||
</Target>
|
||||
<Target Name=""pre"">
|
||||
<Message Text=""Executing pre target""/>
|
||||
</Target>
|
||||
<Import Project='Test/resources/second.proj'/>
|
||||
</Project>");
|
||||
|
||||
MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
|
||||
new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
|
||||
engine.RegisterLogger (logger);
|
||||
|
||||
try {
|
||||
Assert.IsTrue (project.Build (), "Build failed");
|
||||
|
||||
logger.CheckLoggedMessageHead ("Executing pre target", "A1");
|
||||
logger.CheckLoggedMessageHead ("Executing Second::One target", "A2");
|
||||
logger.CheckLoggedMessageHead ("Executing Third::Two target", "A3");
|
||||
logger.CheckLoggedMessageHead ("Executing boo target", "A4");
|
||||
Assert.AreEqual (0, logger.NormalMessageCount, "Unexpected extra messages found");
|
||||
|
||||
Assert.AreEqual ("pre; One; Two", project.InitialTargets, "List of initial targets");
|
||||
} catch {
|
||||
logger.DumpMessages ();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDefaultTargets () {
|
||||
Engine engine = new Engine (Consts.BinPath);
|
||||
Project project = engine.CreateNewProject ();
|
||||
|
||||
project.LoadXml (@"<Project DefaultTargets='pre' xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" >
|
||||
<Target Name=""boo"">
|
||||
<Message Text=""Executing boo target""/>
|
||||
</Target>
|
||||
<Target Name=""pre"">
|
||||
<Message Text=""Executing pre target""/>
|
||||
</Target>
|
||||
</Project>");
|
||||
|
||||
MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
|
||||
new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
|
||||
engine.RegisterLogger (logger);
|
||||
|
||||
try {
|
||||
Assert.IsTrue (project.Build (), "Build failed");
|
||||
|
||||
logger.CheckLoggedMessageHead ("Executing pre target", "A1");
|
||||
Assert.AreEqual (0, logger.NormalMessageCount, "Unexpected extra messages found");
|
||||
|
||||
Assert.AreEqual ("pre", project.DefaultTargets, "Default targets");
|
||||
} catch {
|
||||
logger.DumpMessages ();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void TestDefaultTargetsWithImports () {
|
||||
Engine engine = new Engine (Consts.BinPath);
|
||||
Project project = engine.CreateNewProject ();
|
||||
|
||||
string second = @"<Project DefaultTargets='One' xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
|
||||
<Target Name=""One"">
|
||||
<Message Text='Executing Second::One target'/>
|
||||
</Target>
|
||||
</Project>";
|
||||
using (StreamWriter sw = new StreamWriter (Path.Combine ("Test", Path.Combine ("resources", "second.proj")))) {
|
||||
sw.Write (second);
|
||||
}
|
||||
|
||||
project.LoadXml (@"<Project DefaultTargets='pre' xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" >
|
||||
<Target Name=""boo"">
|
||||
<Message Text=""Executing boo target""/>
|
||||
</Target>
|
||||
<Target Name=""pre"">
|
||||
<Message Text=""Executing pre target""/>
|
||||
</Target>
|
||||
<Import Project='Test/resources/second.proj'/>
|
||||
</Project>");
|
||||
|
||||
MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
|
||||
new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
|
||||
engine.RegisterLogger (logger);
|
||||
|
||||
try {
|
||||
Assert.IsTrue (project.Build (), "Build failed");
|
||||
|
||||
logger.CheckLoggedMessageHead ("Executing pre target", "A1");
|
||||
Assert.AreEqual (0, logger.NormalMessageCount, "Unexpected extra messages found");
|
||||
|
||||
Assert.AreEqual ("pre", project.DefaultTargets, "Default targets");
|
||||
} catch {
|
||||
logger.DumpMessages ();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestNoDefaultTargetsWithImports () {
|
||||
Engine engine = new Engine (Consts.BinPath);
|
||||
Project project = engine.CreateNewProject ();
|
||||
|
||||
|
||||
string second = @"<Project DefaultTargets='; One ; Two' xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
|
||||
<Target Name=""One"">
|
||||
<Message Text='Executing Second::One target'/>
|
||||
</Target>
|
||||
<Target Name=""Two"">
|
||||
<Message Text='Executing Second::Two target'/>
|
||||
</Target>
|
||||
|
||||
</Project>";
|
||||
using (StreamWriter sw = new StreamWriter (Path.Combine ("Test", Path.Combine ("resources", "second.proj")))) {
|
||||
sw.Write (second);
|
||||
}
|
||||
|
||||
project.LoadXml (@"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" >
|
||||
<Target Name=""boo"">
|
||||
<Message Text=""Executing boo target""/>
|
||||
</Target>
|
||||
<Target Name=""pre"">
|
||||
<Message Text=""Executing pre target""/>
|
||||
</Target>
|
||||
<Import Project='Test/resources/second.proj'/>
|
||||
</Project>");
|
||||
|
||||
MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
|
||||
new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
|
||||
engine.RegisterLogger (logger);
|
||||
|
||||
try {
|
||||
Assert.IsTrue (project.Build (), "Build failed");
|
||||
|
||||
logger.CheckLoggedMessageHead ("Executing Second::One target", "A1");
|
||||
logger.CheckLoggedMessageHead ("Executing Second::Two target", "A2");
|
||||
Assert.AreEqual (0, logger.NormalMessageCount, "Unexpected extra messages found");
|
||||
|
||||
Assert.AreEqual ("One; Two", project.DefaultTargets, "Default targets");
|
||||
} catch {
|
||||
logger.DumpMessages ();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestNoDefaultTargets () {
|
||||
Engine engine = new Engine (Consts.BinPath);
|
||||
Project project = engine.CreateNewProject ();
|
||||
|
||||
project.LoadXml (@"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" >
|
||||
<Target Name=""boo"">
|
||||
<Message Text=""Executing boo target""/>
|
||||
</Target>
|
||||
<Target Name=""pre"">
|
||||
<Message Text=""Executing pre target""/>
|
||||
</Target>
|
||||
</Project>");
|
||||
|
||||
MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
|
||||
new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
|
||||
engine.RegisterLogger (logger);
|
||||
|
||||
try {
|
||||
Assert.IsTrue (project.Build (), "Build failed");
|
||||
|
||||
logger.CheckLoggedMessageHead ("Executing boo target", "A1");
|
||||
Assert.AreEqual (0, logger.NormalMessageCount, "Unexpected extra messages found");
|
||||
|
||||
Assert.AreEqual ("", project.DefaultTargets, "Default targets");
|
||||
} catch {
|
||||
logger.DumpMessages ();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
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"">
|
||||
<PropertyGroup>
|
||||
<Prop1>InitialVal</Prop1>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Second Include=""$(ThirdProp):Third""/>
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name=""Main"">
|
||||
<Message Text=""Prop1: $(Prop1) FooItem: @(FooItem)""/>
|
||||
<Message Text=""Second: @(Second) ThirdProp: $(ThirdProp)""/>
|
||||
</Target>
|
||||
<Import Project=""third.proj""/>
|
||||
</Project>";
|
||||
using (StreamWriter sw = new StreamWriter (Path.Combine ("Test", Path.Combine ("resources", "second.proj")))) {
|
||||
sw.Write (second);
|
||||
}
|
||||
|
||||
string third = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" ToolsVersion=""3.5"">
|
||||
<PropertyGroup>
|
||||
<ThirdProp>Third Value</ThirdProp>
|
||||
</PropertyGroup>
|
||||
</Project>";
|
||||
using (StreamWriter sw = new StreamWriter (Path.Combine ("Test", Path.Combine ("resources", "third.proj")))) {
|
||||
sw.Write (third);
|
||||
}
|
||||
|
||||
project.LoadXml (@"<Project InitialTargets=""Main"" xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
|
||||
<ItemGroup>
|
||||
<FooItem Include=""$(Prop1):Something""/>
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project=""Test/resources/second.proj""/>
|
||||
</Project>");
|
||||
|
||||
MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
|
||||
new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
|
||||
engine.RegisterLogger (logger);
|
||||
|
||||
try {
|
||||
Assert.IsTrue (project.Build (), "Build failed");
|
||||
|
||||
logger.CheckLoggedMessageHead ("Prop1: InitialVal FooItem: InitialVal:Something", "A1");
|
||||
logger.CheckLoggedMessageHead ("Second: Third Value:Third ThirdProp: Third Value", "A2");
|
||||
|
||||
Assert.AreEqual (0, logger.NormalMessageCount, "Unexpected extra messages found");
|
||||
} catch {
|
||||
logger.DumpMessages ();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void TestRequiredTask_String1 ()
|
||||
{
|
||||
|
||||
@@ -31,6 +31,7 @@ using Microsoft.Build.BuildEngine;
|
||||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
using NUnit.Framework;
|
||||
using System.IO;
|
||||
|
||||
namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
[TestFixture]
|
||||
@@ -370,5 +371,54 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestOverridingTargets ()
|
||||
{
|
||||
Engine engine;
|
||||
Project project;
|
||||
|
||||
string second = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
|
||||
<Target Name='BeforeBuild'/>
|
||||
<Target Name='AfterBuild'/>
|
||||
<Target Name='Build' DependsOnTargets='BeforeBuild'>
|
||||
<Message Text='Build executing'/>
|
||||
<CallTarget Targets='AfterBuild'/>
|
||||
</Target>
|
||||
</Project>";
|
||||
using (StreamWriter sw = new StreamWriter (Path.Combine ("Test", Path.Combine ("resources", "second.proj")))) {
|
||||
sw.Write (second);
|
||||
}
|
||||
|
||||
string documentString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
|
||||
<Target Name='AfterBuild'>
|
||||
<Message Text='Overriding AfterBuild'/>
|
||||
</Target>
|
||||
|
||||
<Import Project='Test/resources/second.proj'/>
|
||||
<Target Name='BeforeBuild'>
|
||||
<Message Text='Overriding BeforeBuild'/>
|
||||
</Target>
|
||||
</Project>";
|
||||
|
||||
engine = new Engine (Consts.BinPath);
|
||||
project = engine.CreateNewProject ();
|
||||
project.LoadXml (documentString);
|
||||
|
||||
MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
|
||||
new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
|
||||
engine.RegisterLogger (logger);
|
||||
|
||||
bool result = project.Build ("Build");
|
||||
if (!result) {
|
||||
logger.DumpMessages ();
|
||||
Assert.Fail ("Build failed");
|
||||
}
|
||||
|
||||
logger.CheckLoggedMessageHead ("Overriding BeforeBuild", "A1");
|
||||
logger.CheckLoggedMessageHead ("Build executing", "A1");
|
||||
|
||||
Assert.AreEqual (0, logger.NormalMessageCount, "Unexpected extra messages found");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,16 @@
|
||||
2009-09-29 Ankit Jain <[email protected]>
|
||||
|
||||
* Exec.cs: Write the commands, which can be multiline,
|
||||
to a temporary file, and execute that with "cmd.exe /c"
|
||||
on windows and "sh" on non-windows.
|
||||
(LogToolCommand): Override, and emit the commands instead
|
||||
of the actual args passed to the shell.
|
||||
|
||||
2009-09-28 Ankit Jain <[email protected]>
|
||||
|
||||
* WriteLinesToFiles.cs (Execute): Handle empty list of
|
||||
lines.
|
||||
|
||||
2009-09-25 Ankit Jain <[email protected]>
|
||||
|
||||
* FindAppConfigFile.cs: New.
|
||||
|
||||
@@ -48,6 +48,7 @@ namespace Microsoft.Build.Tasks {
|
||||
string stdErrEncoding;
|
||||
string stdOutEncoding;
|
||||
string workingDirectory;
|
||||
string scriptFile;
|
||||
|
||||
public Exec ()
|
||||
{
|
||||
@@ -56,11 +57,15 @@ namespace Microsoft.Build.Tasks {
|
||||
|
||||
protected internal override void AddCommandLineCommands (CommandLineBuilderExtension commandLine)
|
||||
{
|
||||
if (IsRunningOnWindows)
|
||||
commandLine.AppendSwitch ("/c");
|
||||
|
||||
if (!String.IsNullOrEmpty (command)) {
|
||||
string[] commandTable = command.Split (null, 2);
|
||||
string arguments = String.Empty;
|
||||
if (commandTable.Length == 2)
|
||||
commandLine.AppendSwitch (commandTable [1]);
|
||||
scriptFile = Path.GetTempFileName ();
|
||||
using (StreamWriter sw = new StreamWriter (scriptFile)) {
|
||||
sw.Write (command);
|
||||
}
|
||||
commandLine.AppendFileNameIfNotNull (scriptFile);
|
||||
}
|
||||
base.AddCommandLineCommands (commandLine);
|
||||
}
|
||||
@@ -69,13 +74,18 @@ namespace Microsoft.Build.Tasks {
|
||||
string responseFileCommands,
|
||||
string commandLineCommands)
|
||||
{
|
||||
return base.ExecuteTool (pathToTool, responseFileCommands, commandLineCommands);
|
||||
try {
|
||||
return base.ExecuteTool (pathToTool, responseFileCommands, commandLineCommands);
|
||||
} finally {
|
||||
if (scriptFile != null)
|
||||
File.Delete (scriptFile);
|
||||
}
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
protected override string GenerateFullPathToTool ()
|
||||
{
|
||||
return command.Split (null, 2) [0];
|
||||
return IsRunningOnWindows ? "cmd.exe" : "sh";
|
||||
}
|
||||
|
||||
protected override string GetWorkingDirectory ()
|
||||
@@ -97,6 +107,7 @@ namespace Microsoft.Build.Tasks {
|
||||
[MonoTODO]
|
||||
protected override void LogToolCommand (string message)
|
||||
{
|
||||
Log.LogMessage (MessageImportance.Normal, "Executing: " + command);
|
||||
}
|
||||
|
||||
protected override void LogEventsFromTextOutput (string singleLine, MessageImportance importance)
|
||||
@@ -166,6 +177,14 @@ namespace Microsoft.Build.Tasks {
|
||||
get { return workingDirectory; }
|
||||
set { workingDirectory = value; }
|
||||
}
|
||||
|
||||
static bool IsRunningOnWindows {
|
||||
get {
|
||||
PlatformID pid = Environment.OSVersion.Platform;
|
||||
return ((int) pid != 128 && (int) pid != 4 && (int) pid != 6);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,9 +50,9 @@ namespace Microsoft.Build.Tasks {
|
||||
{
|
||||
try {
|
||||
streamWriter = new StreamWriter (file.GetMetadata ("FullPath"), !overwrite);
|
||||
foreach (ITaskItem line in lines) {
|
||||
streamWriter.WriteLine (line);
|
||||
}
|
||||
if (lines != null)
|
||||
foreach (ITaskItem line in lines)
|
||||
streamWriter.WriteLine (line);
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
2009-09-29 Ankit Jain <[email protected]>
|
||||
|
||||
* ToolTask.cs (ExecuteTool): Use LogToolCommand, instead of
|
||||
directly logging.
|
||||
(LogToolCommand): Implement.
|
||||
|
||||
2009-09-28 Ankit Jain <[email protected]>
|
||||
|
||||
* ToolTask.cs (ProcessOuputTool): Move logging of tool
|
||||
output from here to ..
|
||||
(ExecuteTool): .. here. As, ProcessOuputTool can be
|
||||
overridden.
|
||||
|
||||
2009-09-24 Ankit Jain <[email protected]>
|
||||
|
||||
* ToolTask.cs (HasLoggedErrors): Add missing property.
|
||||
|
||||
@@ -138,8 +138,8 @@ namespace Microsoft.Build.Utilities
|
||||
arguments = arguments + " " + GetResponseFileSwitch (responseFileName);
|
||||
}
|
||||
|
||||
Log.LogMessage (MessageImportance.Normal, "Tool {0} execution started with arguments: {1} {2}",
|
||||
pathToTool, commandLineCommands, responseFileCommands);
|
||||
LogToolCommand (String.Format ("Tool {0} execution started with arguments: {1} {2}",
|
||||
pathToTool, commandLineCommands, responseFileCommands));
|
||||
|
||||
output = Path.GetTempFileName ();
|
||||
error = Path.GetTempFileName ();
|
||||
@@ -210,6 +210,7 @@ namespace Microsoft.Build.Utilities
|
||||
Log.LogError (output_str);
|
||||
}
|
||||
|
||||
toolOutput.AppendLine (line);
|
||||
LogEventsFromTextOutput (line, importance);
|
||||
}
|
||||
}
|
||||
@@ -217,8 +218,6 @@ namespace Microsoft.Build.Utilities
|
||||
|
||||
protected virtual void LogEventsFromTextOutput (string singleLine, MessageImportance importance)
|
||||
{
|
||||
toolOutput.AppendLine (singleLine);
|
||||
|
||||
singleLine = singleLine.Trim ();
|
||||
if (singleLine.Length == 0)
|
||||
return;
|
||||
@@ -346,6 +345,7 @@ namespace Microsoft.Build.Utilities
|
||||
[MonoTODO]
|
||||
protected virtual void LogToolCommand (string message)
|
||||
{
|
||||
Log.LogMessage (MessageImportance.Normal, message);
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2009-09-26 Veerapuram Varadhan <[email protected]>
|
||||
|
||||
** Fixes part of #427769 - Patch by John Lenz <[email protected]>
|
||||
* DataSet.cs: XML serialization improvements to be compatible with MS impl.
|
||||
|
||||
2009-09-15 Veerapuram Varadhan <[email protected]>
|
||||
|
||||
** Fixes #536194 - Patch by Andrew Kurochk <[email protected]>
|
||||
|
||||
@@ -95,6 +95,17 @@ namespace System.Data
|
||||
protected DataSet (SerializationInfo info, StreamingContext context)
|
||||
: this ()
|
||||
{
|
||||
#if NET_2_0
|
||||
if (IsBinarySerialized (info, context)) {
|
||||
BinaryDeserialize (info);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
string s = info.GetValue ("XmlSchema", typeof (String)) as String;
|
||||
XmlTextReader reader = new XmlTextReader (new StringReader (s));
|
||||
ReadXmlSchema (reader);
|
||||
reader.Close ();
|
||||
|
||||
GetSerializationData (info, context);
|
||||
}
|
||||
|
||||
@@ -1132,6 +1143,7 @@ namespace System.Data
|
||||
{
|
||||
#if NET_2_0
|
||||
if (RemotingFormat == SerializationFormat.Xml) {
|
||||
info.AddValue ("SchemaSerializationMode.DataSet", this.SchemaSerializationMode);
|
||||
#endif
|
||||
StringWriter sw = new StringWriter ();
|
||||
XmlTextWriter writer = new XmlTextWriter (sw);
|
||||
@@ -1155,19 +1167,8 @@ namespace System.Data
|
||||
#region Protected Methods
|
||||
protected void GetSerializationData (SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
#if NET_2_0
|
||||
if (IsBinarySerialized (info, context)) {
|
||||
BinaryDeserialize (info);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
string s = info.GetValue ("XmlSchema", typeof (String)) as String;
|
||||
string s = info.GetValue ("XmlDiffGram", typeof (String)) as String;
|
||||
XmlTextReader reader = new XmlTextReader (new StringReader (s));
|
||||
ReadXmlSchema (reader);
|
||||
reader.Close ();
|
||||
|
||||
s = info.GetValue ("XmlDiffGram", typeof (String)) as String;
|
||||
reader = new XmlTextReader (new StringReader (s));
|
||||
ReadXml (reader, XmlReadMode.DiffGram);
|
||||
reader.Close ();
|
||||
}
|
||||
@@ -1547,10 +1548,26 @@ namespace System.Data
|
||||
private bool dataSetInitialized = true;
|
||||
public event EventHandler Initialized;
|
||||
|
||||
[MonoTODO]
|
||||
protected DataSet (SerializationInfo info, StreamingContext context, bool constructSchema)
|
||||
: this (info, context)
|
||||
: this ()
|
||||
{
|
||||
if (DetermineSchemaSerializationMode (info, context) == SchemaSerializationMode.ExcludeSchema) {
|
||||
InitializeDerivedDataSet ();
|
||||
}
|
||||
|
||||
if (IsBinarySerialized (info, context)) {
|
||||
BinaryDeserialize (info);
|
||||
return;
|
||||
}
|
||||
|
||||
if (constructSchema) {
|
||||
string s = info.GetValue ("XmlSchema", typeof (String)) as String;
|
||||
XmlTextReader reader = new XmlTextReader (new StringReader (s));
|
||||
ReadXmlSchema (reader);
|
||||
reader.Close ();
|
||||
|
||||
GetSerializationData (info, context);
|
||||
}
|
||||
}
|
||||
|
||||
SerializationFormat remotingFormat = SerializationFormat.Xml;
|
||||
@@ -1751,10 +1768,8 @@ namespace System.Data
|
||||
OnDataSetInitialized (e);
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
protected virtual void InitializeDerivedDataSet ()
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
protected SchemaSerializationMode DetermineSchemaSerializationMode (XmlReader reader)
|
||||
@@ -1764,6 +1779,13 @@ namespace System.Data
|
||||
|
||||
protected SchemaSerializationMode DetermineSchemaSerializationMode (SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
SerializationInfoEnumerator e = info.GetEnumerator ();
|
||||
while (e.MoveNext ()) {
|
||||
if (e.Name == "SchemaSerializationMode.DataSet") {
|
||||
return (SchemaSerializationMode) e.Value;
|
||||
}
|
||||
}
|
||||
|
||||
return SchemaSerializationMode.IncludeSchema;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
2009-09-26 Veerapuram Varadhan <[email protected]>
|
||||
|
||||
* DataSetTest2.cs: Don't run the test for Bug#536194 in 1.x
|
||||
profile. Makes build bot go all green on Sys.Data.
|
||||
|
||||
2009-09-26 Veerapuram Varadhan <[email protected]>
|
||||
|
||||
* DataSetTypedDataSet.cs: Test for #427769. Patch by
|
||||
John Lenz <[email protected]>.
|
||||
|
||||
2009-09-24 Veerapuram Varadhan <[email protected]>
|
||||
|
||||
* DataSetTest2.cs (MergeTest_SameDataSet_536194): Added new.
|
||||
* DataSetTest2.cs (MergeTest_SameDataSet_536194): Added new.
|
||||
|
||||
2009-01-16 Atsushi Enomoto <[email protected]>
|
||||
|
||||
|
||||
@@ -3467,6 +3467,7 @@ namespace MonoTests_System.Data
|
||||
Assert.AreEqual (typeof (string), ds.Tables [0].Columns [0].DataType, "#5");
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
[Test]
|
||||
public void MergeTest_SameDataSet_536194 ()
|
||||
{
|
||||
@@ -3479,6 +3480,7 @@ namespace MonoTests_System.Data
|
||||
dataSet.Merge(dataTable);
|
||||
Assert.AreEqual (1, dataSet.Tables.Count, "1");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if NET_2_0
|
||||
[Test]
|
||||
|
||||
@@ -196,6 +196,58 @@ namespace MonoTests.System.Data
|
||||
myTypedDataSet.Order_DetailsRow[] drArr1 = ds.Orders[0].GetOrder_DetailsRows();
|
||||
DataRow[] drArr2 = ds.Orders[0].GetChildRows(ds.Relations[0]);
|
||||
Assert.AreEqual(drArr1 ,drArr2,"TDS25");
|
||||
|
||||
#if NET_2_0
|
||||
//now test serialization of a typed dataset generated by microsoft's xsd.exe
|
||||
DataSet1 ds1 = new DataSet1();
|
||||
ds1.DataTable1.AddDataTable1Row("test");
|
||||
ds1.DataTable1.AddDataTable1Row("test2");
|
||||
|
||||
global::System.Runtime.Serialization.Formatters.Binary.BinaryFormatter formatter =
|
||||
new global::System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
|
||||
MemoryStream stream = new MemoryStream();
|
||||
|
||||
formatter.Serialize(stream, ds1);
|
||||
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
DataSet1 ds1load = (DataSet1) formatter.Deserialize(stream);
|
||||
|
||||
Assert.IsTrue(ds1load.Tables.Contains("DataTable1"));
|
||||
Assert.AreEqual("DataTable1DataTable", ds1load.Tables["DataTable1"].GetType().Name);
|
||||
Assert.AreEqual(2, ds1load.DataTable1.Rows.Count);
|
||||
Assert.AreEqual("DataTable1Row", ds1load.DataTable1[0].GetType().Name);
|
||||
if (ds1load.DataTable1[0].Column1 == "test") {
|
||||
Assert.AreEqual("test2", ds1load.DataTable1[1].Column1);
|
||||
} else if (ds1load.DataTable1[0].Column1 == "test2") {
|
||||
Assert.AreEqual("test", ds1load.DataTable1[1].Column1);
|
||||
} else {
|
||||
Assert.Fail("Invalid entry for Column1");
|
||||
}
|
||||
|
||||
//now test when the mode is exclude schema
|
||||
ds1.SchemaSerializationMode = global::System.Data.SchemaSerializationMode.ExcludeSchema;
|
||||
|
||||
stream = new MemoryStream();
|
||||
|
||||
formatter.Serialize(stream, ds1);
|
||||
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
ds1load = (DataSet1) formatter.Deserialize(stream);
|
||||
|
||||
Assert.IsTrue(ds1load.Tables.Contains("DataTable1"));
|
||||
Assert.AreEqual("DataTable1DataTable", ds1load.Tables["DataTable1"].GetType().Name);
|
||||
Assert.AreEqual(2, ds1load.DataTable1.Rows.Count);
|
||||
Assert.AreEqual("DataTable1Row", ds1load.DataTable1[0].GetType().Name);
|
||||
if (ds1load.DataTable1[0].Column1 == "test") {
|
||||
Assert.AreEqual("test2", ds1load.DataTable1[1].Column1);
|
||||
} else if (ds1load.DataTable1[0].Column1 == "test2") {
|
||||
Assert.AreEqual("test", ds1load.DataTable1[1].Column1);
|
||||
} else {
|
||||
Assert.Fail("Invalid entry for Column1");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
protected void T_Changing(object sender, myTypedDataSet.OrdersRowChangeEvent e)
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
2009-09-29 Sebastien Pouliot <[email protected]>
|
||||
|
||||
* net_2_1_raw_System.Net.dll.sources: Remove Timer_2_1.cs and
|
||||
related classes from System.dll - they are not required anymore
|
||||
since Gonzalo's changes on Socket.Close(int)
|
||||
[Backport r142851]
|
||||
|
||||
2009-09-27 Sebastien Pouliot <[email protected]>
|
||||
|
||||
* net_2_1_raw_System.Net.dll.sources: Add Timer_2_1.cs and
|
||||
related classes from System.dll
|
||||
[Backport of r142720]
|
||||
|
||||
2009-09-24 Sebastien Pouliot <[email protected]>
|
||||
|
||||
* net_2_1_raw_System.Net.dll.sources: Substitute System.dll Dns
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
2009-09-28 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* SerializationMap.cs :
|
||||
There were some places that ignored possible whitespace nodes.
|
||||
Fixed sorting of ordered members so that it does not give
|
||||
incomplete sorting among base/derived types. (should fix #539563.)
|
||||
Give xml error details in some places.
|
||||
|
||||
2009-09-28 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* KnownTypeCollection.cs : (the previous one didn't fix #539563.)
|
||||
Consider attempts to register the same collection type as it did
|
||||
before.
|
||||
|
||||
2009-09-28 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* SerializationMap.cs, KnownTypeCollection.cs : nested use of type
|
||||
in its members resulted in infinite loop. This hopefully fixes
|
||||
bug #539563.
|
||||
|
||||
2009-09-07 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* IgnoreDataMemberAttribute.cs : add missing type.
|
||||
|
||||
+9
-4
@@ -666,8 +666,13 @@ namespace System.Runtime.Serialization
|
||||
|
||||
QName qname = GetCollectionQName (element);
|
||||
|
||||
if (FindUserMap (qname) != null)
|
||||
throw new InvalidOperationException (String.Format ("Failed to add type {0} to known type collection. There already is a registered type for XML name {1}", type, qname));
|
||||
var map = FindUserMap (qname);
|
||||
if (map != null) {
|
||||
var cmap = map as CollectionTypeMap;
|
||||
if (cmap == null || cmap.RuntimeType != type)
|
||||
throw new InvalidOperationException (String.Format ("Failed to add type {0} to known type collection. There already is a registered type for XML name {1}", type, qname));
|
||||
return cmap;
|
||||
}
|
||||
|
||||
CollectionTypeMap ret =
|
||||
new CollectionTypeMap (type, element, qname, this);
|
||||
@@ -746,9 +751,9 @@ namespace System.Runtime.Serialization
|
||||
if (FindUserMap (qname) != null)
|
||||
throw new InvalidOperationException (String.Format ("There is already a registered type for XML name {0}", qname));
|
||||
|
||||
SharedContractMap ret =
|
||||
new SharedContractMap (type, qname, this);
|
||||
SharedContractMap ret = new SharedContractMap (type, qname, this);
|
||||
contracts.Add (ret);
|
||||
ret.Initialize ();
|
||||
|
||||
object [] attrs = type.GetCustomAttributes (typeof (KnownTypeAttribute), true);
|
||||
for (int i = 0; i < attrs.Length; i++) {
|
||||
|
||||
+31
-17
@@ -353,8 +353,15 @@ namespace System.Runtime.Serialization
|
||||
reader.MoveToContent ();
|
||||
if (!isEmpty && reader.NodeType == XmlNodeType.EndElement)
|
||||
reader.ReadEndElement ();
|
||||
else if (!isEmpty && reader.NodeType != XmlNodeType.None)
|
||||
throw new SerializationException (String.Format ("Deserializing type '{3}'. Expecting state 'EndElement'. Encountered state '{0}' with name '{1}' with namespace '{2}'.", reader.NodeType, reader.Name, reader.NamespaceURI, RuntimeType.FullName));
|
||||
else if (!isEmpty && reader.NodeType != XmlNodeType.None) {
|
||||
var li = reader as IXmlLineInfo;
|
||||
throw new SerializationException (String.Format ("Deserializing type '{3}'. Expecting state 'EndElement'. Encountered state '{0}' with name '{1}' with namespace '{2}'.{4}",
|
||||
reader.NodeType,
|
||||
reader.Name,
|
||||
reader.NamespaceURI,
|
||||
RuntimeType.FullName,
|
||||
li != null && li.HasLineInfo () ? String.Format (" {0}({1},{2})", reader.BaseURI, li.LineNumber, li.LinePosition) : String.Empty));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -378,7 +385,7 @@ namespace System.Runtime.Serialization
|
||||
object instance = FormatterServices.GetUninitializedObject (RuntimeType);
|
||||
int depth = reader.NodeType == XmlNodeType.None ? reader.Depth : reader.Depth - 1;
|
||||
bool [] filled = new bool [Members.Count];
|
||||
int memberInd = -1;
|
||||
int memberInd = -1, ordered = -1;
|
||||
while (!empty && reader.NodeType == XmlNodeType.Element && reader.Depth > depth) {
|
||||
DataMemberInfo dmi = null;
|
||||
int i = 0;
|
||||
@@ -392,12 +399,13 @@ namespace System.Runtime.Serialization
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (; i < Members.Count; i++) { // ordered
|
||||
for (i = Math.Max (i, ordered); i < Members.Count; i++) { // ordered
|
||||
if (dmi != null)
|
||||
break;
|
||||
if (reader.LocalName == Members [i].XmlName &&
|
||||
reader.NamespaceURI == Members [i].XmlRootNamespace) {
|
||||
memberInd = i;
|
||||
ordered = i;
|
||||
dmi = Members [i];
|
||||
break;
|
||||
}
|
||||
@@ -409,6 +417,7 @@ namespace System.Runtime.Serialization
|
||||
}
|
||||
SetValue (dmi, instance, deserializer.Deserialize (dmi.MemberType, reader));
|
||||
filled [memberInd] = true;
|
||||
reader.MoveToContent ();
|
||||
}
|
||||
for (int i = 0; i < Members.Count; i++)
|
||||
if (!filled [i] && Members [i].IsRequired)
|
||||
@@ -420,7 +429,11 @@ namespace System.Runtime.Serialization
|
||||
// For now it could be private.
|
||||
protected Exception MissingRequiredMember (DataMemberInfo dmi, XmlReader reader)
|
||||
{
|
||||
return new ArgumentException (String.Format ("Data contract member {0} is required, but missing in the input XML.", new QName (dmi.XmlName, dmi.XmlNamespace)));
|
||||
var li = reader as IXmlLineInfo;
|
||||
return new ArgumentException (String.Format ("Data contract member {0} for the type {1} is required, but missing in the input XML.{2}",
|
||||
new QName (dmi.XmlName, dmi.XmlNamespace),
|
||||
RuntimeType,
|
||||
li != null && li.HasLineInfo () ? String.Format (" {0}({1},{2})", reader.BaseURI, li.LineNumber, li.LinePosition) : null));
|
||||
}
|
||||
|
||||
// For now it could be private.
|
||||
@@ -487,14 +500,18 @@ namespace System.Runtime.Serialization
|
||||
Type type, QName qname, KnownTypeCollection knownTypes)
|
||||
: base (type, qname, knownTypes)
|
||||
{
|
||||
Type baseType = type;
|
||||
}
|
||||
|
||||
internal void Initialize ()
|
||||
{
|
||||
Type baseType = RuntimeType;
|
||||
List <DataMemberInfo> members = new List <DataMemberInfo> ();
|
||||
object [] atts = type.GetCustomAttributes (
|
||||
object [] atts = baseType.GetCustomAttributes (
|
||||
typeof (DataContractAttribute), false);
|
||||
IsReference = atts.Length > 0 ? (((DataContractAttribute) atts [0]).IsReference) : false;
|
||||
|
||||
while (baseType != null) {
|
||||
QName bqname = knownTypes.GetQName (baseType);
|
||||
QName bqname = KnownTypes.GetQName (baseType);
|
||||
|
||||
members = GetMembers (baseType, bqname, true);
|
||||
Members.InsertRange (0, members);
|
||||
@@ -503,10 +520,7 @@ namespace System.Runtime.Serialization
|
||||
baseType = baseType.BaseType;
|
||||
}
|
||||
|
||||
// Members.Sort (delegate (
|
||||
// DataMemberInfo d1, DataMemberInfo d2) {
|
||||
// return d1.Order - d2.Order;
|
||||
// });
|
||||
Members.Sort (DataMemberInfo.DataMemberInfoComparer.Instance);
|
||||
}
|
||||
|
||||
List<DataMemberInfo> GetMembers (Type type, QName qname, bool declared_only)
|
||||
@@ -540,14 +554,12 @@ namespace System.Runtime.Serialization
|
||||
data_members.Add (CreateDataMemberInfo (dma, fi, fi.FieldType));
|
||||
}
|
||||
|
||||
data_members.Sort (DataMemberInfo.DataMemberInfoComparer.Instance);
|
||||
|
||||
return data_members;
|
||||
}
|
||||
|
||||
public override List<DataMemberInfo> GetMembers ()
|
||||
{
|
||||
return GetMembers (RuntimeType, XmlName, true);
|
||||
return Members;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -692,6 +704,7 @@ namespace System.Runtime.Serialization
|
||||
add_method.Invoke (instance, new object [] {elem});
|
||||
else
|
||||
throw new NotImplementedException (String.Format ("Type {0} is not supported", RuntimeType));
|
||||
reader.MoveToContent ();
|
||||
}
|
||||
if (RuntimeType.IsArray)
|
||||
return ((ArrayList)instance).ToArray (element_type);
|
||||
@@ -967,7 +980,8 @@ namespace System.Runtime.Serialization
|
||||
// Does this make sense? I doubt.
|
||||
public override List<DataMemberInfo> GetMembers ()
|
||||
{
|
||||
return GetMembers (RuntimeType, XmlName, true);
|
||||
return Members;
|
||||
//return GetMembers (RuntimeType, XmlName, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1141,7 +1155,7 @@ namespace System.Runtime.Serialization
|
||||
|
||||
public int Compare (DataMemberInfo d1, DataMemberInfo d2)
|
||||
{
|
||||
if (d1.Order == -1 || d2.Order == -1)
|
||||
if (d1.Order == d2.Order)
|
||||
return String.CompareOrdinal (d1.XmlName, d2.XmlName);
|
||||
|
||||
return d1.Order - d2.Order;
|
||||
|
||||
@@ -1,3 +1,14 @@
|
||||
2009-09-28 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* XsdDataContractExporterTest.cs : disable some tests that started
|
||||
to fail due to correctly sorted fields while xsd exporter has
|
||||
some bugs that emits duplicate fields (hence ambiguity occurs).
|
||||
|
||||
2009-09-28 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* XmlObjectSerializerTest.cs : Test nested type serialization type
|
||||
initialization.
|
||||
|
||||
2009-09-07 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* XmlObjectSerializerTest.cs : fix (here too) bad serialization-
|
||||
|
||||
+15
@@ -1262,6 +1262,12 @@ namespace MonoTests.System.Runtime.Serialization
|
||||
new DataContractSerializer(typeof (AsxEntryInfo)).ReadObject (reader);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Bug539563 ()
|
||||
{
|
||||
new DataContractSerializer (typeof (NestedContractType));
|
||||
}
|
||||
|
||||
private T Deserialize<T> (string xml)
|
||||
{
|
||||
return Deserialize<T> (xml, typeof (T));
|
||||
@@ -1604,6 +1610,15 @@ namespace MonoTests.System.Runtime.Serialization
|
||||
[DataMember]
|
||||
public IList<int> Array { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class NestedContractType
|
||||
{
|
||||
[DataMember]
|
||||
public NestedContractType Nested;
|
||||
[DataMember]
|
||||
public string X = "x";
|
||||
}
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
|
||||
+2
@@ -136,6 +136,7 @@ namespace MonoTests.System.Runtime.Serialization
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotWorking")]
|
||||
public void Dc3Test ()
|
||||
{
|
||||
//Check for duplicate dc2 ?
|
||||
@@ -145,6 +146,7 @@ namespace MonoTests.System.Runtime.Serialization
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotWorking")]
|
||||
public void Dc3Test2 ()
|
||||
{
|
||||
//Check for duplicate dc2 ?
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
2009-09-28 Marek Habersack <[email protected]>
|
||||
|
||||
* UpdatePanel.cs: RenderChildren stores the alternative writer in
|
||||
a private property, for the benefit of nested child panels. Fixes
|
||||
bug #542441
|
||||
|
||||
* ScriptManager.cs: don't render invisible panel IDs during async
|
||||
request. Fixes bug #542533
|
||||
|
||||
2009-05-26 Marek Habersack <[email protected]>
|
||||
|
||||
* ScriptReferenceBase.cs: implemented (3.5 SP1)
|
||||
|
||||
@@ -1061,9 +1061,18 @@ namespace System.Web.UI
|
||||
writer.WriteLine ("//<![CDATA[");
|
||||
writer.WriteLine ("Sys.WebForms.PageRequestManager._initialize('{0}', document.getElementById('{1}'));", UniqueID, Page.Form.ClientID);
|
||||
if (IsMultiForm)
|
||||
writer.WriteLine ("Sys.WebForms.PageRequestManager.getInstance($get(\"{0}\"))._updateControls([{1}], [{2}], [{3}], {4});", Page.Form.ClientID, FormatUpdatePanelIDs (_updatePanels, true), FormatListIDs (_asyncPostBackControls, true), FormatListIDs (_postBackControls, true), AsyncPostBackTimeout);
|
||||
writer.WriteLine ("Sys.WebForms.PageRequestManager.getInstance($get(\"{0}\"))._updateControls([{1}], [{2}], [{3}], {4});",
|
||||
Page.Form.ClientID,
|
||||
FormatUpdatePanelIDs (_updatePanels, true),
|
||||
FormatListIDs (_asyncPostBackControls, true, false),
|
||||
FormatListIDs (_postBackControls, true, false),
|
||||
AsyncPostBackTimeout);
|
||||
else
|
||||
writer.WriteLine ("Sys.WebForms.PageRequestManager.getInstance()._updateControls([{0}], [{1}], [{2}], {3});", FormatUpdatePanelIDs (_updatePanels, true), FormatListIDs (_asyncPostBackControls, true), FormatListIDs (_postBackControls, true), AsyncPostBackTimeout);
|
||||
writer.WriteLine ("Sys.WebForms.PageRequestManager.getInstance()._updateControls([{0}], [{1}], [{2}], {3});",
|
||||
FormatUpdatePanelIDs (_updatePanels, true),
|
||||
FormatListIDs (_asyncPostBackControls, true, false),
|
||||
FormatListIDs (_postBackControls, true, false),
|
||||
AsyncPostBackTimeout);
|
||||
writer.WriteLine ("//]]");
|
||||
writer.WriteLine ("</script>");
|
||||
}
|
||||
@@ -1075,21 +1084,29 @@ namespace System.Web.UI
|
||||
return null;
|
||||
|
||||
StringBuilder sb = new StringBuilder ();
|
||||
for (int i = 0; i < list.Count; i++) {
|
||||
sb.AppendFormat ("{0}{1}{2}{0},", useSingleQuote ? "'" : String.Empty, list [i].ChildrenAsTriggers ? "t" : "f", list [i].UniqueID);
|
||||
foreach (UpdatePanel panel in list) {
|
||||
if (!panel.Visible)
|
||||
continue;
|
||||
|
||||
sb.AppendFormat ("{0}{1}{2}{0},", useSingleQuote ? "'" : String.Empty, panel.ChildrenAsTriggers ? "t" : "f", panel.UniqueID);
|
||||
}
|
||||
|
||||
if (sb.Length > 0)
|
||||
sb.Length--;
|
||||
|
||||
return sb.ToString ();
|
||||
}
|
||||
|
||||
static string FormatListIDs<T> (List<T> list, bool useSingleQuote) where T : Control {
|
||||
static string FormatListIDs<T> (List<T> list, bool useSingleQuote, bool skipInvisible) where T : Control
|
||||
{
|
||||
if (list == null || list.Count == 0)
|
||||
return null;
|
||||
|
||||
StringBuilder sb = new StringBuilder ();
|
||||
for (int i = 0; i < list.Count; i++) {
|
||||
if (skipInvisible && !list [i].Visible)
|
||||
continue;
|
||||
|
||||
sb.AppendFormat ("{0}{1}{0},", useSingleQuote ? "'" : String.Empty, list [i].UniqueID);
|
||||
}
|
||||
if (sb.Length > 0)
|
||||
@@ -1255,7 +1272,7 @@ namespace System.Web.UI
|
||||
needsUpdate = true;
|
||||
else
|
||||
needsUpdate = false;
|
||||
|
||||
|
||||
if (needsUpdate == false) {
|
||||
Control parent = panel.Parent;
|
||||
UpdatePanel parentPanel;
|
||||
@@ -1270,7 +1287,7 @@ namespace System.Web.UI
|
||||
parent = parent.Parent;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
panel.SetInPartialRendering (needsUpdate);
|
||||
if (needsUpdate)
|
||||
RegisterPanelForRefresh (panel);
|
||||
@@ -1286,11 +1303,11 @@ namespace System.Web.UI
|
||||
foreach (KeyValuePair <string, string> kvp in pageHiddenFields)
|
||||
WriteCallbackOutput (output, hiddenField, kvp.Key, kvp.Value);
|
||||
|
||||
WriteCallbackOutput (output, asyncPostBackControlIDs, null, FormatListIDs (_asyncPostBackControls, false));
|
||||
WriteCallbackOutput (output, postBackControlIDs, null, FormatListIDs (_postBackControls, false));
|
||||
WriteCallbackOutput (output, asyncPostBackControlIDs, null, FormatListIDs (_asyncPostBackControls, false, false));
|
||||
WriteCallbackOutput (output, postBackControlIDs, null, FormatListIDs (_postBackControls, false, false));
|
||||
WriteCallbackOutput (output, updatePanelIDs, null, FormatUpdatePanelIDs (_updatePanels, false));
|
||||
WriteCallbackOutput (output, childUpdatePanelIDs, null, FormatListIDs (_childUpdatePanels, false));
|
||||
WriteCallbackOutput (output, panelsToRefreshIDs, null, FormatListIDs (_panelsToRefresh, false));
|
||||
WriteCallbackOutput (output, childUpdatePanelIDs, null, FormatListIDs (_childUpdatePanels, false, true));
|
||||
WriteCallbackOutput (output, panelsToRefreshIDs, null, FormatListIDs (_panelsToRefresh, false, true));
|
||||
WriteCallbackOutput (output, asyncPostBackTimeout, null, AsyncPostBackTimeout.ToString ());
|
||||
if (!IsMultiForm)
|
||||
WriteCallbackOutput (output, pageTitle, null, Page.Title);
|
||||
@@ -1433,10 +1450,10 @@ namespace System.Web.UI
|
||||
output = ((HtmlTextParser) output).ResponseOutput;
|
||||
HtmlForm form = (HtmlForm) container;
|
||||
HtmlTextWriter writer = new HtmlDropWriter (output);
|
||||
|
||||
if (form.HasControls ()) {
|
||||
for (int i = 0; i < form.Controls.Count; i++) {
|
||||
form.Controls [i].RenderControl (writer);
|
||||
}
|
||||
foreach (Control control in form.Controls)
|
||||
control.RenderControl (writer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -200,6 +200,9 @@ namespace System.Web.UI
|
||||
_updateMode = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Used by nested panels (see bug #542441)
|
||||
ScriptManager.AlternativeHtmlTextWriter RenderChildrenWriter { get; set; }
|
||||
|
||||
protected virtual Control CreateContentTemplateContainer ()
|
||||
{
|
||||
@@ -257,22 +260,50 @@ namespace System.Web.UI
|
||||
writer.RenderEndTag ();
|
||||
}
|
||||
|
||||
UpdatePanel FindParentPanel ()
|
||||
{
|
||||
Control parent = Parent;
|
||||
while (parent != null) {
|
||||
UpdatePanel panel = parent as UpdatePanel;
|
||||
if (panel != null)
|
||||
return panel;
|
||||
|
||||
parent = parent.Parent;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected override void RenderChildren (HtmlTextWriter writer)
|
||||
{
|
||||
RenderChildrenWriter = null;
|
||||
|
||||
if (IsInPartialRendering) {
|
||||
ScriptManager.AlternativeHtmlTextWriter altWriter = writer as ScriptManager.AlternativeHtmlTextWriter;
|
||||
if (altWriter == null)
|
||||
altWriter = writer.InnerWriter as ScriptManager.AlternativeHtmlTextWriter;
|
||||
|
||||
if (altWriter == null) {
|
||||
UpdatePanel parentPanel = FindParentPanel ();
|
||||
if (parentPanel != null)
|
||||
altWriter = parentPanel.RenderChildrenWriter;
|
||||
}
|
||||
|
||||
if (altWriter == null)
|
||||
throw new InvalidOperationException ("Internal error. Invalid writer object.");
|
||||
|
||||
HtmlTextWriter responseOutput = altWriter.ResponseOutput;
|
||||
StringBuilder sb = new StringBuilder ();
|
||||
HtmlTextWriter w = new HtmlTextWriter (new StringWriter (sb));
|
||||
base.RenderChildren (w);
|
||||
w.Flush ();
|
||||
|
||||
ScriptManager.WriteCallbackPanel (responseOutput, this, sb);
|
||||
|
||||
// Used by nested panels (see bug #542441)
|
||||
RenderChildrenWriter = altWriter;
|
||||
try {
|
||||
HtmlTextWriter responseOutput = altWriter.ResponseOutput;
|
||||
StringBuilder sb = new StringBuilder ();
|
||||
HtmlTextWriter w = new HtmlTextWriter (new StringWriter (sb));
|
||||
base.RenderChildren (w);
|
||||
w.Flush ();
|
||||
ScriptManager.WriteCallbackPanel (responseOutput, this, sb);
|
||||
} finally {
|
||||
RenderChildrenWriter = null;
|
||||
}
|
||||
} else
|
||||
base.RenderChildren (writer);
|
||||
}
|
||||
|
||||
@@ -67,6 +67,19 @@ namespace System.Web.Compilation
|
||||
protected CodeTypeReferenceExpression mainClassExpr;
|
||||
protected static CodeThisReferenceExpression thisRef = new CodeThisReferenceExpression ();
|
||||
|
||||
#if NET_2_0
|
||||
VirtualPath inputVirtualPath;
|
||||
|
||||
public VirtualPath InputVirtualPath {
|
||||
get {
|
||||
if (inputVirtualPath == null)
|
||||
inputVirtualPath = new VirtualPath (VirtualPathUtility.Combine (parser.BaseVirtualDir, Path.GetFileName (parser.InputFile)));
|
||||
|
||||
return inputVirtualPath;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
protected BaseCompiler (TemplateParser parser)
|
||||
{
|
||||
this.parser = parser;
|
||||
@@ -328,11 +341,7 @@ namespace System.Web.Compilation
|
||||
return;
|
||||
if (!baseType.IsSubclassOf (typeof (System.Web.UI.TemplateControl)))
|
||||
return;
|
||||
|
||||
string arvp = Path.Combine (parser.BaseVirtualDir, Path.GetFileName (parser.InputFile));
|
||||
if (VirtualPathUtility.IsAbsolute (arvp))
|
||||
arvp = VirtualPathUtility.ToAppRelative (arvp);
|
||||
|
||||
|
||||
CodeTypeReference baseTypeRef = new CodeTypeReference (baseType.FullName);
|
||||
if (parser.BaseTypeIsGlobal)
|
||||
baseTypeRef.Options |= CodeTypeReferenceOptions.GlobalReference;
|
||||
@@ -341,7 +350,7 @@ namespace System.Web.Compilation
|
||||
CodePropertyReferenceExpression arvpProp = new CodePropertyReferenceExpression (cast, "AppRelativeVirtualPath");
|
||||
CodeAssignStatement arvpAssign = new CodeAssignStatement ();
|
||||
arvpAssign.Left = arvpProp;
|
||||
arvpAssign.Right = new CodePrimitiveExpression (VirtualPathUtility.RemoveTrailingSlash (arvp));
|
||||
arvpAssign.Right = new CodePrimitiveExpression (VirtualPathUtility.RemoveTrailingSlash (InputVirtualPath.AppRelative));
|
||||
ctor.Statements.Add (arvpAssign);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,3 +1,14 @@
|
||||
2009-09-28 Marek Habersack <[email protected]>
|
||||
|
||||
* TemplateControlCompiler.cs: ResourceProviderHasObject calls
|
||||
HttpContext.GetResourceProvider with the current file's path, not
|
||||
current request's. Fixes situations when localized control lives
|
||||
in a master page or user control. Fixes bug #542484
|
||||
|
||||
* BaseCompiler.cs: introduced a helper property InputVirtualPath
|
||||
which returns a VirtualPath object for the current control's
|
||||
virtual path.
|
||||
|
||||
2009-09-22 Marek Habersack <[email protected]>
|
||||
|
||||
* TemplateControlCompiler.cs: ResourceProviderHasObject needs to
|
||||
|
||||
@@ -855,7 +855,7 @@ namespace System.Web.Compilation
|
||||
|
||||
bool ResourceProviderHasObject (string key)
|
||||
{
|
||||
IResourceProvider rp = HttpContext.GetResourceProvider (key, true);
|
||||
IResourceProvider rp = HttpContext.GetResourceProvider (InputVirtualPath.Absolute, true);
|
||||
if (rp == null)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
2009-09-28 Marek Habersack <[email protected]>
|
||||
|
||||
* DataBoundControl.cs: Initialize sets RequiresDataBinding
|
||||
properly, only when we're not data-bound already, when we aren't
|
||||
in postback or when we are in postback, but with viewstate
|
||||
enabled. Fixes bug #542076
|
||||
|
||||
2009-09-01 Marek Habersack <[email protected]>
|
||||
|
||||
* ObjectDataSourceView.cs: ExecuteSelect must call
|
||||
|
||||
@@ -137,9 +137,11 @@ namespace System.Web.UI.WebControls {
|
||||
void Initialize ()
|
||||
{
|
||||
Page page = Page;
|
||||
if (page != null) {
|
||||
if (page != null && !IsDataBound) {
|
||||
// LAMESPEC: see the comment above OnPagePreLoad
|
||||
if (!page.IsPostBack || (!IsDataBound && IsViewStateEnabled))
|
||||
if (!page.IsPostBack)
|
||||
RequiresDataBinding = true;
|
||||
else if (IsViewStateEnabled)
|
||||
RequiresDataBinding = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -389,8 +389,6 @@ namespace System.Web.UI.WebControls {
|
||||
|
||||
protected override void OnDataBinding (EventArgs e)
|
||||
{
|
||||
base.OnDataBinding (e);
|
||||
|
||||
#if !NET_2_0
|
||||
IEnumerable list = DataSourceResolver.ResolveDataSource (DataSource, DataMember);
|
||||
PerformDataBinding (list);
|
||||
@@ -398,7 +396,7 @@ namespace System.Web.UI.WebControls {
|
||||
IEnumerable list = GetData ().ExecuteSelect (DataSourceSelectArguments.Empty);
|
||||
InternalPerformDataBinding (list);
|
||||
#endif
|
||||
|
||||
base.OnDataBinding (e);
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
|
||||
@@ -1,3 +1,22 @@
|
||||
2009-09-29 Marek Habersack <[email protected]>
|
||||
|
||||
* HttpResponse.cs: use full url in redirect if
|
||||
UseFullyQualifiedRedirectUrl is set to true in httpRuntime
|
||||
configuration section. Patch from Brett Kiefer
|
||||
<[email protected]>, thanks! Fixes bug #542846
|
||||
|
||||
2009-09-29 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* HttpContext.cs: try to load App_GlobalResouces.dll if it has not
|
||||
been set but it exists in 'bin'.
|
||||
|
||||
2009-09-28 Marek Habersack <[email protected]>
|
||||
|
||||
* HttpContext.cs: GetResourceProvider - renamed the 'key' argument
|
||||
to 'virtualPath' in order to reflects its purpose better. Local
|
||||
resource providers are created for the passed virtualPath and not
|
||||
for the current request's path. Fixes bug #542484
|
||||
|
||||
2009-09-25 Marek Habersack <[email protected]>
|
||||
|
||||
* StaticSiteMapProvider.cs: MapUrl must normalize paths. Fixes bug
|
||||
|
||||
@@ -41,10 +41,10 @@ using System.Web.Configuration;
|
||||
using System.Web.SessionState;
|
||||
using System.Web.UI;
|
||||
using System.Web.Util;
|
||||
using System.Reflection;
|
||||
#if NET_2_0
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Web.Compilation;
|
||||
using System.Web.Profile;
|
||||
@@ -55,6 +55,8 @@ namespace System.Web {
|
||||
// CAS - no InheritanceDemand here as the class is sealed
|
||||
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
|
||||
public sealed partial class HttpContext : IServiceProvider {
|
||||
static bool tried_load_global_resx;
|
||||
static Assembly global_resources;
|
||||
internal HttpWorkerRequest WorkerRequest;
|
||||
HttpApplication app_instance;
|
||||
HttpRequest request;
|
||||
@@ -92,7 +94,20 @@ namespace System.Web {
|
||||
set { AppDomain.CurrentDomain.SetData (app_global_res_key, value); }
|
||||
}
|
||||
#else
|
||||
internal static Assembly AppGlobalResourcesAssembly;
|
||||
internal static Assembly AppGlobalResourcesAssembly {
|
||||
get {
|
||||
if (!tried_load_global_resx && global_resources == null) {
|
||||
string file = Path.Combine (HttpApplication.BinDirectory, "App_GlobalResources.dll");
|
||||
try {
|
||||
global_resources = Assembly.LoadFrom (file);
|
||||
} catch {
|
||||
}
|
||||
tried_load_global_resx = true;
|
||||
}
|
||||
return global_resources;
|
||||
}
|
||||
set { global_resources = value; }
|
||||
}
|
||||
#endif
|
||||
ProfileBase profile = null;
|
||||
LinkedList<IHttpHandler> handlers;
|
||||
@@ -484,8 +499,8 @@ namespace System.Web {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
internal static IResourceProvider GetResourceProvider (string key, bool isLocal)
|
||||
|
||||
internal static IResourceProvider GetResourceProvider (string virtualPath, bool isLocal)
|
||||
{
|
||||
if (!EnsureProviderFactory ())
|
||||
return null;
|
||||
@@ -493,27 +508,27 @@ namespace System.Web {
|
||||
// TODO: check if it makes sense to cache the providers and, if yes, maybe
|
||||
// we should expire the entries (or just store them in InternalCache?)
|
||||
IResourceProvider rp = null;
|
||||
if (!resource_providers.TryGetValue (key, out rp)) {
|
||||
if (!resource_providers.TryGetValue (virtualPath, out rp)) {
|
||||
if (isLocal) {
|
||||
HttpContext ctx = HttpContext.Current;
|
||||
HttpRequest req = ctx != null ? ctx.Request : null;
|
||||
rp = provider_factory.CreateLocalResourceProvider (req != null ? req.Path : null);
|
||||
rp = provider_factory.CreateLocalResourceProvider (virtualPath);
|
||||
} else
|
||||
rp = provider_factory.CreateGlobalResourceProvider (key);
|
||||
rp = provider_factory.CreateGlobalResourceProvider (virtualPath);
|
||||
|
||||
if (rp == null) {
|
||||
if (isLocal) {
|
||||
HttpContext ctx = HttpContext.Current;
|
||||
HttpRequest req = ctx != null ? ctx.Request : null;
|
||||
rp = DefaultProviderFactory.CreateLocalResourceProvider (req != null ? req.Path : null);
|
||||
rp = DefaultProviderFactory.CreateLocalResourceProvider (virtualPath);
|
||||
} else
|
||||
rp = DefaultProviderFactory.CreateGlobalResourceProvider (key);
|
||||
rp = DefaultProviderFactory.CreateGlobalResourceProvider (virtualPath);
|
||||
|
||||
if (rp == null)
|
||||
return null;
|
||||
}
|
||||
|
||||
resource_providers.Add (key, rp);
|
||||
resource_providers.Add (virtualPath, rp);
|
||||
}
|
||||
|
||||
return rp;
|
||||
|
||||
@@ -881,6 +881,17 @@ namespace System.Web {
|
||||
|
||||
StatusCode = 302;
|
||||
url = ApplyAppPathModifier (url);
|
||||
#if NET_2_0
|
||||
HttpRuntimeSection config = WebConfigurationManager.GetWebApplicationSection ("system.web/httpRuntime") as HttpRuntimeSection;
|
||||
if (config != null && config.UseFullyQualifiedRedirectUrl) {
|
||||
var ub = new UriBuilder (context.Request.Url);
|
||||
ub.Fragment = null;
|
||||
ub.Password = null;
|
||||
ub.Query = null;
|
||||
ub.UserName = null;
|
||||
url = ub.Uri.ToString ();
|
||||
}
|
||||
#endif
|
||||
redirect_location = url;
|
||||
|
||||
// Text for browsers that can't handle location header
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2009-09-26 Sebastien Pouliot <[email protected]>
|
||||
|
||||
* System_test.dll.sources: Add unit tests for SocketAsyncEventArgs
|
||||
[Backport r142675]
|
||||
|
||||
2009-09-21 Sebastien Pouliot <[email protected]>
|
||||
|
||||
* net_2_1_raw_System.dll.sources: Remove System.Net.Mime since
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace System.ComponentModel {
|
||||
|
||||
lock (lockobj) {
|
||||
if (async == null)
|
||||
async = new CategoryAttribute ("Asynchrinous");
|
||||
async = new CategoryAttribute ("Asynchronous");
|
||||
}
|
||||
return async;
|
||||
}
|
||||
@@ -133,7 +133,11 @@ namespace System.ComponentModel {
|
||||
|
||||
lock (lockobj) {
|
||||
if (def == null)
|
||||
#if NET_2_1
|
||||
def = new CategoryAttribute ("Default");
|
||||
#else
|
||||
def = new CategoryAttribute ();
|
||||
#endif
|
||||
}
|
||||
return def;
|
||||
}
|
||||
@@ -159,7 +163,11 @@ namespace System.ComponentModel {
|
||||
|
||||
lock (lockobj) {
|
||||
if (drag_drop == null)
|
||||
#if NET_2_1
|
||||
drag_drop = new CategoryAttribute ("DragDrop");
|
||||
#else
|
||||
drag_drop = new CategoryAttribute ("Drag Drop");
|
||||
#endif
|
||||
}
|
||||
return drag_drop;
|
||||
}
|
||||
@@ -237,7 +245,11 @@ namespace System.ComponentModel {
|
||||
|
||||
lock (lockobj) {
|
||||
if (window_style == null)
|
||||
#if NET_2_1
|
||||
window_style = new CategoryAttribute ("WindowStyle");
|
||||
#else
|
||||
window_style = new CategoryAttribute ("Window Style");
|
||||
#endif
|
||||
}
|
||||
return window_style;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
2009-09-29 Alan McGovern <[email protected]>
|
||||
|
||||
* DefaultValueAttribute.cs: Implement the cctor which takes
|
||||
a Type and a string for the SL2 case.
|
||||
* CategoryAttribute.cs: Fix a typo in the CategoryAttribute.Asynchronous
|
||||
ctor and fix some SL2 specific naming changes for the default properties.
|
||||
|
||||
2009-09-24 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* EnumConverter.cs: Fix conversion of 0 flag values.
|
||||
|
||||
@@ -93,14 +93,19 @@ namespace System.ComponentModel
|
||||
|
||||
public DefaultValueAttribute (Type type, string value)
|
||||
{
|
||||
#if NET_2_1
|
||||
throw new NotImplementedException ();
|
||||
#else
|
||||
try {
|
||||
#if NET_2_1
|
||||
if (type.IsEnum)
|
||||
DefaultValue = Enum.Parse (type, value);
|
||||
else if (type == typeof (TimeSpan))
|
||||
DefaultValue = TimeSpan.Parse (value);
|
||||
else
|
||||
DefaultValue = Convert.ChangeType (value, type, null);
|
||||
#else
|
||||
TypeConverter converter = TypeDescriptor.GetConverter (type);
|
||||
DefaultValue = converter.ConvertFromString (null, CultureInfo.InvariantCulture, value);
|
||||
} catch { }
|
||||
#endif
|
||||
} catch { }
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
2009-09-29 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* Ping.cs: fix the check for a time-out return value from 'ping'.
|
||||
|
||||
2009-09-24 Zoltan Varga <[email protected]>
|
||||
|
||||
* LinuxNetworkInterfaceMarshal.cs: Add StructLayout attribute to structures, so
|
||||
|
||||
@@ -282,7 +282,7 @@ namespace System.Net.NetworkInformation {
|
||||
#pragma warning restore 219
|
||||
|
||||
trip_time = (long) (DateTime.Now - sentTime).TotalMilliseconds;
|
||||
if (!ping.WaitForExit (timeout) || ping.ExitCode == 2)
|
||||
if (!ping.WaitForExit (timeout) || (ping.HasExited && ping.ExitCode == 2))
|
||||
return new PingReply (address, buffer, options, trip_time, IPStatus.TimedOut);
|
||||
|
||||
if (ping.ExitCode == 1)
|
||||
|
||||
@@ -1,3 +1,33 @@
|
||||
2009-09-28 Sebastien Pouliot <[email protected]>
|
||||
|
||||
* SocketAsyncEventArgs.cs: Default SocketError.AccessDenied on
|
||||
Connect in case none of the DnsEndPoint provides an adequate
|
||||
address (family).
|
||||
[Backport r142746]
|
||||
|
||||
2009-09-27 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* Socket_2_1.cs: Close(int timeout) blocks up to timeout ms if there's
|
||||
pending data to be written to the socket. If there's no pending data,
|
||||
it closes and returns right away. Instead of using Timer and then
|
||||
doing a 'hard' close(), we set the linger option for the socket.
|
||||
|
||||
2009-09-27 Sebastien Pouliot <[email protected]>
|
||||
|
||||
* SocketAsyncEventArgs.cs: Don't use Socket.Poll for NET_2_1.
|
||||
Throw NIE for use of BufferList in Receive.
|
||||
* Socket.cs: Move Close(int) to Socket_2_1.cs. Remove NET_2_1
|
||||
defines since the file is not used by Moonlight
|
||||
* Socket_2_1.cs: Add Close(int) from Socket. Define out Poll
|
||||
and Blocking.
|
||||
[Backport r142722]
|
||||
|
||||
2009-09-26 Sebastien Pouliot <[email protected]>
|
||||
|
||||
* SocketAsyncEventArgs.cs: Fix paramater validations and default
|
||||
values
|
||||
[Backport r142675]
|
||||
|
||||
2009-09-23 Sebastien Pouliot <[email protected]>
|
||||
|
||||
* Socket_2_1.cs: Remove NET_2_1 socket policy checks from here.
|
||||
|
||||
@@ -47,10 +47,8 @@ using System.Text;
|
||||
#if NET_2_0
|
||||
using System.Collections.Generic;
|
||||
using System.Net.NetworkInformation;
|
||||
#if !NET_2_1
|
||||
using System.Timers;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace System.Net.Sockets
|
||||
{
|
||||
@@ -1112,9 +1110,7 @@ namespace System.Net.Sockets
|
||||
sock = Accept_internal(socket, out error, blocking);
|
||||
} catch (ThreadAbortException) {
|
||||
if (disposed) {
|
||||
#if !NET_2_1
|
||||
Thread.ResetAbort ();
|
||||
#endif
|
||||
error = (int) SocketError.Interrupted;
|
||||
}
|
||||
} finally {
|
||||
@@ -1145,9 +1141,7 @@ namespace System.Net.Sockets
|
||||
sock = Accept_internal (socket, out error, blocking);
|
||||
} catch (ThreadAbortException) {
|
||||
if (disposed) {
|
||||
#if !NET_2_1
|
||||
Thread.ResetAbort ();
|
||||
#endif
|
||||
error = (int)SocketError.Interrupted;
|
||||
}
|
||||
} finally {
|
||||
@@ -1763,21 +1757,7 @@ namespace System.Net.Sockets
|
||||
seed_endpoint = local_end;
|
||||
}
|
||||
|
||||
#if NET_2_0 && !NET_2_1
|
||||
public void Close (int timeout)
|
||||
{
|
||||
System.Timers.Timer close_timer = new System.Timers.Timer ();
|
||||
close_timer.Elapsed += new ElapsedEventHandler (OnTimeoutClose);
|
||||
close_timer.Interval = timeout * 1000;
|
||||
close_timer.AutoReset = false;
|
||||
close_timer.Enabled = true;
|
||||
}
|
||||
|
||||
private void OnTimeoutClose (object source, ElapsedEventArgs e)
|
||||
{
|
||||
this.Close ();
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
public bool ConnectAsync (SocketAsyncEventArgs e)
|
||||
{
|
||||
// NO check is made whether e != null in MS.NET (NRE is thrown in such case)
|
||||
|
||||
@@ -82,6 +82,7 @@ namespace System.Net.Sockets
|
||||
public SendPacketsElement[] SendPacketsElements { get; set; }
|
||||
public TransmitFileOptions SendPacketsFlags { get; set; }
|
||||
#endif
|
||||
[MonoTODO ("unused property")]
|
||||
public int SendPacketsSendSize { get; set; }
|
||||
public SocketError SocketError { get; set; }
|
||||
public SocketFlags SocketFlags { get; set; }
|
||||
@@ -124,7 +125,7 @@ namespace System.Net.Sockets
|
||||
SendPacketsElements = null;
|
||||
SendPacketsFlags = TransmitFileOptions.UseDefaultWorkerThread;
|
||||
#endif
|
||||
SendPacketsSendSize = 0;
|
||||
SendPacketsSendSize = -1;
|
||||
SocketError = SocketError.Success;
|
||||
SocketFlags = SocketFlags.None;
|
||||
UserToken = null;
|
||||
@@ -176,15 +177,15 @@ namespace System.Net.Sockets
|
||||
throw new ArgumentException ("Buffer and BufferList properties cannot both be non-null.");
|
||||
|
||||
int buflen = buffer.Length;
|
||||
if (offset < 0 || offset >= buflen)
|
||||
if (offset < 0 || (offset != 0 && offset >= buflen))
|
||||
throw new ArgumentOutOfRangeException ("offset");
|
||||
|
||||
if (count < 0 || count + offset > buflen)
|
||||
if (count < 0 || count > buflen - offset)
|
||||
throw new ArgumentOutOfRangeException ("count");
|
||||
}
|
||||
|
||||
Count = count;
|
||||
Offset = offset;
|
||||
Count = count;
|
||||
Offset = offset;
|
||||
}
|
||||
Buffer = buffer;
|
||||
}
|
||||
|
||||
@@ -212,7 +213,7 @@ namespace System.Net.Sockets
|
||||
void ConnectCallback ()
|
||||
{
|
||||
LastOperation = SocketAsyncOperation.Connect;
|
||||
SocketError error = SocketError.Success;
|
||||
SocketError error = SocketError.AccessDenied;
|
||||
try {
|
||||
#if NET_2_1 && !MONOTOUCH
|
||||
// Connect to the first address that match the host name, like:
|
||||
@@ -259,6 +260,7 @@ namespace System.Net.Sockets
|
||||
}
|
||||
#endif
|
||||
try {
|
||||
#if !NET_2_1
|
||||
if (!curSocket.Blocking) {
|
||||
int success;
|
||||
curSocket.Poll (-1, SelectMode.SelectWrite, out success);
|
||||
@@ -267,7 +269,9 @@ namespace System.Net.Sockets
|
||||
curSocket.Connected = true;
|
||||
else
|
||||
return error;
|
||||
} else {
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
curSocket.seed_endpoint = endpoint;
|
||||
curSocket.Connect (endpoint);
|
||||
curSocket.Connected = true;
|
||||
@@ -343,7 +347,11 @@ namespace System.Net.Sockets
|
||||
|
||||
try {
|
||||
EndPoint ep = RemoteEndPoint;
|
||||
BytesTransferred = curSocket.ReceiveFrom_nochecks (Buffer, Offset, Count, SocketFlags, ref ep);
|
||||
if (Buffer != null) {
|
||||
BytesTransferred = curSocket.ReceiveFrom_nochecks (Buffer, Offset, Count, SocketFlags, ref ep);
|
||||
} else if (BufferList != null) {
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
} catch (SocketException ex) {
|
||||
SocketError = ex.SocketErrorCode;
|
||||
throw;
|
||||
|
||||
@@ -51,7 +51,6 @@ using System.Net.Configuration;
|
||||
using System.Collections.Generic;
|
||||
#if !NET_2_1
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Timers;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -64,6 +63,7 @@ namespace System.Net.Sockets {
|
||||
* their name without also updating the runtime code.
|
||||
*/
|
||||
private static int ipv4Supported = -1, ipv6Supported = -1;
|
||||
int linger_timeout;
|
||||
|
||||
static Socket ()
|
||||
{
|
||||
@@ -227,6 +227,7 @@ namespace System.Net.Sockets {
|
||||
bool block,
|
||||
out int error);
|
||||
#endif
|
||||
#if !NET_2_1
|
||||
public bool Blocking {
|
||||
get {
|
||||
return(blocking);
|
||||
@@ -245,7 +246,7 @@ namespace System.Net.Sockets {
|
||||
blocking=value;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
public bool Connected {
|
||||
get { return connected; }
|
||||
internal set { connected = value; }
|
||||
@@ -381,6 +382,35 @@ namespace System.Net.Sockets {
|
||||
}
|
||||
}
|
||||
|
||||
void Linger (IntPtr handle)
|
||||
{
|
||||
if (linger_timeout <= 0)
|
||||
return;
|
||||
|
||||
// We don't want to receive any more data
|
||||
int error;
|
||||
Shutdown_internal (handle, SocketShutdown.Receive, out error);
|
||||
if (error != 0)
|
||||
return;
|
||||
|
||||
int seconds = linger_timeout / 1000;
|
||||
int ms = linger_timeout % 1000;
|
||||
if (ms > 0) {
|
||||
// If the other end closes, this will return 'true' with 'Available' == 0
|
||||
Poll_internal (handle, SelectMode.SelectRead, ms * 1000, out error);
|
||||
if (error != 0)
|
||||
return;
|
||||
|
||||
}
|
||||
if (seconds > 0) {
|
||||
LingerOption linger = new LingerOption (true, seconds);
|
||||
SetSocketOption_internal (handle, SocketOptionLevel.Socket, SocketOptionName.Linger, linger, null, 0, out error);
|
||||
/* Not needed, we're closing upon return */
|
||||
/*if (error != 0)
|
||||
return; */
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void Dispose (bool explicitDisposing)
|
||||
{
|
||||
if (disposed)
|
||||
@@ -393,7 +423,10 @@ namespace System.Net.Sockets {
|
||||
closed = true;
|
||||
IntPtr x = socket;
|
||||
socket = (IntPtr) (-1);
|
||||
Linger (x);
|
||||
//DateTime start = DateTime.UtcNow;
|
||||
Close_internal (x, out error);
|
||||
//Console.WriteLine ("Time spent in Close_internal: {0}ms\n{1}", (DateTime.UtcNow - start).TotalMilliseconds, Environment.StackTrace);
|
||||
if (blocking_thread != null) {
|
||||
blocking_thread.Abort ();
|
||||
blocking_thread = null;
|
||||
@@ -419,9 +452,18 @@ namespace System.Net.Sockets {
|
||||
|
||||
public void Close ()
|
||||
{
|
||||
linger_timeout = 0;
|
||||
((IDisposable) this).Dispose ();
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
public void Close (int timeout)
|
||||
{
|
||||
linger_timeout = timeout;
|
||||
((IDisposable) this).Dispose ();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Connects to the remote address
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
private extern static void Connect_internal(IntPtr sock,
|
||||
@@ -519,6 +561,7 @@ namespace System.Net.Sockets {
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
extern static bool Poll_internal (IntPtr socket, SelectMode mode, int timeout, out int error);
|
||||
|
||||
#if !NET_2_1
|
||||
/* This overload is needed as the async Connect method
|
||||
* also needs to check the socket error status, but
|
||||
* getsockopt(..., SO_ERROR) clears the error.
|
||||
@@ -553,7 +596,7 @@ namespace System.Net.Sockets {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
private extern static int Receive_internal(IntPtr sock,
|
||||
byte[] buffer,
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2009-09-29 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* EndPointListener.cs: fix matching a listener in presence of a query
|
||||
string or anchor.
|
||||
|
||||
2009-09-15 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* HttpListenerRequest.cs: add the right status code.
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace System.Net {
|
||||
{
|
||||
HttpListenerRequest req = context.Request;
|
||||
ListenerPrefix prefix;
|
||||
HttpListener listener = SearchListener (req.UserHostName, req.RawUrl, out prefix);
|
||||
HttpListener listener = SearchListener (req.UserHostName, req.Url, out prefix);
|
||||
if (listener == null)
|
||||
return false;
|
||||
|
||||
@@ -131,15 +131,15 @@ namespace System.Net {
|
||||
|
||||
HttpListenerRequest req = context.Request;
|
||||
ListenerPrefix prefix;
|
||||
HttpListener listener = SearchListener (req.UserHostName, req.RawUrl, out prefix);
|
||||
HttpListener listener = SearchListener (req.UserHostName, req.Url, out prefix);
|
||||
if (listener != null)
|
||||
listener.UnregisterContext (context);
|
||||
}
|
||||
|
||||
HttpListener SearchListener (string host, string raw_url, out ListenerPrefix prefix)
|
||||
HttpListener SearchListener (string host, Uri uri, out ListenerPrefix prefix)
|
||||
{
|
||||
prefix = null;
|
||||
if (raw_url == null)
|
||||
if (uri == null)
|
||||
return null;
|
||||
|
||||
//TODO: We should use a ReaderWriterLock between this and the add/remove operations.
|
||||
@@ -149,13 +149,7 @@ namespace System.Net {
|
||||
host = host.Substring (0, colon);
|
||||
}
|
||||
|
||||
string path;
|
||||
Uri raw_uri;
|
||||
if (Uri.MaybeUri (raw_url) && Uri.TryCreate (raw_url, UriKind.Absolute, out raw_uri))
|
||||
path = raw_uri.PathAndQuery;
|
||||
else
|
||||
path = HttpUtility.UrlDecode (raw_url);
|
||||
|
||||
string path = HttpUtility.UrlDecode (uri.AbsolutePath);
|
||||
string path_slash = path [path.Length - 1] == '/' ? path : path + "/";
|
||||
|
||||
HttpListener best_match = null;
|
||||
|
||||
@@ -1,3 +1,14 @@
|
||||
2009-09-29 Sebastien Pouliot <[email protected]>
|
||||
|
||||
* Timer_2_1.cs: Removed. No longer needed by Moonlight
|
||||
[Backport r142853]
|
||||
|
||||
2009-09-27 Sebastien Pouliot <[email protected]>
|
||||
|
||||
* Timer_2_1.cs: New. A smaller, internal subset of Timer for
|
||||
Moonlight - needed for Socket.Close(int)
|
||||
[Backport of r142718]
|
||||
|
||||
2009-09-24 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* Timer.cs: lock access to the 'timer' field. Attemp to fix bug
|
||||
|
||||
@@ -230,6 +230,7 @@ System.Net.Sockets/NetworkStreamTest.cs
|
||||
System.Net.Sockets/TcpClientTest.cs
|
||||
System.Net.Sockets/TcpListenerTest.cs
|
||||
System.Net.Sockets/SocketTest.cs
|
||||
System.Net.Sockets/SocketAsyncEventArgsTest.cs
|
||||
System.Net.Sockets/UdpClientTest.cs
|
||||
System.Net.Mail/LinkedResourceTest.cs
|
||||
System.Net.Mail/AttachmentCollectionTest.cs
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// Authors:
|
||||
// Alan McGovern <[email protected]>
|
||||
//
|
||||
// Copyright (C) 2009 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.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTests.System.ComponentModel {
|
||||
|
||||
[TestFixture]
|
||||
public class CategoryAttributeTest {
|
||||
|
||||
[Test]
|
||||
public static void CategoryNamesTest()
|
||||
{
|
||||
Assert.AreEqual(CategoryAttribute.Action.Category, "Action", "#1");
|
||||
Assert.AreEqual(CategoryAttribute.Appearance.Category, "Appearance", "#2");
|
||||
Assert.AreEqual(CategoryAttribute.Asynchronous.Category, "Asynchronous", "#3");
|
||||
Assert.AreEqual(CategoryAttribute.Behavior.Category, "Behavior", "#4");
|
||||
Assert.AreEqual(CategoryAttribute.Data.Category, "Data", "#5");
|
||||
Assert.AreEqual(CategoryAttribute.Design.Category, "Design", "#6");
|
||||
Assert.AreEqual(CategoryAttribute.Focus.Category, "Focus", "#7");
|
||||
Assert.AreEqual(CategoryAttribute.Format.Category, "Format", "#8");
|
||||
Assert.AreEqual(CategoryAttribute.Key.Category, "Key", "#9");
|
||||
Assert.AreEqual(CategoryAttribute.Layout.Category, "Layout", "#10");
|
||||
Assert.AreEqual(CategoryAttribute.Mouse.Category, "Mouse", "#11");
|
||||
#if NET_2_1
|
||||
Assert.AreEqual(CategoryAttribute.Default.Category, "Default", "#12");
|
||||
Assert.AreEqual(CategoryAttribute.DragDrop.Category, "DragDrop", "#13");
|
||||
Assert.AreEqual(CategoryAttribute.WindowStyle.Category, "WindowStyle", "#14");
|
||||
#else
|
||||
Assert.AreEqual(CategoryAttribute.Default.Category, "Misc", "#12");
|
||||
Assert.AreEqual(CategoryAttribute.DragDrop.Category, "Drag Drop", "#13");
|
||||
Assert.AreEqual(CategoryAttribute.WindowStyle.Category, "Window Style", "#14");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,7 @@
|
||||
2009-09-29 Alan McGovern <[email protected]>
|
||||
|
||||
* CategoryAttributeTest.cs: Added new test file.
|
||||
|
||||
2009-09-24 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* EnumConverterTests.cs: Add a test to verify behaviour when converting
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2009-09-26 Sebastien Pouliot <[email protected]>
|
||||
|
||||
* SocketAsyncEventArgsTest.cs: New. Unit tests
|
||||
[Backport r142675]
|
||||
|
||||
2009-06-28 Gert Driesen <[email protected]>
|
||||
|
||||
* SocketTest.cs: Added tests for argument checks, and improved tests
|
||||
|
||||
@@ -0,0 +1,253 @@
|
||||
//
|
||||
// SocketAsyncEventArgsTest.cs - NUnit Test Cases for SocketAsyncEventArgs
|
||||
//
|
||||
// Author:
|
||||
// Sebastien Pouliot ([email protected])
|
||||
//
|
||||
// Copyright (C) 2009 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.Net.Sockets;
|
||||
using System.Text;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTests.System.Net.Sockets {
|
||||
|
||||
[TestFixture]
|
||||
public class SocketAsyncEventArgsTest {
|
||||
|
||||
[Test]
|
||||
public void Defaults ()
|
||||
{
|
||||
SocketAsyncEventArgs saea = new SocketAsyncEventArgs ();
|
||||
Assert.IsNull (saea.AcceptSocket, "AcceptSocket");
|
||||
Assert.IsNull (saea.Buffer, "Buffer");
|
||||
Assert.IsNull (saea.BufferList, "BufferList");
|
||||
Assert.AreEqual (0, saea.BytesTransferred, "BytesTransferred");
|
||||
Assert.AreEqual (0, saea.Count, "Count");
|
||||
Assert.IsFalse (saea.DisconnectReuseSocket, "DisconnectReuseSocket");
|
||||
Assert.AreEqual (SocketAsyncOperation.None, saea.LastOperation, "LastOperation");
|
||||
Assert.AreEqual (0, saea.Offset, "Offset");
|
||||
Assert.IsNotNull (saea.ReceiveMessageFromPacketInfo, "ReceiveMessageFromPacketInfo");
|
||||
Assert.IsNull (saea.RemoteEndPoint, "RemoteEndPoint");
|
||||
Assert.IsNull (saea.SendPacketsElements, "SendPacketsElements");
|
||||
Assert.AreEqual (TransmitFileOptions.UseDefaultWorkerThread, saea.SendPacketsFlags, "SendPacketsFlags");
|
||||
Assert.AreEqual (-1, saea.SendPacketsSendSize, "SendPacketsSendSize");
|
||||
Assert.AreEqual (SocketError.Success, saea.SocketError, "SocketError");
|
||||
Assert.AreEqual (SocketFlags.None, saea.SocketFlags, "SocketFlags");
|
||||
Assert.IsNull (saea.UserToken, "UserToken");
|
||||
|
||||
saea.Dispose ();
|
||||
saea.Dispose (); // twice
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SetBuffer_ByteArray ()
|
||||
{
|
||||
SocketAsyncEventArgs saea = new SocketAsyncEventArgs ();
|
||||
|
||||
byte [] buffer = new byte [0];
|
||||
saea.SetBuffer (buffer, 0, 0);
|
||||
Assert.AreEqual (0, saea.Buffer.Length, "0");
|
||||
Assert.AreSame (saea.Buffer, buffer, "same");
|
||||
|
||||
saea.SetBuffer (null, 0, 0);
|
||||
Assert.IsNull (saea.Buffer, "null");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void SetBuffer_BufferList_ByteArray ()
|
||||
{
|
||||
SocketAsyncEventArgs saea = new SocketAsyncEventArgs ();
|
||||
saea.BufferList = new List<ArraySegment<byte>> ();
|
||||
saea.SetBuffer (new byte [0], 0, 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SetBuffer_BufferList_NullByteArray ()
|
||||
{
|
||||
SocketAsyncEventArgs saea = new SocketAsyncEventArgs ();
|
||||
saea.BufferList = new List<ArraySegment<byte>> ();
|
||||
saea.SetBuffer (null, 0, 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void SetBuffer_ByteArray_BufferList ()
|
||||
{
|
||||
SocketAsyncEventArgs saea = new SocketAsyncEventArgs ();
|
||||
saea.SetBuffer (new byte [0], 0, 0);
|
||||
saea.BufferList = new List<ArraySegment<byte>> ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SetBuffer_NullByteArray_BufferList ()
|
||||
{
|
||||
SocketAsyncEventArgs saea = new SocketAsyncEventArgs ();
|
||||
saea.SetBuffer (null, 0, 0);
|
||||
saea.BufferList = new List<ArraySegment<byte>> ();
|
||||
Assert.IsNull (saea.Buffer, "Buffer");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentOutOfRangeException))]
|
||||
public void SetBuffer_ByteArray_StartNegative ()
|
||||
{
|
||||
SocketAsyncEventArgs saea = new SocketAsyncEventArgs ();
|
||||
saea.SetBuffer (new byte [10], -1, 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SetBuffer_Null_StartNegative ()
|
||||
{
|
||||
SocketAsyncEventArgs saea = new SocketAsyncEventArgs ();
|
||||
saea.SetBuffer (null, -1, 0);
|
||||
Assert.IsNull (saea.Buffer, "Buffer");
|
||||
Assert.IsNull (saea.BufferList, "BufferList");
|
||||
Assert.AreEqual (0, saea.Count, "Count");
|
||||
Assert.AreEqual (0, saea.Offset, "Offset");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentOutOfRangeException))]
|
||||
public void SetBuffer_ByteArray_CountNegative ()
|
||||
{
|
||||
SocketAsyncEventArgs saea = new SocketAsyncEventArgs ();
|
||||
saea.SetBuffer (new byte [10], 1, -1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SetBuffer_BufferList ()
|
||||
{
|
||||
SocketAsyncEventArgs saea = new SocketAsyncEventArgs ();
|
||||
saea.BufferList = new List<ArraySegment<byte>> ();
|
||||
saea.SetBuffer (1, -1);
|
||||
saea.SetBuffer (-1, 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SetBuffer_Null_CountNegative ()
|
||||
{
|
||||
SocketAsyncEventArgs saea = new SocketAsyncEventArgs ();
|
||||
saea.SetBuffer (null, 1, -1);
|
||||
Assert.IsNull (saea.Buffer, "Buffer");
|
||||
Assert.IsNull (saea.BufferList, "BufferList");
|
||||
Assert.AreEqual (0, saea.Count, "Count");
|
||||
Assert.AreEqual (0, saea.Offset, "Offset");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentOutOfRangeException))]
|
||||
public void SetBuffer_ByteArray_StartOverflow ()
|
||||
{
|
||||
SocketAsyncEventArgs saea = new SocketAsyncEventArgs ();
|
||||
saea.SetBuffer (new byte [10], Int32.MaxValue, 1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SetBuffer_Null_StartOverflow ()
|
||||
{
|
||||
SocketAsyncEventArgs saea = new SocketAsyncEventArgs ();
|
||||
saea.SetBuffer (null, Int32.MaxValue, 1);
|
||||
Assert.IsNull (saea.Buffer, "Buffer");
|
||||
Assert.IsNull (saea.BufferList, "BufferList");
|
||||
Assert.AreEqual (0, saea.Count, "Count");
|
||||
Assert.AreEqual (0, saea.Offset, "Offset");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentOutOfRangeException))]
|
||||
public void SetBuffer_ByteArray_CountOverflow ()
|
||||
{
|
||||
SocketAsyncEventArgs saea = new SocketAsyncEventArgs ();
|
||||
saea.SetBuffer (new byte [10], 1, Int32.MaxValue);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SetBuffer_Null_CountOverflow ()
|
||||
{
|
||||
SocketAsyncEventArgs saea = new SocketAsyncEventArgs ();
|
||||
saea.SetBuffer (null, 1, Int32.MaxValue);
|
||||
Assert.IsNull (saea.Buffer, "Buffer");
|
||||
Assert.IsNull (saea.BufferList, "BufferList");
|
||||
Assert.AreEqual (0, saea.Count, "Count");
|
||||
Assert.AreEqual (0, saea.Offset, "Offset");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentOutOfRangeException))]
|
||||
public void SetBuffer_StartNegative ()
|
||||
{
|
||||
SocketAsyncEventArgs saea = new SocketAsyncEventArgs ();
|
||||
saea.SetBuffer (new byte [0], 0, 0);
|
||||
saea.SetBuffer (-1, 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentOutOfRangeException))]
|
||||
public void SetBuffer_CountNegative ()
|
||||
{
|
||||
SocketAsyncEventArgs saea = new SocketAsyncEventArgs ();
|
||||
saea.SetBuffer (new byte [10], 1, -1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentOutOfRangeException))]
|
||||
public void SetBuffer_StartOverflow ()
|
||||
{
|
||||
SocketAsyncEventArgs saea = new SocketAsyncEventArgs ();
|
||||
saea.SetBuffer (new byte [10], Int32.MaxValue, 1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentOutOfRangeException))]
|
||||
public void SetBuffer_CountOverflow ()
|
||||
{
|
||||
SocketAsyncEventArgs saea = new SocketAsyncEventArgs ();
|
||||
saea.SetBuffer (new byte [10], 1, Int32.MaxValue);
|
||||
}
|
||||
|
||||
class SocketAsyncEventArgsPoker : SocketAsyncEventArgs {
|
||||
|
||||
public void OnCompleted_ (SocketAsyncEventArgs e)
|
||||
{
|
||||
base.OnCompleted (e);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OnCompleted_Null ()
|
||||
{
|
||||
SocketAsyncEventArgsPoker saea = new SocketAsyncEventArgsPoker ();
|
||||
saea.OnCompleted_ (null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -142,6 +142,11 @@ public class AsyncResult : IAsyncResult, IMessageSink {
|
||||
|
||||
internal IMessage EndInvoke ()
|
||||
{
|
||||
lock (this) {
|
||||
if (completed)
|
||||
return reply_message;
|
||||
}
|
||||
|
||||
AsyncWaitHandle.WaitOne ();
|
||||
return reply_message;
|
||||
}
|
||||
@@ -152,7 +157,8 @@ public class AsyncResult : IAsyncResult, IMessageSink {
|
||||
|
||||
lock (this) {
|
||||
completed = true;
|
||||
((ManualResetEvent) AsyncWaitHandle).Set ();
|
||||
if (handle != null)
|
||||
((ManualResetEvent) AsyncWaitHandle).Set ();
|
||||
}
|
||||
|
||||
if (async_callback != null) {
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
2009-09-29 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* AsyncResult.cs: do not create the handle if not needed.
|
||||
|
||||
2009-09-27 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* AsyncResult.cs: don't create the handle if we know the result is
|
||||
completed.
|
||||
|
||||
2009-09-12 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* AsyncResult.cs: lock when setting the 'completed' field and use the
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
2009-09-27 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* RealProxy.cs: for a custom proxy, retrieve the OutArgs before
|
||||
allowing EndInvoke to proceed because after that, OutArgs will throw
|
||||
because there is no method. Fixes remoting2 and remoting3 tests.
|
||||
|
||||
2009-05-06 Lluis Sanchez Gual <[email protected]>
|
||||
|
||||
* RealProxy.cs: If async dispatch crashes, don't propagate the
|
||||
|
||||
@@ -169,6 +169,7 @@ namespace System.Runtime.Remoting.Proxies
|
||||
CallType call_type = mMsg.CallType;
|
||||
bool is_remproxy = (rp is RemotingProxy);
|
||||
|
||||
out_args = null;
|
||||
IMethodReturnMessage res_msg = null;
|
||||
|
||||
if (call_type == CallType.BeginInvoke)
|
||||
@@ -214,6 +215,7 @@ namespace System.Runtime.Remoting.Proxies
|
||||
|
||||
// allow calltype EndInvoke to finish
|
||||
asyncMsg = mMsg.AsyncResult.SyncProcessMessage (res_msg as IMessage);
|
||||
out_args = res_msg.OutArgs;
|
||||
res_msg = new ReturnMessage (asyncMsg, null, 0, null, res_msg as IMethodCallMessage);
|
||||
}
|
||||
}
|
||||
@@ -229,7 +231,8 @@ namespace System.Runtime.Remoting.Proxies
|
||||
throw exc.FixRemotingException();
|
||||
}
|
||||
else if (res_msg is IConstructionReturnMessage || mMsg.CallType == CallType.BeginInvoke) {
|
||||
out_args = res_msg.OutArgs;
|
||||
if (out_args == null)
|
||||
out_args = res_msg.OutArgs;
|
||||
}
|
||||
else if (mMsg.CallType == CallType.Sync) {
|
||||
out_args = ProcessResponse (res_msg, mMsg);
|
||||
@@ -238,7 +241,8 @@ namespace System.Runtime.Remoting.Proxies
|
||||
out_args = ProcessResponse (res_msg, mMsg.AsyncResult.CallMessage);
|
||||
}
|
||||
else {
|
||||
out_args = res_msg.OutArgs;
|
||||
if (out_args == null)
|
||||
out_args = res_msg.OutArgs;
|
||||
}
|
||||
|
||||
return res_msg.ReturnValue;
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
2009-09-29 Rolf Bjarne Kvinge <[email protected]>
|
||||
|
||||
* Thread.cs: StartSafe: ignore ThreadAbortExceptions.
|
||||
|
||||
Backport of r142847.
|
||||
|
||||
2009-09-27 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* Timer.cs: account for the time spent sending jobs to the queue.
|
||||
|
||||
2009-09-24 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* Timer.cs: no need to wake up the scheduler when removing the next
|
||||
|
||||
@@ -770,6 +770,8 @@ namespace System.Threading {
|
||||
} else {
|
||||
((ParameterizedThreadStart) threadstart) (start_obj);
|
||||
}
|
||||
} catch (ThreadAbortException) {
|
||||
// do nothing
|
||||
} catch (Exception ex) {
|
||||
MoonlightUnhandledException (ex);
|
||||
}
|
||||
|
||||
@@ -330,7 +330,7 @@ namespace System.Threading
|
||||
//PrintList ();
|
||||
int ms_wait = -1;
|
||||
if (min_next_run != Int64.MaxValue) {
|
||||
long diff = min_next_run - ticks;
|
||||
long diff = min_next_run - DateTime.GetTimeMonotonic ();
|
||||
ms_wait = (int)(diff / TimeSpan.TicksPerMillisecond);
|
||||
if (ms_wait < 0)
|
||||
ms_wait = 0;
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
2009-09-28 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* Console.cs : do not use codepage 28591. It breaks build on
|
||||
Japanese Windows.
|
||||
|
||||
2009-09-27 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* TermInfoDriver.cs: avoid segv if the pointer is not properly
|
||||
initialized.
|
||||
|
||||
2009-09-24 Zoltan Varga <[email protected]>
|
||||
|
||||
* Type.cs: Initialize the Missing field.
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace System
|
||||
//
|
||||
#if NET_2_1
|
||||
// should never happen since Moonlight does not run on windows
|
||||
inputEncoding = outputEncoding = Encoding.GetEncoding (28591);
|
||||
inputEncoding = outputEncoding = Encoding.Default;
|
||||
#else
|
||||
try {
|
||||
inputEncoding = Encoding.GetEncoding (WindowsConsole.GetInputCodePage ());
|
||||
@@ -95,7 +95,7 @@ namespace System
|
||||
} catch {
|
||||
// FIXME: I18N assemblies are not available when compiling mcs
|
||||
// Use Latin 1 as it is fast and UTF-8 is never used as console code page
|
||||
inputEncoding = outputEncoding = Encoding.GetEncoding (28591);
|
||||
inputEncoding = outputEncoding = Encoding.Default;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
|
||||
@@ -718,10 +718,9 @@ namespace System {
|
||||
if (!inited)
|
||||
Init ();
|
||||
|
||||
if (terminal_size == *native_terminal_size)
|
||||
if (native_terminal_size == null || terminal_size == *native_terminal_size)
|
||||
return;
|
||||
|
||||
terminal_size = *native_terminal_size;
|
||||
if (*native_terminal_size == -1){
|
||||
int c = reader.Get (TermInfoNumbers.Columns);
|
||||
if (c != 0)
|
||||
@@ -731,6 +730,7 @@ namespace System {
|
||||
if (c != 0)
|
||||
windowHeight = c;
|
||||
} else {
|
||||
terminal_size = *native_terminal_size;
|
||||
windowWidth = terminal_size >> 16;
|
||||
windowHeight = terminal_size & 0xffff;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,20 @@
|
||||
2009-09-29 Ankit Jain <[email protected]>
|
||||
|
||||
* SolutionParser.cs (Insert): Show project name in case of a cyclic
|
||||
dependency.
|
||||
|
||||
2009-09-27 Ankit Jain <[email protected]>
|
||||
|
||||
* SolutionParser.cs: Implement support for WebSite projects. These
|
||||
projects lack a project file, so properties like references are read
|
||||
from the .sln file, and targets are generated for build/clean etc.
|
||||
|
||||
2009-09-26 Ankit Jain <[email protected]>
|
||||
|
||||
* xbuild/Microsoft.Common.targets: Remove _ValidateEssentialProperties
|
||||
from BuildDependsOn, which was a hack. It will get invoked from the
|
||||
InitialTargets now.
|
||||
|
||||
2009-09-25 Ankit Jain <[email protected]>
|
||||
|
||||
* Makefile(EXTRA_DISTFILES): Add Microsoft.WebApplication.targets
|
||||
|
||||
@@ -41,6 +41,7 @@ namespace Mono.XBuild.CommandLine {
|
||||
class ProjectInfo {
|
||||
public string Name;
|
||||
public string FileName;
|
||||
public Guid Guid;
|
||||
|
||||
public ProjectInfo (string name, string fileName)
|
||||
{
|
||||
@@ -50,6 +51,18 @@ namespace Mono.XBuild.CommandLine {
|
||||
|
||||
public Dictionary<TargetInfo, TargetInfo> TargetMap = new Dictionary<TargetInfo, TargetInfo> ();
|
||||
public Dictionary<Guid, ProjectInfo> Dependencies = new Dictionary<Guid, ProjectInfo> ();
|
||||
public Dictionary<string, ProjectSection> ProjectSections = new Dictionary<string, ProjectSection> ();
|
||||
public List<string> AspNetConfigurations = new List<string> ();
|
||||
}
|
||||
|
||||
class ProjectSection {
|
||||
public string Name;
|
||||
public Dictionary<string, string> Properties = new Dictionary<string, string> ();
|
||||
|
||||
public ProjectSection (string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
}
|
||||
|
||||
struct TargetInfo {
|
||||
@@ -81,6 +94,7 @@ namespace Mono.XBuild.CommandLine {
|
||||
static Regex projectRegex = new Regex ("Project\\(\"(" + guidExpression + ")\"\\) = \"(.*?)\", \"(.*?)\", \"(" + guidExpression + ")\"(\\s*?)((\\s*?)ProjectSection\\((.*?)\\) = (.*?)EndProjectSection(\\s*?))*(\\s*?)EndProject?", RegexOptions.Singleline);
|
||||
static Regex projectDependenciesRegex = new Regex ("ProjectSection\\((.*?)\\) = \\w*(.*?)EndProjectSection", RegexOptions.Singleline);
|
||||
static Regex projectDependencyRegex = new Regex ("\\s*(" + guidExpression + ") = (" + guidExpression + ")");
|
||||
static Regex projectSectionPropertiesRegex = new Regex ("\\s*(?<name>.*) = \"(?<value>.*)\"");
|
||||
|
||||
static Regex globalRegex = new Regex ("Global(.*)EndGlobal", RegexOptions.Singleline);
|
||||
static Regex globalSectionRegex = new Regex ("GlobalSection\\((.*?)\\) = \\w*(.*?)EndGlobalSection", RegexOptions.Singleline);
|
||||
@@ -91,6 +105,7 @@ namespace Mono.XBuild.CommandLine {
|
||||
|
||||
static string solutionFolderGuid = "{2150E333-8FDC-42A3-9474-1A3956D46DE8}";
|
||||
static string vcprojGuid = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}";
|
||||
static string websiteProjectGuid = "{E24C65DC-7377-472B-9ABA-BC803B73C61A}";
|
||||
|
||||
RaiseWarningHandler RaiseWarning;
|
||||
|
||||
@@ -106,6 +121,8 @@ namespace Mono.XBuild.CommandLine {
|
||||
|
||||
List<TargetInfo> solutionTargets = new List<TargetInfo> ();
|
||||
Dictionary<Guid, ProjectInfo> projectInfos = new Dictionary<Guid, ProjectInfo> ();
|
||||
Dictionary<Guid, ProjectInfo> websiteProjectInfos = new Dictionary<Guid, ProjectInfo> ();
|
||||
List<ProjectInfo>[] infosByLevel = null;
|
||||
|
||||
Match m = projectRegex.Match (line);
|
||||
while (m.Success) {
|
||||
@@ -116,6 +133,7 @@ namespace Mono.XBuild.CommandLine {
|
||||
m = m.NextMatch ();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (String.Compare (m.Groups [1].Value, vcprojGuid,
|
||||
StringComparison.InvariantCultureIgnoreCase) == 0) {
|
||||
// Ignore vcproj
|
||||
@@ -124,16 +142,37 @@ namespace Mono.XBuild.CommandLine {
|
||||
continue;
|
||||
}
|
||||
|
||||
projectInfos.Add (new Guid (m.Groups[4].Value), projectInfo);
|
||||
if (String.Compare (m.Groups [1].Value, websiteProjectGuid,
|
||||
StringComparison.InvariantCultureIgnoreCase) == 0)
|
||||
websiteProjectInfos.Add (new Guid (m.Groups[4].Value), projectInfo);
|
||||
else
|
||||
projectInfos.Add (new Guid (m.Groups[4].Value), projectInfo);
|
||||
|
||||
projectInfo.Guid = new Guid (m.Groups [4].Value);
|
||||
|
||||
Match projectSectionMatch = projectDependenciesRegex.Match (m.Groups[6].Value);
|
||||
while (projectSectionMatch.Success) {
|
||||
Match projectDependencyMatch = projectDependencyRegex.Match (projectSectionMatch.Value);
|
||||
while (projectDependencyMatch.Success) {
|
||||
// we might not have projectInfo available right now, so
|
||||
// set it to null, and fill it in later
|
||||
projectInfo.Dependencies [new Guid (projectDependencyMatch.Groups[1].Value)] = null;
|
||||
projectDependencyMatch = projectDependencyMatch.NextMatch ();
|
||||
string section_name = projectSectionMatch.Groups [1].Value;
|
||||
if (String.Compare (section_name, "ProjectDependencies") == 0) {
|
||||
Match projectDependencyMatch = projectDependencyRegex.Match (projectSectionMatch.Value);
|
||||
while (projectDependencyMatch.Success) {
|
||||
// we might not have projectInfo available right now, so
|
||||
// set it to null, and fill it in later
|
||||
projectInfo.Dependencies [new Guid (projectDependencyMatch.Groups[1].Value)] = null;
|
||||
projectDependencyMatch = projectDependencyMatch.NextMatch ();
|
||||
}
|
||||
} else {
|
||||
ProjectSection section = new ProjectSection (section_name);
|
||||
Match propertiesMatch = projectSectionPropertiesRegex.Match (
|
||||
projectSectionMatch.Groups [2].Value);
|
||||
while (propertiesMatch.Success) {
|
||||
section.Properties [propertiesMatch.Groups ["name"].Value] =
|
||||
propertiesMatch.Groups ["value"].Value;
|
||||
|
||||
propertiesMatch = propertiesMatch.NextMatch ();
|
||||
}
|
||||
|
||||
projectInfo.ProjectSections [section_name] = section;
|
||||
}
|
||||
projectSectionMatch = projectSectionMatch.NextMatch ();
|
||||
}
|
||||
@@ -181,7 +220,8 @@ namespace Mono.XBuild.CommandLine {
|
||||
ParseSolutionConfigurationPlatforms (globalSectionMatch.Groups[2].Value, solutionTargets);
|
||||
break;
|
||||
case "ProjectConfigurationPlatforms":
|
||||
ParseProjectConfigurationPlatforms (globalSectionMatch.Groups[2].Value, projectInfos);
|
||||
ParseProjectConfigurationPlatforms (globalSectionMatch.Groups[2].Value,
|
||||
projectInfos, websiteProjectInfos);
|
||||
break;
|
||||
case "SolutionProperties":
|
||||
ParseSolutionProperties (globalSectionMatch.Groups[2].Value);
|
||||
@@ -195,12 +235,16 @@ namespace Mono.XBuild.CommandLine {
|
||||
globalSectionMatch = globalSectionMatch.NextMatch ();
|
||||
}
|
||||
|
||||
int num_levels = AddBuildLevels (p, solutionTargets, projectInfos);
|
||||
int num_levels = AddBuildLevels (p, solutionTargets, projectInfos, ref infosByLevel);
|
||||
|
||||
AddCurrentSolutionConfigurationContents (p, solutionTargets, projectInfos);
|
||||
AddCurrentSolutionConfigurationContents (p, solutionTargets, projectInfos, websiteProjectInfos);
|
||||
AddWebsiteProperties (p, websiteProjectInfos, projectInfos);
|
||||
AddValidateSolutionConfiguration (p);
|
||||
|
||||
AddGetFrameworkPathTarget (p);
|
||||
AddWebsiteTargets (p, websiteProjectInfos, projectInfos, infosByLevel, solutionTargets);
|
||||
AddProjectTargets (p, solutionTargets, projectInfos);
|
||||
AddSolutionTargets (p, num_levels);
|
||||
AddSolutionTargets (p, num_levels, websiteProjectInfos.Values);
|
||||
}
|
||||
|
||||
void AddGeneralSettings (string solutionFile, Project p)
|
||||
@@ -210,10 +254,6 @@ namespace Mono.XBuild.CommandLine {
|
||||
p.AddNewUsingTaskFromAssemblyName ("CreateTemporaryVCProject", "Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
|
||||
p.AddNewUsingTaskFromAssemblyName ("ResolveVCProjectOutput", "Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
|
||||
|
||||
BuildPropertyGroup aspNetConfigurationPropertyGroup = p.AddNewPropertyGroup (true);
|
||||
aspNetConfigurationPropertyGroup.Condition = " ('$(AspNetConfiguration)' == '') ";
|
||||
aspNetConfigurationPropertyGroup.AddNewProperty ("AspNetConfiguration", "$(Configuration)");
|
||||
|
||||
string solutionFilePath = Path.GetFullPath (solutionFile);
|
||||
BuildPropertyGroup solutionPropertyGroup = p.AddNewPropertyGroup (true);
|
||||
solutionPropertyGroup.AddNewProperty ("SolutionDir", Path.GetDirectoryName (solutionFilePath) + Path.DirectorySeparatorChar);
|
||||
@@ -234,7 +274,9 @@ namespace Mono.XBuild.CommandLine {
|
||||
}
|
||||
}
|
||||
|
||||
void ParseProjectConfigurationPlatforms (string section, Dictionary<Guid, ProjectInfo> projectInfos)
|
||||
// ignores the website projects, in the websiteProjectInfos
|
||||
void ParseProjectConfigurationPlatforms (string section, Dictionary<Guid, ProjectInfo> projectInfos,
|
||||
Dictionary<Guid, ProjectInfo> websiteProjectInfos)
|
||||
{
|
||||
List<Guid> missingGuids = new List<Guid> ();
|
||||
Match projectConfigurationPlatform = projectConfigurationActiveCfgRegex.Match (section);
|
||||
@@ -243,7 +285,9 @@ namespace Mono.XBuild.CommandLine {
|
||||
ProjectInfo projectInfo;
|
||||
if (!projectInfos.TryGetValue (guid, out projectInfo)) {
|
||||
if (!missingGuids.Contains (guid)) {
|
||||
RaiseWarning (0, string.Format("Failed to find project {0}", guid));
|
||||
if (!websiteProjectInfos.ContainsKey (guid))
|
||||
// ignore website projects
|
||||
RaiseWarning (0, string.Format("Failed to find project {0}", guid));
|
||||
missingGuids.Add (guid);
|
||||
}
|
||||
projectConfigurationPlatform = projectConfigurationPlatform.NextMatch ();
|
||||
@@ -287,12 +331,26 @@ namespace Mono.XBuild.CommandLine {
|
||||
{
|
||||
}
|
||||
|
||||
void AddCurrentSolutionConfigurationContents (Project p, List<TargetInfo> solutionTargets, Dictionary<Guid, ProjectInfo> projectInfos)
|
||||
void AddCurrentSolutionConfigurationContents (Project p, List<TargetInfo> solutionTargets,
|
||||
Dictionary<Guid, ProjectInfo> projectInfos,
|
||||
Dictionary<Guid, ProjectInfo> websiteProjectInfos)
|
||||
{
|
||||
AddDefaultSolutionConfiguration (p,
|
||||
solutionTargets.Count > 0 ?
|
||||
solutionTargets [0] :
|
||||
new TargetInfo ("Debug", "Any CPU"));
|
||||
TargetInfo default_target_info = new TargetInfo ("Debug", "Any CPU");
|
||||
if (solutionTargets.Count > 0) {
|
||||
bool found = false;
|
||||
foreach (TargetInfo tinfo in solutionTargets) {
|
||||
if (String.Compare (tinfo.Platform, "Mixed Platforms") == 0) {
|
||||
default_target_info = tinfo;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
default_target_info = solutionTargets [0];
|
||||
}
|
||||
|
||||
AddDefaultSolutionConfiguration (p, default_target_info);
|
||||
|
||||
foreach (TargetInfo solutionTarget in solutionTargets) {
|
||||
BuildPropertyGroup platformPropertyGroup = p.AddNewPropertyGroup (false);
|
||||
@@ -302,18 +360,28 @@ namespace Mono.XBuild.CommandLine {
|
||||
solutionTarget.Platform
|
||||
);
|
||||
|
||||
string solutionConfigurationContents = "<SolutionConfiguration xmlns=\"\">";
|
||||
StringBuilder solutionConfigurationContents = new StringBuilder ();
|
||||
solutionConfigurationContents.Append ("<SolutionConfiguration xmlns=\"\">");
|
||||
foreach (KeyValuePair<Guid, ProjectInfo> projectInfo in projectInfos) {
|
||||
foreach (KeyValuePair<TargetInfo, TargetInfo> targetInfo in projectInfo.Value.TargetMap) {
|
||||
if (solutionTarget.Configuration == targetInfo.Key.Configuration && solutionTarget.Platform == targetInfo.Key.Platform) {
|
||||
solutionConfigurationContents += string.Format ("<ProjectConfiguration Project=\"{0}\">{1}|{2}</ProjectConfiguration>",
|
||||
projectInfo.Key.ToString ("B").ToUpper (), targetInfo.Value.Configuration, targetInfo.Value.Platform);
|
||||
}
|
||||
}
|
||||
AddProjectConfigurationItems (projectInfo.Key, projectInfo.Value, solutionTarget, solutionConfigurationContents);
|
||||
}
|
||||
solutionConfigurationContents += "</SolutionConfiguration>";
|
||||
solutionConfigurationContents.Append ("</SolutionConfiguration>");
|
||||
|
||||
platformPropertyGroup.AddNewProperty ("CurrentSolutionConfigurationContents", solutionConfigurationContents);
|
||||
platformPropertyGroup.AddNewProperty ("CurrentSolutionConfigurationContents",
|
||||
solutionConfigurationContents.ToString ());
|
||||
}
|
||||
}
|
||||
|
||||
void AddProjectConfigurationItems (Guid guid, ProjectInfo projectInfo, TargetInfo solutionTarget,
|
||||
StringBuilder solutionConfigurationContents)
|
||||
{
|
||||
foreach (KeyValuePair<TargetInfo, TargetInfo> targetInfo in projectInfo.TargetMap) {
|
||||
if (solutionTarget.Configuration == targetInfo.Key.Configuration &&
|
||||
solutionTarget.Platform == targetInfo.Key.Platform) {
|
||||
solutionConfigurationContents.AppendFormat (
|
||||
"<ProjectConfiguration Project=\"{0}\">{1}|{2}</ProjectConfiguration>",
|
||||
guid.ToString ("B").ToUpper (), targetInfo.Value.Configuration, targetInfo.Value.Platform);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -326,6 +394,11 @@ namespace Mono.XBuild.CommandLine {
|
||||
BuildPropertyGroup platformPropertyGroup = p.AddNewPropertyGroup (true);
|
||||
platformPropertyGroup.Condition = " '$(Platform)' == '' ";
|
||||
platformPropertyGroup.AddNewProperty ("Platform", target.Platform);
|
||||
|
||||
// emit default for AspNetConfiguration also
|
||||
BuildPropertyGroup aspNetConfigurationPropertyGroup = p.AddNewPropertyGroup (true);
|
||||
aspNetConfigurationPropertyGroup.Condition = " ('$(AspNetConfiguration)' == '') ";
|
||||
aspNetConfigurationPropertyGroup.AddNewProperty ("AspNetConfiguration", "$(Configuration)");
|
||||
}
|
||||
|
||||
void AddWarningForMissingProjectConfiguration (Target target, string slnConfig, string slnPlatform, string projectName)
|
||||
@@ -340,6 +413,224 @@ namespace Mono.XBuild.CommandLine {
|
||||
|
||||
}
|
||||
|
||||
// Website project methods
|
||||
|
||||
void AddWebsiteProperties (Project p, Dictionary<Guid, ProjectInfo> websiteProjectInfos,
|
||||
Dictionary<Guid, ProjectInfo> projectInfos)
|
||||
{
|
||||
var propertyGroupByConfig = new Dictionary<string, BuildPropertyGroup> ();
|
||||
foreach (KeyValuePair<Guid, ProjectInfo> infoPair in websiteProjectInfos) {
|
||||
ProjectInfo info = infoPair.Value;
|
||||
string projectGuid = infoPair.Key.ToString ();
|
||||
|
||||
ProjectSection section;
|
||||
if (!info.ProjectSections.TryGetValue ("WebsiteProperties", out section)) {
|
||||
RaiseWarning (0, String.Format ("Website project '{0}' does not have the required project section: WebsiteProperties. Ignoring project.", info.Name));
|
||||
return;
|
||||
}
|
||||
|
||||
//parse project references
|
||||
string [] ref_guids = null;
|
||||
string references;
|
||||
if (section.Properties.TryGetValue ("ProjectReferences", out references)) {
|
||||
ref_guids = references.Split (new char [] {';'}, StringSplitOptions.RemoveEmptyEntries);
|
||||
for (int i = 0; i < ref_guids.Length; i ++) {
|
||||
// "{guid}|foo.dll"
|
||||
ref_guids [i] = ref_guids [i].Split ('|') [0];
|
||||
|
||||
Guid r_guid = new Guid (ref_guids [i]);
|
||||
ProjectInfo ref_info;
|
||||
if (projectInfos.TryGetValue (r_guid, out ref_info))
|
||||
// ignore if not found
|
||||
info.Dependencies [r_guid] = ref_info;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (KeyValuePair<string, string> pair in section.Properties) {
|
||||
//looking for -- ConfigName.AspNetCompiler.PropName
|
||||
string [] parts = pair.Key.Split ('.');
|
||||
if (parts.Length != 3 || String.Compare (parts [1], "AspNetCompiler") != 0)
|
||||
continue;
|
||||
|
||||
string config = parts [0];
|
||||
string propertyName = parts [2];
|
||||
|
||||
BuildPropertyGroup bpg;
|
||||
if (!propertyGroupByConfig.TryGetValue (config, out bpg)) {
|
||||
bpg = p.AddNewPropertyGroup (true);
|
||||
bpg.Condition = String.Format (" '$(AspNetConfiguration)' == '{0}' ", config);
|
||||
propertyGroupByConfig [config] = bpg;
|
||||
}
|
||||
|
||||
bpg.AddNewProperty (String.Format ("Project_{0}_AspNet{1}", projectGuid, propertyName),
|
||||
pair.Value);
|
||||
|
||||
if (!info.AspNetConfigurations.Contains (config))
|
||||
info.AspNetConfigurations.Add (config);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// For WebSite projects
|
||||
// The main "Build" target:
|
||||
// 1. builds all non-website projects
|
||||
// 2. calls target for website project
|
||||
// - gets target path for the referenced projects
|
||||
// - Resolves dependencies, satellites etc for the
|
||||
// referenced project assemblies, and copies them
|
||||
// to bin/ folder
|
||||
void AddWebsiteTargets (Project p, Dictionary<Guid, ProjectInfo> websiteProjectInfos,
|
||||
Dictionary<Guid, ProjectInfo> projectInfos, List<ProjectInfo>[] infosByLevel,
|
||||
List<TargetInfo> solutionTargets)
|
||||
{
|
||||
foreach (ProjectInfo w_info in websiteProjectInfos.Values) {
|
||||
// gets a linear list of dependencies
|
||||
List<ProjectInfo> depInfos = new List<ProjectInfo> ();
|
||||
foreach (List<ProjectInfo> pinfos in infosByLevel) {
|
||||
foreach (ProjectInfo pinfo in pinfos)
|
||||
if (w_info.Dependencies.ContainsKey (pinfo.Guid))
|
||||
depInfos.Add (pinfo);
|
||||
}
|
||||
|
||||
foreach (string buildTarget in new string [] {"Build", "Rebuild"})
|
||||
AddWebsiteTarget (p, w_info, projectInfos, depInfos, solutionTargets, buildTarget);
|
||||
|
||||
// clean/publish are not supported for website projects
|
||||
foreach (string buildTarget in new string [] {"Clean", "Publish"})
|
||||
AddWebsiteUnsupportedTarget (p, w_info, depInfos, buildTarget);
|
||||
}
|
||||
}
|
||||
|
||||
void AddWebsiteTarget (Project p, ProjectInfo webProjectInfo,
|
||||
Dictionary<Guid, ProjectInfo> projectInfos, List<ProjectInfo> depInfos,
|
||||
List<TargetInfo> solutionTargets, string buildTarget)
|
||||
{
|
||||
string w_guid = webProjectInfo.Guid.ToString ().ToUpper ();
|
||||
|
||||
Target target = p.Targets.AddNewTarget (GetTargetNameForProject (webProjectInfo.Name, buildTarget));
|
||||
target.Condition = "'$(CurrentSolutionConfigurationContents)' != ''";
|
||||
target.DependsOnTargets = GetWebsiteDependsOnTarget (depInfos, buildTarget);
|
||||
|
||||
// this item collects all the references
|
||||
string final_ref_item = String.Format ("Project_{0}_References{1}", w_guid,
|
||||
buildTarget != "Build" ? "_" + buildTarget : String.Empty);
|
||||
|
||||
foreach (TargetInfo targetInfo in solutionTargets) {
|
||||
int ref_num = 0;
|
||||
foreach (ProjectInfo depInfo in depInfos) {
|
||||
TargetInfo projectTargetInfo;
|
||||
if (!depInfo.TargetMap.TryGetValue (targetInfo, out projectTargetInfo))
|
||||
// Ignore, no config, so no target path
|
||||
continue;
|
||||
|
||||
// GetTargetPath from the referenced project
|
||||
AddWebsiteMSBuildTaskForReference (target, depInfo, projectTargetInfo, targetInfo,
|
||||
final_ref_item, ref_num);
|
||||
ref_num ++;
|
||||
}
|
||||
}
|
||||
|
||||
// resolve the references
|
||||
AddWebsiteResolveAndCopyReferencesTasks (target, webProjectInfo, final_ref_item, w_guid);
|
||||
}
|
||||
|
||||
// emits the MSBuild task to GetTargetPath for the referenced project
|
||||
void AddWebsiteMSBuildTaskForReference (Target target, ProjectInfo depInfo, TargetInfo projectTargetInfo,
|
||||
TargetInfo solutionTargetInfo, string final_ref_item, int ref_num)
|
||||
{
|
||||
BuildTask task = target.AddNewTask ("MSBuild");
|
||||
task.SetParameterValue ("Projects", depInfo.FileName);
|
||||
task.SetParameterValue ("Targets", "GetTargetPath");
|
||||
|
||||
task.SetParameterValue ("Properties", string.Format ("Configuration={0}; Platform={1}; BuildingSolutionFile=true; CurrentSolutionConfigurationContents=$(CurrentSolutionConfigurationContents); SolutionDir=$(SolutionDir); SolutionExt=$(SolutionExt); SolutionFileName=$(SolutionFileName); SolutionName=$(SolutionName); SolutionPath=$(SolutionPath)", projectTargetInfo.Configuration, projectTargetInfo.Platform));
|
||||
task.Condition = string.Format (" ('$(Configuration)' == '{0}') and ('$(Platform)' == '{1}') ", solutionTargetInfo.Configuration, solutionTargetInfo.Platform);
|
||||
|
||||
string ref_item = String.Format ("{0}_{1}",
|
||||
final_ref_item, ref_num);
|
||||
|
||||
task.AddOutputItem ("TargetOutputs", ref_item);
|
||||
|
||||
task = target.AddNewTask ("CreateItem");
|
||||
task.SetParameterValue ("Include", String.Format ("@({0})", ref_item));
|
||||
task.SetParameterValue ("AdditionalMetadata", String.Format ("Guid={{{0}}}",
|
||||
depInfo.Guid.ToString ().ToUpper ()));
|
||||
task.AddOutputItem ("Include", final_ref_item);
|
||||
}
|
||||
|
||||
void AddWebsiteResolveAndCopyReferencesTasks (Target target, ProjectInfo webProjectInfo,
|
||||
string final_ref_item, string w_guid)
|
||||
{
|
||||
BuildTask task = target.AddNewTask ("ResolveAssemblyReference");
|
||||
task.SetParameterValue ("Assemblies", String.Format ("@({0}->'%(FullPath)')", final_ref_item));
|
||||
task.SetParameterValue ("TargetFrameworkDirectories", "$(TargetFrameworkPath)");
|
||||
task.SetParameterValue ("SearchPaths", "{RawFileName};{TargetFrameworkDirectory};{GAC}");
|
||||
task.SetParameterValue ("FindDependencies", "true");
|
||||
task.SetParameterValue ("FindSatellites", "true");
|
||||
task.SetParameterValue ("FindRelatedFiles", "true");
|
||||
task.Condition = String.Format ("Exists ('%({0}.Identity)')", final_ref_item);
|
||||
|
||||
string copylocal_item = String.Format ("{0}_CopyLocalFiles", final_ref_item);
|
||||
task.AddOutputItem ("CopyLocalFiles", copylocal_item);
|
||||
|
||||
// Copy the references
|
||||
task = target.AddNewTask ("Copy");
|
||||
task.SetParameterValue ("SourceFiles", String.Format ("@({0})", copylocal_item));
|
||||
task.SetParameterValue ("DestinationFiles", String.Format (
|
||||
"@({0}->'$(Project_{1}_AspNetPhysicalPath)\\Bin\\%(DestinationSubDirectory)%(Filename)%(Extension)')",
|
||||
copylocal_item, w_guid));
|
||||
|
||||
// AspNetConfiguration, is config for the website project, useful
|
||||
// for overriding from command line
|
||||
StringBuilder cond = new StringBuilder ();
|
||||
foreach (string config in webProjectInfo.AspNetConfigurations) {
|
||||
if (cond.Length > 0)
|
||||
cond.Append (" or ");
|
||||
cond.AppendFormat (" ('$(AspNetConfiguration)' == '{0}') ", config);
|
||||
}
|
||||
task.Condition = cond.ToString ();
|
||||
|
||||
task = target.AddNewTask ("Message");
|
||||
cond = new StringBuilder ();
|
||||
foreach (string config in webProjectInfo.AspNetConfigurations) {
|
||||
if (cond.Length > 0)
|
||||
cond.Append (" and ");
|
||||
cond.AppendFormat (" ('$(AspNetConfiguration)' != '{0}') ", config);
|
||||
}
|
||||
task.Condition = cond.ToString ();
|
||||
task.SetParameterValue ("Text", "Skipping as the '$(AspNetConfiguration)' configuration is " +
|
||||
"not supported by this website project.");
|
||||
}
|
||||
|
||||
void AddWebsiteUnsupportedTarget (Project p, ProjectInfo webProjectInfo, List<ProjectInfo> depInfos,
|
||||
string buildTarget)
|
||||
{
|
||||
Target target = p.Targets.AddNewTarget (GetTargetNameForProject (webProjectInfo.Name, buildTarget));
|
||||
target.DependsOnTargets = GetWebsiteDependsOnTarget (depInfos, buildTarget);
|
||||
|
||||
BuildTask task = target.AddNewTask ("Message");
|
||||
task.SetParameterValue ("Text", String.Format (
|
||||
"Target '{0}' not support for website projects", buildTarget));
|
||||
}
|
||||
|
||||
string GetWebsiteDependsOnTarget (List<ProjectInfo> depInfos, string buildTarget)
|
||||
{
|
||||
StringBuilder deps = new StringBuilder ();
|
||||
foreach (ProjectInfo pinfo in depInfos) {
|
||||
if (deps.Length > 0)
|
||||
deps.Append (";");
|
||||
deps.Append (GetTargetNameForProject (pinfo.Name, buildTarget));
|
||||
}
|
||||
deps.Append (";GetFrameworkPath");
|
||||
return deps.ToString ();
|
||||
}
|
||||
|
||||
void AddGetFrameworkPathTarget (Project p)
|
||||
{
|
||||
Target t = p.Targets.AddNewTarget ("GetFrameworkPath");
|
||||
BuildTask task = t.AddNewTask ("GetFrameworkPath");
|
||||
task.AddOutputProperty ("Path", "TargetFrameworkPath");
|
||||
}
|
||||
|
||||
void AddValidateSolutionConfiguration (Project p)
|
||||
{
|
||||
Target t = p.Targets.AddNewTarget ("ValidateSolutionConfiguration");
|
||||
@@ -359,12 +650,7 @@ namespace Mono.XBuild.CommandLine {
|
||||
foreach (KeyValuePair<Guid, ProjectInfo> projectInfo in projectInfos) {
|
||||
ProjectInfo project = projectInfo.Value;
|
||||
foreach (string buildTarget in buildTargets) {
|
||||
string target_name = project.Name +
|
||||
(buildTarget == "Build" ? string.Empty : ":" + buildTarget);
|
||||
|
||||
if (IsBuildTargetName (project.Name))
|
||||
target_name = "Solution:" + target_name;
|
||||
|
||||
string target_name = GetTargetNameForProject (project.Name, buildTarget);
|
||||
Target target = p.Targets.AddNewTarget (target_name);
|
||||
target.Condition = "'$(CurrentSolutionConfigurationContents)' != ''";
|
||||
|
||||
@@ -407,6 +693,20 @@ namespace Mono.XBuild.CommandLine {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
string GetTargetNameForProject (string projectName, string buildTarget)
|
||||
{
|
||||
//FIXME: hack
|
||||
projectName = projectName.Replace ("\\", "/").Replace (".", "_");
|
||||
string target_name = projectName +
|
||||
(buildTarget == "Build" ? string.Empty : ":" + buildTarget);
|
||||
|
||||
if (IsBuildTargetName (projectName))
|
||||
target_name = "Solution:" + target_name;
|
||||
|
||||
return target_name;
|
||||
}
|
||||
|
||||
bool IsBuildTargetName (string name)
|
||||
{
|
||||
foreach (string tgt in buildTargets)
|
||||
@@ -416,9 +716,10 @@ namespace Mono.XBuild.CommandLine {
|
||||
}
|
||||
|
||||
// returns number of levels
|
||||
int AddBuildLevels (Project p, List<TargetInfo> solutionTargets, Dictionary<Guid, ProjectInfo> projectInfos)
|
||||
int AddBuildLevels (Project p, List<TargetInfo> solutionTargets, Dictionary<Guid, ProjectInfo> projectInfos,
|
||||
ref List<ProjectInfo>[] infosByLevel)
|
||||
{
|
||||
List<ProjectInfo>[] infosByLevel = TopologicalSort<ProjectInfo> (projectInfos.Values);
|
||||
infosByLevel = TopologicalSort<ProjectInfo> (projectInfos.Values);
|
||||
|
||||
foreach (TargetInfo targetInfo in solutionTargets) {
|
||||
BuildItemGroup big = p.AddNewItemGroup ();
|
||||
@@ -456,15 +757,16 @@ namespace Mono.XBuild.CommandLine {
|
||||
return infosByLevel.Length;
|
||||
}
|
||||
|
||||
void AddSolutionTargets (Project p, int num_levels)
|
||||
void AddSolutionTargets (Project p, int num_levels, IEnumerable<ProjectInfo> websiteProjectInfos)
|
||||
{
|
||||
foreach (string buildTarget in buildTargets) {
|
||||
Target t = p.Targets.AddNewTarget (buildTarget);
|
||||
t.Condition = "'$(CurrentSolutionConfigurationContents)' != ''";
|
||||
|
||||
BuildTask task = null;
|
||||
for (int i = 0; i < num_levels; i ++) {
|
||||
string level_str = String.Format ("BuildLevel{0}", i);
|
||||
BuildTask task = t.AddNewTask ("MSBuild");
|
||||
task = t.AddNewTask ("MSBuild");
|
||||
task.SetParameterValue ("Condition", String.Format ("'@({0})' != ''", level_str));
|
||||
task.SetParameterValue ("Projects", String.Format ("@({0})", level_str));
|
||||
task.SetParameterValue ("Properties",
|
||||
@@ -490,6 +792,18 @@ namespace Mono.XBuild.CommandLine {
|
||||
"corresponding to the solution configuration " +
|
||||
"'$(Configuration)|$(Platform)' was not found.", level_str));
|
||||
}
|
||||
|
||||
// "build" website projects also
|
||||
StringBuilder w_targets = new StringBuilder ();
|
||||
foreach (ProjectInfo info in websiteProjectInfos) {
|
||||
if (w_targets.Length > 0)
|
||||
w_targets.Append (";");
|
||||
w_targets.Append (GetTargetNameForProject (info.Name, buildTarget));
|
||||
}
|
||||
|
||||
task = t.AddNewTask ("CallTarget");
|
||||
task.SetParameterValue ("Targets", w_targets.ToString ());
|
||||
task.SetParameterValue ("RunEachTargetSeparately", "true");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -535,7 +849,9 @@ namespace Mono.XBuild.CommandLine {
|
||||
return levels [index];
|
||||
|
||||
if (triedToInsert[index])
|
||||
throw new InvalidOperationException ("Cyclic dependency found in the project dependency graph");
|
||||
throw new InvalidOperationException (String.Format (
|
||||
"Cyclic dependency involving project {0} found in the project dependency graph",
|
||||
allItems [index].Name));
|
||||
|
||||
triedToInsert[index] = true;
|
||||
ProjectInfo insertItem = allItems[index];
|
||||
|
||||
@@ -205,7 +205,6 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<BuildDependsOn>
|
||||
_ValidateEssentialProperties;
|
||||
BeforeBuild;
|
||||
CoreBuild;
|
||||
AfterBuild
|
||||
|
||||
+3
-3
@@ -616,8 +616,7 @@ Authors:
|
||||
%_prefix/lib/mono/2.0/System.ServiceModel.dll
|
||||
%_prefix/lib/mono/gac/System.ServiceModel.Web
|
||||
%_prefix/lib/mono/2.0/System.ServiceModel.Web.dll
|
||||
%_prefix/lib/mono/2.0/svcutil.exe
|
||||
%_prefix/lib/mono/2.0/svcutil.exe.mdb
|
||||
%_prefix/lib/mono/2.0/svcutil.exe*
|
||||
%_libdir/pkgconfig/wcf.pc
|
||||
|
||||
%package -n mono-winfxcore
|
||||
@@ -1006,6 +1005,7 @@ fi
|
||||
%_prefix/lib/mono/2.0/Microsoft.VisualBasic.targets
|
||||
%_prefix/lib/mono/2.0/MSBuild
|
||||
%_prefix/lib/mono/2.0/xbuild.rsp
|
||||
%_prefix/lib/mono/xbuild
|
||||
# man pages
|
||||
%_mandir/man1/cert2spc.1%ext_man
|
||||
%_mandir/man1/mono-cil-strip.1%ext_man
|
||||
@@ -1212,7 +1212,7 @@ export CFLAGS=" $RPM_OPT_FLAGS -DKDE_ASSEMBLIES='\"/opt/kde3/%{_lib}\"' -fno-str
|
||||
%configure \
|
||||
--with-jit=yes \
|
||||
--with-ikvm=yes \
|
||||
--with-moonlight=yes
|
||||
--with-moonlight=no
|
||||
make
|
||||
|
||||
%install
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
2009-09-29 Rolf Bjarne Kvinge <[email protected]>
|
||||
|
||||
* appdomain.c|h: Add a mono_domain_try_unload method which is
|
||||
equivalent to mono_domain_unload, except that it returns an exception
|
||||
instead of throwing it. Make mono_domain_unload use the
|
||||
mono_domain_try_unload method to avoid code-duplication.
|
||||
|
||||
Backport of r142658.
|
||||
|
||||
2009-09-27 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* marshal.c: don't create the handle when calling. It is created later
|
||||
if needed.
|
||||
|
||||
2009-09-24 Zoltan Varga <[email protected]>
|
||||
|
||||
* marshal.c (emit_ptr_to_object_conv): Generate an exception instead of
|
||||
|
||||
+33
-15
@@ -2103,22 +2103,45 @@ unload_thread_main (void *arg)
|
||||
* mono_domain_unload:
|
||||
* @domain: The domain to unload
|
||||
*
|
||||
* Unloads an appdomain. Follows the process outlined in the comment
|
||||
* for mono_domain_try_unload.
|
||||
*/
|
||||
void
|
||||
mono_domain_unload (MonoDomain *domain)
|
||||
{
|
||||
MonoObject *exc = NULL;
|
||||
mono_domain_try_unload (domain, &exc);
|
||||
if (exc)
|
||||
mono_raise_exception ((MonoException*)exc);
|
||||
}
|
||||
|
||||
/*
|
||||
* mono_domain_unload:
|
||||
* @domain: The domain to unload
|
||||
* @exc: Exception information
|
||||
*
|
||||
* Unloads an appdomain. Follows the process outlined in:
|
||||
* http://blogs.gotdotnet.com/cbrumme
|
||||
*
|
||||
* If doing things the 'right' way is too hard or complex, we do it the
|
||||
* 'simple' way, which means do everything needed to avoid crashes and
|
||||
* memory leaks, but not much else.
|
||||
*
|
||||
* It is required to pass a valid reference to the exc argument, upon return
|
||||
* from this function *exc will be set to the exception thrown, if any.
|
||||
*
|
||||
* If this method is not called from an icall (embedded scenario for instance),
|
||||
* it must not be called with any managed frames on the stack, since the unload
|
||||
* process could end up trying to abort the current thread.
|
||||
*/
|
||||
void
|
||||
mono_domain_unload (MonoDomain *domain)
|
||||
mono_domain_try_unload (MonoDomain *domain, MonoObject **exc)
|
||||
{
|
||||
HANDLE thread_handle;
|
||||
gsize tid;
|
||||
guint32 res;
|
||||
MonoAppDomainState prev_state;
|
||||
MonoMethod *method;
|
||||
MonoObject *exc;
|
||||
unload_data thread_data;
|
||||
MonoDomain *caller_domain = mono_domain_get ();
|
||||
|
||||
@@ -2132,11 +2155,11 @@ mono_domain_unload (MonoDomain *domain)
|
||||
switch (prev_state) {
|
||||
case MONO_APPDOMAIN_UNLOADING_START:
|
||||
case MONO_APPDOMAIN_UNLOADING:
|
||||
mono_raise_exception (mono_get_exception_cannot_unload_appdomain ("Appdomain is already being unloaded."));
|
||||
break;
|
||||
*exc = (MonoObject *) mono_get_exception_cannot_unload_appdomain ("Appdomain is already being unloaded.");
|
||||
return;
|
||||
case MONO_APPDOMAIN_UNLOADED:
|
||||
mono_raise_exception (mono_get_exception_cannot_unload_appdomain ("Appdomain is already unloaded."));
|
||||
break;
|
||||
*exc = (MonoObject *) mono_get_exception_cannot_unload_appdomain ("Appdomain is already unloaded.");
|
||||
return;
|
||||
default:
|
||||
g_warning ("Incalid appdomain state %d", prev_state);
|
||||
g_assert_not_reached ();
|
||||
@@ -2150,13 +2173,12 @@ mono_domain_unload (MonoDomain *domain)
|
||||
method = mono_class_get_method_from_name (domain->domain->mbr.obj.vtable->klass, "DoDomainUnload", -1);
|
||||
g_assert (method);
|
||||
|
||||
exc = NULL;
|
||||
mono_runtime_invoke (method, domain->domain, NULL, &exc);
|
||||
if (exc) {
|
||||
mono_runtime_invoke (method, domain->domain, NULL, exc);
|
||||
if (*exc) {
|
||||
/* Roll back the state change */
|
||||
domain->state = MONO_APPDOMAIN_CREATED;
|
||||
mono_domain_set (caller_domain, FALSE);
|
||||
mono_raise_exception ((MonoException*)exc);
|
||||
return;
|
||||
}
|
||||
mono_domain_set (caller_domain, FALSE);
|
||||
|
||||
@@ -2195,18 +2217,14 @@ mono_domain_unload (MonoDomain *domain)
|
||||
CloseHandle (thread_handle);
|
||||
|
||||
if (thread_data.failure_reason) {
|
||||
MonoException *ex;
|
||||
|
||||
/* Roll back the state change */
|
||||
domain->state = MONO_APPDOMAIN_CREATED;
|
||||
|
||||
g_warning ("%s", thread_data.failure_reason);
|
||||
|
||||
ex = mono_get_exception_cannot_unload_appdomain (thread_data.failure_reason);
|
||||
*exc = (MonoObject *) mono_get_exception_cannot_unload_appdomain (thread_data.failure_reason);
|
||||
|
||||
g_free (thread_data.failure_reason);
|
||||
thread_data.failure_reason = NULL;
|
||||
|
||||
mono_raise_exception (ex);
|
||||
}
|
||||
}
|
||||
@@ -85,6 +85,9 @@ mono_domain_set_internal (MonoDomain *domain);
|
||||
void
|
||||
mono_domain_unload (MonoDomain *domain);
|
||||
|
||||
void
|
||||
mono_domain_try_unload (MonoDomain *domain, MonoObject **exc);
|
||||
|
||||
gboolean
|
||||
mono_domain_is_unloading (MonoDomain *domain);
|
||||
|
||||
|
||||
@@ -1987,13 +1987,10 @@ mono_delegate_begin_invoke (MonoDelegate *delegate, gpointer *params)
|
||||
MonoAsyncResult *ares;
|
||||
MonoObject *exc;
|
||||
MonoArray *out_args;
|
||||
HANDLE handle;
|
||||
method = delegate->method;
|
||||
|
||||
msg = mono_method_call_message_new (mono_marshal_method_from_wrapper (method), params, NULL, &async_callback, &state);
|
||||
handle = CreateEvent (NULL, TRUE, FALSE, NULL);
|
||||
g_assert(handle != NULL);
|
||||
ares = mono_async_result_new (mono_domain_get (), handle, state, handle, NULL);
|
||||
ares = mono_async_result_new (mono_domain_get (), NULL, state, NULL, NULL);
|
||||
MONO_OBJECT_SETREF (ares, async_delegate, (MonoObject *)delegate);
|
||||
MONO_OBJECT_SETREF (ares, async_callback, (MonoObject *)async_callback);
|
||||
MONO_OBJECT_SETREF (msg, async_result, ares);
|
||||
|
||||
@@ -10,4 +10,5 @@ _MONO_DEBUGGER__notification_function:
|
||||
_MONO_DEBUGGER__debugger_info_ptr:
|
||||
.long _MONO_DEBUGGER__debugger_info
|
||||
_MONO_DEBUGGER__using_debugger:
|
||||
.quad 0
|
||||
.long 0
|
||||
.long 0
|
||||
Reference in new issue
Block a user