compiletools 5.2.0__tar.gz → 5.3.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. {compiletools-5.2.0 → compiletools-5.3.1}/PKG-INFO +3 -3
  2. {compiletools-5.2.0 → compiletools-5.3.1}/pyproject.toml +3 -3
  3. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/README.ct-cache-clean.rst +1 -1
  4. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/README.ct-cache.rst +1 -1
  5. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/README.ct-cake.rst +1 -1
  6. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/README.ct-commandline.rst +1 -1
  7. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/README.ct-config.rst +1 -1
  8. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/README.ct-doc.rst +1 -1
  9. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/README.ct-filelist.rst +1 -1
  10. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/README.ct-findtargets.rst +1 -1
  11. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/README.ct-gitroot.rst +1 -1
  12. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/README.ct-headertree.rst +1 -1
  13. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/README.ct-jobs.rst +1 -1
  14. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/README.ct-list-variants.rst +1 -1
  15. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/README.ct-magicflags.rst +1 -1
  16. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/cake.py +47 -2
  17. compiletools-5.3.1/src/compiletools/compilation_database.py +249 -0
  18. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/hunter.py +118 -0
  19. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/makefile.py +15 -13
  20. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/namer.py +14 -0
  21. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/test_cake.py +101 -0
  22. compiletools-5.3.1/src/compiletools/test_compilation_database.py +716 -0
  23. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/test_utils.py +33 -0
  24. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/testhelper.py +4 -1
  25. compiletools-5.3.1/src/compiletools/utils.py +202 -0
  26. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/version.py +1 -1
  27. compiletools-5.3.1/src/compiletools/wrappedos.py +117 -0
  28. compiletools-5.2.0/src/compiletools/compilation_database.py +0 -196
  29. compiletools-5.2.0/src/compiletools/test_compilation_database.py +0 -171
  30. compiletools-5.2.0/src/compiletools/utils.py +0 -164
  31. compiletools-5.2.0/src/compiletools/wrappedos.py +0 -66
  32. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/README.ct-cppdeps.rst +0 -0
  33. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/__init__.py +0 -0
  34. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/apptools.py +0 -0
  35. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/benchmark_file_analyzer_cache.py +0 -0
  36. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/compiler_macros.py +0 -0
  37. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/config.py +0 -0
  38. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/configutils.py +0 -0
  39. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/cppdeps.py +0 -0
  40. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/create_cmakelists.py +0 -0
  41. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/ct.conf.d/blank.conf +0 -0
  42. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/ct.conf.d/blank.release.conf +0 -0
  43. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/ct.conf.d/clang.debug.conf +0 -0
  44. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/ct.conf.d/clang.release.conf +0 -0
  45. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/ct.conf.d/ct.conf +0 -0
  46. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/ct.conf.d/gcc.debug.conf +0 -0
  47. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/ct.conf.d/gcc.release.conf +0 -0
  48. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/dirnamer.py +0 -0
  49. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/diskcache.py +0 -0
  50. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/doc.py +0 -0
  51. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/file_analyzer.py +0 -0
  52. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/file_analyzer_cache.py +0 -0
  53. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/filelist.py +0 -0
  54. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/findtargets.py +0 -0
  55. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/git_sha_report.py +0 -0
  56. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/git_utils.py +0 -0
  57. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/global_hash_registry.py +0 -0
  58. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/headerdeps.py +0 -0
  59. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/headertree.py +0 -0
  60. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/jobs.py +0 -0
  61. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/listvariants.py +0 -0
  62. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/magicflags.py +0 -0
  63. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/memoize.py +0 -0
  64. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/mmap_oracle_cache.py +0 -0
  65. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/preprocessor.py +0 -0
  66. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/calculator/add.C +0 -0
  67. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/calculator/add.H +0 -0
  68. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/calculator/calculator.cpp +0 -0
  69. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/calculator/calculator.h +0 -0
  70. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/calculator/main.cpp +0 -0
  71. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/conditional_includes/linux_header.h +0 -0
  72. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/conditional_includes/main.cpp +0 -0
  73. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/conditional_includes/windows_header.h +0 -0
  74. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/aarch64_feature.hpp +0 -0
  75. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/advanced_feature.hpp +0 -0
  76. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/advanced_preprocessor_header.hpp +0 -0
  77. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/advanced_preprocessor_test.cpp +0 -0
  78. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/alt_form_feature.hpp +0 -0
  79. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/arm_feature.hpp +0 -0
  80. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/armcc_feature.hpp +0 -0
  81. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/avx2_optimization.hpp +0 -0
  82. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/basic_feature.hpp +0 -0
  83. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/cache_profiler.hpp +0 -0
  84. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/certificate_validation.hpp +0 -0
  85. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/cflags_feature.hpp +0 -0
  86. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/clang_feature.hpp +0 -0
  87. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/combined_features.hpp +0 -0
  88. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/compiler_builtin_header.hpp +0 -0
  89. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/compiler_builtin_test.cpp +0 -0
  90. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/conditional_header.hpp +0 -0
  91. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/cppflags_feature.hpp +0 -0
  92. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/cpu_profiler.hpp +0 -0
  93. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/custom_allocator.hpp +0 -0
  94. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/cxxflags_feature.hpp +0 -0
  95. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/default_feature.hpp +0 -0
  96. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/detailed_profiler.hpp +0 -0
  97. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/elif_header.hpp +0 -0
  98. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/elif_test.cpp +0 -0
  99. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/emscripten_feature.hpp +0 -0
  100. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/expert_feature.hpp +0 -0
  101. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/expert_mode_base.hpp +0 -0
  102. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/fma_optimization.hpp +0 -0
  103. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/gcc_feature.hpp +0 -0
  104. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/high_optimization.hpp +0 -0
  105. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/intel_feature.hpp +0 -0
  106. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/leak_detector.hpp +0 -0
  107. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/linux_advanced.hpp +0 -0
  108. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/linux_epoll_threading.hpp +0 -0
  109. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/linux_feature.hpp +0 -0
  110. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/main.cpp +0 -0
  111. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/memory_profiler.hpp +0 -0
  112. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/memory_tracker.hpp +0 -0
  113. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/msvc_feature.hpp +0 -0
  114. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/multi_flag_header.hpp +0 -0
  115. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/multi_flag_test.cpp +0 -0
  116. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/nested_macros_header.hpp +0 -0
  117. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/nested_macros_test.cpp +0 -0
  118. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/networking_base.hpp +0 -0
  119. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/numa_threading.hpp +0 -0
  120. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/partial_features.hpp +0 -0
  121. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/profiling_base.hpp +0 -0
  122. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/riscv_feature.hpp +0 -0
  123. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/simd_optimization.hpp +0 -0
  124. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/ssl_networking.hpp +0 -0
  125. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/stack_tracer.hpp +0 -0
  126. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/strict_cert_validation.hpp +0 -0
  127. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/tcc_feature.hpp +0 -0
  128. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/temp_defined.hpp +0 -0
  129. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/temp_still_defined.hpp +0 -0
  130. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/version1_feature.hpp +0 -0
  131. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/version2_feature.hpp +0 -0
  132. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/version3_feature.hpp +0 -0
  133. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/version_205_plus.hpp +0 -0
  134. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/version_ge_2_feature.hpp +0 -0
  135. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/windows_advanced.hpp +0 -0
  136. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/windows_iocp.hpp +0 -0
  137. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/windows_iocp_threading.hpp +0 -0
  138. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cppflags_macros/x86_64_feature.hpp +0 -0
  139. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cross_platform/cross_platform.cpp +0 -0
  140. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cross_platform/cross_platform.hpp +0 -0
  141. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cross_platform/cross_platform_lin.cpp +0 -0
  142. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cross_platform/cross_platform_win.cpp +0 -0
  143. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cross_platform/test_source.cpp +0 -0
  144. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cycle/cycle_a.hpp +0 -0
  145. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cycle/cycle_b.hpp +0 -0
  146. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/cycle/cycle_c.hpp +0 -0
  147. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/dottypaths/d1/d1.cpp +0 -0
  148. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/dottypaths/d1/d1.hpp +0 -0
  149. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/dottypaths/d2/d2.cpp +0 -0
  150. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/dottypaths/d2/d2.hpp +0 -0
  151. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/dottypaths/dottypaths.cpp +0 -0
  152. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/factory/a_widget.cpp +0 -0
  153. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/factory/a_widget.hpp +0 -0
  154. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/factory/red_herring_c_style_2.hpp +0 -0
  155. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/factory/test_factory.cpp +0 -0
  156. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/factory/widget.hpp +0 -0
  157. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/factory/widget_factory.cpp +0 -0
  158. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/factory/widget_factory.hpp +0 -0
  159. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/factory/z_widget.cpp +0 -0
  160. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/factory/z_widget.hpp +0 -0
  161. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/feature_headers/database.h +0 -0
  162. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/feature_headers/feature_config.h +0 -0
  163. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/feature_headers/graphics.h +0 -0
  164. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/feature_headers/logging.h +0 -0
  165. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/feature_headers/main.cpp +0 -0
  166. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/feature_headers/networking.h +0 -0
  167. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/isystem_include_bug/fake_system_include/system/version.h +0 -0
  168. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/isystem_include_bug/main.cpp +0 -0
  169. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/ldflags/conditional_ldflags_test.cpp +0 -0
  170. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/ldflags/version_dependent_ldflags.cpp +0 -0
  171. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/ldflags/version_macro.hpp +0 -0
  172. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/library/build.sh +0 -0
  173. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/library/main.cpp +0 -0
  174. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/library/mylib/get_double.cpp +0 -0
  175. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/library/mylib/get_double.hpp +0 -0
  176. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/library/mylib/get_int.cpp +0 -0
  177. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/library/mylib/get_int.hpp +0 -0
  178. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/library/mylib/get_numbers.cpp +0 -0
  179. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/library/mylib/get_numbers.hpp +0 -0
  180. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/lotsofmagic/lotsofmagic.cpp +0 -0
  181. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/macro_deps/feature_header.hpp +0 -0
  182. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/macro_deps/feature_x_impl.cpp +0 -0
  183. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/macro_deps/feature_y_impl.cpp +0 -0
  184. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/macro_deps/main.cpp +0 -0
  185. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/macro_state_dependency/README.md +0 -0
  186. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/macro_state_dependency/clean_main.cpp +0 -0
  187. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/macro_state_dependency/config.h +0 -0
  188. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/macro_state_dependency/core.h +0 -0
  189. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/macro_state_dependency/debug.h +0 -0
  190. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/macro_state_dependency/feature.h +0 -0
  191. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/macro_state_dependency/main.cpp +0 -0
  192. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/macro_state_dependency/module_b.h +0 -0
  193. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/macro_state_dependency/pytest_test.py +0 -0
  194. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/macro_state_dependency/release.h +0 -0
  195. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/macro_state_dependency/sample.cpp +0 -0
  196. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/macro_state_dependency/test_exposes_bug.py +0 -0
  197. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/macro_state_dependency/test_macro_state_bug.py +0 -0
  198. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/macro_state_dependency/test_macro_state_dependency.py +0 -0
  199. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/magic_processing_order/complex_header.h +0 -0
  200. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/magic_processing_order/complex_test.cpp +0 -0
  201. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/magic_processing_order/macro_header.h +0 -0
  202. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/magic_processing_order/test_macro_transform.cpp +0 -0
  203. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/magic_processing_order/traits_header.h +0 -0
  204. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/magicinclude/main.cpp +0 -0
  205. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/magicinclude/subdir/important.hpp +0 -0
  206. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/magicinclude/subdir2/important2.hpp +0 -0
  207. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/magicinclude/subdir3/important3.hpp +0 -0
  208. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/magicpkgconfig/main.cpp +0 -0
  209. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/magicsourceinheader/include_dir/some_header.hpp +0 -0
  210. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/magicsourceinheader/include_dir/sub_dir/another_header.hpp +0 -0
  211. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/magicsourceinheader/include_dir/sub_dir/the_code_lin.cpp +0 -0
  212. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/magicsourceinheader/include_dir/sub_dir/the_code_win.cpp +0 -0
  213. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/magicsourceinheader/main.cpp +0 -0
  214. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/movingheaders/main.cpp +0 -0
  215. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/movingheaders/someheader.hpp +0 -0
  216. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/nestedconfig/gcc.debug.conf +0 -0
  217. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/nestedconfig/nc.cpp +0 -0
  218. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/nestedconfig/subdir/gcc.debug.conf +0 -0
  219. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/nestedconfig/subdir/nc.cpp +0 -0
  220. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/numbers/get_double.cpp +0 -0
  221. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/numbers/get_double.hpp +0 -0
  222. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/numbers/get_int.cpp +0 -0
  223. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/numbers/get_int.hpp +0 -0
  224. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/numbers/get_numbers.cpp +0 -0
  225. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/numbers/get_numbers.hpp +0 -0
  226. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/numbers/test_direct_include.cpp +0 -0
  227. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/numbers/test_library.cpp +0 -0
  228. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/pkgconfig/main.cpp +0 -0
  229. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/serialise_tests/README.txt +0 -0
  230. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/serialise_tests/createfile.cpp +0 -0
  231. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/serialise_tests/createfile.hpp +0 -0
  232. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/serialise_tests/filename.hpp +0 -0
  233. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/serialise_tests/obtainlock.cpp +0 -0
  234. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/serialise_tests/obtainlock.hpp +0 -0
  235. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/serialise_tests/test_flock_1.cpp +0 -0
  236. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/serialise_tests/test_flock_2.cpp +0 -0
  237. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/simple/helloworld_c.c +0 -0
  238. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/simple/helloworld_cpp.cpp +0 -0
  239. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/simple/test_cflags.c +0 -0
  240. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/version_dependent_api/api_config.h +0 -0
  241. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/version_dependent_api/api_config_new.h +0 -0
  242. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/version_dependent_api/test_main.cpp +0 -0
  243. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/version_dependent_api/test_main_new.cpp +0 -0
  244. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/version_dependent_api/version.h +0 -0
  245. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/samples/version_dependent_api/version_new.h +0 -0
  246. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/simple_preprocessor.py +0 -0
  247. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/test_apptools.py +0 -0
  248. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/test_base.py +0 -0
  249. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/test_cache_performance.py +0 -0
  250. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/test_cache_versioning.py +0 -0
  251. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/test_cap.py +0 -0
  252. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/test_compiler_macros.py +0 -0
  253. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/test_configutils.py +0 -0
  254. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/test_cppdeps.py +0 -0
  255. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/test_ctcache_conflicts.py +0 -0
  256. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/test_ctcache_type_config.py +0 -0
  257. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/test_environment_assumptions.py +0 -0
  258. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/test_file_analyzer.py +0 -0
  259. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/test_file_analyzer_integration.py +0 -0
  260. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/test_findtargets.py +0 -0
  261. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/test_headerdeps.py +0 -0
  262. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/test_hunter.py +0 -0
  263. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/test_library.py +0 -0
  264. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/test_listvariants.py +0 -0
  265. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/test_macro_state_dependency.py +0 -0
  266. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/test_magicflags.py +0 -0
  267. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/test_magicinclude.py +0 -0
  268. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/test_magicpkgconfig.py +0 -0
  269. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/test_makefile.py +0 -0
  270. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/test_mmap_oracle_cache.py +0 -0
  271. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/test_movingheaders.py +0 -0
  272. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/test_namer.py +0 -0
  273. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/test_serialisetests.py +0 -0
  274. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/test_simple_preprocessor.py +0 -0
  275. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/tree.py +0 -0
  276. {compiletools-5.2.0 → compiletools-5.3.1}/src/compiletools/uth_reload.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: compiletools
