Skip to content

Commit b32aa92

Browse files
committed
Fix building for Android
1 parent 7fb1399 commit b32aa92

File tree

5 files changed

+18
-8
lines changed

5 files changed

+18
-8
lines changed

mullvad-api/src/api.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
//! [`ApiConnectionMode`], which in turn is used by `mullvad-api` for
55
//! establishing connections when performing API requests.
66
7+
#[cfg(feature = "api-override")]
8+
use crate::ApiEndpoint;
79
use crate::{
810
proxy::{AllowedClientsProvider, ApiConnectionMode, ConnectionModeProvider, ProxyConfig},
911
AddressCache,
@@ -12,17 +14,13 @@ use futures::{
1214
channel::{mpsc, oneshot},
1315
StreamExt,
1416
};
15-
#[cfg(feature = "api-override")]
16-
use mullvad_api::ApiEndpoint;
1717
use mullvad_encrypted_dns_proxy::state::EncryptedDnsProxyState;
1818
use mullvad_relay_selector::RelaySelector;
1919
use mullvad_types::access_method::{
2020
AccessMethod, AccessMethodSetting, BuiltInAccessMethod, Id, Settings,
2121
};
2222
use std::{net::SocketAddr, path::PathBuf};
23-
use talpid_types::net::{
24-
proxy::CustomProxy, AllowedEndpoint, Endpoint, TransportProtocol,
25-
};
23+
use talpid_types::net::{proxy::CustomProxy, AllowedEndpoint, Endpoint, TransportProtocol};
2624

2725
pub enum Message {
2826
Get(ResponseTx<ResolvedConnectionMode>),
@@ -306,6 +304,8 @@ impl AccessModeSelector {
306304
let api_connection_mode = initial_connection_mode.connection_mode.clone();
307305

308306
let selector = AccessModeSelector {
307+
#[cfg(feature = "api-override")]
308+
api_endpoint,
309309
cmd_rx,
310310
cache_dir,
311311
relay_selector,
@@ -317,8 +317,6 @@ impl AccessModeSelector {
317317
current: initial_connection_mode,
318318
index,
319319
provider,
320-
#[cfg(feature = "api-override")]
321-
api_endpoint,
322320
};
323321

324322
tokio::spawn(selector.into_future());

mullvad-api/src/bin/relay_list.rs

+7
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,20 @@
22
//! Used by the installer artifact packer to bundle the latest available
33
//! relay list at the time of creating the installer.
44
5+
#[cfg(not(target_os = "android"))]
56
use mullvad_api::{
67
proxy::ApiConnectionMode, rest::Error as RestError, ApiEndpoint, RelayListProxy,
78
};
9+
#[cfg(not(target_os = "android"))]
810
use std::process;
11+
#[cfg(not(target_os = "android"))]
912
use talpid_types::ErrorExt;
1013

1114
#[tokio::main]
15+
#[cfg(target_os = "android")]
16+
async fn main() {}
17+
#[tokio::main]
18+
#[cfg(not(target_os = "android"))]
1219
async fn main() {
1320
let runtime = mullvad_api::Runtime::new(
1421
tokio::runtime::Handle::current(),

mullvad-daemon/src/api.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
#[cfg(target_os = "android")]
22
use crate::DaemonCommand;
3+
#[cfg(target_os = "android")]
4+
use crate::DaemonEventSender;
35
use futures::channel::mpsc;
46
use futures::StreamExt;
57
use mullvad_api::availability::ApiAvailability;
68
use mullvad_api::proxy::AllowedClientsProvider;
79
use mullvad_api::proxy::ApiConnectionMode;
810
use mullvad_api::proxy::ProxyConfig;
11+
#[cfg(target_os = "android")]
12+
use talpid_core::mpsc::Sender;
913
use talpid_types::net::AllowedClients;
1014
use talpid_types::net::Connectivity;
1115

mullvad-jni/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ workspace = true
1212

1313
[features]
1414
# Allow the API server to use to be configured
15-
api-override = ["mullvad-api/api-override"]
15+
api-override = ["mullvad-api/api-override", "mullvad-daemon/api-override"]
1616

1717
[lib]
1818
crate-type = ["cdylib"]

test/Cargo.lock

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)