|
|
@ -73,7 +73,7 @@ MatchResult Builder::parse_line(const string &line) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Builder::building(BuildEvent ev) { |
|
|
|
void Builder::BUILDING(BuildEvent ev) { |
|
|
|
// check if there's output
|
|
|
|
// check if there's output
|
|
|
|
if(build_done) { |
|
|
|
if(build_done) { |
|
|
|
int rc = pclose(build_out); |
|
|
|
int rc = pclose(build_out); |
|
|
@ -100,7 +100,7 @@ void Builder::building(BuildEvent ev) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Builder::start(BuildEvent ev) { |
|
|
|
void Builder::START(BuildEvent ev) { |
|
|
|
gui.output(format("Using build command: {}", build_cmd)); |
|
|
|
gui.output(format("Using build command: {}", build_cmd)); |
|
|
|
fileWatcher = new efsw::FileWatcher(); |
|
|
|
fileWatcher = new efsw::FileWatcher(); |
|
|
|
dbc::check(fileWatcher != nullptr, "Failed to create filewatcher."); |
|
|
|
dbc::check(fileWatcher != nullptr, "Failed to create filewatcher."); |
|
|
@ -120,7 +120,7 @@ void Builder::start(BuildEvent ev) { |
|
|
|
state(BuildState::WAITING); |
|
|
|
state(BuildState::WAITING); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Builder::waiting(BuildEvent ev) { |
|
|
|
void Builder::WAITING(BuildEvent ev) { |
|
|
|
if(listener->changes) { |
|
|
|
if(listener->changes) { |
|
|
|
game.event(GameEvent::BUILD_START); |
|
|
|
game.event(GameEvent::BUILD_START); |
|
|
|
gui.building(); |
|
|
|
gui.building(); |
|
|
@ -129,7 +129,7 @@ void Builder::waiting(BuildEvent ev) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Builder::forking(BuildEvent ev) { |
|
|
|
void Builder::FORKING(BuildEvent ev) { |
|
|
|
if(build_fut.valid()) { |
|
|
|
if(build_fut.valid()) { |
|
|
|
std::future_status status = build_fut.wait_for(0ms); |
|
|
|
std::future_status status = build_fut.wait_for(0ms); |
|
|
|
|
|
|
|
|
|
|
@ -148,7 +148,7 @@ void Builder::forking(BuildEvent ev) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Builder::reading(BuildEvent ev) { |
|
|
|
void Builder::READING(BuildEvent ev) { |
|
|
|
// BUG: too much copy-pasta so turn this into a class?
|
|
|
|
// BUG: too much copy-pasta so turn this into a class?
|
|
|
|
if(read_fut.valid()) { |
|
|
|
if(read_fut.valid()) { |
|
|
|
std::future_status status = read_fut.wait_for(0ms); |
|
|
|
std::future_status status = read_fut.wait_for(0ms); |
|
|
@ -166,7 +166,7 @@ void Builder::reading(BuildEvent ev) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Builder::done(BuildEvent ev) { |
|
|
|
void Builder::DONE(BuildEvent ev) { |
|
|
|
if(game.is_dead()) { |
|
|
|
if(game.is_dead()) { |
|
|
|
gui.you_died(); |
|
|
|
gui.you_died(); |
|
|
|
} |
|
|
|
} |
|
|
@ -176,7 +176,7 @@ void Builder::done(BuildEvent ev) { |
|
|
|
state(BuildState::WAITING); |
|
|
|
state(BuildState::WAITING); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Builder::exit(BuildEvent ev) { |
|
|
|
void Builder::EXIT(BuildEvent ev) { |
|
|
|
if(ev == QUIT) { |
|
|
|
if(ev == QUIT) { |
|
|
|
fileWatcher->removeWatch(wid); |
|
|
|
fileWatcher->removeWatch(wid); |
|
|
|
git_libgit2_shutdown(); |
|
|
|
git_libgit2_shutdown(); |
|
|
@ -184,7 +184,7 @@ void Builder::exit(BuildEvent ev) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Builder::error(BuildEvent ev) { |
|
|
|
void Builder::ERROR(BuildEvent ev) { |
|
|
|
// how to avoid doing this more than once?
|
|
|
|
// how to avoid doing this more than once?
|
|
|
|
if(ev == CRASH) { |
|
|
|
if(ev == CRASH) { |
|
|
|
if(repo != nullptr) git_repository_free(repo); |
|
|
|
if(repo != nullptr) git_repository_free(repo); |
|
|
|