use of com.intellij.openapi.compiler.options.ExcludeEntryDescription in project intellij-community by JetBrains.
the class CompilerConfigurationImpl method createExcludedEntriesConfiguration.
// Overridden in Upsource
@NotNull
protected ExcludedEntriesConfiguration createExcludedEntriesConfiguration(@NotNull Project project) {
final ExcludedEntriesConfiguration cfg = new ExcludedEntriesConfiguration(project.getMessageBus().syncPublisher(ExcludedEntriesListener.TOPIC));
Disposer.register(project, cfg);
project.getMessageBus().connect().subscribe(ExcludedEntriesListener.TOPIC, new ExcludedEntriesListener() {
@Override
public void onEntryAdded(@NotNull ExcludeEntryDescription description) {
clearState();
}
@Override
public void onEntryRemoved(@NotNull ExcludeEntryDescription description) {
clearState();
}
private void clearState() {
if (project.isOpen()) {
BuildManager.getInstance().clearState(project);
}
}
});
return cfg;
}
use of com.intellij.openapi.compiler.options.ExcludeEntryDescription in project intellij-community by JetBrains.
the class ExcludedFromCompileFilesUtil method getExcludedFilesScope.
static GlobalSearchScope getExcludedFilesScope(@NotNull ExcludeEntryDescription[] descriptions, @NotNull Set<FileType> fileTypes, @NotNull Project project, @NotNull ProjectFileIndex fileIndex) {
ManagingFS fs = ManagingFS.getInstance();
final Collection<VirtualFile> excludedFiles = Stream.of(descriptions).flatMap(description -> {
final VirtualFile file = description.getVirtualFile();
if (file == null)
return Stream.empty();
if (description.isFile()) {
return Stream.of(file);
} else if (description.isIncludeSubdirectories()) {
final Stream.Builder<VirtualFile> builder = Stream.builder();
VfsUtilCore.iterateChildrenRecursively(file, f -> !f.isDirectory() || fs.areChildrenLoaded(f), f -> {
builder.accept(f);
return true;
});
return builder.build();
} else {
return fs.areChildrenLoaded(file) ? Stream.of(file.getChildren()) : Stream.empty();
}
}).filter(f -> !f.isDirectory() && fileTypes.contains(f.getFileType()) && fileIndex.isInSourceContent(f)).collect(Collectors.toList());
return GlobalSearchScope.filesWithoutLibrariesScope(project, excludedFiles);
}
use of com.intellij.openapi.compiler.options.ExcludeEntryDescription in project intellij-community by JetBrains.
the class ExcludeFromCompileAction method actionPerformed.
public void actionPerformed(AnActionEvent e) {
VirtualFile file = getSelectedFile();
if (file != null && file.isValid()) {
ExcludeEntryDescription description = new ExcludeEntryDescription(file, false, true, myProject);
CompilerConfiguration.getInstance(myProject).getExcludedEntriesConfiguration().addExcludeEntryDescription(description);
FileStatusManager.getInstance(myProject).fileStatusesChanged();
}
}
use of com.intellij.openapi.compiler.options.ExcludeEntryDescription in project intellij-community by JetBrains.
the class MavenCompilerConfigurer method configure.
@Override
public void configure(@NotNull MavenProject mavenProject, @NotNull Project project, @Nullable Module module) {
if (module == null)
return;
CompilerConfiguration configuration = CompilerConfiguration.getInstance(project);
if (!Boolean.TRUE.equals(module.getUserData(IGNORE_MAVEN_COMPILER_TARGET_KEY))) {
String targetLevel = mavenProject.getTargetLevel();
// default source and target settings of maven-compiler-plugin is 1.5, see details at http://maven.apache.org/plugins/maven-compiler-plugin
configuration.setBytecodeTargetLevel(module, ObjectUtils.notNull(targetLevel, "1.5"));
}
module.putUserData(IGNORE_MAVEN_COMPILER_TARGET_KEY, Boolean.FALSE);
// Exclude src/main/archetype-resources
VirtualFile dir = VfsUtil.findRelativeFile(mavenProject.getDirectoryFile(), "src", "main", "resources", "archetype-resources");
if (dir != null && !configuration.isExcludedFromCompilation(dir)) {
ExcludesConfiguration cfg = configuration.getExcludedEntriesConfiguration();
cfg.addExcludeEntryDescription(new ExcludeEntryDescription(dir, true, false, project));
}
}
use of com.intellij.openapi.compiler.options.ExcludeEntryDescription in project android by JetBrains.
the class AndroidCompileUtil method excludeFromCompilation.
private static void excludeFromCompilation(@NotNull Project project, @NotNull VirtualFile sourceRoot, @NotNull String aPackage) {
final String buildConfigPath = sourceRoot.getPath() + '/' + aPackage.replace('.', '/') + "/BuildConfig.java";
String url = VfsUtilCore.pathToUrl(buildConfigPath);
final ExcludesConfiguration configuration = CompilerConfiguration.getInstance(project).getExcludedEntriesConfiguration();
for (ExcludeEntryDescription description : configuration.getExcludeEntryDescriptions()) {
if (Comparing.equal(description.getUrl(), url)) {
return;
}
}
configuration.addExcludeEntryDescription(new ExcludeEntryDescription(url, true, false, project));
}
Aggregations