Skip to content

Commit

Permalink
Added logging to plugin execution
Browse files Browse the repository at this point in the history
- plugin_manager now logs plugin activity for plugins with defined event handlers
- Removed plugin base class’s event handler methods as they erroneously and unnecessarily caused each plugin to define (blank) handlers for every event
  • Loading branch information
mkarlesky committed Jan 3, 2024
1 parent 44a0d97 commit bcd237f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 41 deletions.
40 changes: 0 additions & 40 deletions lib/ceedling/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,46 +42,6 @@ def initialize(system_objects, name)
end

def setup; end

# Preprocessing (before / after each and every header file preprocessing operation before mocking)
def pre_mock_preprocess(arg_hash); end
def post_mock_preprocess(arg_hash); end

# Preprocessing (before / after each and every test preprocessing operation before runner generation)
def pre_test_preprocess(arg_hash); end
def post_test_preprocess(arg_hash); end

# Mock generation (before / after each and every mock)
def pre_mock_generate(arg_hash); end
def post_mock_generate(arg_hash); end

# Test runner generation (before / after each and every test runner)
def pre_runner_generate(arg_hash); end
def post_runner_generate(arg_hash); end

# Compilation (before / after each and test or source file compilation)
def pre_compile_execute(arg_hash); end
def post_compile_execute(arg_hash); end

# Linking (before / after each and every test executable or release artifact)
def pre_link_execute(arg_hash); end
def post_link_execute(arg_hash); end

# Test fixture execution (before / after each and every test fixture executable)
def pre_test_fixture_execute(arg_hash); end
def post_test_fixture_execute(arg_hash); end

# Test task (before / after each test executable build)
def pre_test(test); end
def post_test(test); end

# Release task (before / after a release build)
def pre_release; end
def post_release; end

# Whole shebang (any use of Ceedling)
def pre_build; end
def post_build; end

def summary; end

Expand Down
17 changes: 16 additions & 1 deletion lib/ceedling/plugin_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,24 @@ def camelize(underscored_name)
end

def execute_plugins(method, *args)
handlers = 0

@plugin_objects.each do |plugin|
handlers += 1 if plugin.respond_to?(method)
end

if handlers > 0
heading = @reportinator.generate_heading( "Plugins (#{handlers}) > :#{method}" )
@streaminator.stdout_puts(heading, Verbosity::OBNOXIOUS)
end

@plugin_objects.each do |plugin|
begin
plugin.send(method, *args) if plugin.respond_to?(method)
if plugin.respond_to?(method)
message = @reportinator.generate_progress( " + #{plugin.name}" )
@streaminator.stdout_puts(message, Verbosity::OBNOXIOUS)
plugin.send(method, *args)
end
rescue
@streaminator.stderr_puts("Exception raised in plugin: #{plugin.name}, in method #{method}")
raise
Expand Down

0 comments on commit bcd237f

Please sign in to comment.