]>
Commit | Line | Data |
---|---|---|
d6e3a706 JP |
1 | From bbe8d64377e2ff81cfe146d961d3ce3d7005d666 Mon Sep 17 00:00:00 2001 |
2 | From: Jan Palus <jpalus@fastmail.com> | |
3 | Date: Sat, 1 Jul 2023 14:36:09 +0200 | |
4 | Subject: [PATCH] Generate GIR once to fix intermittent parallel build failures | |
5 | ||
6 | typelib, doc-check and doc targets add file dependency on generated GIR | |
7 | file. As per CMake documentation that pulls commands to generate GIR | |
8 | file in every of those targets: | |
9 | ||
10 | https://cmake.org/cmake/help/latest/command/add_custom_command.html | |
11 | ||
12 | > If any dependency is an OUTPUT of another custom command in the same | |
13 | > directory (CMakeLists.txt file), CMake automatically brings the other | |
14 | > custom command into the target in which this command is built. | |
15 | ||
16 | Meaning there will be 4 different commands in total trying to create | |
17 | same file independently without any ordering enforced between them. This | |
18 | causes intermittent failures depending on timing in which those commands | |
19 | execute when invoking parallel build. | |
20 | ||
21 | To ensure that GIR is created only once and that proper ordering is in | |
22 | place replace file dependency with dependency on target creating GIR | |
23 | file. | |
24 | ||
25 | Signed-off-by: Jan Palus <jpalus@fastmail.com> | |
26 | --- | |
27 | Source/cmake/FindGI.cmake | 2 +- | |
28 | Source/cmake/FindGIDocgen.cmake | 5 +++-- | |
29 | 2 files changed, 4 insertions(+), 3 deletions(-) | |
30 | ||
31 | diff --git a/Source/cmake/FindGI.cmake b/Source/cmake/FindGI.cmake | |
32 | index fdc56b21b148..6b636af69a28 100644 | |
33 | --- a/Source/cmake/FindGI.cmake | |
34 | +++ b/Source/cmake/FindGI.cmake | |
90845fbf JB |
35 | @@ -265,7 +265,7 @@ function(GI_INTROSPECT namespace nsversi |
36 | get_property(dep_gir_lib TARGET "gir-${dep}" PROPERTY GI_GIR_LIBRARY) | |
37 | if (dep_gir_path) | |
38 | list(APPEND scanner_flags "--include-uninstalled=${dep_gir_path}") | |
39 | - list(APPEND gir_deps "${dep_gir_path}") | |
40 | + list(APPEND gir_deps "gir-${dep}") | |
41 | else () | |
42 | message(AUTHOR_WARNING | |
43 | "Target '${dep}' listed as a dependency but it has not " | |
d6e3a706 JP |
44 | @@ -376,7 +376,7 @@ function(GI_INTROSPECT namespace nsversion header) |
45 | add_custom_command( | |
46 | OUTPUT "${typ_path}" | |
47 | COMMENT "Generating ${gir_name}.typelib" | |
48 | - DEPENDS "${gir_path}" | |
49 | + DEPENDS "gir-${namespace}" | |
50 | VERBATIM | |
51 | COMMAND "${GI_COMPILER_EXE}" | |
52 | "--includedir=${CMAKE_BINARY_DIR}" | |
53 | diff --git a/Source/cmake/FindGIDocgen.cmake b/Source/cmake/FindGIDocgen.cmake | |
54 | index 88c90633e63f..ef560db7a2f0 100644 | |
55 | --- a/Source/cmake/FindGIDocgen.cmake | |
56 | +++ b/Source/cmake/FindGIDocgen.cmake | |
57 | @@ -180,7 +180,7 @@ function(GI_DOCGEN namespace toml) | |
58 | endif () | |
59 | set(outdir "${CMAKE_BINARY_DIR}/Documentation/${package}") | |
60 | ||
61 | - set(docdeps "${toml_path};${gir_path}") | |
62 | + set(docdeps "${toml_path};gir-${namespace}") | |
63 | foreach (item IN LISTS opt_CONTENT_TEMPLATES) | |
64 | get_filename_component(filename "${item}" NAME) | |
65 | configure_file("${item}.in" "${contentdir}/${filename}" @ONLY) | |
66 | @@ -239,10 +239,11 @@ function(GI_DOCGEN namespace toml) | |
67 | add_custom_target("doc-check-${namespace}" | |
68 | COMMENT "Checking documentation: ${namespace}" | |
69 | WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" | |
70 | - DEPENDS "${toml_path}" "${gir_path}" | |
71 | + DEPENDS "${toml_path}" | |
72 | VERBATIM | |
73 | COMMAND "${GIDocgen_EXE}" check ${common_flags} "${gir_path}" | |
74 | ) | |
75 | + add_dependencies("doc-check-${namespace}" "gir-${namespace}") | |
76 | ||
77 | if (NOT TARGET doc-check-all) | |
78 | add_custom_target(doc-check-all COMMENT "Check all documentation targets") | |
79 | -- | |
80 | 2.41.0 | |
81 |