Skip to content

Commit 01a768d

Browse files
committed
Add a simple tool to synchronize changes from Ruby source files to the GraalVM build
1 parent b2b8a85 commit 01a768d

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

tool/sync.rb

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env ruby
2+
3+
# Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.
4+
# This code is released under a tri EPL/GPL/LGPL license. You can use it,
5+
# redistribute it and/or modify it under the terms of the:
6+
#
7+
# Eclipse Public License version 1.0, or
8+
# GNU General Public License version 2, or
9+
# GNU Lesser General Public License version 2.1.
10+
11+
# A script to synchronize changes from the Ruby source files
12+
# to the GraalVM build instantaneously.
13+
14+
require 'listen'
15+
require 'fileutils'
16+
17+
FROM = File.expand_path('../..', File.realpath(__FILE__))
18+
TO = "#{FROM}/mxbuild/graalvm/jre/languages/ruby"
19+
20+
# Must be consistent with TRUFFLERUBY_GRAALVM_SUPPORT in suite.py
21+
DIRS_TO_SYNC = %w[
22+
lib/json
23+
lib/mri
24+
lib/patches
25+
lib/truffle
26+
].map { |path| "#{FROM}/#{path}" }
27+
28+
listener = Listen.to(*DIRS_TO_SYNC) do |modified, added, removed|
29+
(modified + added).each do |file|
30+
target = "#{TO}#{file[FROM.size..-1]}"
31+
FileUtils::Verbose.cp file, target
32+
end
33+
removed.each do |file|
34+
target = "#{TO}#{file[FROM.size..-1]}"
35+
FileUtils::Verbose.rm target
36+
end
37+
end
38+
39+
listener.start # not blocking
40+
sleep

0 commit comments

Comments
 (0)