compiletools 5.2.0__tar.gz → 5.3.0__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 (274) hide show
  1. {compiletools-5.2.0 → compiletools-5.3.0}/PKG-INFO +3 -3
  2. {compiletools-5.2.0 → compiletools-5.3.0}/pyproject.toml +3 -3
  3. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/README.ct-cache-clean.rst +1 -1
  4. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/README.ct-cache.rst +1 -1
  5. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/README.ct-cake.rst +1 -1
  6. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/README.ct-commandline.rst +1 -1
  7. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/README.ct-config.rst +1 -1
  8. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/README.ct-doc.rst +1 -1
  9. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/README.ct-filelist.rst +1 -1
  10. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/README.ct-findtargets.rst +1 -1
  11. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/README.ct-gitroot.rst +1 -1
  12. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/README.ct-headertree.rst +1 -1
  13. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/README.ct-jobs.rst +1 -1
  14. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/README.ct-list-variants.rst +1 -1
  15. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/README.ct-magicflags.rst +1 -1
  16. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/cake.py +47 -2
  17. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/compilation_database.py +95 -48
  18. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/hunter.py +118 -0
  19. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/makefile.py +14 -12
  20. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/test_cake.py +101 -0
  21. compiletools-5.3.0/src/compiletools/test_compilation_database.py +715 -0
  22. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/testhelper.py +1 -1
  23. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/utils.py +12 -0
  24. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/version.py +1 -1
  25. compiletools-5.3.0/src/compiletools/wrappedos.py +108 -0
  26. compiletools-5.2.0/src/compiletools/test_compilation_database.py +0 -171
  27. compiletools-5.2.0/src/compiletools/wrappedos.py +0 -66
  28. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/README.ct-cppdeps.rst +0 -0
  29. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/__init__.py +0 -0
  30. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/apptools.py +0 -0
  31. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/benchmark_file_analyzer_cache.py +0 -0
  32. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/compiler_macros.py +0 -0
  33. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/config.py +0 -0
  34. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/configutils.py +0 -0
  35. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/cppdeps.py +0 -0
  36. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/create_cmakelists.py +0 -0
  37. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/ct.conf.d/blank.conf +0 -0
  38. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/ct.conf.d/blank.release.conf +0 -0
  39. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/ct.conf.d/clang.debug.conf +0 -0
  40. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/ct.conf.d/clang.release.conf +0 -0
  41. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/ct.conf.d/ct.conf +0 -0
  42. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/ct.conf.d/gcc.debug.conf +0 -0
  43. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/ct.conf.d/gcc.release.conf +0 -0
  44. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/dirnamer.py +0 -0
  45. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/diskcache.py +0 -0
  46. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/doc.py +0 -0
  47. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/file_analyzer.py +0 -0
  48. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/file_analyzer_cache.py +0 -0
  49. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/filelist.py +0 -0
  50. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/findtargets.py +0 -0
  51. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/git_sha_report.py +0 -0
  52. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/git_utils.py +0 -0
  53. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/global_hash_registry.py +0 -0
  54. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/headerdeps.py +0 -0
  55. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/headertree.py +0 -0
  56. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/jobs.py +0 -0
  57. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/listvariants.py +0 -0
  58. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/magicflags.py +0 -0
  59. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/memoize.py +0 -0
  60. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/mmap_oracle_cache.py +0 -0
  61. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/namer.py +0 -0
  62. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/preprocessor.py +0 -0
  63. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/calculator/add.C +0 -0
  64. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/calculator/add.H +0 -0
  65. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/calculator/calculator.cpp +0 -0
  66. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/calculator/calculator.h +0 -0
  67. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/calculator/main.cpp +0 -0
  68. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/conditional_includes/linux_header.h +0 -0
  69. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/conditional_includes/main.cpp +0 -0
  70. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/conditional_includes/windows_header.h +0 -0
  71. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/aarch64_feature.hpp +0 -0
  72. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/advanced_feature.hpp +0 -0
  73. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/advanced_preprocessor_header.hpp +0 -0
  74. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/advanced_preprocessor_test.cpp +0 -0
  75. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/alt_form_feature.hpp +0 -0
  76. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/arm_feature.hpp +0 -0
  77. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/armcc_feature.hpp +0 -0
  78. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/avx2_optimization.hpp +0 -0
  79. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/basic_feature.hpp +0 -0
  80. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/cache_profiler.hpp +0 -0
  81. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/certificate_validation.hpp +0 -0
  82. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/cflags_feature.hpp +0 -0
  83. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/clang_feature.hpp +0 -0
  84. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/combined_features.hpp +0 -0
  85. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/compiler_builtin_header.hpp +0 -0
  86. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/compiler_builtin_test.cpp +0 -0
  87. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/conditional_header.hpp +0 -0
  88. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/cppflags_feature.hpp +0 -0
  89. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/cpu_profiler.hpp +0 -0
  90. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/custom_allocator.hpp +0 -0
  91. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/cxxflags_feature.hpp +0 -0
  92. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/default_feature.hpp +0 -0
  93. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/detailed_profiler.hpp +0 -0
  94. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/elif_header.hpp +0 -0
  95. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/elif_test.cpp +0 -0
  96. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/emscripten_feature.hpp +0 -0
  97. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/expert_feature.hpp +0 -0
  98. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/expert_mode_base.hpp +0 -0
  99. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/fma_optimization.hpp +0 -0
  100. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/gcc_feature.hpp +0 -0
  101. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/high_optimization.hpp +0 -0
  102. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/intel_feature.hpp +0 -0
  103. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/leak_detector.hpp +0 -0
  104. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/linux_advanced.hpp +0 -0
  105. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/linux_epoll_threading.hpp +0 -0
  106. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/linux_feature.hpp +0 -0
  107. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/main.cpp +0 -0
  108. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/memory_profiler.hpp +0 -0
  109. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/memory_tracker.hpp +0 -0
  110. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/msvc_feature.hpp +0 -0
  111. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/multi_flag_header.hpp +0 -0
  112. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/multi_flag_test.cpp +0 -0
  113. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/nested_macros_header.hpp +0 -0
  114. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/nested_macros_test.cpp +0 -0
  115. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/networking_base.hpp +0 -0
  116. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/numa_threading.hpp +0 -0
  117. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/partial_features.hpp +0 -0
  118. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/profiling_base.hpp +0 -0
  119. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/riscv_feature.hpp +0 -0
  120. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/simd_optimization.hpp +0 -0
  121. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/ssl_networking.hpp +0 -0
  122. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/stack_tracer.hpp +0 -0
  123. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/strict_cert_validation.hpp +0 -0
  124. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/tcc_feature.hpp +0 -0
  125. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/temp_defined.hpp +0 -0
  126. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/temp_still_defined.hpp +0 -0
  127. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/version1_feature.hpp +0 -0
  128. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/version2_feature.hpp +0 -0
  129. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/version3_feature.hpp +0 -0
  130. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/version_205_plus.hpp +0 -0
  131. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/version_ge_2_feature.hpp +0 -0
  132. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/windows_advanced.hpp +0 -0
  133. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/windows_iocp.hpp +0 -0
  134. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/windows_iocp_threading.hpp +0 -0
  135. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cppflags_macros/x86_64_feature.hpp +0 -0
  136. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cross_platform/cross_platform.cpp +0 -0
  137. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cross_platform/cross_platform.hpp +0 -0
  138. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cross_platform/cross_platform_lin.cpp +0 -0
  139. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cross_platform/cross_platform_win.cpp +0 -0
  140. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cross_platform/test_source.cpp +0 -0
  141. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cycle/cycle_a.hpp +0 -0
  142. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cycle/cycle_b.hpp +0 -0
  143. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/cycle/cycle_c.hpp +0 -0
  144. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/dottypaths/d1/d1.cpp +0 -0
  145. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/dottypaths/d1/d1.hpp +0 -0
  146. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/dottypaths/d2/d2.cpp +0 -0
  147. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/dottypaths/d2/d2.hpp +0 -0
  148. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/dottypaths/dottypaths.cpp +0 -0
  149. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/factory/a_widget.cpp +0 -0
  150. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/factory/a_widget.hpp +0 -0
  151. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/factory/red_herring_c_style_2.hpp +0 -0
  152. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/factory/test_factory.cpp +0 -0
  153. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/factory/widget.hpp +0 -0
  154. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/factory/widget_factory.cpp +0 -0
  155. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/factory/widget_factory.hpp +0 -0
  156. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/factory/z_widget.cpp +0 -0
  157. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/factory/z_widget.hpp +0 -0
  158. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/feature_headers/database.h +0 -0
  159. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/feature_headers/feature_config.h +0 -0
  160. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/feature_headers/graphics.h +0 -0
  161. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/feature_headers/logging.h +0 -0
  162. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/feature_headers/main.cpp +0 -0
  163. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/feature_headers/networking.h +0 -0
  164. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/isystem_include_bug/fake_system_include/system/version.h +0 -0
  165. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/isystem_include_bug/main.cpp +0 -0
  166. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/ldflags/conditional_ldflags_test.cpp +0 -0
  167. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/ldflags/version_dependent_ldflags.cpp +0 -0
  168. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/ldflags/version_macro.hpp +0 -0
  169. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/library/build.sh +0 -0
  170. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/library/main.cpp +0 -0
  171. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/library/mylib/get_double.cpp +0 -0
  172. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/library/mylib/get_double.hpp +0 -0
  173. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/library/mylib/get_int.cpp +0 -0
  174. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/library/mylib/get_int.hpp +0 -0
  175. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/library/mylib/get_numbers.cpp +0 -0
  176. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/library/mylib/get_numbers.hpp +0 -0
  177. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/lotsofmagic/lotsofmagic.cpp +0 -0
  178. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/macro_deps/feature_header.hpp +0 -0
  179. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/macro_deps/feature_x_impl.cpp +0 -0
  180. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/macro_deps/feature_y_impl.cpp +0 -0
  181. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/macro_deps/main.cpp +0 -0
  182. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/macro_state_dependency/README.md +0 -0
  183. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/macro_state_dependency/clean_main.cpp +0 -0
  184. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/macro_state_dependency/config.h +0 -0
  185. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/macro_state_dependency/core.h +0 -0
  186. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/macro_state_dependency/debug.h +0 -0
  187. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/macro_state_dependency/feature.h +0 -0
  188. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/macro_state_dependency/main.cpp +0 -0
  189. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/macro_state_dependency/module_b.h +0 -0
  190. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/macro_state_dependency/pytest_test.py +0 -0
  191. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/macro_state_dependency/release.h +0 -0
  192. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/macro_state_dependency/sample.cpp +0 -0
  193. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/macro_state_dependency/test_exposes_bug.py +0 -0
  194. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/macro_state_dependency/test_macro_state_bug.py +0 -0
  195. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/macro_state_dependency/test_macro_state_dependency.py +0 -0
  196. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/magic_processing_order/complex_header.h +0 -0
  197. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/magic_processing_order/complex_test.cpp +0 -0
  198. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/magic_processing_order/macro_header.h +0 -0
  199. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/magic_processing_order/test_macro_transform.cpp +0 -0
  200. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/magic_processing_order/traits_header.h +0 -0
  201. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/magicinclude/main.cpp +0 -0
  202. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/magicinclude/subdir/important.hpp +0 -0
  203. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/magicinclude/subdir2/important2.hpp +0 -0
  204. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/magicinclude/subdir3/important3.hpp +0 -0
  205. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/magicpkgconfig/main.cpp +0 -0
  206. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/magicsourceinheader/include_dir/some_header.hpp +0 -0
  207. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/magicsourceinheader/include_dir/sub_dir/another_header.hpp +0 -0
  208. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/magicsourceinheader/include_dir/sub_dir/the_code_lin.cpp +0 -0
  209. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/magicsourceinheader/include_dir/sub_dir/the_code_win.cpp +0 -0
  210. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/magicsourceinheader/main.cpp +0 -0
  211. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/movingheaders/main.cpp +0 -0
  212. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/movingheaders/someheader.hpp +0 -0
  213. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/nestedconfig/gcc.debug.conf +0 -0
  214. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/nestedconfig/nc.cpp +0 -0
  215. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/nestedconfig/subdir/gcc.debug.conf +0 -0
  216. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/nestedconfig/subdir/nc.cpp +0 -0
  217. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/numbers/get_double.cpp +0 -0
  218. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/numbers/get_double.hpp +0 -0
  219. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/numbers/get_int.cpp +0 -0
  220. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/numbers/get_int.hpp +0 -0
  221. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/numbers/get_numbers.cpp +0 -0
  222. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/numbers/get_numbers.hpp +0 -0
  223. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/numbers/test_direct_include.cpp +0 -0
  224. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/numbers/test_library.cpp +0 -0
  225. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/pkgconfig/main.cpp +0 -0
  226. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/serialise_tests/README.txt +0 -0
  227. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/serialise_tests/createfile.cpp +0 -0
  228. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/serialise_tests/createfile.hpp +0 -0
  229. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/serialise_tests/filename.hpp +0 -0
  230. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/serialise_tests/obtainlock.cpp +0 -0
  231. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/serialise_tests/obtainlock.hpp +0 -0
  232. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/serialise_tests/test_flock_1.cpp +0 -0
  233. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/serialise_tests/test_flock_2.cpp +0 -0
  234. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/simple/helloworld_c.c +0 -0
  235. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/simple/helloworld_cpp.cpp +0 -0
  236. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/simple/test_cflags.c +0 -0
  237. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/version_dependent_api/api_config.h +0 -0
  238. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/version_dependent_api/api_config_new.h +0 -0
  239. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/version_dependent_api/test_main.cpp +0 -0
  240. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/version_dependent_api/test_main_new.cpp +0 -0
  241. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/version_dependent_api/version.h +0 -0
  242. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/samples/version_dependent_api/version_new.h +0 -0
  243. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/simple_preprocessor.py +0 -0
  244. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/test_apptools.py +0 -0
  245. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/test_base.py +0 -0
  246. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/test_cache_performance.py +0 -0
  247. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/test_cache_versioning.py +0 -0
  248. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/test_cap.py +0 -0
  249. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/test_compiler_macros.py +0 -0
  250. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/test_configutils.py +0 -0
  251. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/test_cppdeps.py +0 -0
  252. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/test_ctcache_conflicts.py +0 -0
  253. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/test_ctcache_type_config.py +0 -0
  254. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/test_environment_assumptions.py +0 -0
  255. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/test_file_analyzer.py +0 -0
  256. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/test_file_analyzer_integration.py +0 -0
  257. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/test_findtargets.py +0 -0
  258. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/test_headerdeps.py +0 -0
  259. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/test_hunter.py +0 -0
  260. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/test_library.py +0 -0
  261. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/test_listvariants.py +0 -0
  262. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/test_macro_state_dependency.py +0 -0
  263. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/test_magicflags.py +0 -0
  264. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/test_magicinclude.py +0 -0
  265. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/test_magicpkgconfig.py +0 -0
  266. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/test_makefile.py +0 -0
  267. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/test_mmap_oracle_cache.py +0 -0
  268. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/test_movingheaders.py +0 -0
  269. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/test_namer.py +0 -0
  270. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/test_serialisetests.py +0 -0
  271. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/test_simple_preprocessor.py +0 -0
  272. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/test_utils.py +0 -0
  273. {compiletools-5.2.0 → compiletools-5.3.0}/src/compiletools/tree.py +0 -0
  274. {compiletools-5.2.0 → compiletools-5.3.0}/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.0
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.3.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.0
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.0"
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.3.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.0"
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.0
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.0
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.0
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.0
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.0
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.0
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.0
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.0
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.0
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.0
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.0
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.0
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.0
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="compile_commands.json",
102
+ help="Output filename for compilation database (default: 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:
@@ -1,7 +1,9 @@
1
1
  import json
