NETProjectGen.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. //
  2. // Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
  3. // LICENSE: Atomic Game Engine Editor and Tools EULA
  4. // Please see LICENSE_ATOMIC_EDITOR_AND_TOOLS.md in repository root for
  5. // license information: https://github.com/AtomicGameEngine/AtomicGameEngine
  6. //
  7. #pragma once
  8. #include <Atomic/Core/Object.h>
  9. #include <Atomic/Resource/XMLFile.h>
  10. #include <Atomic/Resource/JSONFile.h>
  11. using namespace Atomic;
  12. namespace ToolCore
  13. {
  14. class NETProjectGen;
  15. class NETProjectBase : public Object
  16. {
  17. OBJECT(NETProjectBase);
  18. public:
  19. NETProjectBase(Context* context, NETProjectGen* projectGen);
  20. virtual ~NETProjectBase();
  21. void ReplacePathStrings(String& path);
  22. protected:
  23. SharedPtr<XMLFile> xmlFile_;
  24. WeakPtr<NETProjectGen> projectGen_;
  25. };
  26. class NETCSProject : public NETProjectBase
  27. {
  28. OBJECT(NETCSProject);
  29. public:
  30. NETCSProject(Context* context, NETProjectGen* projectGen);
  31. virtual ~NETCSProject();
  32. bool Load(const JSONValue& root);
  33. const String& GetName() { return name_; }
  34. const String& GetProjectGUID() { return projectGuid_; }
  35. bool Generate();
  36. private:
  37. void CreateCompileItemGroup(XMLElement &projectRoot);
  38. void CreateReferencesItemGroup(XMLElement &projectRoot);
  39. void CreateMainPropertyGroup(XMLElement &projectRoot);
  40. void CreateDebugPropertyGroup(XMLElement &projectRoot);
  41. void CreateReleasePropertyGroup(XMLElement &projectRoot);
  42. String name_;
  43. String projectGuid_;
  44. String outputType_;
  45. String rootNamespace_;
  46. String assemblyName_;
  47. String assemblyOutputPath_;
  48. XMLElement xmlRoot_;
  49. Vector<String> references_;
  50. Vector<String> sourceFolders_;
  51. };
  52. class NETSolution : public NETProjectBase
  53. {
  54. OBJECT(NETSolution);
  55. public:
  56. NETSolution(Context* context, NETProjectGen* projectGen);
  57. virtual ~NETSolution();
  58. bool Load(const JSONValue& root);
  59. bool Generate();
  60. const String& GetOutputPath() { return outputPath_; }
  61. private:
  62. void GenerateXamarinStudio(const String& slnPath);
  63. String name_;
  64. String outputPath_;
  65. };
  66. class NETProjectGen : public Object
  67. {
  68. OBJECT(NETProjectGen);
  69. public:
  70. NETProjectGen(Context* context);
  71. virtual ~NETProjectGen();
  72. const String& GetScriptPlatform() { return scriptPlatform_; }
  73. NETSolution* GetSolution() { return solution_; }
  74. const Vector<SharedPtr<NETCSProject>>& GetCSProjects() { return projects_; }
  75. void SetScriptPlatform(const String& platform) { scriptPlatform_ = platform; }
  76. bool Generate();
  77. bool LoadProject(const JSONValue& root);
  78. bool LoadProject(const String& projectPath);
  79. private:
  80. String scriptPlatform_;
  81. SharedPtr<NETSolution> solution_;
  82. Vector<SharedPtr<NETCSProject>> projects_;
  83. };
  84. }