external artifact builder: cleanup

This commit is contained in:
nik
2012-08-01 09:04:27 +04:00
parent 8b53f463fa
commit d3b1dfa49a
6 changed files with 10 additions and 66 deletions
@@ -354,7 +354,7 @@ final class BuildSession implements Runnable, CanceledStatus {
LOG.info("Applying deleted path from fs event to artifacts: " + file.getPath());
}
for (ArtifactRootDescriptor rootDescriptor : descriptor)
pd.fsState.registerDeleted(rootDescriptor.getArtifactName(), rootDescriptor.getRootId().getArtifactId(), deleted,
pd.fsState.registerDeleted(rootDescriptor.getArtifactName(), rootDescriptor.getArtifactId(), deleted,
artifactTimestamps);
}
}
@@ -1,54 +0,0 @@
package org.jetbrains.jps.incremental.artifacts;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
/**
* @author nik
*/
public class ArtifactRootId {
private final int myArtifactId;
private final int myRootIndex;
public ArtifactRootId(int artifactId, int rootIndex) {
myArtifactId = artifactId;
myRootIndex = rootIndex;
}
public ArtifactRootId(DataInput input) throws IOException {
myArtifactId = input.readInt();
myRootIndex = input.readInt();
}
public int getArtifactId() {
return myArtifactId;
}
public int getRootIndex() {
return myRootIndex;
}
public void save(DataOutput out) throws IOException {
out.writeInt(myArtifactId);
out.writeInt(myRootIndex);
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ArtifactRootId id = (ArtifactRootId)o;
return myArtifactId == id.myArtifactId && myRootIndex == id.myRootIndex;
}
@Override
public int hashCode() {
return 31 * myArtifactId + myRootIndex;
}
}
@@ -24,13 +24,11 @@ import java.util.*;
*/
public class ArtifactRootsIndex {
private MultiMap<File, ArtifactRootDescriptor> myRootToDescriptorMap;
private Map<ArtifactRootId, ArtifactRootDescriptor> myIdToDescriptorMap;
private Map<JpsArtifact, ArtifactInstructionsBuilder> myInstructions;
public ArtifactRootsIndex(JpsModel model, Project project, BuildDataManager manager, ModuleRootsIndex rootsIndex) {
myRootToDescriptorMap = new MultiMap<File, ArtifactRootDescriptor>();
myInstructions = new HashMap<JpsArtifact, ArtifactInstructionsBuilder>();
myIdToDescriptorMap = new HashMap<ArtifactRootId, ArtifactRootDescriptor>();
ArtifactsBuildData data = manager.getArtifactsBuildData();
for (JpsArtifact artifact : JpsArtifactService.getInstance().getArtifacts(model.getProject())) {
int artifactId = data.getArtifactId(artifact);
@@ -44,7 +42,6 @@ public class ArtifactRootsIndex {
for (Pair<ArtifactRootDescriptor, DestinationInfo> pair : builder.getInstructions()) {
ArtifactRootDescriptor descriptor = pair.getFirst();
myRootToDescriptorMap.putValue(descriptor.getRootFile(), descriptor);
myIdToDescriptorMap.put(descriptor.getRootId(), descriptor);
}
}
}
@@ -3,7 +3,6 @@ package org.jetbrains.jps.incremental.artifacts.instructions;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.incremental.CompileContext;
import org.jetbrains.jps.incremental.artifacts.ArtifactOutputToSourceMapping;
import org.jetbrains.jps.incremental.artifacts.ArtifactRootId;
import org.jetbrains.jps.incremental.artifacts.ArtifactSourceToOutputMapping;
import java.io.File;
@@ -15,22 +14,24 @@ import java.io.IOException;
public abstract class ArtifactRootDescriptor {
protected final File myRoot;
private final SourceFileFilter myFilter;
private final ArtifactRootId myRootId;
private final int myRootIndex;
private final int myArtifactId;
private final String myArtifactName;
protected ArtifactRootDescriptor(File root, @NotNull SourceFileFilter filter, int index, int artifactId, String artifactName) {
myRoot = root;
myFilter = filter;
myRootIndex = index;
myArtifactId = artifactId;
myArtifactName = artifactName;
myRootId = new ArtifactRootId(artifactId, index);
}
public final String getArtifactName() {
return myArtifactName;
}
public final ArtifactRootId getRootId() {
return myRootId;
public int getArtifactId() {
return myArtifactId;
}
@NotNull
@@ -48,6 +49,6 @@ public abstract class ArtifactRootDescriptor {
}
public int getRootIndex() {
return myRootId.getRootIndex();
return myRootIndex;
}
}
@@ -200,7 +200,7 @@ public class BuildFSState extends FSState {
}
else {
marked = true;
storage.update(descriptor.getRootId().getArtifactId(), path, stamp);
storage.update(descriptor.getArtifactId(), path, stamp);
}
}
}
@@ -117,7 +117,7 @@ public class FSState {
public void markDirty(ArtifactRootDescriptor descriptor, String filePath, ArtifactSourceTimestampStorage timestamps) throws IOException {
markRecompile(descriptor, filePath);
timestamps.removeTimestamp(filePath, descriptor.getRootId().getArtifactId());
timestamps.removeTimestamp(filePath, descriptor.getArtifactId());
}
public void markRecompile(ArtifactRootDescriptor descriptor, String filePath) {