mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
external make: test mode support; additional logging in test mode
This commit is contained in:
@@ -693,6 +693,9 @@ public class BuildManager implements ApplicationComponent{
|
||||
}
|
||||
|
||||
cmdLine.addParameter("-Djava.awt.headless=true");
|
||||
if (ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
cmdLine.addParameter("-Dtest.mode=true");
|
||||
}
|
||||
|
||||
final String shouldGenerateIndex = System.getProperty(GlobalOptions.GENERATE_CLASSPATH_INDEX_OPTION);
|
||||
if (shouldGenerateIndex != null) {
|
||||
|
||||
@@ -331,6 +331,11 @@ final class BuildSession implements Runnable, CanceledStatus {
|
||||
if (rd != null) {
|
||||
pd.fsState.registerDeleted(rd.module, file, rd.isTestRoot, timestamps);
|
||||
}
|
||||
else {
|
||||
if (Utils.IS_TEST_MODE) {
|
||||
LOG.info("Skipping deleted path: " + file.getPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String changed : event.getChangedPathsList()) {
|
||||
final File file = new File(changed);
|
||||
@@ -338,6 +343,11 @@ final class BuildSession implements Runnable, CanceledStatus {
|
||||
if (rd != null) {
|
||||
pd.fsState.markDirty(file, rd, timestamps);
|
||||
}
|
||||
else {
|
||||
if (Utils.IS_TEST_MODE) {
|
||||
LOG.info("Skipping dirty path: " + file.getPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.util.*;
|
||||
public class Utils {
|
||||
public static final Key<Map<String, Collection<String>>> REMOVED_SOURCES_KEY = Key.create("_removed_sources_");
|
||||
private static volatile File ourSystemRoot = new File(System.getProperty("user.home", ".idea-build"));
|
||||
public static final boolean IS_TEST_MODE = Boolean.parseBoolean(System.getProperty("test.mode", "false"));
|
||||
|
||||
private Utils() {
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.jetbrains.jps.incremental.fs;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.CompilerExcludes;
|
||||
@@ -8,6 +9,7 @@ import org.jetbrains.jps.ModuleChunk;
|
||||
import org.jetbrains.jps.incremental.CompileContext;
|
||||
import org.jetbrains.jps.incremental.CompileScope;
|
||||
import org.jetbrains.jps.incremental.FileProcessor;
|
||||
import org.jetbrains.jps.incremental.Utils;
|
||||
import org.jetbrains.jps.incremental.storage.Timestamps;
|
||||
|
||||
import java.io.File;
|
||||
@@ -21,6 +23,7 @@ import java.util.Set;
|
||||
* Date: 12/16/11
|
||||
*/
|
||||
public class BuildFSState extends FSState {
|
||||
private static final Logger LOG = Logger.getInstance("#org.jetbrains.jps.incremental.fs.BuildFSState");
|
||||
|
||||
private final Set<String> myContextModules = new HashSet<String>();
|
||||
private volatile FilesDelta myCurrentRoundDelta;
|
||||
@@ -143,6 +146,9 @@ public class BuildFSState extends FSState {
|
||||
// if the file was modified after the compilation had started,
|
||||
// do not save the stamp considering file dirty
|
||||
delta.markRecompile(rd.root, rd.isTestRoot, file);
|
||||
if (Utils.IS_TEST_MODE) {
|
||||
LOG.info("Timestamp after compilation started; marking dirty again: " + file.getPath());
|
||||
}
|
||||
}
|
||||
else {
|
||||
marked = true;
|
||||
@@ -150,6 +156,9 @@ public class BuildFSState extends FSState {
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (Utils.IS_TEST_MODE) {
|
||||
LOG.info("Not affected by compile scope; marking dirty again: " + file.getPath());
|
||||
}
|
||||
delta.markRecompile(rd.root, rd.isTestRoot, file);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package org.jetbrains.jps.incremental.fs;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.util.io.IOUtil;
|
||||
import gnu.trove.THashSet;
|
||||
import gnu.trove.TObjectHashingStrategy;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.incremental.Utils;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
@@ -14,6 +16,8 @@ import java.util.*;
|
||||
|
||||
/** @noinspection SynchronizationOnLocalVariableOrMethodParameter*/
|
||||
final class FilesDelta {
|
||||
private static final Logger LOG = Logger.getInstance("#org.jetbrains.jps.incremental.fs.FilesDelta");
|
||||
|
||||
private final Set<String> myDeletedProduction = Collections.synchronizedSet(new HashSet<String>());
|
||||
private final Set<String> myDeletedTests = Collections.synchronizedSet(new HashSet<String>());
|
||||
private final Map<File, Set<File>> mySourcesToRecompile = Collections.synchronizedMap(new HashMap<File, Set<File>>()); // srcRoot -> set of sources
|
||||
@@ -57,7 +61,11 @@ final class FilesDelta {
|
||||
}
|
||||
int filesCount = in.readInt();
|
||||
while (filesCount-- > 0) {
|
||||
files.add(new File(IOUtil.readString(in)));
|
||||
final File file = new File(IOUtil.readString(in));
|
||||
if (Utils.IS_TEST_MODE) {
|
||||
LOG.info("Loaded " + file.getPath());
|
||||
}
|
||||
files.add(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -115,6 +123,10 @@ final class FilesDelta {
|
||||
}
|
||||
|
||||
private boolean _addToRecompiled(File root, boolean isTestRoot, File file) {
|
||||
if (Utils.IS_TEST_MODE) {
|
||||
LOG.info("Marking dirty: " + file.getPath());
|
||||
}
|
||||
|
||||
final Map<File, Set<File>> toRecompile = isTestRoot ? myTestsToRecompile : mySourcesToRecompile;
|
||||
Set<File> files;
|
||||
synchronized (toRecompile) {
|
||||
@@ -123,8 +135,8 @@ final class FilesDelta {
|
||||
files = createSetOfFiles();
|
||||
toRecompile.put(root, files);
|
||||
}
|
||||
return files.add(file);
|
||||
}
|
||||
return files.add(file);
|
||||
}
|
||||
|
||||
public void addDeleted(File file, boolean isTest) {
|
||||
@@ -136,7 +148,11 @@ final class FilesDelta {
|
||||
}
|
||||
}
|
||||
final Set<String> deleted = isTest? myDeletedTests : myDeletedProduction;
|
||||
deleted.add(FileUtil.toCanonicalPath(file.getPath()));
|
||||
final String path = FileUtil.toCanonicalPath(file.getPath());
|
||||
deleted.add(path);
|
||||
if (Utils.IS_TEST_MODE) {
|
||||
LOG.info("Marking deleted: " + path);
|
||||
}
|
||||
}
|
||||
|
||||
public void clearDeletedPaths(boolean isTest) {
|
||||
|
||||
@@ -49,7 +49,9 @@ public class GroovyBuilder extends ModuleLevelBuilder {
|
||||
public ModuleLevelBuilder.ExitCode build(final CompileContext context, ModuleChunk chunk) throws ProjectBuildException {
|
||||
try {
|
||||
final List<File> toCompile = collectChangedFiles(context, chunk);
|
||||
LOG.info((myForStubs ? "stubs" : "groovyc") + ", toCompile=" + toCompile);
|
||||
if (Utils.IS_TEST_MODE) {
|
||||
LOG.info((myForStubs ? "stubs" : "groovyc") + ", toCompile=" + toCompile);
|
||||
}
|
||||
if (toCompile.isEmpty()) {
|
||||
return ExitCode.NOTHING_DONE;
|
||||
}
|
||||
@@ -108,14 +110,18 @@ public class GroovyBuilder extends ModuleLevelBuilder {
|
||||
}
|
||||
|
||||
for (CompilerMessage message : handler.getCompilerMessages()) {
|
||||
LOG.info(message.toString());
|
||||
if (Utils.IS_TEST_MODE) {
|
||||
LOG.info(message.toString());
|
||||
}
|
||||
context.processMessage(message);
|
||||
}
|
||||
|
||||
|
||||
List<GroovycOSProcessHandler.OutputItem> compiled = new ArrayList<GroovycOSProcessHandler.OutputItem>();
|
||||
for (GroovycOSProcessHandler.OutputItem item : handler.getSuccessfullyCompiled()) {
|
||||
LOG.info("Compiled " + item);
|
||||
if (Utils.IS_TEST_MODE) {
|
||||
LOG.info("Compiled " + item);
|
||||
}
|
||||
compiled.add(ensureCorrectOutput(context, chunk, item, generationOutputs, compilerOutput));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user