Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set full path of the ragel source file to rake task #1221

Merged
merged 2 commits into from
Apr 13, 2018

Conversation

unasuke
Copy link
Contributor

@unasuke unasuke commented Apr 12, 2018

In Rake v12.1.0 or higher, the algorithm of resolve file dependency
was changed in ruby/rake#39 .

Then rake task ragel:generate is works incorrectry that require
wrong ragel source file.
As the example, rake resolves lib/mail/parsers/address_lists_parser.rb
needs lib/mail/parsers/address_lists.rl, but this file is not exist.

Therefore, fixed that to pass full path of the ragel source file
to rule.

rake v12.0.0

$ bundle exec rake --version
rake, version 12.0.0

$ bundle exec rake ragel:generate --rules
Attempting Rule lib/mail/parsers/address_lists_parser.rb => lib/mail/parsers/address_lists_parser.rl
(lib/mail/parsers/address_lists_parser.rb => lib/mail/parsers/address_lists_parser.rl ... EXIST)
Attempting Rule lib/mail/parsers/content_disposition_parser.rb => lib/mail/parsers/content_disposition_parser.rl
(lib/mail/parsers/content_disposition_parser.rb => lib/mail/parsers/content_disposition_parser.rl ... EXIST)
Attempting Rule lib/mail/parsers/content_location_parser.rb => lib/mail/parsers/content_location_parser.rl
(lib/mail/parsers/content_location_parser.rb => lib/mail/parsers/content_location_parser.rl ... EXIST)
Attempting Rule lib/mail/parsers/content_transfer_encoding_parser.rb => lib/mail/parsers/content_transfer_encoding_parser.rl
(lib/mail/parsers/content_transfer_encoding_parser.rb => lib/mail/parsers/content_transfer_encoding_parser.rl ... EXIST)
Attempting Rule lib/mail/parsers/content_type_parser.rb => lib/mail/parsers/content_type_parser.rl
(lib/mail/parsers/content_type_parser.rb => lib/mail/parsers/content_type_parser.rl ... EXIST)
Attempting Rule lib/mail/parsers/date_time_parser.rb => lib/mail/parsers/date_time_parser.rl
(lib/mail/parsers/date_time_parser.rb => lib/mail/parsers/date_time_parser.rl ... EXIST)
Attempting Rule lib/mail/parsers/envelope_from_parser.rb => lib/mail/parsers/envelope_from_parser.rl
(lib/mail/parsers/envelope_from_parser.rb => lib/mail/parsers/envelope_from_parser.rl ... EXIST)
# snip..
Attempting Rule lib/mail/parsers/received_parser.rl => lib/mail/parsers/rfc5322.rl
(lib/mail/parsers/received_parser.rl => lib/mail/parsers/rfc5322.rl ... EXIST)

rake v12.1.0 (without this change)

$ bundle exec rake --version
rake, version 12.1.0

$ bundle exec rake ragel:generate --rules
Attempting Rule lib/mail/parsers/address_lists_parser.rb => lib/mail/parsers/address_lists.rl
(lib/mail/parsers/address_lists_parser.rb => lib/mail/parsers/address_lists.rl ... FAIL)
Attempting Rule lib/mail/parsers/content_disposition_parser.rb => lib/mail/parsers/content_disposition.rl
(lib/mail/parsers/content_disposition_parser.rb => lib/mail/parsers/content_disposition.rl ... FAIL)
Attempting Rule lib/mail/parsers/content_location_parser.rb => lib/mail/parsers/content_location.rl
(lib/mail/parsers/content_location_parser.rb => lib/mail/parsers/content_location.rl ... FAIL)
Attempting Rule lib/mail/parsers/content_transfer_encoding_parser.rb => lib/mail/parsers/content_transfer_encoding.rl
(lib/mail/parsers/content_transfer_encoding_parser.rb => lib/mail/parsers/content_transfer_encoding.rl ... FAIL)
Attempting Rule lib/mail/parsers/content_type_parser.rb => lib/mail/parsers/content_type.rl
(lib/mail/parsers/content_type_parser.rb => lib/mail/parsers/content_type.rl ... FAIL)
Attempting Rule lib/mail/parsers/date_time_parser.rb => lib/mail/parsers/date_time.rl
(lib/mail/parsers/date_time_parser.rb => lib/mail/parsers/date_time.rl ... FAIL)
Attempting Rule lib/mail/parsers/envelope_from_parser.rb => lib/mail/parsers/envelope_from.rl
(lib/mail/parsers/envelope_from_parser.rb => lib/mail/parsers/envelope_from.rl ... FAIL)
Attempting Rule lib/mail/parsers/message_ids_parser.rb => lib/mail/parsers/message_ids.rl
(lib/mail/parsers/message_ids_parser.rb => lib/mail/parsers/message_ids.rl ... FAIL)
Attempting Rule lib/mail/parsers/mime_version_parser.rb => lib/mail/parsers/mime_version.rl
(lib/mail/parsers/mime_version_parser.rb => lib/mail/parsers/mime_version.rl ... FAIL)
Attempting Rule lib/mail/parsers/phrase_lists_parser.rb => lib/mail/parsers/phrase_lists.rl
(lib/mail/parsers/phrase_lists_parser.rb => lib/mail/parsers/phrase_lists.rl ... FAIL)
Attempting Rule lib/mail/parsers/received_parser.rb => lib/mail/parsers/received.rl
(lib/mail/parsers/received_parser.rb => lib/mail/parsers/received.rl ... FAIL)

rake v12.1.0 (with this change)

$ bundle exec rake --version
rake, version 12.1.0

