com.android.ide.common.blame
Class MergingLog

java.lang.Object
  extended by com.android.ide.common.blame.MergingLog

public class MergingLog
extends java.lang.Object

Stores where file and text fragments within files came from, so the original can be found later if a subsequent build step outputs an error. It is implicitly incremental, shards (which correspond to type directories for resource files, eg. layout-land) are created or loaded only when the output files that they store are changed, and only the changed files are written when write() is called. For its use by MergeWriter, it uses ConcurrentMaps internally, so it is safe to perform any log operation from any thread.


Constructor Summary
MergingLog(java.io.File outputFolder)
           
 
Method Summary
 com.android.ide.common.blame.SourceFile find(com.android.ide.common.blame.SourceFile mergedFile)
          Find the original source file corresponding to an intermediate file.
 com.android.ide.common.blame.SourceFilePosition find(com.android.ide.common.blame.SourceFilePosition mergedFilePosition)
          Find the original source file and position for a position in an intermediate merged file.
 void logCopy(java.io.File source, java.io.File destination)
          Store the source of a file in the merging log.
 void logCopy(com.android.ide.common.blame.SourceFile source, com.android.ide.common.blame.SourceFile destination)
          Store the source of a file in the merging log.
 void logRemove(com.android.ide.common.blame.SourceFile merged)
          Remove a merged file from the merging log.
 void logSource(com.android.ide.common.blame.SourceFile mergedFile, java.util.Map<com.android.ide.common.blame.SourcePosition,com.android.ide.common.blame.SourceFilePosition> map)
          Store the source file positions for a merged file.
 void write()
          Persist the current state of the merging log.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MergingLog

public MergingLog(@NonNull
                  java.io.File outputFolder)
Method Detail

logCopy

public void logCopy(@NonNull
                    com.android.ide.common.blame.SourceFile source,
                    @NonNull
                    com.android.ide.common.blame.SourceFile destination)
Store the source of a file in the merging log.

Parameters:
source - the original file.
destination - the destination.

logCopy

public void logCopy(@NonNull
                    java.io.File source,
                    @NonNull
                    java.io.File destination)
Store the source of a file in the merging log.

Parameters:
source - the original file.
destination - the destination.

logRemove

public void logRemove(@NonNull
                      com.android.ide.common.blame.SourceFile merged)
Remove a merged file from the merging log.


logSource

public void logSource(@NonNull
                      com.android.ide.common.blame.SourceFile mergedFile,
                      @NonNull
                      java.util.Map<com.android.ide.common.blame.SourcePosition,com.android.ide.common.blame.SourceFilePosition> map)
Store the source file positions for a merged file.

Parameters:
mergedFile - the destination file.
map - the map from positions in the destination file to the SourceFilePosition that they came from.

find

@NonNull
public com.android.ide.common.blame.SourceFile find(@NonNull
                                                            com.android.ide.common.blame.SourceFile mergedFile)
Find the original source file corresponding to an intermediate file.


find

@NonNull
public com.android.ide.common.blame.SourceFilePosition find(@NonNull
                                                                    com.android.ide.common.blame.SourceFilePosition mergedFilePosition)
Find the original source file and position for a position in an intermediate merged file.


write

public void write()
           throws java.io.IOException
Persist the current state of the merging log.

Throws:
java.io.IOException