added additional logging to external artifact builder

This commit is contained in:
nik
2013-01-29 16:59:03 +04:00
parent 89ad40b807
commit ecd44b969b
2 changed files with 17 additions and 1 deletions
@@ -15,6 +15,7 @@
*/
package org.jetbrains.jps.incremental.artifacts;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
@@ -47,6 +48,7 @@ import java.util.*;
* @author nik
*/
public class IncArtifactBuilder extends TargetBuilder<ArtifactRootDescriptor, ArtifactBuildTarget> {
private static final Logger LOG = Logger.getInstance(IncArtifactBuilder.class);
public static final String BUILDER_NAME = "Artifacts builder";
public IncArtifactBuilder() {
@@ -77,7 +79,10 @@ public class IncArtifactBuilder extends TargetBuilder<ArtifactRootDescriptor, Ar
try {
final Collection<String> deletedFiles = holder.getRemovedFiles(target);
context.processMessage(new ProgressMessage("Building artifact '" + artifact.getName() + "'..."));
String messageText = "Building artifact '" + artifact.getName() + "'...";
context.processMessage(new ProgressMessage(messageText));
LOG.debug(messageText);
runArtifactTasks(context, target.getArtifact(), ArtifactBuildTaskProvider.ArtifactBuildPhase.PRE_PROCESSING);
final SourceToOutputMapping srcOutMapping = pd.dataManager.getSourceToOutputMap(target);
final ArtifactOutputToSourceMapping outSrcMapping = pd.dataManager.getStorage(target, ArtifactOutToSourceStorageProvider.INSTANCE);
@@ -143,6 +148,9 @@ public class IncArtifactBuilder extends TargetBuilder<ArtifactRootDescriptor, Ar
for (String sourcePath : sourcePaths) {
if (!descriptor.getFilter().shouldBeCopied(sourcePath, pd)) {
if (LOG.isDebugEnabled()) {
LOG.debug("File " + sourcePath + " will be skipped because it isn't accepted by filter");
}
continue;
}
DestinationInfo destination = descriptor.getDestinationInfo();
@@ -217,6 +225,9 @@ public class IncArtifactBuilder extends TargetBuilder<ArtifactRootDescriptor, Ar
}
if (deleted) {
if (LOG.isDebugEnabled()) {
LOG.debug("Outdated output file deleted: " + filePath);
}
outSrcMapping.remove(filePath);
deletedPaths.add(filePath);
for (String sourcePath : filesToDelete.get(filePath)) {
@@ -15,6 +15,7 @@
*/
package org.jetbrains.jps.incremental.artifacts.instructions;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.io.FileUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.builders.BuildOutputConsumer;
@@ -34,6 +35,7 @@ import java.util.Collections;
* @author nik
*/
public class FileBasedArtifactRootDescriptor extends ArtifactRootDescriptor {
private static final Logger LOG = Logger.getInstance(FileBasedArtifactRootDescriptor.class);
public FileBasedArtifactRootDescriptor(@NotNull File file,
@NotNull SourceFileFilter filter,
int index,
@@ -79,6 +81,9 @@ public class FileBasedArtifactRootDescriptor extends ArtifactRootDescriptor {
FileUtil.copyContent(file, targetFile);
outputConsumer.registerOutputFile(targetFile, Collections.singletonList(filePath));
}
else if (LOG.isDebugEnabled()) {
LOG.debug("Target path " + targetPath + " is already registered so " + filePath + " won't be copied");
}
outSrcMapping.appendData(targetPath, Collections.singletonList(new ArtifactOutputToSourceMapping.SourcePathAndRootIndex(filePath, rootIndex)));
}
}