external build: additional logging

This commit is contained in:
Eugene Zhuravlev
2013-02-14 21:35:22 +01:00
parent 68b520b3d2
commit b84529a89c
3 changed files with 33 additions and 12 deletions
@@ -45,7 +45,13 @@ import java.util.UUID;
public class BuildMain {
public static final Key<String> FORCE_MODEL_LOADING_PARAMETER = Key.create("_force_model_loading");
private static final String LOG_FILE_NAME = "log.xml";
private static final Logger LOG = Logger.getInstance("#org.jetbrains.jps.cmdline.BuildMain");
private static final Logger LOG;
static {
initLoggers();
LOG = Logger.getInstance("#org.jetbrains.jps.cmdline.BuildMain");
}
private static NioClientSocketChannelFactory ourChannelFactory;
public static void main(String[] args){
@@ -56,8 +62,6 @@ public class BuildMain {
final File systemDir = new File(FileUtil.toCanonicalPath(args[3]));
Utils.setSystemRoot(systemDir);
initLoggers();
ourChannelFactory = new NioClientSocketChannelFactory(SharedThreadPool.getInstance(), SharedThreadPool.getInstance(), 1);
final ClientBootstrap bootstrap = new ClientBootstrap(ourChannelFactory);
bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
@@ -301,23 +301,25 @@ final class BuildSession implements Runnable, CanceledStatus {
pd.getFSCache().clear();
cacheCleared = true;
}
if (Utils.IS_TEST_MODE) {
LOG.info("Applying deleted path from fs event: " + file.getPath());
if (LOG.isDebugEnabled()) {
LOG.debug("Applying deleted path from fs event: " + file.getPath());
}
for (BuildRootDescriptor rootDescriptor : descriptor) {
pd.fsState.registerDeleted(rootDescriptor.getTarget(), file, timestamps);
}
}
else if (Utils.IS_TEST_MODE) {
LOG.info("Skipping deleted path: " + file.getPath());
else {
if (LOG.isDebugEnabled()) {
LOG.debug("Skipping deleted path: " + file.getPath());
}
}
}
for (String changed : event.getChangedPathsList()) {
final File file = new File(changed);
Collection<BuildRootDescriptor> descriptors = pd.getBuildRootIndex().findAllParentDescriptors(file, null, null);
if (!descriptors.isEmpty()) {
if (Utils.IS_TEST_MODE) {
LOG.info("Applying dirty path from fs event: " + file.getPath());
if (LOG.isDebugEnabled()) {
LOG.debug("Applying dirty path from fs event: " + changed);
}
long fileStamp = -1L;
for (BuildRootDescriptor descriptor : descriptors) {
@@ -325,7 +327,7 @@ final class BuildSession implements Runnable, CanceledStatus {
if (fileStamp == -1L) {
fileStamp = FileSystemUtil.lastModified(file); // lazy init
}
long stamp = timestamps.getStamp(file, descriptor.getTarget());
final long stamp = timestamps.getStamp(file, descriptor.getTarget());
if (stamp != fileStamp) {
if (!cacheCleared) {
pd.getFSCache().clear();
@@ -333,11 +335,18 @@ final class BuildSession implements Runnable, CanceledStatus {
}
pd.fsState.markDirty(null, file, descriptor, timestamps, saveEventStamp);
}
else {
if (LOG.isDebugEnabled()) {
LOG.debug(descriptor.getTarget() + ": Path considered up-to-date: " + changed + "; timestamp= " + stamp);
}
}
}
}
}
else if (Utils.IS_TEST_MODE) {
LOG.info("Skipping dirty path: " + file.getPath());
else {
if (LOG.isDebugEnabled()) {
LOG.debug("Skipping dirty path: " + file.getPath());
}
}
}
}
@@ -102,6 +102,9 @@ public class FSState {
public boolean markDirty(@Nullable CompileContext context, final File file, final BuildRootDescriptor rd, final @Nullable Timestamps tsStorage, boolean saveEventStamp) throws IOException {
final boolean marked = getDelta(rd.getTarget()).markRecompile(rd, file);
if (marked) {
if (LOG.isDebugEnabled()) {
LOG.debug(rd.getTarget() + ": MARKED DIRTY: " + file.getPath());
}
if (saveEventStamp) {
myRegistrationStamps.put(file, System.currentTimeMillis());
}
@@ -109,6 +112,11 @@ public class FSState {
tsStorage.removeStamp(file, rd.getTarget());
}
}
else {
if (LOG.isDebugEnabled()) {
LOG.debug(rd.getTarget() + ": NOT MARKED DIRTY: " + file.getPath());
}
}
return marked;
}