// Path: src/compile/JavaSourceFile.java
// public class JavaSourceFile extends SimpleJavaFileObject {
// 
//     private String sourceCode;
// 
//     public JavaSourceFile(File file) {
//         super(file.toURI(), Kind.SOURCE);
//         this.sourceCode = FileToString.readFile(file.toURI());
//     }
// 
//     @Override
//     public CharSequence getCharContent(boolean ignoreEncodingErrors) {
//         return sourceCode;
//     }
// 
// }


import compile.JavaSourceFile;
import javax.tools.*;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
package generator;



/**
 * User: PC
 * Date: 30.4.2014
 * Time: 16:13
 */
public class MyJavaCompiler {

    JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();

    @SuppressWarnings("ConstantConditions")
    public void run(File inDir, File outDir) {
        outDir.delete();
        outDir.mkdir();

        List<JavaFileObject> javaFileObjects = new ArrayList<JavaFileObject>();
        DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>();
        Iterable<String> compilationOptions = Arrays.asList("-d", outDir.getName());

        for (File file : inDir.listFiles()) {
            if(file.isDirectory()){
                for(File ffile : file.listFiles()){
                    if(ffile.isDirectory()){
                        for(File fffile : ffile.listFiles()){
// Path: src/compile/JavaSourceFile.java
// public class JavaSourceFile extends SimpleJavaFileObject {
// 
//     private String sourceCode;
// 
//     public JavaSourceFile(File file) {
//         super(file.toURI(), Kind.SOURCE);
//         this.sourceCode = FileToString.readFile(file.toURI());
//     }
// 
//     @Override
//     public CharSequence getCharContent(boolean ignoreEncodingErrors) {
//         return sourceCode;
//     }
// 
// }


// Path: src/generator/MyJavaCompiler.java
import compile.JavaSourceFile;
import javax.tools.*;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;

package generator;



/**
 * User: PC
 * Date: 30.4.2014
 * Time: 16:13
 */
public class MyJavaCompiler {

    JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();

    @SuppressWarnings("ConstantConditions")
    public void run(File inDir, File outDir) {
        outDir.delete();
        outDir.mkdir();

        List<JavaFileObject> javaFileObjects = new ArrayList<JavaFileObject>();
        DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>();
        Iterable<String> compilationOptions = Arrays.asList("-d", outDir.getName());

        for (File file : inDir.listFiles()) {
            if(file.isDirectory()){
                for(File ffile : file.listFiles()){
                    if(ffile.isDirectory()){
                        for(File fffile : ffile.listFiles()){
                            javaFileObjects.add(new JavaSourceFile(fffile));