giginet / danger-xcprofiler

🚫 danger plugin for asserting Swift compilation time
MIT License
50 stars 4 forks source link

Invalid `Dangerfile` file: unexpected end of file #8

Open ppeelen opened 5 years ago

ppeelen commented 5 years ago

Report

What did you do?

bundle exec danger --verbose

What did you expect to happen?

I expected Danger to run without any crash from the first time. The first time it crashes, when I rebuild the build it'll complete successfully.

What happened instead?

+------------------------------------------------------------------------------+

| (5) Danger                                                                   |
+------------------------------------------------------------------------------+
| id: script                                                                   |
| version: 1.1.5                                                               |
| collection: https://github.com/bitrise-io/bitrise-steplib.git                |
| toolkit: bash                                                                |
| time: 2019-04-08T06:11:34Z                                                   |
+------------------------------------------------------------------------------+
|                                                                              |
bundler: failed to load command: danger (/Users/vagrant/.rbenv/versions/2.5.3/bin/danger)
Danger::DSLError: 
[!] Invalid `Dangerfile` file: unexpected end of file
 #  from Dangerfile:34
 #  -------------------------------------------
 #  }
 >  xcprofiler.report 'SCHEME'
 #  
 #  -------------------------------------------
  /Users/vagrant/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/xcprofiler-0.6.2/lib/xcprofiler/derived_data.rb:67:in `read'
  /Users/vagrant/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/xcprofiler-0.6.2/lib/xcprofiler/derived_data.rb:67:in `block in lines'
  /Users/vagrant/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/xcprofiler-0.6.2/lib/xcprofiler/derived_data.rb:66:in `open'
  /Users/vagrant/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/xcprofiler-0.6.2/lib/xcprofiler/derived_data.rb:66:in `lines'
  /Users/vagrant/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/xcprofiler-0.6.2/lib/xcprofiler/derived_data.rb:59:in `flag_enabled?'
  /Users/vagrant/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/xcprofiler-0.6.2/lib/xcprofiler/profiler.rb:24:in `report!'
  /Users/vagrant/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/danger-xcprofiler-0.4.0/lib/xcprofiler/plugin.rb:57:in `report'
  Dangerfile:34:in `eval_file'
  /Users/vagrant/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/danger-6.0.3/lib/danger/danger_core/dangerfile.rb:297:in `eval'
  /Users/vagrant/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/danger-6.0.3/lib/danger/danger_core/dangerfile.rb:297:in `eval_file'
  /Users/vagrant/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/danger-6.0.3/lib/danger/danger_core/dangerfile.rb:200:in `block in parse'
  /Users/vagrant/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/danger-6.0.3/lib/danger/danger_core/dangerfile.rb:197:in `instance_eval'
  /Users/vagrant/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/danger-6.0.3/lib/danger/danger_core/dangerfile.rb:197:in `parse'
  /Users/vagrant/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/danger-6.0.3/lib/danger/danger_core/dangerfile.rb:273:in `run'
  /Users/vagrant/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/danger-6.0.3/lib/danger/danger_core/executor.rb:29:in `run'
  /Users/vagrant/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/danger-6.0.3/lib/danger/commands/runner.rb:72:in `run'
  /Users/vagrant/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
  /Users/vagrant/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/danger-6.0.3/bin/danger:5:in `<top (required)>'
  /Users/vagrant/.rbenv/versions/2.5.3/bin/danger:23:in `load'
  /Users/vagrant/.rbenv/versions/2.5.3/bin/danger:23:in `<top (required)>'
[!] The exception involves the following plugins:
 -  danger-xcprofiler
|                                                                              |
+---+---------------------------------------------------------------+----------+
| x | Danger (exit code: 1)                                         | 78 sec   |
+---+---------------------------------------------------------------+----------+
| Issue tracker: https://github.com/bitrise-io/steps-script/issues             |
| Source: https://github.com/bitrise-io/steps-script                           |
+---+---------------------------------------------------------------+----------+

Your Environment

  # Sometimes it's a README fix, or something like that - which isn't relevant for
  # including in a project's CHANGELOG for example
  declared_trivial = github.pr_title.include? "#trivial"

  # Make it more obvious that a PR is a work in progress and shouldn't be merged yet
  warn("PR is classed as Work in Progress") if github.pr_title.include? "[WIP]"

  # Warn when there is a big PR
  warn("Big PR") if git.lines_of_code > 500

  # Read log
  build_output_file = "build/logs/COMPANY-COMPANY.log"
  return unless File.file?(build_output_file)

  build_output_log = File.read build_output_file

  # Parse log to erros.json
  %x(cat #{build_output_file}|bundle exec xcpretty -f `bundle exec xcpretty-json-formatter` &> /dev/null)

  # Xcode Summary
  build_errors_file = "build/reports/errors.json"
  return unless File.file?(build_errors_file)

  xcode_summary.report build_errors_file
  xcode_summary.ignored_files = 'Pods/**'

  # Defines inline_mode
  xcprofiler.inline_mode = false
  # Defines thresholds (ms)
  xcprofiler.thresholds = {
    warn: 300,
    fail: 500
    }
  xcprofiler.report 'SCHEME'
giginet commented 5 years ago

Hi! Thank you for reporting.

Do you use Xcode 10.2? I guess log formats are changed since the latest Xcode. Maybe this issue is caused by xcprofiler...

ppeelen commented 5 years ago

Hi! Yes, I am using Xcode 10.2. This is the stack on which I am running: https://github.com/bitrise-io/bitrise.io/blob/master/system_reports/osx-xcode-10.2.x.log

Worth noting is that on the rebuild, it does work (usually).

giginet commented 5 years ago

Hi I tried xcprofiler on some project in Swift 5, So it may work well.

Would you mind to share your xcactivitylog for further investigate? It will be found in ~/Library/Developer/Xcode/DerivedData

ppeelen commented 5 years ago

Unfortunately, on bitrise I can't access that file. Locally it runs fine. Haven't experienced the error locally, only on the CI.