Skip to content

Commit 4bd3e37

Browse files
authored
Merge pull request #47871 from fastly/jkarneges/old-runner
only expose the old runner
2 parents 1ecf52a + cfaa166 commit 4bd3e37

File tree

4 files changed

+20
-103
lines changed

4 files changed

+20
-103
lines changed

Cargo.toml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,6 @@ name = "pushpin-handler"
8282
test = false
8383
bench = false
8484

85-
[[bin]]
86-
name = "pushpin-legacy"
87-
test = false
88-
bench = false
89-
9085
[[bin]]
9186
name = "pushpin"
9287
test = false

postbuild/postbuild.pro

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ handler_bin.target = $$bin_dir/pushpin-handler
3131
handler_bin.depends = $$target_dir/pushpin-handler
3232
handler_bin.commands = mkdir -p $$bin_dir && cp -a $$target_dir/pushpin-handler $$bin_dir/pushpin-handler
3333

34-
runner_legacy_bin.target = $$root_dir/pushpin-legacy
35-
runner_legacy_bin.depends = $$target_dir/pushpin-legacy
36-
runner_legacy_bin.commands = cp -a $$target_dir/pushpin-legacy $$root_dir/pushpin-legacy
37-
3834
runner_bin.target = $$root_dir/pushpin
3935
runner_bin.depends = $$target_dir/pushpin
4036
runner_bin.commands = cp -a $$target_dir/pushpin $$root_dir/pushpin
@@ -48,7 +44,6 @@ QMAKE_EXTRA_TARGETS += \
4844
m2adapter_bin \
4945
proxy_bin \
5046
handler_bin \
51-
runner_legacy_bin \
5247
runner_bin \
5348
publish_bin
5449

@@ -57,7 +52,6 @@ PRE_TARGETDEPS += \
5752
$$bin_dir/m2adapter \
5853
$$bin_dir/pushpin-proxy \
5954
$$bin_dir/pushpin-handler \
60-
$$root_dir/pushpin-legacy \
6155
$$root_dir/pushpin \
6256
$$bin_dir/pushpin-publish
6357

@@ -79,7 +73,6 @@ unix:!isEmpty(BINDIR) {
7973
$$bin_dir/m2adapter \
8074
$$bin_dir/pushpin-proxy \
8175
$$bin_dir/pushpin-handler \
82-
$$root_dir/pushpin-legacy \
8376
$$root_dir/pushpin \
8477
$$bin_dir/pushpin-publish
8578
binfiles.CONFIG += no_check_exist executable

src/bin/pushpin-legacy.rs

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/bin/pushpin.rs

Lines changed: 20 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -14,58 +14,28 @@
1414
* limitations under the License.
1515
*/
1616

17-
use clap::Parser;
18-
use log::{error, info, LevelFilter};
19-
use pushpin::log::{ensure_init_simple_logger, get_simple_logger, local_offset_check};
20-
use pushpin::runner::{open_log_file, ArgsData, CliArgs, Settings};
21-
use pushpin::service::start_services;
17+
use pushpin::call_c_main;
2218
use std::env;
23-
use std::error::Error;
24-
use std::process;
25-
26-
fn process_args_and_run(args: CliArgs) -> Result<(), Box<dyn Error>> {
27-
let args_data = ArgsData::new(args)?;
28-
let settings = Settings::new(&env::current_dir()?, args_data)?;
29-
30-
let log_file = match settings.log_file.clone() {
31-
Some(x) => match open_log_file(x) {
32-
Ok(x) => Some(x),
33-
Err(_) => {
34-
error!("unable to open log file. logging to standard out.");
35-
None
36-
}
37-
},
38-
None => None,
39-
};
40-
ensure_init_simple_logger(log_file, true);
41-
log::set_logger(get_simple_logger()).unwrap();
42-
let ll = settings
43-
.log_levels
44-
.get("")
45-
.unwrap_or_else(|| settings.log_levels.get("default").unwrap());
46-
let level = match ll {
47-
0 => LevelFilter::Error,
48-
1 => LevelFilter::Warn,
49-
2 => LevelFilter::Info,
50-
3 => LevelFilter::Debug,
51-
4..=u8::MAX => LevelFilter::Trace,
52-
};
53-
log::set_max_level(level);
54-
55-
local_offset_check();
56-
57-
info!("using config: {:?}", settings.config_file.display());
58-
start_services(settings);
59-
60-
Ok(())
19+
use std::process::ExitCode;
20+
21+
#[cfg(target_os = "macos")]
22+
#[link(name = "pushpin-cpp")]
23+
#[link(name = "QtCore", kind = "framework")]
24+
#[link(name = "QtNetwork", kind = "framework")]
25+
#[link(name = "c++")]
26+
extern "C" {
27+
fn runner_main(argc: libc::c_int, argv: *const *const libc::c_char) -> libc::c_int;
6128
}
6229

63-
fn main() {
64-
let args = CliArgs::parse();
65-
info!("starting...");
30+
#[cfg(not(target_os = "macos"))]
31+
#[link(name = "pushpin-cpp")]
32+
#[link(name = "Qt5Core")]
33+
#[link(name = "Qt5Network")]
34+
#[link(name = "stdc++")]
35+
extern "C" {
36+
fn runner_main(argc: libc::c_int, argv: *const *const libc::c_char) -> libc::c_int;
37+
}
6638

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

0 commit comments

Comments
 (0)