@Override public void setBinaryOutputDirectory(File outputDirectory) { setBinaryOutputDirectory(outputDirectory.getPath()); }
@Override public void setBinaryOutputDirectory(String path) { setBinaryOutputDirectory(new File(path)); }
spoonLauncher.setSourceOutputDirectory(destSrcTestFolder); spoonLauncher.getEnvironment().setShouldCompile(true); spoonLauncher.setBinaryOutputDirectory(destCpTestFolder); spoonLauncher.getEnvironment().setComplianceLevel(7); spoonLauncher.run(); lastLauncher.setSourceOutputDirectory(destSrcTestFolder); lastLauncher.getEnvironment().setShouldCompile(true); lastLauncher.setBinaryOutputDirectory(destCpTestFolder); lastLauncher.run();
/** * Compile the original code * * @param properties */ protected void compileProject(ProjectConfiguration properties) { final Launcher launcher = new Launcher(); for (String path_src : properties.getOriginalDirSrc()) { log.debug("Add folder to compile: " + path_src); launcher.addInputResource(path_src); } for (String path_test : properties.getTestDirSrc()) { log.debug("Add folder to compile: " + path_test); launcher.addInputResource(path_test); } String binoutput = properties.getWorkingDirForBytecode() + File.separator + (ProgramVariant.DEFAULT_ORIGINAL_VARIANT); launcher.setBinaryOutputDirectory(binoutput); log.info("Compiling original code from " + launcher.getModelBuilder().getInputSources() + "\n bytecode saved in " + launcher.getModelBuilder().getBinaryOutputDirectory()); launcher.getEnvironment() .setPreserveLineNumbers(ConfigurationProperties.getPropertyBool("preservelinenumbers")); launcher.getEnvironment().setComplianceLevel(ConfigurationProperties.getPropertyInt("javacompliancelevel")); launcher.getEnvironment().setShouldCompile(true); launcher.getEnvironment().setSourceClasspath(properties.getDependenciesString().split(File.pathSeparator)); launcher.buildModel(); launcher.getModelBuilder().generateProcessedSourceFiles(OutputType.COMPILATION_UNITS); launcher.getModelBuilder().compile(InputType.FILES); // launcher.getModelBuilder().generateProcessedSourceFiles(OutputType.CLASSES); }