<commit_before>require 'java'
require 'mini_aether/spec'

module MiniAether
  MAVEN_CENTRAL_REPO = 'http://repo1.maven.org/maven2'.freeze

  M2_SETTINGS = File.join(ENV['HOME'], '.m2', 'settings.xml').freeze

  class << self
    # Create a new ScriptingContainer (Java object interface to a
    # JRuby runtime) in SINGLETHREAD mode, and yield it to the block.
    # Ensure the runtime is terminated after the block returns.
    def with_ruby_container
      scope = Java::OrgJrubyEmbed::LocalContextScope::SINGLETHREAD
      c = Java::OrgJrubyEmbed::ScriptingContainer.new(scope)
      begin
        yield c
      ensure
        c.terminate
      end
    end

    # Resolve +dependencies+, downloading from +sources+.
    #
    # Uses a separate JRuby runtime to avoid polluting the classpath
    # with Aether and SLF4J classes.
    #
    # @param [Array<Hash>] dependencies
    #
    # @option dependency [String] :group_id the groupId of the artifact
    # @option dependency [String] :artifact_id the artifactId of the artifact
    # @option dependency [String] :version the version (or range of versions) of the artifact
    # @option dependency [String] :extension default to 'jar'
    #
    # @param [Array<String>] repos urls to maven2 repositories
    #
    # @return [Array<String>] an array of paths to artifact files
    # (likely jar files) satisfying the dependencies<commit_msg>Set compile mode to 'OFF' in sub JRuby instance.<commit_after>require 'java'
require 'mini_aether/spec'

module MiniAether
  MAVEN_CENTRAL_REPO = 'http://repo1.maven.org/maven2'.freeze

  M2_SETTINGS = File.join(ENV['HOME'], '.m2', 'settings.xml').freeze

  class << self
    # Create a new ScriptingContainer (Java object interface to a
    # JRuby runtime) in SINGLETHREAD mode, and yield it to the block.
    # Ensure the runtime is terminated after the block returns.
    def with_ruby_container
      scope = Java::OrgJrubyEmbed::LocalContextScope::SINGLETHREAD
      c = Java::OrgJrubyEmbed::ScriptingContainer.new(scope)
      begin
        # short-lived container of mostly java calls may be a bit
        # faster without spending time to JIT
        c.setCompileMode Java::OrgJruby::RubyInstanceConfig::CompileMode::OFF
        yield c
      ensure
        c.terminate
      end
    end

    # Resolve +dependencies+, downloading from +sources+.
    #
    # Uses a separate JRuby runtime to avoid polluting the classpath
    # with Aether and SLF4J classes.
    #
    # @param [Array<Hash>] dependencies
    #
    # @option dependency [String] :group_id the groupId of the artifact
    # @option dependency [String] :artifact_id the artifactId of the artifact
    # @option dependency [String] :version the version (or range of versions) of the artifact
    # @option dependency [String] :extension default to 'jar'
    #
    # @param [Array<String>] repos urls to maven2 repositories
    #
    # @return [Array<String>] an array of paths to artifact files
    # (likely jar files) satisfying the dependencies
{'fraction_non_alphanumeric': 0.08529704613342184, 'fraction_numerical': 0.003982741453700631, 'mean_word_length': 3.3429394812680115, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5787479', 'n_tokens_mistral': 927, 'n_tokens_neox': 851, 'n_words': 303}