mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
2a97e97db4
* Output `GEN` log for generated files
* `MRBC` log is outputted one for each `mrbc` execution
#### Before this patch:
```console
CC src/array.c -> build/host/src/array.o
(snip)
GEN mrblib/*.rb -> build/host/mrblib/mrblib.c
MRBC mrblib/00class.rb
MRBC mrblib/10error.rb
(snip)
CC mrbgems/mruby-time/src/time.c -> build/host/mrbgems/mruby-time/src/time.o
MRBC mrbgems/mruby-time/mrblib/time.rb
(snip)
CC mrbgems/mruby-socket/test/sockettest.c -> build/host/mrbgems/mruby-socket/test/sockettest.o
MRBC mrbgems/mruby-socket/test/addrinfo.rb
MRBC mrbgems/mruby-socket/test/basicsocket.rb
(snip)
```
#### After this patch:
```console
GEN build/presym
GEN build/presym.inc
CC src/array.c -> build/host/src/array.o
(snip)
GEN mrblib/*.rb -> build/host/mrblib/mrblib.c
MRBC mrblib/00class.rb
mrblib/10error.rb
(snip)
CC mrbgems/mruby-time/src/time.c -> build/host/mrbgems/mruby-time/src/time.o
GEN build/host/mrbgems/mruby-time/gem_init.c
MRBC mrbgems/mruby-time/mrblib/time.rb
(snip)
CC mrbgems/mruby-socket/test/sockettest.c -> build/host/mrbgems/mruby-socket/test/sockettest.o
GEN build/host/mrbgems/mruby-socket/gem_test.c
MRBC mrbgems/mruby-socket/test/addrinfo.rb
MRBC mrbgems/mruby-socket/test/basicsocket.rb
(snip)
```
36 lines
742 B
Ruby
36 lines
742 B
Ruby
autoload :Pathname, 'pathname'
|
|
|
|
class Object
|
|
class << self
|
|
def attr_block(*syms)
|
|
syms.flatten.each do |sym|
|
|
class_eval "def #{sym}(&block);block.call(@#{sym}) if block_given?;@#{sym};end"
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
class String
|
|
def relative_path_from(dir)
|
|
Pathname.new(File.expand_path(self)).relative_path_from(Pathname.new(File.expand_path(dir))).to_s
|
|
end
|
|
|
|
def relative_path
|
|
relative_path_from(Dir.pwd)
|
|
end
|
|
end
|
|
|
|
def install_D(src, dst)
|
|
rm_f dst
|
|
mkdir_p File.dirname(dst)
|
|
cp src, dst
|
|
end
|
|
|
|
def _pp(cmd, src, tgt=nil, indent: nil)
|
|
return if Rake.verbose
|
|
|
|
width = 5
|
|
template = indent ? "%#{width * indent}s %s %s" : "%-#{width}s %s %s"
|
|
puts template % [cmd, src, tgt ? "-> #{tgt}" : nil]
|
|
end
|