ProjectBuildSettings.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. //
  2. // Copyright (c) 2014-2016 THUNDERBEAST GAMES LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. // copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. // THE SOFTWARE.
  21. //
  22. #pragma once
  23. #include <Atomic/Core/Object.h>
  24. #include <Atomic/Resource/JSONValue.h>
  25. using namespace Atomic;
  26. namespace ToolCore
  27. {
  28. class MacBuildSettings : public RefCounted
  29. {
  30. REFCOUNTED(MacBuildSettings)
  31. public:
  32. MacBuildSettings() {}
  33. const String& GetAppName() const { return appName_; }
  34. const String& GetPackageName() const { return packageName_; }
  35. const String& GetCompanyName() const { return companyName_; }
  36. const String& GetProductName() const { return productName_; }
  37. void SetAppName(const String& name) { appName_ = name; }
  38. void SetPackageName(const String& packageName) { packageName_ = packageName; }
  39. void SetCompanyName(const String& companyName) { companyName_ = companyName; }
  40. void SetProductName(const String& productName) { productName_ = productName; }
  41. void Write(JSONValue& parent);
  42. void Read(JSONValue& parent);
  43. private:
  44. String appName_;
  45. String packageName_;
  46. String companyName_;
  47. String productName_;
  48. };
  49. class WebBuildSettings : public RefCounted
  50. {
  51. REFCOUNTED(WebBuildSettings)
  52. public:
  53. WebBuildSettings() {}
  54. const String& GetAppName() const { return appName_; }
  55. const String& GetPackageName() const { return packageName_; }
  56. const String& GetCompanyName() const { return companyName_; }
  57. const String& GetProductName() const { return productName_; }
  58. void SetAppName(const String& name) { appName_ = name; }
  59. void SetPackageName(const String& packageName) { packageName_ = packageName; }
  60. void SetCompanyName(const String& companyName) { companyName_ = companyName; }
  61. void SetProductName(const String& productName) { productName_ = productName; }
  62. void Write(JSONValue& parent);
  63. void Read(JSONValue& parent);
  64. private:
  65. String appName_;
  66. String packageName_;
  67. String companyName_;
  68. String productName_;
  69. };
  70. class WindowsBuildSettings : public RefCounted
  71. {
  72. REFCOUNTED(WindowsBuildSettings)
  73. public:
  74. WindowsBuildSettings() {}
  75. const String& GetAppName() const { return appName_; }
  76. const String& GetPackageName() const { return packageName_; }
  77. const String& GetCompanyName() const { return companyName_; }
  78. const String& GetProductName() const { return productName_; }
  79. void SetAppName(const String& name) { appName_ = name; }
  80. void SetPackageName(const String& packageName) { packageName_ = packageName; }
  81. void SetCompanyName(const String& companyName) { companyName_ = companyName; }
  82. void SetProductName(const String& productName) { productName_ = productName; }
  83. void Write(JSONValue& parent);
  84. void Read(JSONValue& parent);
  85. private:
  86. String appName_;
  87. String packageName_;
  88. String companyName_;
  89. String productName_;
  90. };
  91. class AndroidBuildSettings : public RefCounted
  92. {
  93. REFCOUNTED(AndroidBuildSettings)
  94. public:
  95. AndroidBuildSettings() {}
  96. const String& GetAppName() const { return appName_; }
  97. const String& GetPackageName() const { return packageName_; }
  98. const String& GetCompanyName() const { return companyName_; }
  99. const String& GetProductName() const { return productName_; }
  100. const String& GetSDKVersion() const { return targetSDKVersion_; }
  101. const String& GetMinSDKVersion() const { return minSDKVersion_; }
  102. const String& GetActivityName() const { return activityName_; }
  103. void SetAppName(const String& name) { appName_ = name; }
  104. void SetPackageName(const String& packageName) { packageName_ = packageName; }
  105. void SetCompanyName(const String& companyName) { companyName_ = companyName; }
  106. void SetProductName(const String& productName) { productName_ = productName; }
  107. void SetSDKVersion(const String& value) { targetSDKVersion_ = value; }
  108. void SetMinSDKVersion(const String& value) { minSDKVersion_ = value; }
  109. void SetActivityName(const String& value) { activityName_ = value; }
  110. void Write(JSONValue& parent);
  111. void Read(JSONValue& parent);
  112. private:
  113. String appName_;
  114. String packageName_;
  115. String companyName_;
  116. String productName_;
  117. String targetSDKVersion_;
  118. String minSDKVersion_;
  119. String activityName_;
  120. };
  121. class IOSBuildSettings : public RefCounted
  122. {
  123. REFCOUNTED(IOSBuildSettings)
  124. public:
  125. IOSBuildSettings() {}
  126. const String& GetAppName() const { return appName_; }
  127. const String& GetPackageName() const { return packageName_; }
  128. const String& GetCompanyName() const { return companyName_; }
  129. const String& GetProductName() const { return productName_; }
  130. const String& GetProvisionFile() const { return provisionFile_; }
  131. const String& GetAppIDPrefix() const { return appidPrefix_; }
  132. void SetAppName(const String& name) { appName_ = name; }
  133. void SetPackageName(const String& packageName) { packageName_ = packageName; }
  134. void SetCompanyName(const String& companyName) { companyName_ = companyName; }
  135. void SetProductName(const String& productName) { productName_ = productName; }
  136. void SetProvisionFile(const String& value) { provisionFile_ = value; }
  137. void SetAppIDPrefix(const String& value) { appidPrefix_ = value; }
  138. void Write(JSONValue& parent);
  139. void Read(JSONValue& parent);
  140. private:
  141. String appName_;
  142. String packageName_;
  143. String companyName_;
  144. String productName_;
  145. String provisionFile_;
  146. String appidPrefix_;
  147. };
  148. class ProjectBuildSettings : public Object
  149. {
  150. OBJECT(ProjectBuildSettings);
  151. public:
  152. /// Construct.
  153. ProjectBuildSettings(Context* context);
  154. /// Destruct.
  155. virtual ~ProjectBuildSettings();
  156. MacBuildSettings* GetMacBuildSettings() { return macBuildSettings_; }
  157. WindowsBuildSettings* GetWindowsBuildSettings() { return windowsBuildSettings_; }
  158. WebBuildSettings* GetWebBuildSettings() { return webBuildSettings_; }
  159. AndroidBuildSettings* GetAndroidBuildSettings() { return androidBuildSettings_; }
  160. IOSBuildSettings* GetIOSBuildSettings() { return iosBuildSettings_; }
  161. bool Load(const String& path);
  162. void Save(const String& path);
  163. private:
  164. SharedPtr<MacBuildSettings> macBuildSettings_;
  165. SharedPtr<WindowsBuildSettings> windowsBuildSettings_;
  166. SharedPtr<WebBuildSettings> webBuildSettings_;
  167. SharedPtr<AndroidBuildSettings> androidBuildSettings_;
  168. SharedPtr<IOSBuildSettings> iosBuildSettings_;
  169. };
  170. }