mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
GWT: don't start (slow and non-incremental) GWT compilation for whole module if 'compile file' action is invoked (ZD-75490)
This commit is contained in:
@@ -28,8 +28,16 @@ import java.io.File;
|
||||
public abstract class CompileScope {
|
||||
public abstract boolean isAffected(BuildTarget<?> target, @NotNull File file);
|
||||
|
||||
/**
|
||||
* @return {@code true} if at least one file from {@code target} is included into the scope
|
||||
*/
|
||||
public abstract boolean isAffected(@NotNull BuildTarget<?> target);
|
||||
|
||||
/**
|
||||
* @return {@code true} if all files from {@code target} are included into the scope
|
||||
*/
|
||||
public abstract boolean isWholeTargetAffected(@NotNull BuildTarget<?> target);
|
||||
|
||||
public abstract boolean isBuildForced(@NotNull BuildTarget<?> target);
|
||||
|
||||
public abstract boolean isBuildForcedForAllTargets(@NotNull BuildTargetType<?> targetType);
|
||||
|
||||
@@ -62,13 +62,17 @@ public class CompileScopeImpl extends CompileScope {
|
||||
|
||||
@Override
|
||||
public boolean isAffected(@NotNull BuildTarget<?> target) {
|
||||
return myTypes.contains(target.getTargetType()) || myTargets.contains(target) || myFiles.containsKey(target) || isAffectedByAssociatedModule(target);
|
||||
return isWholeTargetAffected(target) || myFiles.containsKey(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWholeTargetAffected(@NotNull BuildTarget<?> target) {
|
||||
return myTypes.contains(target.getTargetType()) || myTargets.contains(target) || isAffectedByAssociatedModule(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBuildForced(@NotNull BuildTarget<?> target) {
|
||||
BuildTargetType<?> type = target.getTargetType();
|
||||
return myTypesToForceBuild.contains(type) && myFiles.isEmpty() && (myTypes.contains(type) || myTargets.contains(target) || isAffectedByAssociatedModule(target));
|
||||
return myTypesToForceBuild.contains(target.getTargetType()) && myFiles.isEmpty() && isWholeTargetAffected(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -35,6 +35,7 @@ public class CompileScopeTestBuilder {
|
||||
private final boolean myForceBuild;
|
||||
private final Set<BuildTargetType<?>> myTargetTypes = new HashSet<BuildTargetType<?>>();
|
||||
private final Set<BuildTarget<?>> myTargets = new HashSet<BuildTarget<?>>();
|
||||
private LinkedHashMap<BuildTarget<?>, Set<File>> myFiles = new LinkedHashMap<BuildTarget<?>, Set<File>>();
|
||||
|
||||
public static CompileScopeTestBuilder rebuild() {
|
||||
return new CompileScopeTestBuilder(true);
|
||||
@@ -78,9 +79,19 @@ public class CompileScopeTestBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
public CompileScopeTestBuilder file(BuildTarget<?> target, String path) {
|
||||
Set<File> files = myFiles.get(target);
|
||||
if (files == null) {
|
||||
files = new LinkedHashSet<File>();
|
||||
myFiles.put(target, files);
|
||||
}
|
||||
files.add(new File(path));
|
||||
return this;
|
||||
}
|
||||
|
||||
public CompileScope build() {
|
||||
Collection<BuildTargetType<?>> typesToForceBuild = myForceBuild ? myTargetTypes : Collections.<BuildTargetType<?>>emptyList();
|
||||
return new CompileScopeImpl(myTargetTypes, typesToForceBuild, myTargets, Collections.<BuildTarget<?>,Set<File>>emptyMap());
|
||||
return new CompileScopeImpl(myTargetTypes, typesToForceBuild, myTargets, myFiles);
|
||||
}
|
||||
|
||||
public CompileScopeTestBuilder all() {
|
||||
|
||||
Reference in New Issue
Block a user