File tree 3 files changed +19
-8
lines changed 3 files changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -19,9 +19,9 @@ pub fn build(env: &BuildEnv) -> Result<()> {
19
19
let mut runner = TaskRunner :: new ( 3 , env. verbose ( ) ) ;
20
20
21
21
runner. start_task ( "Fetch precompiled artifacts" ) ;
22
- let manager = DownloadManager :: new ( env) ?;
22
+ let manager = DownloadManager :: new ( env) . context ( "Creating DownloadManager" ) ?;
23
23
if !env. offline ( ) {
24
- manager. prefetch ( ) ?;
24
+ manager. prefetch ( ) . context ( "prefetch" ) ?;
25
25
runner. end_verbose_task ( ) ;
26
26
}
27
27
Original file line number Diff line number Diff line change 1
1
use crate :: { BuildEnv , Platform } ;
2
- use anyhow:: Result ;
2
+ use anyhow:: { Context , Result } ;
3
3
use indicatif:: { ProgressBar , ProgressDrawTarget , ProgressStyle } ;
4
+ use log:: info;
4
5
use mvn:: Download ;
5
6
use reqwest:: blocking:: Client ;
6
7
use std:: fs:: File ;
@@ -37,7 +38,10 @@ impl<'a> Download for DownloadManager<'a> {
37
38
let len = resp. content_length ( ) . unwrap_or_default ( ) ;
38
39
pb. set_length ( len) ;
39
40
40
- let dest = BufWriter :: new ( File :: create ( dest) ?) ;
41
+ let dest = BufWriter :: new (
42
+ File :: create ( dest)
43
+ . with_context ( || format ! ( "While creating download output file `{dest:?}`" ) ) ?,
44
+ ) ;
41
45
std:: io:: copy ( & mut resp, & mut pb. wrap_write ( dest) ) ?;
42
46
pb. finish_with_message ( "📥 downloaded" ) ;
43
47
@@ -138,9 +142,14 @@ impl<'a> DownloadManager<'a> {
138
142
self . macos_sdk ( ) ?;
139
143
}
140
144
Platform :: Android => {
141
- self . rustup_target ( "aarch64-linux-android" ) ?;
142
- self . android_ndk ( ) ?;
143
- self . android_jar ( ) ?;
145
+ if Platform :: host ( ) ? != Platform :: Android {
146
+ self . rustup_target ( "aarch64-linux-android" )
147
+ . context ( "rustup_target" ) ?;
148
+ } else {
149
+ info ! ( "Skipping `rustup` for Android target" ) ;
150
+ }
151
+ self . android_ndk ( ) . context ( "ndk" ) ?;
152
+ self . android_jar ( ) . context ( "jar" ) ?;
144
153
}
145
154
Platform :: Ios => {
146
155
self . rustup_target ( "aarch64-apple-ios" ) ?;
Original file line number Diff line number Diff line change @@ -51,7 +51,9 @@ pub enum Platform {
51
51
52
52
impl Platform {
53
53
pub fn host ( ) -> Result < Self > {
54
- Ok ( if cfg ! ( target_os = "linux" ) {
54
+ Ok ( if cfg ! ( target_os = "android" ) {
55
+ Platform :: Android
56
+ } else if cfg ! ( target_os = "linux" ) {
55
57
Platform :: Linux
56
58
} else if cfg ! ( target_os = "macos" ) {
57
59
Platform :: Macos
You can’t perform that action at this time.
0 commit comments