Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added --quit and --build-solutions cmd line options to make CI pipelines possible #16098

Merged
merged 1 commit into from
Feb 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1784,7 +1784,7 @@ void EditorNode::_run(bool p_current, const String &p_custom) {
editor_data.save_editor_external_data();
}

if (!_call_build())
if (!call_build())
return;

if (bool(EDITOR_DEF("run/output/always_clear_output_on_play", true))) {
Expand Down Expand Up @@ -2321,7 +2321,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
if (run_native->is_deploy_debug_remote_enabled()) {
_menu_option_confirm(RUN_STOP, true);

if (!_call_build())
if (!call_build())
break; // build failed

emit_signal("play_pressed");
Expand Down Expand Up @@ -4525,7 +4525,7 @@ void EditorNode::add_build_callback(EditorBuildCallback p_callback) {

EditorBuildCallback EditorNode::build_callbacks[EditorNode::MAX_BUILD_CALLBACKS];

bool EditorNode::_call_build() {
bool EditorNode::call_build() {

for (int i = 0; i < build_callback_count; i++) {
if (!build_callbacks[i]())
Expand Down
3 changes: 2 additions & 1 deletion editor/editor_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,6 @@ class EditorNode : public Node {
static EditorPluginInitializeCallback plugin_init_callbacks[MAX_INIT_CALLBACKS];
void _save_default_environment();

bool _call_build();
static int build_callback_count;
static EditorBuildCallback build_callbacks[MAX_BUILD_CALLBACKS];

Expand Down Expand Up @@ -634,6 +633,8 @@ class EditorNode : public Node {
static void _bind_methods();

public:
bool call_build();

static void add_plugin_init_callback(EditorPluginInitializeCallback p_callback);

enum EditorTable {
Expand Down
19 changes: 18 additions & 1 deletion main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ static bool editor = false;
static bool show_help = false;
static bool disable_render_loop = false;
static int fixed_fps = -1;
static bool auto_build_solutions = false;
static bool auto_quit = false;

static OS::ProcessID allow_focus_steal_pid = 0;

Expand Down Expand Up @@ -261,6 +263,7 @@ void Main::print_help(const char *p_binary) {
OS::get_singleton()->print(" --export-debug Use together with --export, enables debug mode for the template.\n");
OS::get_singleton()->print(" --doctool <path> Dump the engine API reference to the given <path> in XML format, merging if existing files are found.\n");
OS::get_singleton()->print(" --no-docbase Disallow dumping the base types (used with --doctool).\n");
OS::get_singleton()->print(" --build-solutions Builds the scripting solutions (IE. C#).\n");
#ifdef DEBUG_METHODS_ENABLED
OS::get_singleton()->print(" --gdnative-generate-json-api Generate JSON dump of the Godot API for GDNative bindings.\n");
#endif
Expand Down Expand Up @@ -526,6 +529,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
} else if (I->get() == "-p" || I->get() == "--project-manager") { // starts project manager

project_manager = true;
} else if (I->get() == "--build-solutions") { // Build the scripting solution such C#

auto_build_solutions = true;
#endif
} else if (I->get() == "--no-window") { // disable window creation, Windows only

Expand All @@ -552,6 +558,8 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
}
} else if (I->get() == "-u" || I->get() == "--upwards") { // scan folders upwards
upwards = true;
} else if (I->get() == "--quit" || I->get() == "-q") { // Auto quit at the end of the first main loop iteration
auto_quit = true;
} else if (I->get().ends_with("project.godot")) {
String path;
String file = I->get();
Expand Down Expand Up @@ -1848,7 +1856,16 @@ bool Main::iteration() {
target_ticks = MIN(MAX(target_ticks, current_ticks - time_step), current_ticks + time_step);
}

return exit;
#ifdef TOOLS_ENABLED
if (auto_build_solutions) {
auto_build_solutions = false;
if (!EditorNode::get_singleton()->call_build()) {
ERR_FAIL_V(true);
}
}
#endif

return exit || auto_quit;
}

void Main::force_redraw() {
Expand Down