lib/xcprofiler/plugin.rb in danger-xcprofiler-0.4.0 vs lib/xcprofiler/plugin.rb in danger-xcprofiler-0.5.0
- old
+ new
@@ -46,12 +46,18 @@
attr_accessor :ignored_files
# Search the latest .xcactivitylog by the passing product_name and profile compilation time
# @param [String] product_name Product name for the target project.
# @param [String] derived_data_path Path to the directory containing the DerivedData.
+ # @param [String] log_path Path to the xcactivitylog to process.
# @return [void]
- def report(product_name, derived_data_path = nil)
- profiler = Xcprofiler::Profiler.by_product_name(product_name, derived_data_path)
+ def report(product_name, derived_data_path = nil, log_path = nil)
+ profiler = if log_path&.end_with?('.xcactivitylog')
+ Xcprofiler::Profiler.by_path(log_path)
+ else
+ Xcprofiler::Profiler.by_product_name(product_name, derived_data_path)
+ end
+
profiler.reporters = [
DangerReporter.new(@dangerfile, thresholds, inline_mode, working_dir, ignored_files)
]
profiler.report!
rescue Xcprofiler::DerivedDataNotFound, Xcprofiler::BuildFlagIsNotEnabled => e