File tree Expand file tree Collapse file tree 3 files changed +19
-8
lines changed Expand file tree Collapse file tree 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<()> {
1919 let mut runner = TaskRunner :: new ( 3 , env. verbose ( ) ) ;
2020
2121 runner. start_task ( "Fetch precompiled artifacts" ) ;
22- let manager = DownloadManager :: new ( env) ?;
22+ let manager = DownloadManager :: new ( env) . context ( "Creating DownloadManager" ) ?;
2323 if !env. offline ( ) {
24- manager. prefetch ( ) ?;
24+ manager. prefetch ( ) . context ( "prefetch" ) ?;
2525 runner. end_verbose_task ( ) ;
2626 }
2727
Original file line number Diff line number Diff line change 11use crate :: { BuildEnv , Platform } ;
2- use anyhow:: Result ;
2+ use anyhow:: { Context , Result } ;
33use indicatif:: { ProgressBar , ProgressDrawTarget , ProgressStyle } ;
4+ use log:: info;
45use mvn:: Download ;
56use reqwest:: blocking:: Client ;
67use std:: fs:: File ;
@@ -37,7 +38,10 @@ impl<'a> Download for DownloadManager<'a> {
3738 let len = resp. content_length ( ) . unwrap_or_default ( ) ;
3839 pb. set_length ( len) ;
3940
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+ ) ;
4145 std:: io:: copy ( & mut resp, & mut pb. wrap_write ( dest) ) ?;
4246 pb. finish_with_message ( "📥 downloaded" ) ;
4347
@@ -138,9 +142,14 @@ impl<'a> DownloadManager<'a> {
138142 self . macos_sdk ( ) ?;
139143 }
140144 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" ) ?;
144153 }
145154 Platform :: Ios => {
146155 self . rustup_target ( "aarch64-apple-ios" ) ?;
Original file line number Diff line number Diff line change @@ -51,7 +51,9 @@ pub enum Platform {
5151
5252impl Platform {
5353 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" ) {
5557 Platform :: Linux
5658 } else if cfg ! ( target_os = "macos" ) {
5759 Platform :: Macos
You can’t perform that action at this time.
0 commit comments