mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
support FS events in communication protocol
This commit is contained in:
@@ -28,6 +28,7 @@ message Message {
|
||||
SHUTDOWN_COMMAND = 2;
|
||||
SETUP_COMMAND = 3;
|
||||
RELOAD_PROJECT_COMMAND = 4;
|
||||
FS_EVENT = 5;
|
||||
}
|
||||
|
||||
message CompilationRequest {
|
||||
@@ -72,11 +73,18 @@ message Message {
|
||||
repeated string project_id = 1;
|
||||
}
|
||||
|
||||
message FSEvent {
|
||||
required string project_id = 1;
|
||||
repeated string changed_paths = 2;
|
||||
repeated string deleted_paths = 3;
|
||||
}
|
||||
|
||||
required Type request_type = 1;
|
||||
optional CompilationRequest compile_request = 2;
|
||||
optional ShutdownCommand shutdown_command = 3;
|
||||
optional SetupCommand setup_command = 4;
|
||||
optional ReloadProjectCommand reload_project_command = 5;
|
||||
optional FSEvent fs_event = 6;
|
||||
}
|
||||
|
||||
message Response {
|
||||
|
||||
@@ -718,6 +718,7 @@ public final class JpsRemoteProto {
|
||||
SHUTDOWN_COMMAND(1, 2),
|
||||
SETUP_COMMAND(2, 3),
|
||||
RELOAD_PROJECT_COMMAND(3, 4),
|
||||
FS_EVENT(4, 5),
|
||||
;
|
||||
|
||||
|
||||
@@ -729,6 +730,7 @@ public final class JpsRemoteProto {
|
||||
case 2: return SHUTDOWN_COMMAND;
|
||||
case 3: return SETUP_COMMAND;
|
||||
case 4: return RELOAD_PROJECT_COMMAND;
|
||||
case 5: return FS_EVENT;
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
@@ -2838,6 +2840,418 @@ public final class JpsRemoteProto {
|
||||
// @@protoc_insertion_point(class_scope:org.jetbrains.jpsservice.Message.Request.ReloadProjectCommand)
|
||||
}
|
||||
|
||||
public static final class FSEvent extends
|
||||
com.google.protobuf.GeneratedMessageLite {
|
||||
// Use FSEvent.newBuilder() to construct.
|
||||
private FSEvent() {
|
||||
initFields();
|
||||
}
|
||||
private FSEvent(boolean noInit) {}
|
||||
|
||||
private static final FSEvent defaultInstance;
|
||||
public static FSEvent getDefaultInstance() {
|
||||
return defaultInstance;
|
||||
}
|
||||
|
||||
public FSEvent getDefaultInstanceForType() {
|
||||
return defaultInstance;
|
||||
}
|
||||
|
||||
// required string project_id = 1;
|
||||
public static final int PROJECT_ID_FIELD_NUMBER = 1;
|
||||
private boolean hasProjectId;
|
||||
private java.lang.String projectId_ = "";
|
||||
public boolean hasProjectId() { return hasProjectId; }
|
||||
public java.lang.String getProjectId() { return projectId_; }
|
||||
|
||||
// repeated string changed_paths = 2;
|
||||
public static final int CHANGED_PATHS_FIELD_NUMBER = 2;
|
||||
private java.util.List<java.lang.String> changedPaths_ =
|
||||
java.util.Collections.emptyList();
|
||||
public java.util.List<java.lang.String> getChangedPathsList() {
|
||||
return changedPaths_;
|
||||
}
|
||||
public int getChangedPathsCount() { return changedPaths_.size(); }
|
||||
public java.lang.String getChangedPaths(int index) {
|
||||
return changedPaths_.get(index);
|
||||
}
|
||||
|
||||
// repeated string deleted_paths = 3;
|
||||
public static final int DELETED_PATHS_FIELD_NUMBER = 3;
|
||||
private java.util.List<java.lang.String> deletedPaths_ =
|
||||
java.util.Collections.emptyList();
|
||||
public java.util.List<java.lang.String> getDeletedPathsList() {
|
||||
return deletedPaths_;
|
||||
}
|
||||
public int getDeletedPathsCount() { return deletedPaths_.size(); }
|
||||
public java.lang.String getDeletedPaths(int index) {
|
||||
return deletedPaths_.get(index);
|
||||
}
|
||||
|
||||
private void initFields() {
|
||||
}
|
||||
public final boolean isInitialized() {
|
||||
if (!hasProjectId) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void writeTo(com.google.protobuf.CodedOutputStream output)
|
||||
throws java.io.IOException {
|
||||
getSerializedSize();
|
||||
if (hasProjectId()) {
|
||||
output.writeString(1, getProjectId());
|
||||
}
|
||||
for (java.lang.String element : getChangedPathsList()) {
|
||||
output.writeString(2, element);
|
||||
}
|
||||
for (java.lang.String element : getDeletedPathsList()) {
|
||||
output.writeString(3, element);
|
||||
}
|
||||
}
|
||||
|
||||
private int memoizedSerializedSize = -1;
|
||||
public int getSerializedSize() {
|
||||
int size = memoizedSerializedSize;
|
||||
if (size != -1) return size;
|
||||
|
||||
size = 0;
|
||||
if (hasProjectId()) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeStringSize(1, getProjectId());
|
||||
}
|
||||
{
|
||||
int dataSize = 0;
|
||||
for (java.lang.String element : getChangedPathsList()) {
|
||||
dataSize += com.google.protobuf.CodedOutputStream
|
||||
.computeStringSizeNoTag(element);
|
||||
}
|
||||
size += dataSize;
|
||||
size += 1 * getChangedPathsList().size();
|
||||
}
|
||||
{
|
||||
int dataSize = 0;
|
||||
for (java.lang.String element : getDeletedPathsList()) {
|
||||
dataSize += com.google.protobuf.CodedOutputStream
|
||||
.computeStringSizeNoTag(element);
|
||||
}
|
||||
size += dataSize;
|
||||
size += 1 * getDeletedPathsList().size();
|
||||
}
|
||||
memoizedSerializedSize = size;
|
||||
return size;
|
||||
}
|
||||
|
||||
public static org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent parseFrom(
|
||||
com.google.protobuf.ByteString data)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return newBuilder().mergeFrom(data).buildParsed();
|
||||
}
|
||||
public static org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent parseFrom(
|
||||
com.google.protobuf.ByteString data,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return newBuilder().mergeFrom(data, extensionRegistry)
|
||||
.buildParsed();
|
||||
}
|
||||
public static org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent parseFrom(byte[] data)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return newBuilder().mergeFrom(data).buildParsed();
|
||||
}
|
||||
public static org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent parseFrom(
|
||||
byte[] data,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return newBuilder().mergeFrom(data, extensionRegistry)
|
||||
.buildParsed();
|
||||
}
|
||||
public static org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent parseFrom(java.io.InputStream input)
|
||||
throws java.io.IOException {
|
||||
return newBuilder().mergeFrom(input).buildParsed();
|
||||
}
|
||||
public static org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent parseFrom(
|
||||
java.io.InputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
return newBuilder().mergeFrom(input, extensionRegistry)
|
||||
.buildParsed();
|
||||
}
|
||||
public static org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent parseDelimitedFrom(java.io.InputStream input)
|
||||
throws java.io.IOException {
|
||||
Builder builder = newBuilder();
|
||||
if (builder.mergeDelimitedFrom(input)) {
|
||||
return builder.buildParsed();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public static org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent parseDelimitedFrom(
|
||||
java.io.InputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
Builder builder = newBuilder();
|
||||
if (builder.mergeDelimitedFrom(input, extensionRegistry)) {
|
||||
return builder.buildParsed();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public static org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent parseFrom(
|
||||
com.google.protobuf.CodedInputStream input)
|
||||
throws java.io.IOException {
|
||||
return newBuilder().mergeFrom(input).buildParsed();
|
||||
}
|
||||
public static org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent parseFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
return newBuilder().mergeFrom(input, extensionRegistry)
|
||||
.buildParsed();
|
||||
}
|
||||
|
||||
public static Builder newBuilder() { return Builder.create(); }
|
||||
public Builder newBuilderForType() { return newBuilder(); }
|
||||
public static Builder newBuilder(org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent prototype) {
|
||||
return newBuilder().mergeFrom(prototype);
|
||||
}
|
||||
public Builder toBuilder() { return newBuilder(this); }
|
||||
|
||||
public static final class Builder extends
|
||||
com.google.protobuf.GeneratedMessageLite.Builder<
|
||||
org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent, Builder> {
|
||||
private org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent result;
|
||||
|
||||
// Construct using org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent.newBuilder()
|
||||
private Builder() {}
|
||||
|
||||
private static Builder create() {
|
||||
Builder builder = new Builder();
|
||||
builder.result = new org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent();
|
||||
return builder;
|
||||
}
|
||||
|
||||
protected org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent internalGetResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public Builder clear() {
|
||||
if (result == null) {
|
||||
throw new IllegalStateException(
|
||||
"Cannot call clear() after build().");
|
||||
}
|
||||
result = new org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent();
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder clone() {
|
||||
return create().mergeFrom(result);
|
||||
}
|
||||
|
||||
public org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent getDefaultInstanceForType() {
|
||||
return org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent.getDefaultInstance();
|
||||
}
|
||||
|
||||
public boolean isInitialized() {
|
||||
return result.isInitialized();
|
||||
}
|
||||
public org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent build() {
|
||||
if (result != null && !isInitialized()) {
|
||||
throw newUninitializedMessageException(result);
|
||||
}
|
||||
return buildPartial();
|
||||
}
|
||||
|
||||
private org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent buildParsed()
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
if (!isInitialized()) {
|
||||
throw newUninitializedMessageException(
|
||||
result).asInvalidProtocolBufferException();
|
||||
}
|
||||
return buildPartial();
|
||||
}
|
||||
|
||||
public org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent buildPartial() {
|
||||
if (result == null) {
|
||||
throw new IllegalStateException(
|
||||
"build() has already been called on this Builder.");
|
||||
}
|
||||
if (result.changedPaths_ != java.util.Collections.EMPTY_LIST) {
|
||||
result.changedPaths_ =
|
||||
java.util.Collections.unmodifiableList(result.changedPaths_);
|
||||
}
|
||||
if (result.deletedPaths_ != java.util.Collections.EMPTY_LIST) {
|
||||
result.deletedPaths_ =
|
||||
java.util.Collections.unmodifiableList(result.deletedPaths_);
|
||||
}
|
||||
org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent returnMe = result;
|
||||
result = null;
|
||||
return returnMe;
|
||||
}
|
||||
|
||||
public Builder mergeFrom(org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent other) {
|
||||
if (other == org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent.getDefaultInstance()) return this;
|
||||
if (other.hasProjectId()) {
|
||||
setProjectId(other.getProjectId());
|
||||
}
|
||||
if (!other.changedPaths_.isEmpty()) {
|
||||
if (result.changedPaths_.isEmpty()) {
|
||||
result.changedPaths_ = new java.util.ArrayList<java.lang.String>();
|
||||
}
|
||||
result.changedPaths_.addAll(other.changedPaths_);
|
||||
}
|
||||
if (!other.deletedPaths_.isEmpty()) {
|
||||
if (result.deletedPaths_.isEmpty()) {
|
||||
result.deletedPaths_ = new java.util.ArrayList<java.lang.String>();
|
||||
}
|
||||
result.deletedPaths_.addAll(other.deletedPaths_);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder mergeFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
while (true) {
|
||||
int tag = input.readTag();
|
||||
switch (tag) {
|
||||
case 0:
|
||||
return this;
|
||||
default: {
|
||||
if (!parseUnknownField(input, extensionRegistry, tag)) {
|
||||
return this;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 10: {
|
||||
setProjectId(input.readString());
|
||||
break;
|
||||
}
|
||||
case 18: {
|
||||
addChangedPaths(input.readString());
|
||||
break;
|
||||
}
|
||||
case 26: {
|
||||
addDeletedPaths(input.readString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// required string project_id = 1;
|
||||
public boolean hasProjectId() {
|
||||
return result.hasProjectId();
|
||||
}
|
||||
public java.lang.String getProjectId() {
|
||||
return result.getProjectId();
|
||||
}
|
||||
public Builder setProjectId(java.lang.String value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
result.hasProjectId = true;
|
||||
result.projectId_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder clearProjectId() {
|
||||
result.hasProjectId = false;
|
||||
result.projectId_ = getDefaultInstance().getProjectId();
|
||||
return this;
|
||||
}
|
||||
|
||||
// repeated string changed_paths = 2;
|
||||
public java.util.List<java.lang.String> getChangedPathsList() {
|
||||
return java.util.Collections.unmodifiableList(result.changedPaths_);
|
||||
}
|
||||
public int getChangedPathsCount() {
|
||||
return result.getChangedPathsCount();
|
||||
}
|
||||
public java.lang.String getChangedPaths(int index) {
|
||||
return result.getChangedPaths(index);
|
||||
}
|
||||
public Builder setChangedPaths(int index, java.lang.String value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
result.changedPaths_.set(index, value);
|
||||
return this;
|
||||
}
|
||||
public Builder addChangedPaths(java.lang.String value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
if (result.changedPaths_.isEmpty()) {
|
||||
result.changedPaths_ = new java.util.ArrayList<java.lang.String>();
|
||||
}
|
||||
result.changedPaths_.add(value);
|
||||
return this;
|
||||
}
|
||||
public Builder addAllChangedPaths(
|
||||
java.lang.Iterable<? extends java.lang.String> values) {
|
||||
if (result.changedPaths_.isEmpty()) {
|
||||
result.changedPaths_ = new java.util.ArrayList<java.lang.String>();
|
||||
}
|
||||
super.addAll(values, result.changedPaths_);
|
||||
return this;
|
||||
}
|
||||
public Builder clearChangedPaths() {
|
||||
result.changedPaths_ = java.util.Collections.emptyList();
|
||||
return this;
|
||||
}
|
||||
|
||||
// repeated string deleted_paths = 3;
|
||||
public java.util.List<java.lang.String> getDeletedPathsList() {
|
||||
return java.util.Collections.unmodifiableList(result.deletedPaths_);
|
||||
}
|
||||
public int getDeletedPathsCount() {
|
||||
return result.getDeletedPathsCount();
|
||||
}
|
||||
public java.lang.String getDeletedPaths(int index) {
|
||||
return result.getDeletedPaths(index);
|
||||
}
|
||||
public Builder setDeletedPaths(int index, java.lang.String value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
result.deletedPaths_.set(index, value);
|
||||
return this;
|
||||
}
|
||||
public Builder addDeletedPaths(java.lang.String value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
if (result.deletedPaths_.isEmpty()) {
|
||||
result.deletedPaths_ = new java.util.ArrayList<java.lang.String>();
|
||||
}
|
||||
result.deletedPaths_.add(value);
|
||||
return this;
|
||||
}
|
||||
public Builder addAllDeletedPaths(
|
||||
java.lang.Iterable<? extends java.lang.String> values) {
|
||||
if (result.deletedPaths_.isEmpty()) {
|
||||
result.deletedPaths_ = new java.util.ArrayList<java.lang.String>();
|
||||
}
|
||||
super.addAll(values, result.deletedPaths_);
|
||||
return this;
|
||||
}
|
||||
public Builder clearDeletedPaths() {
|
||||
result.deletedPaths_ = java.util.Collections.emptyList();
|
||||
return this;
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(builder_scope:org.jetbrains.jpsservice.Message.Request.FSEvent)
|
||||
}
|
||||
|
||||
static {
|
||||
defaultInstance = new FSEvent(true);
|
||||
org.jetbrains.jps.api.JpsRemoteProto.internalForceInit();
|
||||
defaultInstance.initFields();
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(class_scope:org.jetbrains.jpsservice.Message.Request.FSEvent)
|
||||
}
|
||||
|
||||
// required .org.jetbrains.jpsservice.Message.Request.Type request_type = 1;
|
||||
public static final int REQUEST_TYPE_FIELD_NUMBER = 1;
|
||||
private boolean hasRequestType;
|
||||
@@ -2873,12 +3287,20 @@ public final class JpsRemoteProto {
|
||||
public boolean hasReloadProjectCommand() { return hasReloadProjectCommand; }
|
||||
public org.jetbrains.jps.api.JpsRemoteProto.Message.Request.ReloadProjectCommand getReloadProjectCommand() { return reloadProjectCommand_; }
|
||||
|
||||
// optional .org.jetbrains.jpsservice.Message.Request.FSEvent fs_event = 6;
|
||||
public static final int FS_EVENT_FIELD_NUMBER = 6;
|
||||
private boolean hasFsEvent;
|
||||
private org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent fsEvent_;
|
||||
public boolean hasFsEvent() { return hasFsEvent; }
|
||||
public org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent getFsEvent() { return fsEvent_; }
|
||||
|
||||
private void initFields() {
|
||||
requestType_ = org.jetbrains.jps.api.JpsRemoteProto.Message.Request.Type.COMPILE_REQUEST;
|
||||
compileRequest_ = org.jetbrains.jps.api.JpsRemoteProto.Message.Request.CompilationRequest.getDefaultInstance();
|
||||
shutdownCommand_ = org.jetbrains.jps.api.JpsRemoteProto.Message.Request.ShutdownCommand.getDefaultInstance();
|
||||
setupCommand_ = org.jetbrains.jps.api.JpsRemoteProto.Message.Request.SetupCommand.getDefaultInstance();
|
||||
reloadProjectCommand_ = org.jetbrains.jps.api.JpsRemoteProto.Message.Request.ReloadProjectCommand.getDefaultInstance();
|
||||
fsEvent_ = org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent.getDefaultInstance();
|
||||
}
|
||||
public final boolean isInitialized() {
|
||||
if (!hasRequestType) return false;
|
||||
@@ -2891,6 +3313,9 @@ public final class JpsRemoteProto {
|
||||
if (hasSetupCommand()) {
|
||||
if (!getSetupCommand().isInitialized()) return false;
|
||||
}
|
||||
if (hasFsEvent()) {
|
||||
if (!getFsEvent().isInitialized()) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2912,6 +3337,9 @@ public final class JpsRemoteProto {
|
||||
if (hasReloadProjectCommand()) {
|
||||
output.writeMessage(5, getReloadProjectCommand());
|
||||
}
|
||||
if (hasFsEvent()) {
|
||||
output.writeMessage(6, getFsEvent());
|
||||
}
|
||||
}
|
||||
|
||||
private int memoizedSerializedSize = -1;
|
||||
@@ -2940,6 +3368,10 @@ public final class JpsRemoteProto {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeMessageSize(5, getReloadProjectCommand());
|
||||
}
|
||||
if (hasFsEvent()) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeMessageSize(6, getFsEvent());
|
||||
}
|
||||
memoizedSerializedSize = size;
|
||||
return size;
|
||||
}
|
||||
@@ -3099,6 +3531,9 @@ public final class JpsRemoteProto {
|
||||
if (other.hasReloadProjectCommand()) {
|
||||
mergeReloadProjectCommand(other.getReloadProjectCommand());
|
||||
}
|
||||
if (other.hasFsEvent()) {
|
||||
mergeFsEvent(other.getFsEvent());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -3161,6 +3596,15 @@ public final class JpsRemoteProto {
|
||||
setReloadProjectCommand(subBuilder.buildPartial());
|
||||
break;
|
||||
}
|
||||
case 50: {
|
||||
org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent.Builder subBuilder = org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent.newBuilder();
|
||||
if (hasFsEvent()) {
|
||||
subBuilder.mergeFrom(getFsEvent());
|
||||
}
|
||||
input.readMessage(subBuilder, extensionRegistry);
|
||||
setFsEvent(subBuilder.buildPartial());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3335,6 +3779,43 @@ public final class JpsRemoteProto {
|
||||
return this;
|
||||
}
|
||||
|
||||
// optional .org.jetbrains.jpsservice.Message.Request.FSEvent fs_event = 6;
|
||||
public boolean hasFsEvent() {
|
||||
return result.hasFsEvent();
|
||||
}
|
||||
public org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent getFsEvent() {
|
||||
return result.getFsEvent();
|
||||
}
|
||||
public Builder setFsEvent(org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
result.hasFsEvent = true;
|
||||
result.fsEvent_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder setFsEvent(org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent.Builder builderForValue) {
|
||||
result.hasFsEvent = true;
|
||||
result.fsEvent_ = builderForValue.build();
|
||||
return this;
|
||||
}
|
||||
public Builder mergeFsEvent(org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent value) {
|
||||
if (result.hasFsEvent() &&
|
||||
result.fsEvent_ != org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent.getDefaultInstance()) {
|
||||
result.fsEvent_ =
|
||||
org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent.newBuilder(result.fsEvent_).mergeFrom(value).buildPartial();
|
||||
} else {
|
||||
result.fsEvent_ = value;
|
||||
}
|
||||
result.hasFsEvent = true;
|
||||
return this;
|
||||
}
|
||||
public Builder clearFsEvent() {
|
||||
result.hasFsEvent = false;
|
||||
result.fsEvent_ = org.jetbrains.jps.api.JpsRemoteProto.Message.Request.FSEvent.getDefaultInstance();
|
||||
return this;
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(builder_scope:org.jetbrains.jpsservice.Message.Request)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.jetbrains.jps.incremental;
|
||||
|
||||
import com.intellij.openapi.util.UserDataHolderBase;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.ether.dependencyView.Mappings;
|
||||
@@ -28,9 +27,7 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
|
||||
private final MessageHandler myDelegateMessageHandler;
|
||||
private volatile boolean myCompilingTests = false;
|
||||
private final BuildDataManager myDataManager;
|
||||
|
||||
private final Map<File, RootDescriptor> myRootToModuleMap = new HashMap<File, RootDescriptor>();
|
||||
private final Map<Module, List<RootDescriptor>> myModuleToRootsMap = new HashMap<Module, List<RootDescriptor>>();
|
||||
private final ModuleRootsIndex myRootsIndex;
|
||||
|
||||
private final ProjectPaths myProjectPaths;
|
||||
private volatile boolean myErrorsFound = false;
|
||||
@@ -42,7 +39,7 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
|
||||
boolean isProjectRebuild,
|
||||
ProjectChunks productionChunks,
|
||||
ProjectChunks testChunks,
|
||||
FSState fsState, TimestampStorage tsStorage, MessageHandler delegateMessageHandler) throws ProjectBuildException {
|
||||
FSState fsState, TimestampStorage tsStorage, MessageHandler delegateMessageHandler, final ModuleRootsIndex rootsIndex) throws ProjectBuildException {
|
||||
myTsStorage = tsStorage;
|
||||
myCompilationStartStamp = System.currentTimeMillis();
|
||||
myScope = scope;
|
||||
@@ -55,25 +52,7 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
|
||||
myDataManager = new BuildDataManager(projectName);
|
||||
final Project project = scope.getProject();
|
||||
myProjectPaths = new ProjectPaths(project);
|
||||
for (Module module : project.getModules().values()) {
|
||||
List<RootDescriptor> moduleRoots = myModuleToRootsMap.get(module);
|
||||
if (moduleRoots == null) {
|
||||
moduleRoots = new ArrayList<RootDescriptor>();
|
||||
myModuleToRootsMap.put(module, moduleRoots);
|
||||
}
|
||||
for (String r : module.getSourceRoots()) {
|
||||
final File root = new File(FileUtil.toCanonicalPath(r));
|
||||
final RootDescriptor descriptor = new RootDescriptor(module, root, false);
|
||||
myRootToModuleMap.put(root, descriptor);
|
||||
moduleRoots.add(descriptor);
|
||||
}
|
||||
for (String r : module.getTestRoots()) {
|
||||
final File root = new File(FileUtil.toCanonicalPath(r));
|
||||
final RootDescriptor descriptor = new RootDescriptor(module, root, true);
|
||||
myRootToModuleMap.put(root, descriptor);
|
||||
moduleRoots.add(descriptor);
|
||||
}
|
||||
}
|
||||
myRootsIndex = rootsIndex;
|
||||
}
|
||||
|
||||
public Project getProject() {
|
||||
@@ -153,7 +132,7 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
|
||||
if (!myErrorsFound) {
|
||||
final boolean compilingTests = isCompilingTests();
|
||||
for (Module module : chunk.getModules()) {
|
||||
final List<RootDescriptor> roots = myModuleToRootsMap.get(module);
|
||||
final List<RootDescriptor> roots = myRootsIndex.getModuleRoots(module);
|
||||
for (RootDescriptor descriptor : roots) {
|
||||
if (compilingTests? descriptor.isTestRoot : !descriptor.isTestRoot) {
|
||||
myFsState.markAllUpToDate(descriptor, myTsStorage, myCompilationStartStamp);
|
||||
@@ -226,21 +205,12 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
|
||||
|
||||
@Nullable
|
||||
public RootDescriptor getModuleAndRoot(File file) {
|
||||
File current = file;
|
||||
while (current != null) {
|
||||
final RootDescriptor descriptor = myRootToModuleMap.get(current);
|
||||
if (descriptor != null) {
|
||||
return descriptor;
|
||||
}
|
||||
current = FileUtil.getParentFile(current);
|
||||
}
|
||||
return null;
|
||||
return myRootsIndex.getModuleAndRoot(file);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<RootDescriptor> getModuleRoots(Module module) {
|
||||
final List<RootDescriptor> rootDescriptors = myModuleToRootsMap.get(module);
|
||||
return rootDescriptors != null? Collections.unmodifiableList(rootDescriptors) : Collections.<RootDescriptor>emptyList();
|
||||
return myRootsIndex.getModuleRoots(module);
|
||||
}
|
||||
|
||||
private static enum DirtyMarkScope{
|
||||
|
||||
@@ -121,8 +121,9 @@ public class IncProjectBuilder {
|
||||
final String projectName = myProjectDescriptor.projectName;
|
||||
final TimestampStorage tsStorage = myProjectDescriptor.timestamps.getStorage();
|
||||
final FSState fsState = myProjectDescriptor.fsState;
|
||||
final ModuleRootsIndex rootsIndex = myProjectDescriptor.rootsIndex;
|
||||
return new CompileContext(
|
||||
projectName, scope, isMake, isProjectRebuild, myProductionChunks, myTestChunks, fsState, tsStorage, myMessageDispatcher
|
||||
projectName, scope, isMake, isProjectRebuild, myProductionChunks, myTestChunks, fsState, tsStorage, myMessageDispatcher, rootsIndex
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package org.jetbrains.jps.incremental;
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.Module;
|
||||
import org.jetbrains.jps.Project;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
* Date: 1/11/12
|
||||
*/
|
||||
public class ModuleRootsIndex {
|
||||
private final Map<File, RootDescriptor> myRootToModuleMap = new HashMap<File, RootDescriptor>();
|
||||
private final Map<Module, List<RootDescriptor>> myModuleToRootsMap = new HashMap<Module, List<RootDescriptor>>();
|
||||
|
||||
public ModuleRootsIndex(Project project) {
|
||||
for (Module module : project.getModules().values()) {
|
||||
List<RootDescriptor> moduleRoots = myModuleToRootsMap.get(module);
|
||||
if (moduleRoots == null) {
|
||||
moduleRoots = new ArrayList<RootDescriptor>();
|
||||
myModuleToRootsMap.put(module, moduleRoots);
|
||||
}
|
||||
for (String r : module.getSourceRoots()) {
|
||||
final File root = new File(FileUtil.toCanonicalPath(r));
|
||||
final RootDescriptor descriptor = new RootDescriptor(module, root, false);
|
||||
myRootToModuleMap.put(root, descriptor);
|
||||
moduleRoots.add(descriptor);
|
||||
}
|
||||
for (String r : module.getTestRoots()) {
|
||||
final File root = new File(FileUtil.toCanonicalPath(r));
|
||||
final RootDescriptor descriptor = new RootDescriptor(module, root, true);
|
||||
myRootToModuleMap.put(root, descriptor);
|
||||
moduleRoots.add(descriptor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<RootDescriptor> getModuleRoots(Module module) {
|
||||
final List<RootDescriptor> descriptors = myModuleToRootsMap.get(module);
|
||||
return descriptors != null? Collections.unmodifiableList(descriptors) : Collections.<RootDescriptor>emptyList();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public RootDescriptor getRootDescriptor(File root) {
|
||||
return myRootToModuleMap.get(root);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public RootDescriptor getModuleAndRoot(File file) {
|
||||
File current = file;
|
||||
while (current != null) {
|
||||
final RootDescriptor descriptor = getRootDescriptor(current);
|
||||
if (descriptor != null) {
|
||||
return descriptor;
|
||||
}
|
||||
current = FileUtil.getParentFile(current);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package org.jetbrains.jps.server;
|
||||
|
||||
import org.jetbrains.jps.Project;
|
||||
import org.jetbrains.jps.incremental.FSState;
|
||||
import org.jetbrains.jps.incremental.ModuleRootsIndex;
|
||||
import org.jetbrains.jps.incremental.storage.ProjectTimestamps;
|
||||
|
||||
/**
|
||||
@@ -13,12 +14,14 @@ public class ProjectDescriptor {
|
||||
public final Project project;
|
||||
public final FSState fsState;
|
||||
public final ProjectTimestamps timestamps;
|
||||
public ModuleRootsIndex rootsIndex;
|
||||
|
||||
ProjectDescriptor(String projectName, Project project, FSState fsState, ProjectTimestamps timestamps) {
|
||||
this.projectName = projectName;
|
||||
this.project = project;
|
||||
this.fsState = fsState;
|
||||
this.timestamps = timestamps;
|
||||
this.rootsIndex = new ModuleRootsIndex(project);
|
||||
}
|
||||
|
||||
public void close() {
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.jetbrains.jps.incremental.messages.BuildMessage;
|
||||
import org.jetbrains.jps.incremental.messages.CompilerMessage;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.PrintStream;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -80,7 +81,19 @@ class ServerMessageHandler extends SimpleChannelHandler {
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
||||
case FS_EVENT:
|
||||
final JpsRemoteProto.Message.Request.FSEvent fsEvent = request.getFsEvent();
|
||||
final String projectId = fsEvent.getProjectId();
|
||||
final ProjectDescriptor pd = facade.getProjectDescriptor(projectId);
|
||||
if (pd != null) {
|
||||
for (String path : fsEvent.getChangedPathsList()) {
|
||||
facade.notifyFileChanged(pd, new File(path));
|
||||
}
|
||||
for (String path : fsEvent.getDeletedPathsList()) {
|
||||
facade.notifyFileDeleted(pd, new File(path));
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
reply = ProtoUtil.toMessage(sessionId, ProtoUtil.createFailure("Unknown request: " + message));
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.jetbrains.jps.server;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import org.codehaus.groovy.runtime.MethodClosure;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.JavaSdk;
|
||||
import org.jetbrains.jps.Library;
|
||||
import org.jetbrains.jps.Module;
|
||||
@@ -47,14 +48,11 @@ class ServerState {
|
||||
}
|
||||
}
|
||||
|
||||
public void notifyFileChanged(String projectPath, File file, RootDescriptor rd) {
|
||||
public void notifyFileChanged(ProjectDescriptor pd, File file) {
|
||||
try {
|
||||
final ProjectDescriptor d;
|
||||
synchronized (myConfigurationLock) {
|
||||
d = myProjects.get(projectPath);
|
||||
}
|
||||
if (d != null) {
|
||||
d.fsState.markDirty(file, rd, d.timestamps.getStorage());
|
||||
final RootDescriptor rd = pd.rootsIndex.getModuleAndRoot(file);
|
||||
if (rd != null) {
|
||||
pd.fsState.markDirty(file, rd, pd.timestamps.getStorage());
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
@@ -62,14 +60,11 @@ class ServerState {
|
||||
}
|
||||
}
|
||||
|
||||
public void notifyFileDeleted(String projectPath, Module module, String filePath, final boolean isTest) {
|
||||
public void notifyFileDeleted(final ProjectDescriptor pd, File file) {
|
||||
try {
|
||||
final ProjectDescriptor d;
|
||||
synchronized (myConfigurationLock) {
|
||||
d = myProjects.get(projectPath);
|
||||
}
|
||||
if (d != null) {
|
||||
d.fsState.registerDeleted(module, FileUtil.toCanonicalPath(filePath), isTest, d.timestamps.getStorage());
|
||||
final RootDescriptor moduleAndRoot = pd.rootsIndex.getModuleAndRoot(file);
|
||||
if (moduleAndRoot != null) {
|
||||
pd.fsState.registerDeleted(moduleAndRoot.module, FileUtil.toCanonicalPath(file.getPath()), moduleAndRoot.isTestRoot, pd.timestamps.getStorage());
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
@@ -77,6 +72,15 @@ class ServerState {
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ProjectDescriptor getProjectDescriptor(String projectPath) {
|
||||
final ProjectDescriptor pd;
|
||||
synchronized (myConfigurationLock) {
|
||||
pd = myProjects.get(projectPath);
|
||||
}
|
||||
return pd;
|
||||
}
|
||||
|
||||
public void clearProjectCache(Collection<String> projectPaths) {
|
||||
synchronized (myConfigurationLock) {
|
||||
for (String projectPath : projectPaths) {
|
||||
|
||||
Reference in New Issue
Block a user