From 651f9f47d0dec64e70bc257f4695313fad839b7a Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Wed, 21 Dec 2011 14:56:38 -0800
Subject: HG: Verify that the user is local
---
OpenSim/Services/HypergridService/UserAgentService.cs | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs
index cdc560c..8538660 100644
--- a/OpenSim/Services/HypergridService/UserAgentService.cs
+++ b/OpenSim/Services/HypergridService/UserAgentService.cs
@@ -161,6 +161,14 @@ namespace OpenSim.Services.HypergridService
{
m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}",
agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), gatekeeper.ServerURI);
+
+ if (m_UserAccountService.GetUserAccount(UUID.Zero, agentCircuit.AgentID) == null)
+ {
+ m_log.WarnFormat("[USER AGENT SERVICE]: Someone attempted to lauch a foreign user from here {0} {1}", agentCircuit.firstname, agentCircuit.lastname);
+ reason = "Forbidden to launch your agents from here";
+ return false;
+ }
+
// Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination
GridRegion region = new GridRegion(gatekeeper);
region.ServerURI = gatekeeper.ServerURI;
--
cgit v1.1
From ddff2f246cb4862abcac5308ae2532c9828691fb Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Wed, 21 Dec 2011 15:17:26 -0800
Subject: Moved an external test into the method that uses those preconditions.
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 30 +++++++++---------------
1 file changed, 11 insertions(+), 19 deletions(-)
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 36d8c0b..526fab3 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1161,10 +1161,10 @@ namespace OpenSim.Region.Framework.Scenes
public void CompleteMovement(IClientAPI client, bool openChildAgents)
{
// DateTime startTime = DateTime.Now;
-
-// m_log.DebugFormat(
-// "[SCENE PRESENCE]: Completing movement of {0} into region {1}",
-// client.Name, Scene.RegionInfo.RegionName);
+
+ m_log.DebugFormat(
+ "[SCENE PRESENCE]: Completing movement of {0} into region {1} in position {2}",
+ client.Name, Scene.RegionInfo.RegionName, AbsolutePosition);
Vector3 look = Velocity;
if ((look.X == 0) && (look.Y == 0) && (look.Z == 0))
@@ -2383,9 +2383,7 @@ namespace OpenSim.Region.Framework.Scenes
m_lastVelocity = Velocity;
}
- // followed suggestion from mic bowman. reversed the two lines below.
- if (ParentID == 0 && PhysicsActor != null || ParentID != 0) // Check that we have a physics actor or we're sitting on something
- CheckForBorderCrossing();
+ CheckForBorderCrossing();
CheckForSignificantMovement(); // sends update to the modules.
}
@@ -2741,7 +2739,8 @@ namespace OpenSim.Region.Framework.Scenes
///
protected void CheckForBorderCrossing()
{
- if (IsChildAgent)
+ // Check that we we are not a child and have a physics actor or we're sitting on something
+ if (IsChildAgent || (ParentID == 0 && PhysicsActor != null || ParentID != 0))
return;
Vector3 pos2 = AbsolutePosition;
@@ -2757,7 +2756,6 @@ namespace OpenSim.Region.Framework.Scenes
if (!IsInTransit)
{
// Checks if where it's headed exists a region
-
bool needsTransit = false;
if (m_scene.TestBorderCross(pos2, Cardinals.W))
{
@@ -2828,7 +2826,7 @@ namespace OpenSim.Region.Framework.Scenes
Velocity = Vector3.Zero;
AbsolutePosition = pos;
-// m_log.DebugFormat("[SCENE PRESENCE]: Prevented flyoff for {0} at {1}", Name, AbsolutePosition);
+ m_log.DebugFormat("[SCENE PRESENCE]: Prevented flyoff for {0} at {1}", Name, AbsolutePosition);
AddToPhysicalScene(isFlying);
}
@@ -2861,22 +2859,16 @@ namespace OpenSim.Region.Framework.Scenes
}
}
else
- {
- // We must remove the agent from the physical scene if it has been placed in transit. If we don't,
- // then this method continues to be called from ScenePresence.Update() until the handover of the client between
- // regions is completed. Since this handover can take more than 1000ms (due to the 1000ms
- // event queue polling response from the server), this results in the avatar pausing on the border
- // for the handover period.
- RemoveFromPhysicalScene();
-
+ {
// This constant has been inferred from experimentation
// I'm not sure what this value should be, so I tried a few values.
timeStep = 0.04f;
pos2 = AbsolutePosition;
pos2.X = pos2.X + (vel.X * timeStep);
pos2.Y = pos2.Y + (vel.Y * timeStep);
- pos2.Z = pos2.Z + (vel.Z * timeStep);
+ // Don't touch the Z
m_pos = pos2;
+ m_log.ErrorFormat("m_pos={0}", m_pos);
}
}
--
cgit v1.1
From 219ec7ef20ccefb257be5ec650a13758b2a3cda3 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Thu, 22 Dec 2011 08:18:03 -0800
Subject: Fixing a bug introduced yesterday. This put the precondition test
inside CheckForBorderCrossing the right way.
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 214 ++++++++++++-----------
1 file changed, 109 insertions(+), 105 deletions(-)
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 6f02475..040cbfc 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2736,137 +2736,141 @@ namespace OpenSim.Region.Framework.Scenes
///
protected void CheckForBorderCrossing()
{
- // Check that we we are not a child and have a physics actor or we're sitting on something
- if (IsChildAgent || (ParentID == 0 && PhysicsActor != null || ParentID != 0))
+ // Check that we we are not a child
+ if (IsChildAgent)
return;
- Vector3 pos2 = AbsolutePosition;
- Vector3 vel = Velocity;
- int neighbor = 0;
- int[] fix = new int[2];
+ // We only do this if we have a physics actor or we're sitting on something
+ if (ParentID == 0 && PhysicsActor != null || ParentID != 0)
+ {
+ Vector3 pos2 = AbsolutePosition;
+ Vector3 vel = Velocity;
+ int neighbor = 0;
+ int[] fix = new int[2];
- float timeStep = 0.1f;
- pos2.X = pos2.X + (vel.X*timeStep);
- pos2.Y = pos2.Y + (vel.Y*timeStep);
- pos2.Z = pos2.Z + (vel.Z*timeStep);
+ float timeStep = 0.1f;
+ pos2.X = pos2.X + (vel.X * timeStep);
+ pos2.Y = pos2.Y + (vel.Y * timeStep);
+ pos2.Z = pos2.Z + (vel.Z * timeStep);
- if (!IsInTransit)
- {
- // Checks if where it's headed exists a region
- bool needsTransit = false;
- if (m_scene.TestBorderCross(pos2, Cardinals.W))
+ if (!IsInTransit)
{
- if (m_scene.TestBorderCross(pos2, Cardinals.S))
+ // Checks if where it's headed exists a region
+ bool needsTransit = false;
+ if (m_scene.TestBorderCross(pos2, Cardinals.W))
{
- needsTransit = true;
- neighbor = m_scene.HaveNeighbor(Cardinals.SW, ref fix);
- }
- else if (m_scene.TestBorderCross(pos2, Cardinals.N))
- {
- needsTransit = true;
- neighbor = m_scene.HaveNeighbor(Cardinals.NW, ref fix);
+ if (m_scene.TestBorderCross(pos2, Cardinals.S))
+ {
+ needsTransit = true;
+ neighbor = m_scene.HaveNeighbor(Cardinals.SW, ref fix);
+ }
+ else if (m_scene.TestBorderCross(pos2, Cardinals.N))
+ {
+ needsTransit = true;
+ neighbor = m_scene.HaveNeighbor(Cardinals.NW, ref fix);
+ }
+ else
+ {
+ needsTransit = true;
+ neighbor = m_scene.HaveNeighbor(Cardinals.W, ref fix);
+ }
}
- else
+ else if (m_scene.TestBorderCross(pos2, Cardinals.E))
{
- needsTransit = true;
- neighbor = m_scene.HaveNeighbor(Cardinals.W, ref fix);
+ if (m_scene.TestBorderCross(pos2, Cardinals.S))
+ {
+ needsTransit = true;
+ neighbor = m_scene.HaveNeighbor(Cardinals.SE, ref fix);
+ }
+ else if (m_scene.TestBorderCross(pos2, Cardinals.N))
+ {
+ needsTransit = true;
+ neighbor = m_scene.HaveNeighbor(Cardinals.NE, ref fix);
+ }
+ else
+ {
+ needsTransit = true;
+ neighbor = m_scene.HaveNeighbor(Cardinals.E, ref fix);
+ }
}
- }
- else if (m_scene.TestBorderCross(pos2, Cardinals.E))
- {
- if (m_scene.TestBorderCross(pos2, Cardinals.S))
+ else if (m_scene.TestBorderCross(pos2, Cardinals.S))
{
needsTransit = true;
- neighbor = m_scene.HaveNeighbor(Cardinals.SE, ref fix);
+ neighbor = m_scene.HaveNeighbor(Cardinals.S, ref fix);
}
else if (m_scene.TestBorderCross(pos2, Cardinals.N))
{
needsTransit = true;
- neighbor = m_scene.HaveNeighbor(Cardinals.NE, ref fix);
+ neighbor = m_scene.HaveNeighbor(Cardinals.N, ref fix);
}
- else
- {
- needsTransit = true;
- neighbor = m_scene.HaveNeighbor(Cardinals.E, ref fix);
- }
- }
- else if (m_scene.TestBorderCross(pos2, Cardinals.S))
- {
- needsTransit = true;
- neighbor = m_scene.HaveNeighbor(Cardinals.S, ref fix);
- }
- else if (m_scene.TestBorderCross(pos2, Cardinals.N))
- {
- needsTransit = true;
- neighbor = m_scene.HaveNeighbor(Cardinals.N, ref fix);
- }
- // Makes sure avatar does not end up outside region
- if (neighbor <= 0)
- {
- if (needsTransit)
+ // Makes sure avatar does not end up outside region
+ if (neighbor <= 0)
{
- if (m_requestedSitTargetUUID == UUID.Zero)
+ if (needsTransit)
{
- bool isFlying = Flying;
- RemoveFromPhysicalScene();
-
- Vector3 pos = AbsolutePosition;
- if (AbsolutePosition.X < 0)
- pos.X += Velocity.X * 2;
- else if (AbsolutePosition.X > Constants.RegionSize)
- pos.X -= Velocity.X * 2;
- if (AbsolutePosition.Y < 0)
- pos.Y += Velocity.Y * 2;
- else if (AbsolutePosition.Y > Constants.RegionSize)
- pos.Y -= Velocity.Y * 2;
- Velocity = Vector3.Zero;
- AbsolutePosition = pos;
-
- m_log.DebugFormat("[SCENE PRESENCE]: Prevented flyoff for {0} at {1}", Name, AbsolutePosition);
-
- AddToPhysicalScene(isFlying);
+ if (m_requestedSitTargetUUID == UUID.Zero)
+ {
+ bool isFlying = Flying;
+ RemoveFromPhysicalScene();
+
+ Vector3 pos = AbsolutePosition;
+ if (AbsolutePosition.X < 0)
+ pos.X += Velocity.X * 2;
+ else if (AbsolutePosition.X > Constants.RegionSize)
+ pos.X -= Velocity.X * 2;
+ if (AbsolutePosition.Y < 0)
+ pos.Y += Velocity.Y * 2;
+ else if (AbsolutePosition.Y > Constants.RegionSize)
+ pos.Y -= Velocity.Y * 2;
+ Velocity = Vector3.Zero;
+ AbsolutePosition = pos;
+
+ m_log.DebugFormat("[SCENE PRESENCE]: Prevented flyoff for {0} at {1}", Name, AbsolutePosition);
+
+ AddToPhysicalScene(isFlying);
+ }
}
}
- }
- else if (neighbor > 0)
- {
- if (!CrossToNewRegion())
+ else if (neighbor > 0)
{
- if (m_requestedSitTargetUUID == UUID.Zero)
+ if (!CrossToNewRegion())
{
- bool isFlying = Flying;
- RemoveFromPhysicalScene();
-
- Vector3 pos = AbsolutePosition;
- if (AbsolutePosition.X < 0)
- pos.X += Velocity.X * 2;
- else if (AbsolutePosition.X > Constants.RegionSize)
- pos.X -= Velocity.X * 2;
- if (AbsolutePosition.Y < 0)
- pos.Y += Velocity.Y * 2;
- else if (AbsolutePosition.Y > Constants.RegionSize)
- pos.Y -= Velocity.Y * 2;
- Velocity = Vector3.Zero;
- AbsolutePosition = pos;
-
- AddToPhysicalScene(isFlying);
+ if (m_requestedSitTargetUUID == UUID.Zero)
+ {
+ bool isFlying = Flying;
+ RemoveFromPhysicalScene();
+
+ Vector3 pos = AbsolutePosition;
+ if (AbsolutePosition.X < 0)
+ pos.X += Velocity.X * 2;
+ else if (AbsolutePosition.X > Constants.RegionSize)
+ pos.X -= Velocity.X * 2;
+ if (AbsolutePosition.Y < 0)
+ pos.Y += Velocity.Y * 2;
+ else if (AbsolutePosition.Y > Constants.RegionSize)
+ pos.Y -= Velocity.Y * 2;
+ Velocity = Vector3.Zero;
+ AbsolutePosition = pos;
+
+ AddToPhysicalScene(isFlying);
+ }
}
}
}
- }
- else
- {
- // This constant has been inferred from experimentation
- // I'm not sure what this value should be, so I tried a few values.
- timeStep = 0.04f;
- pos2 = AbsolutePosition;
- pos2.X = pos2.X + (vel.X * timeStep);
- pos2.Y = pos2.Y + (vel.Y * timeStep);
- // Don't touch the Z
- m_pos = pos2;
- m_log.ErrorFormat("m_pos={0}", m_pos);
- }
+ else
+ {
+ // This constant has been inferred from experimentation
+ // I'm not sure what this value should be, so I tried a few values.
+ timeStep = 0.04f;
+ pos2 = AbsolutePosition;
+ pos2.X = pos2.X + (vel.X * timeStep);
+ pos2.Y = pos2.Y + (vel.Y * timeStep);
+ // Don't touch the Z
+ m_pos = pos2;
+ m_log.DebugFormat("[SCENE PRESENCE]: In transit m_pos={0}", m_pos);
+ }
+ }
}
///
--
cgit v1.1
From 2347593dac0d435851fb1437b87c42a5fd4f9060 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Thu, 22 Dec 2011 16:48:52 +0000
Subject: Harmonizing SP with Avination
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 96 ++++++++++++++----------
1 file changed, 55 insertions(+), 41 deletions(-)
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 040cbfc..c578fc0 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -118,7 +118,7 @@ namespace OpenSim.Region.Framework.Scenes
/// TODO: For some reason, we effectively have a list both here and in Appearance. Need to work out if this is
/// necessary.
///
- protected List m_attachments = new List();
+ private List m_attachments = new List();
public Object AttachmentsSyncLock { get; private set; }
@@ -550,8 +550,12 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- m_pos = value;
- ParentPosition = Vector3.Zero;
+ // Don't update while sitting
+ if (ParentID == 0)
+ {
+ m_pos = value;
+ ParentPosition = Vector3.Zero;
+ }
//m_log.DebugFormat(
// "[ENTITY BASE]: In {0} set AbsolutePosition of {1} to {2}",
@@ -566,6 +570,13 @@ namespace OpenSim.Region.Framework.Scenes
public Vector3 OffsetPosition
{
get { return m_pos; }
+ set
+ {
+ // There is no offset position when not seated
+ if (ParentID == 0)
+ return;
+ m_pos = value;
+ }
}
///
@@ -2740,8 +2751,10 @@ namespace OpenSim.Region.Framework.Scenes
if (IsChildAgent)
return;
- // We only do this if we have a physics actor or we're sitting on something
- if (ParentID == 0 && PhysicsActor != null || ParentID != 0)
+ if (ParentID != 0)
+ return;
+
+ if (!IsInTransit)
{
Vector3 pos2 = AbsolutePosition;
Vector3 vel = Velocity;
@@ -3100,30 +3113,28 @@ namespace OpenSim.Region.Framework.Scenes
catch { }
// Attachment objects
- lock (m_attachments)
+ List attachments = GetAttachments();
+ if (attachments.Count > 0)
{
- if (m_attachments.Count > 0)
- {
- cAgent.AttachmentObjects = new List();
- cAgent.AttachmentObjectStates = new List();
- // IScriptModule se = m_scene.RequestModuleInterface();
- InTransitScriptStates.Clear();
+ cAgent.AttachmentObjects = new List();
+ cAgent.AttachmentObjectStates = new List();
+// IScriptModule se = m_scene.RequestModuleInterface();
+ InTransitScriptStates.Clear();
- foreach (SceneObjectGroup sog in m_attachments)
- {
- // We need to make a copy and pass that copy
- // because of transfers withn the same sim
- ISceneObject clone = sog.CloneForNewScene();
- // Attachment module assumes that GroupPosition holds the offsets...!
- ((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos;
- ((SceneObjectGroup)clone).IsAttachment = false;
- cAgent.AttachmentObjects.Add(clone);
- string state = sog.GetStateSnapshot();
- cAgent.AttachmentObjectStates.Add(state);
- InTransitScriptStates.Add(state);
- // Let's remove the scripts of the original object here
- sog.RemoveScriptInstances(true);
- }
+ foreach (SceneObjectGroup sog in attachments)
+ {
+ // We need to make a copy and pass that copy
+ // because of transfers withn the same sim
+ ISceneObject clone = sog.CloneForNewScene();
+ // Attachment module assumes that GroupPosition holds the offsets...!
+ ((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos;
+ ((SceneObjectGroup)clone).IsAttachment = false;
+ cAgent.AttachmentObjects.Add(clone);
+ string state = sog.GetStateSnapshot();
+ cAgent.AttachmentObjectStates.Add(state);
+ InTransitScriptStates.Add(state);
+ // Let's remove the scripts of the original object here
+ sog.RemoveScriptInstances(true);
}
}
}
@@ -3531,26 +3542,29 @@ namespace OpenSim.Region.Framework.Scenes
/// The arguments for the event
public void SendScriptEventToAttachments(string eventName, Object[] args)
{
- if (m_scriptEngines.Length == 0)
- return;
-
- lock (m_attachments)
+ Util.FireAndForget(delegate(object x)
{
- foreach (SceneObjectGroup grp in m_attachments)
+ if (m_scriptEngines.Length == 0)
+ return;
+
+ lock (m_attachments)
{
- // 16384 is CHANGED_ANIMATION
- //
- // Send this to all attachment root prims
- //
- foreach (IScriptModule m in m_scriptEngines)
+ foreach (SceneObjectGroup grp in m_attachments)
{
- if (m == null) // No script engine loaded
- continue;
+ // 16384 is CHANGED_ANIMATION
+ //
+ // Send this to all attachment root prims
+ //
+ foreach (IScriptModule m in m_scriptEngines)
+ {
+ if (m == null) // No script engine loaded
+ continue;
- m.PostObjectEvent(grp.RootPart.UUID, "changed", new Object[] { (int)Changed.ANIMATION });
+ m.PostObjectEvent(grp.RootPart.UUID, "changed", new Object[] { (int)Changed.ANIMATION });
+ }
}
}
- }
+ });
}
internal void PushForce(Vector3 impulse)
--
cgit v1.1
From 6412349decb36a7278528477bacb5b71534ad657 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Thu, 22 Dec 2011 16:51:51 +0000
Subject: Add a few comments, correct a merge artefact
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index c578fc0..fc6eb6d 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -570,6 +570,8 @@ namespace OpenSim.Region.Framework.Scenes
public Vector3 OffsetPosition
{
get { return m_pos; }
+ // Don't remove setter. It's not currently used in core but
+ // upcoming Avination code needs it.
set
{
// There is no offset position when not seated
@@ -2751,7 +2753,10 @@ namespace OpenSim.Region.Framework.Scenes
if (IsChildAgent)
return;
- if (ParentID != 0)
+ // If we don't have a PhysActor, we can't cross anyway
+ // Also don't do this while sat, sitting avatars cross with the
+ // object they sit on.
+ if (ParentID != 0 || PhysActor == null)
return;
if (!IsInTransit)
--
cgit v1.1
From 7f527814d524fe6b0fb5243dbdb558e5b661e4a5 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Thu, 22 Dec 2011 16:57:49 +0000
Subject: And a typo fix
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index fc6eb6d..3d1c1b5 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2756,7 +2756,7 @@ namespace OpenSim.Region.Framework.Scenes
// If we don't have a PhysActor, we can't cross anyway
// Also don't do this while sat, sitting avatars cross with the
// object they sit on.
- if (ParentID != 0 || PhysActor == null)
+ if (ParentID != 0 || PhysicsActor == null)
return;
if (!IsInTransit)
--
cgit v1.1
From 469955889ed5499ed1dbb8fcc224d6912c651d06 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Thu, 22 Dec 2011 09:30:06 -0800
Subject: Region crossings redone: (1) removed WaitForCallback. Now that we are
passing the entire agent with attachs in one big message we don't necessarily
need to wait for confirmation. The callback sometimes is problematic and it
adds delay to the process. (2) Z velocity sent to the viewer = 0. This is an
heuristic; the Z velocity usually is negative, and it makes the viewer move
the avie down. This only matters while the agent is in transit and therefore
not being physically simulated by neither region. As soon as the receiving
region receives CompleteMovement from the viewer, the position and velocity
get corrected.
---
.../EntityTransfer/EntityTransferModule.cs | 71 ++++++++++------------
1 file changed, 32 insertions(+), 39 deletions(-)
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 87f292c..b9d5d32 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -676,9 +676,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
Vector3 eastCross = new Vector3(boundaryDistance, 0, 0);
Vector3 westCross = new Vector3(-1 * boundaryDistance, 0, 0);
- // distance to edge that will trigger crossing
-
-
// distance into new region to place avatar
const float enterDistance = 0.5f;
@@ -960,29 +957,31 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Failed validation of all attachments for region crossing of {0} from {1} to {2}. Continuing.",
agent.Name, agent.Scene.RegionInfo.RegionName, neighbourRegion.RegionName);
-
- pos = pos + (agent.Velocity);
-
+
+ pos = pos + agent.Velocity;
+ Vector3 vel2 = new Vector3(agent.Velocity.X, agent.Velocity.Y, 0);
+
+ agent.RemoveFromPhysicalScene();
SetInTransit(agent.UUID);
- AgentData cAgent = new AgentData();
+
+ AgentData cAgent = new AgentData();
agent.CopyTo(cAgent);
cAgent.Position = pos;
if (isFlying)
cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
- cAgent.CallbackURI = m_scene.RegionInfo.ServerURI +
- "agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/";
-
+
+ // We don't need the callback anymnore
+ cAgent.CallbackURI = String.Empty;
+
if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent))
{
// region doesn't take it
ReInstantiateScripts(agent);
+ agent.AddToPhysicalScene(isFlying);
ResetFromTransit(agent.UUID);
return agent;
}
- // Next, let's close the child agent connections that are too far away.
- agent.CloseChildAgents(neighbourx, neighboury);
-
//AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo();
agent.ControllingClient.RequestClientInfo();
@@ -999,11 +998,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps);
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID);
-
+
IEventQueue eq = agent.Scene.RequestModuleInterface();
if (eq != null)
{
- eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint,
+ eq.CrossRegion(neighbourHandle, pos, vel2 /* agent.Velocity */, neighbourRegion.ExternalEndPoint,
capsPath, agent.UUID, agent.ControllingClient.SessionId);
}
else
@@ -1011,32 +1010,26 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint,
capsPath);
}
-
- if (!WaitForCallback(agent.UUID))
- {
- m_log.Debug("[ENTITY TRANSFER MODULE]: Callback never came in crossing agent");
- ReInstantiateScripts(agent);
- ResetFromTransit(agent.UUID);
-
- // Yikes! We should just have a ref to scene here.
- //agent.Scene.InformClientOfNeighbours(agent);
- EnableChildAgents(agent);
-
- return agent;
- }
-
+
+ // SUCCESS!
agent.MakeChildAgent();
-
+ ResetFromTransit(agent.UUID);
+
// now we have a child agent in this region. Request all interesting data about other (root) agents
agent.SendOtherAgentsAvatarDataToMe();
agent.SendOtherAgentsAppearanceToMe();
-
- // Backwards compatibility
+
+ // Backwards compatibility. Best effort
if (version == "Unknown" || version == string.Empty)
{
- m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old neighbor, passing attachments one by one...");
+ m_log.DebugFormat("[ENTITY TRANSFER MODULE]: neighbor with old version, passing attachments one by one...");
+ Thread.Sleep(3000); // wait a little now that we're not waiting for the callback
CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true);
}
+
+
+ // Next, let's close the child agent connections that are too far away.
+ agent.CloseChildAgents(neighbourx, neighboury);
AgentHasMovedAway(agent, false);
@@ -1069,16 +1062,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
CrossAgentToNewRegionDelegate icon = (CrossAgentToNewRegionDelegate)iar.AsyncState;
ScenePresence agent = icon.EndInvoke(iar);
- // If the cross was successful, this agent is a child agent
- if (agent.IsChildAgent)
- agent.Reset();
- else // Not successful
- agent.RestoreInCurrentScene();
+ //// If the cross was successful, this agent is a child agent
+ //if (agent.IsChildAgent)
+ // agent.Reset();
+ //else // Not successful
+ // agent.RestoreInCurrentScene();
// In any case
agent.IsInTransit = false;
- //m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname);
+ m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname);
}
#endregion
--
cgit v1.1
From 48113f0fc811f21f4a113176caa9dbd78c0d3446 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 22 Dec 2011 19:44:52 +0000
Subject: Make it possible to force all prims to be phantom via the
collidable_prim boolean setting in the OpenSim.ini config [Startup] section.
Naturally, default is true.
When set to false, "phantom" flags on prims can be set as usual but all prims remain phantom.
This setting is for test purposes.
This switch does not affect the collision of avatars with the terrain.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 9 +++++++++
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 5 ++++-
bin/OpenSimDefaults.ini | 5 +++++
3 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 6666328..96e6863 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -79,6 +79,14 @@ namespace OpenSim.Region.Framework.Scenes
///
public bool m_physicalPrim;
+ ///
+ /// Controls whether prims can be collided with.
+ ///
+ ///
+ /// If this is set to false then prims cannot be subject to physics either.
+ ///
+ public bool CollidablePrims { get; private set; }
+
public float m_maxNonphys = 256;
public float m_maxPhys = 10;
public bool m_clampPrimSize;
@@ -651,6 +659,7 @@ namespace OpenSim.Region.Framework.Scenes
m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
m_physicalPrim = startupConfig.GetBoolean("physical_prim", true);
+ CollidablePrims = startupConfig.GetBoolean("collidable_prim", true);
m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys);
if (RegionInfo.NonphysPrimMax > 0)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index b29ecc6..8fd136d 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1473,6 +1473,9 @@ namespace OpenSim.Region.Framework.Scenes
///
public void ApplyPhysics(uint rootObjectFlags, bool VolumeDetectActive)
{
+ if (!ParentGroup.Scene.CollidablePrims)
+ return;
+
// m_log.DebugFormat(
// "[SCENE OBJECT PART]: Applying physics to {0} {1}, m_physicalPrim {2}",
// Name, LocalId, UUID, m_physicalPrim);
@@ -4318,7 +4321,7 @@ namespace OpenSim.Region.Framework.Scenes
if (ParentGroup.Scene == null)
return;
- if (PhysActor == null)
+ if (ParentGroup.Scene.CollidablePrims && PhysActor == null)
{
// It's not phantom anymore. So make sure the physics engine get's knowledge of it
PhysActor = ParentGroup.Scene.PhysicsScene.AddPrimShape(
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini
index 972efe4..3e7f8a6 100644
--- a/bin/OpenSimDefaults.ini
+++ b/bin/OpenSimDefaults.ini
@@ -181,6 +181,11 @@
; ## PHYSICS
; ##
+ ; If true then prims can be collided with by avatars, other prims, etc.
+ ; If false then all prims are phantom, no matter whether their phantom flag is checked or unchecked.
+ ; Also, no prims are subject to physics.
+ collidable_prim = true
+
; If true then prims can be made subject to physics (gravity, pushing, etc.).
; If false then physics flag can be set but it is not honoured. However, prims are still solid for the purposes of collision direction
physical_prim = true
--
cgit v1.1
From f7dbdba447cf91b03749c09d24709b03bc9f7831 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 22 Dec 2011 19:52:09 +0000
Subject: Remove unused m_physicalPrim parameter from SOG.ApplyPhysics()
---
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 1 -
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 5 ++---
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index a3e4b46..1e2901b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -333,7 +333,6 @@ namespace OpenSim.Region.Framework.Scenes
if (rot != null)
sceneObject.UpdateGroupRotationR((Quaternion)rot);
- //group.ApplyPhysics(m_physicalPrim);
if (sceneObject.RootPart.PhysActor != null && sceneObject.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero)
{
sceneObject.RootPart.ApplyImpulse((vel * sceneObject.GetMass()), false);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index abea788..0585477 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -669,7 +669,7 @@ namespace OpenSim.Region.Framework.Scenes
//m_log.DebugFormat("[SCENE]: Given local id {0} to part {1}, linknum {2}, parent {3} {4}", part.LocalId, part.UUID, part.LinkNum, part.ParentID, part.ParentUUID);
}
- ApplyPhysics(m_scene.m_physicalPrim);
+ ApplyPhysics();
// Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled
// for the same object with very different properties. The caller must schedule the update.
@@ -1239,8 +1239,7 @@ namespace OpenSim.Region.Framework.Scenes
///
/// Apply physics to this group
///
- ///
- public void ApplyPhysics(bool m_physicalPrim)
+ public void ApplyPhysics()
{
// Apply physics to the root prim
m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive);
--
cgit v1.1
From 7ccd8f8f1d8accb0c5f67e9e3bc9a43fbbfd93e2 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 22 Dec 2011 19:57:50 +0000
Subject: rename Scene.m_physicalPrim to PhysicalPrims since its public and
access external as a property
---
OpenSim/Region/Framework/Scenes/Scene.cs | 4 ++--
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 96e6863..b4972d6 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -77,7 +77,7 @@ namespace OpenSim.Region.Framework.Scenes
/// Controls whether physics can be applied to prims. Even if false, prims still have entries in a
/// PhysicsScene in order to perform collision detection
///
- public bool m_physicalPrim;
+ public bool PhysicalPrims { get; private set; }
///
/// Controls whether prims can be collided with.
@@ -658,7 +658,7 @@ namespace OpenSim.Region.Framework.Scenes
//Animation states
m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
- m_physicalPrim = startupConfig.GetBoolean("physical_prim", true);
+ PhysicalPrims = startupConfig.GetBoolean("physical_prim", true);
CollidablePrims = startupConfig.GetBoolean("collidable_prim", true);
m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 8fd136d..aea47e6 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1742,7 +1742,7 @@ namespace OpenSim.Region.Framework.Scenes
///
public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew)
{
- if (!ParentGroup.Scene.m_physicalPrim && UsePhysics)
+ if (!ParentGroup.Scene.PhysicalPrims && UsePhysics)
return;
if (IsJoint())
--
cgit v1.1
From 790ca65c84b8597b20f63ba48556c0fb2141a4f0 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 22 Dec 2011 20:22:15 +0000
Subject: Align default ODE_STEPSIZE with that already used through
OpenSimDefaults.ini
---
OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index 04ba738..2194ff0 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -110,7 +110,7 @@ namespace OpenSim.Region.Physics.OdePlugin
private const uint m_regionWidth = Constants.RegionSize;
private const uint m_regionHeight = Constants.RegionSize;
- private float ODE_STEPSIZE = 0.020f;
+ private float ODE_STEPSIZE = 0.0178f;
private float metersInSpace = 29.9f;
private float m_timeDilation = 1.0f;
@@ -456,7 +456,7 @@ namespace OpenSim.Region.Physics.OdePlugin
mAvatarObjectContactFriction = physicsconfig.GetFloat("m_avatarobjectcontact_friction", 75f);
mAvatarObjectContactBounce = physicsconfig.GetFloat("m_avatarobjectcontact_bounce", 0.1f);
- ODE_STEPSIZE = physicsconfig.GetFloat("world_stepsize", 0.020f);
+ ODE_STEPSIZE = physicsconfig.GetFloat("world_stepsize", ODE_STEPSIZE);
m_physicsiterations = physicsconfig.GetInt("world_internal_steps_without_collisions", 10);
avDensity = physicsconfig.GetFloat("av_density", 80f);
--
cgit v1.1
From 6b08c051a33d97d94d9c68d287926939f1a5d6b2 Mon Sep 17 00:00:00 2001
From: Mic Bowman
Date: Thu, 22 Dec 2011 15:31:51 -0800
Subject: Enables processing of hypergrid links through simiangrid services.
Thanks otakup0pe
---
.../SimianGrid/SimianGridServiceConnector.cs | 81 +++++++++++++++-------
1 file changed, 56 insertions(+), 25 deletions(-)
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
index 918544f..67a65ff 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
@@ -341,26 +341,54 @@ namespace OpenSim.Services.Connectors.SimianGrid
public List GetHyperlinks(UUID scopeID)
{
- // Hypergrid/linked regions are not supported
- return new List();
+ List foundRegions = new List();
+
+ NameValueCollection requestArgs = new NameValueCollection
+ {
+ { "RequestMethod", "GetScenes" },
+ { "HyperGrid", "true" },
+ { "Enabled", "1" }
+ };
+
+ OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
+ if (response["Success"].AsBoolean())
+ {
+ // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] found regions with name {0}",name);
+
+ OSDArray array = response["Scenes"] as OSDArray;
+ if (array != null)
+ {
+ for (int i = 0; i < array.Count; i++)
+ {
+ GridRegion region = ResponseToGridRegion(array[i] as OSDMap);
+ if (region != null)
+ foundRegions.Add(region);
+ }
+ }
+ }
+
+ return foundRegions;
}
-
+
public int GetRegionFlags(UUID scopeID, UUID regionID)
{
- const int REGION_ONLINE = 4;
-
NameValueCollection requestArgs = new NameValueCollection
{
{ "RequestMethod", "GetScene" },
{ "SceneID", regionID.ToString() }
};
- // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request region flags for {0}",regionID.ToString());
+ m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request region flags for {0}",regionID.ToString());
OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
if (response["Success"].AsBoolean())
{
- return response["Enabled"].AsBoolean() ? REGION_ONLINE : 0;
+ OSDMap extraData = response["ExtraData"] as OSDMap;
+ int enabled = response["Enabled"].AsBoolean() ? (int) OpenSim.Data.RegionFlags.RegionOnline : 0;
+ int hypergrid = extraData["HyperGrid"].AsBoolean() ? (int) OpenSim.Data.RegionFlags.Hyperlink : 0;
+ int flags = enabled | hypergrid;
+ m_log.DebugFormat("[SGGC] enabled - {0} hg - {1} flags - {2}", enabled, hypergrid, flags);
+ return flags;
}
else
{
@@ -411,24 +439,27 @@ namespace OpenSim.Services.Connectors.SimianGrid
Vector3d minPosition = response["MinPosition"].AsVector3d();
region.RegionLocX = (int)minPosition.X;
region.RegionLocY = (int)minPosition.Y;
-
- Uri httpAddress = response["Address"].AsUri();
- region.ExternalHostName = httpAddress.Host;
- region.HttpPort = (uint)httpAddress.Port;
-
- region.ServerURI = extraData["ServerURI"].AsString();
-
- IPAddress internalAddress;
- IPAddress.TryParse(extraData["InternalAddress"].AsString(), out internalAddress);
- if (internalAddress == null)
- internalAddress = IPAddress.Any;
-
- region.InternalEndPoint = new IPEndPoint(internalAddress, extraData["InternalPort"].AsInteger());
- region.TerrainImage = extraData["MapTexture"].AsUUID();
- region.Access = (byte)extraData["Access"].AsInteger();
- region.RegionSecret = extraData["RegionSecret"].AsString();
- region.EstateOwner = extraData["EstateOwner"].AsUUID();
- region.Token = extraData["Token"].AsString();
+
+ if ( ! extraData["HyperGrid"] ) {
+ Uri httpAddress = response["Address"].AsUri();
+ region.ExternalHostName = httpAddress.Host;
+ region.HttpPort = (uint)httpAddress.Port;
+
+ IPAddress internalAddress;
+ IPAddress.TryParse(extraData["InternalAddress"].AsString(), out internalAddress);
+ if (internalAddress == null)
+ internalAddress = IPAddress.Any;
+
+ region.InternalEndPoint = new IPEndPoint(internalAddress, extraData["InternalPort"].AsInteger());
+ region.TerrainImage = extraData["MapTexture"].AsUUID();
+ region.Access = (byte)extraData["Access"].AsInteger();
+ region.RegionSecret = extraData["RegionSecret"].AsString();
+ region.EstateOwner = extraData["EstateOwner"].AsUUID();
+ region.Token = extraData["Token"].AsString();
+ region.ServerURI = extraData["ServerURI"].AsString();
+ } else {
+ region.ServerURI = response["Address"];
+ }
return region;
}
--
cgit v1.1
From f394cb2e8f1605809dbf3d5503b9ae00dc1f5180 Mon Sep 17 00:00:00 2001
From: Mic Bowman
Date: Thu, 22 Dec 2011 16:21:32 -0800
Subject: fix the UsesPhysics flag to reference the physics flag rather than
the temponrez flag
---
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 0585477..8860764 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -210,7 +210,7 @@ namespace OpenSim.Region.Framework.Scenes
///
public bool UsesPhysics
{
- get { return (RootPart.Flags & PrimFlags.TemporaryOnRez) != 0; }
+ get { return (RootPart.Flags & PrimFlags.Physics) != 0; }
}
///
--
cgit v1.1
From 456c89a7a30c5c2ec2e228beb717b9c611106364 Mon Sep 17 00:00:00 2001
From: Mic Bowman
Date: Thu, 22 Dec 2011 16:59:51 -0800
Subject: Fixes some problems with objects that attempt to cross a region
boundary into a region that does not exist. This is particularly problematic
for physical objects where the velocity continues to move them out of the
region causing an infinite number of failed region crossings. The patch
forces an object that fails a crossing to be non-physical and moves it back
into the starting region.
---
.../EntityTransfer/EntityTransferModule.cs | 24 ++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index b9d5d32..098e5cb 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -1705,6 +1705,30 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
uint x = 0, y = 0;
Utils.LongToUInts(newRegionHandle, out x, out y);
GridRegion destination = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y);
+
+ if (destination == null || !CrossPrimGroupIntoNewRegion(destination, grp, silent))
+ {
+ m_log.InfoFormat("[ENTITY TRANSFER MODULE] cross region transfer failed for object {0}",grp.UUID);
+
+ // We are going to move the object back to the old position so long as the old position
+ // is in the region
+ oldGroupPosition.X = Util.Clamp(oldGroupPosition.X,1.0f,(float)Constants.RegionSize-1);
+ oldGroupPosition.Y = Util.Clamp(oldGroupPosition.Y,1.0f,(float)Constants.RegionSize-1);
+ oldGroupPosition.Z = Util.Clamp(oldGroupPosition.Z,1.0f,4096.0f);
+
+ grp.RootPart.GroupPosition = oldGroupPosition;
+
+ // Need to turn off the physics flags, otherwise the object will continue to attempt to
+ // move out of the region creating an infinite loop of failed attempts to cross
+ grp.UpdatePrimFlags(grp.RootPart.LocalId,false,grp.IsTemporary,grp.IsPhantom,false);
+
+ grp.ScheduleGroupForFullUpdate();
+ }
+
+
+
+
+
if (destination != null && !CrossPrimGroupIntoNewRegion(destination, grp, silent))
{
grp.RootPart.GroupPosition = oldGroupPosition;
--
cgit v1.1
From c6ce464dbc64dc24878a8032412e82b02b9314f6 Mon Sep 17 00:00:00 2001
From: Mic Bowman
Date: Fri, 23 Dec 2011 10:13:32 -0800
Subject: remove the old region crossing handler
---
.../Framework/EntityTransfer/EntityTransferModule.cs | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 098e5cb..cbef6ce 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -1724,16 +1724,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
grp.ScheduleGroupForFullUpdate();
}
-
-
-
-
-
- if (destination != null && !CrossPrimGroupIntoNewRegion(destination, grp, silent))
- {
- grp.RootPart.GroupPosition = oldGroupPosition;
- grp.ScheduleGroupForFullUpdate();
- }
}
--
cgit v1.1
From 26bb95fe3d5239c183bc3b312ef05e73fc06749c Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Fri, 23 Dec 2011 10:58:30 -0800
Subject: HG: AAdded a few missing /'s at the end of URLs
---
OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs | 2 +-
OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs | 2 ++
.../Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs | 3 +++
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs
index 7cfd6e8..ff1dd5f 100644
--- a/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs
@@ -53,7 +53,7 @@ namespace OpenSim.Services.Connectors
public virtual string Helo()
{
- HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI + "/helo");
+ HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI + "/helo/");
// Eventually we need to switch to HEAD
/* req.Method = "HEAD"; */
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
index 9573e21..99523a1 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
@@ -86,6 +86,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
public SimianAssetServiceConnector(string url)
{
+ if (!url.EndsWith("/") && !url.EndsWith("="))
+ url = url + '/';
m_serverUrl = url;
}
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
index 39df1f5..f828abb 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
@@ -92,7 +92,10 @@ namespace OpenSim.Services.Connectors.SimianGrid
public SimianInventoryServiceConnector(string url)
{
+ if (!url.EndsWith("/") && !url.EndsWith("="))
+ url = url + '/';
m_serverUrl = url;
+
}
public void Initialise(IConfigSource source)
--
cgit v1.1
From f9a1fd5748a0f33adad3b8b06702f9474dbf6908 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Fri, 23 Dec 2011 15:08:13 -0800
Subject: HG: one more adjustment with trailing /s
---
.../CoreModules/Framework/InventoryAccess/HGAssetMapper.cs | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
index 81b65c5..d20c9eb 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
@@ -73,7 +73,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
public AssetBase FetchAsset(string url, UUID assetID)
{
- AssetBase asset = m_scene.AssetService.Get(url + "/" + assetID.ToString());
+ if (!url.EndsWith("/") && !url.EndsWith("="))
+ url = url + "/";
+
+ AssetBase asset = m_scene.AssetService.Get(url + assetID.ToString());
if (asset != null)
{
@@ -87,6 +90,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
{
if (asset != null)
{
+ if (!url.EndsWith("/") && !url.EndsWith("="))
+ url = url + "/";
+
// See long comment in AssetCache.AddAsset
if (!asset.Temporary || asset.Local)
{
@@ -99,7 +105,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
Copy(asset, asset1);
try
{
- asset1.ID = url + "/" + asset.ID;
+ asset1.ID = url + asset.ID;
}
catch
{
--
cgit v1.1
From b6cfe15c7c0b3697709179cbbf32818576919642 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Sat, 24 Dec 2011 07:44:26 -0800
Subject: HG: more / love for Xmas
---
OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs | 7 ++++--
.../Connectors/Asset/HGAssetServiceConnector.cs | 21 +++++++++++++++--
.../Connectors/Hypergrid/HeloServiceConnector.cs | 27 ++++++++++++++++++++--
prebuild.xml | 1 +
4 files changed, 50 insertions(+), 6 deletions(-)
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
index e9e2dca..1dea87e 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
@@ -385,8 +385,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
string assetServerURL = string.Empty;
if (InventoryAccessModule.IsForeignUser(AgentID, out assetServerURL))
{
- m_log.DebugFormat("[J2KIMAGE]: texture {0} not found in local asset storage. Trying user's storage.", id);
- AssetService.Get(assetServerURL + "/" + id, InventoryAccessModule, AssetReceived);
+ if (!assetServerURL.EndsWith("/") && !assetServerURL.EndsWith("="))
+ assetServerURL = assetServerURL + "/";
+
+ m_log.DebugFormat("[J2KIMAGE]: texture {0} not found in local asset storage. Trying user's storage.", assetServerURL + id);
+ AssetService.Get(assetServerURL + id, InventoryAccessModule, AssetReceived);
return;
}
}
diff --git a/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs
index 5c31639..bb5d51f 100644
--- a/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs
@@ -29,7 +29,9 @@ using log4net;
using Nini.Config;
using System;
using System.Collections.Generic;
+using System.Collections.Specialized;
using System.Reflection;
+using System.Web;
using OpenSim.Framework;
using OpenSim.Services.Interfaces;
using OpenSim.Services.Connectors.Hypergrid;
@@ -73,11 +75,26 @@ namespace OpenSim.Services.Connectors
if (Uri.TryCreate(id, UriKind.Absolute, out assetUri) &&
assetUri.Scheme == Uri.UriSchemeHttp)
{
- url = "http://" + assetUri.Authority;
- assetID = assetUri.LocalPath.Trim(new char[] {'/'});
+ // Simian
+ if (assetUri.Query != string.Empty)
+ {
+ NameValueCollection qscoll = HttpUtility.ParseQueryString(assetUri.Query);
+ assetID = qscoll["id"];
+ if (assetID != null)
+ url = id.Replace(assetID, ""); // Malformed again, as simian expects
+ else
+ url = id; // !!! best effort
+ }
+ else // robust
+ {
+ url = "http://" + assetUri.Authority;
+ assetID = assetUri.LocalPath.Trim(new char[] { '/' });
+ }
+
return true;
}
+ m_log.DebugFormat("[HG ASSET SERVICE]: Malformed URL {0}", id);
return false;
}
diff --git a/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs
index ff1dd5f..8ac89cc 100644
--- a/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs
@@ -47,13 +47,36 @@ namespace OpenSim.Services.Connectors
public HeloServicesConnector(string serverURI)
{
- m_ServerURI = serverURI.TrimEnd('/');
+ if (!serverURI.EndsWith("="))
+ m_ServerURI = serverURI.TrimEnd('/') + "/helo/";
+ else
+ {
+ // Simian sends malformed urls like this:
+ // http://valley.virtualportland.org/simtest/Grid/?id=
+ //
+ try
+ {
+ Uri uri = new Uri(serverURI + "xxx");
+ if (uri.Query == string.Empty)
+ m_ServerURI = serverURI.TrimEnd('/') + "/helo/";
+ else
+ {
+ serverURI = serverURI + "xxx";
+ m_ServerURI = serverURI.Replace("?" + uri.Query, "");
+ m_ServerURI = m_ServerURI.TrimEnd('/') + "/helo/";
+ }
+ }
+ catch (UriFormatException e)
+ {
+ m_log.WarnFormat("[HELO SERVICE]: Malformed URL {0}", serverURI);
+ }
+ }
}
public virtual string Helo()
{
- HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI + "/helo/");
+ HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI);
// Eventually we need to switch to HEAD
/* req.Method = "HEAD"; */
diff --git a/prebuild.xml b/prebuild.xml
index e951187..4ea4708 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -926,6 +926,7 @@
../../../bin/
+
--
cgit v1.1
From f36fe45fa7468dd6e785d523c5df38666140135f Mon Sep 17 00:00:00 2001
From: BlueWall
Date: Sun, 25 Dec 2011 00:04:42 -0500
Subject: Add Copy task to Prebuild.exe (vsxxxx targets)
---
Prebuild/COPYING | 130 +-
Prebuild/NEWS | 400 ++--
Prebuild/Prebuild.exe | Bin 0 -> 226816 bytes
Prebuild/README | 548 ++---
Prebuild/prebuild.xml | 6 +-
Prebuild/scripts/SharpDevelop2.bat | 8 +-
Prebuild/scripts/VS2008.bat | 8 +-
Prebuild/scripts/VS2010.bat | 8 +-
Prebuild/scripts/autotools.bat | 8 +-
Prebuild/src/Core/Nodes/CleanFilesNode.cs | 158 +-
Prebuild/src/Core/Nodes/CleanupNode.cs | 168 +-
.../src/Core/Nodes/ConfigurationNodeCollection.cs | 142 +-
Prebuild/src/Core/Nodes/DatabaseProjectNode.cs | 186 +-
Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs | 126 +-
Prebuild/src/Core/Nodes/FileNode.cs | 9 +-
Prebuild/src/Core/Nodes/FilesNode.cs | 34 +
Prebuild/src/Core/Nodes/MatchNode.cs | 17 +-
Prebuild/src/Core/Targets/AutotoolsTarget.cs | 2140 ++++++++++----------
Prebuild/src/Core/Targets/DebugTarget.cs | 2 +-
Prebuild/src/Core/Targets/VS2010Target.cs | 276 +--
Prebuild/src/Core/Targets/VSGenericTarget.cs | 1894 ++++++++---------
Prebuild/src/Prebuild.cs | 2 +-
Prebuild/src/data/prebuild-1.7.xsd | 700 +++----
Prebuild/src/data/prebuild-1.9.xsd | 672 +++---
bin/Prebuild.exe | Bin 228352 -> 226816 bytes
25 files changed, 3873 insertions(+), 3769 deletions(-)
create mode 100755 Prebuild/Prebuild.exe
diff --git a/Prebuild/COPYING b/Prebuild/COPYING
index c57c080..d3cdf7e 100644
--- a/Prebuild/COPYING
+++ b/Prebuild/COPYING
@@ -1,65 +1,65 @@
-BSD License
-Copyright (c)2004-2008
-
-See AUTHORS file for list of copyright holders
-
-Dave Hudson (jendave@yahoo.com),
-Matthew Holmes (matthew@wildfiregames.com)
-Dan Moorehead (dan05a@gmail.com)
-Rob Loach (http://www.robloach.net)
-C.J. Adams-Collier (cjac@colliertech.org)
-
-http://dnpb.sourceforge.net
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-3. The names of the authors may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-
----
-
-Portions of src/Core/Targets/AutotoolsTarget.cs
-// Copyright (C) 2006 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.
+BSD License
+Copyright (c)2004-2008
+
+See AUTHORS file for list of copyright holders
+
+Dave Hudson (jendave@yahoo.com),
+Matthew Holmes (matthew@wildfiregames.com)
+Dan Moorehead (dan05a@gmail.com)
+Rob Loach (http://www.robloach.net)
+C.J. Adams-Collier (cjac@colliertech.org)
+
+http://dnpb.sourceforge.net
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+3. The names of the authors may not be used to endorse or promote
+ products derived from this software without specific prior written
+ permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+
+---
+
+Portions of src/Core/Targets/AutotoolsTarget.cs
+// Copyright (C) 2006 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.
diff --git a/Prebuild/NEWS b/Prebuild/NEWS
index 3ab3108..bea28da 100644
--- a/Prebuild/NEWS
+++ b/Prebuild/NEWS
@@ -1,200 +1,200 @@
-Prebuild is an XML-driven pre-build tool allowing developers to easily generate project or make files for major IDE's and .NET development tools including: Visual Studio 2005, Visual Studio 2003, Visual Studio 2002, SharpDevelop, MonoDevelop, and NAnt.
-
-Documentation and downloads are available at http://dnpb.sourceforge.net.
-
-Prebuild is licensed under the BSD license.
-
-[ XXXXXXX XX, XXX - 1.3.2 ]
- + Added Keyfile signing to NAnt target and VS2005 target
- + Updated XSD file to 1.7
- + Boo and VisualBasic Language support in VS2005 target
- + Added basic Autotools target. It creates a non-recursive Autotools system.
- ! Multiple files can be excluded from the Match node
- ! VS2005 now handles .resx files correctly.
- ! NAnt and Autotools now handle defines
- ! NAnt and Autotools now handle resources
- + Conditional XML variables can be passed through the command line.
- + Added /install and /remove command line flags to install and remove assemblies from the GAC
- + Many fixes to VS2005 target
-
-[ July 21, 2006 - 1.3.1 ]
- ! VS2005 fixes from Rob Loach
- ! NAnt fixes from Rob Loach and David Hudson
- ! XML doc fixes from Rob Loach
- + Added SharpDevelop2 target (really just uses VS2005 target)
- ! Fixed bug with BuildEvents in Monodevelop target
- + Passing /yes will default to answering yes to any warnings
-
-[ February 28, 2006 - 1.3 ]
- + Added MonoDevelop target.
- + Added NAnt target.
- + Lots of fixes to all targets.
- * Cleaned up the code using FXCop.
- * Updated schema to 1.6 to fix a typo and add a new parameter.
- * jendave is now the maintainer of the project. RobLoach has been added as a developer.
- * Removed references to 'dnpb'.
- + Added rudimentary support for pre- and post- build scripts
- * Updated examples.
-
-[ August 5, 2004 - 1.2 ]
- + Added Visual Studio Express (vs2005express) target contributed by Borrillis and modified for use with different languages
- + Added the allowedgroups command line option followed by a pipe-delimited list of project group filter flags (eg. Group1|Group2) allow optional filtering of all projects that dont have at least one of these flags
- + Added the filterGroups XML attribute to the project node and updated the scheme to v1.5 for this addition, it is used to specified the delimited list of filter groups to which a project belongs
- * Modified the removedir command line option to allow for a pipe-delimited list of directory names
- ! Modified the resource loading code to search for resourced without the prepended namespace (as Visual Studio .NET does it) to allow for it to be compiled with SharpDevelop as well
- + Added the GenerateXmlDocFile boolean option to the Options XML element
- * Changed the behavior of the XmlDocFile option so that if not specified it uses the assemblyName (without file extension) + .xml for the file name instead of just not generating the file since the new GenerateXmlDocFile takes care of this
-
-[ January 3, 2004 - 1.1 ]
- ! Replaced regex use for more efficient manual parsing to allow use on non-windows platforms with Mono which has Regex problems
- + Added the checkOsVars attribute to the root element for enabling interpolation for Enviroment variables in the form ${var}, otherwise no checking is performed for efficiency-sake
- * Make the version attribute on the root element optional as it isn't used and not needed since the schema url contains the version
-
-[ December 30, 2004 - 1.1 ]
- ! Applied Leed's fix for SharpDevelop references
- + Rewrote much of the processing for better validation and without the use of a temp file
- + Added support for configurations at the project level which are named All. They now apply changes to all Solution level defined configs
- * Changed all spaces into tabs
- + Added support for the None build action
- * Replaced all sequence's in the XML schema for all's because the order doesn't matter since the xml file is loaded into an XmlDocument
-
-[ December 25, 2004 - 1.0 ]
- + Added the /removedir option for cleaning directories like obj before file releases
- + Changed WriteTempXml() and the new DeleteTempXml() methods to be compiled only in DEBUG builds
- * Made path optional for Match elements (defaults to current directory) and updates schema for it
- ! Fixed XML example in the readme.txt
- + Added example xml files to docs directory
- * Updated license.txt to add Dan Moorehead and update copyright years
- + Updated prebuild.xml to take advantage of the default path attribute for match elements
- + Updated Clean to delete the obj directories
-
-[ December 25, 2004 - 0.13 ]
- + Added dnpb.exe so that it can be used to generate the project files
- + Added dnpb.ico
- * Added parameterless Write statement to Log for writing a single line
- * Changed scehema to version 1.3 for support of icon attribute
- * Added support for All configuration name under a Project node signifying common settings for all configurations
- ! Fixed the SupressWarnings by adding the corresponding field to OptionsNode
- * Wrote documentation in docs/readme.txt
- * Added Dan Moorehead to copyrights and extended date from 2004 to 2004-2005
- * Updated prebuild.xml
- * Optimized Log class
- * Updated OutputUsage()
- * /clean targets all by default
- * No log file is used by default, /log without value specified uses default file name
- + Added support for the /pause which pauses the utility after execution to observe output
-
-
-[ September 27, 2004 - 0.12.2a ]
- ! Fixed a nasty bug when trying to delete our temp file for pre-processing.
-
-[ September 15, 2004 - 0.12.2 ]
- + Expanded platform identification, thanks to the NAnt guys for shedding some
- light on how to properly check for UNIX platforms! Thanks guys!
- * POSIX OS identifier changed to UNIX. Valid OS names are now "Win32", "UNIX",
- and "Unknown".
- ! Fixed SharpDevelop target to properly use the 'rootNamespace' attribute of
- the Project tag.
- + New command-line switch, /ppo, forces DNPB to pre-process the file and write
- the pre-processed file. This allows you to test/debug your pre-processor
- macros. No other processing will be done. You can specify a target file as
- a paramter for the /ppo switch, or DNPB will write the file 'preprocessed.xml'
- if you do not specify a file.
- + The Match tag now has a 'buildAction' attribute which functions exactly like
- the attribute of the same name for the File tag.
-
-[ August 5, 2004 - 0.12.1 ]
- + Added environment variable expansion for all values. Environment variables
- should be listed in the form ${VAR}.
-
-[ July 30, 2004 - 0.12.0 ]
- + Added preprocessing via XML processing information tags. Available tags
- are: ?>, ?>, and . The
- current expression parser is very basic, but will be replaced with a more
- capable parser over time. Current operators available are: =, !=, <, >,
- <=, >=. Current test variables available: OS, RuntimeVersion, RuntimeMajor,
- RuntimeMinor, RuntimeRevision.
-
-[ July 27, 2004 - 0.11.4 ]
- + Added 'useRegex' attribute to the Match tag. Matches can now use regular
- expressions to match filenames.
- + Added the 'assemblyName' attribute to the Project tag. Projects can now
- set their output assembly name.
- ! Fixed several bugs in the way that Project tags inheirt their parent
- Solutions configuration options. This operation should now work fully as
- intended.
- ! Due to some wierdness, Project Guid's are now stored as part of the Project
- node and created at parse time.
-
-[ May 11, 2004 - 0.11.3 ]
- ! Fixed a bug where I was writing the wrong property name for a projects root
- namespace.
- ! Removed a DEBUG statement I had left in the code in 0.11.2.
- ! Fixed a bug in the VS2002 writer which caused the version variables to not
- be overriden correctly.
- + Added the rootNamespace property to the element, allowing you to
- specify the root namespace.
- * /target and /clean are now mutually exclusive command line switches, and
- they both now take the all option. In the case of /target all, all build
- file for all targets will be created. In the case of /clean all, the user
- will be prompted to make sure they want to do it, and if so, will clean
- all build files for all targets.
-
-[ April 22, 2004 - 0.11.2 ]
- ! Fixed a bug with the /file command-line operator. Was using the unresolved
- file path rather then the resolved one, was making the attempt to open the
- dnpb file fail.
- ! Fixed a bug in the schema that required at least 1 solution and 1 reference
- path. We can do just fine with 0 of either of these. Some files may be all
- statements and not have any tags.
- ! Fixed a bug that caused the project references not to be written with the
- SharpDevelop target.
- * Changed the schema to version 1.2, allowing for Configuration nodes to exist
- under project nodes. The inheritance of values is hierarchical. Meaning, if
- you define a configuration named Debug at the Soltion level, and one by the
- same name at the Project level, the one at the Project level will first
- inherit the options of the Solution level configuration, then set it's own
- options. If you define a configuration at the Project level and it does not
- exist at the Solution level, it will be created at the Solution level.
- * Project references should now work correctly across the board. Note that due
- to a restriction in Visual Studio, you can only reference projects in the same
- solution.
-
-[ April 21, 2004 - 0.11.1 ]
- ! Fixed a problem with resolving paths in various targets. Was not properly
- setting the CWD.
- * Schema updated to 1.1, moving the ReferencePath element from the Options
- element to the Project element. This makes more logical sense, given that
- reference paths are resolved relative to the project path. Any prebuild.xml
- file referecning verison 1.0 will fail! Please update to the 1.1 schema.
-
-[ April 19, 2004 - 0.11.0 ]
- * Added several attributes across the code to make FxCop happy
- ! Fixed bugs in reference paths being written in the VS targets.
- ! Fixed a bug in ProjectNode which was doing two CWDStack.Push() calls instead of
- a Push/Pop pair. Was wreaking havoc with tags.
- ! Fixed some bugs in the path tracking, both the Project and Solution nodes now
- have a FullPath property, which is the full path to the file resolved at load
- time. This should fix all path relativity problems.
- + Added new /clean switch, allowing the target to clean up any files it generated.
- in accordance, the ITarget interface has been updated to support a new Clean()
- method.
- + Completed addition of the tag, to allow the referencing of external
- prebuild.xml files.
- + Added the runtime attribute to the Project element. This allows the developer
- to specify which runtime a project should target (Mono or Microsoft). This is
- of course ignored in certain targets like the Visual Studio targets.
- + Added the SharpDevelop target.
-
-[ April 13, 2004 - 0.10.1a ]
- + Added the buildAction attribute to the File node. This is needed for dnpb
- to even be able to bootstrap itself (dnpb-1.0.xsd must be an embedded resource)
-
-[ April 13, 2004 - 0.10.1 ]
- * First Release
-
-[ Key ]
-* = Change or information
-+ = Addition
-! = Bug Fix
-
+Prebuild is an XML-driven pre-build tool allowing developers to easily generate project or make files for major IDE's and .NET development tools including: Visual Studio 2005, Visual Studio 2003, Visual Studio 2002, SharpDevelop, MonoDevelop, and NAnt.
+
+Documentation and downloads are available at http://dnpb.sourceforge.net.
+
+Prebuild is licensed under the BSD license.
+
+[ XXXXXXX XX, XXX - 1.3.2 ]
+ + Added Keyfile signing to NAnt target and VS2005 target
+ + Updated XSD file to 1.7
+ + Boo and VisualBasic Language support in VS2005 target
+ + Added basic Autotools target. It creates a non-recursive Autotools system.
+ ! Multiple files can be excluded from the Match node
+ ! VS2005 now handles .resx files correctly.
+ ! NAnt and Autotools now handle defines
+ ! NAnt and Autotools now handle resources
+ + Conditional XML variables can be passed through the command line.
+ + Added /install and /remove command line flags to install and remove assemblies from the GAC
+ + Many fixes to VS2005 target
+
+[ July 21, 2006 - 1.3.1 ]
+ ! VS2005 fixes from Rob Loach
+ ! NAnt fixes from Rob Loach and David Hudson
+ ! XML doc fixes from Rob Loach
+ + Added SharpDevelop2 target (really just uses VS2005 target)
+ ! Fixed bug with BuildEvents in Monodevelop target
+ + Passing /yes will default to answering yes to any warnings
+
+[ February 28, 2006 - 1.3 ]
+ + Added MonoDevelop target.
+ + Added NAnt target.
+ + Lots of fixes to all targets.
+ * Cleaned up the code using FXCop.
+ * Updated schema to 1.6 to fix a typo and add a new parameter.
+ * jendave is now the maintainer of the project. RobLoach has been added as a developer.
+ * Removed references to 'dnpb'.
+ + Added rudimentary support for pre- and post- build scripts
+ * Updated examples.
+
+[ August 5, 2004 - 1.2 ]
+ + Added Visual Studio Express (vs2005express) target contributed by Borrillis and modified for use with different languages
+ + Added the allowedgroups command line option followed by a pipe-delimited list of project group filter flags (eg. Group1|Group2) allow optional filtering of all projects that dont have at least one of these flags
+ + Added the filterGroups XML attribute to the project node and updated the scheme to v1.5 for this addition, it is used to specified the delimited list of filter groups to which a project belongs
+ * Modified the removedir command line option to allow for a pipe-delimited list of directory names
+ ! Modified the resource loading code to search for resourced without the prepended namespace (as Visual Studio .NET does it) to allow for it to be compiled with SharpDevelop as well
+ + Added the GenerateXmlDocFile boolean option to the Options XML element
+ * Changed the behavior of the XmlDocFile option so that if not specified it uses the assemblyName (without file extension) + .xml for the file name instead of just not generating the file since the new GenerateXmlDocFile takes care of this
+
+[ January 3, 2004 - 1.1 ]
+ ! Replaced regex use for more efficient manual parsing to allow use on non-windows platforms with Mono which has Regex problems
+ + Added the checkOsVars attribute to the root element for enabling interpolation for Enviroment variables in the form ${var}, otherwise no checking is performed for efficiency-sake
+ * Make the version attribute on the root element optional as it isn't used and not needed since the schema url contains the version
+
+[ December 30, 2004 - 1.1 ]
+ ! Applied Leed's fix for SharpDevelop references
+ + Rewrote much of the processing for better validation and without the use of a temp file
+ + Added support for configurations at the project level which are named All. They now apply changes to all Solution level defined configs
+ * Changed all spaces into tabs
+ + Added support for the None build action
+ * Replaced all sequence's in the XML schema for all's because the order doesn't matter since the xml file is loaded into an XmlDocument
+
+[ December 25, 2004 - 1.0 ]
+ + Added the /removedir option for cleaning directories like obj before file releases
+ + Changed WriteTempXml() and the new DeleteTempXml() methods to be compiled only in DEBUG builds
+ * Made path optional for Match elements (defaults to current directory) and updates schema for it
+ ! Fixed XML example in the readme.txt
+ + Added example xml files to docs directory
+ * Updated license.txt to add Dan Moorehead and update copyright years
+ + Updated prebuild.xml to take advantage of the default path attribute for match elements
+ + Updated Clean to delete the obj directories
+
+[ December 25, 2004 - 0.13 ]
+ + Added dnpb.exe so that it can be used to generate the project files
+ + Added dnpb.ico
+ * Added parameterless Write statement to Log for writing a single line
+ * Changed scehema to version 1.3 for support of icon attribute
+ * Added support for All configuration name under a Project node signifying common settings for all configurations
+ ! Fixed the SupressWarnings by adding the corresponding field to OptionsNode
+ * Wrote documentation in docs/readme.txt
+ * Added Dan Moorehead to copyrights and extended date from 2004 to 2004-2005
+ * Updated prebuild.xml
+ * Optimized Log class
+ * Updated OutputUsage()
+ * /clean targets all by default
+ * No log file is used by default, /log without value specified uses default file name
+ + Added support for the /pause which pauses the utility after execution to observe output
+
+
+[ September 27, 2004 - 0.12.2a ]
+ ! Fixed a nasty bug when trying to delete our temp file for pre-processing.
+
+[ September 15, 2004 - 0.12.2 ]
+ + Expanded platform identification, thanks to the NAnt guys for shedding some
+ light on how to properly check for UNIX platforms! Thanks guys!
+ * POSIX OS identifier changed to UNIX. Valid OS names are now "Win32", "UNIX",
+ and "Unknown".
+ ! Fixed SharpDevelop target to properly use the 'rootNamespace' attribute of
+ the Project tag.
+ + New command-line switch, /ppo, forces DNPB to pre-process the file and write
+ the pre-processed file. This allows you to test/debug your pre-processor
+ macros. No other processing will be done. You can specify a target file as
+ a paramter for the /ppo switch, or DNPB will write the file 'preprocessed.xml'
+ if you do not specify a file.
+ + The Match tag now has a 'buildAction' attribute which functions exactly like
+ the attribute of the same name for the File tag.
+
+[ August 5, 2004 - 0.12.1 ]
+ + Added environment variable expansion for all values. Environment variables
+ should be listed in the form ${VAR}.
+
+[ July 30, 2004 - 0.12.0 ]
+ + Added preprocessing via XML processing information tags. Available tags
+ are: ?>, ?>, and . The
+ current expression parser is very basic, but will be replaced with a more
+ capable parser over time. Current operators available are: =, !=, <, >,
+ <=, >=. Current test variables available: OS, RuntimeVersion, RuntimeMajor,
+ RuntimeMinor, RuntimeRevision.
+
+[ July 27, 2004 - 0.11.4 ]
+ + Added 'useRegex' attribute to the Match tag. Matches can now use regular
+ expressions to match filenames.
+ + Added the 'assemblyName' attribute to the Project tag. Projects can now
+ set their output assembly name.
+ ! Fixed several bugs in the way that Project tags inheirt their parent
+ Solutions configuration options. This operation should now work fully as
+ intended.
+ ! Due to some wierdness, Project Guid's are now stored as part of the Project
+ node and created at parse time.
+
+[ May 11, 2004 - 0.11.3 ]
+ ! Fixed a bug where I was writing the wrong property name for a projects root
+ namespace.
+ ! Removed a DEBUG statement I had left in the code in 0.11.2.
+ ! Fixed a bug in the VS2002 writer which caused the version variables to not
+ be overriden correctly.
+ + Added the rootNamespace property to the element, allowing you to
+ specify the root namespace.
+ * /target and /clean are now mutually exclusive command line switches, and
+ they both now take the all option. In the case of /target all, all build
+ file for all targets will be created. In the case of /clean all, the user
+ will be prompted to make sure they want to do it, and if so, will clean
+ all build files for all targets.
+
+[ April 22, 2004 - 0.11.2 ]
+ ! Fixed a bug with the /file command-line operator. Was using the unresolved
+ file path rather then the resolved one, was making the attempt to open the
+ dnpb file fail.
+ ! Fixed a bug in the schema that required at least 1 solution and 1 reference
+ path. We can do just fine with 0 of either of these. Some files may be all
+ statements and not have any tags.
+ ! Fixed a bug that caused the project references not to be written with the
+ SharpDevelop target.
+ * Changed the schema to version 1.2, allowing for Configuration nodes to exist
+ under project nodes. The inheritance of values is hierarchical. Meaning, if
+ you define a configuration named Debug at the Soltion level, and one by the
+ same name at the Project level, the one at the Project level will first
+ inherit the options of the Solution level configuration, then set it's own
+ options. If you define a configuration at the Project level and it does not
+ exist at the Solution level, it will be created at the Solution level.
+ * Project references should now work correctly across the board. Note that due
+ to a restriction in Visual Studio, you can only reference projects in the same
+ solution.
+
+[ April 21, 2004 - 0.11.1 ]
+ ! Fixed a problem with resolving paths in various targets. Was not properly
+ setting the CWD.
+ * Schema updated to 1.1, moving the ReferencePath element from the Options
+ element to the Project element. This makes more logical sense, given that
+ reference paths are resolved relative to the project path. Any prebuild.xml
+ file referecning verison 1.0 will fail! Please update to the 1.1 schema.
+
+[ April 19, 2004 - 0.11.0 ]
+ * Added several attributes across the code to make FxCop happy
+ ! Fixed bugs in reference paths being written in the VS targets.
+ ! Fixed a bug in ProjectNode which was doing two CWDStack.Push() calls instead of
+ a Push/Pop pair. Was wreaking havoc with tags.
+ ! Fixed some bugs in the path tracking, both the Project and Solution nodes now
+ have a FullPath property, which is the full path to the file resolved at load
+ time. This should fix all path relativity problems.
+ + Added new /clean switch, allowing the target to clean up any files it generated.
+ in accordance, the ITarget interface has been updated to support a new Clean()
+ method.
+ + Completed addition of the tag, to allow the referencing of external
+ prebuild.xml files.
+ + Added the runtime attribute to the Project element. This allows the developer
+ to specify which runtime a project should target (Mono or Microsoft). This is
+ of course ignored in certain targets like the Visual Studio targets.
+ + Added the SharpDevelop target.
+
+[ April 13, 2004 - 0.10.1a ]
+ + Added the buildAction attribute to the File node. This is needed for dnpb
+ to even be able to bootstrap itself (dnpb-1.0.xsd must be an embedded resource)
+
+[ April 13, 2004 - 0.10.1 ]
+ * First Release
+
+[ Key ]
+* = Change or information
++ = Addition
+! = Bug Fix
+
diff --git a/Prebuild/Prebuild.exe b/Prebuild/Prebuild.exe
new file mode 100755
index 0000000..bdb25b6
Binary files /dev/null and b/Prebuild/Prebuild.exe differ
diff --git a/Prebuild/README b/Prebuild/README
index e8a2d69..2b05fb5 100644
--- a/Prebuild/README
+++ b/Prebuild/README
@@ -1,274 +1,274 @@
-Prebuild Instructions
-
-Prebuild is an XML-driven pre-build tool allowing developers to easily generate project or make files for major IDE's and .NET development tools including: Visual Studio 2005, Visual Studio 2003, Visual Studio 2002, SharpDevelop, SharpDevelop2, MonoDevelop, and NAnt.
-
-_______________________________________________________________________________
-Overview
-
-Prebuild can be either be run from the command line to generate the
-project and make files or you can execute the included batch (*.bat)
-and Unix Shell script (*.sh) files.
-
-_______________________________________________________________________________
-The currently supported developement tools and their associated batch
-and shell script files.
-
-Visual Studio .NET 2005 (VS2005.bat)
-Visual Studio .NET 2003 (VS2003.bat)
-Visual Studio .NET 2002 (VS2002.bat)
-SharpDevelop (SharpDevelop.bat) - http://www.icsharpcode.net/OpenSource/SD/
-SharpDevelop2 (SharpDevelop.bat) - http://www.icsharpcode.net/OpenSource/SD/
-MonoDevelop (MonoDevelop.sh) - http://www.monodevelop.com/
-NAnt (nant.sh and nant.bat) - http://nant.sourceforge.net/
-Autotools (autotools.bat and autotools.sh) - http://en.wikipedia.org/wiki/GNU_build_system
-
-Notes:
-
-A Unix Shell script is provided for MonoDevelop, as it does not run on
-Windows at this time.
-
-Visual Studio .NET 2005 and the Visual Express IDE's can import
-solutions from older versions of Visual Studio .NET.
-
-Makefiles are not currently supported.
-
-_______________________________________________________________________________
-Command Line Syntax:
-
-Example:
-> Prebuild /target vs2003
-
-This will generate the project files for Visual Studio.NET 2003 and
-place the redirect the log to a file named PrebuildLog.txt in the
-parent directory
-
-
-The syntax structure is as below, where commandParameter is optional
-depending on the command and you can provide several option-value
-pairs.
-
-Note: The '> ' signifies the command prompt, do not enter this literally
-
-> Prebuild /
-
-> Prebuild /target vs2003 /pause
-
-> Prebuild /target vs2003 /log ../Log.txt /pause /ppo /file ProjectConfig.xml
-
-> Prebuild /target sharpdev /log
-
-> Prebuild /removedir obj|bin
-
-> Prebuild /target vs2003 /allowedgroups Group1|Group2
-
-> Prebuild /clean
-
-> Prebuild /clean /yes
-
-> Prebuild /clean vs2003
-
-_______________________________________________________________________________
-Command Line Options:
-
-/usage - Shows the help information on how to use Prebuild and what
-the different options are and what they do
-
-/clean - The project files generated for the target type specified as
-a parameter for this option will be deleted. If no value is specified
-or if 'all' is specified, then project files for all the target types
-will be deleted.
-
-/target - Specified the name of the development tool for which project
-or make files will be generated. Possible parameter values include:
-vs2003, vs2002, sharpdev
-
-/file - Specifies the name of the XML which defines what files are to
-be referenced by the generated project files as well as configures the
-options for them. If not specified, prebuild.xml in the current
-directory will be used as the default.
-
-/log - Specified the log file that should be written to for build
-errors. If this option is not specified, no log file is generated,
-but if just no value is specified, then the defaul filename will be
-used for the log (Prebuild.log).
-
-/ppo - Preprocesses the xml file to test for syntax errors or problems
-but doesn't generate the files
-
-/pause - Shows the console until you press a key so that you can view
-the messages written while performing the specified actions.
-
-This allows you to check if an errors occurred and - if so - what it
-was.
-
-/showtargets - Shows a list of all the targets that can be specified
-as values for the /clean and /target commands.
-
-/allowedgroups - This is followed by a pipe-delimited list of project
-group filter flags (eg. Group1|Group2) allow optional filtering of all
-projects that dont have at least one of these flags
-
-/removedir - This is followed by a pipe-delimited list of directory
-names that will be deleted while recursivly searching the directory of
-the prebuild application and its child directories (eg. use obj|bin to
-delete all output and temporary directories before file releases)
-
-/yes - Answer yes to any warnings (e.g. when cleaning all projects).
-
-_______________________________________________________________________________
-Example Batch Files and Shell Scripts
-
-NOTE: Common batch and shell script files are included with Prebuild source and file releases.
-______________________________
-MonoDevelop
-
-#!/bin/sh
-# Generates a solution (.mds) and a set of project files (.mdp)
-
-# for MonoDevelop, a Mono port of SharpDevelop
-# (http://icsharpcode.net/OpenSource/SD/Default.aspx)
-
-./Prebuild /target monodev /pause
-
-______________________________
-Visual Studio .NET 2003
-
-@rem Generates a solution (.sln) and a set of project files (.csproj)
-@rem for Microsoft Visual Studio .NET 2002
-Prebuild /target vs2003 /pause
-
-Notes:
-Text after lines that start with @rem are comments and are not evaluated
-You can also place pause on the last line instead of specifing the /pause command.
-
-_______________________________________________________________________________
-Example XML Configuration File
-
-Note:
-
-XML Comments () are used to markup the prebuild.xml
-file with notes
-
-The below file may be out-of-date, however the RealmForge Prebuild
-file serves as an up-to-date and extensive example.
-
-It can be viewed using Tigris.org's WebSVN
-(http://realmforge.tigris.org/source/browse/realmforge/trunk/src/prebuild.xml)
-by just clicking on the "view file" link for the latest revision.
-
-_________________________________
-
-
-
-
-
-
-
-
-
-
- DEBUG;TRACE;WIN32
-
- DEBUG;TRACE;POSIX
-
- false
- false
- false
- 4
-
-
- false
- 1591;219;1573;1572;168
-
-
- ..\bin
- true
- false
- true
- 285212672
- 4096
- false
- Docs.xml
-
-
-
-
- TRACE
- true
- false
- false
- 4
- false
- 1591;219;1573;1572;168
- ..\bin
- false
- false
- true
- 285212672
- 4096
- false
- true
- Docs.xml
-
-
-
-
-
-
-
- ..\bin\lib\Utility
- RealmForge.Utility.xml
-
-
-
-
- ..\bin\lib\Utility
- RealmForge.Utility.xml
-
-
- ../bin
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ..\bin
- DemoGame.xml
-
-
-
-
- ..\bin
- DemoGame.xml
-
-
- ../bin
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+Prebuild Instructions
+
+Prebuild is an XML-driven pre-build tool allowing developers to easily generate project or make files for major IDE's and .NET development tools including: Visual Studio 2005, Visual Studio 2003, Visual Studio 2002, SharpDevelop, SharpDevelop2, MonoDevelop, and NAnt.
+
+_______________________________________________________________________________
+Overview
+
+Prebuild can be either be run from the command line to generate the
+project and make files or you can execute the included batch (*.bat)
+and Unix Shell script (*.sh) files.
+
+_______________________________________________________________________________
+The currently supported developement tools and their associated batch
+and shell script files.
+
+Visual Studio .NET 2005 (VS2005.bat)
+Visual Studio .NET 2003 (VS2003.bat)
+Visual Studio .NET 2002 (VS2002.bat)
+SharpDevelop (SharpDevelop.bat) - http://www.icsharpcode.net/OpenSource/SD/
+SharpDevelop2 (SharpDevelop.bat) - http://www.icsharpcode.net/OpenSource/SD/
+MonoDevelop (MonoDevelop.sh) - http://www.monodevelop.com/
+NAnt (nant.sh and nant.bat) - http://nant.sourceforge.net/
+Autotools (autotools.bat and autotools.sh) - http://en.wikipedia.org/wiki/GNU_build_system
+
+Notes:
+
+A Unix Shell script is provided for MonoDevelop, as it does not run on
+Windows at this time.
+
+Visual Studio .NET 2005 and the Visual Express IDE's can import
+solutions from older versions of Visual Studio .NET.
+
+Makefiles are not currently supported.
+
+_______________________________________________________________________________
+Command Line Syntax:
+
+Example:
+> Prebuild /target vs2003
+
+This will generate the project files for Visual Studio.NET 2003 and
+place the redirect the log to a file named PrebuildLog.txt in the
+parent directory
+
+
+The syntax structure is as below, where commandParameter is optional
+depending on the command and you can provide several option-value
+pairs.
+
+Note: The '> ' signifies the command prompt, do not enter this literally
+
+> Prebuild /
+
+> Prebuild /target vs2003 /pause
+
+> Prebuild /target vs2003 /log ../Log.txt /pause /ppo /file ProjectConfig.xml
+
+> Prebuild /target sharpdev /log
+
+> Prebuild /removedir obj|bin
+
+> Prebuild /target vs2003 /allowedgroups Group1|Group2
+
+> Prebuild /clean
+
+> Prebuild /clean /yes
+
+> Prebuild /clean vs2003
+
+_______________________________________________________________________________
+Command Line Options:
+
+/usage - Shows the help information on how to use Prebuild and what
+the different options are and what they do
+
+/clean - The project files generated for the target type specified as
+a parameter for this option will be deleted. If no value is specified
+or if 'all' is specified, then project files for all the target types
+will be deleted.
+
+/target - Specified the name of the development tool for which project
+or make files will be generated. Possible parameter values include:
+vs2003, vs2002, sharpdev
+
+/file - Specifies the name of the XML which defines what files are to
+be referenced by the generated project files as well as configures the
+options for them. If not specified, prebuild.xml in the current
+directory will be used as the default.
+
+/log - Specified the log file that should be written to for build
+errors. If this option is not specified, no log file is generated,
+but if just no value is specified, then the defaul filename will be
+used for the log (Prebuild.log).
+
+/ppo - Preprocesses the xml file to test for syntax errors or problems
+but doesn't generate the files
+
+/pause - Shows the console until you press a key so that you can view
+the messages written while performing the specified actions.
+
+This allows you to check if an errors occurred and - if so - what it
+was.
+
+/showtargets - Shows a list of all the targets that can be specified
+as values for the /clean and /target commands.
+
+/allowedgroups - This is followed by a pipe-delimited list of project
+group filter flags (eg. Group1|Group2) allow optional filtering of all
+projects that dont have at least one of these flags
+
+/removedir - This is followed by a pipe-delimited list of directory
+names that will be deleted while recursivly searching the directory of
+the prebuild application and its child directories (eg. use obj|bin to
+delete all output and temporary directories before file releases)
+
+/yes - Answer yes to any warnings (e.g. when cleaning all projects).
+
+_______________________________________________________________________________
+Example Batch Files and Shell Scripts
+
+NOTE: Common batch and shell script files are included with Prebuild source and file releases.
+______________________________
+MonoDevelop
+
+#!/bin/sh
+# Generates a solution (.mds) and a set of project files (.mdp)
+
+# for MonoDevelop, a Mono port of SharpDevelop
+# (http://icsharpcode.net/OpenSource/SD/Default.aspx)
+
+./Prebuild /target monodev /pause
+
+______________________________
+Visual Studio .NET 2003
+
+@rem Generates a solution (.sln) and a set of project files (.csproj)
+@rem for Microsoft Visual Studio .NET 2002
+Prebuild /target vs2003 /pause
+
+Notes:
+Text after lines that start with @rem are comments and are not evaluated
+You can also place pause on the last line instead of specifing the /pause command.
+
+_______________________________________________________________________________
+Example XML Configuration File
+
+Note:
+
+XML Comments () are used to markup the prebuild.xml
+file with notes
+
+The below file may be out-of-date, however the RealmForge Prebuild
+file serves as an up-to-date and extensive example.
+
+It can be viewed using Tigris.org's WebSVN
+(http://realmforge.tigris.org/source/browse/realmforge/trunk/src/prebuild.xml)
+by just clicking on the "view file" link for the latest revision.
+
+_________________________________
+
+
+
+
+
+
+
+
+
+
+ DEBUG;TRACE;WIN32
+
+ DEBUG;TRACE;POSIX
+
+ false
+ false
+ false
+ 4
+
+
+ false
+ 1591;219;1573;1572;168
+
+
+ ..\bin
+ true
+ false
+ true
+ 285212672
+ 4096
+ false
+ Docs.xml
+
+
+
+
+ TRACE
+ true
+ false
+ false
+ 4
+ false
+ 1591;219;1573;1572;168
+ ..\bin
+ false
+ false
+ true
+ 285212672
+ 4096
+ false
+ true
+ Docs.xml
+
+
+
+
+
+
+
+ ..\bin\lib\Utility
+ RealmForge.Utility.xml
+
+
+
+
+ ..\bin\lib\Utility
+ RealmForge.Utility.xml
+
+
+ ../bin
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ..\bin
+ DemoGame.xml
+
+
+
+
+ ..\bin
+ DemoGame.xml
+
+
+ ../bin
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Prebuild/prebuild.xml b/Prebuild/prebuild.xml
index d14b94f..588d788 100644
--- a/Prebuild/prebuild.xml
+++ b/Prebuild/prebuild.xml
@@ -1,6 +1,6 @@
-
+
DEBUG;TRACE
@@ -31,13 +31,15 @@
type="Exe"
rootNamespace="Prebuild"
startupObject="Prebuild.Prebuild"
- version="2.0.3"
+ version="2.0.5"
+ frameworkVersion="v3_5"
>
Matthew Holmes (matthew@wildfiregames.com)
Dan Moorehead (dan05a@gmail.com)
Dave Hudson (jendave@yahoo.com)
Rob Loach (http://robloach.net)
C.J. Adams-Collier (cjac@colliertech.org)
+ John Hurliman (john.hurliman@intel.com)
The Prebuild project generator
diff --git a/Prebuild/scripts/SharpDevelop2.bat b/Prebuild/scripts/SharpDevelop2.bat
index 49120ab..4ca0272 100755
--- a/Prebuild/scripts/SharpDevelop2.bat
+++ b/Prebuild/scripts/SharpDevelop2.bat
@@ -1,4 +1,4 @@
-@rem Generates a combine (.cmbx) and a set of project files (.prjx)
-@rem for SharpDevelop (http://icsharpcode.net/OpenSource/SD/Default.aspx)
-cd ..
-Prebuild.exe /target sharpdev2 /file prebuild.xml /pause
+@rem Generates a combine (.cmbx) and a set of project files (.prjx)
+@rem for SharpDevelop (http://icsharpcode.net/OpenSource/SD/Default.aspx)
+cd ..
+Prebuild.exe /target sharpdev2 /file prebuild.xml /pause
diff --git a/Prebuild/scripts/VS2008.bat b/Prebuild/scripts/VS2008.bat
index eb51a82..b465668 100755
--- a/Prebuild/scripts/VS2008.bat
+++ b/Prebuild/scripts/VS2008.bat
@@ -1,4 +1,4 @@
-@rem Generates a solution (.sln) and a set of project files (.csproj, .vbproj, etc.)
-@rem for Microsoft Visual Studio .NET 2008
-cd ..
-Prebuild.exe /target vs2008 /file prebuild.xml /pause
+@rem Generates a solution (.sln) and a set of project files (.csproj, .vbproj, etc.)
+@rem for Microsoft Visual Studio .NET 2008
+cd ..
+Prebuild.exe /target vs2008 /file prebuild.xml /pause
diff --git a/Prebuild/scripts/VS2010.bat b/Prebuild/scripts/VS2010.bat
index 1b98818..87676ac 100644
--- a/Prebuild/scripts/VS2010.bat
+++ b/Prebuild/scripts/VS2010.bat
@@ -1,4 +1,4 @@
-@rem Generates a solution (.sln) and a set of project files (.csproj, .vbproj, etc.)
-@rem for Microsoft Visual Studio .NET 2010
-cd ..
-Prebuild.exe /target vs2010 /file prebuild.xml /pause
+@rem Generates a solution (.sln) and a set of project files (.csproj, .vbproj, etc.)
+@rem for Microsoft Visual Studio .NET 2010
+cd ..
+Prebuild.exe /target vs2010 /file prebuild.xml /pause
diff --git a/Prebuild/scripts/autotools.bat b/Prebuild/scripts/autotools.bat
index 43f9a74..1fd3469 100755
--- a/Prebuild/scripts/autotools.bat
+++ b/Prebuild/scripts/autotools.bat
@@ -1,4 +1,4 @@
-@rem Generates Makefiles
-@rem for autotools
-cd ..
-Prebuild.exe /target autotools /file prebuild.xml /pause
+@rem Generates Makefiles
+@rem for autotools
+cd ..
+Prebuild.exe /target autotools /file prebuild.xml /pause
diff --git a/Prebuild/src/Core/Nodes/CleanFilesNode.cs b/Prebuild/src/Core/Nodes/CleanFilesNode.cs
index 71405f9..dc2da9a 100644
--- a/Prebuild/src/Core/Nodes/CleanFilesNode.cs
+++ b/Prebuild/src/Core/Nodes/CleanFilesNode.cs
@@ -1,80 +1,80 @@
-#region BSD License
-/*
-Copyright (c) 2007 C.J. Adams-Collier (cjac@colliertech.org)
-
-Redistribution and use in source and binary forms, with or without modification, are permitted
-provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this list of conditions
- and the following disclaimer.
-* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
- and the following disclaimer in the documentation and/or other materials provided with the
- distribution.
-* The name of the author may not be used to endorse or promote products derived from this software
- without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
-BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Xml;
-
-using Prebuild.Core.Attributes;
-using Prebuild.Core.Interfaces;
-using Prebuild.Core.Utilities;
-
-namespace Prebuild.Core.Nodes
-{
- [DataNode("CleanFiles")]
- public class CleanFilesNode : DataNode
- {
- #region Fields
-
- private string m_Pattern;
-
- #endregion
-
- #region Properties
-
- ///
- /// Gets the signature.
- ///
- /// The signature.
- public string Pattern
- {
- get
- {
- return m_Pattern;
- }
- }
-
- #endregion
-
- #region Public Methods
-
- ///
- /// Parses the specified node.
- ///
- /// The node.
- public override void Parse(XmlNode node)
- {
- if (node == null)
- {
- throw new ArgumentNullException("node");
- }
-
- m_Pattern = Helper.AttributeValue(node, "pattern", String.Empty); ;
- m_Pattern = m_Pattern.Trim();
- }
-
- #endregion
- }
+#region BSD License
+/*
+Copyright (c) 2007 C.J. Adams-Collier (cjac@colliertech.org)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Xml;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Utilities;
+
+namespace Prebuild.Core.Nodes
+{
+ [DataNode("CleanFiles")]
+ public class CleanFilesNode : DataNode
+ {
+ #region Fields
+
+ private string m_Pattern;
+
+ #endregion
+
+ #region Properties
+
+ ///
+ /// Gets the signature.
+ ///
+ /// The signature.
+ public string Pattern
+ {
+ get
+ {
+ return m_Pattern;
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ ///
+ /// Parses the specified node.
+ ///
+ /// The node.
+ public override void Parse(XmlNode node)
+ {
+ if (node == null)
+ {
+ throw new ArgumentNullException("node");
+ }
+
+ m_Pattern = Helper.AttributeValue(node, "pattern", String.Empty); ;
+ m_Pattern = m_Pattern.Trim();
+ }
+
+ #endregion
+ }
}
\ No newline at end of file
diff --git a/Prebuild/src/Core/Nodes/CleanupNode.cs b/Prebuild/src/Core/Nodes/CleanupNode.cs
index b8131b0..a9b77eb 100644
--- a/Prebuild/src/Core/Nodes/CleanupNode.cs
+++ b/Prebuild/src/Core/Nodes/CleanupNode.cs
@@ -1,85 +1,85 @@
-#region BSD License
-/*
-Copyright (c) 2007 C.J. Adams-Collier (cjac@colliertech.org)
-
-Redistribution and use in source and binary forms, with or without modification, are permitted
-provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this list of conditions
- and the following disclaimer.
-* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
- and the following disclaimer in the documentation and/or other materials provided with the
- distribution.
-* The name of the author may not be used to endorse or promote products derived from this software
- without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
-BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Xml;
-
-using Prebuild.Core.Attributes;
-using Prebuild.Core.Interfaces;
-
-namespace Prebuild.Core.Nodes
-{
- [DataNode("Cleanup")]
- public class CleanupNode : DataNode
- {
- #region Fields
-
- private List m_CleanFiles = new List();
-
- #endregion
-
- #region Properties
-
- ///
- /// Gets the signature.
- ///
- /// The signature.
- public List CleanFiles
- {
- get
- {
- return m_CleanFiles;
- }
- }
-
- #endregion
-
- #region Public Methods
-
- ///
- /// Parses the specified node.
- ///
- /// The node.
- public override void Parse(XmlNode node)
- {
- if( node == null )
- {
- throw new ArgumentNullException("node");
- }
-
- foreach (XmlNode child in node.ChildNodes)
- {
- IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
- if (dataNode is CleanFilesNode)
- {
- m_CleanFiles.Add((CleanFilesNode)dataNode);
- }
- }
- }
-
- #endregion
- }
+#region BSD License
+/*
+Copyright (c) 2007 C.J. Adams-Collier (cjac@colliertech.org)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Xml;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+
+namespace Prebuild.Core.Nodes
+{
+ [DataNode("Cleanup")]
+ public class CleanupNode : DataNode
+ {
+ #region Fields
+
+ private List m_CleanFiles = new List();
+
+ #endregion
+
+ #region Properties
+
+ ///
+ /// Gets the signature.
+ ///
+ /// The signature.
+ public List CleanFiles
+ {
+ get
+ {
+ return m_CleanFiles;
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ ///
+ /// Parses the specified node.
+ ///
+ /// The node.
+ public override void Parse(XmlNode node)
+ {
+ if( node == null )
+ {
+ throw new ArgumentNullException("node");
+ }
+
+ foreach (XmlNode child in node.ChildNodes)
+ {
+ IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
+ if (dataNode is CleanFilesNode)
+ {
+ m_CleanFiles.Add((CleanFilesNode)dataNode);
+ }
+ }
+ }
+
+ #endregion
+ }
}
\ No newline at end of file
diff --git a/Prebuild/src/Core/Nodes/ConfigurationNodeCollection.cs b/Prebuild/src/Core/Nodes/ConfigurationNodeCollection.cs
index 1c38d9e..7c59ac5 100644
--- a/Prebuild/src/Core/Nodes/ConfigurationNodeCollection.cs
+++ b/Prebuild/src/Core/Nodes/ConfigurationNodeCollection.cs
@@ -1,71 +1,71 @@
-#region BSD License
-/*
-Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
-
-Redistribution and use in source and binary forms, with or without modification, are permitted
-provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this list of conditions
- and the following disclaimer.
-* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
- and the following disclaimer in the documentation and/or other materials provided with the
- distribution.
-* The name of the author may not be used to endorse or promote products derived from this software
- without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
-BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-#endregion
-
-using System.Collections.Generic;
-
-namespace Prebuild.Core.Nodes
-{
- ///
- /// Implements a specialized list of configuration nodes which allows for lookup via
- /// configuration name and platform.
- ///
- public class ConfigurationNodeCollection : List
- {
- #region Properties
-
- public ConfigurationNode this[string nameAndPlatform]
- {
- get
- {
- foreach (ConfigurationNode configurationNode in this)
- {
- if (configurationNode.NameAndPlatform == nameAndPlatform)
- {
- return configurationNode;
- }
- }
-
- return null;
- }
-
- set
- {
- // See if the node
- ConfigurationNode configurationNode = this[nameAndPlatform];
-
- if (configurationNode != null)
- {
- this[IndexOf(configurationNode)] = value;
- }
- else
- {
- Add(value);
- }
- }
- }
-
- #endregion
- }
-}
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+using System.Collections.Generic;
+
+namespace Prebuild.Core.Nodes
+{
+ ///
+ /// Implements a specialized list of configuration nodes which allows for lookup via
+ /// configuration name and platform.
+ ///
+ public class ConfigurationNodeCollection : List
+ {
+ #region Properties
+
+ public ConfigurationNode this[string nameAndPlatform]
+ {
+ get
+ {
+ foreach (ConfigurationNode configurationNode in this)
+ {
+ if (configurationNode.NameAndPlatform == nameAndPlatform)
+ {
+ return configurationNode;
+ }
+ }
+
+ return null;
+ }
+
+ set
+ {
+ // See if the node
+ ConfigurationNode configurationNode = this[nameAndPlatform];
+
+ if (configurationNode != null)
+ {
+ this[IndexOf(configurationNode)] = value;
+ }
+ else
+ {
+ Add(value);
+ }
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs b/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs
index 278ecd8..20095c3 100644
--- a/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs
+++ b/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs
@@ -1,93 +1,93 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Xml;
-
-using Prebuild.Core.Attributes;
-using Prebuild.Core.Interfaces;
-using Prebuild.Core.Utilities;
-
-namespace Prebuild.Core.Nodes
-{
- [DataNode("DatabaseProject")]
- public class DatabaseProjectNode : DataNode
- {
- string name;
- string path;
- string fullpath;
- Guid guid = Guid.NewGuid();
- readonly List authors = new List();
- readonly List references = new List();
-
- public Guid Guid
- {
- get { return guid; }
- }
-
- public string Name
- {
- get { return name; }
- }
-
- public string Path
- {
- get { return path; }
- }
-
- public string FullPath
- {
- get { return fullpath; }
- }
-
- public IEnumerable References
- {
- get { return references; }
- }
-
- public override void Parse(XmlNode node)
- {
- name = Helper.AttributeValue(node, "name", name);
- path = Helper.AttributeValue(node, "path", name);
-
- try
- {
- fullpath = Helper.ResolvePath(path);
- }
- catch
- {
- throw new WarningException("Could not resolve Solution path: {0}", path);
- }
-
- Kernel.Instance.CurrentWorkingDirectory.Push();
-
- try
- {
- Helper.SetCurrentDir(fullpath);
-
- if (node == null)
- {
- throw new ArgumentNullException("node");
- }
-
- foreach (XmlNode child in node.ChildNodes)
- {
- IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
-
- if (dataNode == null)
- continue;
-
- if (dataNode is AuthorNode)
- authors.Add((AuthorNode)dataNode);
- else if (dataNode is DatabaseReferenceNode)
- references.Add((DatabaseReferenceNode)dataNode);
- }
- }
- finally
- {
- Kernel.Instance.CurrentWorkingDirectory.Pop();
- }
-
- base.Parse(node);
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Utilities;
+
+namespace Prebuild.Core.Nodes
+{
+ [DataNode("DatabaseProject")]
+ public class DatabaseProjectNode : DataNode
+ {
+ string name;
+ string path;
+ string fullpath;
+ Guid guid = Guid.NewGuid();
+ readonly List authors = new List();
+ readonly List references = new List();
+
+ public Guid Guid
+ {
+ get { return guid; }
+ }
+
+ public string Name
+ {
+ get { return name; }
+ }
+
+ public string Path
+ {
+ get { return path; }
+ }
+
+ public string FullPath
+ {
+ get { return fullpath; }
+ }
+
+ public IEnumerable References
+ {
+ get { return references; }
+ }
+
+ public override void Parse(XmlNode node)
+ {
+ name = Helper.AttributeValue(node, "name", name);
+ path = Helper.AttributeValue(node, "path", name);
+
+ try
+ {
+ fullpath = Helper.ResolvePath(path);
+ }
+ catch
+ {
+ throw new WarningException("Could not resolve Solution path: {0}", path);
+ }
+
+ Kernel.Instance.CurrentWorkingDirectory.Push();
+
+ try
+ {
+ Helper.SetCurrentDir(fullpath);
+
+ if (node == null)
+ {
+ throw new ArgumentNullException("node");
+ }
+
+ foreach (XmlNode child in node.ChildNodes)
+ {
+ IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
+
+ if (dataNode == null)
+ continue;
+
+ if (dataNode is AuthorNode)
+ authors.Add((AuthorNode)dataNode);
+ else if (dataNode is DatabaseReferenceNode)
+ references.Add((DatabaseReferenceNode)dataNode);
+ }
+ }
+ finally
+ {
+ Kernel.Instance.CurrentWorkingDirectory.Pop();
+ }
+
+ base.Parse(node);
+ }
+ }
+}
diff --git a/Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs b/Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs
index 845db24..97c3964 100644
--- a/Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs
+++ b/Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs
@@ -1,63 +1,63 @@
-using System;
-using Prebuild.Core.Attributes;
-using Prebuild.Core.Utilities;
-
-namespace Prebuild.Core.Nodes
-{
- [DataNode("DatabaseReference")]
- public class DatabaseReferenceNode : DataNode
- {
- string name;
- Guid providerId;
- string connectionString;
-
- public string Name
- {
- get { return name; }
- }
-
- public Guid ProviderId
- {
- get { return providerId; }
- }
-
- public string ConnectionString
- {
- get { return connectionString; }
- }
-
- public override void Parse(System.Xml.XmlNode node)
- {
- name = Helper.AttributeValue(node, "name", name);
-
- string providerName = Helper.AttributeValue(node, "providerName", string.Empty);
- if (providerName != null)
- {
- switch (providerName)
- {
- // digitaljeebus: pulled from HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\DataProviders\*
- // Not sure if these will help other operating systems, or if there's a better way.
- case "Microsoft.SqlServerCe.Client.3.5":
- providerId = new Guid("7C602B5B-ACCB-4acd-9DC0-CA66388C1533"); break;
- case "System.Data.OleDb":
- providerId = new Guid("7F041D59-D76A-44ed-9AA2-FBF6B0548B80"); break;
- case "System.Data.OracleClient":
- providerId = new Guid("8F5C5018-AE09-42cf-B2CC-2CCCC7CFC2BB"); break;
- case "System.Data.SqlClient":
- providerId = new Guid("91510608-8809-4020-8897-FBA057E22D54"); break;
- case "System.Data.Odbc":
- providerId = new Guid("C3D4F4CE-2C48-4381-B4D6-34FA50C51C86"); break;
-
- default:
- throw new ArgumentOutOfRangeException("providerName", providerName, "Could not provider name to an id.");
- }
- }
- else
- providerId = new Guid(Helper.AttributeValue(node, "providerId", Guid.Empty.ToString("B")));
-
- connectionString = Helper.AttributeValue(node, "connectionString", connectionString);
-
- base.Parse(node);
- }
- }
-}
+using System;
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Utilities;
+
+namespace Prebuild.Core.Nodes
+{
+ [DataNode("DatabaseReference")]
+ public class DatabaseReferenceNode : DataNode
+ {
+ string name;
+ Guid providerId;
+ string connectionString;
+
+ public string Name
+ {
+ get { return name; }
+ }
+
+ public Guid ProviderId
+ {
+ get { return providerId; }
+ }
+
+ public string ConnectionString
+ {
+ get { return connectionString; }
+ }
+
+ public override void Parse(System.Xml.XmlNode node)
+ {
+ name = Helper.AttributeValue(node, "name", name);
+
+ string providerName = Helper.AttributeValue(node, "providerName", string.Empty);
+ if (providerName != null)
+ {
+ switch (providerName)
+ {
+ // digitaljeebus: pulled from HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\DataProviders\*
+ // Not sure if these will help other operating systems, or if there's a better way.
+ case "Microsoft.SqlServerCe.Client.3.5":
+ providerId = new Guid("7C602B5B-ACCB-4acd-9DC0-CA66388C1533"); break;
+ case "System.Data.OleDb":
+ providerId = new Guid("7F041D59-D76A-44ed-9AA2-FBF6B0548B80"); break;
+ case "System.Data.OracleClient":
+ providerId = new Guid("8F5C5018-AE09-42cf-B2CC-2CCCC7CFC2BB"); break;
+ case "System.Data.SqlClient":
+ providerId = new Guid("91510608-8809-4020-8897-FBA057E22D54"); break;
+ case "System.Data.Odbc":
+ providerId = new Guid("C3D4F4CE-2C48-4381-B4D6-34FA50C51C86"); break;
+
+ default:
+ throw new ArgumentOutOfRangeException("providerName", providerName, "Could not provider name to an id.");
+ }
+ }
+ else
+ providerId = new Guid(Helper.AttributeValue(node, "providerId", Guid.Empty.ToString("B")));
+
+ connectionString = Helper.AttributeValue(node, "connectionString", connectionString);
+
+ base.Parse(node);
+ }
+ }
+}
diff --git a/Prebuild/src/Core/Nodes/FileNode.cs b/Prebuild/src/Core/Nodes/FileNode.cs
index 01cea1e..b313ffa 100644
--- a/Prebuild/src/Core/Nodes/FileNode.cs
+++ b/Prebuild/src/Core/Nodes/FileNode.cs
@@ -62,7 +62,11 @@ namespace Prebuild.Core.Nodes
///
///
///
- Page
+ Page,
+ ///
+ ///
+ ///
+ Copy
}
///
@@ -245,6 +249,9 @@ namespace Prebuild.Core.Nodes
if (subType != String.Empty)
m_SubType = (SubType)Enum.Parse(typeof(SubType), subType);
+ Console.WriteLine("[FileNode]:BuildAction is {0}", buildAction);
+
+
m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString());
this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString));
if ( this.m_Link == true )
diff --git a/Prebuild/src/Core/Nodes/FilesNode.cs b/Prebuild/src/Core/Nodes/FilesNode.cs
index 23a716c..16658f3 100644
--- a/Prebuild/src/Core/Nodes/FilesNode.cs
+++ b/Prebuild/src/Core/Nodes/FilesNode.cs
@@ -25,6 +25,7 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
using System;
using System.Collections.Generic;
+using System.Collections.Specialized;
using System.Xml;
using Prebuild.Core.Attributes;
@@ -49,6 +50,8 @@ namespace Prebuild.Core.Nodes
private readonly Dictionary m_Links = new Dictionary();
private readonly Dictionary m_LinkPaths = new Dictionary();
private readonly Dictionary m_PreservePaths = new Dictionary();
+ private readonly Dictionary m_DestinationPath = new Dictionary();
+ private readonly NameValueCollection m_CopyFiles = new NameValueCollection();
#endregion
@@ -62,6 +65,16 @@ namespace Prebuild.Core.Nodes
}
}
+ public string[] Destinations
+ {
+ get { return m_CopyFiles.AllKeys; }
+ }
+
+ public int CopyFiles
+ {
+ get { return m_CopyFiles.Count; }
+ }
+
#endregion
#region Public Methods
@@ -76,6 +89,20 @@ namespace Prebuild.Core.Nodes
return m_BuildActions[file];
}
+ public string GetDestinationPath(string file)
+ {
+ if( !m_DestinationPath.ContainsKey(file))
+ {
+ return null;
+ }
+ return m_DestinationPath[file];
+ }
+
+ public string[] SourceFiles(string dest)
+ {
+ return m_CopyFiles.GetValues(dest);
+ }
+
public CopyToOutput GetCopyToOutput(string file)
{
if (!m_CopyToOutputs.ContainsKey(file))
@@ -178,6 +205,13 @@ namespace Prebuild.Core.Nodes
m_BuildActions[file] = GetBuildActionByFileName(file);
else
m_BuildActions[file] = matchNode.BuildAction.Value;
+
+ if (matchNode.BuildAction == BuildAction.Copy)
+ {
+ m_CopyFiles.Add(matchNode.DestinationPath, file);
+ m_DestinationPath[file] = matchNode.DestinationPath;
+ }
+
m_SubTypes[file] = matchNode.SubType == null ? GetSubTypeByFileName(file) : matchNode.SubType.Value;
m_ResourceNames[ file ] = matchNode.ResourceName;
m_PreservePaths[ file ] = matchNode.PreservePath;
diff --git a/Prebuild/src/Core/Nodes/MatchNode.cs b/Prebuild/src/Core/Nodes/MatchNode.cs
index 9735265..000bde9 100644
--- a/Prebuild/src/Core/Nodes/MatchNode.cs
+++ b/Prebuild/src/Core/Nodes/MatchNode.cs
@@ -52,6 +52,7 @@ namespace Prebuild.Core.Nodes
private bool m_Link;
private string m_LinkPath;
private bool m_PreservePath;
+ private string m_Destination = "";
private readonly List m_Exclusions = new List();
#endregion
@@ -80,6 +81,13 @@ namespace Prebuild.Core.Nodes
}
}
+ public string DestinationPath
+ {
+ get
+ {
+ return m_Destination;
+ }
+ }
///
///
///
@@ -285,12 +293,14 @@ namespace Prebuild.Core.Nodes
}
string path = Helper.AttributeValue(node, "path", ".");
string pattern = Helper.AttributeValue(node, "pattern", "*");
+ string destination = Helper.AttributeValue(node, "destination", string.Empty);
bool recurse = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "recurse", "false"));
bool useRegex = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "useRegex", "false"));
string buildAction = Helper.AttributeValue(node, "buildAction", String.Empty);
if (buildAction != string.Empty)
m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction), buildAction);
-
+
+
//TODO: Figure out where the subtype node is being assigned
//string subType = Helper.AttributeValue(node, "subType", string.Empty);
//if (subType != String.Empty)
@@ -304,11 +314,12 @@ namespace Prebuild.Core.Nodes
}
m_PreservePath = bool.Parse( Helper.AttributeValue( node, "preservePath", bool.FalseString ) );
+ if ( buildAction == "Copy")
+ m_Destination = destination;
if(path != null && path.Length == 0)
- {
path = ".";//use current directory
- }
+
//throw new WarningException("Match must have a 'path' attribute");
if(pattern == null)
diff --git a/Prebuild/src/Core/Targets/AutotoolsTarget.cs b/Prebuild/src/Core/Targets/AutotoolsTarget.cs
index 485e4dd..e46b5a5 100644
--- a/Prebuild/src/Core/Targets/AutotoolsTarget.cs
+++ b/Prebuild/src/Core/Targets/AutotoolsTarget.cs
@@ -1,1070 +1,1070 @@
-#region BSD License
-/*
-
-Copyright (c) 2004 - 2008
-Matthew Holmes (matthew@wildfiregames.com),
-Dan Moorehead (dan05a@gmail.com),
-Dave Hudson (jendave@yahoo.com),
-C.J. Adams-Collier (cjac@colliertech.org),
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-* Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright
-notice, this list of conditions and the following disclaimer in the
-documentation and/or other materials provided with the distribution.
-
-* The name of the author may not be used to endorse or promote
-products derived from this software without specific prior written
-permission.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
-INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-*/
-#endregion
-
-#region MIT X11 license
-
-/*
- Portions of this file authored by Lluis Sanchez Gual
-
- Copyright (C) 2006 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.
- */
-
-#endregion
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Reflection;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Xml;
-using System.Xml.Xsl;
-using System.Net;
-using System.Diagnostics;
-
-using Prebuild.Core.Attributes;
-using Prebuild.Core.Interfaces;
-using Prebuild.Core.Nodes;
-using Prebuild.Core.Utilities;
-
-namespace Prebuild.Core.Targets
-{
- public enum ClrVersion
- {
- Default,
- Net_1_1,
- Net_2_0
- }
-
- public class SystemPackage
- {
- string name;
- string version;
- string description;
- string[] assemblies;
- bool isInternal;
- ClrVersion targetVersion;
-
- public void Initialize(string name,
- string version,
- string description,
- string[] assemblies,
- ClrVersion targetVersion,
- bool isInternal)
- {
- this.isInternal = isInternal;
- this.name = name;
- this.version = version;
- this.assemblies = assemblies;
- this.description = description;
- this.targetVersion = targetVersion;
- }
-
- public string Name
- {
- get { return name; }
- }
-
- public string Version
- {
- get { return version; }
- }
-
- public string Description
- {
- get { return description; }
- }
-
- public ClrVersion TargetVersion
- {
- get { return targetVersion; }
- }
-
- // The package is part of the mono SDK
- public bool IsCorePackage
- {
- get { return name == "mono"; }
- }
-
- // The package has been registered by an add-in, and is not installed
- // in the system.
- public bool IsInternalPackage
- {
- get { return isInternal; }
- }
-
- public string[] Assemblies
- {
- get { return assemblies; }
- }
-
- }
-
-
- ///
- ///
- ///
- [Target("autotools")]
- public class AutotoolsTarget : ITarget
- {
- #region Fields
-
- Kernel m_Kernel;
- XmlDocument autotoolsDoc;
- XmlUrlResolver xr;
- System.Security.Policy.Evidence e;
- readonly Dictionary assemblyPathToPackage = new Dictionary();
- readonly Dictionary assemblyFullNameToPath = new Dictionary();
- readonly Dictionary packagesHash = new Dictionary();
- readonly List packages = new List();
-
- #endregion
-
- #region Private Methods
-
- private static void mkdirDashP(string dirName)
- {
- DirectoryInfo di = new DirectoryInfo(dirName);
- if (di.Exists)
- return;
-
- string parentDirName = System.IO.Path.GetDirectoryName(dirName);
- DirectoryInfo parentDi = new DirectoryInfo(parentDirName);
- if (!parentDi.Exists)
- mkdirDashP(parentDirName);
-
- di.Create();
- }
-
- private static void chkMkDir(string dirName)
- {
- System.IO.DirectoryInfo di =
- new System.IO.DirectoryInfo(dirName);
-
- if (!di.Exists)
- di.Create();
- }
-
- private void transformToFile(string filename, XsltArgumentList argList, string nodeName)
- {
- // Create an XslTransform for this file
- XslTransform templateTransformer =
- new XslTransform();
-
- // Load up the template
- XmlNode templateNode =
- autotoolsDoc.SelectSingleNode(nodeName + "/*");
- templateTransformer.Load(templateNode.CreateNavigator(), xr, e);
-
- // Create a writer for the transformed template
- XmlTextWriter templateWriter =
- new XmlTextWriter(filename, null);
-
- // Perform transformation, writing the file
- templateTransformer.Transform
- (m_Kernel.CurrentDoc, argList, templateWriter, xr);
- }
-
- static string NormalizeAsmName(string name)
- {
- int i = name.IndexOf(", PublicKeyToken=null");
- if (i != -1)
- return name.Substring(0, i).Trim();
- return name;
- }
-
- private void AddAssembly(string assemblyfile, SystemPackage package)
- {
- if (!File.Exists(assemblyfile))
- return;
-
- try
- {
- System.Reflection.AssemblyName an = System.Reflection.AssemblyName.GetAssemblyName(assemblyfile);
- assemblyFullNameToPath[NormalizeAsmName(an.FullName)] = assemblyfile;
- assemblyPathToPackage[assemblyfile] = package;
- }
- catch
- {
- }
- }
-
- private static List GetAssembliesWithLibInfo(string line, string file)
- {
- List references = new List();
- List libdirs = new List();
- List retval = new List();
- foreach (string piece in line.Split(' '))
- {
- if (piece.ToLower().Trim().StartsWith("/r:") || piece.ToLower().Trim().StartsWith("-r:"))
- {
- references.Add(ProcessPiece(piece.Substring(3).Trim(), file));
- }
- else if (piece.ToLower().Trim().StartsWith("/lib:") || piece.ToLower().Trim().StartsWith("-lib:"))
- {
- libdirs.Add(ProcessPiece(piece.Substring(5).Trim(), file));
- }
- }
-
- foreach (string refrnc in references)
- {
- foreach (string libdir in libdirs)
- {
- if (File.Exists(libdir + Path.DirectorySeparatorChar + refrnc))
- {
- retval.Add(libdir + Path.DirectorySeparatorChar + refrnc);
- }
- }
- }
-
- return retval;
- }
-
- private static List GetAssembliesWithoutLibInfo(string line, string file)
- {
- List references = new List();
- foreach (string reference in line.Split(' '))
- {
- if (reference.ToLower().Trim().StartsWith("/r:") || reference.ToLower().Trim().StartsWith("-r:"))
- {
- string final_ref = reference.Substring(3).Trim();
- references.Add(ProcessPiece(final_ref, file));
- }
- }
- return references;
- }
-
- private static string ProcessPiece(string piece, string pcfile)
- {
- int start = piece.IndexOf("${");
- if (start == -1)
- return piece;
-
- int end = piece.IndexOf("}");
- if (end == -1)
- return piece;
-
- string variable = piece.Substring(start + 2, end - start - 2);
- string interp = GetVariableFromPkgConfig(variable, Path.GetFileNameWithoutExtension(pcfile));
- return ProcessPiece(piece.Replace("${" + variable + "}", interp), pcfile);
- }
-
- private static string GetVariableFromPkgConfig(string var, string pcfile)
- {
- ProcessStartInfo psi = new ProcessStartInfo("pkg-config");
- psi.RedirectStandardOutput = true;
- psi.UseShellExecute = false;
- psi.Arguments = String.Format("--variable={0} {1}", var, pcfile);
- Process p = new Process();
- p.StartInfo = psi;
- p.Start();
- string ret = p.StandardOutput.ReadToEnd().Trim();
- p.WaitForExit();
- if (String.IsNullOrEmpty(ret))
- return String.Empty;
- return ret;
- }
-
- private void ParsePCFile(string pcfile)
- {
- // Don't register the package twice
- string pname = Path.GetFileNameWithoutExtension(pcfile);
- if (packagesHash.ContainsKey(pname))
- return;
-
- List fullassemblies = null;
- string version = "";
- string desc = "";
-
- SystemPackage package = new SystemPackage();
-
- using (StreamReader reader = new StreamReader(pcfile))
- {
- string line;
- while ((line = reader.ReadLine()) != null)
- {
- string lowerLine = line.ToLower();
- if (lowerLine.StartsWith("libs:") && lowerLine.IndexOf(".dll") != -1)
- {
- string choppedLine = line.Substring(5).Trim();
- if (choppedLine.IndexOf("-lib:") != -1 || choppedLine.IndexOf("/lib:") != -1)
- {
- fullassemblies = GetAssembliesWithLibInfo(choppedLine, pcfile);
- }
- else
- {
- fullassemblies = GetAssembliesWithoutLibInfo(choppedLine, pcfile);
- }
- }
- else if (lowerLine.StartsWith("version:"))
- {
- // "version:".Length == 8
- version = line.Substring(8).Trim();
- }
- else if (lowerLine.StartsWith("description:"))
- {
- // "description:".Length == 12
- desc = line.Substring(12).Trim();
- }
- }
- }
-
- if (fullassemblies == null)
- return;
-
- foreach (string assembly in fullassemblies)
- {
- AddAssembly(assembly, package);
- }
-
- package.Initialize(pname,
- version,
- desc,
- fullassemblies.ToArray(),
- ClrVersion.Default,
- false);
- packages.Add(package);
- packagesHash[pname] = package;
- }
-
- void RegisterSystemAssemblies(string prefix, string version, ClrVersion ver)
- {
- SystemPackage package = new SystemPackage();
- List list = new List();
-
- string dir = Path.Combine(prefix, version);
- if (!Directory.Exists(dir))
- {
- return;
- }
-
- foreach (string assembly in Directory.GetFiles(dir, "*.dll"))
- {
- AddAssembly(assembly, package);
- list.Add(assembly);
- }
-
- package.Initialize("mono",
- version,
- "The Mono runtime",
- list.ToArray(),
- ver,
- false);
- packages.Add(package);
- }
-
- void RunInitialization()
- {
- string versionDir;
-
- if (Environment.Version.Major == 1)
- {
- versionDir = "1.0";
- }
- else
- {
- versionDir = "2.0";
- }
-
- //Pull up assemblies from the installed mono system.
- string prefix = Path.GetDirectoryName(typeof(int).Assembly.Location);
-
- if (prefix.IndexOf(Path.Combine("mono", versionDir)) == -1)
- prefix = Path.Combine(prefix, "mono");
- else
- prefix = Path.GetDirectoryName(prefix);
-
- RegisterSystemAssemblies(prefix, "1.0", ClrVersion.Net_1_1);
- RegisterSystemAssemblies(prefix, "2.0", ClrVersion.Net_2_0);
-
- string search_dirs = Environment.GetEnvironmentVariable("PKG_CONFIG_PATH");
- string libpath = Environment.GetEnvironmentVariable("PKG_CONFIG_LIBPATH");
-
- if (String.IsNullOrEmpty(libpath))
- {
- string path_dirs = Environment.GetEnvironmentVariable("PATH");
- foreach (string pathdir in path_dirs.Split(Path.PathSeparator))
- {
- if (pathdir == null)
- continue;
- if (File.Exists(pathdir + Path.DirectorySeparatorChar + "pkg-config"))
- {
- libpath = Path.Combine(pathdir, "..");
- libpath = Path.Combine(libpath, "lib");
- libpath = Path.Combine(libpath, "pkgconfig");
- break;
- }
- }
- }
- search_dirs += Path.PathSeparator + libpath;
- if (!string.IsNullOrEmpty(search_dirs))
- {
- List scanDirs = new List();
- foreach (string potentialDir in search_dirs.Split(Path.PathSeparator))
- {
- if (!scanDirs.Contains(potentialDir))
- scanDirs.Add(potentialDir);
- }
- foreach (string pcdir in scanDirs)
- {
- if (pcdir == null)
- continue;
-
- if (Directory.Exists(pcdir))
- {
- foreach (string pcfile in Directory.GetFiles(pcdir, "*.pc"))
- {
- ParsePCFile(pcfile);
- }
- }
- }
- }
- }
-
- private void WriteCombine(SolutionNode solution)
- {
- #region "Create Solution directory if it doesn't exist"
- string solutionDir = Path.Combine(solution.FullPath,
- Path.Combine("autotools",
- solution.Name));
- chkMkDir(solutionDir);
- #endregion
-
- #region "Write Solution-level files"
- XsltArgumentList argList = new XsltArgumentList();
- argList.AddParam("solutionName", "", solution.Name);
- // $solutionDir is $rootDir/$solutionName/
- transformToFile(Path.Combine(solutionDir, "configure.ac"),
- argList, "/Autotools/SolutionConfigureAc");
- transformToFile(Path.Combine(solutionDir, "Makefile.am"),
- argList, "/Autotools/SolutionMakefileAm");
- transformToFile(Path.Combine(solutionDir, "autogen.sh"),
- argList, "/Autotools/SolutionAutogenSh");
- #endregion
-
- foreach (ProjectNode project in solution.ProjectsTableOrder)
- {
- m_Kernel.Log.Write(String.Format("Writing project: {0}",
- project.Name));
- WriteProject(solution, project);
- }
- }
-
- private static string FindFileReference(string refName,
- ProjectNode project)
- {
- foreach (ReferencePathNode refPath in project.ReferencePaths)
- {
- string fullPath =
- Helper.MakeFilePath(refPath.Path, refName, "dll");
-
- if (File.Exists(fullPath)) {
- return fullPath;
- }
- }
-
- return null;
- }
-
- ///
- /// Gets the XML doc file.
- ///
- /// The project.
- /// The conf.
- ///
- public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf)
- {
- if (conf == null)
- {
- throw new ArgumentNullException("conf");
- }
- if (project == null)
- {
- throw new ArgumentNullException("project");
- }
- string docFile = (string)conf.Options["XmlDocFile"];
- // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified
- // {
- // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml";
- // }
- return docFile;
- }
-
- ///
- /// Normalizes the path.
- ///
- /// The path.
- ///
- public static string NormalizePath(string path)
- {
- if (path == null)
- {
- return "";
- }
-
- StringBuilder tmpPath;
-
- if (Core.Parse.Preprocessor.GetOS() == "Win32")
- {
- tmpPath = new StringBuilder(path.Replace('\\', '/'));
- tmpPath.Replace("/", @"\\");
- }
- else
- {
- tmpPath = new StringBuilder(path.Replace('\\', '/'));
- tmpPath = tmpPath.Replace('/', Path.DirectorySeparatorChar);
- }
- return tmpPath.ToString();
- }
-
- private void WriteProject(SolutionNode solution, ProjectNode project)
- {
- string solutionDir = Path.Combine(solution.FullPath, Path.Combine("autotools", solution.Name));
- string projectDir = Path.Combine(solutionDir, project.Name);
- string projectVersion = project.Version;
- bool hasAssemblyConfig = false;
- chkMkDir(projectDir);
-
- List
- compiledFiles = new List(),
- contentFiles = new List(),
- embeddedFiles = new List(),
-
- binaryLibs = new List(),
- pkgLibs = new List(),
- systemLibs = new List(),
- runtimeLibs = new List(),
-
- extraDistFiles = new List(),
- localCopyTargets = new List();
-
- // If there exists a .config file for this assembly, copy
- // it to the project folder
-
- // TODO: Support copying .config.osx files
- // TODO: support processing the .config file for native library deps
- string projectAssemblyName = project.Name;
- if (project.AssemblyName != null)
- projectAssemblyName = project.AssemblyName;
-
- if (File.Exists(Path.Combine(project.FullPath, projectAssemblyName) + ".dll.config"))
- {
- hasAssemblyConfig = true;
- System.IO.File.Copy(Path.Combine(project.FullPath, projectAssemblyName + ".dll.config"), Path.Combine(projectDir, projectAssemblyName + ".dll.config"), true);
- extraDistFiles.Add(project.AssemblyName + ".dll.config");
- }
-
- foreach (ConfigurationNode conf in project.Configurations)
- {
- if (conf.Options.KeyFile != string.Empty)
- {
- // Copy snk file into the project's directory
- // Use the snk from the project directory directly
- string source = Path.Combine(project.FullPath, conf.Options.KeyFile);
- string keyFile = conf.Options.KeyFile;
- Regex re = new Regex(".*/");
- keyFile = re.Replace(keyFile, "");
-
- string dest = Path.Combine(projectDir, keyFile);
- // Tell the user if there's a problem copying the file
- try
- {
- mkdirDashP(System.IO.Path.GetDirectoryName(dest));
- System.IO.File.Copy(source, dest, true);
- }
- catch (System.IO.IOException e)
- {
- Console.WriteLine(e.Message);
- }
- }
- }
-
- // Copy compiled, embedded and content files into the project's directory
- foreach (string filename in project.Files)
- {
- string source = Path.Combine(project.FullPath, filename);
- string dest = Path.Combine(projectDir, filename);
-
- if (filename.Contains("AssemblyInfo.cs"))
- {
- // If we've got an AssemblyInfo.cs, pull the version number from it
- string[] sources = { source };
- string[] args = { "" };
- Microsoft.CSharp.CSharpCodeProvider cscp =
- new Microsoft.CSharp.CSharpCodeProvider();
-
- string tempAssemblyFile = Path.Combine(Path.GetTempPath(), project.Name + "-temp.dll");
- System.CodeDom.Compiler.CompilerParameters cparam =
- new System.CodeDom.Compiler.CompilerParameters(args, tempAssemblyFile);
-
- System.CodeDom.Compiler.CompilerResults cr =
- cscp.CompileAssemblyFromFile(cparam, sources);
-
- foreach (System.CodeDom.Compiler.CompilerError error in cr.Errors)
- Console.WriteLine("Error! '{0}'", error.ErrorText);
-
- try {
- string projectFullName = cr.CompiledAssembly.FullName;
- Regex verRegex = new Regex("Version=([\\d\\.]+)");
- Match verMatch = verRegex.Match(projectFullName);
- if (verMatch.Success)
- projectVersion = verMatch.Groups[1].Value;
- }catch{
- Console.WriteLine("Couldn't compile AssemblyInfo.cs");
- }
-
- // Clean up the temp file
- try
- {
- if (File.Exists(tempAssemblyFile))
- File.Delete(tempAssemblyFile);
- }
- catch
- {
- Console.WriteLine("Error! '{0}'", e);
- }
-
- }
-
- // Tell the user if there's a problem copying the file
- try
- {
- mkdirDashP(System.IO.Path.GetDirectoryName(dest));
- System.IO.File.Copy(source, dest, true);
- }
- catch (System.IO.IOException e)
- {
- Console.WriteLine(e.Message);
- }
-
- switch (project.Files.GetBuildAction(filename))
- {
- case BuildAction.Compile:
- compiledFiles.Add(filename);
- break;
- case BuildAction.Content:
- contentFiles.Add(filename);
- extraDistFiles.Add(filename);
- break;
- case BuildAction.EmbeddedResource:
- embeddedFiles.Add(filename);
- break;
- }
- }
-
- // Set up references
- for (int refNum = 0; refNum < project.References.Count; refNum++)
- {
- ReferenceNode refr = project.References[refNum];
- Assembly refAssembly = Assembly.LoadWithPartialName(refr.Name);
-
- /* Determine which pkg-config (.pc) file refers to
- this assembly */
-
- SystemPackage package = null;
-
- if (packagesHash.ContainsKey(refr.Name))
- {
- package = packagesHash[refr.Name];
-
- }
- else
- {
- string assemblyFullName = string.Empty;
- if (refAssembly != null)
- assemblyFullName = refAssembly.FullName;
-
- string assemblyFileName = string.Empty;
- if (assemblyFullName != string.Empty &&
- assemblyFullNameToPath.ContainsKey(assemblyFullName)
- )
- assemblyFileName =
- assemblyFullNameToPath[assemblyFullName];
-
- if (assemblyFileName != string.Empty &&
- assemblyPathToPackage.ContainsKey(assemblyFileName)
- )
- package = assemblyPathToPackage[assemblyFileName];
-
- }
-
- /* If we know the .pc file and it is not "mono"
- (already in the path), add a -pkg: argument */
-
- if (package != null &&
- package.Name != "mono" &&
- !pkgLibs.Contains(package.Name)
- )
- pkgLibs.Add(package.Name);
-
- string fileRef =
- FindFileReference(refr.Name, (ProjectNode)refr.Parent);
-
- if (refr.LocalCopy ||
- solution.ProjectsTable.ContainsKey(refr.Name) ||
- fileRef != null ||
- refr.Path != null
- )
- {
-
- /* Attempt to copy the referenced lib to the
- project's directory */
-
- string filename = refr.Name + ".dll";
- string source = filename;
- if (refr.Path != null)
- source = Path.Combine(refr.Path, source);
- source = Path.Combine(project.FullPath, source);
- string dest = Path.Combine(projectDir, filename);
-
- /* Since we depend on this binary dll to build, we
- * will add a compile- time dependency on the
- * copied dll, and add the dll to the list of
- * files distributed with this package
- */
-
- binaryLibs.Add(refr.Name + ".dll");
- extraDistFiles.Add(refr.Name + ".dll");
-
- // TODO: Support copying .config.osx files
- // TODO: Support for determining native dependencies
- if (File.Exists(source + ".config"))
- {
- System.IO.File.Copy(source + ".config", Path.GetDirectoryName(dest), true);
- extraDistFiles.Add(refr.Name + ".dll.config");
- }
-
- try
- {
- System.IO.File.Copy(source, dest, true);
- }
- catch (System.IO.IOException)
- {
- if (solution.ProjectsTable.ContainsKey(refr.Name)){
-
- /* If an assembly is referenced, marked for
- * local copy, in the list of projects for
- * this solution, but does not exist, put a
- * target into the Makefile.am to build the
- * assembly and copy it to this project's
- * directory
- */
-
- ProjectNode sourcePrj =
- ((solution.ProjectsTable[refr.Name]));
-
- string target =
- String.Format("{0}:\n" +
- "\t$(MAKE) -C ../{1}\n" +
- "\tln ../{2}/$@ $@\n",
- filename,
- sourcePrj.Name,
- sourcePrj.Name );
-
- localCopyTargets.Add(target);
- }
- }
- }
- else if( !pkgLibs.Contains(refr.Name) )
- {
- // Else, let's assume it's in the GAC or the lib path
- string assemName = string.Empty;
- int index = refr.Name.IndexOf(",");
-
- if (index > 0)
- assemName = refr.Name.Substring(0, index);
- else
- assemName = refr.Name;
-
- m_Kernel.Log.Write(String.Format(
- "Warning: Couldn't find an appropriate assembly " +
- "for reference:\n'{0}'", refr.Name
- ));
- systemLibs.Add(assemName);
- }
- }
-
- const string lineSep = " \\\n\t";
- string compiledFilesString = string.Empty;
- if (compiledFiles.Count > 0)
- compiledFilesString =
- lineSep + string.Join(lineSep, compiledFiles.ToArray());
-
- string embeddedFilesString = "";
- if (embeddedFiles.Count > 0)
- embeddedFilesString =
- lineSep + string.Join(lineSep, embeddedFiles.ToArray());
-
- string contentFilesString = "";
- if (contentFiles.Count > 0)
- contentFilesString =
- lineSep + string.Join(lineSep, contentFiles.ToArray());
-
- string extraDistFilesString = "";
- if (extraDistFiles.Count > 0)
- extraDistFilesString =
- lineSep + string.Join(lineSep, extraDistFiles.ToArray());
-
- string pkgLibsString = "";
- if (pkgLibs.Count > 0)
- pkgLibsString =
- lineSep + string.Join(lineSep, pkgLibs.ToArray());
-
- string binaryLibsString = "";
- if (binaryLibs.Count > 0)
- binaryLibsString =
- lineSep + string.Join(lineSep, binaryLibs.ToArray());
-
- string systemLibsString = "";
- if (systemLibs.Count > 0)
- systemLibsString =
- lineSep + string.Join(lineSep, systemLibs.ToArray());
-
- string localCopyTargetsString = "";
- if (localCopyTargets.Count > 0)
- localCopyTargetsString =
- string.Join("\n", localCopyTargets.ToArray());
-
- string monoPath = "";
- foreach (string runtimeLib in runtimeLibs)
- {
- monoPath += ":`pkg-config --variable=libdir " + runtimeLib + "`";
- }
-
- // Add the project name to the list of transformation
- // parameters
- XsltArgumentList argList = new XsltArgumentList();
- argList.AddParam("projectName", "", project.Name);
- argList.AddParam("solutionName", "", solution.Name);
- argList.AddParam("assemblyName", "", projectAssemblyName);
- argList.AddParam("compiledFiles", "", compiledFilesString);
- argList.AddParam("embeddedFiles", "", embeddedFilesString);
- argList.AddParam("contentFiles", "", contentFilesString);
- argList.AddParam("extraDistFiles", "", extraDistFilesString);
- argList.AddParam("pkgLibs", "", pkgLibsString);
- argList.AddParam("binaryLibs", "", binaryLibsString);
- argList.AddParam("systemLibs", "", systemLibsString);
- argList.AddParam("monoPath", "", monoPath);
- argList.AddParam("localCopyTargets", "", localCopyTargetsString);
- argList.AddParam("projectVersion", "", projectVersion);
- argList.AddParam("hasAssemblyConfig", "", hasAssemblyConfig ? "true" : "");
-
- // Transform the templates
- transformToFile(Path.Combine(projectDir, "configure.ac"), argList, "/Autotools/ProjectConfigureAc");
- transformToFile(Path.Combine(projectDir, "Makefile.am"), argList, "/Autotools/ProjectMakefileAm");
- transformToFile(Path.Combine(projectDir, "autogen.sh"), argList, "/Autotools/ProjectAutogenSh");
-
- if (project.Type == Core.Nodes.ProjectType.Library)
- transformToFile(Path.Combine(projectDir, project.Name + ".pc.in"), argList, "/Autotools/ProjectPcIn");
- if (project.Type == Core.Nodes.ProjectType.Exe || project.Type == Core.Nodes.ProjectType.WinExe)
- transformToFile(Path.Combine(projectDir, project.Name.ToLower() + ".in"), argList, "/Autotools/ProjectWrapperScriptIn");
- }
-
- private void CleanProject(ProjectNode project)
- {
- m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
- string projectFile = Helper.MakeFilePath(project.FullPath, "Include", "am");
- Helper.DeleteIfExists(projectFile);
- }
-
- private void CleanSolution(SolutionNode solution)
- {
- m_Kernel.Log.Write("Cleaning Autotools make files for", solution.Name);
-
- string slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am");
- Helper.DeleteIfExists(slnFile);
-
- slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "in");
- Helper.DeleteIfExists(slnFile);
-
- slnFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac");
- Helper.DeleteIfExists(slnFile);
-
- slnFile = Helper.MakeFilePath(solution.FullPath, "configure");
- Helper.DeleteIfExists(slnFile);
-
- slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile");
- Helper.DeleteIfExists(slnFile);
-
- foreach (ProjectNode project in solution.Projects)
- {
- CleanProject(project);
- }
-
- m_Kernel.Log.Write("");
- }
-
- #endregion
-
- #region ITarget Members
-
- ///
- /// Writes the specified kern.
- ///
- /// The kern.
- public void Write(Kernel kern)
- {
- if (kern == null)
- {
- throw new ArgumentNullException("kern");
- }
- m_Kernel = kern;
- m_Kernel.Log.Write("Parsing system pkg-config files");
- RunInitialization();
-
- const string streamName = "autotools.xml";
- string fqStreamName = String.Format("Prebuild.data.{0}",
- streamName
- );
-
- // Retrieve stream for the autotools template XML
- Stream autotoolsStream = Assembly.GetExecutingAssembly()
- .GetManifestResourceStream(fqStreamName);
-
- if(autotoolsStream == null) {
-
- /*
- * try without the default namespace prepended, in
- * case prebuild.exe assembly was compiled with
- * something other than Visual Studio .NET
- */
-
- autotoolsStream = Assembly.GetExecutingAssembly()
- .GetManifestResourceStream(streamName);
- if(autotoolsStream == null){
- string errStr =
- String.Format("Could not find embedded resource file:\n" +
- "'{0}' or '{1}'",
- streamName, fqStreamName
- );
-
- m_Kernel.Log.Write(errStr);
-
- throw new System.Reflection.TargetException(errStr);
- }
- }
-
- // Create an XML URL Resolver with default credentials
- xr = new System.Xml.XmlUrlResolver();
- xr.Credentials = CredentialCache.DefaultCredentials;
-
- // Create a default evidence - no need to limit access
- e = new System.Security.Policy.Evidence();
-
- // Load the autotools XML
- autotoolsDoc = new XmlDocument();
- autotoolsDoc.Load(autotoolsStream);
-
- /* rootDir is the filesystem location where the Autotools
- * build tree will be created - for now we'll make it
- * $PWD/autotools
- */
-
- string pwd = Directory.GetCurrentDirectory();
- //string pwd = System.Environment.GetEnvironmentVariable("PWD");
- //if (pwd.Length != 0)
- //{
- string rootDir = Path.Combine(pwd, "autotools");
- //}
- //else
- //{
- // pwd = Assembly.GetExecutingAssembly()
- //}
- chkMkDir(rootDir);
-
- foreach (SolutionNode solution in kern.Solutions)
- {
- m_Kernel.Log.Write(String.Format("Writing solution: {0}",
- solution.Name));
- WriteCombine(solution);
- }
- m_Kernel = null;
- }
-
- ///
- /// Cleans the specified kern.
- ///
- /// The kern.
- public virtual void Clean(Kernel kern)
- {
- if (kern == null)
- {
- throw new ArgumentNullException("kern");
- }
- m_Kernel = kern;
- foreach (SolutionNode sol in kern.Solutions)
- {
- CleanSolution(sol);
- }
- m_Kernel = null;
- }
-
- ///
- /// Gets the name.
- ///
- /// The name.
- public string Name
- {
- get
- {
- return "autotools";
- }
- }
-
- #endregion
- }
-}
+#region BSD License
+/*
+
+Copyright (c) 2004 - 2008
+Matthew Holmes (matthew@wildfiregames.com),
+Dan Moorehead (dan05a@gmail.com),
+Dave Hudson (jendave@yahoo.com),
+C.J. Adams-Collier (cjac@colliertech.org),
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+* The name of the author may not be used to endorse or promote
+products derived from this software without specific prior written
+permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+#endregion
+
+#region MIT X11 license
+
+/*
+ Portions of this file authored by Lluis Sanchez Gual
+
+ Copyright (C) 2006 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.
+ */
+
+#endregion
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Reflection;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Xml;
+using System.Xml.Xsl;
+using System.Net;
+using System.Diagnostics;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Nodes;
+using Prebuild.Core.Utilities;
+
+namespace Prebuild.Core.Targets
+{
+ public enum ClrVersion
+ {
+ Default,
+ Net_1_1,
+ Net_2_0
+ }
+
+ public class SystemPackage
+ {
+ string name;
+ string version;
+ string description;
+ string[] assemblies;
+ bool isInternal;
+ ClrVersion targetVersion;
+
+ public void Initialize(string name,
+ string version,
+ string description,
+ string[] assemblies,
+ ClrVersion targetVersion,
+ bool isInternal)
+ {
+ this.isInternal = isInternal;
+ this.name = name;
+ this.version = version;
+ this.assemblies = assemblies;
+ this.description = description;
+ this.targetVersion = targetVersion;
+ }
+
+ public string Name
+ {
+ get { return name; }
+ }
+
+ public string Version
+ {
+ get { return version; }
+ }
+
+ public string Description
+ {
+ get { return description; }
+ }
+
+ public ClrVersion TargetVersion
+ {
+ get { return targetVersion; }
+ }
+
+ // The package is part of the mono SDK
+ public bool IsCorePackage
+ {
+ get { return name == "mono"; }
+ }
+
+ // The package has been registered by an add-in, and is not installed
+ // in the system.
+ public bool IsInternalPackage
+ {
+ get { return isInternal; }
+ }
+
+ public string[] Assemblies
+ {
+ get { return assemblies; }
+ }
+
+ }
+
+
+ ///
+ ///
+ ///
+ [Target("autotools")]
+ public class AutotoolsTarget : ITarget
+ {
+ #region Fields
+
+ Kernel m_Kernel;
+ XmlDocument autotoolsDoc;
+ XmlUrlResolver xr;
+ System.Security.Policy.Evidence e;
+ readonly Dictionary assemblyPathToPackage = new Dictionary();
+ readonly Dictionary assemblyFullNameToPath = new Dictionary();
+ readonly Dictionary packagesHash = new Dictionary();
+ readonly List packages = new List();
+
+ #endregion
+
+ #region Private Methods
+
+ private static void mkdirDashP(string dirName)
+ {
+ DirectoryInfo di = new DirectoryInfo(dirName);
+ if (di.Exists)
+ return;
+
+ string parentDirName = System.IO.Path.GetDirectoryName(dirName);
+ DirectoryInfo parentDi = new DirectoryInfo(parentDirName);
+ if (!parentDi.Exists)
+ mkdirDashP(parentDirName);
+
+ di.Create();
+ }
+
+ private static void chkMkDir(string dirName)
+ {
+ System.IO.DirectoryInfo di =
+ new System.IO.DirectoryInfo(dirName);
+
+ if (!di.Exists)
+ di.Create();
+ }
+
+ private void transformToFile(string filename, XsltArgumentList argList, string nodeName)
+ {
+ // Create an XslTransform for this file
+ XslTransform templateTransformer =
+ new XslTransform();
+
+ // Load up the template
+ XmlNode templateNode =
+ autotoolsDoc.SelectSingleNode(nodeName + "/*");
+ templateTransformer.Load(templateNode.CreateNavigator(), xr, e);
+
+ // Create a writer for the transformed template
+ XmlTextWriter templateWriter =
+ new XmlTextWriter(filename, null);
+
+ // Perform transformation, writing the file
+ templateTransformer.Transform
+ (m_Kernel.CurrentDoc, argList, templateWriter, xr);
+ }
+
+ static string NormalizeAsmName(string name)
+ {
+ int i = name.IndexOf(", PublicKeyToken=null");
+ if (i != -1)
+ return name.Substring(0, i).Trim();
+ return name;
+ }
+
+ private void AddAssembly(string assemblyfile, SystemPackage package)
+ {
+ if (!File.Exists(assemblyfile))
+ return;
+
+ try
+ {
+ System.Reflection.AssemblyName an = System.Reflection.AssemblyName.GetAssemblyName(assemblyfile);
+ assemblyFullNameToPath[NormalizeAsmName(an.FullName)] = assemblyfile;
+ assemblyPathToPackage[assemblyfile] = package;
+ }
+ catch
+ {
+ }
+ }
+
+ private static List GetAssembliesWithLibInfo(string line, string file)
+ {
+ List references = new List();
+ List libdirs = new List();
+ List retval = new List();
+ foreach (string piece in line.Split(' '))
+ {
+ if (piece.ToLower().Trim().StartsWith("/r:") || piece.ToLower().Trim().StartsWith("-r:"))
+ {
+ references.Add(ProcessPiece(piece.Substring(3).Trim(), file));
+ }
+ else if (piece.ToLower().Trim().StartsWith("/lib:") || piece.ToLower().Trim().StartsWith("-lib:"))
+ {
+ libdirs.Add(ProcessPiece(piece.Substring(5).Trim(), file));
+ }
+ }
+
+ foreach (string refrnc in references)
+ {
+ foreach (string libdir in libdirs)
+ {
+ if (File.Exists(libdir + Path.DirectorySeparatorChar + refrnc))
+ {
+ retval.Add(libdir + Path.DirectorySeparatorChar + refrnc);
+ }
+ }
+ }
+
+ return retval;
+ }
+
+ private static List GetAssembliesWithoutLibInfo(string line, string file)
+ {
+ List references = new List();
+ foreach (string reference in line.Split(' '))
+ {
+ if (reference.ToLower().Trim().StartsWith("/r:") || reference.ToLower().Trim().StartsWith("-r:"))
+ {
+ string final_ref = reference.Substring(3).Trim();
+ references.Add(ProcessPiece(final_ref, file));
+ }
+ }
+ return references;
+ }
+
+ private static string ProcessPiece(string piece, string pcfile)
+ {
+ int start = piece.IndexOf("${");
+ if (start == -1)
+ return piece;
+
+ int end = piece.IndexOf("}");
+ if (end == -1)
+ return piece;
+
+ string variable = piece.Substring(start + 2, end - start - 2);
+ string interp = GetVariableFromPkgConfig(variable, Path.GetFileNameWithoutExtension(pcfile));
+ return ProcessPiece(piece.Replace("${" + variable + "}", interp), pcfile);
+ }
+
+ private static string GetVariableFromPkgConfig(string var, string pcfile)
+ {
+ ProcessStartInfo psi = new ProcessStartInfo("pkg-config");
+ psi.RedirectStandardOutput = true;
+ psi.UseShellExecute = false;
+ psi.Arguments = String.Format("--variable={0} {1}", var, pcfile);
+ Process p = new Process();
+ p.StartInfo = psi;
+ p.Start();
+ string ret = p.StandardOutput.ReadToEnd().Trim();
+ p.WaitForExit();
+ if (String.IsNullOrEmpty(ret))
+ return String.Empty;
+ return ret;
+ }
+
+ private void ParsePCFile(string pcfile)
+ {
+ // Don't register the package twice
+ string pname = Path.GetFileNameWithoutExtension(pcfile);
+ if (packagesHash.ContainsKey(pname))
+ return;
+
+ List fullassemblies = null;
+ string version = "";
+ string desc = "";
+
+ SystemPackage package = new SystemPackage();
+
+ using (StreamReader reader = new StreamReader(pcfile))
+ {
+ string line;
+ while ((line = reader.ReadLine()) != null)
+ {
+ string lowerLine = line.ToLower();
+ if (lowerLine.StartsWith("libs:") && lowerLine.IndexOf(".dll") != -1)
+ {
+ string choppedLine = line.Substring(5).Trim();
+ if (choppedLine.IndexOf("-lib:") != -1 || choppedLine.IndexOf("/lib:") != -1)
+ {
+ fullassemblies = GetAssembliesWithLibInfo(choppedLine, pcfile);
+ }
+ else
+ {
+ fullassemblies = GetAssembliesWithoutLibInfo(choppedLine, pcfile);
+ }
+ }
+ else if (lowerLine.StartsWith("version:"))
+ {
+ // "version:".Length == 8
+ version = line.Substring(8).Trim();
+ }
+ else if (lowerLine.StartsWith("description:"))
+ {
+ // "description:".Length == 12
+ desc = line.Substring(12).Trim();
+ }
+ }
+ }
+
+ if (fullassemblies == null)
+ return;
+
+ foreach (string assembly in fullassemblies)
+ {
+ AddAssembly(assembly, package);
+ }
+
+ package.Initialize(pname,
+ version,
+ desc,
+ fullassemblies.ToArray(),
+ ClrVersion.Default,
+ false);
+ packages.Add(package);
+ packagesHash[pname] = package;
+ }
+
+ void RegisterSystemAssemblies(string prefix, string version, ClrVersion ver)
+ {
+ SystemPackage package = new SystemPackage();
+ List list = new List();
+
+ string dir = Path.Combine(prefix, version);
+ if (!Directory.Exists(dir))
+ {
+ return;
+ }
+
+ foreach (string assembly in Directory.GetFiles(dir, "*.dll"))
+ {
+ AddAssembly(assembly, package);
+ list.Add(assembly);
+ }
+
+ package.Initialize("mono",
+ version,
+ "The Mono runtime",
+ list.ToArray(),
+ ver,
+ false);
+ packages.Add(package);
+ }
+
+ void RunInitialization()
+ {
+ string versionDir;
+
+ if (Environment.Version.Major == 1)
+ {
+ versionDir = "1.0";
+ }
+ else
+ {
+ versionDir = "2.0";
+ }
+
+ //Pull up assemblies from the installed mono system.
+ string prefix = Path.GetDirectoryName(typeof(int).Assembly.Location);
+
+ if (prefix.IndexOf(Path.Combine("mono", versionDir)) == -1)
+ prefix = Path.Combine(prefix, "mono");
+ else
+ prefix = Path.GetDirectoryName(prefix);
+
+ RegisterSystemAssemblies(prefix, "1.0", ClrVersion.Net_1_1);
+ RegisterSystemAssemblies(prefix, "2.0", ClrVersion.Net_2_0);
+
+ string search_dirs = Environment.GetEnvironmentVariable("PKG_CONFIG_PATH");
+ string libpath = Environment.GetEnvironmentVariable("PKG_CONFIG_LIBPATH");
+
+ if (String.IsNullOrEmpty(libpath))
+ {
+ string path_dirs = Environment.GetEnvironmentVariable("PATH");
+ foreach (string pathdir in path_dirs.Split(Path.PathSeparator))
+ {
+ if (pathdir == null)
+ continue;
+ if (File.Exists(pathdir + Path.DirectorySeparatorChar + "pkg-config"))
+ {
+ libpath = Path.Combine(pathdir, "..");
+ libpath = Path.Combine(libpath, "lib");
+ libpath = Path.Combine(libpath, "pkgconfig");
+ break;
+ }
+ }
+ }
+ search_dirs += Path.PathSeparator + libpath;
+ if (!string.IsNullOrEmpty(search_dirs))
+ {
+ List scanDirs = new List();
+ foreach (string potentialDir in search_dirs.Split(Path.PathSeparator))
+ {
+ if (!scanDirs.Contains(potentialDir))
+ scanDirs.Add(potentialDir);
+ }
+ foreach (string pcdir in scanDirs)
+ {
+ if (pcdir == null)
+ continue;
+
+ if (Directory.Exists(pcdir))
+ {
+ foreach (string pcfile in Directory.GetFiles(pcdir, "*.pc"))
+ {
+ ParsePCFile(pcfile);
+ }
+ }
+ }
+ }
+ }
+
+ private void WriteCombine(SolutionNode solution)
+ {
+ #region "Create Solution directory if it doesn't exist"
+ string solutionDir = Path.Combine(solution.FullPath,
+ Path.Combine("autotools",
+ solution.Name));
+ chkMkDir(solutionDir);
+ #endregion
+
+ #region "Write Solution-level files"
+ XsltArgumentList argList = new XsltArgumentList();
+ argList.AddParam("solutionName", "", solution.Name);
+ // $solutionDir is $rootDir/$solutionName/
+ transformToFile(Path.Combine(solutionDir, "configure.ac"),
+ argList, "/Autotools/SolutionConfigureAc");
+ transformToFile(Path.Combine(solutionDir, "Makefile.am"),
+ argList, "/Autotools/SolutionMakefileAm");
+ transformToFile(Path.Combine(solutionDir, "autogen.sh"),
+ argList, "/Autotools/SolutionAutogenSh");
+ #endregion
+
+ foreach (ProjectNode project in solution.ProjectsTableOrder)
+ {
+ m_Kernel.Log.Write(String.Format("Writing project: {0}",
+ project.Name));
+ WriteProject(solution, project);
+ }
+ }
+
+ private static string FindFileReference(string refName,
+ ProjectNode project)
+ {
+ foreach (ReferencePathNode refPath in project.ReferencePaths)
+ {
+ string fullPath =
+ Helper.MakeFilePath(refPath.Path, refName, "dll");
+
+ if (File.Exists(fullPath)) {
+ return fullPath;
+ }
+ }
+
+ return null;
+ }
+
+ ///
+ /// Gets the XML doc file.
+ ///
+ /// The project.
+ /// The conf.
+ ///
+ public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf)
+ {
+ if (conf == null)
+ {
+ throw new ArgumentNullException("conf");
+ }
+ if (project == null)
+ {
+ throw new ArgumentNullException("project");
+ }
+ string docFile = (string)conf.Options["XmlDocFile"];
+ // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified
+ // {
+ // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml";
+ // }
+ return docFile;
+ }
+
+ ///
+ /// Normalizes the path.
+ ///
+ /// The path.
+ ///
+ public static string NormalizePath(string path)
+ {
+ if (path == null)
+ {
+ return "";
+ }
+
+ StringBuilder tmpPath;
+
+ if (Core.Parse.Preprocessor.GetOS() == "Win32")
+ {
+ tmpPath = new StringBuilder(path.Replace('\\', '/'));
+ tmpPath.Replace("/", @"\\");
+ }
+ else
+ {
+ tmpPath = new StringBuilder(path.Replace('\\', '/'));
+ tmpPath = tmpPath.Replace('/', Path.DirectorySeparatorChar);
+ }
+ return tmpPath.ToString();
+ }
+
+ private void WriteProject(SolutionNode solution, ProjectNode project)
+ {
+ string solutionDir = Path.Combine(solution.FullPath, Path.Combine("autotools", solution.Name));
+ string projectDir = Path.Combine(solutionDir, project.Name);
+ string projectVersion = project.Version;
+ bool hasAssemblyConfig = false;
+ chkMkDir(projectDir);
+
+ List
+ compiledFiles = new List(),
+ contentFiles = new List(),
+ embeddedFiles = new List(),
+
+ binaryLibs = new List(),
+ pkgLibs = new List(),
+ systemLibs = new List(),
+ runtimeLibs = new List(),
+
+ extraDistFiles = new List(),
+ localCopyTargets = new List();
+
+ // If there exists a .config file for this assembly, copy
+ // it to the project folder
+
+ // TODO: Support copying .config.osx files
+ // TODO: support processing the .config file for native library deps
+ string projectAssemblyName = project.Name;
+ if (project.AssemblyName != null)
+ projectAssemblyName = project.AssemblyName;
+
+ if (File.Exists(Path.Combine(project.FullPath, projectAssemblyName) + ".dll.config"))
+ {
+ hasAssemblyConfig = true;
+ System.IO.File.Copy(Path.Combine(project.FullPath, projectAssemblyName + ".dll.config"), Path.Combine(projectDir, projectAssemblyName + ".dll.config"), true);
+ extraDistFiles.Add(project.AssemblyName + ".dll.config");
+ }
+
+ foreach (ConfigurationNode conf in project.Configurations)
+ {
+ if (conf.Options.KeyFile != string.Empty)
+ {
+ // Copy snk file into the project's directory
+ // Use the snk from the project directory directly
+ string source = Path.Combine(project.FullPath, conf.Options.KeyFile);
+ string keyFile = conf.Options.KeyFile;
+ Regex re = new Regex(".*/");
+ keyFile = re.Replace(keyFile, "");
+
+ string dest = Path.Combine(projectDir, keyFile);
+ // Tell the user if there's a problem copying the file
+ try
+ {
+ mkdirDashP(System.IO.Path.GetDirectoryName(dest));
+ System.IO.File.Copy(source, dest, true);
+ }
+ catch (System.IO.IOException e)
+ {
+ Console.WriteLine(e.Message);
+ }
+ }
+ }
+
+ // Copy compiled, embedded and content files into the project's directory
+ foreach (string filename in project.Files)
+ {
+ string source = Path.Combine(project.FullPath, filename);
+ string dest = Path.Combine(projectDir, filename);
+
+ if (filename.Contains("AssemblyInfo.cs"))
+ {
+ // If we've got an AssemblyInfo.cs, pull the version number from it
+ string[] sources = { source };
+ string[] args = { "" };
+ Microsoft.CSharp.CSharpCodeProvider cscp =
+ new Microsoft.CSharp.CSharpCodeProvider();
+
+ string tempAssemblyFile = Path.Combine(Path.GetTempPath(), project.Name + "-temp.dll");
+ System.CodeDom.Compiler.CompilerParameters cparam =
+ new System.CodeDom.Compiler.CompilerParameters(args, tempAssemblyFile);
+
+ System.CodeDom.Compiler.CompilerResults cr =
+ cscp.CompileAssemblyFromFile(cparam, sources);
+
+ foreach (System.CodeDom.Compiler.CompilerError error in cr.Errors)
+ Console.WriteLine("Error! '{0}'", error.ErrorText);
+
+ try {
+ string projectFullName = cr.CompiledAssembly.FullName;
+ Regex verRegex = new Regex("Version=([\\d\\.]+)");
+ Match verMatch = verRegex.Match(projectFullName);
+ if (verMatch.Success)
+ projectVersion = verMatch.Groups[1].Value;
+ }catch{
+ Console.WriteLine("Couldn't compile AssemblyInfo.cs");
+ }
+
+ // Clean up the temp file
+ try
+ {
+ if (File.Exists(tempAssemblyFile))
+ File.Delete(tempAssemblyFile);
+ }
+ catch
+ {
+ Console.WriteLine("Error! '{0}'", e);
+ }
+
+ }
+
+ // Tell the user if there's a problem copying the file
+ try
+ {
+ mkdirDashP(System.IO.Path.GetDirectoryName(dest));
+ System.IO.File.Copy(source, dest, true);
+ }
+ catch (System.IO.IOException e)
+ {
+ Console.WriteLine(e.Message);
+ }
+
+ switch (project.Files.GetBuildAction(filename))
+ {
+ case BuildAction.Compile:
+ compiledFiles.Add(filename);
+ break;
+ case BuildAction.Content:
+ contentFiles.Add(filename);
+ extraDistFiles.Add(filename);
+ break;
+ case BuildAction.EmbeddedResource:
+ embeddedFiles.Add(filename);
+ break;
+ }
+ }
+
+ // Set up references
+ for (int refNum = 0; refNum < project.References.Count; refNum++)
+ {
+ ReferenceNode refr = project.References[refNum];
+ Assembly refAssembly = Assembly.LoadWithPartialName(refr.Name);
+
+ /* Determine which pkg-config (.pc) file refers to
+ this assembly */
+
+ SystemPackage package = null;
+
+ if (packagesHash.ContainsKey(refr.Name))
+ {
+ package = packagesHash[refr.Name];
+
+ }
+ else
+ {
+ string assemblyFullName = string.Empty;
+ if (refAssembly != null)
+ assemblyFullName = refAssembly.FullName;
+
+ string assemblyFileName = string.Empty;
+ if (assemblyFullName != string.Empty &&
+ assemblyFullNameToPath.ContainsKey(assemblyFullName)
+ )
+ assemblyFileName =
+ assemblyFullNameToPath[assemblyFullName];
+
+ if (assemblyFileName != string.Empty &&
+ assemblyPathToPackage.ContainsKey(assemblyFileName)
+ )
+ package = assemblyPathToPackage[assemblyFileName];
+
+ }
+
+ /* If we know the .pc file and it is not "mono"
+ (already in the path), add a -pkg: argument */
+
+ if (package != null &&
+ package.Name != "mono" &&
+ !pkgLibs.Contains(package.Name)
+ )
+ pkgLibs.Add(package.Name);
+
+ string fileRef =
+ FindFileReference(refr.Name, (ProjectNode)refr.Parent);
+
+ if (refr.LocalCopy ||
+ solution.ProjectsTable.ContainsKey(refr.Name) ||
+ fileRef != null ||
+ refr.Path != null
+ )
+ {
+
+ /* Attempt to copy the referenced lib to the
+ project's directory */
+
+ string filename = refr.Name + ".dll";
+ string source = filename;
+ if (refr.Path != null)
+ source = Path.Combine(refr.Path, source);
+ source = Path.Combine(project.FullPath, source);
+ string dest = Path.Combine(projectDir, filename);
+
+ /* Since we depend on this binary dll to build, we
+ * will add a compile- time dependency on the
+ * copied dll, and add the dll to the list of
+ * files distributed with this package
+ */
+
+ binaryLibs.Add(refr.Name + ".dll");
+ extraDistFiles.Add(refr.Name + ".dll");
+
+ // TODO: Support copying .config.osx files
+ // TODO: Support for determining native dependencies
+ if (File.Exists(source + ".config"))
+ {
+ System.IO.File.Copy(source + ".config", Path.GetDirectoryName(dest), true);
+ extraDistFiles.Add(refr.Name + ".dll.config");
+ }
+
+ try
+ {
+ System.IO.File.Copy(source, dest, true);
+ }
+ catch (System.IO.IOException)
+ {
+ if (solution.ProjectsTable.ContainsKey(refr.Name)){
+
+ /* If an assembly is referenced, marked for
+ * local copy, in the list of projects for
+ * this solution, but does not exist, put a
+ * target into the Makefile.am to build the
+ * assembly and copy it to this project's
+ * directory
+ */
+
+ ProjectNode sourcePrj =
+ ((solution.ProjectsTable[refr.Name]));
+
+ string target =
+ String.Format("{0}:\n" +
+ "\t$(MAKE) -C ../{1}\n" +
+ "\tln ../{2}/$@ $@\n",
+ filename,
+ sourcePrj.Name,
+ sourcePrj.Name );
+
+ localCopyTargets.Add(target);
+ }
+ }
+ }
+ else if( !pkgLibs.Contains(refr.Name) )
+ {
+ // Else, let's assume it's in the GAC or the lib path
+ string assemName = string.Empty;
+ int index = refr.Name.IndexOf(",");
+
+ if (index > 0)
+ assemName = refr.Name.Substring(0, index);
+ else
+ assemName = refr.Name;
+
+ m_Kernel.Log.Write(String.Format(
+ "Warning: Couldn't find an appropriate assembly " +
+ "for reference:\n'{0}'", refr.Name
+ ));
+ systemLibs.Add(assemName);
+ }
+ }
+
+ const string lineSep = " \\\n\t";
+ string compiledFilesString = string.Empty;
+ if (compiledFiles.Count > 0)
+ compiledFilesString =
+ lineSep + string.Join(lineSep, compiledFiles.ToArray());
+
+ string embeddedFilesString = "";
+ if (embeddedFiles.Count > 0)
+ embeddedFilesString =
+ lineSep + string.Join(lineSep, embeddedFiles.ToArray());
+
+ string contentFilesString = "";
+ if (contentFiles.Count > 0)
+ contentFilesString =
+ lineSep + string.Join(lineSep, contentFiles.ToArray());
+
+ string extraDistFilesString = "";
+ if (extraDistFiles.Count > 0)
+ extraDistFilesString =
+ lineSep + string.Join(lineSep, extraDistFiles.ToArray());
+
+ string pkgLibsString = "";
+ if (pkgLibs.Count > 0)
+ pkgLibsString =
+ lineSep + string.Join(lineSep, pkgLibs.ToArray());
+
+ string binaryLibsString = "";
+ if (binaryLibs.Count > 0)
+ binaryLibsString =
+ lineSep + string.Join(lineSep, binaryLibs.ToArray());
+
+ string systemLibsString = "";
+ if (systemLibs.Count > 0)
+ systemLibsString =
+ lineSep + string.Join(lineSep, systemLibs.ToArray());
+
+ string localCopyTargetsString = "";
+ if (localCopyTargets.Count > 0)
+ localCopyTargetsString =
+ string.Join("\n", localCopyTargets.ToArray());
+
+ string monoPath = "";
+ foreach (string runtimeLib in runtimeLibs)
+ {
+ monoPath += ":`pkg-config --variable=libdir " + runtimeLib + "`";
+ }
+
+ // Add the project name to the list of transformation
+ // parameters
+ XsltArgumentList argList = new XsltArgumentList();
+ argList.AddParam("projectName", "", project.Name);
+ argList.AddParam("solutionName", "", solution.Name);
+ argList.AddParam("assemblyName", "", projectAssemblyName);
+ argList.AddParam("compiledFiles", "", compiledFilesString);
+ argList.AddParam("embeddedFiles", "", embeddedFilesString);
+ argList.AddParam("contentFiles", "", contentFilesString);
+ argList.AddParam("extraDistFiles", "", extraDistFilesString);
+ argList.AddParam("pkgLibs", "", pkgLibsString);
+ argList.AddParam("binaryLibs", "", binaryLibsString);
+ argList.AddParam("systemLibs", "", systemLibsString);
+ argList.AddParam("monoPath", "", monoPath);
+ argList.AddParam("localCopyTargets", "", localCopyTargetsString);
+ argList.AddParam("projectVersion", "", projectVersion);
+ argList.AddParam("hasAssemblyConfig", "", hasAssemblyConfig ? "true" : "");
+
+ // Transform the templates
+ transformToFile(Path.Combine(projectDir, "configure.ac"), argList, "/Autotools/ProjectConfigureAc");
+ transformToFile(Path.Combine(projectDir, "Makefile.am"), argList, "/Autotools/ProjectMakefileAm");
+ transformToFile(Path.Combine(projectDir, "autogen.sh"), argList, "/Autotools/ProjectAutogenSh");
+
+ if (project.Type == Core.Nodes.ProjectType.Library)
+ transformToFile(Path.Combine(projectDir, project.Name + ".pc.in"), argList, "/Autotools/ProjectPcIn");
+ if (project.Type == Core.Nodes.ProjectType.Exe || project.Type == Core.Nodes.ProjectType.WinExe)
+ transformToFile(Path.Combine(projectDir, project.Name.ToLower() + ".in"), argList, "/Autotools/ProjectWrapperScriptIn");
+ }
+
+ private void CleanProject(ProjectNode project)
+ {
+ m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
+ string projectFile = Helper.MakeFilePath(project.FullPath, "Include", "am");
+ Helper.DeleteIfExists(projectFile);
+ }
+
+ private void CleanSolution(SolutionNode solution)
+ {
+ m_Kernel.Log.Write("Cleaning Autotools make files for", solution.Name);
+
+ string slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am");
+ Helper.DeleteIfExists(slnFile);
+
+ slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "in");
+ Helper.DeleteIfExists(slnFile);
+
+ slnFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac");
+ Helper.DeleteIfExists(slnFile);
+
+ slnFile = Helper.MakeFilePath(solution.FullPath, "configure");
+ Helper.DeleteIfExists(slnFile);
+
+ slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile");
+ Helper.DeleteIfExists(slnFile);
+
+ foreach (ProjectNode project in solution.Projects)
+ {
+ CleanProject(project);
+ }
+
+ m_Kernel.Log.Write("");
+ }
+
+ #endregion
+
+ #region ITarget Members
+
+ ///
+ /// Writes the specified kern.
+ ///
+ /// The kern.
+ public void Write(Kernel kern)
+ {
+ if (kern == null)
+ {
+ throw new ArgumentNullException("kern");
+ }
+ m_Kernel = kern;
+ m_Kernel.Log.Write("Parsing system pkg-config files");
+ RunInitialization();
+
+ const string streamName = "autotools.xml";
+ string fqStreamName = String.Format("Prebuild.data.{0}",
+ streamName
+ );
+
+ // Retrieve stream for the autotools template XML
+ Stream autotoolsStream = Assembly.GetExecutingAssembly()
+ .GetManifestResourceStream(fqStreamName);
+
+ if(autotoolsStream == null) {
+
+ /*
+ * try without the default namespace prepended, in
+ * case prebuild.exe assembly was compiled with
+ * something other than Visual Studio .NET
+ */
+
+ autotoolsStream = Assembly.GetExecutingAssembly()
+ .GetManifestResourceStream(streamName);
+ if(autotoolsStream == null){
+ string errStr =
+ String.Format("Could not find embedded resource file:\n" +
+ "'{0}' or '{1}'",
+ streamName, fqStreamName
+ );
+
+ m_Kernel.Log.Write(errStr);
+
+ throw new System.Reflection.TargetException(errStr);
+ }
+ }
+
+ // Create an XML URL Resolver with default credentials
+ xr = new System.Xml.XmlUrlResolver();
+ xr.Credentials = CredentialCache.DefaultCredentials;
+
+ // Create a default evidence - no need to limit access
+ e = new System.Security.Policy.Evidence();
+
+ // Load the autotools XML
+ autotoolsDoc = new XmlDocument();
+ autotoolsDoc.Load(autotoolsStream);
+
+ /* rootDir is the filesystem location where the Autotools
+ * build tree will be created - for now we'll make it
+ * $PWD/autotools
+ */
+
+ string pwd = Directory.GetCurrentDirectory();
+ //string pwd = System.Environment.GetEnvironmentVariable("PWD");
+ //if (pwd.Length != 0)
+ //{
+ string rootDir = Path.Combine(pwd, "autotools");
+ //}
+ //else
+ //{
+ // pwd = Assembly.GetExecutingAssembly()
+ //}
+ chkMkDir(rootDir);
+
+ foreach (SolutionNode solution in kern.Solutions)
+ {
+ m_Kernel.Log.Write(String.Format("Writing solution: {0}",
+ solution.Name));
+ WriteCombine(solution);
+ }
+ m_Kernel = null;
+ }
+
+ ///
+ /// Cleans the specified kern.
+ ///
+ /// The kern.
+ public virtual void Clean(Kernel kern)
+ {
+ if (kern == null)
+ {
+ throw new ArgumentNullException("kern");
+ }
+ m_Kernel = kern;
+ foreach (SolutionNode sol in kern.Solutions)
+ {
+ CleanSolution(sol);
+ }
+ m_Kernel = null;
+ }
+
+ ///
+ /// Gets the name.
+ ///
+ /// The name.
+ public string Name
+ {
+ get
+ {
+ return "autotools";
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Core/Targets/DebugTarget.cs b/Prebuild/src/Core/Targets/DebugTarget.cs
index 650007e..d78064f 100644
--- a/Prebuild/src/Core/Targets/DebugTarget.cs
+++ b/Prebuild/src/Core/Targets/DebugTarget.cs
@@ -27,7 +27,7 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
/*
* $Source$
* $Author: jendave $
- * $Date: 2006-09-20 08:42:51 +0100 (Wed, 20 Sep 2006) $
+ * $Date: 2006-09-20 03:42:51 -0400 (Wed, 20 Sep 2006) $
* $Revision: 164 $
*/
#endregion
diff --git a/Prebuild/src/Core/Targets/VS2010Target.cs b/Prebuild/src/Core/Targets/VS2010Target.cs
index b16120c..ea9f736 100644
--- a/Prebuild/src/Core/Targets/VS2010Target.cs
+++ b/Prebuild/src/Core/Targets/VS2010Target.cs
@@ -1,138 +1,138 @@
-using System;
-using System.IO;
-using System.Text;
-
-using Prebuild.Core.Attributes;
-using Prebuild.Core.Interfaces;
-using Prebuild.Core.Nodes;
-using Prebuild.Core.Utilities;
-using System.CodeDom.Compiler;
-
-namespace Prebuild.Core.Targets
-{
-
- ///
- ///
- ///
- [Target("vs2010")]
- public class VS2010Target : VSGenericTarget
- {
- #region Fields
-
- string solutionVersion = "11.00";
- string productVersion = "9.0.30729";
- string schemaVersion = "2.0";
- string versionName = "Visual Studio 2010";
- string name = "vs2010";
- VSVersion version = VSVersion.VS10;
-
- #endregion
-
- #region Properties
-
- ///
- /// Gets or sets the solution version.
- ///
- /// The solution version.
- public override string SolutionVersion
- {
- get
- {
- return solutionVersion;
- }
- }
-
- ///
- /// Gets or sets the product version.
- ///
- /// The product version.
- public override string ProductVersion
- {
- get
- {
- return productVersion;
- }
- }
-
- ///
- /// Gets or sets the schema version.
- ///
- /// The schema version.
- public override string SchemaVersion
- {
- get
- {
- return schemaVersion;
- }
- }
-
- ///
- /// Gets or sets the name of the version.
- ///
- /// The name of the version.
- public override string VersionName
- {
- get
- {
- return versionName;
- }
- }
-
- ///
- /// Gets or sets the version.
- ///
- /// The version.
- public override VSVersion Version
- {
- get
- {
- return version;
- }
- }
-
- ///
- /// Gets the name.
- ///
- /// The name.
- public override string Name
- {
- get
- {
- return name;
- }
- }
-
- protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
- {
- switch (frameworkVersion)
- {
- case FrameworkVersion.v4_0:
- case FrameworkVersion.v3_5:
- return "ToolsVersion=\"4.0\"";
- case FrameworkVersion.v3_0:
- return "ToolsVersion=\"3.0\"";
- default:
- return "ToolsVersion=\"2.0\"";
- }
- }
-
- public override string SolutionTag
- {
- get { return "# Visual Studio 2010"; }
- }
-
- #endregion
-
- #region Constructors
-
- ///
- /// Initializes a new instance of the class.
- ///
- public VS2010Target()
- : base()
- {
- }
-
- #endregion
- }
-}
+using System;
+using System.IO;
+using System.Text;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Nodes;
+using Prebuild.Core.Utilities;
+using System.CodeDom.Compiler;
+
+namespace Prebuild.Core.Targets
+{
+
+ ///
+ ///
+ ///
+ [Target("vs2010")]
+ public class VS2010Target : VSGenericTarget
+ {
+ #region Fields
+
+ string solutionVersion = "11.00";
+ string productVersion = "9.0.30729";
+ string schemaVersion = "2.0";
+ string versionName = "Visual Studio 2010";
+ string name = "vs2010";
+ VSVersion version = VSVersion.VS10;
+
+ #endregion
+
+ #region Properties
+
+ ///
+ /// Gets or sets the solution version.
+ ///
+ /// The solution version.
+ public override string SolutionVersion
+ {
+ get
+ {
+ return solutionVersion;
+ }
+ }
+
+ ///
+ /// Gets or sets the product version.
+ ///
+ /// The product version.
+ public override string ProductVersion
+ {
+ get
+ {
+ return productVersion;
+ }
+ }
+
+ ///
+ /// Gets or sets the schema version.
+ ///
+ /// The schema version.
+ public override string SchemaVersion
+ {
+ get
+ {
+ return schemaVersion;
+ }
+ }
+
+ ///
+ /// Gets or sets the name of the version.
+ ///
+ /// The name of the version.
+ public override string VersionName
+ {
+ get
+ {
+ return versionName;
+ }
+ }
+
+ ///
+ /// Gets or sets the version.
+ ///
+ /// The version.
+ public override VSVersion Version
+ {
+ get
+ {
+ return version;
+ }
+ }
+
+ ///
+ /// Gets the name.
+ ///
+ /// The name.
+ public override string Name
+ {
+ get
+ {
+ return name;
+ }
+ }
+
+ protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
+ {
+ switch (frameworkVersion)
+ {
+ case FrameworkVersion.v4_0:
+ case FrameworkVersion.v3_5:
+ return "ToolsVersion=\"4.0\"";
+ case FrameworkVersion.v3_0:
+ return "ToolsVersion=\"3.0\"";
+ default:
+ return "ToolsVersion=\"2.0\"";
+ }
+ }
+
+ public override string SolutionTag
+ {
+ get { return "# Visual Studio 2010"; }
+ }
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public VS2010Target()
+ : base()
+ {
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Core/Targets/VSGenericTarget.cs b/Prebuild/src/Core/Targets/VSGenericTarget.cs
index cd3f5bb..af61704 100644
--- a/Prebuild/src/Core/Targets/VSGenericTarget.cs
+++ b/Prebuild/src/Core/Targets/VSGenericTarget.cs
@@ -1,922 +1,972 @@
-#region BSD License
-/*
-Copyright (c) 2008 Matthew Holmes (matthew@wildfiregames.com), John Anderson (sontek@gmail.com)
-
-Redistribution and use in source and binary forms, with or without modification, are permitted
-provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions
- and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
- and the following disclaimer in the documentation and/or other materials provided with the
- distribution.
- * The name of the author may not be used to endorse or promote products derived from this software
- without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
-BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using Prebuild.Core.Interfaces;
-using Prebuild.Core.Nodes;
-using Prebuild.Core.Utilities;
-using System.CodeDom.Compiler;
-
-namespace Prebuild.Core.Targets
-{
-
- ///
- ///
- ///
- public abstract class VSGenericTarget : ITarget
- {
- #region Fields
-
- readonly Dictionary tools = new Dictionary();
- Kernel kernel;
- #endregion
-
- #region Properties
- ///
- /// Gets or sets the solution version.
- ///
- /// The solution version.
- public abstract string SolutionVersion { get; }
- ///
- /// Gets or sets the product version.
- ///
- /// The product version.
- public abstract string ProductVersion { get; }
- ///
- /// Gets or sets the schema version.
- ///
- /// The schema version.
- public abstract string SchemaVersion { get; }
- ///
- /// Gets or sets the name of the version.
- ///
- /// The name of the version.
- public abstract string VersionName { get; }
- ///
- /// Gets or sets the version.
- ///
- /// The version.
- public abstract VSVersion Version { get; }
- ///
- /// Gets the name.
- ///
- /// The name.
- public abstract string Name { get; }
-
- protected abstract string GetToolsVersionXml(FrameworkVersion version);
- public abstract string SolutionTag { get; }
-
- #endregion
-
- #region Constructors
-
- ///
- /// Initializes a new instance of the class.
- ///
- protected VSGenericTarget()
- {
- tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets");
- tools["Database"] = new ToolInfo("Database", "{4F174C21-8C12-11D0-8340-0000F80270F8}", "dbp", "UNKNOWN");
- tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets");
- tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets");
- tools["Folder"] = new ToolInfo("Folder", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", null, null);
- }
-
- #endregion
-
- #region Private Methods
-
- private string MakeRefPath(ProjectNode project)
- {
- string ret = "";
- foreach (ReferencePathNode node in project.ReferencePaths)
- {
- try
- {
- string fullPath = Helper.ResolvePath(node.Path);
- if (ret.Length < 1)
- {
- ret = fullPath;
- }
- else
- {
- ret += ";" + fullPath;
- }
- }
- catch (ArgumentException)
- {
- kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path);
- }
- }
-
- return ret;
- }
-
- private static ProjectNode FindProjectInSolution(string name, SolutionNode solution)
- {
- SolutionNode node = solution;
-
- while (node.Parent is SolutionNode)
- node = node.Parent as SolutionNode;
-
- return FindProjectInSolutionRecursively(name, node);
- }
-
- private static ProjectNode FindProjectInSolutionRecursively(string name, SolutionNode solution)
- {
- if (solution.ProjectsTable.ContainsKey(name))
- return solution.ProjectsTable[name];
-
- foreach (SolutionNode child in solution.Solutions)
- {
- ProjectNode node = FindProjectInSolutionRecursively(name, child);
- if (node != null)
- return node;
- }
-
- return null;
- }
-
- private void WriteProject(SolutionNode solution, ProjectNode project)
- {
- if (!tools.ContainsKey(project.Language))
- {
- throw new UnknownLanguageException("Unknown .NET language: " + project.Language);
- }
-
- ToolInfo toolInfo = tools[project.Language];
- string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
- StreamWriter ps = new StreamWriter(projectFile);
-
- kernel.CurrentWorkingDirectory.Push();
- Helper.SetCurrentDir(Path.GetDirectoryName(projectFile));
-
- #region Project File
- using (ps)
- {
- ps.WriteLine("", GetToolsVersionXml(project.FrameworkVersion));
- ps.WriteLine(" ");
- ps.WriteLine(" Local ");
- ps.WriteLine(" {0} ", ProductVersion);
- ps.WriteLine(" {0} ", SchemaVersion);
- ps.WriteLine(" {{{0}}} ", project.Guid.ToString().ToUpper());
-
- // Visual Studio has a hard coded guid for the project type
- if (project.Type == ProjectType.Web)
- ps.WriteLine(" {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} ");
- ps.WriteLine(" Debug ");
- ps.WriteLine(" {0} ", project.AppIcon);
- ps.WriteLine(" ");
- ps.WriteLine(" ");
- ps.WriteLine(" {0} ", project.AssemblyName);
- foreach (ConfigurationNode conf in project.Configurations)
- {
- if (conf.Options.KeyFile != "")
- {
- ps.WriteLine(" {0} ", conf.Options.KeyFile);
- ps.WriteLine(" true ");
- break;
- }
- }
- ps.WriteLine(" JScript ");
- ps.WriteLine(" Grid ");
- ps.WriteLine(" IE50 ");
- ps.WriteLine(" false ");
- ps.WriteLine(" {0} ", project.FrameworkVersion.ToString().Replace("_", "."));
-
- ps.WriteLine(" {0} ", project.Type == ProjectType.Web ? ProjectType.Library.ToString() : project.Type.ToString());
- ps.WriteLine(" {0} ", project.DesignerFolder);
- ps.WriteLine(" {0} ", project.RootNamespace);
- ps.WriteLine(" {0} ", project.StartupObject);
- if (string.IsNullOrEmpty(project.DebugStartParameters))
- {
- ps.WriteLine(" {0} ", project.DebugStartParameters);
- }
- ps.WriteLine(" ");
- ps.WriteLine(" ");
-
- ps.WriteLine(" ");
-
- foreach (ConfigurationNode conf in project.Configurations)
- {
- ps.Write(" ", conf.Name, conf.Platform);
- ps.WriteLine(" {0} ", conf.Options["AllowUnsafe"]);
- ps.WriteLine(" {0} ", conf.Options["BaseAddress"]);
- ps.WriteLine(" {0} ", conf.Options["CheckUnderflowOverflow"]);
- ps.WriteLine(" ");
- ps.WriteLine(" ");
- ps.WriteLine(" {0} ", conf.Options["CompilerDefines"]);
- ps.WriteLine(" {0} ", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString()));
- ps.WriteLine(" {0} ", conf.Options["DebugInformation"]);
- ps.WriteLine(" {0} ", conf.Options["FileAlignment"]);
- ps.WriteLine(" {0} ", conf.Options["OptimizeCode"]);
- if (project.Type != ProjectType.Web)
- ps.WriteLine(" {0} ",
- Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString())));
- else
- ps.WriteLine(" {0} ",
- Helper.EndPath(Helper.NormalizePath("bin\\")));
-
- ps.WriteLine(" {0} ", conf.Options["RegisterComInterop"]);
- ps.WriteLine(" {0} ", conf.Options["RemoveIntegerChecks"]);
- ps.WriteLine(" {0} ", conf.Options["WarningsAsErrors"]);
- ps.WriteLine(" {0} ", conf.Options["WarningLevel"]);
- ps.WriteLine(" {0} ", conf.Options["NoStdLib"]);
- ps.WriteLine(" {0} ", conf.Options["SuppressWarnings"]);
- ps.WriteLine(" {0} ", conf.Platform);
- ps.WriteLine(" ");
- }
-
- //ps.WriteLine(" ");
-
- Dictionary projectReferences = new Dictionary();
- List otherReferences = new List();
-
- foreach (ReferenceNode refr in project.References)
- {
- ProjectNode projectNode = FindProjectInSolution(refr.Name, solution);
-
- if (projectNode == null)
- otherReferences.Add(refr);
- else
- projectReferences.Add(refr, projectNode);
- }
- // Assembly References
- ps.WriteLine(" ");
-
- foreach (ReferenceNode refr in otherReferences)
- {
- ps.Write(" ");
- ps.Write(" ");
- ps.Write(refr.Name);
- ps.WriteLine(" ");
-
- if(!String.IsNullOrEmpty(refr.Path))
- {
- // Use absolute path to assembly (for determining assembly type)
- string absolutePath = Path.Combine(project.FullPath, refr.Path);
- if(File.Exists(Helper.MakeFilePath(absolutePath, refr.Name, "exe"))) {
- // Assembly is an executable (exe)
- ps.WriteLine(" {0} ", Helper.MakeFilePath(refr.Path, refr.Name, "exe"));
- } else if(File.Exists(Helper.MakeFilePath(absolutePath, refr.Name, "dll"))) {
- // Assembly is an library (dll)
- ps.WriteLine(" {0} ", Helper.MakeFilePath(refr.Path, refr.Name, "dll"));
- } else {
- string referencePath = Helper.MakeFilePath(refr.Path, refr.Name, "dll");
- kernel.Log.Write(LogType.Warning, "Reference \"{0}\": The specified file doesn't exist.", referencePath);
- ps.WriteLine(" {0} ", Helper.MakeFilePath(refr.Path, refr.Name, "dll"));
- }
- }
-
- ps.WriteLine(" {0} ", refr.LocalCopy);
- ps.WriteLine(" ");
- }
- ps.WriteLine(" ");
-
- //Project References
- ps.WriteLine(" ");
- foreach (KeyValuePair pair in projectReferences)
- {
- ToolInfo tool = tools[pair.Value.Language];
- if (tools == null)
- throw new UnknownLanguageException();
-
- string path =
- Helper.MakePathRelativeTo(project.FullPath,
- Helper.MakeFilePath(pair.Value.FullPath, pair.Value.Name, tool.FileExtension));
- ps.WriteLine(" ", path);
-
- // TODO: Allow reference to visual basic projects
- ps.WriteLine(" {0} ", pair.Value.Name);
- ps.WriteLine(" {0} ", pair.Value.Guid.ToString("B").ToUpper());
- ps.WriteLine(" {0} ", tool.Guid.ToUpper());
-
- //This is the Copy Local flag in VS
- ps.WriteLine(" {0} ", pair.Key.LocalCopy);
-
- ps.WriteLine(" ");
- }
- ps.WriteLine(" ");
-
- // ps.WriteLine(" ");
- ps.WriteLine(" ");
-
- // ps.WriteLine(" ");
- List list = new List();
-
- foreach (string path in project.Files)
- {
- string lower = path.ToLower();
- if (lower.EndsWith(".resx"))
- {
- string codebehind = String.Format("{0}.Designer{1}", path.Substring(0, path.LastIndexOf('.')), toolInfo.LanguageExtension);
- if (!list.Contains(codebehind))
- list.Add(codebehind);
- }
-
- }
-
- foreach (string filePath in project.Files)
- {
- // if (file == "Properties\\Bind.Designer.cs")
- // {
- // Console.WriteLine("Wait a minute!");
- // Console.WriteLine(project.Files.GetSubType(file).ToString());
- // }
- SubType subType = project.Files.GetSubType(filePath);
-
- // Visual Studio chokes on file names if forward slash is used as a path separator
- // instead of backslash. So we must make sure that all file paths written to the
- // project file use \ as a path separator.
- string file = filePath.Replace(@"/", @"\");
-
- if (subType != SubType.Code && subType != SubType.Settings && subType != SubType.Designer
- && subType != SubType.CodeBehind)
- {
- ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx");
- ps.WriteLine(" {0} ", Path.GetFileName(file));
- ps.WriteLine(" Designer ");
- ps.WriteLine(" ");
- //
- }
-
- if (subType == SubType.Designer)
- {
- ps.WriteLine(" ", file);
-
- string autogen_name = file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs";
- string dependent_name = filePath.Substring(0, file.LastIndexOf('.')) + ".cs";
-
- // Check for a parent .cs file with the same name as this designer file
- if (File.Exists(Helper.NormalizePath(dependent_name)))
- {
- ps.WriteLine(" {0} ", Path.GetFileName(dependent_name));
- }
- else
- {
- ps.WriteLine(" ResXFileCodeGenerator ");
- ps.WriteLine(" {0} ", Path.GetFileName(autogen_name));
- ps.WriteLine(" " + subType + " ");
- }
-
- ps.WriteLine(" ");
- if (File.Exists(Helper.NormalizePath(autogen_name)))
- {
- ps.WriteLine(" ", autogen_name);
- //ps.WriteLine(" True ");
-
- // If a parent .cs file exists, link this autogen file to it. Otherwise link
- // to the designer file
- if (File.Exists(dependent_name))
- {
- ps.WriteLine(" {0} ", Path.GetFileName(dependent_name));
- }
- else
- {
- ps.WriteLine(" True ");
- ps.WriteLine(" {0} ", Path.GetFileName(filePath));
- }
-
- ps.WriteLine(" ");
- }
- list.Add(autogen_name);
- }
- if (subType == SubType.Settings)
- {
- ps.Write(" <{0} ", project.Files.GetBuildAction(filePath));
- ps.WriteLine("Include=\"{0}\">", file);
- string fileName = Path.GetFileName(filePath);
- if (project.Files.GetBuildAction(filePath) == BuildAction.None)
- {
- ps.WriteLine(" SettingsSingleFileGenerator ");
- ps.WriteLine(" {0} ", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs");
- }
- else
- {
- ps.WriteLine(" Code ");
- ps.WriteLine(" True ");
- ps.WriteLine(" True ");
- string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.'));
- string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.'));
- ps.WriteLine(" {0} ", Path.GetFileName(fileNameShorter + ".settings"));
- }
- ps.WriteLine(" {0}>", project.Files.GetBuildAction(filePath));
- }
- else if (subType != SubType.Designer)
- {
- string path = Helper.NormalizePath(file);
- string path_lower = path.ToLower();
-
- if (!list.Contains(filePath))
- {
- ps.Write(" <{0} ", project.Files.GetBuildAction(filePath));
-
- int startPos = 0;
- if (project.Files.GetPreservePath(filePath))
- {
- while ((@"./\").IndexOf(file.Substring(startPos, 1)) != -1)
- startPos++;
-
- }
- else
- {
- startPos = file.LastIndexOf(Path.GetFileName(path));
- }
-
- // be sure to write out the path with backslashes so VS recognizes
- // the file properly.
- ps.WriteLine("Include=\"{0}\">", file);
-
- int last_period_index = file.LastIndexOf('.');
- string short_file_name = file.Substring(0, last_period_index);
- string extension = Path.GetExtension(path);
- // make this upper case, so that when File.Exists tests for the
- // existence of a designer file on a case-sensitive platform,
- // it is correctly identified.
- string designer_format = string.Format(".Designer{0}", extension);
-
- if (path_lower.EndsWith(designer_format.ToLowerInvariant()))
- {
- int designer_index = path.IndexOf(designer_format);
- string file_name = path.Substring(0, designer_index);
-
- // There are two corrections to the next lines:
- // 1. Fix the connection between a designer file and a form
- // or usercontrol that don't have an associated resx file.
- // 2. Connect settings files to associated designer files.
- if (File.Exists(file_name + extension))
- ps.WriteLine(" {0} ", Path.GetFileName(file_name + extension));
- else if (File.Exists(file_name + ".resx"))
- ps.WriteLine(" {0} ", Path.GetFileName(file_name + ".resx"));
- else if (File.Exists(file_name + ".settings"))
- {
- ps.WriteLine(" {0} ", Path.GetFileName(file_name + ".settings"));
- ps.WriteLine(" True ");
- ps.WriteLine(" True ");
- }
- }
- else if (subType == SubType.CodeBehind)
- {
- ps.WriteLine(" {0} ", Path.GetFileName(short_file_name));
- }
- if (project.Files.GetIsLink(filePath))
- {
- string alias = project.Files.GetLinkPath(filePath);
- alias += file.Substring(startPos);
- alias = Helper.NormalizePath(alias);
- ps.WriteLine(" {0}", alias);
- }
- else if (project.Files.GetBuildAction(filePath) != BuildAction.None)
- {
- if (project.Files.GetBuildAction(filePath) != BuildAction.EmbeddedResource)
- {
- ps.WriteLine(" {0} ", subType);
- }
- }
-
- if (project.Files.GetCopyToOutput(filePath) != CopyToOutput.Never)
- {
- ps.WriteLine(" {0} ", project.Files.GetCopyToOutput(filePath));
- }
-
- ps.WriteLine(" {0}>", project.Files.GetBuildAction(filePath));
- }
- }
- }
-
- ps.WriteLine(" ");
- ps.WriteLine(" ");
- ps.WriteLine(" ");
- ps.WriteLine(" ");
- ps.WriteLine(" ");
- ps.WriteLine(" ");
- ps.WriteLine(" ");
- ps.WriteLine(" ");
- ps.WriteLine(" ");
- }
- #endregion
-
- #region User File
-
- ps = new StreamWriter(projectFile + ".user");
- using (ps)
- {
- // Get the first configuration from the project.
- ConfigurationNode firstConfiguration = null;
-
- if (project.Configurations.Count > 0)
- {
- firstConfiguration = project.Configurations[0];
- }
-
- ps.WriteLine("");
- //ps.WriteLine( "" );
- //ps.WriteLine(" <{0}>", toolInfo.XMLTag);
- //ps.WriteLine(" ");
- ps.WriteLine(" ");
- //ps.WriteLine(" ", MakeRefPath(project));
-
- if (firstConfiguration != null)
- {
- ps.WriteLine(" {0} ", firstConfiguration.Name);
- ps.WriteLine(" {0} ", firstConfiguration.Platform);
- }
-
- ps.WriteLine(" {0} ", MakeRefPath(project));
- ps.WriteLine(" {0} ", ProductVersion);
- ps.WriteLine(" ProjectFiles ");
- ps.WriteLine(" 0 ");
- ps.WriteLine(" ");
- foreach (ConfigurationNode conf in project.Configurations)
- {
- ps.Write(" ");
- }
- ps.WriteLine(" ");
- }
- #endregion
-
- kernel.CurrentWorkingDirectory.Pop();
- }
-
- private void WriteSolution(SolutionNode solution, bool writeSolutionToDisk)
- {
- kernel.Log.Write("Creating {0} solution and project files", VersionName);
-
- foreach (SolutionNode child in solution.Solutions)
- {
- kernel.Log.Write("...Creating folder: {0}", child.Name);
- WriteSolution(child, false);
- }
-
- foreach (ProjectNode project in solution.Projects)
- {
- kernel.Log.Write("...Creating project: {0}", project.Name);
- WriteProject(solution, project);
- }
-
- foreach (DatabaseProjectNode project in solution.DatabaseProjects)
- {
- kernel.Log.Write("...Creating database project: {0}", project.Name);
- WriteDatabaseProject(solution, project);
- }
-
- if (writeSolutionToDisk) // only write main solution
- {
- kernel.Log.Write("");
- string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
-
- using (StreamWriter ss = new StreamWriter(solutionFile))
- {
- kernel.CurrentWorkingDirectory.Push();
- Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile));
-
- ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", SolutionVersion);
- ss.WriteLine(SolutionTag);
-
- WriteProjectDeclarations(ss, solution, solution);
-
- ss.WriteLine("Global");
-
- ss.WriteLine("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution");
- foreach (ConfigurationNode conf in solution.Configurations)
- {
- ss.WriteLine("\t\t{0} = {0}", conf.NameAndPlatform);
- }
- ss.WriteLine("\tEndGlobalSection");
-
- ss.WriteLine("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution");
- WriteConfigurationLines(solution.Configurations, solution, ss);
- ss.WriteLine("\tEndGlobalSection");
-
- if (solution.Solutions.Count > 0)
- {
- ss.WriteLine("\tGlobalSection(NestedProjects) = preSolution");
- foreach (SolutionNode embeddedSolution in solution.Solutions)
- {
- WriteNestedProjectMap(ss, embeddedSolution);
- }
- ss.WriteLine("\tEndGlobalSection");
- }
-
- ss.WriteLine("EndGlobal");
- }
-
- kernel.CurrentWorkingDirectory.Pop();
- }
- }
-
- private void WriteProjectDeclarations(TextWriter writer, SolutionNode actualSolution, SolutionNode embeddedSolution)
- {
- foreach (SolutionNode childSolution in embeddedSolution.Solutions)
- {
- WriteEmbeddedSolution(writer, childSolution);
- WriteProjectDeclarations(writer, actualSolution, childSolution);
- }
-
- foreach (ProjectNode project in embeddedSolution.Projects)
- {
- WriteProject(actualSolution, writer, project);
- }
-
- foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects)
- {
- WriteProject(actualSolution, writer, dbProject);
- }
-
- if (actualSolution.Guid == embeddedSolution.Guid)
- {
- WriteSolutionFiles(actualSolution, writer);
- }
- }
-
- private static void WriteNestedProjectMap(TextWriter writer, SolutionNode embeddedSolution)
- {
- foreach (ProjectNode project in embeddedSolution.Projects)
- {
- WriteNestedProject(writer, embeddedSolution, project.Guid);
- }
-
- foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects)
- {
- WriteNestedProject(writer, embeddedSolution, dbProject.Guid);
- }
-
- foreach (SolutionNode child in embeddedSolution.Solutions)
- {
- WriteNestedProject(writer, embeddedSolution, child.Guid);
- WriteNestedProjectMap(writer, child);
- }
- }
-
- private static void WriteNestedProject(TextWriter writer, SolutionNode solution, Guid projectGuid)
- {
- WriteNestedFolder(writer, solution.Guid, projectGuid);
- }
-
- private static void WriteNestedFolder(TextWriter writer, Guid parentGuid, Guid childGuid)
- {
- writer.WriteLine("\t\t{0} = {1}",
- childGuid.ToString("B").ToUpper(),
- parentGuid.ToString("B").ToUpper());
- }
-
- private static void WriteConfigurationLines(IEnumerable configurations, SolutionNode solution, TextWriter ss)
- {
- foreach (ProjectNode project in solution.Projects)
- {
- foreach (ConfigurationNode conf in configurations)
- {
- ss.WriteLine("\t\t{0}.{1}.ActiveCfg = {1}",
- project.Guid.ToString("B").ToUpper(),
- conf.NameAndPlatform);
-
- ss.WriteLine("\t\t{0}.{1}.Build.0 = {1}",
- project.Guid.ToString("B").ToUpper(),
- conf.NameAndPlatform);
- }
- }
-
- foreach (SolutionNode child in solution.Solutions)
- {
- WriteConfigurationLines(configurations, child, ss);
- }
- }
-
- private void WriteSolutionFiles(SolutionNode solution, TextWriter ss)
- {
- if(solution.Files != null && solution.Files.Count > 0)
- WriteProject(ss, "Folder", solution.Guid, "Solution Files", "Solution Files", solution.Files);
- }
-
- private void WriteEmbeddedSolution(TextWriter writer, SolutionNode embeddedSolution)
- {
- WriteProject(writer, "Folder", embeddedSolution.Guid, embeddedSolution.Name, embeddedSolution.Name, embeddedSolution.Files);
- }
-
- private void WriteProject(SolutionNode solution, TextWriter ss, ProjectNode project)
- {
- WriteProject(ss, solution, project.Language, project.Guid, project.Name, project.FullPath);
- }
-
- private void WriteProject(SolutionNode solution, TextWriter ss, DatabaseProjectNode dbProject)
- {
- if (solution.Files != null && solution.Files.Count > 0)
- WriteProject(ss, solution, "Database", dbProject.Guid, dbProject.Name, dbProject.FullPath);
- }
-
- const string ProjectDeclarationBeginFormat = "Project(\"{0}\") = \"{1}\", \"{2}\", \"{3}\"";
- const string ProjectDeclarationEndFormat = "EndProject";
-
- private void WriteProject(TextWriter ss, SolutionNode solution, string language, Guid guid, string name, string projectFullPath)
- {
- if (!tools.ContainsKey(language))
- throw new UnknownLanguageException("Unknown .NET language: " + language);
-
- ToolInfo toolInfo = tools[language];
-
- string path = Helper.MakePathRelativeTo(solution.FullPath, projectFullPath);
-
- path = Helper.MakeFilePath(path, name, toolInfo.FileExtension);
-
- WriteProject(ss, language, guid, name, path);
- }
-
- private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location)
- {
- WriteProject(writer, language, projectGuid, name, location, null);
- }
-
- private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location, FilesNode files)
- {
- if (!tools.ContainsKey(language))
- throw new UnknownLanguageException("Unknown .NET language: " + language);
-
- ToolInfo toolInfo = tools[language];
-
- writer.WriteLine(ProjectDeclarationBeginFormat,
- toolInfo.Guid,
- name,
- location,
- projectGuid.ToString("B").ToUpper());
-
- if (files != null)
- {
- writer.WriteLine("\tProjectSection(SolutionItems) = preProject");
-
- foreach (string file in files)
- writer.WriteLine("\t\t{0} = {0}", file);
-
- writer.WriteLine("\tEndProjectSection");
- }
-
- writer.WriteLine(ProjectDeclarationEndFormat);
- }
-
- private void WriteDatabaseProject(SolutionNode solution, DatabaseProjectNode project)
- {
- string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "dbp");
- IndentedTextWriter ps = new IndentedTextWriter(new StreamWriter(projectFile), " ");
-
- kernel.CurrentWorkingDirectory.Push();
-
- Helper.SetCurrentDir(Path.GetDirectoryName(projectFile));
-
- using (ps)
- {
- ps.WriteLine("# Microsoft Developer Studio Project File - Database Project");
- ps.WriteLine("Begin DataProject = \"{0}\"", project.Name);
- ps.Indent++;
- ps.WriteLine("MSDTVersion = \"80\"");
- // TODO: Use the project.Files property
- if (ContainsSqlFiles(Path.GetDirectoryName(projectFile)))
- WriteDatabaseFoldersAndFiles(ps, Path.GetDirectoryName(projectFile));
-
- ps.WriteLine("Begin DBRefFolder = \"Database References\"");
- ps.Indent++;
- foreach (DatabaseReferenceNode reference in project.References)
- {
- ps.WriteLine("Begin DBRefNode = \"{0}\"", reference.Name);
- ps.Indent++;
- ps.WriteLine("ConnectStr = \"{0}\"", reference.ConnectionString);
- ps.WriteLine("Provider = \"{0}\"", reference.ProviderId.ToString("B").ToUpper());
- //ps.WriteLine("Colorizer = 5");
- ps.Indent--;
- ps.WriteLine("End");
- }
- ps.Indent--;
- ps.WriteLine("End");
- ps.Indent--;
- ps.WriteLine("End");
-
- ps.Flush();
- }
-
- kernel.CurrentWorkingDirectory.Pop();
- }
-
- private static bool ContainsSqlFiles(string folder)
- {
- if(Directory.GetFiles(folder, "*.sql").Length > 0)
- return true; // if the folder contains 1 .sql file, that's good enough
-
- foreach (string child in Directory.GetDirectories(folder))
- {
- if (ContainsSqlFiles(child))
- return true; // if 1 child folder contains a .sql file, still good enough
- }
-
- return false;
- }
-
- private static void WriteDatabaseFoldersAndFiles(IndentedTextWriter writer, string folder)
- {
- foreach (string child in Directory.GetDirectories(folder))
- {
- if (ContainsSqlFiles(child))
- {
- writer.WriteLine("Begin Folder = \"{0}\"", Path.GetFileName(child));
- writer.Indent++;
- WriteDatabaseFoldersAndFiles(writer, child);
- writer.Indent--;
- writer.WriteLine("End");
- }
- }
- foreach (string file in Directory.GetFiles(folder, "*.sql"))
- {
- writer.WriteLine("Script = \"{0}\"", Path.GetFileName(file));
- }
- }
-
- private void CleanProject(ProjectNode project)
- {
- kernel.Log.Write("...Cleaning project: {0}", project.Name);
-
- ToolInfo toolInfo = tools[project.Language];
- string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
- string userFile = projectFile + ".user";
-
- Helper.DeleteIfExists(projectFile);
- Helper.DeleteIfExists(userFile);
- }
-
- private void CleanSolution(SolutionNode solution)
- {
- kernel.Log.Write("Cleaning {0} solution and project files", VersionName, solution.Name);
-
- string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
- string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo");
-
- Helper.DeleteIfExists(slnFile);
- Helper.DeleteIfExists(suoFile);
-
- foreach (ProjectNode project in solution.Projects)
- {
- CleanProject(project);
- }
-
- kernel.Log.Write("");
- }
-
- #endregion
-
- #region ITarget Members
-
- ///
- /// Writes the specified kern.
- ///
- /// The kern.
- public virtual void Write(Kernel kern)
- {
- if (kern == null)
- {
- throw new ArgumentNullException("kern");
- }
- kernel = kern;
- foreach (SolutionNode sol in kernel.Solutions)
- {
- WriteSolution(sol, true);
- }
- kernel = null;
- }
-
- ///
- /// Cleans the specified kern.
- ///
- /// The kern.
- public virtual void Clean(Kernel kern)
- {
- if (kern == null)
- {
- throw new ArgumentNullException("kern");
- }
- kernel = kern;
- foreach (SolutionNode sol in kernel.Solutions)
- {
- CleanSolution(sol);
- }
- kernel = null;
- }
-
- #endregion
- }
-}
+#region BSD License
+/*
+Copyright (c) 2008 Matthew Holmes (matthew@wildfiregames.com), John Anderson (sontek@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+ * The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.IO;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Nodes;
+using Prebuild.Core.Utilities;
+using System.CodeDom.Compiler;
+
+namespace Prebuild.Core.Targets
+{
+
+ ///
+ ///
+ ///
+ public abstract class VSGenericTarget : ITarget
+ {
+ #region Fields
+
+ readonly Dictionary tools = new Dictionary();
+// NameValueCollection CopyFiles = new NameValueCollection();
+ Kernel kernel;
+ #endregion
+
+ #region Properties
+ ///
+ /// Gets or sets the solution version.
+ ///
+ /// The solution version.
+ public abstract string SolutionVersion { get; }
+ ///
+ /// Gets or sets the product version.
+ ///
+ /// The product version.
+ public abstract string ProductVersion { get; }
+ ///
+ /// Gets or sets the schema version.
+ ///
+ /// The schema version.
+ public abstract string SchemaVersion { get; }
+ ///
+ /// Gets or sets the name of the version.
+ ///
+ /// The name of the version.
+ public abstract string VersionName { get; }
+ ///
+ /// Gets or sets the version.
+ ///
+ /// The version.
+ public abstract VSVersion Version { get; }
+ ///
+ /// Gets the name.
+ ///
+ /// The name.
+ public abstract string Name { get; }
+
+ protected abstract string GetToolsVersionXml(FrameworkVersion version);
+ public abstract string SolutionTag { get; }
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ protected VSGenericTarget()
+ {
+ tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets");
+ tools["Database"] = new ToolInfo("Database", "{4F174C21-8C12-11D0-8340-0000F80270F8}", "dbp", "UNKNOWN");
+ tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets");
+ tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets");
+ tools["Folder"] = new ToolInfo("Folder", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", null, null);
+ }
+
+ #endregion
+
+ #region Private Methods
+
+ private string MakeRefPath(ProjectNode project)
+ {
+ string ret = "";
+ foreach (ReferencePathNode node in project.ReferencePaths)
+ {
+ try
+ {
+ string fullPath = Helper.ResolvePath(node.Path);
+ if (ret.Length < 1)
+ {
+ ret = fullPath;
+ }
+ else
+ {
+ ret += ";" + fullPath;
+ }
+ }
+ catch (ArgumentException)
+ {
+ kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path);
+ }
+ }
+
+ return ret;
+ }
+
+ private static ProjectNode FindProjectInSolution(string name, SolutionNode solution)
+ {
+ SolutionNode node = solution;
+
+ while (node.Parent is SolutionNode)
+ node = node.Parent as SolutionNode;
+
+ return FindProjectInSolutionRecursively(name, node);
+ }
+
+ private static ProjectNode FindProjectInSolutionRecursively(string name, SolutionNode solution)
+ {
+ if (solution.ProjectsTable.ContainsKey(name))
+ return solution.ProjectsTable[name];
+
+ foreach (SolutionNode child in solution.Solutions)
+ {
+ ProjectNode node = FindProjectInSolutionRecursively(name, child);
+ if (node != null)
+ return node;
+ }
+
+ return null;
+ }
+
+ private void WriteProject(SolutionNode solution, ProjectNode project)
+ {
+ if (!tools.ContainsKey(project.Language))
+ {
+ throw new UnknownLanguageException("Unknown .NET language: " + project.Language);
+ }
+
+ ToolInfo toolInfo = tools[project.Language];
+ string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
+ StreamWriter ps = new StreamWriter(projectFile);
+
+ kernel.CurrentWorkingDirectory.Push();
+ Helper.SetCurrentDir(Path.GetDirectoryName(projectFile));
+
+ #region Project File
+ using (ps)
+ {
+ string targets = "";
+
+ if(project.Files.CopyFiles > 0)
+ targets = "Build;CopyFiles";
+ else
+ targets = "Build";
+
+ ps.WriteLine("", targets, GetToolsVersionXml(project.FrameworkVersion));
+ ps.WriteLine(" ");
+ ps.WriteLine(" Local ");
+ ps.WriteLine(" {0} ", ProductVersion);
+ ps.WriteLine(" {0} ", SchemaVersion);
+ ps.WriteLine(" {{{0}}} ", project.Guid.ToString().ToUpper());
+
+ // Visual Studio has a hard coded guid for the project type
+ if (project.Type == ProjectType.Web)
+ ps.WriteLine(" {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} ");
+ ps.WriteLine(" Debug ");
+ ps.WriteLine(" {0} ", project.AppIcon);
+ ps.WriteLine(" ");
+ ps.WriteLine(" ");
+ ps.WriteLine(" {0} ", project.AssemblyName);
+ foreach (ConfigurationNode conf in project.Configurations)
+ {
+ if (conf.Options.KeyFile != "")
+ {
+ ps.WriteLine(" {0} ", conf.Options.KeyFile);
+ ps.WriteLine(" true ");
+ break;
+ }
+ }
+ ps.WriteLine(" JScript ");
+ ps.WriteLine(" Grid ");
+ ps.WriteLine(" IE50 ");
+ ps.WriteLine(" false ");
+ ps.WriteLine(" {0} ", project.FrameworkVersion.ToString().Replace("_", "."));
+
+ ps.WriteLine(" {0} ", project.Type == ProjectType.Web ? ProjectType.Library.ToString() : project.Type.ToString());
+ ps.WriteLine(" {0} ", project.DesignerFolder);
+ ps.WriteLine(" {0} ", project.RootNamespace);
+ ps.WriteLine(" {0} ", project.StartupObject);
+ if (string.IsNullOrEmpty(project.DebugStartParameters))
+ {
+ ps.WriteLine(" {0} ", project.DebugStartParameters);
+ }
+ ps.WriteLine(" ");
+ ps.WriteLine(" ");
+
+ ps.WriteLine(" ");
+
+ foreach (ConfigurationNode conf in project.Configurations)
+ {
+ ps.Write(" ", conf.Name, conf.Platform);
+ ps.WriteLine(" {0} ", conf.Options["AllowUnsafe"]);
+ ps.WriteLine(" {0} ", conf.Options["BaseAddress"]);
+ ps.WriteLine(" {0} ", conf.Options["CheckUnderflowOverflow"]);
+ ps.WriteLine(" ");
+ ps.WriteLine(" ");
+ ps.WriteLine(" {0} ", conf.Options["CompilerDefines"]);
+ ps.WriteLine(" {0} ", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString()));
+ ps.WriteLine(" {0} ", conf.Options["DebugInformation"]);
+ ps.WriteLine(" {0} ", conf.Options["FileAlignment"]);
+ ps.WriteLine(" {0} ", conf.Options["OptimizeCode"]);
+ if (project.Type != ProjectType.Web)
+ ps.WriteLine(" {0} ",
+ Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString())));
+ else
+ ps.WriteLine(" {0} ",
+ Helper.EndPath(Helper.NormalizePath("bin\\")));
+
+ ps.WriteLine(" {0} ", conf.Options["RegisterComInterop"]);
+ ps.WriteLine(" {0} ", conf.Options["RemoveIntegerChecks"]);
+ ps.WriteLine(" {0} ", conf.Options["WarningsAsErrors"]);
+ ps.WriteLine(" {0} ", conf.Options["WarningLevel"]);
+ ps.WriteLine(" {0} ", conf.Options["NoStdLib"]);
+ ps.WriteLine(" {0} ", conf.Options["SuppressWarnings"]);
+ ps.WriteLine(" {0} ", conf.Platform);
+ ps.WriteLine(" ");
+ }
+
+ //ps.WriteLine(" ");
+
+ Dictionary projectReferences = new Dictionary();
+ List otherReferences = new List();
+
+ foreach (ReferenceNode refr in project.References)
+ {
+ ProjectNode projectNode = FindProjectInSolution(refr.Name, solution);
+
+ if (projectNode == null)
+ otherReferences.Add(refr);
+ else
+ projectReferences.Add(refr, projectNode);
+ }
+ // Assembly References
+ ps.WriteLine(" ");
+
+ foreach (ReferenceNode refr in otherReferences)
+ {
+ ps.Write(" ");
+ ps.Write(" ");
+ ps.Write(refr.Name);
+ ps.WriteLine(" ");
+
+ if(!String.IsNullOrEmpty(refr.Path))
+ {
+ // Use absolute path to assembly (for determining assembly type)
+ string absolutePath = Path.Combine(project.FullPath, refr.Path);
+ if(File.Exists(Helper.MakeFilePath(absolutePath, refr.Name, "exe"))) {
+ // Assembly is an executable (exe)
+ ps.WriteLine(" {0} ", Helper.MakeFilePath(refr.Path, refr.Name, "exe"));
+ } else if(File.Exists(Helper.MakeFilePath(absolutePath, refr.Name, "dll"))) {
+ // Assembly is an library (dll)
+ ps.WriteLine(" {0} ", Helper.MakeFilePath(refr.Path, refr.Name, "dll"));
+ } else {
+ string referencePath = Helper.MakeFilePath(refr.Path, refr.Name, "dll");
+ kernel.Log.Write(LogType.Warning, "Reference \"{0}\": The specified file doesn't exist.", referencePath);
+ ps.WriteLine(" {0} ", Helper.MakeFilePath(refr.Path, refr.Name, "dll"));
+ }
+ }
+
+ ps.WriteLine(" {0} ", refr.LocalCopy);
+ ps.WriteLine(" ");
+ }
+ ps.WriteLine(" ");
+
+ //Project References
+ ps.WriteLine(" ");
+ foreach (KeyValuePair pair in projectReferences)
+ {
+ ToolInfo tool = tools[pair.Value.Language];
+ if (tools == null)
+ throw new UnknownLanguageException();
+
+ string path =
+ Helper.MakePathRelativeTo(project.FullPath,
+ Helper.MakeFilePath(pair.Value.FullPath, pair.Value.Name, tool.FileExtension));
+ ps.WriteLine(" ", path);
+
+ // TODO: Allow reference to visual basic projects
+ ps.WriteLine(" {0} ", pair.Value.Name);
+ ps.WriteLine(" {0} ", pair.Value.Guid.ToString("B").ToUpper());
+ ps.WriteLine(" {0} ", tool.Guid.ToUpper());
+
+ //This is the Copy Local flag in VS
+ ps.WriteLine(" {0} ", pair.Key.LocalCopy);
+
+ ps.WriteLine(" ");
+ }
+ ps.WriteLine(" ");
+
+ // ps.WriteLine(" ");
+ ps.WriteLine(" ");
+
+ // ps.WriteLine(" ");
+ List list = new List();
+
+ foreach (string path in project.Files)
+ {
+ string lower = path.ToLower();
+ if (lower.EndsWith(".resx"))
+ {
+ string codebehind = String.Format("{0}.Designer{1}", path.Substring(0, path.LastIndexOf('.')), toolInfo.LanguageExtension);
+ if (!list.Contains(codebehind))
+ list.Add(codebehind);
+ }
+
+ }
+
+
+ foreach (string filePath in project.Files)
+ {
+ // Add the filePath with the destination as the key
+ // will use it later to form the copy parameters with Include lists
+ // for each destination
+ if (project.Files.GetBuildAction(filePath) == BuildAction.Copy)
+ continue;
+ // if (file == "Properties\\Bind.Designer.cs")
+ // {
+ // Console.WriteLine("Wait a minute!");
+ // Console.WriteLine(project.Files.GetSubType(file).ToString());
+ // }
+ SubType subType = project.Files.GetSubType(filePath);
+
+ // Visual Studio chokes on file names if forward slash is used as a path separator
+ // instead of backslash. So we must make sure that all file paths written to the
+ // project file use \ as a path separator.
+ string file = filePath.Replace(@"/", @"\");
+
+ if (subType != SubType.Code && subType != SubType.Settings && subType != SubType.Designer
+ && subType != SubType.CodeBehind)
+ {
+ ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx");
+ ps.WriteLine(" {0} ", Path.GetFileName(file));
+ ps.WriteLine(" Designer ");
+ ps.WriteLine(" ");
+ //
+ }
+
+ if (subType == SubType.Designer)
+ {
+ ps.WriteLine(" ", file);
+
+ string autogen_name = file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs";
+ string dependent_name = filePath.Substring(0, file.LastIndexOf('.')) + ".cs";
+
+ // Check for a parent .cs file with the same name as this designer file
+ if (File.Exists(Helper.NormalizePath(dependent_name)))
+ {
+ ps.WriteLine(" {0} ", Path.GetFileName(dependent_name));
+ }
+ else
+ {
+ ps.WriteLine(" ResXFileCodeGenerator ");
+ ps.WriteLine(" {0} ", Path.GetFileName(autogen_name));
+ ps.WriteLine(" " + subType + " ");
+ }
+
+ ps.WriteLine(" ");
+ if (File.Exists(Helper.NormalizePath(autogen_name)))
+ {
+ ps.WriteLine(" ", autogen_name);
+ //ps.WriteLine(" True ");
+
+ // If a parent .cs file exists, link this autogen file to it. Otherwise link
+ // to the designer file
+ if (File.Exists(dependent_name))
+ {
+ ps.WriteLine(" {0} ", Path.GetFileName(dependent_name));
+ }
+ else
+ {
+ ps.WriteLine(" True ");
+ ps.WriteLine(" {0} ", Path.GetFileName(filePath));
+ }
+
+ ps.WriteLine(" ");
+ }
+ list.Add(autogen_name);
+ }
+ if (subType == SubType.Settings)
+ {
+ ps.Write(" <{0} ", project.Files.GetBuildAction(filePath));
+ ps.WriteLine("Include=\"{0}\">", file);
+ string fileName = Path.GetFileName(filePath);
+ if (project.Files.GetBuildAction(filePath) == BuildAction.None)
+ {
+ ps.WriteLine(" SettingsSingleFileGenerator ");
+ ps.WriteLine(" {0} ", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs");
+ }
+ else
+ {
+ ps.WriteLine(" Code ");
+ ps.WriteLine(" True ");
+ ps.WriteLine(" True ");
+ string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.'));
+ string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.'));
+ ps.WriteLine(" {0} ", Path.GetFileName(fileNameShorter + ".settings"));
+ }
+ ps.WriteLine(" {0}>", project.Files.GetBuildAction(filePath));
+ }
+ else if (subType != SubType.Designer)
+ {
+ string path = Helper.NormalizePath(file);
+ string path_lower = path.ToLower();
+
+ if (!list.Contains(filePath))
+ {
+ ps.Write(" <{0} ", project.Files.GetBuildAction(filePath));
+
+ int startPos = 0;
+ if (project.Files.GetPreservePath(filePath))
+ {
+ while ((@"./\").IndexOf(file.Substring(startPos, 1)) != -1)
+ startPos++;
+
+ }
+ else
+ {
+ startPos = file.LastIndexOf(Path.GetFileName(path));
+ }
+
+ // be sure to write out the path with backslashes so VS recognizes
+ // the file properly.
+ ps.WriteLine("Include=\"{0}\">", file);
+
+ int last_period_index = file.LastIndexOf('.');
+ string short_file_name = (last_period_index >= 0)
+ ? file.Substring(0, last_period_index)
+ : file;
+ string extension = Path.GetExtension(path);
+ // make this upper case, so that when File.Exists tests for the
+ // existence of a designer file on a case-sensitive platform,
+ // it is correctly identified.
+ string designer_format = string.Format(".Designer{0}", extension);
+
+ if (path_lower.EndsWith(designer_format.ToLowerInvariant()))
+ {
+ int designer_index = path.IndexOf(designer_format);
+ string file_name = path.Substring(0, designer_index);
+
+ // There are two corrections to the next lines:
+ // 1. Fix the connection between a designer file and a form
+ // or usercontrol that don't have an associated resx file.
+ // 2. Connect settings files to associated designer files.
+ if (File.Exists(file_name + extension))
+ ps.WriteLine(" {0} ", Path.GetFileName(file_name + extension));
+ else if (File.Exists(file_name + ".resx"))
+ ps.WriteLine(" {0} ", Path.GetFileName(file_name + ".resx"));
+ else if (File.Exists(file_name + ".settings"))
+ {
+ ps.WriteLine(" {0} ", Path.GetFileName(file_name + ".settings"));
+ ps.WriteLine(" True ");
+ ps.WriteLine(" True ");
+ }
+ }
+ else if (subType == SubType.CodeBehind)
+ {
+ ps.WriteLine(" {0} ", Path.GetFileName(short_file_name));
+ }
+ if (project.Files.GetIsLink(filePath))
+ {
+ string alias = project.Files.GetLinkPath(filePath);
+ alias += file.Substring(startPos);
+ alias = Helper.NormalizePath(alias);
+ ps.WriteLine(" {0}", alias);
+ }
+ else if (project.Files.GetBuildAction(filePath) != BuildAction.None)
+ {
+ if (project.Files.GetBuildAction(filePath) != BuildAction.EmbeddedResource)
+ {
+ ps.WriteLine(" {0} ", subType);
+ }
+ }
+
+ if (project.Files.GetCopyToOutput(filePath) != CopyToOutput.Never)
+ {
+ ps.WriteLine(" {0} ", project.Files.GetCopyToOutput(filePath));
+ }
+
+ ps.WriteLine(" {0}>", project.Files.GetBuildAction(filePath));
+ }
+ }
+ }
+ ps.WriteLine(" ");
+
+ /*
+ * Copy Task
+ *
+ */
+ if ( project.Files.CopyFiles > 0 ) {
+
+ Dictionary IncludeTags = new Dictionary();
+ int TagCount = 0;
+
+ // Handle Copy tasks
+ ps.WriteLine(" ");
+ foreach (string destPath in project.Files.Destinations)
+ {
+ string tag = "FilesToCopy_" + TagCount.ToString("0000");
+
+ ps.WriteLine(" <{0} Include=\"{1}\" />", tag, String.Join(";", project.Files.SourceFiles(destPath)));
+ IncludeTags.Add(destPath, tag);
+ TagCount++;
+ }
+
+ ps.WriteLine(" ");
+
+ ps.WriteLine(" ");
+
+ foreach (string destPath in project.Files.Destinations)
+ {
+ ps.WriteLine(" ",
+ IncludeTags[destPath], destPath);
+ }
+
+ ps.WriteLine(" ");
+ }
+
+ ps.WriteLine(" ");
+ ps.WriteLine(" ");
+ ps.WriteLine(" ");
+ ps.WriteLine(" ");
+ ps.WriteLine(" ");
+ ps.WriteLine(" ");
+ ps.WriteLine(" ");
+ ps.WriteLine(" ");
+ }
+ #endregion
+
+ #region User File
+
+ ps = new StreamWriter(projectFile + ".user");
+ using (ps)
+ {
+ // Get the first configuration from the project.
+ ConfigurationNode firstConfiguration = null;
+
+ if (project.Configurations.Count > 0)
+ {
+ firstConfiguration = project.Configurations[0];
+ }
+
+ ps.WriteLine("");
+ //ps.WriteLine( "" );
+ //ps.WriteLine(" <{0}>", toolInfo.XMLTag);
+ //ps.WriteLine(" ");
+ ps.WriteLine(" ");
+ //ps.WriteLine(" ", MakeRefPath(project));
+
+ if (firstConfiguration != null)
+ {
+ ps.WriteLine(" {0} ", firstConfiguration.Name);
+ ps.WriteLine(" {0} ", firstConfiguration.Platform);
+ }
+
+ ps.WriteLine(" {0} ", MakeRefPath(project));
+ ps.WriteLine(" {0} ", ProductVersion);
+ ps.WriteLine(" ProjectFiles ");
+ ps.WriteLine(" 0 ");
+ ps.WriteLine(" ");
+ foreach (ConfigurationNode conf in project.Configurations)
+ {
+ ps.Write(" ");
+ }
+ ps.WriteLine(" ");
+ }
+ #endregion
+
+ kernel.CurrentWorkingDirectory.Pop();
+ }
+
+ private void WriteSolution(SolutionNode solution, bool writeSolutionToDisk)
+ {
+ kernel.Log.Write("Creating {0} solution and project files", VersionName);
+
+ foreach (SolutionNode child in solution.Solutions)
+ {
+ kernel.Log.Write("...Creating folder: {0}", child.Name);
+ WriteSolution(child, false);
+ }
+
+ foreach (ProjectNode project in solution.Projects)
+ {
+ kernel.Log.Write("...Creating project: {0}", project.Name);
+ WriteProject(solution, project);
+ }
+
+ foreach (DatabaseProjectNode project in solution.DatabaseProjects)
+ {
+ kernel.Log.Write("...Creating database project: {0}", project.Name);
+ WriteDatabaseProject(solution, project);
+ }
+
+ if (writeSolutionToDisk) // only write main solution
+ {
+ kernel.Log.Write("");
+ string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
+
+ using (StreamWriter ss = new StreamWriter(solutionFile))
+ {
+ kernel.CurrentWorkingDirectory.Push();
+ Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile));
+
+ ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", SolutionVersion);
+ ss.WriteLine(SolutionTag);
+
+ WriteProjectDeclarations(ss, solution, solution);
+
+ ss.WriteLine("Global");
+
+ ss.WriteLine("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution");
+ foreach (ConfigurationNode conf in solution.Configurations)
+ {
+ ss.WriteLine("\t\t{0} = {0}", conf.NameAndPlatform);
+ }
+ ss.WriteLine("\tEndGlobalSection");
+
+ ss.WriteLine("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution");
+ WriteConfigurationLines(solution.Configurations, solution, ss);
+ ss.WriteLine("\tEndGlobalSection");
+
+ if (solution.Solutions.Count > 0)
+ {
+ ss.WriteLine("\tGlobalSection(NestedProjects) = preSolution");
+ foreach (SolutionNode embeddedSolution in solution.Solutions)
+ {
+ WriteNestedProjectMap(ss, embeddedSolution);
+ }
+ ss.WriteLine("\tEndGlobalSection");
+ }
+
+ ss.WriteLine("EndGlobal");
+ }
+
+ kernel.CurrentWorkingDirectory.Pop();
+ }
+ }
+
+ private void WriteProjectDeclarations(TextWriter writer, SolutionNode actualSolution, SolutionNode embeddedSolution)
+ {
+ foreach (SolutionNode childSolution in embeddedSolution.Solutions)
+ {
+ WriteEmbeddedSolution(writer, childSolution);
+ WriteProjectDeclarations(writer, actualSolution, childSolution);
+ }
+
+ foreach (ProjectNode project in embeddedSolution.Projects)
+ {
+ WriteProject(actualSolution, writer, project);
+ }
+
+ foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects)
+ {
+ WriteProject(actualSolution, writer, dbProject);
+ }
+
+ if (actualSolution.Guid == embeddedSolution.Guid)
+ {
+ WriteSolutionFiles(actualSolution, writer);
+ }
+ }
+
+ private static void WriteNestedProjectMap(TextWriter writer, SolutionNode embeddedSolution)
+ {
+ foreach (ProjectNode project in embeddedSolution.Projects)
+ {
+ WriteNestedProject(writer, embeddedSolution, project.Guid);
+ }
+
+ foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects)
+ {
+ WriteNestedProject(writer, embeddedSolution, dbProject.Guid);
+ }
+
+ foreach (SolutionNode child in embeddedSolution.Solutions)
+ {
+ WriteNestedProject(writer, embeddedSolution, child.Guid);
+ WriteNestedProjectMap(writer, child);
+ }
+ }
+
+ private static void WriteNestedProject(TextWriter writer, SolutionNode solution, Guid projectGuid)
+ {
+ WriteNestedFolder(writer, solution.Guid, projectGuid);
+ }
+
+ private static void WriteNestedFolder(TextWriter writer, Guid parentGuid, Guid childGuid)
+ {
+ writer.WriteLine("\t\t{0} = {1}",
+ childGuid.ToString("B").ToUpper(),
+ parentGuid.ToString("B").ToUpper());
+ }
+
+ private static void WriteConfigurationLines(IEnumerable configurations, SolutionNode solution, TextWriter ss)
+ {
+ foreach (ProjectNode project in solution.Projects)
+ {
+ foreach (ConfigurationNode conf in configurations)
+ {
+ ss.WriteLine("\t\t{0}.{1}.ActiveCfg = {1}",
+ project.Guid.ToString("B").ToUpper(),
+ conf.NameAndPlatform);
+
+ ss.WriteLine("\t\t{0}.{1}.Build.0 = {1}",
+ project.Guid.ToString("B").ToUpper(),
+ conf.NameAndPlatform);
+ }
+ }
+
+ foreach (SolutionNode child in solution.Solutions)
+ {
+ WriteConfigurationLines(configurations, child, ss);
+ }
+ }
+
+ private void WriteSolutionFiles(SolutionNode solution, TextWriter ss)
+ {
+ if(solution.Files != null && solution.Files.Count > 0)
+ WriteProject(ss, "Folder", solution.Guid, "Solution Files", "Solution Files", solution.Files);
+ }
+
+ private void WriteEmbeddedSolution(TextWriter writer, SolutionNode embeddedSolution)
+ {
+ WriteProject(writer, "Folder", embeddedSolution.Guid, embeddedSolution.Name, embeddedSolution.Name, embeddedSolution.Files);
+ }
+
+ private void WriteProject(SolutionNode solution, TextWriter ss, ProjectNode project)
+ {
+ WriteProject(ss, solution, project.Language, project.Guid, project.Name, project.FullPath);
+ }
+
+ private void WriteProject(SolutionNode solution, TextWriter ss, DatabaseProjectNode dbProject)
+ {
+ if (solution.Files != null && solution.Files.Count > 0)
+ WriteProject(ss, solution, "Database", dbProject.Guid, dbProject.Name, dbProject.FullPath);
+ }
+
+ const string ProjectDeclarationBeginFormat = "Project(\"{0}\") = \"{1}\", \"{2}\", \"{3}\"";
+ const string ProjectDeclarationEndFormat = "EndProject";
+
+ private void WriteProject(TextWriter ss, SolutionNode solution, string language, Guid guid, string name, string projectFullPath)
+ {
+ if (!tools.ContainsKey(language))
+ throw new UnknownLanguageException("Unknown .NET language: " + language);
+
+ ToolInfo toolInfo = tools[language];
+
+ string path = Helper.MakePathRelativeTo(solution.FullPath, projectFullPath);
+
+ path = Helper.MakeFilePath(path, name, toolInfo.FileExtension);
+
+ WriteProject(ss, language, guid, name, path);
+ }
+
+ private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location)
+ {
+ WriteProject(writer, language, projectGuid, name, location, null);
+ }
+
+ private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location, FilesNode files)
+ {
+ if (!tools.ContainsKey(language))
+ throw new UnknownLanguageException("Unknown .NET language: " + language);
+
+ ToolInfo toolInfo = tools[language];
+
+ writer.WriteLine(ProjectDeclarationBeginFormat,
+ toolInfo.Guid,
+ name,
+ location,
+ projectGuid.ToString("B").ToUpper());
+
+ if (files != null)
+ {
+ writer.WriteLine("\tProjectSection(SolutionItems) = preProject");
+
+ foreach (string file in files)
+ writer.WriteLine("\t\t{0} = {0}", file);
+
+ writer.WriteLine("\tEndProjectSection");
+ }
+
+ writer.WriteLine(ProjectDeclarationEndFormat);
+ }
+
+ private void WriteDatabaseProject(SolutionNode solution, DatabaseProjectNode project)
+ {
+ string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "dbp");
+ IndentedTextWriter ps = new IndentedTextWriter(new StreamWriter(projectFile), " ");
+
+ kernel.CurrentWorkingDirectory.Push();
+
+ Helper.SetCurrentDir(Path.GetDirectoryName(projectFile));
+
+ using (ps)
+ {
+ ps.WriteLine("# Microsoft Developer Studio Project File - Database Project");
+ ps.WriteLine("Begin DataProject = \"{0}\"", project.Name);
+ ps.Indent++;
+ ps.WriteLine("MSDTVersion = \"80\"");
+ // TODO: Use the project.Files property
+ if (ContainsSqlFiles(Path.GetDirectoryName(projectFile)))
+ WriteDatabaseFoldersAndFiles(ps, Path.GetDirectoryName(projectFile));
+
+ ps.WriteLine("Begin DBRefFolder = \"Database References\"");
+ ps.Indent++;
+ foreach (DatabaseReferenceNode reference in project.References)
+ {
+ ps.WriteLine("Begin DBRefNode = \"{0}\"", reference.Name);
+ ps.Indent++;
+ ps.WriteLine("ConnectStr = \"{0}\"", reference.ConnectionString);
+ ps.WriteLine("Provider = \"{0}\"", reference.ProviderId.ToString("B").ToUpper());
+ //ps.WriteLine("Colorizer = 5");
+ ps.Indent--;
+ ps.WriteLine("End");
+ }
+ ps.Indent--;
+ ps.WriteLine("End");
+ ps.Indent--;
+ ps.WriteLine("End");
+
+ ps.Flush();
+ }
+
+ kernel.CurrentWorkingDirectory.Pop();
+ }
+
+ private static bool ContainsSqlFiles(string folder)
+ {
+ if(Directory.GetFiles(folder, "*.sql").Length > 0)
+ return true; // if the folder contains 1 .sql file, that's good enough
+
+ foreach (string child in Directory.GetDirectories(folder))
+ {
+ if (ContainsSqlFiles(child))
+ return true; // if 1 child folder contains a .sql file, still good enough
+ }
+
+ return false;
+ }
+
+ private static void WriteDatabaseFoldersAndFiles(IndentedTextWriter writer, string folder)
+ {
+ foreach (string child in Directory.GetDirectories(folder))
+ {
+ if (ContainsSqlFiles(child))
+ {
+ writer.WriteLine("Begin Folder = \"{0}\"", Path.GetFileName(child));
+ writer.Indent++;
+ WriteDatabaseFoldersAndFiles(writer, child);
+ writer.Indent--;
+ writer.WriteLine("End");
+ }
+ }
+ foreach (string file in Directory.GetFiles(folder, "*.sql"))
+ {
+ writer.WriteLine("Script = \"{0}\"", Path.GetFileName(file));
+ }
+ }
+
+ private void CleanProject(ProjectNode project)
+ {
+ kernel.Log.Write("...Cleaning project: {0}", project.Name);
+
+ ToolInfo toolInfo = tools[project.Language];
+ string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
+ string userFile = projectFile + ".user";
+
+ Helper.DeleteIfExists(projectFile);
+ Helper.DeleteIfExists(userFile);
+ }
+
+ private void CleanSolution(SolutionNode solution)
+ {
+ kernel.Log.Write("Cleaning {0} solution and project files", VersionName, solution.Name);
+
+ string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
+ string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo");
+
+ Helper.DeleteIfExists(slnFile);
+ Helper.DeleteIfExists(suoFile);
+
+ foreach (ProjectNode project in solution.Projects)
+ {
+ CleanProject(project);
+ }
+
+ kernel.Log.Write("");
+ }
+
+ #endregion
+
+ #region ITarget Members
+
+ ///
+ /// Writes the specified kern.
+ ///
+ /// The kern.
+ public virtual void Write(Kernel kern)
+ {
+ if (kern == null)
+ {
+ throw new ArgumentNullException("kern");
+ }
+ kernel = kern;
+ foreach (SolutionNode sol in kernel.Solutions)
+ {
+ WriteSolution(sol, true);
+ }
+ kernel = null;
+ }
+
+ ///
+ /// Cleans the specified kern.
+ ///
+ /// The kern.
+ public virtual void Clean(Kernel kern)
+ {
+ if (kern == null)
+ {
+ throw new ArgumentNullException("kern");
+ }
+ kernel = kern;
+ foreach (SolutionNode sol in kernel.Solutions)
+ {
+ CleanSolution(sol);
+ }
+ kernel = null;
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Prebuild.cs b/Prebuild/src/Prebuild.cs
index 081c89c..35a5dfa 100644
--- a/Prebuild/src/Prebuild.cs
+++ b/Prebuild/src/Prebuild.cs
@@ -27,7 +27,7 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
/*
* $Source$
* $Author: kunnis $
- * $Date: 2009-04-15 02:33:14 +0100 (Wed, 15 Apr 2009) $
+ * $Date: 2009-04-14 21:33:14 -0400 (Tue, 14 Apr 2009) $
* $Revision: 308 $
*/
#endregion
diff --git a/Prebuild/src/data/prebuild-1.7.xsd b/Prebuild/src/data/prebuild-1.7.xsd
index 3675503..a7f5c88 100644
--- a/Prebuild/src/data/prebuild-1.7.xsd
+++ b/Prebuild/src/data/prebuild-1.7.xsd
@@ -1,350 +1,350 @@
-
-
-
-
- Copyright (c) 2004-2007
- Matthew Holmes (calefaction at houston . rr . com),
- Dan Moorehead (dan05a at gmail . com),
- David Hudson (jendave at yahoo dot com),
- C.J. Adams-Collier (cjac at colliertech dot com)
-
- .NET Prebuild is a cross-platform XML-driven pre-build tool which
- allows developers to easily generate project or make files for major
- IDE's and .NET development tools including: Visual Studio .NET 2002,
- 2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools.
-
- BSD License:
-
- Redistribution and use in source and binary forms, with or without modification, are permitted
- provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions
- and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
- and the following disclaimer in the documentation and/or other materials provided with the
- distribution.
- * The name of the author may not be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
- BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+ Copyright (c) 2004-2007
+ Matthew Holmes (calefaction at houston . rr . com),
+ Dan Moorehead (dan05a at gmail . com),
+ David Hudson (jendave at yahoo dot com),
+ C.J. Adams-Collier (cjac at colliertech dot com)
+
+ .NET Prebuild is a cross-platform XML-driven pre-build tool which
+ allows developers to easily generate project or make files for major
+ IDE's and .NET development tools including: Visual Studio .NET 2002,
+ 2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools.
+
+ BSD License:
+
+ Redistribution and use in source and binary forms, with or without modification, are permitted
+ provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+ * The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+ BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Prebuild/src/data/prebuild-1.9.xsd b/Prebuild/src/data/prebuild-1.9.xsd
index fbca556..d647e08 100644
--- a/Prebuild/src/data/prebuild-1.9.xsd
+++ b/Prebuild/src/data/prebuild-1.9.xsd
@@ -1,336 +1,336 @@
-
-
-
-
- Copyright (c) 2004-2007
- Matthew Holmes (calefaction at houston . rr . com),
- Dan Moorehead (dan05a at gmail . com),
- David Hudson (jendave at yahoo dot com),
- C.J. Adams-Collier (cjac at colliertech dot com)
-
- .NET Prebuild is a cross-platform XML-driven pre-build tool which
- allows developers to easily generate project or make files for major
- IDE's and .NET development tools including: Visual Studio .NET 2002,
- 2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools.
-
- BSD License:
-
- Redistribution and use in source and binary forms, with or without modification, are permitted
- provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions
- and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
- and the following disclaimer in the documentation and/or other materials provided with the
- distribution.
- * The name of the author may not be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
- BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+ Copyright (c) 2004-2007
+ Matthew Holmes (calefaction at houston . rr . com),
+ Dan Moorehead (dan05a at gmail . com),
+ David Hudson (jendave at yahoo dot com),
+ C.J. Adams-Collier (cjac at colliertech dot com)
+
+ .NET Prebuild is a cross-platform XML-driven pre-build tool which
+ allows developers to easily generate project or make files for major
+ IDE's and .NET development tools including: Visual Studio .NET 2002,
+ 2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools.
+
+ BSD License:
+
+ Redistribution and use in source and binary forms, with or without modification, are permitted
+ provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+ * The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+ BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bin/Prebuild.exe b/bin/Prebuild.exe
index ead3c6b..bdb25b6 100755
Binary files a/bin/Prebuild.exe and b/bin/Prebuild.exe differ
--
cgit v1.1
From 5b52440e61648a98d418cff11b588352a3cfff67 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Sat, 24 Dec 2011 16:18:01 +0100
Subject: Introduce a LightShare kill packet ans send it when needed. Currently
only understood by AVN v0.3
---
.../Region/CoreModules/LightShare/LightShareModule.cs | 17 ++++++++++++-----
.../ScriptEngine/Shared/Api/Implementation/LS_Api.cs | 1 +
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs
index cabbd31..16cbbf5 100644
--- a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs
+++ b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs
@@ -153,10 +153,18 @@ namespace OpenSim.Region.CoreModules.World.LightShare
public void SendProfileToClient(IClientAPI client, RegionLightShareData wl)
{
- if (m_enableWindlight && m_scene.RegionInfo.WindlightSettings.valid)
+ if (m_enableWindlight)
{
- List param = compileWindlightSettings(wl);
- client.SendGenericMessage("Windlight", param);
+ if (m_scene.RegionInfo.WindlightSettings.valid)
+ {
+ List param = compileWindlightSettings(wl);
+ client.SendGenericMessage("Windlight", param);
+ }
+ else
+ {
+ List param = new List();
+ client.SendGenericMessage("WindlightReset", param);
+ }
}
}
@@ -175,8 +183,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare
private void EventManager_OnSaveNewWindlightProfile()
{
- if (m_scene.RegionInfo.WindlightSettings.valid)
- m_scene.ForEachRootClient(SendProfileToClient);
+ m_scene.ForEachRootClient(SendProfileToClient);
}
public void PostInitialise()
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
index cb0d765..77a784d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
@@ -486,6 +486,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.valid = false;
if (m_host.ParentGroup.Scene.SimulationDataService != null)
m_host.ParentGroup.Scene.SimulationDataService.RemoveRegionWindlightSettings(m_host.ParentGroup.Scene.RegionInfo.RegionID);
+ m_host.ParentGroup.Scene.EventManager.TriggerOnSaveNewWindlightProfile();
}
///
/// Set the current Windlight scene to a target avatar
--
cgit v1.1
From 70e36ee2b41da03e41b4f61ab348bc85bd872801 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Thu, 29 Dec 2011 12:17:58 -0800
Subject: HG: more adjustments for making HG Simian work. Added server_uri as
new key on get_agent_home in UAS.
---
.../CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | 5 +++--
OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs | 2 +-
OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs | 3 +++
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index cc9ba97..841363c 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -227,8 +227,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
IEventQueue eq = sp.Scene.RequestModuleInterface();
GridRegion homeGatekeeper = MakeRegion(aCircuit);
- m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: teleporting user {0} {1} home to {2} via {3}:{4}:{5}",
- aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ExternalHostName, homeGatekeeper.HttpPort, homeGatekeeper.RegionName);
+ m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: teleporting user {0} {1} home to {2} via {3}:{4}",
+ aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ServerURI, homeGatekeeper.RegionName);
DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq);
}
@@ -347,6 +347,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
region.ExternalHostName = uri.Host;
region.HttpPort = (uint)uri.Port;
+ region.ServerURI = uri.ToString();
region.RegionName = string.Empty;
region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0);
return region;
diff --git a/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs
index 8ac89cc..c030bca 100644
--- a/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs
@@ -62,7 +62,7 @@ namespace OpenSim.Services.Connectors
else
{
serverURI = serverURI + "xxx";
- m_ServerURI = serverURI.Replace("?" + uri.Query, "");
+ m_ServerURI = serverURI.Replace(uri.Query, "");
m_ServerURI = m_ServerURI.TrimEnd('/') + "/helo/";
}
}
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
index 0c55c2e..57b6d16 100644
--- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
@@ -334,6 +334,9 @@ namespace OpenSim.Services.Connectors.Hypergrid
UInt32.TryParse((string)hash["http_port"], out p);
region.HttpPort = p;
}
+ if (hash.ContainsKey("server_uri") && hash["server_uri"] != null)
+ region.ServerURI = (string)hash["server_uri"];
+
if (hash["internal_port"] != null)
{
int p = 0;
--
cgit v1.1
From 6974596e83b9029b30913e8e0ed71cbe1da46358 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Thu, 29 Dec 2011 12:34:57 -0800
Subject: Fixed mix-up in UserAccount fields when passing UserAccounts
remotely.
---
OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
index ab383ef..3fd69ae 100644
--- a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
@@ -231,7 +231,7 @@ namespace OpenSim.Server.Handlers.UserAccounts
int userLevel = 0;
if (request.ContainsKey("UserLevel") && int.TryParse(request["UserLevel"].ToString(), out userLevel))
- existingAccount.UserFlags = userLevel;
+ existingAccount.UserLevel = userLevel;
int userFlags = 0;
if (request.ContainsKey("UserFlags") && int.TryParse(request["UserFlags"].ToString(), out userFlags))
--
cgit v1.1
From ef4d989f37bdfbdc6ae34c4d0fc444341b806296 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Thu, 29 Dec 2011 15:21:56 -0800
Subject: Deleted unused methods from HGAssetBroker
---
.../ServiceConnectorsOut/Asset/HGAssetBroker.cs | 18 ------------------
1 file changed, 18 deletions(-)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
index e31be21..8395f83 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
@@ -382,23 +382,5 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
return result;
}
- #region IHyperAssetService
-
- public string GetUserAssetServer(UUID userID)
- {
- UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, userID);
-
- if (account != null && account.ServiceURLs.ContainsKey("AssetServerURI") && account.ServiceURLs["AssetServerURI"] != null)
- return account.ServiceURLs["AssetServerURI"].ToString();
-
- return string.Empty;
- }
-
- public string GetSimAssetServer()
- {
- return m_LocalAssetServiceURI;
- }
-
- #endregion
}
}
--
cgit v1.1
From 98ab3dffa35a007986a43fd15b9ce93202c92ef5 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Thu, 29 Dec 2011 15:33:04 -0800
Subject: Deleted two obsolete files in Inventory modules.
---
.../Inventory/BaseInventoryConnector.cs | 223 -------------------
.../Inventory/InventoryCache.cs | 237 ---------------------
2 files changed, 460 deletions(-)
delete mode 100644 OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
delete mode 100644 OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
deleted file mode 100644
index dcf08e3..0000000
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System;
-using System.Collections.Generic;
-using OpenMetaverse;
-using Nini.Config;
-using log4net;
-using OpenSim.Framework;
-using OpenSim.Services.Interfaces;
-
-namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
-{
- public abstract class BaseInventoryConnector : IInventoryService
- {
- protected static InventoryCache m_cache;
- private static bool m_Initialized;
-
- protected virtual void Init(IConfigSource source)
- {
- if (!m_Initialized)
- {
- m_cache = new InventoryCache();
- m_cache.Init(source, this);
- m_Initialized = true;
- }
- }
-
- ///
- /// Create the entire inventory for a given user
- ///
- ///
- ///
- public abstract bool CreateUserInventory(UUID user);
-
- ///
- /// Gets the skeleton of the inventory -- folders only
- ///
- ///
- ///
- public abstract List GetInventorySkeleton(UUID userId);
-
- ///
- /// Synchronous inventory fetch.
- ///
- ///
- ///
- public abstract InventoryCollection GetUserInventory(UUID userID);
-
- ///
- /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the
- /// inventory has been received
- ///
- ///
- ///
- public abstract void GetUserInventory(UUID userID, InventoryReceiptCallback callback);
-
- ///
- /// Retrieve the root inventory folder for the given user.
- ///
- ///
- /// null if no root folder was found
- public InventoryFolderBase GetRootFolder(UUID userID)
- {
- // Root folder is here as system type Folder.
- return m_cache.GetFolderForType(userID, AssetType.Folder);
- }
-
- public abstract Dictionary GetSystemFolders(UUID userID);
-
- ///
- /// Gets the user folder for the given folder-type
- ///
- ///
- ///
- ///
- public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
- {
- return m_cache.GetFolderForType(userID, type);
- }
-
- ///
- /// Gets everything (folders and items) inside a folder
- ///
- ///
- ///
- ///
- public abstract InventoryCollection GetFolderContent(UUID userID, UUID folderID);
-
- ///
- /// Gets the items inside a folder
- ///
- ///
- ///
- ///
- public abstract List GetFolderItems(UUID userID, UUID folderID);
-
- ///
- /// Add a new folder to the user's inventory
- ///
- ///
- /// true if the folder was successfully added
- public abstract bool AddFolder(InventoryFolderBase folder);
-
- ///
- /// Update a folder in the user's inventory
- ///
- ///
- /// true if the folder was successfully updated
- public abstract bool UpdateFolder(InventoryFolderBase folder);
-
- ///
- /// Move an inventory folder to a new location
- ///
- /// A folder containing the details of the new location
- /// true if the folder was successfully moved
- public abstract bool MoveFolder(InventoryFolderBase folder);
-
- ///
- /// Delete a list of inventory folders (from trash)
- ///
- public abstract bool DeleteFolders(UUID ownerID, List folderIDs);
-
- ///
- /// Purge an inventory folder of all its items and subfolders.
- ///
- ///
- /// true if the folder was successfully purged
- public abstract bool PurgeFolder(InventoryFolderBase folder);
-
- ///
- /// Add a new item to the user's inventory.
- /// If the given item has to parent folder, it tries to find the most
- /// suitable folder for it.
- ///
- ///
- /// true if the item was successfully added
- public bool AddItem(InventoryItemBase item)
- {
- if (item == null)
- return false;
-
- if (item.Folder == UUID.Zero)
- {
- InventoryFolderBase f = GetFolderForType(item.Owner, (AssetType)item.AssetType);
- if (f != null)
- item.Folder = f.ID;
- else
- {
- f = GetRootFolder(item.Owner);
- if (f != null)
- item.Folder = f.ID;
- else
- return false;
- }
- }
-
- return AddItemPlain(item);
- }
-
- protected abstract bool AddItemPlain(InventoryItemBase item);
-
- ///
- /// Update an item in the user's inventory
- ///
- ///
- /// true if the item was successfully updated
- public abstract bool UpdateItem(InventoryItemBase item);
-
- public abstract bool MoveItems(UUID ownerID, List items);
-
- ///
- /// Delete an item from the user's inventory
- ///
- ///
- /// true if the item was successfully deleted
- public abstract bool DeleteItems(UUID ownerID, List itemIDs);
-
- public abstract InventoryItemBase GetItem(InventoryItemBase item);
-
- public abstract InventoryFolderBase GetFolder(InventoryFolderBase folder);
-
- ///
- /// Does the given user have an inventory structure?
- ///
- ///
- ///
- public abstract bool HasInventoryForUser(UUID userID);
-
- ///
- /// Get the active gestures of the agent.
- ///
- ///
- ///
- public abstract List GetActiveGestures(UUID userId);
-
- public abstract int GetAssetPermissions(UUID userID, UUID assetID);
- }
-}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
deleted file mode 100644
index 2322d7c..0000000
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-
-using OpenSim.Framework;
-using OpenSim.Framework.Client;
-using OpenSim.Region.Framework.Scenes;
-
-using OpenMetaverse;
-using Nini.Config;
-using log4net;
-
-namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
-{
- public class InventoryCache
- {
- private static readonly ILog m_log =
- LogManager.GetLogger(
- MethodBase.GetCurrentMethod().DeclaringType);
-
- protected BaseInventoryConnector m_Connector;
- protected List m_Scenes;
-
- // The cache proper
- protected Dictionary> m_InventoryCache;
-
- // A cache of userIDs --> ServiceURLs, for HGBroker only
- protected Dictionary m_InventoryURLs =
- new Dictionary();
-
- public virtual void Init(IConfigSource source, BaseInventoryConnector connector)
- {
- m_Scenes = new List();
- m_InventoryCache = new Dictionary>();
- m_Connector = connector;
- }
-
- public virtual void AddRegion(Scene scene)
- {
- m_Scenes.Add(scene);
- scene.EventManager.OnMakeRootAgent += OnMakeRootAgent;
- scene.EventManager.OnClientClosed += OnClientClosed;
- }
-
- public virtual void RemoveRegion(Scene scene)
- {
- if ((m_Scenes != null) && m_Scenes.Contains(scene))
- {
- m_Scenes.Remove(scene);
- }
- }
-
- void OnMakeRootAgent(ScenePresence presence)
- {
- // Get system folders
-
- // First check if they're here already
- lock (m_InventoryCache)
- {
- if (m_InventoryCache.ContainsKey(presence.UUID))
- {
- m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent, system folders for {0} {1} already in cache", presence.Firstname, presence.Lastname);
- return;
- }
- }
-
- // If not, go get them and place them in the cache
- Dictionary folders = CacheSystemFolders(presence.UUID);
- CacheInventoryServiceURL(presence.Scene, presence.UUID);
-
- m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}",
- presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count);
-
- }
-
- void OnClientClosed(UUID clientID, Scene scene)
- {
- if (m_InventoryCache.ContainsKey(clientID)) // if it's still in cache
- {
- ScenePresence sp = null;
- foreach (Scene s in m_Scenes)
- {
- s.TryGetScenePresence(clientID, out sp);
- if ((sp != null) && !sp.IsChildAgent && (s != scene))
- {
- m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, but user {1} still in sim. Keeping system folders in cache",
- scene.RegionInfo.RegionName, clientID);
- return;
- }
- }
-
- m_log.DebugFormat(
- "[INVENTORY CACHE]: OnClientClosed in {0}, user {1} out of sim. Dropping system folders",
- scene.RegionInfo.RegionName, clientID);
- DropCachedSystemFolders(clientID);
- DropInventoryServiceURL(clientID);
- }
- }
-
- ///
- /// Cache a user's 'system' folders.
- ///
- ///
- /// Folders cached
- protected Dictionary CacheSystemFolders(UUID userID)
- {
- // If not, go get them and place them in the cache
- Dictionary folders = m_Connector.GetSystemFolders(userID);
-
- if (folders.Count > 0)
- lock (m_InventoryCache)
- m_InventoryCache.Add(userID, folders);
-
- return folders;
- }
-
- ///
- /// Drop a user's cached 'system' folders
- ///
- ///
- protected void DropCachedSystemFolders(UUID userID)
- {
- // Drop system folders
- lock (m_InventoryCache)
- if (m_InventoryCache.ContainsKey(userID))
- m_InventoryCache.Remove(userID);
- }
-
- ///
- /// Get the system folder for a particular asset type
- ///
- ///
- ///
- ///
- public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
- {
- m_log.DebugFormat("[INVENTORY CACHE]: Getting folder for asset type {0} for user {1}", type, userID);
-
- Dictionary folders = null;
-
- lock (m_InventoryCache)
- {
- m_InventoryCache.TryGetValue(userID, out folders);
-
- // In some situations (such as non-secured standalones), system folders can be requested without
- // the user being logged in. So we need to try caching them here if we don't already have them.
- if (null == folders)
- CacheSystemFolders(userID);
-
- m_InventoryCache.TryGetValue(userID, out folders);
- }
-
- if ((folders != null) && folders.ContainsKey(type))
- {
- m_log.DebugFormat(
- "[INVENTORY CACHE]: Returning folder {0} as type {1} for {2}", folders[type], type, userID);
-
- return folders[type];
- }
-
- m_log.WarnFormat("[INVENTORY CACHE]: Could not find folder for system type {0} for {1}", type, userID);
-
- return null;
- }
-
- ///
- /// Gets the user's inventory URL from its serviceURLs, if the user is foreign,
- /// and sticks it in the cache
- ///
- ///
- private void CacheInventoryServiceURL(Scene scene, UUID userID)
- {
- if (scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, userID) == null)
- {
- // The user does not have a local account; let's cache its service URL
- string inventoryURL = string.Empty;
- ScenePresence sp = null;
- scene.TryGetScenePresence(userID, out sp);
- if (sp != null)
- {
- AgentCircuitData aCircuit = scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
- if (aCircuit.ServiceURLs.ContainsKey("InventoryServerURI"))
- {
- inventoryURL = aCircuit.ServiceURLs["InventoryServerURI"].ToString();
- if (inventoryURL != null && inventoryURL != string.Empty)
- {
- inventoryURL = inventoryURL.Trim(new char[] { '/' });
- m_InventoryURLs.Add(userID, inventoryURL);
- }
- }
- }
- }
- }
-
- private void DropInventoryServiceURL(UUID userID)
- {
- lock (m_InventoryURLs)
- if (m_InventoryURLs.ContainsKey(userID))
- m_InventoryURLs.Remove(userID);
- }
-
- public string GetInventoryServiceURL(UUID userID)
- {
- if (m_InventoryURLs.ContainsKey(userID))
- return m_InventoryURLs[userID];
-
- return null;
- }
- }
-}
--
cgit v1.1
From 42f5394677a0a033e501f343cc3ccf02627e09d8 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Thu, 29 Dec 2011 15:39:12 -0800
Subject: Added field LocalToGrid in UserAccount. Context: make HG work in
Simian.
---
OpenSim/Services/Interfaces/IUserAccountService.cs | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/OpenSim/Services/Interfaces/IUserAccountService.cs b/OpenSim/Services/Interfaces/IUserAccountService.cs
index 6cc8eb8..4f80549 100644
--- a/OpenSim/Services/Interfaces/IUserAccountService.cs
+++ b/OpenSim/Services/Interfaces/IUserAccountService.cs
@@ -37,11 +37,13 @@ namespace OpenSim.Services.Interfaces
{
public UserAccount()
{
+ LocalToGrid = true;
}
public UserAccount(UUID principalID)
{
PrincipalID = principalID;
+ LocalToGrid = true;
}
///
@@ -70,6 +72,7 @@ namespace OpenSim.Services.Interfaces
Email = email;
ServiceURLs = new Dictionary();
Created = Util.UnixTimeSinceEpoch();
+ LocalToGrid = true;
}
public UserAccount(UUID scopeID, UUID principalID, string firstName, string lastName, string email)
@@ -81,6 +84,7 @@ namespace OpenSim.Services.Interfaces
Email = email;
ServiceURLs = new Dictionary();
Created = Util.UnixTimeSinceEpoch();
+ LocalToGrid = true;
}
public string FirstName;
@@ -91,6 +95,7 @@ namespace OpenSim.Services.Interfaces
public int UserLevel;
public int UserFlags;
public string UserTitle;
+ public Boolean LocalToGrid;
public Dictionary ServiceURLs;
@@ -119,6 +124,8 @@ namespace OpenSim.Services.Interfaces
UserFlags = Convert.ToInt32(kvp["UserFlags"].ToString());
if (kvp.ContainsKey("UserTitle"))
UserTitle = kvp["UserTitle"].ToString();
+ if (kvp.ContainsKey("LocalToGrid"))
+ Boolean.TryParse(kvp["LocalToGrid"].ToString(), out LocalToGrid);
if (kvp.ContainsKey("Created"))
Created = Convert.ToInt32(kvp["Created"].ToString());
@@ -152,6 +159,7 @@ namespace OpenSim.Services.Interfaces
result["UserLevel"] = UserLevel.ToString();
result["UserFlags"] = UserFlags.ToString();
result["UserTitle"] = UserTitle;
+ result["LocalToGrid"] = LocalToGrid.ToString();
string str = string.Empty;
foreach (KeyValuePair kvp in ServiceURLs)
--
cgit v1.1
From 571efeddb20f38bb4164074b3c217be5387ca2e0 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Thu, 29 Dec 2011 16:12:06 -0800
Subject: Added UserManagementModule.IsLocalGridUser(UUID) to be used
throughout region Scenes and Modules. Changed existing modules to use it
instead of assuming that foreign = null account.
---
.../CoreModules/Avatar/Friends/HGFriendsModule.cs | 81 ++++++++++++++++------
.../InstantMessage/HGMessageTransferModule.cs | 3 +-
.../EntityTransfer/HGEntityTransferModule.cs | 7 +-
.../InventoryAccess/HGInventoryAccessModule.cs | 10 +--
.../UserManagement/UserManagementModule.cs | 9 +++
.../Inventory/HGInventoryBroker.cs | 4 +-
.../Region/Framework/Interfaces/IUserManagement.cs | 2 +
7 files changed, 80 insertions(+), 36 deletions(-)
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
index 9a97925..a77646c 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
@@ -50,6 +50,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+ IUserManagement m_uMan;
+ IUserManagement UserManagementModule
+ {
+ get
+ {
+ if (m_uMan == null)
+ m_uMan = m_Scenes[0].RequestModuleInterface();
+ return m_uMan;
+ }
+ }
+
#region ISharedRegionModule
public override string Name
{
@@ -369,9 +380,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
protected override FriendInfo[] GetFriendsFromService(IClientAPI client)
{
// m_log.DebugFormat("[HGFRIENDS MODULE]: Entering GetFriendsFromService for {0}", client.Name);
+ Boolean agentIsLocal = true;
+ if (UserManagementModule != null)
+ agentIsLocal = UserManagementModule.IsLocalGridUser(client.AgentId);
- UserAccount account1 = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, client.AgentId);
- if (account1 != null)
+ if (agentIsLocal)
return base.GetFriendsFromService(client);
FriendInfo[] finfos = new FriendInfo[0];
@@ -392,16 +405,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
protected override bool StoreRights(UUID agentID, UUID friendID, int rights)
{
- UserAccount account1 = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, agentID);
- UserAccount account2 = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, friendID);
+ Boolean agentIsLocal = true;
+ Boolean friendIsLocal = true;
+ if (UserManagementModule != null)
+ {
+ agentIsLocal = UserManagementModule.IsLocalGridUser(agentID);
+ friendIsLocal = UserManagementModule.IsLocalGridUser(friendID);
+ }
+
// Are they both local users?
- if (account1 != null && account2 != null)
+ if (agentIsLocal && friendIsLocal)
{
// local grid users
return base.StoreRights(agentID, friendID, rights);
}
- if (account1 != null) // agent is local, friend is foreigner
+ if (agentIsLocal) // agent is local, friend is foreigner
{
FriendInfo[] finfos = GetFriends(agentID);
FriendInfo finfo = GetFriend(finfos, friendID);
@@ -412,7 +431,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
}
}
- if (account2 != null) // agent is foreigner, friend is local
+ if (friendIsLocal) // agent is foreigner, friend is local
{
string agentUUI = GetUUI(friendID, agentID);
if (agentUUI != string.Empty)
@@ -427,10 +446,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
protected override void StoreBackwards(UUID friendID, UUID agentID)
{
- UserAccount account1 = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, agentID);
- UserAccount account2 = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, friendID);
+ Boolean agentIsLocal = true;
+ Boolean friendIsLocal = true;
+ if (UserManagementModule != null)
+ {
+ agentIsLocal = UserManagementModule.IsLocalGridUser(agentID);
+ friendIsLocal = UserManagementModule.IsLocalGridUser(friendID);
+ }
+
// Are they both local users?
- if (account1 != null && account2 != null)
+ if (agentIsLocal && friendIsLocal)
{
// local grid users
m_log.DebugFormat("[HGFRIENDS MODULE]: Users are both local");
@@ -444,10 +469,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
protected override void StoreFriendships(UUID agentID, UUID friendID)
{
- UserAccount agentAccount = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, agentID);
- UserAccount friendAccount = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, friendID);
+ Boolean agentIsLocal = true;
+ Boolean friendIsLocal = true;
+ if (UserManagementModule != null)
+ {
+ agentIsLocal = UserManagementModule.IsLocalGridUser(agentID);
+ friendIsLocal = UserManagementModule.IsLocalGridUser(friendID);
+ }
+
// Are they both local users?
- if (agentAccount != null && friendAccount != null)
+ if (agentIsLocal && friendIsLocal)
{
// local grid users
m_log.DebugFormat("[HGFRIENDS MODULE]: Users are both local");
@@ -465,13 +496,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
string agentFriendService = string.Empty;
string friendFriendService = string.Empty;
- if (agentClient != null)
+ if (agentIsLocal)
{
agentClientCircuit = ((Scene)(agentClient.Scene)).AuthenticateHandler.GetAgentCircuitData(agentClient.CircuitCode);
agentUUI = Util.ProduceUserUniversalIdentifier(agentClientCircuit);
agentFriendService = agentClientCircuit.ServiceURLs["FriendsServerURI"].ToString();
}
- if (friendClient != null)
+ if (friendIsLocal)
{
friendClientCircuit = ((Scene)(friendClient.Scene)).AuthenticateHandler.GetAgentCircuitData(friendClient.CircuitCode);
friendUUI = Util.ProduceUserUniversalIdentifier(friendClientCircuit);
@@ -484,7 +515,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
// Generate a random 8-character hex number that will sign this friendship
string secret = UUID.Random().ToString().Substring(0, 8);
- if (agentAccount != null) // agent is local, 'friend' is foreigner
+ if (agentIsLocal) // agent is local, 'friend' is foreigner
{
// This may happen when the agent returned home, in which case the friend is not there
// We need to look for its information in the friends list itself
@@ -520,7 +551,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
friendsConn.NewFriendship(friendID, agentUUI + ";" + secret);
}
}
- else if (friendAccount != null) // 'friend' is local, agent is foreigner
+ else if (friendIsLocal) // 'friend' is local, agent is foreigner
{
// store in the local friends service a reference to the foreign agent
FriendsService.StoreFriend(friendID.ToString(), agentUUI + ";" + secret, 1);
@@ -553,10 +584,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
protected override bool DeleteFriendship(UUID agentID, UUID exfriendID)
{
- UserAccount agentAccount = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, agentID);
- UserAccount friendAccount = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, exfriendID);
+ Boolean agentIsLocal = true;
+ Boolean friendIsLocal = true;
+ if (UserManagementModule != null)
+ {
+ agentIsLocal = UserManagementModule.IsLocalGridUser(agentID);
+ friendIsLocal = UserManagementModule.IsLocalGridUser(exfriendID);
+ }
+
// Are they both local users?
- if (agentAccount != null && friendAccount != null)
+ if (agentIsLocal && friendIsLocal)
{
// local grid users
return base.DeleteFriendship(agentID, exfriendID);
@@ -566,7 +603,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
string agentUUI = string.Empty;
string friendUUI = string.Empty;
- if (agentAccount != null) // agent is local, 'friend' is foreigner
+ if (agentIsLocal) // agent is local, 'friend' is foreigner
{
// We need to look for its information in the friends list itself
FriendInfo[] finfos = GetFriends(agentID);
@@ -587,7 +624,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
return true;
}
}
- else if (friendAccount != null) // agent is foreigner, 'friend' is local
+ else if (friendIsLocal) // agent is foreigner, 'friend' is local
{
agentUUI = GetUUI(exfriendID, agentID);
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs
index 560d913..bf1d787 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs
@@ -180,10 +180,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
// m_log.DebugFormat("[HG INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID);
// Is the user a local user?
- UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, toAgentID);
string url = string.Empty;
bool foreigner = false;
- if (account == null) // foreign user
+ if (UserManagementModule != null && !UserManagementModule.IsLocalGridUser(toAgentID)) // foreign user
{
url = UserManagementModule.GetUserServerURL(toAgentID, "IMServerURI");
foreigner = true;
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 841363c..8d41728 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -187,8 +187,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName);
// Let's find out if this is a foreign user or a local user
- UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, id);
- if (account != null)
+ IUserManagement uMan = m_aScene.RequestModuleInterface();
+ if (uMan != null && uMan.IsLocalGridUser(id))
{
// local grid user
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local");
@@ -313,8 +313,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
}
// Let's find out if this is a foreign user or a local user
+ IUserManagement uMan = m_aScene.RequestModuleInterface();
UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, obj.AgentId);
- if (account != null)
+ if (uMan != null && uMan.IsLocalGridUser(obj.AgentId))
{
// local grid user
return;
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
index 49d484b..bf24ebc 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
@@ -124,8 +124,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
protected override string GenerateLandmark(ScenePresence presence, out string prefix, out string suffix)
{
- UserAccount account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, presence.UUID);
- if (account == null)
+ if (UserManagementModule != null && !UserManagementModule.IsLocalGridUser(presence.UUID))
prefix = "HG ";
else
prefix = string.Empty;
@@ -210,12 +209,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
public override bool IsForeignUser(UUID userID, out string assetServerURL)
{
assetServerURL = string.Empty;
- UserAccount account = null;
- if (m_Scene.UserAccountService != null)
- account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID);
- if (account == null) // foreign
- {
+ if (UserManagementModule != null && !UserManagementModule.IsLocalGridUser(userID))
+ { // foreign
ScenePresence sp = null;
if (m_Scene.TryGetScenePresence(userID, out sp))
{
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index a40a6a4..dbe2560 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -425,6 +425,15 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
//}
+ public bool IsLocalGridUser(UUID uuid)
+ {
+ UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, uuid);
+ if (account == null || (account != null && !account.LocalToGrid))
+ return false;
+
+ return true;
+ }
+
#endregion IUserManagement
private void HandleShowUsers(string module, string[] cmd)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index 0d121ed..b5c0af6 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -218,9 +218,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
///
private void CacheInventoryServiceURL(UUID userID)
{
- if (m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, userID) == null)
+ if (UserManagementModule != null && !UserManagementModule.IsLocalGridUser(userID))
{
- // The user does not have a local account; let's cache its service URL
+ // The user is not local; let's cache its service URL
string inventoryURL = string.Empty;
ScenePresence sp = null;
foreach (Scene scene in m_Scenes)
diff --git a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
index c66e053..ea0ba593 100644
--- a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
+++ b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
@@ -48,5 +48,7 @@ namespace OpenSim.Region.Framework.Interfaces
///
///
void AddUser(UUID uuid, string firstName, string lastName, string profileURL);
+
+ bool IsLocalGridUser(UUID uuid);
}
}
--
cgit v1.1
From 967ea519800a5a6b3bfba586172a218e545c2009 Mon Sep 17 00:00:00 2001
From: Mic Bowman
Date: Thu, 29 Dec 2011 16:37:16 -0800
Subject: Set the local grid flag in the user account through the simian
connector This should make bi-directional hypergrid work.
---
.../Connectors/SimianGrid/SimianUserAccountServiceConnector.cs | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
index 91e2976..4350749 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
@@ -287,6 +287,10 @@ namespace OpenSim.Services.Connectors.SimianGrid
account.UserFlags = response["UserFlags"].AsInteger();
account.UserLevel = response["AccessLevel"].AsInteger();
account.UserTitle = response["UserTitle"].AsString();
+ account.LocalToGrid = true;
+ if (response.ContainsKey("LocalToGrid"))
+ account.LocalToGrid = (response["LocalToGrid"].AsString() == "true" ? true : false);
+
GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName);
// Cache the user account info
--
cgit v1.1
From 5aad1f7afed9770b94b4cabdd2f681781a16d662 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Fri, 30 Dec 2011 10:40:57 -0800
Subject: Default LocalToGrid to true. Fixes minor bug introduced yesterday
where old robust UserAccount service would result is LocalToGrid at the sim
being false.
---
OpenSim/Services/Interfaces/IUserAccountService.cs | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/OpenSim/Services/Interfaces/IUserAccountService.cs b/OpenSim/Services/Interfaces/IUserAccountService.cs
index 4f80549..1b85980 100644
--- a/OpenSim/Services/Interfaces/IUserAccountService.cs
+++ b/OpenSim/Services/Interfaces/IUserAccountService.cs
@@ -37,13 +37,11 @@ namespace OpenSim.Services.Interfaces
{
public UserAccount()
{
- LocalToGrid = true;
}
public UserAccount(UUID principalID)
{
PrincipalID = principalID;
- LocalToGrid = true;
}
///
@@ -72,7 +70,6 @@ namespace OpenSim.Services.Interfaces
Email = email;
ServiceURLs = new Dictionary();
Created = Util.UnixTimeSinceEpoch();
- LocalToGrid = true;
}
public UserAccount(UUID scopeID, UUID principalID, string firstName, string lastName, string email)
@@ -84,7 +81,6 @@ namespace OpenSim.Services.Interfaces
Email = email;
ServiceURLs = new Dictionary();
Created = Util.UnixTimeSinceEpoch();
- LocalToGrid = true;
}
public string FirstName;
@@ -95,7 +91,7 @@ namespace OpenSim.Services.Interfaces
public int UserLevel;
public int UserFlags;
public string UserTitle;
- public Boolean LocalToGrid;
+ public Boolean LocalToGrid = true;
public Dictionary ServiceURLs;
--
cgit v1.1
From 5d8ed077bc01b46cdd4a6854cc08c735ebb66c24 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Fri, 30 Dec 2011 19:17:35 -0800
Subject: Bring back the Hyperlinker to the Robust console. Moved the config to
[GridService]. Changed all HG-related .inis, including HyperSimianGrid. No
changes in user-facing inis.
---
OpenSim/Services/GridService/HypergridLinker.cs | 55 +++++++++++--------------
bin/Robust.HG.ini.example | 2 +
bin/config-include/GridHypergrid.ini | 2 +-
bin/config-include/HyperSimianGrid.ini | 2 +-
bin/config-include/StandaloneHypergrid.ini | 2 +-
5 files changed, 30 insertions(+), 33 deletions(-)
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index 90c022f..78eab3d 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -102,50 +102,45 @@ namespace OpenSim.Services.GridService
public HypergridLinker(IConfigSource config, GridService gridService, IRegionData db)
{
- IConfig modulesConfig = config.Configs["Modules"];
- if (modulesConfig == null)
- return;
-
- if (modulesConfig.GetString("HypergridLinker", "") != "HypergridLinker")
- return;
+ IConfig gridConfig = config.Configs["GridService"];
+ if (gridConfig == null)
+ return;
- m_log.DebugFormat("[HYPERGRID LINKER]: Starting with db {0}", db.GetType());
+ if (!gridConfig.GetBoolean("HypergridLinker", false))
+ return;
m_Database = db;
m_GridService = gridService;
+ m_log.DebugFormat("[HYPERGRID LINKER]: Starting with db {0}", db.GetType());
- IConfig gridConfig = config.Configs["GridService"];
- if (gridConfig != null)
- {
- string assetService = gridConfig.GetString("AssetService", string.Empty);
+ string assetService = gridConfig.GetString("AssetService", string.Empty);
- Object[] args = new Object[] { config };
+ Object[] args = new Object[] { config };
- if (assetService != string.Empty)
- m_AssetService = ServerUtils.LoadPlugin(assetService, args);
+ if (assetService != string.Empty)
+ m_AssetService = ServerUtils.LoadPlugin(assetService, args);
- string scope = gridConfig.GetString("ScopeID", string.Empty);
- if (scope != string.Empty)
- UUID.TryParse(scope, out m_ScopeID);
+ string scope = gridConfig.GetString("ScopeID", string.Empty);
+ if (scope != string.Empty)
+ UUID.TryParse(scope, out m_ScopeID);
// m_Check4096 = gridConfig.GetBoolean("Check4096", true);
- m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles");
+ m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles");
- m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", string.Empty);
- try
- {
- m_ThisGatekeeperURI = new Uri(m_ThisGatekeeper);
- }
- catch
- {
- m_log.WarnFormat("[HYPERGRID LINKER]: Malformed URL in [GridService], variable Gatekeeper = {0}", m_ThisGatekeeper);
- }
+ m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", string.Empty);
+ try
+ {
+ m_ThisGatekeeperURI = new Uri(m_ThisGatekeeper);
+ }
+ catch
+ {
+ m_log.WarnFormat("[HYPERGRID LINKER]: Malformed URL in [GridService], variable Gatekeeper = {0}", m_ThisGatekeeper);
+ }
- m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService);
+ m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService);
- m_log.Debug("[HYPERGRID LINKER]: Loaded all services...");
- }
+ m_log.Debug("[HYPERGRID LINKER]: Loaded all services...");
if (!string.IsNullOrEmpty(m_MapTileDirectory))
{
diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example
index eee7dc8..49ee41a 100644
--- a/bin/Robust.HG.ini.example
+++ b/bin/Robust.HG.ini.example
@@ -82,6 +82,8 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
; *
[GridService]
LocalServiceModule = "OpenSim.Services.GridService.dll:GridService"
+ HypergridLinker = true
+
; Realm = "regions"
; AllowDuplicateNames = "True"
diff --git a/bin/config-include/GridHypergrid.ini b/bin/config-include/GridHypergrid.ini
index 4c32498..5f0ba37 100644
--- a/bin/config-include/GridHypergrid.ini
+++ b/bin/config-include/GridHypergrid.ini
@@ -26,7 +26,6 @@
LandServices = "RemoteLandServicesConnector"
FriendsModule = "HGFriendsModule"
MapImageService = "MapImageServiceModule"
- HypergridLinker = "HypergridLinker"
LandServiceInConnector = true
NeighbourServiceInConnector = true
@@ -60,6 +59,7 @@
; Needed to display non-default map tile images for linked regions
AssetService = "OpenSim.Services.Connectors.dll:AssetServicesConnector"
+ HypergridLinker = true
AllowHypergridMapSearch = true
[LibraryService]
diff --git a/bin/config-include/HyperSimianGrid.ini b/bin/config-include/HyperSimianGrid.ini
index ec4efc0..99a589c 100644
--- a/bin/config-include/HyperSimianGrid.ini
+++ b/bin/config-include/HyperSimianGrid.ini
@@ -40,7 +40,6 @@
LibraryModule = false
AssetCaching = "FlotsamAssetCache"
- HypergridLinker = "HypergridLinker"
[SimulationDataStore]
LocalServiceModule = "OpenSim.Services.Connectors.dll:SimulationDataService"
@@ -56,6 +55,7 @@
StorageProvider = "OpenSim.Data.Null.dll:NullRegionData"
NetworkConnector = "OpenSim.Services.Connectors.dll:SimianGridServiceConnector"
+ HypergridLinker = true
AllowHypergridMapSearch = true
[LibraryService]
diff --git a/bin/config-include/StandaloneHypergrid.ini b/bin/config-include/StandaloneHypergrid.ini
index f8c258a..00beb31 100644
--- a/bin/config-include/StandaloneHypergrid.ini
+++ b/bin/config-include/StandaloneHypergrid.ini
@@ -22,7 +22,6 @@
EntityTransferModule = "HGEntityTransferModule"
InventoryAccessModule = "HGInventoryAccessModule"
FriendsModule = "HGFriendsModule"
- HypergridLinker = "HypergridLinker"
InventoryServiceInConnector = true
AssetServiceInConnector = true
@@ -84,6 +83,7 @@
; Needed to display non-default map tile images for remote regions
AssetService = "OpenSim.Services.AssetService.dll:AssetService"
+ HypergridLinker = true
AllowHypergridMapSearch = true
[PresenceService]
--
cgit v1.1
From 56dbcae402000e199e556827944dfdd1bb3a64be Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Fri, 30 Dec 2011 21:32:28 -0800
Subject: Bug fix in map tiles in standalone: the map has been blank since
commit 01ae916bad672722aa62ee712b7b580d6f5f4370 r/17324 (Nov.18, justincc).
But the root cause comes from commit 02e54c57c4901167779f07ed3e89fb1d24ffc22a
Author: Oren Hurvitz Date: 7/22/2011 This is a nasty situation. The map tile
UUID is, in principle, stored authoritatively in RegionSettings. However, it
also needs to be stored in the Grid Service because that's how other sims can
retrieve it to send it in Map Blocks to non-V3 viewers. So every time the
tile image changes, that change needs to propagate to the Grid Service, and
this is done via RegisterRegion (ugh!). Interestingly, this problem didn't
affect grids because by default AllowRemoteDelete is false, so the prior
images aren't being deleted from the asset servers -- but they were not being
correctly updated in the map either, the map was stuck with old images.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 33 +++++++++++++++++++-------------
1 file changed, 20 insertions(+), 13 deletions(-)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index b4972d6..0f84da9 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -710,7 +710,7 @@ namespace OpenSim.Region.Framework.Scenes
if (maptileRefresh != 0)
{
m_mapGenerationTimer.Interval = maptileRefresh * 1000;
- m_mapGenerationTimer.Elapsed += RegenerateMaptile;
+ m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister;
m_mapGenerationTimer.AutoReset = true;
m_mapGenerationTimer.Start();
}
@@ -1647,21 +1647,17 @@ namespace OpenSim.Region.Framework.Scenes
{
m_sceneGridService.SetScene(this);
+ //// Unfortunately this needs to be here and it can't be async.
+ //// The map tile image is stored in RegionSettings, but it also needs to be
+ //// stored in the GridService, because that's what the world map module uses
+ //// to send the map image UUIDs (of other regions) to the viewer...
+ if (m_generateMaptiles)
+ RegenerateMaptile();
+
GridRegion region = new GridRegion(RegionInfo);
string error = GridService.RegisterRegion(RegionInfo.ScopeID, region);
if (error != String.Empty)
- {
throw new Exception(error);
- }
-
- // Generate the maptile asynchronously, because sometimes it can be very slow and we
- // don't want this to delay starting the region.
- if (m_generateMaptiles)
- {
- Util.FireAndForget(delegate {
- RegenerateMaptile(null, null);
- });
- }
}
#endregion
@@ -5032,13 +5028,24 @@ namespace OpenSim.Region.Framework.Scenes
///
///
///
- public void RegenerateMaptile(object sender, ElapsedEventArgs e)
+ private void RegenerateMaptile()
{
IWorldMapModule mapModule = RequestModuleInterface();
if (mapModule != null)
mapModule.GenerateMaptile();
}
+ private void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e)
+ {
+ RegenerateMaptile();
+
+ // We need to propagate the new image UUID to the grid service
+ // so that all simulators can retrieve it
+ string error = GridService.RegisterRegion(RegionInfo.ScopeID, new GridRegion(RegionInfo));
+ if (error != string.Empty)
+ throw new Exception(error);
+ }
+
// This method is called across the simulation connector to
// determine if a given agent is allowed in this region
// AS A ROOT AGENT. Returning false here will prevent them
--
cgit v1.1
From 87374274b9a53003de40828f7eb2906ecd9ed8ed Mon Sep 17 00:00:00 2001
From: BlueWall
Date: Sun, 1 Jan 2012 23:44:46 -0500
Subject: Fix for failed http request status
Thanks "sendapatch" for fixes to llHTTPRequest status reporting.
---
.../Scripting/HttpRequest/ScriptsHttpRequests.cs | 31 ++++++++++++----------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
index 43672d1..8fb5d75 100644
--- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
+++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
@@ -411,8 +411,21 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
}
Request.Timeout = HttpTimeout;
- // execute the request
- response = (HttpWebResponse) Request.GetResponse();
+ try
+ {
+ // execute the request
+ response = (HttpWebResponse) Request.GetResponse();
+ }
+ catch (WebException e)
+ {
+ if (e.Status != WebExceptionStatus.ProtocolError)
+ {
+ throw;
+ }
+ response = (HttpWebResponse)e.Response;
+ }
+
+ Status = (int)response.StatusCode;
Stream resStream = response.GetResponseStream();
@@ -436,17 +449,8 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
}
catch (Exception e)
{
- if (e is WebException && ((WebException)e).Status == WebExceptionStatus.ProtocolError)
- {
- HttpWebResponse webRsp = (HttpWebResponse)((WebException)e).Response;
- Status = (int)webRsp.StatusCode;
- ResponseBody = webRsp.StatusDescription;
- }
- else
- {
- Status = (int)OSHttpStatusCode.ClientErrorJoker;
- ResponseBody = e.Message;
- }
+ Status = (int)OSHttpStatusCode.ClientErrorJoker;
+ ResponseBody = e.Message;
_finished = true;
return;
@@ -457,7 +461,6 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
response.Close();
}
- Status = (int)OSHttpStatusCode.SuccessOk;
_finished = true;
}
--
cgit v1.1
From 014a86c26b138e4fc861fd30634e866b83dbabdb Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 2 Jan 2012 19:46:30 +0000
Subject: Adding commented out log messages and some minor formatting for
future bug hunting. No functional changes.
---
.../WebFetchInvDescHandler.cs | 148 +++++++++++----------
.../ClientStack/Linden/UDP/LLImageManager.cs | 9 +-
.../Agent/TextureSender/J2KDecoderModule.cs | 3 +
.../Asset/LocalAssetServiceConnector.cs | 2 +
OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 1 +
.../Connectors/Asset/AssetServiceConnector.cs | 6 +
6 files changed, 97 insertions(+), 72 deletions(-)
diff --git a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs
index e91a4b8..3ce4e66 100644
--- a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs
+++ b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs
@@ -240,78 +240,84 @@ namespace OpenSim.Capabilities.Handlers
if (containingFolder != null)
{
- version = containingFolder.Version;
+// m_log.DebugFormat(
+// "[WEB FETCH INV DESC HANDLER]: Retrieved folder {0} {1} for agent id {2}",
+// containingFolder.Name, containingFolder.ID, agentID);
- if (fetchItems)
- {
- /*
- List linkedItemsToAdd = new List();
-
- foreach (InventoryItemBase item in contents.Items)
- {
- if (item.AssetType == (int)AssetType.Link)
- {
- InventoryItemBase linkedItem = m_InventoryService.GetItem(new InventoryItemBase(item.AssetID));
-
- // Take care of genuinely broken links where the target doesn't exist
- // HACK: Also, don't follow up links that just point to other links. In theory this is legitimate,
- // but no viewer has been observed to set these up and this is the lazy way of avoiding cycles
- // rather than having to keep track of every folder requested in the recursion.
- if (linkedItem != null && linkedItem.AssetType != (int)AssetType.Link && linkedItem.AssetType == (int)AssetType.Object)
- linkedItemsToAdd.Add(linkedItem);
- }
- }
-
- foreach (InventoryItemBase linkedItem in linkedItemsToAdd)
- {
- m_log.DebugFormat(
- "[WEB FETCH INV DESC HANDLER]: Inserted linked item {0} for link in folder {1} for agent {2}",
- linkedItem.Name, folderID, agentID);
-
- contents.Items.Insert(0, linkedItem);
- }
- */
-
- /*
- // If the folder requested contains links, then we need to send those folders first, otherwise the links
- // will be broken in the viewer.
- HashSet linkedItemFolderIdsToSend = new HashSet();
- foreach (InventoryItemBase item in contents.Items)
- {
- if (item.AssetType == (int)AssetType.Link)
- {
- InventoryItemBase linkedItem = m_InventoryService.GetItem(new InventoryItemBase(item.AssetID));
-
- // Take care of genuinely broken links where the target doesn't exist
- // HACK: Also, don't follow up links that just point to other links. In theory this is legitimate,
- // but no viewer has been observed to set these up and this is the lazy way of avoiding cycles
- // rather than having to keep track of every folder requested in the recursion.
- if (linkedItem != null && linkedItem.AssetType != (int)AssetType.Link)
- {
- // We don't need to send the folder if source and destination of the link are in the same
- // folder.
- if (linkedItem.Folder != containingFolder.ID)
- linkedItemFolderIdsToSend.Add(linkedItem.Folder);
- }
- }
- }
-
- foreach (UUID linkedItemFolderId in linkedItemFolderIdsToSend)
- {
- m_log.DebugFormat(
- "[WEB FETCH INV DESC HANDLER]: Recursively fetching folder {0} linked by item in folder {1} for agent {2}",
- linkedItemFolderId, folderID, agentID);
-
- int dummyVersion;
- InventoryCollection linkedCollection
- = Fetch(
- agentID, linkedItemFolderId, ownerID, fetchFolders, fetchItems, sortOrder, out dummyVersion);
-
- contents.Folders.AddRange(linkedCollection.Folders);
- contents.Items.AddRange(linkedCollection.Items);
- }
- */
- }
+ version = containingFolder.Version;
+//
+// if (fetchItems)
+// {
+// List linkedItemsToAdd = new List();
+//
+// foreach (InventoryItemBase item in contents.Items)
+// {
+// if (item.AssetType == (int)AssetType.Link)
+// {
+// InventoryItemBase linkedItem = m_InventoryService.GetItem(new InventoryItemBase(item.AssetID));
+//
+// // Take care of genuinely broken links where the target doesn't exist
+// // HACK: Also, don't follow up links that just point to other links. In theory this is legitimate,
+// // but no viewer has been observed to set these up and this is the lazy way of avoiding cycles
+// // rather than having to keep track of every folder requested in the recursion.
+// if (linkedItem != null && linkedItem.AssetType != (int)AssetType.Link)
+// linkedItemsToAdd.Insert(0, linkedItem);
+// }
+// }
+//
+// foreach (InventoryItemBase linkedItem in linkedItemsToAdd)
+// {
+// m_log.DebugFormat(
+// "[WEB FETCH INV DESC HANDLER]: Inserted linked item {0} for link in folder {1} for agent {2}",
+// linkedItem.Name, folderID, agentID);
+//
+// contents.Items.Add(linkedItem);
+// }
+//
+// // If the folder requested contains links, then we need to send those folders first, otherwise the links
+// // will be broken in the viewer.
+// HashSet linkedItemFolderIdsToSend = new HashSet();
+// foreach (InventoryItemBase item in contents.Items)
+// {
+// if (item.AssetType == (int)AssetType.Link)
+// {
+// InventoryItemBase linkedItem = m_InventoryService.GetItem(new InventoryItemBase(item.AssetID));
+//
+// // Take care of genuinely broken links where the target doesn't exist
+// // HACK: Also, don't follow up links that just point to other links. In theory this is legitimate,
+// // but no viewer has been observed to set these up and this is the lazy way of avoiding cycles
+// // rather than having to keep track of every folder requested in the recursion.
+// if (linkedItem != null && linkedItem.AssetType != (int)AssetType.Link)
+// {
+// // We don't need to send the folder if source and destination of the link are in the same
+// // folder.
+// if (linkedItem.Folder != containingFolder.ID)
+// linkedItemFolderIdsToSend.Add(linkedItem.Folder);
+// }
+// }
+// }
+//
+// foreach (UUID linkedItemFolderId in linkedItemFolderIdsToSend)
+// {
+// m_log.DebugFormat(
+// "[WEB FETCH INV DESC HANDLER]: Recursively fetching folder {0} linked by item in folder {1} for agent {2}",
+// linkedItemFolderId, folderID, agentID);
+//
+// int dummyVersion;
+// InventoryCollection linkedCollection
+// = Fetch(
+// agentID, linkedItemFolderId, ownerID, fetchFolders, fetchItems, sortOrder, out dummyVersion);
+//
+// InventoryFolderBase linkedFolder = new InventoryFolderBase(linkedItemFolderId);
+// linkedFolder.Owner = agentID;
+// linkedFolder = m_InventoryService.GetFolder(linkedFolder);
+//
+//// contents.Folders.AddRange(linkedCollection.Folders);
+//
+// contents.Folders.Add(linkedFolder);
+// contents.Items.AddRange(linkedCollection.Items);
+// }
+// }
}
}
else
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
index 9e0db12..5c4a662 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
@@ -39,6 +39,9 @@ using log4net;
namespace OpenSim.Region.ClientStack.LindenUDP
{
+ ///
+ /// This class handles UDP texture requests.
+ ///
public class LLImageManager
{
private sealed class J2KImageComparer : IComparer
@@ -228,15 +231,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
image.PriorityQueueHandle = null;
lock (m_syncRoot)
+ {
try { m_priorityQueue.Add(ref image.PriorityQueueHandle, image); }
catch (Exception) { }
+ }
}
void RemoveImageFromQueue(J2KImage image)
{
lock (m_syncRoot)
+ {
try { m_priorityQueue.Delete(image.PriorityQueueHandle); }
catch (Exception) { }
+ }
}
void UpdateImageInQueue(J2KImage image)
@@ -254,4 +261,4 @@ namespace OpenSim.Region.ClientStack.LindenUDP
#endregion Priority Queue Helpers
}
-}
+}
\ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
index 1386e86..7dd9087 100644
--- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
@@ -152,6 +152,9 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
/// JPEG2000 data
private void DoJ2KDecode(UUID assetID, byte[] j2kData)
{
+// m_log.DebugFormat(
+// "[J2KDecoderModule]: Doing J2K decoding of {0} bytes for asset {1}", j2kData.Length, assetID);
+
//int DecodeTime = 0;
//DecodeTime = Environment.TickCount;
OpenJPEG.J2KLayerInfo[] layers;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
index cc5d061..2e6ec90 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
@@ -170,6 +170,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
public AssetBase GetCached(string id)
{
+// m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Cache request for {0}", id);
+
if (m_Cache != null)
return m_Cache.Get(id);
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index 2194ff0..228eca9 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -2822,6 +2822,7 @@ namespace OpenSim.Region.Physics.OdePlugin
m_global_contactcount = 0;
d.WorldQuickStep(world, ODE_STEPSIZE);
+
d.JointGroupEmpty(contactgroup);
}
catch (Exception e)
diff --git a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs
index fdab254..d7b2ff8 100644
--- a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs
@@ -100,6 +100,8 @@ namespace OpenSim.Services.Connectors
public AssetBase Get(string id)
{
+// m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Synchronous get request for {0}", id);
+
string uri = m_ServerURI + "/assets/" + id;
AssetBase asset = null;
@@ -119,6 +121,8 @@ namespace OpenSim.Services.Connectors
public AssetBase GetCached(string id)
{
+// m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Cache request for {0}", id);
+
if (m_Cache != null)
return m_Cache.Get(id);
@@ -177,6 +181,8 @@ namespace OpenSim.Services.Connectors
public bool Get(string id, Object sender, AssetRetrieved handler)
{
+// m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Potentially asynchronous get request for {0}", id);
+
string uri = m_ServerURI + "/assets/" + id;
AssetBase asset = null;
--
cgit v1.1
From fac8c258515c533854549109f14615b8be3ddc15 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 2 Jan 2012 21:31:42 +0000
Subject: Reduce accessibility of some J2KImage/LLImageManager properties and
methods to reduce potential code complexity and make code reading easier.
---
OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs | 16 ++++++++--------
OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs | 8 ++++----
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
index 1dea87e..cb9692a 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
@@ -56,9 +56,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public IAssetService AssetService;
public UUID AgentID;
public IInventoryAccessModule InventoryAccessModule;
- public OpenJPEG.J2KLayerInfo[] Layers;
- public bool IsDecoded;
- public bool HasAsset;
+ private OpenJPEG.J2KLayerInfo[] m_layers;
+ public bool IsDecoded { get; private set; }
+ public bool HasAsset { get; private set; }
public C5.IPriorityQueueHandle PriorityQueueHandle;
private uint m_currentPacket;
@@ -170,14 +170,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (DiscardLevel >= 0 || m_stopPacket == 0)
{
// This shouldn't happen, but if it does, we really can't proceed
- if (Layers == null)
+ if (m_layers == null)
{
m_log.Warn("[J2KIMAGE]: RunUpdate() called with missing Layers. Canceling texture transfer");
m_currentPacket = m_stopPacket;
return;
}
- int maxDiscardLevel = Math.Max(0, Layers.Length - 1);
+ int maxDiscardLevel = Math.Max(0, m_layers.Length - 1);
// Treat initial texture downloads with a DiscardLevel of -1 a request for the highest DiscardLevel
if (DiscardLevel < 0 && m_stopPacket == 0)
@@ -187,9 +187,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
DiscardLevel = (sbyte)Math.Min(DiscardLevel, maxDiscardLevel);
//Calculate the m_stopPacket
- if (Layers.Length > 0)
+ if (m_layers.Length > 0)
{
- m_stopPacket = (uint)GetPacketForBytePosition(Layers[(Layers.Length - 1) - DiscardLevel].End);
+ m_stopPacket = (uint)GetPacketForBytePosition(m_layers[(m_layers.Length - 1) - DiscardLevel].End);
//I don't know why, but the viewer seems to expect the final packet if the file
//is just one packet bigger.
if (TexturePacketCount() == m_stopPacket + 1)
@@ -341,7 +341,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private void J2KDecodedCallback(UUID AssetId, OpenJPEG.J2KLayerInfo[] layers)
{
- Layers = layers;
+ m_layers = layers;
IsDecoded = true;
RunUpdate();
}
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
index 5c4a662..e3a881f 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
@@ -211,7 +211,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
#region Priority Queue Helpers
- J2KImage GetHighestPriorityImage()
+ private J2KImage GetHighestPriorityImage()
{
J2KImage image = null;
@@ -226,7 +226,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return image;
}
- void AddImageToQueue(J2KImage image)
+ private void AddImageToQueue(J2KImage image)
{
image.PriorityQueueHandle = null;
@@ -237,7 +237,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
- void RemoveImageFromQueue(J2KImage image)
+ private void RemoveImageFromQueue(J2KImage image)
{
lock (m_syncRoot)
{
@@ -246,7 +246,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
- void UpdateImageInQueue(J2KImage image)
+ private void UpdateImageInQueue(J2KImage image)
{
lock (m_syncRoot)
{
--
cgit v1.1
From fa79588a20fb4bcc79a24214b7c055efaff97f77 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 3 Jan 2012 15:42:36 +0000
Subject: minor: add missing newlines to pCampbot usage statement
---
OpenSim/Tools/pCampBot/pCampBot.cs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs
index 6249fae..a73fcbe 100644
--- a/OpenSim/Tools/pCampBot/pCampBot.cs
+++ b/OpenSim/Tools/pCampBot/pCampBot.cs
@@ -112,10 +112,10 @@ namespace pCampBot
" -lastname lastname for the bots. Each lastname will have _ appended, e.g. Ima Bot_0\n" +
" -password password for the bots\n" +
" -b, behaviours behaviours for bots. Comma separated, e.g. p,g. Default is p\n" +
- " current options are:" +
- " p (physics)" +
- " g (grab)" +
- " t (teleport)" +
+ " current options are:\n" +
+ " p (physics)\n" +
+ " g (grab)\n" +
+ " t (teleport)\n" +
// " c (cross)" +
" -wear set appearance folder to load from (default: no)\n" +
" -h, -help show this message");
--
cgit v1.1
From 6941058824e418bcdc2932c35f226bbcc5cea2ad Mon Sep 17 00:00:00 2001
From: BlueWall
Date: Sun, 1 Jan 2012 14:57:13 -0500
Subject: Profile Updates
Update basic profile to use the replaceable interface, making configuration less error-prone. Add support to query avatar's home user account and profile service for regions usng the updated OpenProfileModule with Hypergrid.
---
OpenSim/Framework/IProfileModule.cs | 37 +++++++++
.../Avatar/Profile/BasicProfileModule.cs | 12 +--
.../UserManagement/UserManagementModule.cs | 93 ++++++++++++++++++++++
.../Region/Framework/Interfaces/IUserManagement.cs | 3 +
.../Handlers/Hypergrid/UserAgentServerConnector.cs | 33 ++++++++
.../Hypergrid/UserAgentServiceConnector.cs | 54 +++++++++++++
.../Services/HypergridService/UserAgentService.cs | 25 ++++++
OpenSim/Services/Interfaces/IHypergridServices.cs | 1 +
8 files changed, 253 insertions(+), 5 deletions(-)
create mode 100644 OpenSim/Framework/IProfileModule.cs
diff --git a/OpenSim/Framework/IProfileModule.cs b/OpenSim/Framework/IProfileModule.cs
new file mode 100644
index 0000000..ef03d4a
--- /dev/null
+++ b/OpenSim/Framework/IProfileModule.cs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using OpenMetaverse;
+
+namespace OpenSim.Framework
+{
+ public interface IProfileModule
+ {
+ void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID);
+
+ }
+}
diff --git a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs
index dee0ad4..eb1e4b5 100644
--- a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs
@@ -43,7 +43,7 @@ using OpenSim.Services.Interfaces;
namespace OpenSim.Region.CoreModules.Avatar.Profile
{
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
- public class BasicProfileModule : ISharedRegionModule
+ public class BasicProfileModule : IProfileModule, ISharedRegionModule
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -57,6 +57,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
public void Initialise(IConfigSource config)
{
+ // This can be reduced later as the loader will determine
+ // whether we are needed
if (config.Configs["Profile"] != null)
{
if (config.Configs["Profile"].GetString("Module", string.Empty) != "BasicProfileModule")
@@ -65,14 +67,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
m_log.DebugFormat("[PROFILE MODULE]: Basic Profile Module enabled");
m_Enabled = true;
-
}
public void AddRegion(Scene scene)
{
if (!m_Enabled)
return;
-
+
lock (m_Scenes)
{
if (!m_Scenes.Contains(scene))
@@ -80,6 +81,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
m_Scenes.Add(scene);
// Hook up events
scene.EventManager.OnNewClient += OnNewClient;
+ scene.RegisterModuleInterface(this);
}
}
}
@@ -116,7 +118,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
public Type ReplaceableInterface
{
- get { return null; }
+ get { return typeof(IProfileModule); }
}
#endregion
@@ -170,4 +172,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
}
}
-}
\ No newline at end of file
+}
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index dbe2560..37292d6 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -50,6 +50,9 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
public string LastName { get; set; }
public string HomeURL { get; set; }
public Dictionary ServerURLs { get; set; }
+ public string Title { get; set; }
+ public int Flags { get; set; }
+ public int Created { get; set; }
}
public class UserManagementModule : ISharedRegionModule, IUserManagement
@@ -281,6 +284,94 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
return string.Empty;
}
+ public int GetUserFlags(UUID userID)
+ {
+ UserData userdata;
+ lock (m_UserCache)
+ m_UserCache.TryGetValue(userID, out userdata);
+
+ if (userdata.Flags == -1)
+ GetUserInfo(userID);
+
+ if (userdata.Flags != -1)
+ return userdata.Flags;
+
+ return 0;
+ }
+
+ public int GetUserCreated(UUID userID)
+ {
+ UserData userdata;
+ lock (m_UserCache)
+ m_UserCache.TryGetValue(userID, out userdata);
+
+ if (userdata.Flags == -1)
+ GetUserInfo(userID);
+
+ if (userdata.Created != -1)
+ return userdata.Created;
+
+ return 0;
+ }
+
+ public string GetUserTitle(UUID userID)
+ {
+ UserData userdata;
+ lock (m_UserCache)
+ m_UserCache.TryGetValue(userID, out userdata);
+
+ if (userdata.Flags == -1)
+ GetUserInfo(userID);
+
+ if (userdata.Created != -1)
+ return userdata.Title;
+
+ return string.Empty;
+ }
+
+ // This will cache the user data
+ // Change this to return bool
+ private bool GetUserInfo(UUID userID)
+ {
+ UserData userdata;
+ lock (m_UserCache)
+ m_UserCache.TryGetValue(userID, out userdata);
+
+ if (userdata != null)
+ {
+// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Requested url type {0} for {1}", serverType, userID);
+
+ if (userdata.Flags >= 0)
+ {
+ // This is already populated
+ return true;
+ }
+
+ if (userdata.HomeURL != null && userdata.HomeURL != string.Empty)
+ {
+ m_log.DebugFormat(
+ "[USER MANAGEMENT MODULE]: Requesting user flags from '{0}' for {1}",
+ userdata.HomeURL, userID);
+
+ UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL);
+ Dictionary info = uConn.GetUserInfo(userID);
+
+ // Pull our data now
+ if (info["result"].ToString() == "success")
+ {
+ userdata.Flags = (int)info["user_flags"];
+ userdata.Created = (int)info["user_created"];
+ userdata.Title = (string)info["user_title"];
+
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+
public string GetUserUUI(UUID userID)
{
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, userID);
@@ -352,6 +443,8 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
{
UserData user = new UserData();
user.Id = id;
+ user.Flags = -1;
+ user.Created = -1;
if (creatorData != null && creatorData != string.Empty)
{
diff --git a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
index ea0ba593..54dfaf4 100644
--- a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
+++ b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
@@ -14,6 +14,9 @@ namespace OpenSim.Region.Framework.Interfaces
string GetUserHomeURL(UUID uuid);
string GetUserUUI(UUID uuid);
string GetUserServerURL(UUID uuid, string serverType);
+ int GetUserFlags(UUID userID);
+ int GetUserCreated(UUID userID);
+ string GetUserTitle(UUID userID);
///
/// Add a user.
diff --git a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
index 07c6962..1bd3706 100644
--- a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
@@ -91,6 +91,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
server.AddXmlRPCHandler("status_notification", StatusNotification, false);
server.AddXmlRPCHandler("get_online_friends", GetOnlineFriends, false);
+ server.AddXmlRPCHandler("get_user_info", GetUserInfo, false);
server.AddXmlRPCHandler("get_server_urls", GetServerURLs, false);
server.AddXmlRPCHandler("locate_user", LocateUser, false);
@@ -299,6 +300,38 @@ namespace OpenSim.Server.Handlers.Hypergrid
}
+ public XmlRpcResponse GetUserInfo(XmlRpcRequest request, IPEndPoint remoteClient)
+ {
+ Hashtable hash = new Hashtable();
+ Hashtable requestData = (Hashtable)request.Params[0];
+
+ // This needs checking!
+ if (requestData.ContainsKey("userID"))
+ {
+ string userID_str = (string)requestData["userID"];
+ UUID userID = UUID.Zero;
+ UUID.TryParse(userID_str, out userID);
+
+ //int userFlags = m_HomeUsersService.GetUserFlags(userID);
+ Dictionary userInfo = m_HomeUsersService.GetUserInfo(userID);
+ if (userInfo.Count > 0)
+ {
+ foreach (KeyValuePair kvp in userInfo)
+ {
+ hash[kvp.Key] = kvp.Value;
+ }
+ }
+ else
+ {
+ hash["result"] = "failure";
+ }
+ }
+
+ XmlRpcResponse response = new XmlRpcResponse();
+ response.Value = hash;
+ return response;
+ }
+
public XmlRpcResponse GetServerURLs(XmlRpcRequest request, IPEndPoint remoteClient)
{
Hashtable hash = new Hashtable();
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
index 57b6d16..5b27cf6 100644
--- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
@@ -561,6 +561,60 @@ namespace OpenSim.Services.Connectors.Hypergrid
return online;
}
+ public Dictionary GetUserInfo (UUID userID)
+ {
+ Hashtable hash = new Hashtable();
+ hash["userID"] = userID.ToString();
+
+ IList paramList = new ArrayList();
+ paramList.Add(hash);
+
+ XmlRpcRequest request = new XmlRpcRequest("get_user_info", paramList);
+
+ Dictionary info = new Dictionary();
+ XmlRpcResponse response = null;
+ try
+ {
+ response = request.Send(m_ServerURL, 10000);
+ }
+ catch
+ {
+ m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetUserInfo", m_ServerURL);
+ return info;
+ }
+
+ if (response.IsFault)
+ {
+ m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetServerURLs returned an error: {1}", m_ServerURL, response.FaultString);
+ return info;
+ }
+
+ hash = (Hashtable)response.Value;
+ try
+ {
+ if (hash == null)
+ {
+ m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetUserInfo Got null response from {0}! THIS IS BAAAAD", m_ServerURL);
+ return info;
+ }
+
+ // Here is the actual response
+ foreach (object key in hash.Keys)
+ {
+ if (hash[key] != null)
+ {
+ info.Add(key.ToString(), hash[key]);
+ }
+ }
+ }
+ catch
+ {
+ m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetOnlineFriends response.");
+ }
+
+ return info;
+ }
+
public Dictionary GetServerURLs(UUID userID)
{
Hashtable hash = new Hashtable();
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs
index 8538660..f681df4 100644
--- a/OpenSim/Services/HypergridService/UserAgentService.cs
+++ b/OpenSim/Services/HypergridService/UserAgentService.cs
@@ -488,6 +488,31 @@ namespace OpenSim.Services.HypergridService
return online;
}
+ public Dictionary GetUserInfo(UUID userID)
+ {
+ Dictionary info = new Dictionary();
+
+ if (m_UserAccountService == null)
+ {
+ m_log.WarnFormat("[USER AGENT SERVICE]: Unable to get user flags because user account service is missing");
+ info["result"] = "fail";
+ info["message"] = "UserAccountService is missing!";
+ return info;
+ }
+
+ UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero /*!!!*/, userID);
+
+ if (account != null)
+ {
+ info.Add("user_flags", (object)account.UserFlags);
+ info.Add("user_created", (object)account.Created);
+ info.Add("user_title", (object)account.UserTitle);
+ info.Add("result", "success");
+ }
+
+ return info;
+ }
+
public Dictionary GetServerURLs(UUID userID)
{
if (m_UserAccountService == null)
diff --git a/OpenSim/Services/Interfaces/IHypergridServices.cs b/OpenSim/Services/Interfaces/IHypergridServices.cs
index e86ec51..5b293ac 100644
--- a/OpenSim/Services/Interfaces/IHypergridServices.cs
+++ b/OpenSim/Services/Interfaces/IHypergridServices.cs
@@ -55,6 +55,7 @@ namespace OpenSim.Services.Interfaces
void LogoutAgent(UUID userID, UUID sessionID);
GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt);
Dictionary GetServerURLs(UUID userID);
+ Dictionary GetUserInfo(UUID userID);
string LocateUser(UUID userID);
// Tries to get the universal user identifier for the targetUserId
--
cgit v1.1
From 983b49c0c872e997576d7fc167319e28e6f970e3 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 3 Jan 2012 18:25:31 +0000
Subject: commented out "Prevented flyoff" log message for now as this becomes
problematic with bot testing.
Please uncomment if still needed.
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 3d1c1b5..42cd4be 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2844,7 +2844,7 @@ namespace OpenSim.Region.Framework.Scenes
Velocity = Vector3.Zero;
AbsolutePosition = pos;
- m_log.DebugFormat("[SCENE PRESENCE]: Prevented flyoff for {0} at {1}", Name, AbsolutePosition);
+// m_log.DebugFormat("[SCENE PRESENCE]: Prevented flyoff for {0} at {1}", Name, AbsolutePosition);
AddToPhysicalScene(isFlying);
}
--
cgit v1.1
From 6166a40440aaa505e55c5b9a71c8b7ba1daf07e0 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 3 Jan 2012 20:22:15 +0000
Subject: Update C5.dll to version 1.1.1 from 1.1.0
C5 is a collections library and can be found at http://www.itu.dk/research/c5/
This is used in the UDP texture (image) sending code.
---
bin/C5.dll | Bin 272384 -> 276992 bytes
1 file changed, 0 insertions(+), 0 deletions(-)
diff --git a/bin/C5.dll b/bin/C5.dll
index 1234ce9..42093e5 100755
Binary files a/bin/C5.dll and b/bin/C5.dll differ
--
cgit v1.1