- Artifact roots are not marked as "generated sources".

- To properly mark artifact sources as up-to-date, compilation-start timestamp is advanced for every chunk/group of chunks before starting compilation
This commit is contained in:
Eugene Zhuravlev
2012-10-18 19:15:47 +02:00
parent 1b4658481e
commit fedf3fff7a
5 changed files with 21 additions and 6 deletions
@@ -35,6 +35,7 @@ import junit.framework.Assert;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.util.JpsPathUtil;
import javax.swing.*;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
@@ -209,10 +210,10 @@ public abstract class BaseCompilerTestCase extends ModuleTestCase {
private CompilationLog compile(final ParameterizedRunnable<CompileStatusNotification> action) {
final Ref<CompilationLog> result = Ref.create(null);
final Semaphore semaphore = new Semaphore();
semaphore.down();
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
@Override
public void run() {
semaphore.down();
CompilerManagerImpl.testSetup();
final CompileStatusNotification callback = new CompileStatusNotification() {
@@ -240,14 +241,18 @@ public abstract class BaseCompilerTestCase extends ModuleTestCase {
}
});
long start = System.currentTimeMillis();
final long start = System.currentTimeMillis();
while (!semaphore.waitFor(10)) {
if (System.currentTimeMillis() - start > 60 * 1000) {
throw new RuntimeException("timeout");
}
if (SwingUtilities.isEventDispatchThread()) {
UIUtil.dispatchAllInvocationEvents();
}
}
if (SwingUtilities.isEventDispatchThread()) {
UIUtil.dispatchAllInvocationEvents();
}
UIUtil.dispatchAllInvocationEvents();
return result.get();
}
@@ -49,6 +49,8 @@ public interface CompileContext extends UserDataHolder, MessageHandler {
long getCompilationStartStamp();
void updateCompilationStartStamp();
void markNonIncremental(ModuleBuildTarget target);
void clearNonIncrementalMark(ModuleBuildTarget target);
@@ -5,7 +5,8 @@ import com.intellij.openapi.util.UserDataHolderBase;
import com.intellij.util.EventDispatcher;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.*;
import org.jetbrains.jps.ModuleChunk;
import org.jetbrains.jps.ProjectPaths;
import org.jetbrains.jps.api.CanceledStatus;
import org.jetbrains.jps.builders.java.JavaModuleBuildTargetType;
import org.jetbrains.jps.builders.logging.BuildLoggingManager;
@@ -34,7 +35,7 @@ public class CompileContextImpl extends UserDataHolderBase implements CompileCon
private final Set<ModuleBuildTarget> myNonIncrementalModules = new HashSet<ModuleBuildTarget>();
private final ProjectPaths myProjectPaths;
private final long myCompilationStartStamp;
private volatile long myCompilationStartStamp;
private final ProjectDescriptor myProjectDescriptor;
private final Map<String, String> myBuilderParams;
private final CanceledStatus myCancelStatus;
@@ -64,6 +65,11 @@ public class CompileContextImpl extends UserDataHolderBase implements CompileCon
return myCompilationStartStamp;
}
@Override
public void updateCompilationStartStamp() {
myCompilationStartStamp = System.currentTimeMillis();
}
@Override
public ProjectPaths getProjectPaths() {
return myProjectPaths;
@@ -466,6 +466,7 @@ public class IncProjectBuilder {
}
}
finally {
context.updateCompilationStartStamp();
pd.dataManager.closeSourceToOutputStorages(groupChunks);
pd.dataManager.flush(true);
}
@@ -478,6 +479,7 @@ public class IncProjectBuilder {
buildChunkIfAffected(context, scope, chunk);
}
finally {
context.updateCompilationStartStamp();
pd.dataManager.closeSourceToOutputStorages(Collections.singleton(chunk));
pd.dataManager.flush(true);
}
@@ -94,6 +94,6 @@ public abstract class ArtifactRootDescriptor extends BuildRootDescriptor {
@Override
public boolean isGenerated() {
return true;//todo[nik] we cannot detect if this root is generated by some other compiler (e.g. javac) so threat all roots as generated for now
return false;//todo[nik] we cannot detect if this root is generated by some other compiler (e.g. javac) so treat all roots as non-generated for now
}
}