summaryrefslogtreecommitdiffhomepage
path: root/installer-downloader/src/main.rs
blob: 26b14425699d3c0ba2c294b47a600bbf780576d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

#[cfg(target_os = "windows")]
mod winapi_impl;

#[cfg(target_os = "macos")]
mod cacao_impl;

#[cfg(any(target_os = "windows", target_os = "macos"))]
mod inner {
    pub use installer_downloader::controller;
    pub use installer_downloader::delegate;
    pub use installer_downloader::log;
    pub use installer_downloader::resource;

    pub fn run() {
        log::init().expect("failed to set up logger");

        ::log::debug!("Installer downloader version: {}", resource::VERSION);

        let rt = tokio::runtime::Builder::new_multi_thread()
            .enable_all()
            .build()
            .expect("failed to create tokio runtime");
        let _guard = rt.enter();

        #[cfg(target_os = "windows")]
        super::winapi_impl::main();

        #[cfg(target_os = "macos")]
        super::cacao_impl::main();
    }
}

#[cfg(not(any(target_os = "windows", target_os = "macos")))]
mod inner {
    pub fn run() {}
}

use inner::*;

fn main() {
    run()
}