diff options
Diffstat (limited to 'tinyusb/test/vendor/ceedling/lib/ceedling/preprocessinator_file_handler.rb')
-rwxr-xr-x | tinyusb/test/vendor/ceedling/lib/ceedling/preprocessinator_file_handler.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tinyusb/test/vendor/ceedling/lib/ceedling/preprocessinator_file_handler.rb b/tinyusb/test/vendor/ceedling/lib/ceedling/preprocessinator_file_handler.rb new file mode 100755 index 00000000..b6b5efbc --- /dev/null +++ b/tinyusb/test/vendor/ceedling/lib/ceedling/preprocessinator_file_handler.rb @@ -0,0 +1,21 @@ + + +class PreprocessinatorFileHandler + + constructor :preprocessinator_extractor, :configurator, :tool_executor, :file_path_utils, :file_wrapper + + + def preprocess_file(filepath, includes) + preprocessed_filepath = @file_path_utils.form_preprocessed_file_filepath(filepath) + + command = @tool_executor.build_command_line(@configurator.tools_test_file_preprocessor, [], filepath, preprocessed_filepath) + @tool_executor.exec(command[:line], command[:options]) + + contents = @preprocessinator_extractor.extract_base_file_from_preprocessed_expansion(preprocessed_filepath) + + includes.each{|include| contents.unshift("#include \"#{include}\"")} + + @file_wrapper.write(preprocessed_filepath, contents.join("\n")) + end + +end |