lib/autobuild/packages/cmake.rb in autobuild-1.23.1 vs lib/autobuild/packages/cmake.rb in autobuild-1.24.0
- old
+ new
@@ -267,11 +267,18 @@
io.write(doxyfile_data)
end
run('doc', Autobuild.tool(:doxygen), doxyfile)
end
- def common_utility_handling(utility, target, *args, start_msg, done_msg)
+ def common_utility_handling( # rubocop:disable Metrics/ParameterLists
+ utility,
+ target,
+ *args,
+ start_msg,
+ done_msg,
+ post_process: nil
+ )
utility.source_ref_dir = builddir
utility.task do
progress_start start_msg, :done_message => done_msg do
if internal_doxygen_mode?
run_doxygen
@@ -282,13 +289,31 @@
target, *args,
working_directory: builddir)
end
yield if block_given?
end
+
+ post_process&.call
end
end
+ def with_coverage(&block)
+ @with_coverage ||= block
+ end
+
+ def coverage_block
+ proc do
+ next unless test_utility.coverage_enabled?
+ next unless @with_coverage
+
+ progress_start "generating coverage report for %s",
+ done_message: "generated coverage report for %s" do
+ @with_coverage.call
+ end
+ end
+ end
+
# Declare that the given target can be used to generate documentation
def with_doc(target = 'doc', &block)
common_utility_handling(
doc_utility, target,
"generating documentation for %s",
@@ -297,10 +322,11 @@
def with_tests(target = 'test', &block)
common_utility_handling(
test_utility, target, "ARGS=-V",
"running tests for %s",
- "successfully ran tests for %s", &block)
+ "successfully ran tests for %s",
+ post_process: coverage_block, &block)
end
CMAKE_EQVS = {
'ON' => 'ON',
'YES' => 'ON',