Skip to content

Commit

Permalink
Merge pull request #47871 from fastly/jkarneges/old-runner
Browse files Browse the repository at this point in the history
only expose the old runner
  • Loading branch information
jkarneges authored Jan 9, 2024
2 parents 1ecf52a + cfaa166 commit 4bd3e37
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 103 deletions.
5 changes: 0 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,6 @@ name = "pushpin-handler"
test = false
bench = false

[[bin]]
name = "pushpin-legacy"
test = false
bench = false

[[bin]]
name = "pushpin"
test = false
Expand Down
7 changes: 0 additions & 7 deletions postbuild/postbuild.pro
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ handler_bin.target = $$bin_dir/pushpin-handler
handler_bin.depends = $$target_dir/pushpin-handler
handler_bin.commands = mkdir -p $$bin_dir && cp -a $$target_dir/pushpin-handler $$bin_dir/pushpin-handler

runner_legacy_bin.target = $$root_dir/pushpin-legacy
runner_legacy_bin.depends = $$target_dir/pushpin-legacy
runner_legacy_bin.commands = cp -a $$target_dir/pushpin-legacy $$root_dir/pushpin-legacy

runner_bin.target = $$root_dir/pushpin
runner_bin.depends = $$target_dir/pushpin
runner_bin.commands = cp -a $$target_dir/pushpin $$root_dir/pushpin
Expand All @@ -48,7 +44,6 @@ QMAKE_EXTRA_TARGETS += \
m2adapter_bin \
proxy_bin \
handler_bin \
runner_legacy_bin \
runner_bin \
publish_bin

Expand All @@ -57,7 +52,6 @@ PRE_TARGETDEPS += \
$$bin_dir/m2adapter \
$$bin_dir/pushpin-proxy \
$$bin_dir/pushpin-handler \
$$root_dir/pushpin-legacy \
$$root_dir/pushpin \
$$bin_dir/pushpin-publish

Expand All @@ -79,7 +73,6 @@ unix:!isEmpty(BINDIR) {
$$bin_dir/m2adapter \
$$bin_dir/pushpin-proxy \
$$bin_dir/pushpin-handler \
$$root_dir/pushpin-legacy \
$$root_dir/pushpin \
$$bin_dir/pushpin-publish
binfiles.CONFIG += no_check_exist executable
Expand Down
41 changes: 0 additions & 41 deletions src/bin/pushpin-legacy.rs

This file was deleted.

70 changes: 20 additions & 50 deletions src/bin/pushpin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,58 +14,28 @@
* limitations under the License.
*/

use clap::Parser;
use log::{error, info, LevelFilter};
use pushpin::log::{ensure_init_simple_logger, get_simple_logger, local_offset_check};
use pushpin::runner::{open_log_file, ArgsData, CliArgs, Settings};
use pushpin::service::start_services;
use pushpin::call_c_main;
use std::env;
use std::error::Error;
use std::process;

fn process_args_and_run(args: CliArgs) -> Result<(), Box<dyn Error>> {
let args_data = ArgsData::new(args)?;
let settings = Settings::new(&env::current_dir()?, args_data)?;

let log_file = match settings.log_file.clone() {
Some(x) => match open_log_file(x) {
Ok(x) => Some(x),
Err(_) => {
error!("unable to open log file. logging to standard out.");
None
}
},
None => None,
};
ensure_init_simple_logger(log_file, true);
log::set_logger(get_simple_logger()).unwrap();
let ll = settings
.log_levels
.get("")
.unwrap_or_else(|| settings.log_levels.get("default").unwrap());
let level = match ll {
0 => LevelFilter::Error,
1 => LevelFilter::Warn,
2 => LevelFilter::Info,
3 => LevelFilter::Debug,
4..=u8::MAX => LevelFilter::Trace,
};
log::set_max_level(level);

local_offset_check();

info!("using config: {:?}", settings.config_file.display());
start_services(settings);

Ok(())
use std::process::ExitCode;

#[cfg(target_os = "macos")]
#[link(name = "pushpin-cpp")]
#[link(name = "QtCore", kind = "framework")]
#[link(name = "QtNetwork", kind = "framework")]
#[link(name = "c++")]
extern "C" {
fn runner_main(argc: libc::c_int, argv: *const *const libc::c_char) -> libc::c_int;
}

fn main() {
let args = CliArgs::parse();
info!("starting...");
#[cfg(not(target_os = "macos"))]
#[link(name = "pushpin-cpp")]
#[link(name = "Qt5Core")]
#[link(name = "Qt5Network")]
#[link(name = "stdc++")]
extern "C" {
fn runner_main(argc: libc::c_int, argv: *const *const libc::c_char) -> libc::c_int;
}

if let Err(e) = process_args_and_run(args) {
eprintln!("Error: {}", e);
process::exit(1);
}
fn main() -> ExitCode {
unsafe { ExitCode::from(call_c_main(runner_main, env::args_os())) }
}

0 comments on commit 4bd3e37

Please sign in to comment.