2
2
  import os
3
3
  from typing import List, Dict, Any
4
+ from functools import lru_cache
4
5
 
6
+ import stringzilla as sz
5
7
  import compiletools.utils
6
8
  import compiletools.apptools
7
9
  import compiletools.headerdeps
@@ -9,42 +11,52 @@ import compiletools.magicflags
9
11
  import compiletools.hunter
10
12
  import compiletools.namer
11
13
  import compiletools.configutils
14
+ import compiletools.wrappedos
12
15
 
13
16
 
14
17
  class CompilationDatabaseCreator:
15
18
  """Creates compile_commands.json files for clang tooling integration"""
16
19
 
17
- def __init__(self, args, file_analyzer_cache=None):
20
+ def __init__(self, args, file_analyzer_cache=None, namer=None, headerdeps=None, magicparser=None, hunter=None):
18
21
  self.args = args
19
- self.namer = compiletools.namer.Namer(args)
20
- self.headerdeps = compiletools.headerdeps.create(args, file_analyzer_cache=file_analyzer_cache)
21
- self.magicparser = compiletools.magicflags.create(args, self.headerdeps)
22
- self.hunter = compiletools.hunter.Hunter(args, self.headerdeps, self.magicparser)
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
+ def _normalize_path_sz(self, file_path: str) -> str:
30
+ """Normalize file path using wrappedos with shared StringZilla-aware cache"""
31
+ # Use enhanced wrappedos.abspath that handles both Python str and StringZilla Str
32
+ return compiletools.wrappedos.abspath(file_path)
33
+
23
34
 
