@@ -132,6 +132,49 @@ impl Step for UnstableBook {
132
132
}
133
133
}
134
134
135
+ #[ derive( Debug , Copy , Clone , Hash , PartialEq , Eq ) ]
136
+ pub struct CargoBook {
137
+ target : Interned < String > ,
138
+ name : Interned < String > ,
139
+ src : Interned < PathBuf > ,
140
+ }
141
+
142
+ impl Step for CargoBook {
143
+ type Output = ( ) ;
144
+ const DEFAULT : bool = true ;
145
+
146
+ fn should_run ( run : ShouldRun ) -> ShouldRun {
147
+ let builder = run. builder ;
148
+ run. path ( "src/tools/cargo/src/doc/book" ) . default_condition ( builder. build . config . docs )
149
+ }
150
+
151
+ fn make_run ( run : RunConfig ) {
152
+ run. builder . ensure ( CargoBook {
153
+ target : run. target ,
154
+ name : INTERNER . intern_str ( "cargo" ) ,
155
+ src : INTERNER . intern_path ( PathBuf :: from ( "src/tools/cargo/src/doc/book" ) ) ,
156
+ } ) ;
157
+ }
158
+
159
+ fn run ( self , builder : & Builder ) {
160
+ let build = builder. build ;
161
+ let target = self . target ;
162
+ let name = self . name ;
163
+ let src = self . src ;
164
+ let out = build. doc_out ( target) ;
165
+ t ! ( fs:: create_dir_all( & out) ) ;
166
+
167
+ let out = out. join ( name) ;
168
+ println ! ( "Cargo Book ({}) - {}" , target, name) ;
169
+ let _ = fs:: remove_dir_all ( & out) ;
170
+ build. run ( builder. tool_cmd ( Tool :: Rustbook )
171
+ . arg ( "build" )
172
+ . arg ( & src)
173
+ . arg ( "-d" )
174
+ . arg ( out) ) ;
175
+ }
176
+ }
177
+
135
178
#[ derive( Debug , Copy , Clone , Hash , PartialEq , Eq ) ]
136
179
struct RustbookSrc {
137
180
target : Interned < String > ,
@@ -240,51 +283,6 @@ impl Step for TheBook {
240
283
}
241
284
}
242
285
243
- #[ derive( Debug , Copy , Clone , Hash , PartialEq , Eq ) ]
244
- pub struct CargoBook {
245
- target : Interned < String > ,
246
- }
247
-
248
- impl Step for CargoBook {
249
- type Output = ( ) ;
250
- const DEFAULT : bool = true ;
251
-
252
- fn should_run ( run : ShouldRun ) -> ShouldRun {
253
- let builder = run. builder ;
254
- run. path ( "src/doc/cargo" ) . default_condition ( builder. build . config . docs )
255
- }
256
-
257
- fn make_run ( run : RunConfig ) {
258
- run. builder . ensure ( CargoBook {
259
- target : run. target ,
260
- } ) ;
261
- }
262
-
263
- /// Create a placeholder for the cargo documentation so that doc.rust-lang.org/cargo will
264
- /// redirect to doc.crates.io. We want to publish doc.rust-lang.org/cargo in the paper
265
- /// version of the book, but we don't want to rush the process of switching cargo's docs
266
- /// over to mdbook and deploying them. When the cargo book is ready, this implementation
267
- /// should build the mdbook instead of this redirect page.
268
- fn run ( self , builder : & Builder ) {
269
- let build = builder. build ;
270
- let out = build. doc_out ( self . target ) ;
271
-
272
- let cargo_dir = out. join ( "cargo" ) ;
273
- t ! ( fs:: create_dir_all( & cargo_dir) ) ;
274
-
275
- let index = cargo_dir. join ( "index.html" ) ;
276
- let redirect_html = r#"
277
- <html>
278
- <head>
279
- <meta http-equiv="refresh" content="0; URL='http://doc.crates.io'" />
280
- </head>
281
- </html>"# ;
282
-
283
- println ! ( "Creating cargo book redirect page" ) ;
284
- t ! ( t!( File :: create( & index) ) . write_all( redirect_html. as_bytes( ) ) ) ;
285
- }
286
- }
287
-
288
286
fn invoke_rustdoc ( builder : & Builder , compiler : Compiler , target : Interned < String > , markdown : & str ) {
289
287
let build = builder. build ;
290
288
let out = build. doc_out ( target) ;
0 commit comments