$ bundle exec rake ragel:generate --rules
Attempting Rule lib/mail/parsers/address_lists_parser.rb => lib/mail/parsers/address_lists_parser.rl
(lib/mail/parsers/address_lists_parser.rb => lib/mail/parsers/address_lists_parser.rl ... EXIST)
Attempting Rule lib/mail/parsers/content_disposition_parser.rb => lib/mail/parsers/content_disposition_parser.rl
(lib/mail/parsers/content_disposition_parser.rb => lib/mail/parsers/content_disposition_parser.rl ... EXIST)
# snip..
Attempting Rule lib/mail/parsers/content_disposition_parser.rl => lib/mail/parsers/rfc5322.rl
(lib/mail/parsers/content_disposition_parser.rl => lib/mail/parsers/rfc5322.rl ... EXIST)
ragel -s -R -L -F1 -o lib/mail/parsers/content_disposition_parser.rb lib/mail/parsers/content_disposition_parser.rl
fsm name  : content_disposition
num states: 47

Attempting Rule lib/mail/parsers/content_location_parser.rl => lib/mail/parsers/rfc5322.rl
(lib/mail/parsers/content_location_parser.rl => lib/mail/parsers/rfc5322.rl ... EXIST)
Attempting Rule lib/mail/parsers/content_location_parser.rl => lib/mail/parsers/rfc5322.rl
(lib/mail/parsers/content_location_parser.rl => lib/mail/parsers/rfc5322.rl ... EXIST)
ragel -s -R -L -F1 -o lib/mail/parsers/content_location_parser.rb lib/mail/parsers/content_location_parser.rl
fsm name  : content_location
num states: 41

Attempting Rule lib/mail/parsers/content_transfer_encoding_parser.rl => lib/mail/parsers/rfc5322.rl
(lib/mail/parsers/content_transfer_encoding_parser.rl => lib/mail/parsers/rfc5322.rl ... EXIST)
Attempting Rule lib/mail/parsers/content_transfer_encoding_parser.rl => lib/mail/parsers/rfc5322.rl
(lib/mail/parsers/content_transfer_encoding_parser.rl => lib/mail/parsers/rfc5322.rl ... EXIST)
ragel -s -R -L -F1 -o lib/mail/parsers/content_transfer_encoding_parser.rb lib/mail/parsers/content_transfer_encoding_parser.rl
fsm name  : content_transfer_encoding
num states: 27

Attempting Rule lib/mail/parsers/content_type_parser.rl => lib/mail/parsers/rfc5322.rl
(lib/mail/parsers/content_type_parser.rl => lib/mail/parsers/rfc5322.rl ... EXIST)
Attempting Rule lib/mail/parsers/content_type_parser.rl => lib/mail/parsers/rfc5322.rl
(lib/mail/parsers/content_type_parser.rl => lib/mail/parsers/rfc5322.rl ... EXIST)
ragel -s -R -L -F1 -o lib/mail/parsers/content_type_parser.rb lib/mail/parsers/content_type_parser.rl
fsm name  : content_type
num states: 55

# snip..

Attempting Rule lib/mail/parsers/phrase_lists_parser.rl => lib/mail/parsers/rfc5322.rl
(lib/mail/parsers/phrase_lists_parser.rl => lib/mail/parsers/rfc5322.rl ... EXIST)
Attempting Rule lib/mail/parsers/phrase_lists_parser.rl => lib/mail/parsers/rfc5322.rl
(lib/mail/parsers/phrase_lists_parser.rl => lib/mail/parsers/rfc5322.rl ... EXIST)
ragel -s -R -L -F1 -o lib/mail/parsers/phrase_lists_parser.rb lib/mail/parsers/phrase_lists_parser.rl
fsm name  : date_time
num states: 46

Attempting Rule lib/mail/parsers/received_parser.rl => lib/mail/parsers/rfc5322.rl
(lib/mail/parsers/received_parser.rl => lib/mail/parsers/rfc5322.rl ... EXIST)
Attempting Rule lib/mail/parsers/received_parser.rl => lib/mail/parsers/rfc5322.rl
(lib/mail/parsers/received_parser.rl => lib/mail/parsers/rfc5322.rl ... EXIST)
ragel -s -R -L -F1 -o lib/mail/parsers/received_parser.rb lib/mail/parsers/received_parser.rl
fsm name  : date_time
num states: 655

In Rake v12.1.0 or higher, the algorithm of resolve file dependency
was changed in ruby/rake#39 .

Then rake task "ragel:generate" is works incorrectry that require
wrong ragel source file.
As the example, rake resolves "lib/mail/parsers/address_lists_parser.rb"
needs "lib/mail/parsers/address_lists.rl", but this file is not exist.

Therefore, fixed that to pass full path of the ragel source file
to rule.
@yahonda
Copy link
Contributor

yahonda commented Apr 12, 2018

Great work.

I recall this CI error which was reported at sunspot/sunspot#889
which can be addressed by https://github.com/yahonda/mail/commit/c648205cf35a21b1b3e4fa51f320db6a1fee6cf8

bundle exec rake
bundler: failed to load command: rake (/home/travis/build/mikel/mail/vendor/bundle/ruby/2.5.0/bin/rake)
LoadError: cannot load such file -- bundler/dep_proxy

I hope it makes CI green.

file -- bundler/dep_proxy`

```ruby
bundle exec rake
bundler: failed to load command: rake (/home/travis/build/mikel/mail/vendor/bundle/ruby/2.5.0/bin/rake)
LoadError: cannot load such file -- bundler/dep_proxy
```
@jeremy jeremy merged commit 3668ee8 into mikel:master Apr 13, 2018
@unasuke unasuke deleted the rake_task_ragel_generate branch April 13, 2018 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants