12
12
13
13
use compile:: { run_cargo, std_cargo, test_cargo, rustc_cargo, rustc_cargo_env, add_to_sysroot} ;
14
14
use builder:: { RunConfig , Builder , ShouldRun , Step } ;
15
+ use tool:: { self , prepare_tool_cargo} ;
15
16
use { Compiler , Mode } ;
16
17
use cache:: { INTERNER , Interned } ;
17
18
use std:: path:: PathBuf ;
@@ -41,6 +42,7 @@ impl Step for Std {
41
42
42
43
let out_dir = builder. stage_out ( compiler, Mode :: Libstd ) ;
43
44
builder. clear_if_dirty ( & out_dir, & builder. rustc ( compiler) ) ;
45
+
44
46
let mut cargo = builder. cargo ( compiler, Mode :: Libstd , target, "check" ) ;
45
47
std_cargo ( builder, & compiler, target, & mut cargo) ;
46
48
@@ -170,11 +172,12 @@ impl Step for Test {
170
172
}
171
173
172
174
fn run ( self , builder : & Builder ) {
173
- let target = self . target ;
174
175
let compiler = builder. compiler ( 0 , builder. config . build ) ;
176
+ let target = self . target ;
175
177
176
178
let out_dir = builder. stage_out ( compiler, Mode :: Libtest ) ;
177
179
builder. clear_if_dirty ( & out_dir, & libstd_stamp ( builder, compiler, target) ) ;
180
+
178
181
let mut cargo = builder. cargo ( compiler, Mode :: Libtest , target, "check" ) ;
179
182
test_cargo ( builder, & compiler, target, & mut cargo) ;
180
183
@@ -190,6 +193,54 @@ impl Step for Test {
190
193
}
191
194
}
192
195
196
+ #[ derive( Debug , Copy , Clone , PartialEq , Eq , Hash ) ]
197
+ pub struct Rustdoc {
198
+ pub target : Interned < String > ,
199
+ }
200
+
201
+ impl Step for Rustdoc {
202
+ type Output = ( ) ;
203
+ const ONLY_HOSTS : bool = true ;
204
+ const DEFAULT : bool = true ;
205
+
206
+ fn should_run ( run : ShouldRun ) -> ShouldRun {
207
+ run. path ( "src/tools/rustdoc" )
208
+ }
209
+
210
+ fn make_run ( run : RunConfig ) {
211
+ run. builder . ensure ( Rustdoc {
212
+ target : run. target ,
213
+ } ) ;
214
+ }
215
+
216
+ fn run ( self , builder : & Builder ) {
217
+ let compiler = builder. compiler ( 0 , builder. config . build ) ;
218
+ let target = self . target ;
219
+
220
+ let mut cargo = prepare_tool_cargo ( builder,
221
+ compiler,
222
+ target,
223
+ "check" ,
224
+ "src/tools/rustdoc" ) ;
225
+
226
+ let _folder = builder. fold_output ( || format ! ( "stage{}-rustdoc" , compiler. stage) ) ;
227
+ println ! ( "Checking rustdoc artifacts ({} -> {})" , & compiler. host, target) ;
228
+ run_cargo ( builder,
229
+ & mut cargo,
230
+ & rustdoc_stamp ( builder, compiler, target) ,
231
+ true ) ;
232
+
233
+ let libdir = builder. sysroot_libdir ( compiler, target) ;
234
+ add_to_sysroot ( & builder, & libdir, & rustdoc_stamp ( builder, compiler, target) ) ;
235
+
236
+ builder. ensure ( tool:: CleanTools {
237
+ compiler,
238
+ target,
239
+ mode : Mode :: Tool ,
240
+ } ) ;
241
+ }
242
+ }
243
+
193
244
/// Cargo's output path for the standard library in a given stage, compiled
194
245
/// by a particular compiler for the specified target.
195
246
pub fn libstd_stamp ( builder : & Builder , compiler : Compiler , target : Interned < String > ) -> PathBuf {
@@ -217,3 +268,9 @@ fn codegen_backend_stamp(builder: &Builder,
217
268
builder. cargo_out ( compiler, Mode :: Librustc , target)
218
269
. join ( format ! ( ".librustc_trans-{}-check.stamp" , backend) )
219
270
}
271
+
272
+ /// Cargo's output path for rustdoc in a given stage, compiled by a particular
273
+ /// compiler for the specified target.
274
+ pub fn rustdoc_stamp ( builder : & Builder , compiler : Compiler , target : Interned < String > ) -> PathBuf {
275
+ builder. cargo_out ( compiler, Mode :: Tool , target) . join ( ".rustdoc-check.stamp" )
276
+ }
0 commit comments