@@ -557,6 +557,7 @@ pub struct Dependency {
557
557
registry : Option < String > ,
558
558
package : Option < String > ,
559
559
optional : bool ,
560
+ default_features : bool ,
560
561
}
561
562
562
563
/// Entry with data that corresponds to [`tar::EntryType`].
@@ -1161,12 +1162,15 @@ fn save_new_crate(
1161
1162
"name" : name,
1162
1163
"req" : dep. version_req,
1163
1164
"features" : dep. features,
1164
- "default_features" : true ,
1165
+ "default_features" : dep . default_features ,
1165
1166
"target" : dep. target,
1166
1167
"optional" : dep. optional,
1167
1168
"kind" : dep. kind,
1168
1169
"registry" : dep. registry,
1169
1170
"package" : package,
1171
+ "artifact" : dep. artifact,
1172
+ "bindep_target" : dep. bindep_target,
1173
+ "lib" : dep. lib,
1170
1174
} )
1171
1175
} )
1172
1176
. collect :: < Vec < _ > > ( ) ;
@@ -1179,7 +1183,7 @@ fn save_new_crate(
1179
1183
new_crate. features ,
1180
1184
false ,
1181
1185
new_crate. links ,
1182
- None ,
1186
+ new_crate . rust_version . as_deref ( ) ,
1183
1187
None ,
1184
1188
) ;
1185
1189
@@ -1415,7 +1419,7 @@ impl Package {
1415
1419
"name" : dep. name,
1416
1420
"req" : dep. vers,
1417
1421
"features" : dep. features,
1418
- "default_features" : true ,
1422
+ "default_features" : dep . default_features ,
1419
1423
"target" : dep. target,
1420
1424
"artifact" : artifact,
1421
1425
"bindep_target" : dep. bindep_target,
@@ -1580,6 +1584,21 @@ impl Package {
1580
1584
assert_eq ! ( registry, "alternative" ) ;
1581
1585
manifest. push_str ( & format ! ( "registry-index = \" {}\" " , alt_registry_url( ) ) ) ;
1582
1586
}
1587
+ if !dep. default_features {
1588
+ manifest. push_str ( "default-features = false\n " ) ;
1589
+ }
1590
+ if !dep. features . is_empty ( ) {
1591
+ let mut features = String :: new ( ) ;
1592
+ serde:: Serialize :: serialize (
1593
+ & dep. features ,
1594
+ toml:: ser:: ValueSerializer :: new ( & mut features) ,
1595
+ )
1596
+ . unwrap ( ) ;
1597
+ manifest. push_str ( & format ! ( "features = {}\n " , features) ) ;
1598
+ }
1599
+ if let Some ( package) = & dep. package {
1600
+ manifest. push_str ( & format ! ( "package = \" {}\" \n " , package) ) ;
1601
+ }
1583
1602
}
1584
1603
if self . proc_macro {
1585
1604
manifest. push_str ( "[lib]\n proc-macro = true\n " ) ;
@@ -1658,6 +1677,7 @@ impl Dependency {
1658
1677
package : None ,
1659
1678
optional : false ,
1660
1679
registry : None ,
1680
+ default_features : true ,
1661
1681
}
1662
1682
}
1663
1683
@@ -1710,4 +1730,10 @@ impl Dependency {
1710
1730
self . optional = optional;
1711
1731
self
1712
1732
}
1733
+
1734
+ /// Adds `default-features = false` if the argument is `false`.
1735
+ pub fn default_features ( & mut self , default_features : bool ) -> & mut Self {
1736
+ self . default_features = default_features;
1737
+ self
1738
+ }
1713
1739
}
0 commit comments