<commit_before>require 'rake'

# Read in and set up development environment variables.
if !ENV['BUILD_PATH']

    # Global Cappuccino build directory
    if ENV['CAPP_BUILD']
        ENV['BUILD_PATH'] = ENV['CAPP_BUILD']
        
    # Maintain backwards compatibility with steam.
    elsif ENV['STEAM_BUILD']
        ENV['BUILD_PATH'] = ENV['STEAM_BUILD']

    # Just build here.
    else 
        ENV['BUILD_PATH'] = File.join(File.dirname(__FILE__), 'Build')
    end
end

ENV['BUILD_PATH'] = File.expand_path(ENV['BUILD_PATH'])

if !ENV['CONFIG']
    ENV['CONFIG'] = 'Release'
end

$CONFIGURATION              = ENV['CONFIG']
$BUILD_DIR                  = ENV['BUILD_PATH']
$PRODUCT_DIR                = File.join($BUILD_DIR, $CONFIGURATION)
$ENVIRONMENT_DIR            = File.join($BUILD_DIR, $CONFIGURATION, 'env')
$ENVIRONMENT_BIN_DIR        = File.join($ENVIRONMENT_DIR, 'bin')
$ENVIRONMENT_LIB_DIR        = File.join($ENVIRONMENT_DIR, 'lib') 
$ENVIRONMENT_FRAMEWORKS_DIR = File.join($ENVIRONMENT_LIB_DIR, 'Frameworks')

$HOME_DIR        = File.expand_path(File.dirname(__FILE__))
$LICENSE_FILE    = File.expand_path(File.join(File.dirname(__FILE__), 'LICENSE'))

if !(defined? COMMON_DO_ONCE)
    
    COMMON_DO_ONCE = true
    
    $LOAD_PATH << File.join($HOME_DIR, 'Rake', 'lib')
    ENV['PATH'] = $ENVIRONMENT_BIN_DIR + ':' + ENV['PATH']
end

require 'objective-j'

$env = ""
$env += %{CONFIG="#{ENV['CONFIG']}" } if ENV['CONFIG']
$env += %{BUILD_DIR="#{ENV['BUILD_DIR']}" } if ENV['BUILD_DIR']