24
35
  @staticmethod
25
36
  def add_arguments(cap):
26
- """Add command-line arguments"""
27
- cap.add("filename", nargs="*", help="Source file(s) to include in compilation database")
28
-
37
+ """Add command-line arguments for standalone ct-compilation-database"""
38
+ # Add standard target arguments that define what sources to process
39
+ compiletools.apptools.add_target_arguments_ex(cap)
40
+
29
41
  cap.add(
30
- "--output", "-o",
42
+ "--compilation-database-output",
31
43
  dest="compilation_database_output",
32
44
  default="compile_commands.json",
33
45
  help="Output filename for compilation database (default: compile_commands.json)"
34
46
  )
35
-
47
+
36
48
  cap.add(
37
49
  "--relative-paths",
38
50
  dest="compilation_database_relative",
39
- action="store_true",
51
+ action="store_true",
40
52
  help="Use relative paths instead of absolute paths"
41
53
  )
42
54
 
43
55
  def _get_compiler_command(self, source_file: str) -> List[str]:
44
- """Generate compiler command arguments for a source file"""
56
+ """Generate compiler command arguments for a source file with StringZilla optimization"""
45
57
 
46
- # Determine compiler based on file extension
47
- if source_file.endswith(('.cpp', '.cxx', '.cc', '.C', '.CC')):
58
+ # Determine compiler based on file extension
59
+ if compiletools.utils.is_cpp_source(source_file):
48
60
  compiler = self.args.CXX
