Browse Source

Merge pull request #1114 from AtomicGameEngine/JME-ATOMIC-PROJECTWORK

Handle partial AtomicEditor C# builds on macOS/Linux using xbuild
JoshEngebretson 9 years ago
parent
commit
a489eaec9e

+ 23 - 2
Source/ToolCore/NETTools/NETBuildSystem.cpp

@@ -61,7 +61,8 @@ namespace ToolCore
     }
 
     NETBuildSystem::NETBuildSystem(Context* context) :
-        Object(context)
+        Object(context),
+        verbose_(false)
     {
         SubscribeToEvent(E_TOOLUPDATE, ATOMIC_HANDLER(NETBuildSystem, HandleToolUpdate));
         SubscribeToEvent(E_NETBUILDATOMICPROJECT, ATOMIC_HANDLER(NETBuildSystem, HandleBuildAtomicProject));
@@ -82,7 +83,8 @@ namespace ToolCore
 
         const String& text = eventData[SubprocessOutput::P_TEXT].GetString();
 
-        // LOGINFOF(text.CString());
+        if (verbose_)
+            ATOMIC_LOGINFOF(text.CString());
 
         curBuild_->output_ += text;
 
@@ -110,6 +112,11 @@ namespace ToolCore
         bool success = true;
         String errorMsg;
 
+        if (verbose_)
+        {
+            ATOMIC_LOGINFOF("AtomicNET Build Command: %s", curBuild_->allArgs_.CString());
+        }
+
         if (!code)
         {
 
@@ -352,6 +359,20 @@ namespace ToolCore
 
             compile += ToString("\"%s\" \"%s\" %s %s", xbuildBinary.CString(), 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("%s:Rebuild", tname));
+                }
+
+                compile += " /target:\"" + String::Joined(targets, ";") + "\"";
+
+            }
+
             args.Push(compile);
 
 #endif

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

@@ -95,6 +95,8 @@ namespace ToolCore
 
         NETBuild* BuildAtomicProject(Project* project);
 
+        void SetVerbose(bool verbose) { verbose_ = verbose; }
+
     private:
 
         void CurrentBuildError(String errorText);
@@ -109,6 +111,8 @@ namespace ToolCore
         SharedPtr<NETBuild> curBuild_;
         List<SharedPtr<NETBuild>> builds_;
 
+        bool verbose_;
+
     };
 
 }

+ 44 - 1
Source/ToolCore/Project/Project.cpp

@@ -26,6 +26,7 @@
 
 #include <Atomic/IO/Log.h>
 #include <Atomic/IO/File.h>
+#include <Atomic/IO/FileSystem.h>
 
 #include <Atomic/Resource/JSONFile.h>
 
@@ -123,7 +124,49 @@ bool Project::Load(const String& fullpath)
     else
     {
         projectPath_ = AddTrailingSlash(fullpath);
-        projectFilePath_ = projectPath_ + GetFileName(RemoveTrailingSlash(projectPath_)) + ".atomic";
+
+        FileSystem* fileSystem = GetSubsystem<FileSystem>();
+        StringVector results;
+        fileSystem->ScanDir(results, projectPath_, "*.atomic", SCAN_FILES, false);
+
+        if (!results.Size())
+        {
+            // no atomic file, so use the parent path name
+            projectFilePath_ = projectPath_ + GetFileName(RemoveTrailingSlash(projectPath_)) + ".atomic";
+        }
+        else
+        {
+            String result = projectPath_ + results[0];
+
+            if (results.Size() > 1)
+            {
+                // multiple *.atomic files, use newest, and report
+
+                unsigned newest = 0xFFFFFFFF;
+
+                for (unsigned i = 0; i < results.Size(); i++)
+                {
+                    String atomicFilePath = projectPath_ + results[i];
+
+                    unsigned modtime = fileSystem->GetLastModifiedTime(atomicFilePath);
+
+                    if (!modtime)
+                        continue;
+
+                    if (newest > modtime)
+                    {
+                        newest = modtime;
+                        result = atomicFilePath;
+                    }
+
+                }
+
+                ATOMIC_LOGERRORF("Project::Load - Multiple .atomic files found in project, selecting newest: %s", result.CString());
+
+            }
+
+            projectFilePath_ = result;
+        }
 
     }