<commit_before>require 'antwrap'
require 'rake-tasks/crazy_fun/mappings/common'

class JavaMappings
  def add_all(fun)
    fun.add_mapping("java_library", CrazyFunJava::CheckPreconditions.new)
    fun.add_mapping("java_library", CrazyFunJava::CreateTask.new)
    fun.add_mapping("java_library", CrazyFunJava::CreateShortNameTask.new)
    fun.add_mapping("java_library", CrazyFunJava::AddDepedencies.new)
    fun.add_mapping("java_library", CrazyFunJava::TidyTempDir.new)
    fun.add_mapping("java_library", CrazyFunJava::Javac.new)
    fun.add_mapping("java_library", CrazyFunJava::CopyResources.new)
    fun.add_mapping("java_library", CrazyFunJava::Jar.new)
    fun.add_mapping("java_library", CrazyFunJava::TidyTempDir.new)
    fun.add_mapping("java_library", CrazyFunJava::CreateSourceJar.new)
    
    fun.add_mapping("java_test", CrazyFunJava::CheckPreconditions.new)
    fun.add_mapping("java_test", CrazyFunJava::CreateTask.new)
    fun.add_mapping("java_test", CrazyFunJava::CreateShortNameTask.new)
    fun.add_mapping("java_test", CrazyFunJava::AddDepedencies.new)
    fun.add_mapping("java_test", CrazyFunJava::TidyTempDir.new)
    fun.add_mapping("java_test", CrazyFunJava::Javac.new)
    fun.add_mapping("java_test", CrazyFunJava::CopyResources.new)
    fun.add_mapping("java_test", CrazyFunJava::Jar.new)
    fun.add_mapping("java_test", CrazyFunJava::TidyTempDir.new)
    fun.add_mapping("java_test", CrazyFunJava::RunTests.new)
    fun.add_mapping("java_test", CrazyFunJava::CreateSourceJar.new)
  end
end

# Monkey-patch ant wrap so it works with where we store ant
module Antwrap
  module AntwrapClassLoader
    def load_ant_libs(ant_home)
      puts "called: #{ant_home}"
      jars = match(ant_home) {|p| ext = p[-4...p.size]; ext && ext.downcase == '.jar'} 
      
      if(RUBY_PLATFORM == 'java')
        jars.each {|jar| require jar }
      else
        Rjb::load(jars.join(File::PATH_SEPARATOR), [])
      end
      
    end
    
    module_function :load_ant_libs
  end
end

module CrazyFunJava

  
  @ant = Antwrap::AntProject.new(:name => 'selenium', 
    :ant_home => 'third_party/java/ant', :basedir => '.')
  @ant.project.setProperty('XmlLogger.file', 'build/build_log.xml')

  # Silence logging to the console, and output to the xml build file
  @ant.project.getBuildListeners().get(0).setMessageOutputLevel(verbose ? 2 : 0)<commit_msg>SimonStewart: Removing some debug output.<commit_after>require 'antwrap'
require 'rake-tasks/crazy_fun/mappings/common'

class JavaMappings
  def add_all(fun)
    fun.add_mapping("java_library", CrazyFunJava::CheckPreconditions.new)
    fun.add_mapping("java_library", CrazyFunJava::CreateTask.new)
    fun.add_mapping("java_library", CrazyFunJava::CreateShortNameTask.new)
    fun.add_mapping("java_library", CrazyFunJava::AddDepedencies.new)
    fun.add_mapping("java_library", CrazyFunJava::TidyTempDir.new)
    fun.add_mapping("java_library", CrazyFunJava::Javac.new)
    fun.add_mapping("java_library", CrazyFunJava::CopyResources.new)
    fun.add_mapping("java_library", CrazyFunJava::Jar.new)
    fun.add_mapping("java_library", CrazyFunJava::TidyTempDir.new)
    fun.add_mapping("java_library", CrazyFunJava::CreateSourceJar.new)
    
    fun.add_mapping("java_test", CrazyFunJava::CheckPreconditions.new)
    fun.add_mapping("java_test", CrazyFunJava::CreateTask.new)
    fun.add_mapping("java_test", CrazyFunJava::CreateShortNameTask.new)
    fun.add_mapping("java_test", CrazyFunJava::AddDepedencies.new)
    fun.add_mapping("java_test", CrazyFunJava::TidyTempDir.new)
    fun.add_mapping("java_test", CrazyFunJava::Javac.new)
    fun.add_mapping("java_test", CrazyFunJava::CopyResources.new)
    fun.add_mapping("java_test", CrazyFunJava::Jar.new)
    fun.add_mapping("java_test", CrazyFunJava::TidyTempDir.new)
    fun.add_mapping("java_test", CrazyFunJava::RunTests.new)
    fun.add_mapping("java_test", CrazyFunJava::CreateSourceJar.new)
  end
end

# Monkey-patch ant wrap so it works with where we store ant
module Antwrap
  module AntwrapClassLoader
    def load_ant_libs(ant_home)
      jars = match(ant_home) {|p| ext = p[-4...p.size]; ext && ext.downcase == '.jar'} 
      
      if(RUBY_PLATFORM == 'java')
        jars.each {|jar| require jar }
      else
        Rjb::load(jars.join(File::PATH_SEPARATOR), [])
      end
      
    end
    
    module_function :load_ant_libs
  end
end

module CrazyFunJava

  
  @ant = Antwrap::AntProject.new(:name => 'selenium', 
    :ant_home => 'third_party/java/ant', :basedir => '.')
  @ant.project.setProperty('XmlLogger.file', 'build/build_log.xml')

  # Silence logging to the console, and output to the xml build file
  @ant.project.getBuildListeners().get(0).setMessageOutputLevel(verbose ? 2 : 0)
{'fraction_non_alphanumeric': 0.13226283541094444, 'fraction_numerical': 0.001690259877456159, 'mean_word_length': 4.9547169811320755, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4610301', 'n_tokens_mistral': 1665, 'n_tokens_neox': 1651, 'n_words': 238}