def subrake(directories, task_name)
    directories.each do |directory|
        system %{cd #{directory} && #{$env} #{$0} #{task_name}}
    end
end

# Shared Resrouces in env
$JSJAR_PATH = File.expand_path(File.join($HOME_DIR, 'Tools/Utilities/js.jar'))
$ENVIRONMENT_JS = File.join($ENVIRONMENT_LIB_DIR, 'js.jar')

file_d $ENVIRONMENT_JS do
    cp($JSJAR_PATH, $ENVIRONMENT_JS)
end

def js2java(inputfile, className, debug)
    
    debugString = '-nosource -debug' if debug
    
    IO.popen("java -classpath #{$JSJAR_PATH}:. #{debugString} org.mozilla.javascript.tools.jsc.Main -o #{className} #{inputfile}") do |shrinksafe|
        puts shrinksafe.read
    end
end

def cat(files, outfile)

    File.open(outfile, "w") do |concated|
    
        files.each do |file|
          concated.write IO.read(file)
        end 
    end
end

$OBJJ_TEMPLATE_EXECUTABLE   = File.join($HOME_DIR, 'Rake', 'lib', 'objj-executable')

def make_objj_executable(path)
    cp($OBJJ_TEMPLATE_EXECUTABLE, path)
    File.chmod 0755, path
end

task :build => [$ENVIRONMENT_JS]
task :default => [:build]<commit_msg>Added shorthands:<commit_after>require 'rake'

# Read in and set up development environment variables.
if !ENV['BUILD_PATH']

    # Global Cappuccino build directory
    if ENV['CAPP_BUILD']
        ENV['BUILD_PATH'] = ENV['CAPP_BUILD']
        
    # Maintain backwards compatibility with steam.
    elsif ENV['STEAM_BUILD']
        ENV['BUILD_PATH'] = ENV['STEAM_BUILD']

    # Just build here.
    else 
        ENV['BUILD_PATH'] = File.join(File.dirname(__FILE__), 'Build')
    end
end

ENV['BUILD_PATH'] = File.expand_path(ENV['BUILD_PATH'])

if !ENV['CONFIG']
    ENV['CONFIG'] = 'Release'
end

$CONFIGURATION              = ENV['CONFIG']
$BUILD_DIR                  = ENV['BUILD_PATH']
$PRODUCT_DIR                = File.join($BUILD_DIR, $CONFIGURATION)
$ENVIRONMENT_DIR            = File.join($BUILD_DIR, $CONFIGURATION, 'env')
$ENVIRONMENT_BIN_DIR        = File.join($ENVIRONMENT_DIR, 'bin')
$ENVIRONMENT_LIB_DIR        = File.join($ENVIRONMENT_DIR, 'lib') 
$ENVIRONMENT_FRAMEWORKS_DIR = File.join($ENVIRONMENT_LIB_DIR, 'Frameworks')

$HOME_DIR        = File.expand_path(File.dirname(__FILE__))
$LICENSE_FILE    = File.expand_path(File.join(File.dirname(__FILE__), 'LICENSE'))

if !(defined? COMMON_DO_ONCE)
    
    COMMON_DO_ONCE = true
    
    $LOAD_PATH << File.join($HOME_DIR, 'Rake', 'lib')
    ENV['PATH'] = $ENVIRONMENT_BIN_DIR + ':' + ENV['PATH']
end

require 'objective-j'

def serialized_env
    env = ""
    env += %{CONFIG="#{ENV['CONFIG']}" } if ENV['CONFIG']
    env += %{BUILD_DIR="#{ENV['BUILD_DIR']}" } if ENV['BUILD_DIR']

    return env

end

def subrake(directories, task_name)
    directories.each do |directory|
        system %{cd #{directory} && #{$serialized_env} #{$0} #{task_name}}
    end
end

# Shared Resrouces in env
$JSJAR_PATH = File.expand_path(File.join($HOME_DIR, 'Tools/Utilities/js.jar'))
$ENVIRONMENT_JS = File.join($ENVIRONMENT_LIB_DIR, 'js.jar')

file_d $ENVIRONMENT_JS do
    cp($JSJAR_PATH, $ENVIRONMENT_JS)
end

def js2java(inputfile, className, debug)
    
    debugString = '-nosource -debug' if debug
    
    IO.popen("java -classpath #{$JSJAR_PATH}:. #{debugString} org.mozilla.javascript.tools.jsc.Main -o #{className} #{inputfile}") do |shrinksafe|
        puts shrinksafe.read
    end
end

def cat(files, outfile)

    File.open(outfile, "w") do |concated|
    
        files.each do |file|
          concated.write IO.read(file)
        end 
    end
end

$OBJJ_TEMPLATE_EXECUTABLE   = File.join($HOME_DIR, 'Rake', 'lib', 'objj-executable')

def make_objj_executable(path)
    cp($OBJJ_TEMPLATE_EXECUTABLE, path)
    File.chmod 0755, path
end

task :build => [$ENVIRONMENT_JS]
task :default => [:build]

task :release do
    ENV['CONFIG'] = 'Release'
    spawn_rake(:build)
end

task :debug do
    ENV['CONFIG'] = 'Debug'
    spawn_rake(:build)
end

task :all => [:debug, :release]

task 'clean-debug' do
    ENV['CONFIG'] = 'Debug'
    spawn_rake(:clean)
end

task 'clean-release' do
    ENV['CONFIG'] = 'Release'
    spawn_rake(:clean)
end

task 'clean-all' => ['clean-debug', 'clean-release']
task :cleanall => ['clean-all']

task 'clobber-debug' do
    ENV['CONFIG'] = 'Debug'
    spawn_rake(:clobber)
end

task 'clobber-release' do
    ENV['CONFIG'] = 'Release'
    spawn_rake(:clobber)
end

task 'clobber-all' => ['clobber-debug', 'clobber-release']
task :clobberall => ['clobber-all']

def spawn_rake(task_name)
    system %{#{$serialized_env} #{$0} #{task_name}}
end
{'fraction_non_alphanumeric': 0.15269956939383902, 'fraction_numerical': 0.0021530308049022857, 'mean_word_length': 3.7216575449569977, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '6659747', 'n_tokens_mistral': 2253, 'n_tokens_neox': 2204, 'n_words': 434}