49
61
  else:
50
62
  compiler = self.args.CC
@@ -57,27 +69,27 @@ class CompilationDatabaseCreator:
57
69
  if isinstance(self.args.CPPFLAGS, list):
58
70
  args.extend(self.args.CPPFLAGS)
59
71
  else:
60
- args.extend(self.args.CPPFLAGS.split())
72
+ args.extend(compiletools.utils.cached_shlex_split(self.args.CPPFLAGS))
61
73
 
62
- if source_file.endswith(('.cpp', '.cxx', '.cc', '.C', '.CC')):
74
+ if compiletools.utils.is_cpp_source(source_file):
63
75
  if hasattr(self.args, 'CXXFLAGS') and self.args.CXXFLAGS:
64
76
  if isinstance(self.args.CXXFLAGS, list):
65
77
  args.extend(self.args.CXXFLAGS)
66
78
  else:
67
- args.extend(self.args.CXXFLAGS.split())
79
+ args.extend(compiletools.utils.cached_shlex_split(self.args.CXXFLAGS))
68
80
  else:
69
81
  if hasattr(self.args, 'CFLAGS') and self.args.CFLAGS:
70
- args.extend(self.args.CFLAGS.split())
82
+ args.extend(compiletools.utils.cached_shlex_split(self.args.CFLAGS))
71
83
 
