Browse Source

[C#] Only build PCL + Desktop when refreshing project assembly from Atomic Editor

Josh Engebretson 9 years ago
parent
commit
ab80da13af

+ 32 - 1
Source/ToolCore/NETTools/NETBuildSystem.cpp

@@ -311,8 +311,25 @@ namespace ToolCore
                 compile += ToString("&& \"%s\" restore \"%s\" ", nugetBinary.CString(), solutionPath.CString());
             }
 
-            compile += ToString("&& msbuild \"%s\" %s %s\"", solutionPath.CString(), platforms.CString(), configs.CString());
+            compile += ToString("&& msbuild \"%s\" %s %s", solutionPath.CString(), platforms.CString(), configs.CString());
 
+            if (curBuild_->targets_.Size()) {
+
+                StringVector targets;
+
+                for (unsigned i = 0; i < curBuild_->targets_.Size(); i++)
+                {
+                    const char* tname = curBuild_->targets_[i].CString();
+                    targets.Push(ToString("/t:\"%s:Rebuild\"", tname));
+                }
+
+                compile += " " + String::Joined(targets, " ");
+
+            }
+
+            // close out quote
+            compile += "\"";
+                
             args.Push(compile);
 
 #else
@@ -412,7 +429,21 @@ namespace ToolCore
 
         if (build)
         {
+            ProjectSettings* settings = project->GetProjectSettings();
+
+            // This path is currently only hit when refreshing for desktop
+            if (settings->GetSupportsAndroid() || settings->GetSupportsIOS()) 
+            {
+                // Build the PCL, which will get copied to Resources
+                build->targets_.Push(project->GetProjectSettings()->GetName());
+
+                // Build the Desktop executable, so we can run it
+                // IMPORTANT NOTE: msbuild requires replacing '.' with '_' when in project name
+                build->targets_.Push(project->GetProjectSettings()->GetName() + "_Desktop");
+            }
+
             build->project_ = project;
+
         }
 
         ATOMIC_LOGINFOF("Received build for project %s", project->GetProjectFilePath().CString());

+ 1 - 0
Source/ToolCore/NETTools/NETBuildSystem.h

@@ -70,6 +70,7 @@ namespace ToolCore
         String solutionPath_;
         StringVector configurations_;
         StringVector platforms_;
+        StringVector targets_;
 
         NETBuildStatus status_;
         String allArgs_;