// Path: core/src/main/java/org/mini2Dx/miniscript/core/GeneratedClasspathScriptProvider.java
// public abstract class GeneratedClasspathScriptProvider implements ClasspathScriptProvider {
// 	private final Map<String, Integer> scriptFilepathsToIds = new HashMap<String, Integer>();
// 	private final Map<Integer, String> scriptIdsToFilepaths = new HashMap<Integer, String>();
// 	private final Map<Integer, Object> idsToScripts = new HashMap<Integer, Object>();
// 
// 	public GeneratedClasspathScriptProvider() {
// 		super();
// 
// 		final Map<String, Object> generatedScripts = getGeneratedScripts();
// 
// 		int count = 0;
// 		for(String filepath : generatedScripts.keySet()) {
// 			scriptFilepathsToIds.put(filepath, count);
// 			scriptIdsToFilepaths.put(count, filepath);
// 			idsToScripts.put(count, generatedScripts.get(filepath));
// 			count++;
// 		}
// 	}
// 
// 	@Override
// 	public <T> T getClasspathScript(int scriptId) {
// 		return (T) idsToScripts.get(scriptId);
// 	}
// 
// 	@Override
// 	public int getScriptId(String filepath) {
// 		return scriptFilepathsToIds.get(filepath);
// 	}
// 
// 	@Override
// 	public int getTotalScripts() {
// 		return scriptFilepathsToIds.size();
// 	}
// 
// 	@Override
// 	public Set<String> getFilepaths() {
// 		return scriptFilepathsToIds.keySet();
// 	}
// 
// 	@Override
// 	public String getFilepath(int scriptId) {
// 		return scriptIdsToFilepaths.get(scriptId);
// 	}
// 
// 	public abstract Map getGeneratedScripts();
// }


import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.TypeSpec;
import org.mini2Dx.miniscript.core.GeneratedClasspathScriptProvider;
import javax.lang.model.element.Modifier;
				.build();

		javaFile.writeTo(outputDir);
	}

	private void generateScriptProvider(List<CompilerInputFile> inputFiles) throws IOException {
		final String outputClassName = outputClass.get().substring(outputClass.get().lastIndexOf('.') + 1);

		MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder("getGeneratedScripts")
				.addModifiers(Modifier.PUBLIC)
				.returns(Map.class)
				.addStatement("final $T result = new $T()", Map.class, HashMap.class);

		for(CompilerInputFile inputFile : inputFiles) {
			final String scriptPackage = inputFile.getOutputPackageName(outputPackage);
			final ClassName scriptClassName = ClassName.get(scriptPackage, inputFile.getOutputClassName());
			final String path;
			if(getPrefixWithRoot().getOrElse(false)) {
				path = scriptsDir.get().getAsFile().getName() + "/" + inputFile.getInputScriptRelativeFilename().replace('\\', '/');
			} else {
				path =  inputFile.getInputScriptRelativeFilename().replace('\\', '/');
			}
			methodBuilder = methodBuilder.addStatement("result.put($S, new $T())", path, scriptClassName);
		}

		methodBuilder = methodBuilder.addStatement("return result");
		final MethodSpec methodSpec = methodBuilder.build();

		final TypeSpec classSpec = TypeSpec.classBuilder(outputClassName)
				.addModifiers(Modifier.PUBLIC)
// Path: core/src/main/java/org/mini2Dx/miniscript/core/GeneratedClasspathScriptProvider.java
// public abstract class GeneratedClasspathScriptProvider implements ClasspathScriptProvider {
// 	private final Map<String, Integer> scriptFilepathsToIds = new HashMap<String, Integer>();
// 	private final Map<Integer, String> scriptIdsToFilepaths = new HashMap<Integer, String>();
// 	private final Map<Integer, Object> idsToScripts = new HashMap<Integer, Object>();
// 
// 	public GeneratedClasspathScriptProvider() {
// 		super();
// 
// 		final Map<String, Object> generatedScripts = getGeneratedScripts();
// 
// 		int count = 0;
// 		for(String filepath : generatedScripts.keySet()) {
// 			scriptFilepathsToIds.put(filepath, count);
// 			scriptIdsToFilepaths.put(count, filepath);
// 			idsToScripts.put(count, generatedScripts.get(filepath));
// 			count++;
// 		}
// 	}
// 
// 	@Override
// 	public <T> T getClasspathScript(int scriptId) {
// 		return (T) idsToScripts.get(scriptId);
// 	}
// 
// 	@Override
// 	public int getScriptId(String filepath) {
// 		return scriptFilepathsToIds.get(filepath);
// 	}
// 
// 	@Override
// 	public int getTotalScripts() {
// 		return scriptFilepathsToIds.size();
// 	}
// 
// 	@Override
// 	public Set<String> getFilepaths() {
// 		return scriptFilepathsToIds.keySet();
// 	}
// 
// 	@Override
// 	public String getFilepath(int scriptId) {
// 		return scriptIdsToFilepaths.get(scriptId);
// 	}
// 
// 	public abstract Map getGeneratedScripts();
// }


// Path: gradle-plugin/src/main/java/org/mini2Dx/miniscript/gradle/MiniscriptStubTask.java
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.TypeSpec;
import org.mini2Dx.miniscript.core.GeneratedClasspathScriptProvider;
import javax.lang.model.element.Modifier;

				.build();

		javaFile.writeTo(outputDir);
	}

	private void generateScriptProvider(List<CompilerInputFile> inputFiles) throws IOException {
		final String outputClassName = outputClass.get().substring(outputClass.get().lastIndexOf('.') + 1);

		MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder("getGeneratedScripts")
				.addModifiers(Modifier.PUBLIC)
				.returns(Map.class)
				.addStatement("final $T result = new $T()", Map.class, HashMap.class);

		for(CompilerInputFile inputFile : inputFiles) {
			final String scriptPackage = inputFile.getOutputPackageName(outputPackage);
			final ClassName scriptClassName = ClassName.get(scriptPackage, inputFile.getOutputClassName());
			final String path;
			if(getPrefixWithRoot().getOrElse(false)) {
				path = scriptsDir.get().getAsFile().getName() + "/" + inputFile.getInputScriptRelativeFilename().replace('\\', '/');
			} else {
				path =  inputFile.getInputScriptRelativeFilename().replace('\\', '/');
			}
			methodBuilder = methodBuilder.addStatement("result.put($S, new $T())", path, scriptClassName);
		}

		methodBuilder = methodBuilder.addStatement("return result");
		final MethodSpec methodSpec = methodBuilder.build();

		final TypeSpec classSpec = TypeSpec.classBuilder(outputClassName)
				.addModifiers(Modifier.PUBLIC)
				.superclass(GeneratedClasspathScriptProvider.class)