// Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
// Licensed under the Apache License, Version 2.0 (see LICENSE).

package com.twitter.intellij.pants.jps.incremental.scala;

import com.twitter.intellij.pants.jps.incremental.model.JpsPantsProjectExtension;
import com.twitter.intellij.pants.jps.incremental.serialization.PantsJpsProjectExtensionSerializer;
import com.twitter.intellij.pants.jps.util.PantsJpsUtil;
import org.jetbrains.jps.ModuleChunk;
import org.jetbrains.jps.incremental.scala.ChunkExclusionService;
import org.jetbrains.jps.model.module.JpsModule;

import java.util.Set;

public class PantsScalaChunkExclusionService extends ChunkExclusionService {
  @Override
  public boolean isExcluded(ModuleChunk chunk) {
    final Set<JpsModule> modules = chunk.getModules();
    if (modules.isEmpty()) {
      return false;
    }

    final JpsPantsProjectExtension pantsProjectExtension =
      PantsJpsProjectExtensionSerializer.findPantsProjectExtension(modules.iterator().next().getProject());
    if (pantsProjectExtension == null) {
      return false;
    }
    return PantsJpsUtil.containsPantsModules(modules);
  }
}

@@ -190,247 +190,8 @@
 a;%0A%0A
-import com.twitter.intellij.pants.jps.incremental.model.JpsPantsProjectExtension;%0Aimport com.twitter.intellij.pants.jps.incremental.serialization.PantsJpsProjectExtensionSerializer;%0Aimport com.twitter.intellij.pants.jps.util.PantsJpsUtil;%0A
 impo
@@ -293,80 +293,8 @@
 ice;
-%0Aimport org.jetbrains.jps.model.module.JpsModule;%0A%0Aimport java.util.Set;
 %0A%0Apu
@@ -437,402 +437,98 @@
     
-final Set%3CJpsModule%3E modules = chunk.getModules();%0A    if (modules.isEmpty()) %7B%0A      return false;%0A    %7D%0A%0A    final JpsPantsProjectExtension pantsProjectExtension =%0A      PantsJpsProjectExtensionSerializer.findPantsProjectExtension(modules.iterator().next().getProject());%0A    if (pantsProjectExtension == null) %7B%0A      return false;%0A    %7D%0A    return PantsJpsUtil.containsPantsModules(modules)
+// All compilations are handled by Pants, thus excluded from scala plugin.%0A    return true
 ;%0A  

Exclude all from scala plugin compilation