external build: allow custom target types not to ruin fast up-to-date check
authornik <Nikolay.Chashnikov@jetbrains.com>
Thu, 25 Jun 2015 10:57:59 +0000 (13:57 +0300)
committernik <Nikolay.Chashnikov@jetbrains.com>
Tue, 30 Jun 2015 12:01:58 +0000 (15:01 +0300)
jps/jps-builders/src/org/jetbrains/jps/builders/ModuleBasedBuildTargetType.java
jps/jps-builders/src/org/jetbrains/jps/builders/ModuleInducedTargetType.java [new file with mode: 0644]
jps/jps-builders/src/org/jetbrains/jps/cmdline/BuildSession.java

index c2903e6cab70e7409c0defb6529652753d51a3f1..1286cee281b71dfb445802f59cb6b3e3807c7d75 100644 (file)
@@ -1,6 +1,6 @@
 package org.jetbrains.jps.builders;
 
-public abstract class ModuleBasedBuildTargetType<T extends ModuleBasedTarget<?>> extends BuildTargetType<T>{
+public abstract class ModuleBasedBuildTargetType<T extends ModuleBasedTarget<?>> extends BuildTargetType<T> implements ModuleInducedTargetType {
   protected ModuleBasedBuildTargetType(String typeId) {
     super(typeId);
   }
diff --git a/jps/jps-builders/src/org/jetbrains/jps/builders/ModuleInducedTargetType.java b/jps/jps-builders/src/org/jetbrains/jps/builders/ModuleInducedTargetType.java
new file mode 100644 (file)
index 0000000..b423483
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2000-2015 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.jps.builders;
+
+/**
+ * Marker interface for {@link org.jetbrains.jps.builders.BuildTargetType}'s implementations. It instructs the external build process
+ * to skip building for targets of this type if all modules were compiled during previous build session and no source files were changed
+ * after that.
+ * @author nik
+ */
+public interface ModuleInducedTargetType {
+}
index 1aab89c35f113cbd39eec47eb2c1ed694acddeb4..c5a19f37d5aa3328382b30284687c35e1b718ced 100644 (file)
@@ -312,7 +312,7 @@ final class BuildSession implements Runnable, CanceledStatus {
         typeRegistry = TargetTypeRegistry.getInstance();
       }
       final BuildTargetType<?> targetType = typeRegistry.getTargetType(typeId);
-      if (targetType != null && !(targetType instanceof ModuleBasedBuildTargetType)) {
+      if (targetType != null && !(targetType instanceof ModuleInducedTargetType)) {
         return false;
       }
     }