Skip to content

Commit

Permalink
Showing 2 changed files with 34 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---
:global:
# default ../jruby/bin/ruby won't work since activesupport is one more dir deeper
:interpreter_path: '../../jruby/bin/jruby'
:graal_path: '../../graalvm-jdk1.8.0/bin/java'
:setup:
:file:
@@ -22,10 +20,10 @@
method_source.rb: nil
exclude_tests.rb: |
{
FileStoreTest: :test_two_classes_autoloading,
KernelTest: [:test_silence_stream,
:test_quietly,
:test_capture],
FileStoreTest: :test_two_classes_autoloading,
KernelTest: [:test_silence_stream,
:test_quietly,
:test_capture],
}.each do |mod_name, tests|
unless Object.const_defined? mod_name
warn "#{mod_name} not found"
@@ -47,8 +45,8 @@
- db
:run:
:require:
- rubygems
- shims
- date
- bigdecimal
- rubygems
- pathname
51 changes: 29 additions & 22 deletions lib/ruby/truffle/jruby+truffle/runner.rb
Original file line number Diff line number Diff line change
@@ -49,11 +49,13 @@ class JRubyTruffleRunner
'-J-agentlib:jdwp=transport=dt_socket,server=y,address=%d,suspend=y'],
truffle_bundle_path: ['--truffle-bundle-path NAME', 'Bundle path', assign_new_value, '.jruby+truffle_bundle'],
interpreter_path: ['--interpreter-path PATH', "Path to #{BRANDING} interpreter executable", assign_new_value,
'../jruby/bin/jruby'],
File.expand_path(File.join(File.dirname(__FILE__), '../../../../../jruby/bin/jruby'))],
graal_path: ['--graal-path PATH', 'Path to Graal', assign_new_value, '../graalvm-jdk1.8.0/bin/java'],
mock_load_path: ['--mock-load-path PATH', 'Path of mocks & monkey-patches (prepended in $:, relative to --truffle_bundle_path)',
mock_load_path: ['--mock-load-path PATH',
'Path of mocks & monkey-patches (prepended in $:, relative to --truffle_bundle_path)',
assign_new_value, 'mocks'],
use_fs_core: ['--[no-]use-fs-core', 'use core from the filesystem rather than the JAR', assign_new_value, true],
use_fs_core: ['--[no-]use-fs-core', 'use core from the filesystem rather than the JAR',
assign_new_value, true],
bundle_cmd: ['--bundle-cmd CMD', 'command to run for bundle', assign_new_value, 'bundle']
},
setup: {
@@ -135,7 +137,8 @@ class JRubyTruffleRunner

def initialize(argv = ARGV)
construct_default_options
load_local_yaml_configuration
load_gem_configuration
load_local_configuration
build_option_parsers

vm_options, argv_after_vm_options = collect_vm_options argv
@@ -198,24 +201,28 @@ def collect_vm_options(argv)
[vm_options, other_options]
end

def load_local_yaml_configuration
yaml_path = File.join Dir.pwd, LOCAL_CONFIG_FILE

unless File.exist? yaml_path
candidates = Dir['*.gemspec']
if candidates.size == 1
gem_name, _ = candidates.first.split('.')
def load_gem_configuration
candidates = Dir['*.gemspec'] # TODO pwd?

default_configuration_file_path = File.dirname(__FILE__) + "gem_configurations/#{gem_name}.yaml"
if File.exist?(default_configuration_file_path)
puts "Copying default #{LOCAL_CONFIG_FILE} for #{gem_name}."
FileUtils.cp default_configuration_file_path, LOCAL_CONFIG_FILE
end
end
if candidates.size == 1
gem_name, _ = candidates.first.split('.')
yaml_path = File.dirname(__FILE__) + "/gem_configurations/#{gem_name}.yaml"
File.exist? yaml_path
end

yaml_data = YAML.load_file(yaml_path) if File.exist?(yaml_path)
@options = deep_merge @options, yaml_data
apply_yaml_to_configuration(yaml_path)
end

def load_local_configuration
yaml_path = File.join Dir.pwd, LOCAL_CONFIG_FILE
apply_yaml_to_configuration(yaml_path)
end

def apply_yaml_to_configuration(yaml_path)
if File.exist?(yaml_path)
yaml_data = YAML.load_file(yaml_path)
@options = deep_merge @options, yaml_data
end
end

def construct_default_options
@@ -271,8 +278,8 @@ def eval_yaml_strings(value)
end

def subcommand_setup(vm_options, rest)
bundle_cmd = @options[:global][:bundle_cmd].split(' ')
bundle_path = File.expand_path(@options[:global][:truffle_bundle_path])
bundle_cmd = @options[:global][:bundle_cmd].split(' ')
bundle_path = File.expand_path(@options[:global][:truffle_bundle_path])

if bundle_cmd == ['bundle']
bundle_installed = execute_cmd 'command -v bundle 2>/dev/null 1>&2', fail: false
@@ -307,7 +314,7 @@ def subcommand_setup(vm_options, rest)
end

def subcommand_run(vm_options, rest)
jruby_path = Pathname("#{@options[:global][:interpreter_path]}/../..")
jruby_path = Pathname("#{@options[:global][:interpreter_path]}/../..").expand_path

unless jruby_path.absolute?
jruby_path = jruby_path.relative_path_from(Pathname('.'))

2 comments on commit 01476b2

@eregon
Copy link
Member

@eregon eregon commented on 01476b2 Nov 20, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So there is no longer a copy?
This might have effects like a command which used to work suddenly breaks due to an update in the jruby repo. Also it's harder to find the configuration used and to customize it.
OTOH it does handle automatic updates of the default configuration.

Sorry, something went wrong.

@pitr-ch
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it directly uses the gem configuration and local config can be used to override. I think that's simpler to manage in our volume of tested gems.

Sorry, something went wrong.

Please sign in to comment.