Rakefile in ruby_parser-3.18.0 vs Rakefile in ruby_parser-3.18.1
- old
+ new
@@ -73,20 +73,30 @@
# TODO: make this deal with encoding comments properly?
end
File.rename tmp_path, path
end
+def unifdef?
+ @unifdef ||= system("which unifdef") or abort <<~EOM
+ unifdef not found!
+
+ Please install 'unifdef' package on your system or `rake generate` on a mac.
+ EOM
+end
+
V2.each do |n|
file "lib/ruby#{n}_parser.y" => "lib/ruby_parser.yy" do |t|
+ unifdef?
cmd = 'unifdef -tk -DV=%s -UDEAD %s > %s || true' % [n, t.source, t.name]
sh cmd
end
file "lib/ruby#{n}_parser.rb" => "lib/ruby#{n}_parser.y"
end
V3.each do |n|
file "lib/ruby#{n}_parser.y" => "lib/ruby3_parser.yy" do |t|
+ unifdef?
cmd = 'unifdef -tk -DV=%s -UDEAD %s > %s || true' % [n, t.source, t.name]
sh cmd
end
file "lib/ruby#{n}_parser.rb" => "lib/ruby#{n}_parser.y"