@@ -16,6 +16,7 @@ use crate::{
16
16
BuildConfig ,
17
17
} ;
18
18
use anyhow:: { bail, Context , Result } ;
19
+ use colored:: Colorize ;
19
20
use move_command_line_common:: files:: { find_move_filenames, FileHash } ;
20
21
use move_core_types:: account_address:: AccountAddress ;
21
22
use move_symbol_pool:: Symbol ;
@@ -25,6 +26,7 @@ use std::{
25
26
cell:: RefCell ,
26
27
collections:: { BTreeMap , BTreeSet } ,
27
28
fs,
29
+ io:: Write ,
28
30
path:: { Path , PathBuf } ,
29
31
process:: { Command , Stdio } ,
30
32
rc:: Rc ,
@@ -90,10 +92,11 @@ pub struct ResolutionPackage<T> {
90
92
}
91
93
92
94
impl ResolvingGraph {
93
- pub fn new (
95
+ pub fn new < W : Write > (
94
96
root_package : SourceManifest ,
95
97
root_package_path : PathBuf ,
96
98
mut build_options : BuildConfig ,
99
+ writer : & mut W ,
97
100
) -> Result < ResolvingGraph > {
98
101
if build_options. architecture . is_none ( ) {
99
102
if let Some ( info) = & root_package. build {
@@ -109,7 +112,7 @@ impl ResolvingGraph {
109
112
} ;
110
113
111
114
resolution_graph
112
- . build_resolution_graph ( root_package. clone ( ) , root_package_path, true )
115
+ . build_resolution_graph ( root_package. clone ( ) , root_package_path, true , writer )
113
116
. with_context ( || {
114
117
format ! (
115
118
"Unable to resolve packages for package '{}'" ,
@@ -189,11 +192,12 @@ impl ResolvingGraph {
189
192
} )
190
193
}
191
194
192
- fn build_resolution_graph (
195
+ fn build_resolution_graph < W : Write > (
193
196
& mut self ,
194
197
package : SourceManifest ,
195
198
package_path : PathBuf ,
196
199
is_root_package : bool ,
200
+ writer : & mut W ,
197
201
) -> Result < ( ) > {
198
202
let package_name = package. package . name ;
199
203
let package_node_id = match self . package_table . get ( & package_name) {
@@ -246,7 +250,7 @@ impl ResolvingGraph {
246
250
self . graph . add_edge ( package_node_id, dep_node_id, ( ) ) ;
247
251
248
252
let ( dep_renaming, dep_resolution_table) = self
249
- . process_dependency ( dep_name, dep, package_path. clone ( ) )
253
+ . process_dependency ( dep_name, dep, package_path. clone ( ) , writer )
250
254
. with_context ( || {
251
255
format ! (
252
256
"While resolving dependency '{}' in package '{}'" ,
@@ -382,21 +386,23 @@ impl ResolvingGraph {
382
386
// Process a dependency. `dep_name_in_pkg` is the name assigned to the dependent package `dep`
383
387
// in the source manifest, and we check that this name matches the name of the dependency it is
384
388
// assigned to.
385
- fn process_dependency (
389
+ fn process_dependency < W : Write > (
386
390
& mut self ,
387
391
dep_name_in_pkg : PackageName ,
388
392
dep : Dependency ,
389
393
root_path : PathBuf ,
394
+ writer : & mut W ,
390
395
) -> Result < ( Renaming , ResolvingTable ) > {
391
396
Self :: download_and_update_if_remote (
392
397
dep_name_in_pkg,
393
398
& dep,
394
399
self . build_options . skip_fetch_latest_git_deps ,
400
+ writer,
395
401
) ?;
396
402
let ( dep_package, dep_package_dir) =
397
403
Self :: parse_package_manifest ( & dep, & dep_name_in_pkg, root_path)
398
404
. with_context ( || format ! ( "While processing dependency '{}'" , dep_name_in_pkg) ) ?;
399
- self . build_resolution_graph ( dep_package. clone ( ) , dep_package_dir, false )
405
+ self . build_resolution_graph ( dep_package. clone ( ) , dep_package_dir, false , writer )
400
406
. with_context ( || {
401
407
format ! ( "Unable to resolve package dependency '{}'" , dep_name_in_pkg)
402
408
} ) ?;
@@ -515,10 +521,11 @@ impl ResolvingGraph {
515
521
}
516
522
}
517
523
518
- pub fn download_dependency_repos (
524
+ pub fn download_dependency_repos < W : Write > (
519
525
manifest : & SourceManifest ,
520
526
build_options : & BuildConfig ,
521
527
root_path : & Path ,
528
+ writer : & mut W ,
522
529
) -> Result < ( ) > {
523
530
// include dev dependencies if in dev mode
524
531
let empty_deps;
@@ -534,24 +541,33 @@ impl ResolvingGraph {
534
541
* dep_name,
535
542
dep,
536
543
build_options. skip_fetch_latest_git_deps ,
544
+ writer,
537
545
) ?;
538
546
539
547
let ( dep_manifest, _) =
540
548
Self :: parse_package_manifest ( dep, dep_name, root_path. to_path_buf ( ) )
541
549
. with_context ( || format ! ( "While processing dependency '{}'" , * dep_name) ) ?;
542
550
// download dependencies of dependencies
543
- Self :: download_dependency_repos ( & dep_manifest, build_options, root_path) ?;
551
+ Self :: download_dependency_repos ( & dep_manifest, build_options, root_path, writer ) ?;
544
552
}
545
553
Ok ( ( ) )
546
554
}
547
555
548
- fn download_and_update_if_remote (
556
+ fn download_and_update_if_remote < W : Write > (
549
557
dep_name : PackageName ,
550
558
dep : & Dependency ,
551
559
skip_fetch_latest_git_deps : bool ,
560
+ writer : & mut W ,
552
561
) -> Result < ( ) > {
553
562
if let Some ( git_info) = & dep. git_info {
554
563
if !git_info. download_to . exists ( ) {
564
+ writeln ! (
565
+ writer,
566
+ "{} {}" ,
567
+ "FETCHING GIT DEPENDENCY" . bold( ) . green( ) ,
568
+ git_info. git_url
569
+ ) ?;
570
+
555
571
// If the cached folder does not exist, download and clone accordingly
556
572
Command :: new ( "git" )
557
573
. args ( [
0 commit comments