@@ -183,88 +183,79 @@ def docs(source_dir = "docs", data = [], deps = [], scan_code = [], known_good =
183183 data_with_docs_sources = _rewrite_needs_json_to_docs_sources (data )
184184 additional_combo_sourcelinks = _rewrite_needs_json_to_sourcelinks (data )
185185 _merge_sourcelinks (name = "merged_sourcelinks" , sourcelinks = [":sourcelinks_json" ] + additional_combo_sourcelinks , known_good = known_good )
186+ docs_data = data + [":sourcelinks_json" ]
187+ combo_data = data_with_docs_sources + [":merged_sourcelinks" ]
188+
189+ docs_env = {
190+ "SOURCE_DIRECTORY" : source_dir ,
191+ "DATA" : str (data ),
192+ "ACTION" : "incremental" ,
193+ "SCORE_SOURCELINKS" : "$(location :sourcelinks_json)" ,
194+ }
195+ docs_sources_env = {
196+ "SOURCE_DIRECTORY" : source_dir ,
197+ "DATA" : str (data_with_docs_sources ),
198+ "ACTION" : "incremental" ,
199+ "SCORE_SOURCELINKS" : "$(location :merged_sourcelinks)" ,
200+ }
201+ if known_good :
202+ docs_env ["KNOWN_GOOD_JSON" ] = "$(location " + known_good + ")"
203+ docs_sources_env ["KNOWN_GOOD_JSON" ] = "$(location " + known_good + ")"
204+ docs_data .append (known_good )
205+ combo_data .append (known_good )
186206
187207 py_binary (
188208 name = "docs" ,
189209 tags = ["cli_help=Build documentation:\n bazel run //:docs" ],
190210 srcs = ["@score_docs_as_code//src:incremental.py" ],
191- data = data + [ ":sourcelinks_json" ] ,
211+ data = docs_data ,
192212 deps = deps ,
193- env = {
194- "SOURCE_DIRECTORY" : source_dir ,
195- "DATA" : str (data ),
196- "ACTION" : "incremental" ,
197- "SCORE_SOURCELINKS" : "$(location :sourcelinks_json)" ,
198- },
213+ env = docs_env ,
199214 )
200215
201216 py_binary (
202217 name = "docs_combo_experimental" ,
203218 tags = ["cli_help=Build full documentation with all dependencies:\n bazel run //:docs_combo_experimental" ],
204219 srcs = ["@score_docs_as_code//src:incremental.py" ],
205- data = data_with_docs_sources + [ ":merged_sourcelinks" ] ,
220+ data = combo_data ,
206221 deps = deps ,
207- env = {
208- "SOURCE_DIRECTORY" : source_dir ,
209- "DATA" : str (data_with_docs_sources ),
210- "ACTION" : "incremental" ,
211- "SCORE_SOURCELINKS" : "$(location :merged_sourcelinks)" ,
212- },
222+ env = docs_sources_env
213223 )
214224
215225 py_binary (
216226 name = "docs_link_check" ,
217227 tags = ["cli_help=Verify Links inside Documentation:\n bazel run //:link_check\n (Note: this could take a long time)" ],
218228 srcs = ["@score_docs_as_code//src:incremental.py" ],
219- data = data ,
229+ data = docs_data ,
220230 deps = deps ,
221- env = {
222- "SOURCE_DIRECTORY" : source_dir ,
223- "DATA" : str (data ),
224- "ACTION" : "linkcheck" ,
225- },
231+ env = docs_env
226232 )
227233
228234 py_binary (
229235 name = "docs_check" ,
230236 tags = ["cli_help=Verify documentation:\n bazel run //:docs_check" ],
231237 srcs = ["@score_docs_as_code//src:incremental.py" ],
232- data = data + [ ":sourcelinks_json" ] ,
238+ data = docs_data ,
233239 deps = deps ,
234- env = {
235- "SOURCE_DIRECTORY" : source_dir ,
236- "DATA" : str (data ),
237- "ACTION" : "check" ,
238- "SCORE_SOURCELINKS" : "$(location :sourcelinks_json)" ,
239- },
240+ env = docs_env ,
240241 )
241242
242243 py_binary (
243244 name = "live_preview" ,
244245 tags = ["cli_help=Live preview documentation in the browser:\n bazel run //:live_preview" ],
245246 srcs = ["@score_docs_as_code//src:incremental.py" ],
246- data = data + [ ":sourcelinks_json" ] ,
247+ data = docs_data ,
247248 deps = deps ,
248- env = {
249- "SOURCE_DIRECTORY" : source_dir ,
250- "DATA" : str (data ),
251- "ACTION" : "live_preview" ,
252- "SCORE_SOURCELINKS" : "$(location :sourcelinks_json)" ,
253- },
249+ env = docs_env ,
254250 )
255251
256252 py_binary (
257253 name = "live_preview_combo_experimental" ,
258254 tags = ["cli_help=Live preview full documentation with all dependencies in the browser:\n bazel run //:live_preview_combo_experimental" ],
259255 srcs = ["@score_docs_as_code//src:incremental.py" ],
260- data = data_with_docs_sources + [ ":merged_sourcelinks" ] ,
256+ data = combo_data ,
261257 deps = deps ,
262- env = {
263- "SOURCE_DIRECTORY" : source_dir ,
264- "DATA" : str (data_with_docs_sources ),
265- "ACTION" : "live_preview" ,
266- "SCORE_SOURCELINKS" : "$(location :merged_sourcelinks)" ,
267- },
258+ env = docs_sources_env
268259 )
269260
270261 score_virtualenv (
0 commit comments