72
84
  # Add magic flags for this specific file
73
85
  try:
74
86
  magic_cppflags = self.magicparser.getmagic_cppflags_for_file(source_file)
75
87
  if magic_cppflags:
76
- args.extend(magic_cppflags.split())
88
+ args.extend(compiletools.utils.cached_shlex_split(magic_cppflags))
77
89
 
78
90
  magic_cxxflags = self.magicparser.getmagic_cxxflags_for_file(source_file)
79
91
  if magic_cxxflags:
80
- args.extend(magic_cxxflags.split())
92
+ args.extend(compiletools.utils.cached_shlex_split(magic_cxxflags))
81
93
  except AttributeError:
82
94
  # Magic flags methods may not exist
83
95
  pass
@@ -116,52 +128,87 @@ class CompilationDatabaseCreator:
116
128
 
117
129
  def create_compilation_database(self) -> List[Dict[str, Any]]:
118
130
  """Create the compilation database as a list of command objects"""
119
-
131
+
120
132
  commands = []
121
-
122
- # Use explicitly provided files if available, otherwise hunt for sources
123
- if hasattr(self.args, 'filename') and self.args.filename:
124
- source_files = self.args.filename
125
- else:
126
- try:
127
- # Hunt for source files
128
- self.hunter.huntsource()
129
- source_files = self.hunter.getsources()
130
-
131
- # Also process test files if they exist
132
- if hasattr(self.hunter, 'gettestsources'):
133
- test_files = self.hunter.gettestsources()
134
- source_files.extend(test_files)
135
-
136
- except Exception as e:
137
- if self.args.verbose:
138
- print(f"Warning: Error during source hunting: {e}")
139
- source_files = []
140
-
133
+
134
+ # Discover all source files using Hunter's project-level discovery
135
+ try:
136
+ # Hunt for all source files from command line arguments and dependencies
137
+ self.hunter.huntsource()
138
+ source_files = self.hunter.getsources()
139
+
140
+ if self.args.verbose >= 6:
141
+ print(f"CompilationDatabase: Processing {len(source_files)} source files")
142
+
143
+ except Exception as e:
144
+ if self.args.verbose:
145
+ print(f"Warning: Error during source hunting: {e}")
146
+ source_files = []
147
+
141
148
  # Process each source file