3
- Version: 5.2.0
3
+ Version: 5.3.1
4
4
  Summary: Tools to make compiling C/C++ projects easy
5
5
  Keywords: c++,make,development
6
6
  Author: DrGeoff
@@ -23,7 +23,7 @@ Requires-Dist: rich>=12.0.0
23
23
  Requires-Dist: rich-rst>=1.1.7
24
24
  Requires-Dist: stringzilla>=3.0.0
25
25
  Requires-Dist: bump-my-version>=0.26.0 ; extra == 'dev'
26
- Requires-Dist: twine>=5.2.0 ; extra == 'dev'
26
+ Requires-Dist: twine>=5.0.0 ; extra == 'dev'
27
27
  Requires-Dist: pytest>=7.0.0 ; extra == 'dev'
28
28
  Requires-Dist: pytest-xdist>=3.0.0 ; extra == 'dev'
29
29
  Requires-Dist: ruff>=0.12.9 ; extra == 'dev'
@@ -47,7 +47,7 @@ C/C++ build tools that requires almost no configuration.
47
47
  :Author: drgeoffathome@gmail.com
48
48
  :Date: 2016-08-09
49
49
  :Copyright: Copyright (C) 2011-2016 Zomojo Pty Ltd
50
- :Version: 5.2.0
50
+ :Version: 5.3.1
51
51
  :Manual section: 1
