@@ -21,9 +21,13 @@ def _swift_doxygen_impl(ctx):
21
21
# this performs a CMake-like replacement of @VAR@ based on the vars dict
22
22
config = configure_file_impl (ctx , vars , ctx .attr .name + "_Doxyfile" )[0 ].files .to_list ()[0 ]
23
23
24
+ # Create a processed config file for sed operations
25
+ processed_config = ctx .actions .declare_file (ctx .attr .name + "_processed_Doxyfile" )
26
+
27
+ # First action: Create the processed config file and apply sed replacements
24
28
ctx .actions .run_shell (
25
- inputs = [config ] + ctx . files . deps ,
26
- outputs = [doxygen_out ],
29
+ inputs = [config ],
30
+ outputs = [processed_config ],
27
31
env = vars ,
28
32
command = """
29
33
DOXYGEN_DOT_FOUND=NO
@@ -36,18 +40,26 @@ def _swift_doxygen_impl(ctx):
36
40
37
41
PRW=`pwd`
38
42
39
- # backward compatibility with old CMake-style doxygen config files
40
- sed -i "s|@DOXYGEN_DOT_FOUND@|$DOXYGEN_DOT_FOUND|g" {config}
41
- sed -i "s|@DOXYGEN_DOT_PATH@|$DOXYGEN_DOT_PATH|g" {config}
42
- sed -i "s|@PLANTUML_JAR_PATH@|/usr/local/bin/plantuml.jar|g" {config}
43
- sed -i "s|@INPUT_DIR@|$PROJECT_SOURCE_DIR|g" {config}
44
- sed -i "s|@PROJECT_NAME@|$PROJECT_NAME|g" {config}
45
- sed -i "s|@STABLE_GIT_TAG@|$STABLE_GIT_TAG|g" {config}
46
- sed -i "s|@DOXYGEN_EXCLUDE@|$DOXYGEN_EXCLUDE|g" {config}
47
- sed -i "s|@PROJECT_SOURCE_DIR@|$PRW|g" {config}
43
+ # Apply backward compatibility sed replacements
44
+ sed "s|@DOXYGEN_DOT_FOUND@|$DOXYGEN_DOT_FOUND|g" {original_config} | \
45
+ sed "s|@DOXYGEN_DOT_PATH@|$DOXYGEN_DOT_PATH|g" | \
46
+ sed "s|@PLANTUML_JAR_PATH@|/usr/local/bin/plantuml.jar|g" | \
47
+ sed "s|@INPUT_DIR@|$PROJECT_SOURCE_DIR|g" | \
48
+ sed "s|@PROJECT_NAME@|$PROJECT_NAME|g" | \
49
+ sed "s|@STABLE_GIT_TAG@|$STABLE_GIT_TAG|g" | \
50
+ sed "s|@DOXYGEN_EXCLUDE@|$DOXYGEN_EXCLUDE|g" | \
51
+ sed "s|@PROJECT_SOURCE_DIR@|$PRW|g" > {processed_config}
52
+ """ .format (original_config = config .path , processed_config = processed_config .path ),
53
+ )
48
54
55
+ # Second action: Run doxygen with the processed config
56
+ ctx .actions .run_shell (
57
+ inputs = [processed_config ] + ctx .files .deps ,
58
+ outputs = [doxygen_out ],
59
+ env = vars ,
60
+ command = """
49
61
PATH=$PATH doxygen {config}
50
- """ .format (config = config .path ),
62
+ """ .format (config = processed_config .path ),
51
63
)
52
64
53
65
return [DefaultInfo (files = depset ([doxygen_out , config ]))]
0 commit comments