Skip to content

Commit

Permalink
Merge 6397d9b into a40f954
Browse files Browse the repository at this point in the history
  • Loading branch information
aChase55 committed Sep 10, 2020
2 parents a40f954 + 6397d9b commit da25716
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ Just add this line to your Dangerfile:
xcprofiler.report 'MyApp'
```

Or specify an xcactivitylog path
```ruby
logDir = Dir[File.join('DerivedData/Logs/Build/', '*.xcactivitylog')].first
xcprofiler.report nil, nil, logDir
```

If compilation times of each methods are exceeded the thresholds, `danger` adds inline comment to your PR.

Default thresholds is 50ms for warning, 100ms for failure.
Expand Down
11 changes: 9 additions & 2 deletions lib/xcprofiler/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,16 @@ class DangerXcprofiler < Plugin
# 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)

if log_path and log_path.end_with?('.xcactivitylog')
profiler = Xcprofiler::Profiler.by_path(log_path)
else
profiler = Xcprofiler::Profiler.by_product_name(product_name, derived_data_path)
end

profiler.reporters = [
DangerReporter.new(@dangerfile, thresholds, inline_mode, working_dir, ignored_files)
]
Expand Down

0 comments on commit da25716

Please sign in to comment.