use of org.infernus.idea.checkstyle.util.TempDirProvider in project checkstyle-idea by jshiell.
the class CheckStyleConfigurable method apply.
public void apply() {
final PluginConfiguration newConfig = PluginConfigurationBuilder.from(configPanel.getPluginConfiguration()).withScanBeforeCheckin(pluginConfigurationManager.getCurrent().isScanBeforeCheckin()).build();
pluginConfigurationManager.setCurrent(newConfig, true);
activateCurrentCheckstyleVersion(newConfig.getCheckstyleVersion(), newConfig.getThirdPartyClasspath());
if (!newConfig.isCopyLibs()) {
new TempDirProvider().deleteCopiedLibrariesDir(project);
}
}
use of org.infernus.idea.checkstyle.util.TempDirProvider in project checkstyle-idea by jshiell.
the class ScannableFile method prepareBaseTmpDirFor.
private File prepareBaseTmpDirFor(final PsiFile tempPsiFile) {
final File baseTmpDir = new File(new TempDirProvider().forPersistedPsiFile(tempPsiFile), tempFileDirectoryName());
baseTmpDir.deleteOnExit();
return baseTmpDir;
}
use of org.infernus.idea.checkstyle.util.TempDirProvider in project checkstyle-idea by jshiell.
the class ModuleClassPathBuilder method build.
public ClassLoader build(final Module baseModule) {
if (baseModule == null) {
return getClass().getClassLoader();
}
final Project baseModuleProject = baseModule.getProject();
final List<URL> outputPaths = new ArrayList<>();
final Set<Module> transitiveDependencies = new HashSet<>();
ModuleUtil.getDependencies(baseModule, transitiveDependencies);
for (Module moduleInScope : transitiveDependencies) {
if (LOG.isDebugEnabled()) {
LOG.debug("Adding module to classpath: " + moduleInScope.getName());
}
outputPaths.addAll(ModulePaths.compilerOutputPathsFor(moduleInScope));
outputPaths.addAll(ModulePaths.libraryPathsFor(moduleInScope));
}
if (LOG.isDebugEnabled()) {
LOG.debug("Creating class-loader with URLs: " + outputPaths);
}
URL[] effectiveClasspath = outputPaths.toArray(new URL[0]);
if (wantsCopyLibs()) {
final Optional<File> tempDir = new TempDirProvider().forCopiedLibraries(baseModuleProject);
if (tempDir.isPresent()) {
final Path t = Paths.get(tempDir.get().toURI());
effectiveClasspath = new ClasspathStabilizer(baseModuleProject, t).stabilize(outputPaths);
}
}
return new URLClassLoader(effectiveClasspath, getClass().getClassLoader());
}
Aggregations