use of com.intellij.openapi.compiler.options.ExcludeEntryDescription in project intellij-community by JetBrains.
the class CompilerReferencesFindUsagesTest method testFindUsagesWithExcludedFromCompilationFile.
public void testFindUsagesWithExcludedFromCompilationFile() {
doTestRunnableFindUsagesWithExcludesConfiguration(configuration -> {
final VirtualFile dirToExclude = findClass("Foo").getContainingFile().getVirtualFile();
configuration.addExcludeEntryDescription(new ExcludeEntryDescription(dirToExclude, false, true, myProject));
}, 2, "Foo.java", "Bar.java");
}
use of com.intellij.openapi.compiler.options.ExcludeEntryDescription in project android by JetBrains.
the class AndroidPrecompileTask method unexcludeAllSourceRoots.
private static void unexcludeAllSourceRoots(AndroidFacet facet, ExcludesConfiguration configuration) {
final VirtualFile[] sourceRoots = ModuleRootManager.getInstance(facet.getModule()).getSourceRoots();
final Set<VirtualFile> sourceRootSet = new HashSet<>();
sourceRootSet.addAll(Arrays.asList(sourceRoots));
final String aidlGenSourceRootPath = AndroidRootUtil.getAidlGenSourceRootPath(facet);
if (aidlGenSourceRootPath != null) {
final VirtualFile aidlGenSourceRoot = LocalFileSystem.getInstance().findFileByPath(aidlGenSourceRootPath);
if (aidlGenSourceRoot != null) {
sourceRootSet.remove(aidlGenSourceRoot);
}
}
final String aptGenSourceRootPath = AndroidRootUtil.getAptGenSourceRootPath(facet);
if (aptGenSourceRootPath != null) {
final VirtualFile aptGenSourceRoot = LocalFileSystem.getInstance().findFileByPath(aptGenSourceRootPath);
if (aptGenSourceRoot != null) {
sourceRootSet.remove(aptGenSourceRoot);
}
}
final VirtualFile rsGenRoot = AndroidRootUtil.getRenderscriptGenDir(facet);
if (rsGenRoot != null) {
sourceRootSet.remove(rsGenRoot);
}
final VirtualFile buildconfigGenDir = AndroidRootUtil.getBuildconfigGenDir(facet);
if (buildconfigGenDir != null) {
sourceRootSet.remove(buildconfigGenDir);
}
final ExcludeEntryDescription[] descriptions = configuration.getExcludeEntryDescriptions();
configuration.removeAllExcludeEntryDescriptions();
for (ExcludeEntryDescription description : descriptions) {
final VirtualFile file = description.getVirtualFile();
if (file == null || !sourceRootSet.contains(file)) {
configuration.addExcludeEntryDescription(description);
}
}
}
use of com.intellij.openapi.compiler.options.ExcludeEntryDescription in project android by JetBrains.
the class AndroidPrecompileTask method prepareForCompilation.
private static boolean prepareForCompilation(CompileContext context) {
final Project project = context.getProject();
if (!checkArtifacts(context)) {
return false;
}
checkAndroidDependencies(context);
ExcludesConfiguration configuration = CompilerConfiguration.getInstance(project).getExcludedEntriesConfiguration();
Set<ExcludeEntryDescription> addedEntries = new HashSet<>();
for (Module module : ModuleManager.getInstance(project).getModules()) {
final AndroidFacet facet = AndroidFacet.getInstance(module);
if (facet == null) {
continue;
}
if (context.isRebuild()) {
clearResCache(facet, context);
}
final AndroidPlatform platform = facet.getConfiguration().getAndroidPlatform();
final int platformToolsRevision = platform != null ? platform.getSdkData().getPlatformToolsRevision() : -1;
LOG.debug("Platform-tools revision for module " + module.getName() + " is " + platformToolsRevision);
if (!facet.isAppProject()) {
if (platformToolsRevision >= 0 && platformToolsRevision <= 7) {
LOG.debug("Excluded sources of module " + module.getName());
excludeAllSourceRoots(module, configuration, addedEntries);
} else {
// todo: support this by project converter to use on compile-server
unexcludeAllSourceRoots(facet, configuration);
}
}
}
if (addedEntries.size() > 0) {
LOG.debug("Files excluded by Android: " + addedEntries.size());
project.getMessageBus().connect().subscribe(CompilerTopics.COMPILATION_STATUS, new MyCompilationStatusListener(project, addedEntries));
}
return true;
}
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 dir) {
final ExcludesConfiguration configuration = CompilerConfiguration.getInstance(project).getExcludedEntriesConfiguration();
for (ExcludeEntryDescription description : configuration.getExcludeEntryDescriptions()) {
if (Comparing.equal(description.getVirtualFile(), dir)) {
return;
}
}
configuration.addExcludeEntryDescription(new ExcludeEntryDescription(dir, true, false, project));
}
use of com.intellij.openapi.compiler.options.ExcludeEntryDescription in project intellij-community by JetBrains.
the class CompilerExcludes method isAvailable.
public static boolean isAvailable(Project project) {
final CompilerConfigurationImpl compilerConfiguration = (CompilerConfigurationImpl) CompilerConfiguration.getInstance(project);
final ExcludeEntryDescription[] excludeEntryDescriptions = compilerConfiguration.getExcludedEntriesConfiguration().getExcludeEntryDescriptions();
return excludeEntryDescriptions.length > 0;
}
Aggregations