@Test public void givenNoCustomAstClassExistsWhenCopyCompiledFilesFromTempOutputDirectoryToOutputDirectoryThenCompiledClassIsUsed() { CompiledJavaccFile compiledFile = givenACompiledFileWithNoCustomAstClass(); compiler.copyCompiledFilesFromTempOutputDirectoryToOutputDirectory(); verify(compiledFile).copyCompiledFileToTargetDirectory(); }
@Override public void copyCompiledFilesFromTempOutputDirectoryToOutputDirectory() { CompiledJavaccFilesDirectory compiledJavaccFilesDirectory = compiledJavaccFilesDirectoryFactory.getCompiledJavaccFilesDirectory( configuration.getTempOutputDirectory(), configuration.getCompleteSourceTree(), getOutputDirectory(), getLogger()); for (CompiledJavaccFile compiledJavaccFile : compiledJavaccFilesDirectory.listFiles()) { FileTree javaSourceTree = configuration.getJavaSourceTree(); if (compiledJavaccFile.customAstClassExists(javaSourceTree)) { compiledJavaccFile.ignoreCompiledFileAndUseCustomAstClassFromJavaSourceTree(javaSourceTree); } else if (compiledJavaccFile.customAstClassExists()) { compiledJavaccFile.copyCustomAstClassToTargetDirectory(configuration.getCompleteSourceTree()); } else { compiledJavaccFile.copyCompiledFileToTargetDirectory(); } } }
JavaccSourceFileCompiler implements SourceFileCompiler { @Override public void copyCompiledFilesFromTempOutputDirectoryToOutputDirectory() { CompiledJavaccFilesDirectory compiledJavaccFilesDirectory = compiledJavaccFilesDirectoryFactory.getCompiledJavaccFilesDirectory( configuration.getTempOutputDirectory(), configuration.getCompleteSourceTree(), getOutputDirectory(), getLogger()); for (CompiledJavaccFile compiledJavaccFile : compiledJavaccFilesDirectory.listFiles()) { FileTree javaSourceTree = configuration.getJavaSourceTree(); if (compiledJavaccFile.customAstClassExists(javaSourceTree)) { compiledJavaccFile.ignoreCompiledFileAndUseCustomAstClassFromJavaSourceTree(javaSourceTree); } else if (compiledJavaccFile.customAstClassExists()) { compiledJavaccFile.copyCustomAstClassToTargetDirectory(configuration.getCompleteSourceTree()); } else { compiledJavaccFile.copyCompiledFileToTargetDirectory(); } } } }
JavaccSourceFileCompiler implements SourceFileCompiler { @Override public void copyCompiledFilesFromTempOutputDirectoryToOutputDirectory() { CompiledJavaccFilesDirectory compiledJavaccFilesDirectory = compiledJavaccFilesDirectoryFactory.getCompiledJavaccFilesDirectory( configuration.getTempOutputDirectory(), configuration.getCompleteSourceTree(), getOutputDirectory(), getLogger()); for (CompiledJavaccFile compiledJavaccFile : compiledJavaccFilesDirectory.listFiles()) { FileTree javaSourceTree = configuration.getJavaSourceTree(); if (compiledJavaccFile.customAstClassExists(javaSourceTree)) { compiledJavaccFile.ignoreCompiledFileAndUseCustomAstClassFromJavaSourceTree(javaSourceTree); } else if (compiledJavaccFile.customAstClassExists()) { compiledJavaccFile.copyCustomAstClassToTargetDirectory(configuration.getCompleteSourceTree()); } else { compiledJavaccFile.copyCompiledFileToTargetDirectory(); } } } JavaccSourceFileCompiler(ProgramInvoker programInvoker, ProgramArguments argumentsProvidedByTask, CompilerInputOutputConfiguration configuration, Logger logger); }
JavaccSourceFileCompiler implements SourceFileCompiler { @Override public void copyCompiledFilesFromTempOutputDirectoryToOutputDirectory() { CompiledJavaccFilesDirectory compiledJavaccFilesDirectory = compiledJavaccFilesDirectoryFactory.getCompiledJavaccFilesDirectory( configuration.getTempOutputDirectory(), configuration.getCompleteSourceTree(), getOutputDirectory(), getLogger()); for (CompiledJavaccFile compiledJavaccFile : compiledJavaccFilesDirectory.listFiles()) { FileTree javaSourceTree = configuration.getJavaSourceTree(); if (compiledJavaccFile.customAstClassExists(javaSourceTree)) { compiledJavaccFile.ignoreCompiledFileAndUseCustomAstClassFromJavaSourceTree(javaSourceTree); } else if (compiledJavaccFile.customAstClassExists()) { compiledJavaccFile.copyCustomAstClassToTargetDirectory(configuration.getCompleteSourceTree()); } else { compiledJavaccFile.copyCompiledFileToTargetDirectory(); } } } JavaccSourceFileCompiler(ProgramInvoker programInvoker, ProgramArguments argumentsProvidedByTask, CompilerInputOutputConfiguration configuration, Logger logger); @Override void compileSourceFilesToTempOutputDirectory(); @Override void copyNonJavaccFilesToOutputDirectory(); @Override void compile(File inputDirectory, RelativePath inputRelativePath); @Override void copyCompiledFilesFromTempOutputDirectoryToOutputDirectory(); @Override String supportedSuffix(); @Override String getProgramName(); @Override File getOutputDirectory(); @Override File getInputDirectory(); @Override void createTempOutputDirectory(); @Override void cleanTempOutputDirectory(); @Override Logger getLogger(); }
JavaccSourceFileCompiler implements SourceFileCompiler { @Override public void copyCompiledFilesFromTempOutputDirectoryToOutputDirectory() { CompiledJavaccFilesDirectory compiledJavaccFilesDirectory = compiledJavaccFilesDirectoryFactory.getCompiledJavaccFilesDirectory( configuration.getTempOutputDirectory(), configuration.getCompleteSourceTree(), getOutputDirectory(), getLogger()); for (CompiledJavaccFile compiledJavaccFile : compiledJavaccFilesDirectory.listFiles()) { FileTree javaSourceTree = configuration.getJavaSourceTree(); if (compiledJavaccFile.customAstClassExists(javaSourceTree)) { compiledJavaccFile.ignoreCompiledFileAndUseCustomAstClassFromJavaSourceTree(javaSourceTree); } else if (compiledJavaccFile.customAstClassExists()) { compiledJavaccFile.copyCustomAstClassToTargetDirectory(configuration.getCompleteSourceTree()); } else { compiledJavaccFile.copyCompiledFileToTargetDirectory(); } } } JavaccSourceFileCompiler(ProgramInvoker programInvoker, ProgramArguments argumentsProvidedByTask, CompilerInputOutputConfiguration configuration, Logger logger); @Override void compileSourceFilesToTempOutputDirectory(); @Override void copyNonJavaccFilesToOutputDirectory(); @Override void compile(File inputDirectory, RelativePath inputRelativePath); @Override void copyCompiledFilesFromTempOutputDirectoryToOutputDirectory(); @Override String supportedSuffix(); @Override String getProgramName(); @Override File getOutputDirectory(); @Override File getInputDirectory(); @Override void createTempOutputDirectory(); @Override void cleanTempOutputDirectory(); @Override Logger getLogger();  }