ceedling 1.2.2 → 1.2.3
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.
- checksums.yaml +4 -4
- data/GIT_COMMIT_SHA +1 -1
- data/README.md +1 -1
- data/assets/fixtures/tests_with_partials_coverage/src/private_macro.c +7 -0
- data/assets/fixtures/tests_with_partials_coverage/src/private_macro.h +5 -0
- data/assets/fixtures/tests_with_partials_coverage/src/tally.c +13 -0
- data/assets/fixtures/tests_with_partials_coverage/src/tally.h +4 -0
- data/assets/fixtures/tests_with_partials_coverage/test/test_private_macro.c +10 -0
- data/assets/fixtures/tests_with_partials_coverage/test/test_tally.c +9 -0
- data/docs/BreakingChanges.md +16 -0
- data/docs/Changelog.md +71 -0
- data/docs/KnownIssues.md +91 -4
- data/examples/wondrous_forest/README.md +29 -1
- data/examples/wondrous_forest/src/ForestUnits.h +23 -0
- data/examples/wondrous_forest/src/RainGauge.c +59 -0
- data/examples/wondrous_forest/src/RainGauge.h +39 -0
- data/examples/wondrous_forest/src/RainTipIsr.c +17 -0
- data/examples/wondrous_forest/src/RainTipIsr.h +14 -0
- data/examples/wondrous_forest/test/TestRainGauge.c +126 -0
- data/lib/ceedling/c_extractor/README.md +15 -7
- data/lib/ceedling/c_extractor/c_extractor.rb +25 -14
- data/lib/ceedling/c_extractor/c_extractor_code_text.rb +84 -54
- data/lib/ceedling/c_extractor/c_extractor_constants.rb +18 -7
- data/lib/ceedling/c_extractor/c_extractor_declarations.rb +319 -283
- data/lib/ceedling/c_extractor/c_extractor_declarator.rb +285 -0
- data/lib/ceedling/c_extractor/c_extractor_defined_type.rb +111 -0
- data/lib/ceedling/c_extractor/c_extractor_definitions.rb +174 -121
- data/lib/ceedling/c_extractor/c_extractor_functions.rb +191 -162
- data/lib/ceedling/c_extractor/c_extractor_preprocessing.rb +46 -55
- data/lib/ceedling/c_extractor/c_extractor_statement.rb +30 -0
- data/lib/ceedling/c_extractor/c_extractor_types.rb +63 -41
- data/lib/ceedling/c_extractor/c_module_edits.rb +48 -0
- data/lib/ceedling/c_identifier.rb +21 -0
- data/lib/ceedling/ceedling.h +8 -0
- data/lib/ceedling/config/configurator.rb +4 -3
- data/lib/ceedling/config/configurator_builder.rb +17 -0
- data/lib/ceedling/config/configurator_setup.rb +29 -5
- data/lib/ceedling/constants.rb +5 -1
- data/lib/ceedling/defaults.rb +31 -1
- data/lib/ceedling/dependencies/CACHE_SCHEMA.md +118 -0
- data/lib/ceedling/dependencies/README.md +1 -1
- data/lib/ceedling/dependencies/dependency_cache_store.rb +30 -25
- data/lib/ceedling/dependencies/dependency_tracker.rb +9 -3
- data/lib/ceedling/dependencies/dependinator.rb +13 -1
- data/lib/ceedling/diagnostics/DOCTOR.md +142 -0
- data/lib/ceedling/diagnostics/README.md +5 -0
- data/lib/ceedling/diagnostics/build_step_doctor.rb +110 -0
- data/lib/ceedling/diagnostics/duplicate_symbol_specialist.rb +108 -0
- data/lib/ceedling/diagnostics/guidance_phrases.rb +30 -0
- data/lib/ceedling/diagnostics/header_collision_guidance.rb +56 -0
- data/lib/ceedling/diagnostics/header_collision_specialist.rb +152 -0
- data/lib/ceedling/diagnostics/include_depth_specialist.rb +132 -0
- data/lib/ceedling/diagnostics/missing_symbol_specialist.rb +111 -0
- data/lib/ceedling/diagnostics/partial_name_specialist.rb +134 -0
- data/lib/ceedling/diagnostics/toolchain_output.rb +44 -0
- data/lib/ceedling/filesystem/PATH_HANDLING.md +83 -27
- data/lib/ceedling/filesystem/README.md +6 -1
- data/lib/ceedling/filesystem/build_roots.rb +105 -0
- data/lib/ceedling/filesystem/build_subpath.rb +110 -25
- data/lib/ceedling/filesystem/file_finder.rb +76 -110
- data/lib/ceedling/filesystem/file_finder_helper.rb +33 -11
- data/lib/ceedling/filesystem/file_path_utils.rb +113 -91
- data/lib/ceedling/filesystem/file_wrapper.rb +105 -28
- data/lib/ceedling/filesystem/path_matcher.rb +21 -0
- data/lib/ceedling/filesystem/test_build_layout.rb +114 -0
- data/lib/ceedling/filesystem/win_long_paths.rb +153 -0
- data/lib/ceedling/filesystem/win_path_limit.rb +83 -0
- data/lib/ceedling/filesystem/win_path_prober.rb +52 -0
- data/lib/ceedling/generators/generator.rb +27 -64
- data/lib/ceedling/generators/generator_helper.rb +0 -44
- data/lib/ceedling/generators/generator_mocks.rb +5 -0
- data/lib/ceedling/generators/generator_partials.rb +305 -243
- data/lib/ceedling/generators/generator_test_runner.rb +5 -8
- data/lib/ceedling/generators/partial_header_writer.rb +95 -0
- data/lib/ceedling/generators/partial_source_writer.rb +137 -0
- data/lib/ceedling/includes/header_search.rb +225 -0
- data/lib/ceedling/includes/include_factory.rb +9 -12
- data/lib/ceedling/includes/include_pathinator.rb +53 -31
- data/lib/ceedling/includes/includes.rb +149 -37
- data/lib/ceedling/objects.yml +89 -4
- data/lib/ceedling/partials/README.md +110 -16
- data/lib/ceedling/partials/carry_plan.rb +71 -0
- data/lib/ceedling/partials/definition_head.rb +74 -0
- data/lib/ceedling/partials/include_groups.rb +37 -0
- data/lib/ceedling/partials/interface_extras.rb +25 -0
- data/lib/ceedling/partials/partializer.rb +599 -120
- data/lib/ceedling/partials/partializer_config.rb +5 -0
- data/lib/ceedling/partials/partializer_helper.rb +851 -145
- data/lib/ceedling/partials/partializer_reconciler.rb +174 -0
- data/lib/ceedling/partials/partializer_utils.rb +89 -109
- data/lib/ceedling/partials/partials.rb +153 -10
- data/lib/ceedling/partials/type_macros.rb +126 -0
- data/lib/ceedling/preprocess/README.md +43 -33
- data/lib/ceedling/preprocess/preprocessinator.rb +100 -186
- data/lib/ceedling/preprocess/preprocessinator_code_finder.rb +65 -72
- data/lib/ceedling/preprocess/preprocessinator_file_assembler.rb +31 -75
- data/lib/ceedling/preprocess/preprocessinator_reconstructor.rb +51 -14
- data/lib/ceedling/setupinator.rb +16 -3
- data/lib/ceedling/test_invoker/HEADER_COLLISIONS.md +21 -7
- data/lib/ceedling/test_invoker/PIPELINE.md +57 -16
- data/lib/ceedling/test_invoker/README.md +1 -1
- data/lib/ceedling/test_invoker/derived_search_path_notices.rb +45 -0
- data/lib/ceedling/test_invoker/mock_locator.rb +116 -9
- data/lib/ceedling/test_invoker/partial_files_preprocessinator.rb +181 -0
- data/lib/ceedling/test_invoker/partials_manager.rb +265 -308
- data/lib/ceedling/test_invoker/standin_headerinator.rb +8 -15
- data/lib/ceedling/test_invoker/test_bare_includes_extractinator.rb +26 -3
- data/lib/ceedling/test_invoker/test_build_executor.rb +338 -198
- data/lib/ceedling/test_invoker/test_build_planner.rb +13 -19
- data/lib/ceedling/test_invoker/test_build_setup.rb +26 -6
- data/lib/ceedling/test_invoker/test_build_validations.rb +23 -20
- data/lib/ceedling/test_invoker/test_derived_search_paths.rb +189 -0
- data/lib/ceedling/test_invoker/test_file_preprocessinator.rb +1 -2
- data/lib/ceedling/test_invoker/test_includes_reconcilinator.rb +1 -1
- data/lib/ceedling/test_invoker/test_invoker_types.rb +28 -20
- data/lib/ceedling/test_invoker/test_pipeline_helpers.rb +5 -3
- data/lib/ceedling/test_invoker/test_pipeline_manager.rb +25 -8
- data/lib/ceedling/test_invoker/test_runner_generatinator.rb +31 -3
- data/lib/ceedling/test_invoker/test_search_paths.rb +30 -8
- data/lib/ceedling/test_invoker/test_substitutions.rb +72 -0
- data/lib/ceedling/tools/shell_quoting.rb +45 -0
- data/lib/ceedling/tools/tool_quoting.rb +79 -0
- data/lib/ceedling/{tool_validator.rb → tools/tool_validator.rb} +18 -7
- data/lib/version.rb +1 -1
- data/plugins/bullseye/bullseye.rake +1 -3
- data/plugins/bullseye/lib/bullseye.rb +15 -2
- data/plugins/command_hooks/lib/command_hooks.rb +1 -1
- data/plugins/fff/lib/fff.rb +42 -15
- data/plugins/fff/lib/fff_mock_generator.rb +12 -9
- data/plugins/fff/spec/fff_cmock_wrapper_spec.rb +134 -0
- data/plugins/fff/spec/fff_mock_header_generator_spec.rb +9 -0
- data/plugins/fff/spec/fff_mock_source_generator_spec.rb +20 -0
- data/plugins/gcov/lib/console_reportinator.rb +25 -19
- data/plugins/gcov/lib/reportgenerator_reportinator.rb +2 -1
- data/site-local/404.html +2 -2
- data/site-local/assets/javascripts/{bundle.c21346df.min.js → bundle.a5f9d56c.min.js} +1 -1
- data/site-local/assets/javascripts/{bundle.c21346df.min.js.map → bundle.a5f9d56c.min.js.map} +2 -2
- data/site-local/configuration/environment-vars.html +2 -2
- data/site-local/configuration/global-collections.html +3 -3
- data/site-local/configuration/index.html +2 -2
- data/site-local/configuration/loading.html +2 -2
- data/site-local/configuration/mixins.html +2 -2
- data/site-local/configuration/parallel-builds.html +2 -2
- data/site-local/configuration/project-file.html +2 -2
- data/site-local/configuration/reference/cexception.html +2 -2
- data/site-local/configuration/reference/cmock.html +5 -2
- data/site-local/configuration/reference/defines.html +2 -2
- data/site-local/configuration/reference/environment.html +2 -2
- data/site-local/configuration/reference/extension.html +2 -2
- data/site-local/configuration/reference/files.html +56 -9
- data/site-local/configuration/reference/flags.html +2 -2
- data/site-local/configuration/reference/index.html +2 -2
- data/site-local/configuration/reference/libraries.html +2 -2
- data/site-local/configuration/reference/mixins.html +2 -2
- data/site-local/configuration/reference/partials.html +84 -2
- data/site-local/configuration/reference/paths.html +7 -2
- data/site-local/configuration/reference/plugins.html +2 -2
- data/site-local/configuration/reference/project.html +247 -5
- data/site-local/configuration/reference/release-build.html +2 -2
- data/site-local/configuration/reference/test-build.html +2 -2
- data/site-local/configuration/reference/test-runner.html +2 -2
- data/site-local/configuration/reference/tools.html +49 -4
- data/site-local/configuration/reference/unity.html +2 -2
- data/site-local/configuration/which-ceedling.html +2 -2
- data/site-local/development/index.html +2 -2
- data/site-local/development/plugins/configuration.html +2 -2
- data/site-local/development/plugins/index.html +2 -2
- data/site-local/development/plugins/plugin-subclass.html +5 -4
- data/site-local/development/plugins/rake-tasks.html +2 -2
- data/site-local/development/releases.html +2 -2
- data/site-local/development/workflow.html +2 -2
- data/site-local/getting-started/builds.html +2 -2
- data/site-local/getting-started/command-line.html +2 -2
- data/site-local/getting-started/example-projects/cipher-quest.html +2 -2
- data/site-local/getting-started/example-projects/index.html +2 -2
- data/site-local/getting-started/example-projects/temp-sensor.html +2 -2
- data/site-local/getting-started/example-projects/wondrous-forest.html +10 -2
- data/site-local/getting-started/index.html +2 -2
- data/site-local/getting-started/installation.html +2 -2
- data/site-local/getting-started/quick-start.html +2 -2
- data/site-local/help.html +2 -2
- data/site-local/index.html +2 -2
- data/site-local/overview/build-system.html +2 -2
- data/site-local/overview/index.html +2 -2
- data/site-local/overview/test-environments.html +2 -2
- data/site-local/overview/tools-and-frameworks.html +2 -2
- data/site-local/plugins/beep.html +2 -2
- data/site-local/plugins/bullseye/index.html +45 -38
- data/site-local/plugins/bullseye/licensing.html +2 -2
- data/site-local/plugins/command-hooks.html +4 -4
- data/site-local/plugins/compile-commands-json-db.html +2 -2
- data/site-local/plugins/cppcheck.html +2 -2
- data/site-local/plugins/dependencies.html +2 -2
- data/site-local/plugins/fff.html +16 -2
- data/site-local/plugins/gcov/examples.html +2 -2
- data/site-local/plugins/gcov/gcovr.html +8 -2
- data/site-local/plugins/gcov/index.html +2 -2
- data/site-local/plugins/gcov/overview.html +2 -2
- data/site-local/plugins/gcov/reportgenerator.html +18 -14
- data/site-local/plugins/gcov/reporting.html +2 -2
- data/site-local/plugins/gcov/setup.html +2 -2
- data/site-local/plugins/gcov/tool-versions.html +2 -2
- data/site-local/plugins/gcov/troubleshooting.html +2 -2
- data/site-local/plugins/index.html +2 -2
- data/site-local/plugins/module-generator.html +2 -2
- data/site-local/plugins/report-build-warnings-log.html +2 -2
- data/site-local/plugins/report-tests-gtestlike-stdout.html +2 -2
- data/site-local/plugins/report-tests-ide-stdout.html +2 -2
- data/site-local/plugins/report-tests-log-factory.html +2 -2
- data/site-local/plugins/report-tests-pretty-stdout.html +2 -2
- data/site-local/plugins/report-tests-raw-output-log.html +2 -2
- data/site-local/plugins/report-tests-teamcity-stdout.html +2 -2
- data/site-local/plugins/sanitize.html +2 -2
- data/site-local/plugins/valgrind.html +2 -2
- data/site-local/project/index.html +2 -2
- data/site-local/project/release-history.html +2 -2
- data/site-local/project/sbom.html +2 -2
- data/site-local/project/upgrade.html +2 -2
- data/site-local/reference/build-directives.html +2 -2
- data/site-local/reference/command-line.html +2 -2
- data/site-local/reference/environment-vars.html +2 -2
- data/site-local/reference/gcov-plugin.html +2 -2
- data/site-local/reference/global-collections.html +12 -12
- data/site-local/reference/index.html +2 -2
- data/site-local/reference/partials-macros.html +47 -2
- data/site-local/reference/project-configuration.html +2 -2
- data/site-local/sitemap.xml.gz +0 -0
- data/site-local/snapshot/examples/cipher_quest/index.html +2 -2
- data/site-local/snapshot/examples/temp_sensor/index.html +2 -2
- data/site-local/snapshot/examples/wondrous_forest/index.html +72 -15
- data/site-local/testing-guide/build-directives.html +2 -2
- data/site-local/testing-guide/conventions.html +67 -22
- data/site-local/testing-guide/frameworks.html +2 -2
- data/site-local/testing-guide/index.html +2 -2
- data/site-local/testing-guide/partials/configuration.html +31 -4
- data/site-local/testing-guide/partials/conventions.html +509 -8
- data/site-local/testing-guide/partials/directives.html +4 -3
- data/site-local/testing-guide/partials/example.html +2 -2
- data/site-local/testing-guide/partials/index.html +2 -2
- data/site-local/testing-guide/partials/overview.html +30 -12
- data/site-local/testing-guide/partials/variables.html +169 -4
- data/site-local/testing-guide/test-cases.html +2 -2
- data/site-local/testing-guide/test-sample.html +2 -2
- data/site-local/testing-guide/test-suite-anatomy.html +2 -2
- data/spec/integration/build_step_doctor_spec.rb +270 -0
- data/spec/integration/c_extractor_composition_spec.rb +254 -4
- data/spec/integration/includes_extraction_spec.rb +27 -14
- data/spec/integration/nested_test_artifacts_spec.rb +1 -1
- data/spec/integration/partial_files_preprocessing_spec.rb +128 -0
- data/spec/integration/partials_carry_spec.rb +520 -0
- data/spec/integration/partials_declarations_spec.rb +655 -0
- data/spec/integration/partials_fallback_preprocessing_spec.rb +65 -0
- data/spec/integration/partials_function_pointers_spec.rb +277 -0
- data/spec/integration/partials_header_composition_spec.rb +268 -35
- data/spec/integration/partials_macro_decorators_spec.rb +267 -0
- data/spec/integration/partials_module_resolution_spec.rb +26 -19
- data/spec/integration/partials_symbol_linkage_spec.rb +13 -0
- data/spec/integration/path_length_reporting_spec.rb +64 -0
- data/spec/integration/path_scenarios_spec.rb +80 -3
- data/spec/integration/quote_include_isolator_spec.rb +56 -0
- data/spec/integration/test_build_parallel_barrier_spec.rb +1 -1
- data/spec/integration/test_includes_extractinator_spec.rb +70 -5
- data/spec/integration/test_naming_spec.rb +6 -3
- data/spec/integration/test_source_file_checks_spec.rb +5 -3
- data/spec/integration/tool_executor_spec.rb +1 -1
- data/spec/integration/tool_validator_spec.rb +2 -2
- data/spec/integration/win_long_paths_probe_spec.rb +46 -0
- data/spec/integration/win_path_limit_spec.rb +53 -0
- data/spec/integration/windows_registry_query_tool_spec.rb +41 -0
- data/spec/support/integration/configurator_integration_helper.rb +8 -3
- data/spec/support/integration/partial_files_harness.rb +181 -0
- data/spec/support/integration/partials_generation_integration_helper.rb +237 -141
- data/spec/support/integration/path_scenario_harness.rb +4 -2
- data/spec/support/integration/spec_integration_helper.rb +8 -3
- data/spec/support/integration/test_includes_harness.rb +56 -35
- data/spec/support/integration/tool_executor_integration_helper.rb +14 -2
- data/spec/system/bullseye_deployment_spec.rb +2 -0
- data/spec/system/delta_builds_spec.rb +26 -12
- data/spec/system/encoding_stress_spec.rb +4 -4
- data/spec/system/example_wondrous_forest_spec.rb +2 -2
- data/spec/system/gcov_deployment_spec.rb +2 -0
- data/spec/system/header_include_path_validation_spec.rb +4 -4
- data/spec/system/header_search_paths_spec.rb +1083 -0
- data/spec/system/mock_include_folders_spec.rb +121 -0
- data/spec/system/mockable_header_reassembly_spec.rb +184 -0
- data/spec/system/partials_carry_spec.rb +581 -0
- data/spec/system/partials_delta_builds_spec.rb +280 -0
- data/spec/system/partials_function_pointers_spec.rb +106 -0
- data/spec/system/partials_macro_decorators_spec.rb +127 -0
- data/spec/system/partials_module_disambiguation_spec.rb +125 -0
- data/spec/system/path_handling_probes_spec.rb +16 -12
- data/spec/system/pinned_thread_count_spec.rb +4 -4
- data/spec/system/preprocessing_fallback_conditionals_spec.rb +1 -1
- data/spec/system/short_build_paths_spec.rb +87 -0
- data/spec/system/sibling_header_collision_spec.rb +30 -6
- data/spec/system/support/bullseye_common_test_cases.rb +42 -0
- data/spec/system/support/common_test_cases.rb +2 -2
- data/spec/system/support/gcov_partials_test_cases.rb +48 -0
- data/spec/system/test_build_layout_spec.rb +209 -0
- data/spec/system/test_source_file_directive_spec.rb +35 -5
- data/spec/units/c_extractor/c_extractor_code_text_spec.rb +67 -10
- data/spec/units/c_extractor/c_extractor_declarations_spec.rb +501 -4
- data/spec/units/c_extractor/c_extractor_declarator_spec.rb +245 -0
- data/spec/units/c_extractor/c_extractor_defined_type_spec.rb +45 -0
- data/spec/units/c_extractor/c_extractor_definitions_spec.rb +163 -3
- data/spec/units/c_extractor/c_extractor_functions_spec.rb +462 -21
- data/spec/units/c_extractor/c_extractor_preprocessing_spec.rb +39 -0
- data/spec/units/c_extractor/c_extractor_spec.rb +4 -4
- data/spec/units/c_extractor/c_extractor_types_spec.rb +163 -0
- data/spec/units/c_identifier_spec.rb +35 -0
- data/spec/units/config/configurator_builder_spec.rb +24 -0
- data/spec/units/config/configurator_setup_spec.rb +72 -4
- data/spec/units/config/configurator_spec.rb +27 -1
- data/spec/units/dependencies/dependency_cache_store_spec.rb +68 -3
- data/spec/units/dependencies/dependency_tracker_spec.rb +25 -0
- data/spec/units/dependencies/dependinator_spec.rb +17 -2
- data/spec/units/diagnostics/build_step_doctor_spec.rb +170 -0
- data/spec/units/diagnostics/duplicate_symbol_specialist_spec.rb +117 -0
- data/spec/units/diagnostics/header_collision_specialist_spec.rb +267 -0
- data/spec/units/diagnostics/include_depth_specialist_spec.rb +137 -0
- data/spec/units/diagnostics/missing_symbol_specialist_spec.rb +154 -0
- data/spec/units/diagnostics/partial_name_specialist_spec.rb +129 -0
- data/spec/units/diagnostics/toolchain_output_spec.rb +86 -0
- data/spec/units/encodinator_spec.rb +3 -4
- data/spec/units/filesystem/build_roots_spec.rb +131 -0
- data/spec/units/filesystem/build_subpath_spec.rb +113 -0
- data/spec/units/filesystem/file_finder_helper_spec.rb +80 -0
- data/spec/units/filesystem/file_finder_spec.rb +242 -58
- data/spec/units/filesystem/file_path_utils_spec.rb +251 -118
- data/spec/units/filesystem/file_wrapper_spec.rb +191 -6
- data/spec/units/filesystem/path_matcher_spec.rb +36 -0
- data/spec/units/filesystem/test_build_layout_spec.rb +216 -0
- data/spec/units/filesystem/win_long_paths_spec.rb +204 -0
- data/spec/units/filesystem/win_path_prober_spec.rb +158 -0
- data/spec/units/generators/generator_helper_spec.rb +0 -60
- data/spec/units/generators/generator_mocks_spec.rb +13 -0
- data/spec/units/generators/generator_partials_spec.rb +656 -55
- data/spec/units/generators/generator_spec.rb +26 -0
- data/spec/units/generators/generator_test_runner_spec.rb +9 -5
- data/spec/units/generators/partial_source_writer_spec.rb +129 -0
- data/spec/units/includes/header_search_spec.rb +406 -0
- data/spec/units/includes/include_factory_spec.rb +22 -5
- data/spec/units/includes/include_pathinator_spec.rb +77 -13
- data/spec/units/includes/include_spec.rb +14 -0
- data/spec/units/includes/includes_spec.rb +176 -19
- data/spec/units/loginator_spec.rb +31 -0
- data/spec/units/mock_locator_spec.rb +199 -5
- data/spec/units/partials/include_groups_spec.rb +42 -0
- data/spec/units/partials/partializer_config_spec.rb +25 -0
- data/spec/units/partials/partializer_helper_carry_spec.rb +661 -0
- data/spec/units/partials/partializer_helper_interface_extras_spec.rb +396 -0
- data/spec/units/partials/partializer_helper_spec.rb +529 -277
- data/spec/units/partials/partializer_reconciler_spec.rb +661 -0
- data/spec/units/partials/partializer_spec.rb +1578 -270
- data/spec/units/partials/partializer_utils_spec.rb +269 -232
- data/spec/units/partials/partials_rename_spec.rb +160 -0
- data/spec/units/partials_manager_spec.rb +554 -261
- data/spec/units/plugins/bullseye_spec.rb +34 -0
- data/spec/units/plugins/console_reportinator_spec.rb +58 -9
- data/spec/units/plugins/report_tests_teamcity_stdout_spec.rb +1 -1
- data/spec/units/plugins/reportgenerator_reportinator_spec.rb +51 -3
- data/spec/units/preprocess/preprocessinator_code_finder_spec.rb +73 -10
- data/spec/units/preprocess/preprocessinator_file_assembler_spec.rb +125 -37
- data/spec/units/preprocess/preprocessinator_includes_handler_spec.rb +15 -0
- data/spec/units/preprocess/preprocessinator_reconstructor_spec.rb +197 -0
- data/spec/units/preprocess/preprocessinator_spec.rb +153 -95
- data/spec/units/setupinator_spec.rb +51 -0
- data/spec/units/standin_headerinator_spec.rb +27 -11
- data/spec/units/test_build_executor_spec.rb +780 -166
- data/spec/units/test_build_planner_spec.rb +116 -28
- data/spec/units/test_build_setup_spec.rb +83 -18
- data/spec/units/test_context_extractor_spec.rb +11 -2
- data/spec/units/test_derived_search_paths_spec.rb +259 -0
- data/spec/units/test_includes_extractinator_spec.rb +56 -8
- data/spec/units/test_invoker/objects_wiring_spec.rb +20 -3
- data/spec/units/test_invoker/partial_files_preprocessinator_spec.rb +264 -0
- data/spec/units/test_invoker/test_substitutions_spec.rb +122 -0
- data/spec/units/test_invoker_types_spec.rb +8 -7
- data/spec/units/test_pipeline_manager_spec.rb +54 -13
- data/spec/units/test_runner_generatinator_spec.rb +93 -1
- data/spec/units/test_search_paths_spec.rb +73 -5
- data/spec/units/{default_tools_quoting_spec.rb → tools/default_tools_quoting_spec.rb} +39 -5
- data/spec/units/tools/shell_quoting_spec.rb +76 -0
- data/spec/units/{tool_executor_helper_spec.rb → tools/tool_executor_helper_spec.rb} +1 -1
- data/spec/units/{tool_executor_spec.rb → tools/tool_executor_spec.rb} +1 -1
- data/spec/units/{tool_validator_spec.rb → tools/tool_validator_spec.rb} +110 -1
- data/spec/units/windows_registry_query_tool_spec.rb +53 -0
- metadata +161 -16
- /data/lib/ceedling/{tool_executor.rb → tools/tool_executor.rb} +0 -0
- /data/lib/ceedling/{tool_executor_helper.rb → tools/tool_executor_helper.rb} +0 -0
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
require 'rubygems'
|
|
9
9
|
require 'rake' # for adding ext() method to string
|
|
10
|
-
require 'set'
|
|
11
10
|
require 'ceedling/exceptions'
|
|
12
11
|
require 'ceedling/filesystem/path_matcher'
|
|
13
12
|
require 'ceedling/filesystem/path_mirror'
|
|
@@ -17,37 +16,23 @@ require 'ceedling/filesystem/build_subpath'
|
|
|
17
16
|
|
|
18
17
|
class FileFinder
|
|
19
18
|
|
|
20
|
-
constructor :configurator, :file_finder_helper, :file_path_utils, :file_wrapper, :yaml_wrapper
|
|
19
|
+
constructor :configurator, :file_finder_helper, :file_path_utils, :file_wrapper, :yaml_wrapper, :test_build_layout
|
|
21
20
|
|
|
22
21
|
def setup
|
|
23
22
|
@test_names_lock = Mutex.new
|
|
24
23
|
end
|
|
25
24
|
|
|
26
25
|
|
|
27
|
-
# `collection`, when given, is a
|
|
28
|
-
#
|
|
29
|
-
#
|
|
30
|
-
#
|
|
31
|
-
# module generically), the project-wide collection_all_headers is the only sensible fallback.
|
|
26
|
+
# `collection`, when given, is a test's HeaderSearch (see IncludePathinator#header_search),
|
|
27
|
+
# which finds the header through that test's search paths as its compiler would, or a
|
|
28
|
+
# caller's own ordered header list. Absent either, the project-wide collection_all_headers
|
|
29
|
+
# is the fallback.
|
|
32
30
|
# `complain` sets what a missing header does: :error raises, and :warn or :ignore
|
|
33
31
|
# returns nil. A header matching only in letter case raises under all three; :silent
|
|
34
32
|
# returns nil for that too.
|
|
35
33
|
def find_header_input_for_mock(mock, collection: nil, complain: :error)
|
|
36
|
-
# Mock name/path => <mock prefix><header filename (.h)>, optionally preceded by however
|
|
37
|
-
# much path the #include itself carried (e.g. 'Mockfoo.h' or 'drivers/Mockfoo.h').
|
|
38
|
-
# Note: In some rare cases, a mock name may include a dot (ex. Sensor.44) because of versioning file naming convention
|
|
39
|
-
# Be careful about assuming the end of the name has any sort of file extension
|
|
40
|
-
#
|
|
41
|
-
# Stripping the mock prefix from only the basename -- not the whole query -- preserves
|
|
42
|
-
# whatever disambiguating path the #include carried, so a query with a path is matched
|
|
43
|
-
# exactly as specifically as it was written, not collapsed to a bare basename that would
|
|
44
|
-
# throw away real disambiguating information.
|
|
45
|
-
dir = File.dirname(mock)
|
|
46
|
-
basename = File.basename(mock).delete_prefix(@configurator.cmock_mock_prefix)
|
|
47
|
-
header = dir == '.' ? basename : File.join(dir, basename)
|
|
48
|
-
|
|
49
34
|
found_path = @file_finder_helper.resolve_file_in_collection(
|
|
50
|
-
|
|
35
|
+
mock_header_query(mock),
|
|
51
36
|
collection || @configurator.collection_all_headers,
|
|
52
37
|
complain
|
|
53
38
|
)
|
|
@@ -55,6 +40,16 @@ class FileFinder
|
|
|
55
40
|
return found_path
|
|
56
41
|
end
|
|
57
42
|
|
|
43
|
+
# The header a mock's #include names, as in 'Mockfoo.h' or 'drivers/Mockfoo.h'. The mock
|
|
44
|
+
# prefix drops from the filename alone, so the path the #include carried stays in the
|
|
45
|
+
# query. A mock name may hold a dot (Sensor.44) by a versioning convention, so nothing
|
|
46
|
+
# here assumes the name ends in an extension.
|
|
47
|
+
def mock_header_query(mock)
|
|
48
|
+
dir = File.dirname(mock)
|
|
49
|
+
basename = File.basename(mock).delete_prefix(@configurator.cmock_mock_prefix)
|
|
50
|
+
return dir == '.' ? basename : File.join(dir, basename)
|
|
51
|
+
end
|
|
52
|
+
|
|
58
53
|
# A mock's real header and its own mirrored subdirectory below whichever configured
|
|
59
54
|
# :test/:support/:include root contains it -- the same roots collection_all_headers is
|
|
60
55
|
# built from. Combined into one call since every caller needing the mirrored subdirectory
|
|
@@ -95,14 +90,15 @@ class FileFinder
|
|
|
95
90
|
# Extract filename without file extension
|
|
96
91
|
source_file = File.basename(filepath).ext('')
|
|
97
92
|
|
|
98
|
-
# Recovered once and reused by every branch below that needs it
|
|
99
|
-
#
|
|
100
|
-
#
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
#
|
|
104
|
-
# a
|
|
105
|
-
|
|
93
|
+
# Recovered once and reused by every branch below that needs it. The caller's own test
|
|
94
|
+
# comes first. Without one, a build file's own place in the test build layout names its
|
|
95
|
+
# test exactly, and a source-tree query, from an #include or TEST_SOURCE_FILE(), names none.
|
|
96
|
+
test_context = test ? test.to_s : test_context_of(filepath, context)
|
|
97
|
+
|
|
98
|
+
# A test's generated mocks and Partials sit below its own roots, which only a known test
|
|
99
|
+
# has. Without one these branches search nothing, so a query never finds another test's.
|
|
100
|
+
mocks_root = release ? nil : @test_build_layout.root( :mocks, test_context )
|
|
101
|
+
partials_root = release ? nil : @test_build_layout.root( :partials, test_context )
|
|
106
102
|
|
|
107
103
|
# We only collect files that already exist when we start up.
|
|
108
104
|
# FileLists can produce undesired results for dynamically generated files depending on when they're accessed.
|
|
@@ -113,6 +109,11 @@ class FileFinder
|
|
|
113
109
|
# Some legacy files can include naming conventions like <name>.##.<ext> for versioning.
|
|
114
110
|
# If we use .ext() below we'll clobber the dotted portion of the filename
|
|
115
111
|
|
|
112
|
+
# The name and the files a mock or Partial branch below searched. A hand-written source may
|
|
113
|
+
# take a generated file's name, so a miss there falls through to the build's sources. A miss
|
|
114
|
+
# of both complains of the generated file.
|
|
115
|
+
generated = nil
|
|
116
|
+
|
|
116
117
|
# Generated test runners -- searched for in the runners directory of this test's name,
|
|
117
118
|
# so two same-named tests' runners are never mistaken for each other
|
|
118
119
|
if (!release) and
|
|
@@ -128,47 +129,49 @@ class FileFinder
|
|
|
128
129
|
@file_wrapper.directory_listing( FilePathUtils.glob(runner_scope_dir(test_context), '*') ),
|
|
129
130
|
complain)
|
|
130
131
|
|
|
131
|
-
# Generated mocks -- scoped to this test's own mock
|
|
132
|
+
# Generated mocks -- scoped to this test's own mock root so another test's
|
|
132
133
|
# identically named mock (expected, routine repetition) is never mistaken for ambiguity
|
|
133
|
-
elsif
|
|
134
|
+
elsif !mocks_root.nil? and
|
|
134
135
|
(source_file.start_with?( @configurator.cmock_mock_prefix ))
|
|
135
136
|
# A mock mirrors the directory of whatever it mocks, so two same-named headers
|
|
136
137
|
# mocked in one test -- two modules mocked as Partials by directory, say -- are
|
|
137
138
|
# told apart only by that subdirectory. Measured the same way a generated
|
|
138
139
|
# Partial's is, below.
|
|
139
|
-
|
|
140
|
-
subdir = generated_file_subdir( filepath, mocks_root, test: test, context: context )
|
|
140
|
+
subdir = generated_file_subdir( filepath, mocks_root, test: test_context, context: context )
|
|
141
141
|
|
|
142
142
|
_source_file = source_file + EXTENSION_CORE_SOURCE
|
|
143
143
|
_source_file = File.join( subdir, _source_file ) unless subdir.empty?
|
|
144
|
+
collection = own_generated_files( mocks_root )
|
|
144
145
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
146
|
+
# The mock at exactly this place below the root comes first, since a same-named mock
|
|
147
|
+
# deeper down, such as one an earlier build left, ends with the same folder and name.
|
|
148
|
+
# A flat object path names no subdirectory, so the name alone still finds a mock
|
|
149
|
+
# anywhere below the root.
|
|
150
|
+
exact = ProjectPaths.segments( File.join( mocks_root, _source_file ) )
|
|
151
|
+
found_file = collection.find { |file| ProjectPaths.segments( file ) == exact }
|
|
152
|
+
found_file ||= @file_finder_helper.find_file_in_collection( _source_file, collection, :ignore )
|
|
153
|
+
generated = [_source_file, collection]
|
|
150
154
|
|
|
151
155
|
# Generated partials -- same per-test scoping rationale as mocks, above
|
|
152
|
-
elsif
|
|
156
|
+
elsif !partials_root.nil? and
|
|
153
157
|
(source_file.start_with?( PARTIAL_FILENAME_PREFIX ))
|
|
154
158
|
# A generated Partial sits in the subdirectory mirroring its own module, so that
|
|
155
159
|
# subdirectory is what distinguishes two modules sharing a basename. Derived the
|
|
156
160
|
# same way a mock's is, above.
|
|
157
|
-
|
|
158
|
-
subdir = generated_file_subdir( filepath, partials_root, test: test, context: context )
|
|
161
|
+
subdir = generated_file_subdir( filepath, partials_root, test: test_context, context: context )
|
|
159
162
|
|
|
160
163
|
_source_file = source_file + EXTENSION_CORE_SOURCE
|
|
161
164
|
_source_file = File.join( subdir, _source_file ) unless subdir.empty?
|
|
162
165
|
|
|
163
|
-
collection = own_generated_files(
|
|
166
|
+
collection = own_generated_files( partials_root )
|
|
164
167
|
|
|
165
168
|
# Ambiguity is detected here rather than rescued from the matching below. One
|
|
166
169
|
# matching implementation stays in force, and the message is composed from the
|
|
167
170
|
# module names the test author wrote instead of reworded by exception.
|
|
168
171
|
raise_ambiguous_partial!( _source_file, collection, partials_root )
|
|
169
172
|
|
|
170
|
-
found_file =
|
|
171
|
-
|
|
173
|
+
found_file = @file_finder_helper.find_file_in_collection( _source_file, collection, :ignore )
|
|
174
|
+
generated = [_source_file, collection]
|
|
172
175
|
|
|
173
176
|
# Vendor framework sources (unity.c, cmock.c, cexception.c, etc.)
|
|
174
177
|
# Note: Taking a small chance by mixing test and release frameworks without smart checks on test/release build
|
|
@@ -193,8 +196,9 @@ class FileFinder
|
|
|
193
196
|
end
|
|
194
197
|
|
|
195
198
|
#
|
|
196
|
-
# Above
|
|
197
|
-
#
|
|
199
|
+
# Above, runners and vendor sources rely on the complain parameter passed to file_finder_helper,
|
|
200
|
+
# since the kind of file sought is certain. Mocks and Partials complain only once the lookup
|
|
201
|
+
# below misses too.
|
|
198
202
|
#
|
|
199
203
|
# Below we ignore file misses because of lgoical complexities of searching for potentially either
|
|
200
204
|
# assmebly or C files, including C files that may not exist (counterparts to header files by convention).
|
|
@@ -209,6 +213,9 @@ class FileFinder
|
|
|
209
213
|
found_file = find_compiled_input( query_file, release: release, exact: exact )
|
|
210
214
|
|
|
211
215
|
if found_file.nil?
|
|
216
|
+
# A generated file's search complains as it would alone, naming the file it sought
|
|
217
|
+
return @file_finder_helper.find_file_in_collection( *generated, complain ) unless generated.nil?
|
|
218
|
+
|
|
212
219
|
# Every name actually attempted, in the order tried, so a missing-file complaint
|
|
213
220
|
# names every filename ceedling went looking for.
|
|
214
221
|
tried = @configurator.extension_source.map { |ext| query_file + ext }
|
|
@@ -220,8 +227,8 @@ class FileFinder
|
|
|
220
227
|
end
|
|
221
228
|
|
|
222
229
|
|
|
223
|
-
# `collection`, when given, overrides collection_all_headers with a
|
|
224
|
-
#
|
|
230
|
+
# `collection`, when given, overrides collection_all_headers with a test's HeaderSearch or
|
|
231
|
+
# a caller's own ordered header list -- see find_header_input_for_mock's comment.
|
|
225
232
|
def find_header_file(filepath, complain = :error, collection: nil)
|
|
226
233
|
return find_first_candidate(filepath, @configurator.extension_header, collection || @configurator.collection_all_headers, complain)
|
|
227
234
|
end
|
|
@@ -295,30 +302,16 @@ class FileFinder
|
|
|
295
302
|
raise CeedlingException.new( message )
|
|
296
303
|
end
|
|
297
304
|
|
|
298
|
-
#
|
|
299
|
-
#
|
|
300
|
-
#
|
|
301
|
-
#
|
|
302
|
-
#
|
|
303
|
-
#
|
|
304
|
-
# A filepath that isn't under the test build root at all (a source-tree-relative query
|
|
305
|
-
# from an #include or TEST_SOURCE_FILE(), rather than a build artifact's own path) has no
|
|
306
|
-
# test identity to recover -- empty string, never a directory name that could coincidentally
|
|
307
|
-
# match some unrelated file's own basename.
|
|
305
|
+
# The name of the test whose own build directory holds `filepath` (TestBuildLayout#locate),
|
|
306
|
+
# such as `test/unit/test_foo` for an object below `build/test/out/test/unit/test_foo/_t_/`.
|
|
307
|
+
# It lets a lookup go straight to the one test a build file belongs to, rather than
|
|
308
|
+
# searching the whole project by bare basename, the query shape that's ambiguous when
|
|
309
|
+
# another same-named test exists elsewhere.
|
|
308
310
|
#
|
|
309
|
-
# A test's
|
|
310
|
-
#
|
|
311
|
-
def test_context_of(filepath)
|
|
312
|
-
|
|
313
|
-
return '' if subdir.nil?
|
|
314
|
-
|
|
315
|
-
parts = subdir.split( '/' )
|
|
316
|
-
parts.length.downto( 1 ) do |count|
|
|
317
|
-
name = parts.first( count ).join( '/' )
|
|
318
|
-
return name if test_files_by_name.key?( name )
|
|
319
|
-
end
|
|
320
|
-
|
|
321
|
-
return ''
|
|
311
|
+
# A filepath below no test's own directory, such as a source-tree-relative query from an
|
|
312
|
+
# #include or TEST_SOURCE_FILE(), has no test to recover and gives ''.
|
|
313
|
+
def test_context_of(filepath, context)
|
|
314
|
+
return @test_build_layout.locate( filepath, context: context ) || ''
|
|
322
315
|
end
|
|
323
316
|
|
|
324
317
|
# A test's runner lives where FilePathUtils#form_test_runners_path puts it. Takes the test
|
|
@@ -336,40 +329,10 @@ class FileFinder
|
|
|
336
329
|
end
|
|
337
330
|
end
|
|
338
331
|
|
|
339
|
-
#
|
|
340
|
-
#
|
|
341
|
-
def
|
|
342
|
-
|
|
343
|
-
@test_names_lock.synchronize do
|
|
344
|
-
@nested_test_names ||= nest_names( names )
|
|
345
|
-
end
|
|
346
|
-
end
|
|
347
|
-
|
|
348
|
-
# Files each name under every other name that is one of its parent directories
|
|
349
|
-
def nest_names(names)
|
|
350
|
-
known = names.to_set
|
|
351
|
-
nested = Hash.new { |hash, name| hash[name] = [] }
|
|
352
|
-
|
|
353
|
-
names.each do |name|
|
|
354
|
-
parts = name.split( '/' )
|
|
355
|
-
(1...parts.length).each do |count|
|
|
356
|
-
parent = parts.first( count ).join( '/' )
|
|
357
|
-
nested[parent] << name if known.include?( parent )
|
|
358
|
-
end
|
|
359
|
-
end
|
|
360
|
-
|
|
361
|
-
return nested
|
|
362
|
-
end
|
|
363
|
-
|
|
364
|
-
# A test's generated mocks or Partials, beneath its own directory below `base`. A test
|
|
365
|
-
# whose name continues this one's (`test/test_foo/test_bar` after `test/test_foo`) has its
|
|
366
|
-
# directory nested here, and the files in it are that test's own.
|
|
367
|
-
def own_generated_files(base, test_context)
|
|
368
|
-
listing = @file_wrapper.directory_listing( FilePathUtils.glob( File.join( base, test_context ), '**/*' + EXTENSION_CORE_SOURCE ) )
|
|
369
|
-
nested = nested_test_names.fetch( test_context, [] ).map { |name| File.join( base, name ) + '/' }
|
|
370
|
-
return listing if nested.empty?
|
|
371
|
-
|
|
372
|
-
return listing.reject { |file| nested.any? { |dir| file.start_with?( dir ) } }
|
|
332
|
+
# A test's generated mocks or Partials, below its own root of that kind. No other test's
|
|
333
|
+
# root lies below it, so every file there is this test's own.
|
|
334
|
+
def own_generated_files(root)
|
|
335
|
+
return @file_wrapper.directory_listing( FilePathUtils.glob( root, '**/*' + EXTENSION_CORE_SOURCE ) )
|
|
373
336
|
end
|
|
374
337
|
|
|
375
338
|
# The query for the source of a release or module-under-test object, and whether it is
|
|
@@ -392,7 +355,11 @@ class FileFinder
|
|
|
392
355
|
basename = File.basename( filepath ).ext('')
|
|
393
356
|
return [basename, false] if subdir.nil? || subdir.empty?
|
|
394
357
|
|
|
395
|
-
|
|
358
|
+
# A marker no shortened root holds was placed by another configuration
|
|
359
|
+
source_dir = BuildSubpath.decode( subdir, roots: @file_path_utils.build_roots, release: release )
|
|
360
|
+
return [basename, false] if source_dir.nil?
|
|
361
|
+
|
|
362
|
+
return [File.join( source_dir, basename ), true]
|
|
396
363
|
end
|
|
397
364
|
|
|
398
365
|
def source_tree_query(filepath)
|
|
@@ -403,9 +370,8 @@ class FileFinder
|
|
|
403
370
|
# The root a release or test object is placed below, or nil where none is known
|
|
404
371
|
def placement_root(release, test, context)
|
|
405
372
|
return @configurator.project_release_build_output_path if release
|
|
406
|
-
return nil if test.nil?
|
|
407
373
|
|
|
408
|
-
return @
|
|
374
|
+
return @test_build_layout.root( :out, test, context: context )
|
|
409
375
|
end
|
|
410
376
|
|
|
411
377
|
# The file of `collection` at exactly `query` plus one of `extension`'s spellings, or nil.
|
|
@@ -436,7 +402,7 @@ class FileFinder
|
|
|
436
402
|
# fallback preprocessing builds a generated #include from a module name instead of
|
|
437
403
|
# resolving the file. Whatever directory such a name carries is the module's own.
|
|
438
404
|
def generated_file_subdir(filepath, root, test:, context:)
|
|
439
|
-
out_root =
|
|
405
|
+
out_root = @test_build_layout.root( :out, test, context: context )
|
|
440
406
|
|
|
441
407
|
subdir = PathMirror.relative_subdir( filepath, [root, out_root].compact )
|
|
442
408
|
|
|
@@ -543,7 +509,7 @@ class FileFinder
|
|
|
543
509
|
if strict
|
|
544
510
|
return PathMatcher.match(candidate, collection)
|
|
545
511
|
else
|
|
546
|
-
winner, _others =
|
|
512
|
+
winner, _others = @file_finder_helper.resolve_in_collection(candidate, collection)
|
|
547
513
|
return winner
|
|
548
514
|
end
|
|
549
515
|
end
|
|
@@ -26,13 +26,12 @@ class FileFinderHelper
|
|
|
26
26
|
return not_found_in_collection(filename, file_list, complain)
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
# As `#find_file_in_collection`, but never raises on ambiguity
|
|
30
|
-
#
|
|
31
|
-
#
|
|
32
|
-
#
|
|
33
|
-
# choice, so a build notes it once.
|
|
29
|
+
# As `#find_file_in_collection`, but never raises on ambiguity. A query matching more
|
|
30
|
+
# than one file resolves to the first in `file_list`'s order, or to a HeaderSearch's
|
|
31
|
+
# first in search order, with an ℹ️ NOTICE naming what else matched so the choice isn't
|
|
32
|
+
# silent. Every test that names the file makes the same choice, so a build notes it once.
|
|
34
33
|
def resolve_file_in_collection(filename, file_list, complain)
|
|
35
|
-
found, others =
|
|
34
|
+
found, others = resolve_in_collection(filename, file_list)
|
|
36
35
|
return not_found_in_collection(filename, file_list, complain) if found.nil?
|
|
37
36
|
|
|
38
37
|
unless others.empty?
|
|
@@ -46,6 +45,15 @@ class FileFinderHelper
|
|
|
46
45
|
return found
|
|
47
46
|
end
|
|
48
47
|
|
|
48
|
+
# The winner and the other candidates for `filename`, from a file list or a
|
|
49
|
+
# HeaderSearch, which finds a header as the compiler does
|
|
50
|
+
def resolve_in_collection(filename, collection)
|
|
51
|
+
return PathMatcher.resolve(filename, collection) unless collection.respond_to?( :header_candidates )
|
|
52
|
+
|
|
53
|
+
found = collection.header_candidates( filename )
|
|
54
|
+
return [found.first, found.drop( 1 )]
|
|
55
|
+
end
|
|
56
|
+
|
|
49
57
|
def find_best_path_in_collection(pathname, path_list, complain, description)
|
|
50
58
|
# search our collection for the specified exact path
|
|
51
59
|
raise "No path list provided for #{description} search" if path_list.nil?
|
|
@@ -61,11 +69,11 @@ class FileFinderHelper
|
|
|
61
69
|
return path_list[best_index( scores )]
|
|
62
70
|
end
|
|
63
71
|
|
|
64
|
-
def handle_missing_file(filename, complain)
|
|
72
|
+
def handle_missing_file(filename, complain, extra_message = '')
|
|
65
73
|
case (complain)
|
|
66
|
-
when :error then blow_up(filename)
|
|
74
|
+
when :error then blow_up(filename, extra_message)
|
|
67
75
|
when :warn
|
|
68
|
-
gripe(filename)
|
|
76
|
+
gripe(filename, extra_message)
|
|
69
77
|
return nil
|
|
70
78
|
when :ignore then return nil
|
|
71
79
|
end
|
|
@@ -81,15 +89,23 @@ class FileFinderHelper
|
|
|
81
89
|
# can find any candidate at all, so the query's own basename gets one last check
|
|
82
90
|
# against every list entry case-insensitively -- catches the common slip of a
|
|
83
91
|
# filename typed with the wrong case before falling through to the caller's own
|
|
84
|
-
# not-found handling.
|
|
92
|
+
# not-found handling. An entry ending in the very same text is no such slip. It lies
|
|
93
|
+
# where the search doesn't reach, as a HeaderSearch's hint files may.
|
|
85
94
|
#
|
|
86
95
|
# `complain` of :silent skips that check. A caller asks for silence when it can't know
|
|
87
96
|
# whether the reference is even live, such as a scan of #includes that ignores #if, and
|
|
88
97
|
# a later, authoritative lookup reports a real slip.
|
|
98
|
+
#
|
|
99
|
+
# A HeaderSearch's refusal comes first. It explains why the header lies beyond every
|
|
100
|
+
# search path, which a case check can't.
|
|
89
101
|
def not_found_in_collection(filename, file_list, complain)
|
|
90
102
|
return nil if complain == :silent
|
|
91
103
|
|
|
92
|
-
|
|
104
|
+
refusal = file_list.respond_to?( :refusal ) ? file_list.refusal( filename ) : nil
|
|
105
|
+
return handle_missing_file( filename, complain, refusal ) unless refusal.nil?
|
|
106
|
+
|
|
107
|
+
files = file_list.respond_to?( :hint_files ) ? file_list.hint_files( filename ) : file_list
|
|
108
|
+
matches = letter_case_slips( filename, files )
|
|
93
109
|
if (matches.length > 0)
|
|
94
110
|
blow_up(filename, "However, a filename having different capitalization was found: '#{matches[0]}'.")
|
|
95
111
|
end
|
|
@@ -97,6 +113,12 @@ class FileFinderHelper
|
|
|
97
113
|
return handle_missing_file(filename, complain)
|
|
98
114
|
end
|
|
99
115
|
|
|
116
|
+
# The files ending in `filename` spelled in another letter case
|
|
117
|
+
def letter_case_slips(filename, files)
|
|
118
|
+
pattern = /(?:\\|\/|^)(#{Regexp.escape(filename)})$/i
|
|
119
|
+
return files.find_all { |file| (tail = file[pattern, 1]) && tail != filename }
|
|
120
|
+
end
|
|
121
|
+
|
|
100
122
|
def blow_up(filename, extra_message="")
|
|
101
123
|
error = ["Found no file `#{filename}` in search paths.", extra_message].join(' ').strip
|
|
102
124
|
raise CeedlingException.new( error )
|