<commit_before>package com.beust.kobalt.plugin.java

import com.beust.kobalt.JavaInfo
import com.beust.kobalt.SystemProperties
import com.beust.kobalt.api.KobaltContext
import com.beust.kobalt.api.Project
import com.beust.kobalt.internal.CompilerActionInfo
import com.beust.kobalt.internal.ICompilerAction
import com.beust.kobalt.internal.JvmCompiler
import com.beust.kobalt.internal.TaskResult
import com.beust.kobalt.maven.IClasspathDependency
import com.beust.kobalt.misc.log
import com.google.inject.Inject
import com.google.inject.Singleton
import java.io.File

@Singleton
class JavaCompiler @Inject constructor(val jvmCompiler: JvmCompiler) {
    fun compilerAction(executable: File) = object : ICompilerAction {
        override fun compile(info: CompilerActionInfo): TaskResult {
            info.outputDir.mkdirs()

            val allArgs = arrayListOf(
                    executable.absolutePath,
                    "-d", info.outputDir.absolutePath)
            if (info.dependencies.size > 0) {
                allArgs.add("-classpath")
                allArgs.add(info.dependencies.map {it.jarFile.get()}.joinToString(File.pathSeparator))
            }
            allArgs.addAll(info.compilerArgs)
            allArgs.addAll(info.sourceFiles)

            val pb = ProcessBuilder(allArgs)
            info.directory?.let {
                pb.directory(File(it))
            }
            pb.inheritIO()<commit_msg>Don't cd to project's directory when compiling with Java.<commit_after>package com.beust.kobalt.plugin.java

import com.beust.kobalt.JavaInfo
import com.beust.kobalt.SystemProperties
import com.beust.kobalt.api.KobaltContext
import com.beust.kobalt.api.Project
import com.beust.kobalt.internal.CompilerActionInfo
import com.beust.kobalt.internal.ICompilerAction
import com.beust.kobalt.internal.JvmCompiler
import com.beust.kobalt.internal.TaskResult
import com.beust.kobalt.maven.IClasspathDependency
import com.beust.kobalt.misc.log
import com.google.inject.Inject
import com.google.inject.Singleton
import java.io.File

@Singleton
class JavaCompiler @Inject constructor(val jvmCompiler: JvmCompiler) {
    fun compilerAction(executable: File) = object : ICompilerAction {
        override fun compile(info: CompilerActionInfo): TaskResult {
            info.outputDir.mkdirs()

            val allArgs = arrayListOf(
                    executable.absolutePath,
                    "-d", info.outputDir.absolutePath)
            if (info.dependencies.size > 0) {
                allArgs.add("-classpath")
                allArgs.add(info.dependencies.map {it.jarFile.get()}.joinToString(File.pathSeparator))
            }
            allArgs.addAll(info.compilerArgs)
            allArgs.addAll(info.sourceFiles)

            val pb = ProcessBuilder(allArgs)
//            info.directory?.let {
//                pb.directory(File(it))
//            }
            pb.inheritIO()
{'fraction_non_alphanumeric': 0.09718406593406594, 'fraction_numerical': 0.0006868131868131869, 'mean_word_length': 2.79296875, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4891120', 'n_tokens_mistral': 877, 'n_tokens_neox': 859, 'n_words': 139}