142
149
  for source_file in source_files:
143
150
  if os.path.exists(source_file):
144
151
  command_obj = self._create_command_object(source_file)
145
152
  commands.append(command_obj)
146
-
153
+ elif self.args.verbose >= 2:
154
+ print(f"Warning: Source file does not exist: {source_file}")
155
+
147
156
  return commands
148
157
 
149
158
  def write_compilation_database(self, output_file: str = None):
150
- """Write the compilation database to file"""
159
+ """Write the compilation database to file with incremental update support"""
151
160
 
152
161
  if output_file is None:
153
162
  output_file = self.args.compilation_database_output
154
163
 
155
- # Create the command objects
156
- commands = self.create_compilation_database()
164
+ # Create the command objects for current files
165
+ new_commands = self.create_compilation_database()
166
+
167
+ # For incremental updates: read existing database and merge using StringZilla
168
+ existing_commands = []
169
+ if os.path.exists(output_file):
170
+ try:
171
+ # Use StringZilla memory-mapped file reading
172
+ file_content = sz.Str(sz.File(output_file))
173
+ # JSON parsing requires conversion only at the boundary
174
+ if len(file_content) > 0:
175
+ existing_commands = json.loads(file_content.decode('utf-8'))
176
+ if self.args.verbose:
177
+ print(f"Loaded existing compilation database with StringZilla: {len(existing_commands)} entries")
178
+ else:
179
+ existing_commands = []
180
+ except Exception as e:
181
+ if self.args.verbose:
182
+ print(f"Warning: Could not read existing compilation database: {e}")
183
+ existing_commands = []
184
+
185
+
186
+ # Merge: Keep existing entries for files we're not updating using StringZilla operations
187
+ merged_commands = []
188
+
189
+ # Get set of files being updated using StringZilla-optimized path normalization
190
+ new_files = {self._normalize_path_sz(cmd["file"]) for cmd in new_commands}
191
+
192
+ # Always use StringZilla for consistent file path operations
193
+ for existing_cmd in existing_commands:
194
+ # Use StringZilla Str and wrappedos for efficient path operations
195
+ existing_file_sz = sz.Str(existing_cmd["file"])
196
+ existing_file_normalized = self._normalize_path_sz(existing_file_sz)
197
+ if existing_file_normalized not in new_files:
198
+ merged_commands.append(existing_cmd)
199
+
200
+ # Add all new/updated entries
201
+ merged_commands.extend(new_commands)
157
202
 
158
- # Write JSON file
203
+ # Write merged JSON file
159
204
  try:
160
205
  with open(output_file, 'w', encoding='utf-8') as f:
161
- json.dump(commands, f, indent=2, ensure_ascii=False)
206
+ json.dump(merged_commands, f, indent=2, ensure_ascii=False)
162
207
 
163
208
  if self.args.verbose:
164
- print(f"Written compilation database with {len(commands)} entries to {output_file}")
209
+ print(f"Written compilation database with {len(merged_commands)} entries to {output_file}")
210
+ print(f" Updated: {len(new_commands)} entries")
211
+ print(f" Preserved: {len(merged_commands) - len(new_commands)} entries")
165
212
 
166
213
  except Exception as e:
167
214
  print(f"Error writing compilation database: {e}")
@@ -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()
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(compiletools.wrappedos.realpath(src) for src in all_sources)
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