Browse Source

For xbuild, in development builds copy mdb files in Lib/**/* so we can debug into AtomicNET from executables

Josh Engebretson 9 years ago
parent
commit
9cbb190c31

+ 11 - 1
Script/AtomicNET/AtomicNET/Script/ScriptVariant.cs

@@ -17,7 +17,17 @@ namespace AtomicEngine
             SetVector3(value);
         }
 
-        public ScriptVariant(Color value) : this()
+		public ScriptVariant(Vector4 value) : this()
+		{
+			SetVector4(value);
+		}
+
+		public ScriptVariant(String value) : this()
+		{
+			SetString(value);
+		}
+
+		public ScriptVariant(Color value) : this()
         {
             SetColor(value);
         }

+ 5 - 1
Source/Atomic/Script/ScriptVariant.h

@@ -67,10 +67,14 @@ namespace Atomic
 
         void SetColor(const Color& value) { variant_ = value; }
 
+        String GetString() { return variant_.GetString(); }
+
+        void SetString(const String& value) { variant_ = value; }
+
     private:
 
         Variant variant_;
 
     };
 
-}
+}

+ 66 - 36
Source/ToolCore/NETTools/NETProjectGen.cpp

@@ -50,7 +50,7 @@ namespace ToolCore
 
     }
 
-    void NETProjectBase::ReplacePathStrings(String& path)
+    void NETProjectBase::ReplacePathStrings(String& path) const
     {
         ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
 
@@ -414,6 +414,29 @@ namespace ToolCore
             constants.Push("ATOMIC_MOBILE");
     }
 
+    String NETCSProject::GetRelativeOutputPath(const String& config) const
+    {
+        String outputPath = assemblyOutputPath_;
+        outputPath.Replace("$ATOMIC_CONFIG$", config);
+
+        if (IsAbsolutePath(outputPath))
+        {
+
+            String atomicProjectPath = projectGen_->GetAtomicProjectPath();
+
+            if (atomicProjectPath.Length())
+            {
+                if (!GetRelativeProjectPath(outputPath, projectPath_, outputPath))
+                {
+                    ATOMIC_LOGERRORF("NETCSProject::CreateReleasePropertyGroup - unable to get relative output path");
+                }
+            }
+        }
+
+        return outputPath;
+
+    }
+
     void NETCSProject::CreateReleasePropertyGroup(XMLElement &projectRoot)
     {
         XMLElement pgroup = projectRoot.CreateChild("PropertyGroup");
@@ -436,22 +459,7 @@ namespace ToolCore
 
 #endif
 
-        String outputPath = assemblyOutputPath_;
-        outputPath.Replace("$ATOMIC_CONFIG$", config);
-
-        if (IsAbsolutePath(outputPath))
-        {
-
-            String atomicProjectPath = projectGen_->GetAtomicProjectPath();
-
-            if (atomicProjectPath.Length())
-            {
-                if (!GetRelativeProjectPath(outputPath, projectPath_, outputPath))
-                {
-                    ATOMIC_LOGERRORF("NETCSProject::CreateReleasePropertyGroup - unable to get relative output path");
-                }
-            }
-        }
+        String outputPath = GetRelativeOutputPath(config);
 
         pgroup.CreateChild("OutputPath").SetValue(outputPath);
 
@@ -553,22 +561,7 @@ namespace ToolCore
 
 #endif
 
-        String outputPath = assemblyOutputPath_;
-        outputPath.Replace("$ATOMIC_CONFIG$", config);
-
-        if (IsAbsolutePath(outputPath))
-        {
-            String atomicProjectPath = projectGen_->GetAtomicProjectPath();
-
-            if (atomicProjectPath.Length())
-            {
-                if (!GetRelativeProjectPath(outputPath, projectPath_, outputPath))
-                {
-                    ATOMIC_LOGERRORF("NETCSProject::CreateDebugPropertyGroup - unable to get relative output path");
-                }
-            }
-
-        }
+        String outputPath = GetRelativeOutputPath(config);
 
         pgroup.CreateChild("OutputPath").SetValue(outputPath);
 
@@ -889,7 +882,7 @@ namespace ToolCore
 
     }
 
