godotsharp_builds.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*************************************************************************/
  2. /* godotsharp_builds.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /*************************************************************************/
  30. #ifndef GODOTSHARP_BUILDS_H
  31. #define GODOTSHARP_BUILDS_H
  32. #include "../mono_gd/gd_mono.h"
  33. #include "mono_bottom_panel.h"
  34. #include "mono_build_info.h"
  35. typedef void (*GodotSharpBuild_ExitCallback)(int);
  36. class GodotSharpBuilds {
  37. private:
  38. struct BuildProcess {
  39. Ref<MonoGCHandle> build_instance;
  40. MonoBuildInfo build_info;
  41. MonoBuildTab *build_tab;
  42. GodotSharpBuild_ExitCallback exit_callback;
  43. bool exited;
  44. int exit_code;
  45. void on_exit(int p_exit_code);
  46. void start(bool p_blocking = false);
  47. BuildProcess() {}
  48. BuildProcess(const MonoBuildInfo &p_build_info, GodotSharpBuild_ExitCallback p_callback = NULL);
  49. };
  50. HashMap<MonoBuildInfo, BuildProcess, MonoBuildInfo::Hasher> builds;
  51. static String _api_folder_name(APIAssembly::Type p_api_type);
  52. static GodotSharpBuilds *singleton;
  53. public:
  54. enum BuildTool {
  55. MSBUILD_MONO,
  56. #ifdef WINDOWS_ENABLED
  57. MSBUILD_VS,
  58. #endif
  59. XBUILD // Deprecated
  60. };
  61. _FORCE_INLINE_ static GodotSharpBuilds *get_singleton() { return singleton; }
  62. static void register_internal_calls();
  63. static void show_build_error_dialog(const String &p_message);
  64. void build_exit_callback(const MonoBuildInfo &p_build_info, int p_exit_code);
  65. void restart_build(MonoBuildTab *p_build_tab);
  66. void stop_build(MonoBuildTab *p_build_tab);
  67. bool build(const MonoBuildInfo &p_build_info);
  68. bool build_async(const MonoBuildInfo &p_build_info, GodotSharpBuild_ExitCallback p_callback = NULL);
  69. static bool build_api_sln(const String &p_api_sln_dir, const String &p_config);
  70. static bool copy_api_assembly(const String &p_src_dir, const String &p_dst_dir, const String &p_assembly_name, APIAssembly::Type p_api_type);
  71. static bool make_api_assembly(APIAssembly::Type p_api_type);
  72. static bool build_project_blocking(const String &p_config);
  73. static bool editor_build_callback();
  74. GodotSharpBuilds();
  75. ~GodotSharpBuilds();
  76. };
  77. #endif // GODOTSHARP_BUILDS_H