@@ -1632,9 +1632,15 @@ impl Step for Extended {
1632
1632
prepare ( "cargo" ) ;
1633
1633
prepare ( "rust-std" ) ;
1634
1634
prepare ( "rust-analysis" ) ;
1635
- prepare ( "clippy" ) ;
1636
- prepare ( "rust-analyzer" ) ;
1637
- for tool in & [ "rust-docs" , "miri" , "rustc-codegen-cranelift" ] {
1635
+
1636
+ for tool in & [
1637
+ "clippy" ,
1638
+ "rustfmt" ,
1639
+ "rust-analyzer" ,
1640
+ "rust-docs" ,
1641
+ "miri" ,
1642
+ "rustc-codegen-cranelift" ,
1643
+ ] {
1638
1644
if built_tools. contains ( tool) {
1639
1645
prepare ( tool) ;
1640
1646
}
@@ -1674,6 +1680,8 @@ impl Step for Extended {
1674
1680
"rust-analyzer-preview" . to_string ( )
1675
1681
} else if name == "clippy" {
1676
1682
"clippy-preview" . to_string ( )
1683
+ } else if name == "rustfmt" {
1684
+ "rustfmt-preview" . to_string ( )
1677
1685
} else if name == "miri" {
1678
1686
"miri-preview" . to_string ( )
1679
1687
} else if name == "rustc-codegen-cranelift" {
@@ -1693,7 +1701,7 @@ impl Step for Extended {
1693
1701
prepare ( "cargo" ) ;
1694
1702
prepare ( "rust-analysis" ) ;
1695
1703
prepare ( "rust-std" ) ;
1696
- for tool in & [ "clippy" , "rust-analyzer" , "rust-docs" , "miri" ] {
1704
+ for tool in & [ "clippy" , "rustfmt" , " rust-analyzer", "rust-docs" , "miri" ] {
1697
1705
if built_tools. contains ( tool) {
1698
1706
prepare ( tool) ;
1699
1707
}
@@ -1811,6 +1819,24 @@ impl Step for Extended {
1811
1819
. arg ( etc. join ( "msi/remove-duplicates.xsl" ) )
1812
1820
. run ( builder) ;
1813
1821
}
1822
+ if built_tools. contains ( "rustfmt" ) {
1823
+ command ( & heat)
1824
+ . current_dir ( & exe)
1825
+ . arg ( "dir" )
1826
+ . arg ( "rustfmt" )
1827
+ . args ( heat_flags)
1828
+ . arg ( "-cg" )
1829
+ . arg ( "RustFmtGroup" )
1830
+ . arg ( "-dr" )
1831
+ . arg ( "RustFmt" )
1832
+ . arg ( "-var" )
1833
+ . arg ( "var.RustFmtDir" )
1834
+ . arg ( "-out" )
1835
+ . arg ( exe. join ( "RustFmtGroup.wxs" ) )
1836
+ . arg ( "-t" )
1837
+ . arg ( etc. join ( "msi/remove-duplicates.xsl" ) )
1838
+ . run ( builder) ;
1839
+ }
1814
1840
if built_tools. contains ( "miri" ) {
1815
1841
command ( & heat)
1816
1842
. current_dir ( & exe)
@@ -1877,11 +1903,14 @@ impl Step for Extended {
1877
1903
. arg ( "-out" )
1878
1904
. arg ( & output)
1879
1905
. arg ( input) ;
1880
- add_env ( builder, & mut cmd, target) ;
1906
+ add_env ( builder, & mut cmd, target, & built_tools ) ;
1881
1907
1882
1908
if built_tools. contains ( "clippy" ) {
1883
1909
cmd. arg ( "-dClippyDir=clippy" ) ;
1884
1910
}
1911
+ if built_tools. contains ( "rustfmt" ) {
1912
+ cmd. arg ( "-dRustFmtDir=rustfmt" ) ;
1913
+ }
1885
1914
if built_tools. contains ( "rust-docs" ) {
1886
1915
cmd. arg ( "-dDocsDir=rust-docs" ) ;
1887
1916
}
@@ -1908,6 +1937,9 @@ impl Step for Extended {
1908
1937
if built_tools. contains ( "clippy" ) {
1909
1938
candle ( "ClippyGroup.wxs" . as_ref ( ) ) ;
1910
1939
}
1940
+ if built_tools. contains ( "rustfmt" ) {
1941
+ candle ( "RustFmtGroup.wxs" . as_ref ( ) ) ;
1942
+ }
1911
1943
if built_tools. contains ( "miri" ) {
1912
1944
candle ( "MiriGroup.wxs" . as_ref ( ) ) ;
1913
1945
}
@@ -1946,6 +1978,9 @@ impl Step for Extended {
1946
1978
if built_tools. contains ( "clippy" ) {
1947
1979
cmd. arg ( "ClippyGroup.wixobj" ) ;
1948
1980
}
1981
+ if built_tools. contains ( "rustfmt" ) {
1982
+ cmd. arg ( "RustFmtGroup.wixobj" ) ;
1983
+ }
1949
1984
if built_tools. contains ( "miri" ) {
1950
1985
cmd. arg ( "MiriGroup.wixobj" ) ;
1951
1986
}
@@ -1972,7 +2007,12 @@ impl Step for Extended {
1972
2007
}
1973
2008
}
1974
2009
1975
- fn add_env ( builder : & Builder < ' _ > , cmd : & mut BootstrapCommand , target : TargetSelection ) {
2010
+ fn add_env (
2011
+ builder : & Builder < ' _ > ,
2012
+ cmd : & mut BootstrapCommand ,
2013
+ target : TargetSelection ,
2014
+ built_tools : & HashSet < & ' static str > ,
2015
+ ) {
1976
2016
let mut parts = builder. version . split ( '.' ) ;
1977
2017
cmd. env ( "CFG_RELEASE_INFO" , builder. rust_version ( ) )
1978
2018
. env ( "CFG_RELEASE_NUM" , & builder. version )
@@ -1993,6 +2033,15 @@ fn add_env(builder: &Builder<'_>, cmd: &mut BootstrapCommand, target: TargetSele
1993
2033
} else {
1994
2034
cmd. env ( "CFG_MINGW" , "0" ) . env ( "CFG_ABI" , "MSVC" ) ;
1995
2035
}
2036
+
2037
+ // ensure these variables are defined
2038
+ let mut define_optional_tool = |tool_name : & str , env_name : & str | {
2039
+ cmd. env ( env_name, if built_tools. contains ( tool_name) { "1" } else { "0" } ) ;
2040
+ } ;
2041
+ define_optional_tool ( "rustfmt" , "CFG_RUSTFMT" ) ;
2042
+ define_optional_tool ( "clippy" , "CFG_CLIPPY" ) ;
2043
+ define_optional_tool ( "miri" , "CFG_MIRI" ) ;
2044
+ define_optional_tool ( "rust-analyzer" , "CFG_RA" ) ;
1996
2045
}
1997
2046
1998
2047
fn install_llvm_file (
0 commit comments