-    bool NETCSProject::GetRelativeProjectPath(const String& fromPath, const String& toPath, String& output)
+    bool NETCSProject::GetRelativeProjectPath(const String& fromPath, const String& toPath, String& output) const
     {
         String path = fromPath;
         ReplacePathStrings(path);
@@ -1280,10 +1273,15 @@ namespace ToolCore
         if (projectGen_->GetProjectSettings())
             projectName = projectGen_->GetProjectSettings()->GetName();
 
+        XMLElement afterBuild;
+
         if (name_ == projectName)
         {
-            XMLElement afterBuild = project.CreateChild("Target");
-            afterBuild.SetAttribute("Name", "AfterBuild");
+            if (afterBuild.IsNull())
+            {
+                afterBuild = project.CreateChild("Target");
+                afterBuild.SetAttribute("Name", "AfterBuild");
+            }
 
             XMLElement copy = afterBuild.CreateChild("Copy");
             copy.SetAttribute("SourceFiles", "$(TargetPath)");
@@ -1302,6 +1300,38 @@ namespace ToolCore
 
         }
 
+#ifdef ATOMIC_DEV_BUILD
+#ifndef ATOMIC_PLATFORM_WINDOWS
+
+        // On xbuild, mdb files for references aren't being copied to output folders for desktop
+        if (platforms_.Size() == 1 && SupportsDesktop() && outputType_.ToLower() == "exe")
+        {
+            if (afterBuild.IsNull())
+            {
+                afterBuild = project.CreateChild("Target");
+                afterBuild.SetAttribute("Name", "AfterBuild");
+            }
+
+            // mdb file item group
+            XMLElement mdbItemGroup = project.CreateChild("ItemGroup");
+            mdbItemGroup.CreateChild("AtomicNETMDBFiles").SetAttribute("Include", "..\\..\\Lib\\Desktop\\**\\*.mdb");
+
+            // Debug
+            XMLElement copyOp = afterBuild.CreateChild("Copy");
+            copyOp.SetAttribute("Condition", "'$(Configuration)' == 'Debug'");
+            copyOp.SetAttribute("SourceFiles", "@(AtomicNETMDBFiles)");
+            copyOp.SetAttribute("DestinationFiles", "@(AtomicNETMDBFiles->'..\\..\\Debug\\Bin\\Desktop\\%(Filename)%(Extension)')");
+
+            // Release
+            copyOp = afterBuild.CreateChild("Copy");
+            copyOp.SetAttribute("Condition", "'$(Configuration)' == 'Release'");
+            copyOp.SetAttribute("SourceFiles", "@(AtomicNETMDBFiles)");
+            copyOp.SetAttribute("DestinationFiles", "@(AtomicNETMDBFiles->'..\\..\\Release\\Bin\\Desktop\\%(Filename)%(Extension)')");
+        }
+
+#endif
+#endif
+
 
         String projectSource = xmlFile_->ToString();
 

+ 4 - 2
Source/ToolCore/NETTools/NETProjectGen.h

@@ -44,7 +44,7 @@ namespace ToolCore
         NETProjectBase(Context* context, NETProjectGen* projectGen);
         virtual ~NETProjectBase();
 
-        void ReplacePathStrings(String& path);
+        void ReplacePathStrings(String& path) const;
 
         void CopyXMLElementRecursive(XMLElement source, XMLElement dest);
 
@@ -95,7 +95,7 @@ namespace ToolCore
 
         bool GenerateStandard();
 
-        bool GetRelativeProjectPath(const String& fromPath, const String& toPath, String& output);
+        bool GetRelativeProjectPath(const String& fromPath, const String& toPath, String& output) const;
 
         bool CreateProjectFolder(const String& path);
 
@@ -115,6 +115,8 @@ namespace ToolCore
 
         void ProcessDefineConstants(StringVector& constants);
 
+        /// Return a relative path to the output folder, config can be Release/Debug/Lib
+        String GetRelativeOutputPath(const String& config) const;
 
         String name_;
         String projectGuid_;