52
52
  :Manual group: developers
53
53
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "compiletools"
3
- version = "5.2.0"
3
+ version = "5.3.1"
4
4
  description = "Tools to make compiling C/C++ projects easy"
5
5
  readme = "src/compiletools/README.ct-doc.rst"
6
6
  requires-python = ">=3.9"
@@ -33,7 +33,7 @@ dependencies = [
33
33
  [project.optional-dependencies]
34
34
  dev = [
35
35
  "bump-my-version>=0.26.0",
36
- "twine>=5.2.0",
36
+ "twine>=5.0.0",
37
37
  "pytest>=7.0.0",
38
38
  "pytest-xdist>=3.0.0",
39
39
  "ruff>=0.12.9",
@@ -83,7 +83,7 @@ include = [
83
83
  ]
84
84
 
85
85
  [tool.bumpversion]
86
- current_version = "5.2.0"
86
+ current_version = "5.3.1"
87
87
  parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
88
88
  serialize = ["{major}.{minor}.{patch}"]
89
89
  search = "{current_version}"
@@ -9,7 +9,7 @@ Remove the current dependency cache
9
9
  :Author: drgeoffathome@gmail.com
10
10
  :Date: 2018-02-23
11
11
  :Copyright: Copyright (C) 2011-2018 Zomojo Pty Ltd
12
- :Version: 5.2.0
12
+ :Version: 5.3.1
13
13
  :Manual section: 1
14
14
  :Manual group: developers
15
15
 
@@ -9,7 +9,7 @@ Where is the dependency information used by the ct-* applications stored
9
9
  :Author: drgeoffathome@gmail.com
10
10
  :Date: 2018-02-21
11
11
  :Copyright: Copyright (C) 2011-2018 Zomojo Pty Ltd
12
- :Version: 5.2.0
12
+ :Version: 5.3.1
13
13
  :Manual section: 1
14
14
  :Manual group: developers
15
15
 
@@ -9,7 +9,7 @@ Swiss army knife for building a C/C++ project
9
9
  :Author: drgeoffathome@gmail.com
10
10
  :Date: 2018-02-06
11
11
  :Copyright: Copyright (C) 2011-2016 Zomojo Pty Ltd
12
- :Version: 5.2.0
12
+ :Version: 5.3.1
13
13
  :Manual section: 1
14
14
  :Manual group: developers
15
15
 
@@ -9,7 +9,7 @@ This document describes the command line arguments that are common across ct-* p
9
9
  :Author: drgeoffathome@gmail.com
10
10
  :Date: 2017-07-06
11
11
  :Copyright: Copyright (C) 2011-2016 Zomojo Pty Ltd
12
- :Version: 5.2.0
12
+ :Version: 5.3.1
13
13
  :Manual section: 1
14
14
  :Manual group: developers
15
15
 
@@ -9,7 +9,7 @@ Helper tool for examining ct-* configuration
9
9
  :Author: drgeoffathome@gmail.com
10
10
  :Date: 2016-08-16
11
11
  :Copyright: Copyright (C) 2011-2016 Zomojo Pty Ltd
12
- :Version: 5.2.0
12
+ :Version: 5.3.1
13
13
  :Manual section: 1
14
14
  :Manual group: developers
15
15
 
@@ -12,7 +12,7 @@ C/C++ build tools that requires almost no configuration.
12
12
  :Author: drgeoffathome@gmail.com
13
13
  :Date: 2016-08-09
14
14
  :Copyright: Copyright (C) 2011-2016 Zomojo Pty Ltd
15
- :Version: 5.2.0
15
+ :Version: 5.3.1
16
16
  :Manual section: 1
17
17
  :Manual group: developers
18
18
 
@@ -9,7 +9,7 @@ Determine header and source dependencies of a C/C++ file by following headers an
9
9
  :Author: drgeoffathome@gmail.com
10
10
  :Date: 2017-07-06
11
11
  :Copyright: Copyright (C) 2011-2016 Zomojo Pty Ltd
12
- :Version: 5.2.0
12
+ :Version: 5.3.1
13
13
  :Manual section: 1
14
14
  :Manual group: developers
15
15
 
@@ -9,7 +9,7 @@ What
9
9
  :Author: drgeoffathome@gmail.com
10
10
  :Date: 2018-04-17
11
11
  :Copyright: Copyright (C) 2011-2018 Zomojo Pty Ltd
12
- :Version: 5.2.0
12
+ :Version: 5.3.1
13
13
  :Manual section: 1
14
14
  :Manual group: developers
15
15
 
@@ -9,7 +9,7 @@ What directory is the root of the git repository?
9
9
  :Author: drgeoffathome@gmail.com
10
10
  :Date: 2017-09-28
11
11
  :Copyright: Copyright (C) 2011-2016 Zomojo Pty Ltd
12
- :Version: 5.2.0
12
+ :Version: 5.3.1
13
13
  :Manual section: 1
14
14
  :Manual group: developers
15
15
 
@@ -9,7 +9,7 @@ Create a tree of header dependencies starting at the given C/C++ file
9
9
  :Author: drgeoffathome@gmail.com
10
10
  :Date: 2018-07-26
11
11
  :Copyright: Copyright (C) 2011-2018 Zomojo Pty Ltd
12
- :Version: 5.2.0
12
+ :Version: 5.3.1
13
13
  :Manual section: 1
14
14
  :Manual group: developers
15
15
 
@@ -9,7 +9,7 @@ How many jobs to run concurrently by the ct-* applications.
9
9
  :Author: drgeoffathome@gmail.com
10
10
  :Date: 2017-04-28
11
11
  :Copyright: Copyright (C) 2011-2016 Zomojo Pty Ltd
12
- :Version: 5.2.0
12
+ :Version: 5.3.1
13
13
  :Manual section: 1
14
14
  :Manual group: developers
15
15
 
@@ -9,7 +9,7 @@ Locates available variants for use by the ct-* applications
9
9
  :Author: drgeoffathome@gmail.com
10
10
  :Date: 2016-08-16
11
11
  :Copyright: Copyright (C) 2011-2016 Zomojo Pty Ltd
12
- :Version: 5.2.0
12
+ :Version: 5.3.1
13
13
  :Manual section: 1
14
14
  :Manual group: developers
15
15
 
@@ -9,7 +9,7 @@ Show the magic flags / magic comments that a file exports
9
9
  :Author: drgeoffathome@gmail.com
10
10
  :Date: 2018-02-23
11
11
  :Copyright: Copyright (C) 2011-2018 Zomojo Pty Ltd
12
- :Version: 5.2.0
12
+ :Version: 5.3.1
13
13
  :Manual section: 1
14
14
  :Manual group: developers
15
15
 
@@ -13,6 +13,7 @@ import compiletools.filelist
13
13
  import compiletools.findtargets
14
14
  import compiletools.jobs
15
15
  import compiletools.wrappedos
16
+ import compiletools.compilation_database
16
17
 
17
18
 
18
19
 
@@ -51,10 +52,10 @@ class Cake(object):
51
52
  """ Has to be separate because --auto fiddles with the args """
52
53
  # Create shared cache for all file analysis components
53
54
  from compiletools.file_analyzer import create_shared_analysis_cache
54
- shared_file_analyzer_cache = create_shared_analysis_cache(self.args)
55
+ self.shared_file_analyzer_cache = create_shared_analysis_cache(self.args)
55
56
 
56
57
  self.namer = compiletools.namer.Namer(self.args)
57
- self.headerdeps = compiletools.headerdeps.create(self.args, file_analyzer_cache=shared_file_analyzer_cache)
58
+ self.headerdeps = compiletools.headerdeps.create(self.args, file_analyzer_cache=self.shared_file_analyzer_cache)
58
59
  self.magicparser = compiletools.magicflags.create(self.args, self.headerdeps)
59
60
  self.hunter = compiletools.hunter.Hunter(self.args, self.headerdeps, self.magicparser)
60
61
 
@@ -86,6 +87,28 @@ class Cake(object):
86
87
 
87
88
  compiletools.findtargets.add_arguments(cap)
88
89
 
90
+ compiletools.utils.add_flag_argument(
91
+ parser=cap,
92
+ name="compilation-database",
93
+ dest="compilation_database",
94
+ default=True,
95
+ help="Generate compile_commands.json for clang tooling.",
96
+ )
97
+
98
+ cap.add(
99
+ "--compilation-database-output",
100
+ dest="compilation_database_output",
101
+ default=None,
102
+ help="Output filename for compilation database (default: <gitroot>/compile_commands.json)"
103
+ )
104
+
105
+ cap.add(
106
+ "--compilation-database-relative-paths",
107
+ dest="compilation_database_relative",
108
+ action="store_true",
109
+ help="Use relative paths instead of absolute paths in compilation database"
110
+ )
111
+
89
112
  compiletools.utils.add_boolean_argument(
90
113
  parser=cap,
91
114
  name="preprocess",
@@ -112,6 +135,24 @@ class Cake(object):
112
135
  filelist = compiletools.filelist.Filelist(self.args, self.hunter, style="flat")
113
136
  filelist.process()
114
137
 
138
+ def _call_compilation_database(self):
139
+ """Generate compilation database if requested"""
140
+ if not getattr(self.args, 'compilation_database', True):
141
+ return
142
+ if self.args.clean:
143
+ return # Don't generate compilation database during clean
144
+
145
+ # Reuse existing objects to avoid duplicating work
146
+ creator = compiletools.compilation_database.CompilationDatabaseCreator(
147
+ self.args,
148
+ file_analyzer_cache=self.shared_file_analyzer_cache,
149
+ namer=self.namer,
150
+ headerdeps=self.headerdeps,
151
+ magicparser=self.magicparser,
152
+ hunter=self.hunter
153
+ )
154
+ creator.write_compilation_database()
155
+
115
156
  def _copyexes(self):
116
157
  # Copy the executables into the "bin" dir (as per cake)
117
158
  # Unless the user has changed the bindir (or set --output)
@@ -162,6 +203,10 @@ class Cake(object):
162
203
  def _callmakefile(self):
163
204
  makefile_creator = compiletools.makefile.MakefileCreator(self.args, self.hunter)
164
205
  makefile_creator.create()
206
+
207
+ # Generate compilation database after makefile creation but before build
208
+ self._call_compilation_database()
209
+
165
210
  os.makedirs(self.namer.executable_dir(), exist_ok=True)
166
211
  cmd = ["make"]
167
212
  if self.args.verbose <= 1:
@@ -0,0 +1,249 @@
1
+ import json
2
+ import os
3
+ from typing import List, Dict, Any
4
+ from functools import lru_cache
5
+
6
+ import stringzilla as sz
7
+ import compiletools.utils
8
+ import compiletools.apptools
9
+ import compiletools.headerdeps
10
+ import compiletools.magicflags
11
+ import compiletools.hunter
12
+ import compiletools.namer
13
+ import compiletools.configutils
14
+ import compiletools.wrappedos
15
+
16
+
17
+ class CompilationDatabaseCreator:
18
+ """Creates compile_commands.json files for clang tooling integration"""
19
+
20
+ def __init__(self, args, file_analyzer_cache=None, namer=None, headerdeps=None, magicparser=None, hunter=None):
21
+ self.args = args
22
+
23
+ # Use provided objects or create new ones
24
+ self.namer = namer if namer is not None else compiletools.namer.Namer(args)
25
+ self.headerdeps = headerdeps if headerdeps is not None else compiletools.headerdeps.create(args, file_analyzer_cache=file_analyzer_cache)
26
+ self.magicparser = magicparser if magicparser is not None else compiletools.magicflags.create(args, self.headerdeps)
27
+ self.hunter = hunter if hunter is not None else compiletools.hunter.Hunter(args, self.headerdeps, self.magicparser)
28
+
29
+ @staticmethod
30
+ def add_arguments(cap):
31
+ """Add command-line arguments for standalone ct-compilation-database"""
32
+ # Add standard target arguments that define what sources to process
33
+ compiletools.apptools.add_target_arguments_ex(cap)
34
+
35
+ cap.add(
36
+ "--compilation-database-output",
37
+ dest="compilation_database_output",
38
+ default=None,
39
+ help="Output filename for compilation database (default: <gitroot>/compile_commands.json)"
40
+ )
41
+
42
+ cap.add(
43
+ "--relative-paths",
44
+ dest="compilation_database_relative",
45
+ action="store_true",
46
+ help="Use relative paths instead of absolute paths"
47
+ )
48
+
49
+ def _get_compiler_command(self, source_file: str) -> List[str]:
50
+ """Generate compiler command arguments for a source file with StringZilla optimization"""
51
+
52
+ # Determine compiler based on file extension
53
+ if compiletools.utils.is_cpp_source(source_file):
54
+ compiler = self.args.CXX
55
+ else:
56
+ compiler = self.args.CC
57
+
58
+ # Build arguments list
59
+ args = [compiler]
60
+
61
+ # Add standard flags
62
+ if hasattr(self.args, 'CPPFLAGS') and self.args.CPPFLAGS:
63
+ if isinstance(self.args.CPPFLAGS, list):
64
+ args.extend(self.args.CPPFLAGS)
65
+ else:
66
+ args.extend(compiletools.utils.cached_shlex_split(self.args.CPPFLAGS))
67
+
68
+ if compiletools.utils.is_cpp_source(source_file):
69
+ if hasattr(self.args, 'CXXFLAGS') and self.args.CXXFLAGS:
70
+ if isinstance(self.args.CXXFLAGS, list):
71
+ args.extend(self.args.CXXFLAGS)
72
+ else:
73
+ args.extend(compiletools.utils.cached_shlex_split(self.args.CXXFLAGS))
74
+ else:
75
+ if hasattr(self.args, 'CFLAGS') and self.args.CFLAGS:
76
+ args.extend(compiletools.utils.cached_shlex_split(self.args.CFLAGS))
77
+
78
+ # Add magic flags for this specific file
79
+ try:
80
+ magic_cppflags = self.magicparser.getmagic_cppflags_for_file(source_file)
81
+ if magic_cppflags:
82
+ args.extend(compiletools.utils.cached_shlex_split(magic_cppflags))
83
+
84
+ magic_cxxflags = self.magicparser.getmagic_cxxflags_for_file(source_file)
85
+ if magic_cxxflags:
86
+ args.extend(compiletools.utils.cached_shlex_split(magic_cxxflags))
87
+ except AttributeError:
88
+ # Magic flags methods may not exist
89
+ pass
90
+
91
+ # Add compile-only flag
92
+ args.extend(["-c"])
93
+
94
+ # Add the source file
95
+ if self.args.compilation_database_relative:
96
+ args.append(os.path.relpath(source_file, os.getcwd()))
97
+ else:
98
+ args.append(os.path.realpath(source_file))
99
+
100
+ return args
101
+
102
+ def _create_command_object(self, source_file: str) -> Dict[str, Any]:
103
+ """Create a single command object for the compilation database"""
104
+
105
+ # Directory is always absolute (working directory)
106
+ directory = os.path.realpath(os.getcwd())
107
+
108
+ # Get file path - relative or absolute based on option
109
+ if self.args.compilation_database_relative:
110
+ file_path = os.path.relpath(source_file, os.getcwd())
111
+ else:
112
+ file_path = os.path.realpath(source_file)
113
+
114
+ # Generate arguments
115
+ arguments = self._get_compiler_command(source_file)
116
+
117
+ return {
118
+ "directory": directory,
119
+ "file": file_path,
120
+ "arguments": arguments
121
+ }
122
+
123
+ def create_compilation_database(self) -> List[Dict[str, Any]]:
124
+ """Create the compilation database as a list of command objects"""
125
+
126
+ commands = []
127
+
128
+ # Discover all source files using Hunter's project-level discovery
129
+ try:
130
+ # Hunt for all source files from command line arguments and dependencies
131
+ self.hunter.huntsource()
132
+ source_files = self.hunter.getsources()
133
+
134
+ if self.args.verbose >= 6:
135
+ print(f"CompilationDatabase: Processing {len(source_files)} source files")
136
+
137
+ except Exception as e:
138
+ if self.args.verbose:
139
+ print(f"Warning: Error during source hunting: {e}")
140
+ source_files = []
141
+
142
+ # Process each source file
143
+ for source_file in source_files:
144
+ if os.path.exists(source_file):
145
+ command_obj = self._create_command_object(source_file)
146
+ commands.append(command_obj)
147
+ elif self.args.verbose >= 2:
148
+ print(f"Warning: Source file does not exist: {source_file}")
149
+
150
+ return commands
151
+
152
+ def write_compilation_database(self, output_file: str = None):
153
+ """Write the compilation database to file with incremental update support"""
154
+
155
+ if output_file is None:
156
+ output_file = self.namer.compilation_database_pathname()
157
+
158
+ # Create the command objects for current files
159
+ new_commands = self.create_compilation_database()
160
+
161
+ # For incremental updates: read existing database and merge using StringZilla
162
+ existing_commands = []
163
+ if os.path.exists(output_file):
164
+ try:
165
+ # Use StringZilla memory-mapped file reading
166
+ file_content = sz.Str(sz.File(output_file))
167
+ # JSON parsing requires conversion only at the boundary
168
+ if len(file_content) > 0:
169
+ existing_commands = json.loads(file_content.decode('utf-8'))
170
+ if self.args.verbose:
171
+ print(f"Loaded existing compilation database with StringZilla: {len(existing_commands)} entries")
172
+ else:
173
+ existing_commands = []
174
+ except Exception as e:
175
+ if self.args.verbose:
176
+ print(f"Warning: Could not read existing compilation database: {e}")
177
+ existing_commands = []
178
+
179
+
180
+ # Merge: Keep existing entries for files we're not updating using StringZilla operations
181
+ merged_commands = []
182
+
183
+ # Use StringZilla for optimal path processing performance
184
+ # Build set of normalized file paths from new commands
185
+ new_files_normalized = set()
186
+ for cmd in new_commands:
187
+ # Convert to StringZilla for optimal caching, then back to str for set
188
+ file_sz = sz.Str(cmd["file"])
189
+ normalized_sz = compiletools.wrappedos.realpath_sz(file_sz)
190
+ new_files_normalized.add(str(normalized_sz))
191
+
192
+ # Process existing commands with StringZilla optimization
193
+ for existing_cmd in existing_commands:
194
+ # Convert to StringZilla for consistent processing
195
+ existing_file_sz = sz.Str(existing_cmd["file"])
196
+ existing_normalized_sz = compiletools.wrappedos.realpath_sz(existing_file_sz)
197
+ if str(existing_normalized_sz) not in new_files_normalized:
198
+ merged_commands.append(existing_cmd)
199
+
200
+ # Add all new/updated entries
201
+ merged_commands.extend(new_commands)
202
+
203
+ # Write merged JSON file
204
+ try:
205
+ # Ensure the output directory exists
206
+ output_dir = compiletools.wrappedos.dirname(output_file)
207
+ if output_dir and not compiletools.wrappedos.isdir(output_dir):
208
+ os.makedirs(output_dir, exist_ok=True)
209
+
210
+ # Use StringZilla Str.write_to for faster file writing - no GIL, no copies
211
+ json_content = json.dumps(merged_commands, indent=2, ensure_ascii=False)
212
+ sz.Str(json_content).write_to(output_file)
213
+
214
+ if self.args.verbose:
215
+ print(f"Written compilation database with {len(merged_commands)} entries to {output_file}")
216
+ print(f" Updated: {len(new_commands)} entries")
217
+ print(f" Preserved: {len(merged_commands) - len(new_commands)} entries")
218
+
219
+ except Exception as e:
220
+ print(f"Error writing compilation database: {e}")
221
+ raise
222
+
223
+
224
+ def main(argv=None):
225
+ """Main entry point for ct-compilation-database"""
226
+
227
+ cap = compiletools.apptools.create_parser(
228
+ "Generate compile_commands.json for clang tooling", argv=argv
229
+ )
230
+
231
+ # Add compilation database specific arguments
232
+ CompilationDatabaseCreator.add_arguments(cap)
233
+
234
+ # Add standard compiletools arguments
235
+ compiletools.hunter.add_arguments(cap)
236
+
237
+ # Parse arguments
238
+ args = compiletools.apptools.parseargs(cap, argv)
239
+
240
+ # Create shared cache for all file analysis components
241
+ from compiletools.file_analyzer import create_shared_analysis_cache
242
+ shared_file_analyzer_cache = create_shared_analysis_cache(args)
243
+
244
+ # Create and run the compilation database creator
245
+ creator = CompilationDatabaseCreator(args, file_analyzer_cache=shared_file_analyzer_cache)
246
+ creator.write_compilation_database()
247
+
248
+ return 0
249
+
@@ -154,6 +154,8 @@ class Hunter(object):
154
154
  compiletools.wrappedos.clear_cache()
155
155
  compiletools.headerdeps.HeaderDepsBase.clear_cache()
156
156
  compiletools.magicflags.MagicFlagsBase.clear_cache()
157
+ # Clear class-level cache
158
+ # Hunter._magic_cache.clear() # This cache doesn't exist
157
159
  # Note: Cannot clear instance-level _parse_magic caches from static method
158
160
  # Each Hunter instance will retain its own cache until the instance is destroyed
159
161
 
@@ -163,6 +165,11 @@ class Hunter(object):
163
165
  self._parse_magic.cache_clear()
164
166
  if hasattr(self, '_required_files_cached'):
165
167
  self._required_files_cached.cache_clear()
168
+ # Clear project-level source discovery caches
169
+ if hasattr(self, '_hunted_sources'):
170
+ del self._hunted_sources
171
+ if hasattr(self, '_test_sources'):
172
+ del self._test_sources
166
173
 
167
174
  @functools.lru_cache(maxsize=None)
168
175
  def _parse_magic(self, filename):
@@ -191,3 +198,114 @@ class Hunter(object):
191
198
  if self.args.verbose >= 8:
192
199
  print("Hunter asking for header dependencies for ", source_filename)
193
200
  return self.headerdeps.process(source_filename)
201
+
202
+ def huntsource(self):
203
+ """Discover all source files from command line arguments and their dependencies.
204
+
205
+ This method analyzes the files specified in args.filename, args.static,
206
+ args.dynamic, and args.tests, then expands each to include all source
207
+ files it depends on. Results are cached for subsequent getsources() calls.
208
+ """
209
+ # For simplicity and test reliability, always recompute
210
+ # This prevents test isolation issues while maintaining functionality
211
+ if hasattr(self, '_hunted_sources'):
212
+ del self._hunted_sources
213
+ if hasattr(self, '_test_sources'):
214
+ del self._test_sources
215
+
216
+ if self.args.verbose >= 5:
217
+ print("Hunter::huntsource - Discovering all project sources")
218
+
219
+ # Get initial sources from command line arguments
220
+ initial_sources = []
221
+ if getattr(self.args, 'static', None):
222
+ initial_sources.extend(self.args.static)
223
+ if getattr(self.args, 'dynamic', None):
224
+ initial_sources.extend(self.args.dynamic)
225
+ if getattr(self.args, 'filename', None):
226
+ initial_sources.extend(self.args.filename)
227
+ if getattr(self.args, 'tests', None):
228
+ initial_sources.extend(self.args.tests)
229
+
230
+
231
+ if not initial_sources:
232
+ self._hunted_sources = []
233
+ if self.args.verbose >= 5:
234
+ print("Hunter::huntsource - No initial sources found")
235
+ return
236
+
237
+ initial_sources = compiletools.utils.ordered_unique(initial_sources)
238
+ if self.args.verbose >= 6:
239
+ print(f"Hunter::huntsource - Initial sources: {initial_sources}")
240
+
241
+ # Expand each source to include its dependencies
242
+ all_sources = set()
243
+ for source in initial_sources:
244
+ try:
245
+ realpath_source = compiletools.wrappedos.realpath(source)
246
+
247
+ # Skip files that don't exist
248
+ if not os.path.exists(realpath_source):
249
+ if self.args.verbose >= 2:
250
+ print(f"Hunter::huntsource - Source file does not exist: {source} -> {realpath_source}")
251
+ continue
252
+
253
+ required_sources = self.required_source_files(realpath_source)
254
+ all_sources.update(required_sources)
255
+
256
+ if self.args.verbose >= 7:
257
+ print(f"Hunter::huntsource - {source} expanded to {len(required_sources)} sources")
258
+
259
+ except Exception as e:
260
+ if self.args.verbose >= 2:
261
+ print(f"Warning: Error expanding source {source}: {e}")
262
+ # Include the original source even if expansion fails, but only if it exists
263
+ if os.path.exists(source):
264
+ all_sources.add(compiletools.wrappedos.realpath(source))
265
+
266
+ # Cache the results as sorted absolute paths
267
+ self._hunted_sources = sorted(all_sources) # all_sources already contains realpaths
268
+
269
+
270
+ if self.args.verbose >= 5:
271
+ print(f"Hunter::huntsource - Discovered {len(self._hunted_sources)} total sources")
272
+
273
+ def getsources(self):
274
+ """Get all discovered source files.
275
+
276
+ Returns the list of source files discovered by huntsource().
277
+ Calls huntsource() automatically if not already called.
278
+
279
+ Returns:
280
+ List of absolute paths to all source files
281
+ """
282
+ if not hasattr(self, '_hunted_sources'):
283
+ self.huntsource()
284
+ return self._hunted_sources
285
+
286
+ def gettestsources(self):
287
+ """Get test source files specifically.
288
+
289
+ Returns only the source files that came from args.tests expansion.
290
+ Calls huntsource() automatically if not already called.
291
+
292
+ Returns:
293
+ List of absolute paths to test source files
294
+ """
295
+ if not hasattr(self, '_test_sources'):
296
+ # Expand only test sources
297
+ test_sources = set()
298
+ if getattr(self.args, 'tests', None):
299
+ for source in self.args.tests:
300
+ try:
301
+ realpath_source = compiletools.wrappedos.realpath(source)
302
+ required_sources = self.required_source_files(realpath_source)
303
+ test_sources.update(required_sources)
304
+ except Exception as e:
305
+ if self.args.verbose >= 2:
306
+ print(f"Warning: Error expanding test source {source}: {e}")
307
+ test_sources.add(compiletools.wrappedos.realpath(source))
308
+
309
+ self._test_sources = sorted(compiletools.wrappedos.realpath(src) for src in test_sources)
310
+
311
+ return self._test_sources