mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[jps builds] make ModuleLevelBuilder::getCompilableFileExtensions abstract to ensure that it is implemented
It's important to know which files are processed by ModuleLevelBuilder to skip processing irrelevant files in caches for ModuleBuildTarget. Before the change a notification was printed to the log if some builder doesn't override the method. Now it's will be a compilation error, but binary compatibility isn't broken because we will catch AbstractMethodError at runtime. GitOrigin-RevId: fdfed347a2904ee31745f7fdf8210b78bc332a97
This commit is contained in:
committed by
intellij-monorepo-bot
parent
c11e901fa6
commit
56189446b8
+1
@@ -62,6 +62,7 @@ public class JavaBackwardReferenceIndexBuilder extends ModuleLevelBuilder {
|
||||
JavaBackwardReferenceIndexWriter.closeIfNeeded(false);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<String> getCompilableFileExtensions() {
|
||||
return Collections.emptyList();
|
||||
|
||||
@@ -55,13 +55,15 @@ public class BuilderRegistry {
|
||||
myTargetBuilders.addAll(service.createBuilders());
|
||||
final List<? extends ModuleLevelBuilder> moduleLevelBuilders = service.createModuleLevelBuilders();
|
||||
for (ModuleLevelBuilder builder : moduleLevelBuilders) {
|
||||
List<String> extensions = builder.getCompilableFileExtensions();
|
||||
if (extensions == null) {
|
||||
LOG.info(builder.getClass().getName() + " builder returns 'null' from 'getCompilableFileExtensions' method so files for module-level builders won't be filtered");
|
||||
compilableFileExtensions = null;
|
||||
try {
|
||||
List<String> extensions = builder.getCompilableFileExtensions();
|
||||
if (compilableFileExtensions != null) {
|
||||
compilableFileExtensions.addAll(extensions);
|
||||
}
|
||||
}
|
||||
else if (compilableFileExtensions != null) {
|
||||
compilableFileExtensions.addAll(extensions);
|
||||
catch (AbstractMethodError e) {
|
||||
LOG.info(builder.getClass().getName() + " builder doesn't implement 'getCompilableFileExtensions' method so ModuleBuildTarget will process all files under source roots.");
|
||||
compilableFileExtensions = null;
|
||||
}
|
||||
myModuleLevelBuilders.get(builder.getCategory()).add(builder);
|
||||
}
|
||||
|
||||
@@ -103,13 +103,9 @@ public abstract class ModuleLevelBuilder extends Builder {
|
||||
}
|
||||
|
||||
/**
|
||||
* <strong>DO NOT RETURN {@code null}</strong> from implementation of this method. If some of builders returns {@code null} no filtering
|
||||
* will be performed for compatibility reasons.
|
||||
* @return list of extensions (without dot) of files which can be compiled by the builder
|
||||
* Returns list of extensions (without dot) of files which can be compiled by the builder.
|
||||
*/
|
||||
public List<String> getCompilableFileExtensions() {
|
||||
return null;
|
||||
}
|
||||
public abstract @NotNull List<String> getCompilableFileExtensions();
|
||||
|
||||
public final BuilderCategory getCategory() {
|
||||
return myCategory;
|
||||
|
||||
+1
@@ -55,6 +55,7 @@ public class DependencyResolvingBuilder extends ModuleLevelBuilder{
|
||||
super(BuilderCategory.INITIAL);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<String> getCompilableFileExtensions() {
|
||||
return Collections.emptyList();
|
||||
|
||||
+2
@@ -4,6 +4,7 @@ package org.jetbrains.jps.incremental.instrumentation;
|
||||
import com.intellij.compiler.instrumentation.InstrumentationClassFinder;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.ModuleChunk;
|
||||
import org.jetbrains.jps.ProjectPaths;
|
||||
@@ -84,6 +85,7 @@ public abstract class ClassProcessingBuilder extends ModuleLevelBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<String> getCompilableFileExtensions() {
|
||||
return Collections.emptyList();
|
||||
|
||||
@@ -205,6 +205,7 @@ public class JavaBuilder extends ModuleLevelBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<String> getCompilableFileExtensions() {
|
||||
return COMPILABLE_EXTENSIONS;
|
||||
|
||||
+1
@@ -71,6 +71,7 @@ public class AppEngineEnhancerBuilder extends ModuleLevelBuilder {
|
||||
return doneSomething ? ExitCode.OK : ExitCode.NOTHING_DONE;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<String> getCompilableFileExtensions() {
|
||||
return Collections.emptyList();
|
||||
|
||||
+1
@@ -92,6 +92,7 @@ public class GreclipseBuilder extends ModuleLevelBuilder {
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<String> getCompilableFileExtensions() {
|
||||
return Arrays.asList("groovy", "java");
|
||||
|
||||
@@ -168,6 +168,7 @@ public class GroovyBuilder extends ModuleLevelBuilder {
|
||||
return path.endsWith("." + GROOVY_EXTENSION);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<String> getCompilableFileExtensions() {
|
||||
return Collections.singletonList(GROOVY_EXTENSION);
|
||||
|
||||
+1
@@ -74,6 +74,7 @@ public class FormsBindingManager extends FormsBuilder {
|
||||
return new File(context.getProjectDescriptor().dataManager.getDataPaths().getDataStorageRoot(), "forms_rebuild_required");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<String> getCompilableFileExtensions() {
|
||||
return Collections.singletonList(FORM_EXTENSION);
|
||||
|
||||
+2
@@ -13,6 +13,7 @@ import com.intellij.uiDesigner.lw.CompiledClassPropertiesProvider;
|
||||
import com.intellij.uiDesigner.lw.LwRootContainer;
|
||||
import gnu.trove.THashMap;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.ModuleChunk;
|
||||
import org.jetbrains.jps.ProjectPaths;
|
||||
@@ -116,6 +117,7 @@ public class FormsInstrumenter extends FormsBuilder {
|
||||
return ExitCode.OK;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<String> getCompilableFileExtensions() {
|
||||
return Collections.emptyList();
|
||||
|
||||
Reference in New Issue
Block a user