diff --git a/libraries/tools/kotlin-gradle-plugin-idea-proto/src/generated/java/org/jetbrains/kotlin/kpm/idea/proto/IdeaKpmSchemaInfoProto.java b/libraries/tools/kotlin-gradle-plugin-idea-proto/src/generated/java/org/jetbrains/kotlin/kpm/idea/proto/IdeaKpmSchemaInfoProto.java index aaab6e57362..faba3d06bde 100644 --- a/libraries/tools/kotlin-gradle-plugin-idea-proto/src/generated/java/org/jetbrains/kotlin/kpm/idea/proto/IdeaKpmSchemaInfoProto.java +++ b/libraries/tools/kotlin-gradle-plugin-idea-proto/src/generated/java/org/jetbrains/kotlin/kpm/idea/proto/IdeaKpmSchemaInfoProto.java @@ -16,6 +16,7 @@ private static final long serialVersionUID = 0L; super(builder); } private IdeaKpmSchemaInfoProto() { + severity_ = 0; message_ = ""; } @@ -65,9 +66,15 @@ private static final long serialVersionUID = 0L; sinceSchemaVersionPatch_ = input.readUInt32(); break; } - case 34: { - java.lang.String s = input.readStringRequireUtf8(); + case 32: { + int rawValue = input.readEnum(); bitField0_ |= 0x00000008; + severity_ = rawValue; + break; + } + case 42: { + java.lang.String s = input.readStringRequireUtf8(); + bitField0_ |= 0x00000010; message_ = s; break; } @@ -103,6 +110,123 @@ private static final long serialVersionUID = 0L; org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmSchemaInfoProto.class, org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmSchemaInfoProto.Builder.class); } + /** + * Protobuf enum {@code org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmSchemaInfoProto.Severity} + */ + public enum Severity + implements com.google.protobuf.ProtocolMessageEnum { + /** + * INFO = 0; + */ + INFO(0), + /** + * WARNING = 1; + */ + WARNING(1), + /** + * ERROR = 2; + */ + ERROR(2), + UNRECOGNIZED(-1), + ; + + /** + * INFO = 0; + */ + public static final int INFO_VALUE = 0; + /** + * WARNING = 1; + */ + public static final int WARNING_VALUE = 1; + /** + * ERROR = 2; + */ + public static final int ERROR_VALUE = 2; + + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static Severity valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static Severity forNumber(int value) { + switch (value) { + case 0: return INFO; + case 1: return WARNING; + case 2: return ERROR; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static final com.google.protobuf.Internal.EnumLiteMap< + Severity> internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public Severity findValueByNumber(int number) { + return Severity.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmSchemaInfoProto.getDescriptor().getEnumTypes().get(0); + } + + private static final Severity[] VALUES = values(); + + public static Severity valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private Severity(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmSchemaInfoProto.Severity) + } + private int bitField0_; public static final int SINCE_SCHEMA_VERSION_MAJOR_FIELD_NUMBER = 1; private int sinceSchemaVersionMajor_; @@ -161,18 +285,44 @@ private static final long serialVersionUID = 0L; return sinceSchemaVersionPatch_; } - public static final int MESSAGE_FIELD_NUMBER = 4; + public static final int SEVERITY_FIELD_NUMBER = 4; + private int severity_; + /** + * optional .org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmSchemaInfoProto.Severity severity = 4; + * @return Whether the severity field is set. + */ + @java.lang.Override public boolean hasSeverity() { + return ((bitField0_ & 0x00000008) != 0); + } + /** + * optional .org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmSchemaInfoProto.Severity severity = 4; + * @return The enum numeric value on the wire for severity. + */ + @java.lang.Override public int getSeverityValue() { + return severity_; + } + /** + * optional .org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmSchemaInfoProto.Severity severity = 4; + * @return The severity. + */ + @java.lang.Override public org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmSchemaInfoProto.Severity getSeverity() { + @SuppressWarnings("deprecation") + org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmSchemaInfoProto.Severity result = org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmSchemaInfoProto.Severity.valueOf(severity_); + return result == null ? org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmSchemaInfoProto.Severity.UNRECOGNIZED : result; + } + + public static final int MESSAGE_FIELD_NUMBER = 5; private volatile java.lang.Object message_; /** - * optional string message = 4; + * optional string message = 5; * @return Whether the message field is set. */ @java.lang.Override public boolean hasMessage() { - return ((bitField0_ & 0x00000008) != 0); + return ((bitField0_ & 0x00000010) != 0); } /** - * optional string message = 4; + * optional string message = 5; * @return The message. */ @java.lang.Override @@ -189,7 +339,7 @@ private static final long serialVersionUID = 0L; } } /** - * optional string message = 4; + * optional string message = 5; * @return The bytes for message. */ @java.lang.Override @@ -231,7 +381,10 @@ private static final long serialVersionUID = 0L; output.writeUInt32(3, sinceSchemaVersionPatch_); } if (((bitField0_ & 0x00000008) != 0)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 4, message_); + output.writeEnum(4, severity_); + } + if (((bitField0_ & 0x00000010) != 0)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, message_); } unknownFields.writeTo(output); } @@ -255,7 +408,11 @@ private static final long serialVersionUID = 0L; .computeUInt32Size(3, sinceSchemaVersionPatch_); } if (((bitField0_ & 0x00000008) != 0)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, message_); + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(4, severity_); + } + if (((bitField0_ & 0x00000010) != 0)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, message_); } size += unknownFields.getSerializedSize(); memoizedSize = size; @@ -287,6 +444,10 @@ private static final long serialVersionUID = 0L; if (getSinceSchemaVersionPatch() != other.getSinceSchemaVersionPatch()) return false; } + if (hasSeverity() != other.hasSeverity()) return false; + if (hasSeverity()) { + if (severity_ != other.severity_) return false; + } if (hasMessage() != other.hasMessage()) return false; if (hasMessage()) { if (!getMessage() @@ -315,6 +476,10 @@ private static final long serialVersionUID = 0L; hash = (37 * hash) + SINCE_SCHEMA_VERSION_PATCH_FIELD_NUMBER; hash = (53 * hash) + getSinceSchemaVersionPatch(); } + if (hasSeverity()) { + hash = (37 * hash) + SEVERITY_FIELD_NUMBER; + hash = (53 * hash) + severity_; + } if (hasMessage()) { hash = (37 * hash) + MESSAGE_FIELD_NUMBER; hash = (53 * hash) + getMessage().hashCode(); @@ -458,8 +623,10 @@ private static final long serialVersionUID = 0L; bitField0_ = (bitField0_ & ~0x00000002); sinceSchemaVersionPatch_ = 0; bitField0_ = (bitField0_ & ~0x00000004); - message_ = ""; + severity_ = 0; bitField0_ = (bitField0_ & ~0x00000008); + message_ = ""; + bitField0_ = (bitField0_ & ~0x00000010); return this; } @@ -503,6 +670,10 @@ private static final long serialVersionUID = 0L; if (((from_bitField0_ & 0x00000008) != 0)) { to_bitField0_ |= 0x00000008; } + result.severity_ = severity_; + if (((from_bitField0_ & 0x00000010) != 0)) { + to_bitField0_ |= 0x00000010; + } result.message_ = message_; result.bitField0_ = to_bitField0_; onBuilt(); @@ -562,8 +733,11 @@ private static final long serialVersionUID = 0L; if (other.hasSinceSchemaVersionPatch()) { setSinceSchemaVersionPatch(other.getSinceSchemaVersionPatch()); } + if (other.hasSeverity()) { + setSeverity(other.getSeverity()); + } if (other.hasMessage()) { - bitField0_ |= 0x00000008; + bitField0_ |= 0x00000010; message_ = other.message_; onChanged(); } @@ -714,16 +888,77 @@ private static final long serialVersionUID = 0L; return this; } - private java.lang.Object message_ = ""; + private int severity_ = 0; /** - * optional string message = 4; - * @return Whether the message field is set. + * optional .org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmSchemaInfoProto.Severity severity = 4; + * @return Whether the severity field is set. */ - public boolean hasMessage() { + @java.lang.Override public boolean hasSeverity() { return ((bitField0_ & 0x00000008) != 0); } /** - * optional string message = 4; + * optional .org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmSchemaInfoProto.Severity severity = 4; + * @return The enum numeric value on the wire for severity. + */ + @java.lang.Override public int getSeverityValue() { + return severity_; + } + /** + * optional .org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmSchemaInfoProto.Severity severity = 4; + * @param value The enum numeric value on the wire for severity to set. + * @return This builder for chaining. + */ + public Builder setSeverityValue(int value) { + bitField0_ |= 0x00000008; + severity_ = value; + onChanged(); + return this; + } + /** + * optional .org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmSchemaInfoProto.Severity severity = 4; + * @return The severity. + */ + @java.lang.Override + public org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmSchemaInfoProto.Severity getSeverity() { + @SuppressWarnings("deprecation") + org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmSchemaInfoProto.Severity result = org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmSchemaInfoProto.Severity.valueOf(severity_); + return result == null ? org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmSchemaInfoProto.Severity.UNRECOGNIZED : result; + } + /** + * optional .org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmSchemaInfoProto.Severity severity = 4; + * @param value The severity to set. + * @return This builder for chaining. + */ + public Builder setSeverity(org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmSchemaInfoProto.Severity value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + severity_ = value.getNumber(); + onChanged(); + return this; + } + /** + * optional .org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmSchemaInfoProto.Severity severity = 4; + * @return This builder for chaining. + */ + public Builder clearSeverity() { + bitField0_ = (bitField0_ & ~0x00000008); + severity_ = 0; + onChanged(); + return this; + } + + private java.lang.Object message_ = ""; + /** + * optional string message = 5; + * @return Whether the message field is set. + */ + public boolean hasMessage() { + return ((bitField0_ & 0x00000010) != 0); + } + /** + * optional string message = 5; * @return The message. */ public java.lang.String getMessage() { @@ -739,7 +974,7 @@ private static final long serialVersionUID = 0L; } } /** - * optional string message = 4; + * optional string message = 5; * @return The bytes for message. */ public com.google.protobuf.ByteString @@ -756,7 +991,7 @@ private static final long serialVersionUID = 0L; } } /** - * optional string message = 4; + * optional string message = 5; * @param value The message to set. * @return This builder for chaining. */ @@ -765,23 +1000,23 @@ private static final long serialVersionUID = 0L; if (value == null) { throw new NullPointerException(); } - bitField0_ |= 0x00000008; + bitField0_ |= 0x00000010; message_ = value; onChanged(); return this; } /** - * optional string message = 4; + * optional string message = 5; * @return This builder for chaining. */ public Builder clearMessage() { - bitField0_ = (bitField0_ & ~0x00000008); + bitField0_ = (bitField0_ & ~0x00000010); message_ = getDefaultInstance().getMessage(); onChanged(); return this; } /** - * optional string message = 4; + * optional string message = 5; * @param value The bytes for message to set. * @return This builder for chaining. */ @@ -791,7 +1026,7 @@ private static final long serialVersionUID = 0L; throw new NullPointerException(); } checkByteStringIsUtf8(value); - bitField0_ |= 0x00000008; + bitField0_ |= 0x00000010; message_ = value; onChanged(); return this; diff --git a/libraries/tools/kotlin-gradle-plugin-idea-proto/src/generated/java/org/jetbrains/kotlin/kpm/idea/proto/IdeaKpmSchemaInfoProtoOrBuilder.java b/libraries/tools/kotlin-gradle-plugin-idea-proto/src/generated/java/org/jetbrains/kotlin/kpm/idea/proto/IdeaKpmSchemaInfoProtoOrBuilder.java index fc16c6fe5d7..f7dd737c555 100644 --- a/libraries/tools/kotlin-gradle-plugin-idea-proto/src/generated/java/org/jetbrains/kotlin/kpm/idea/proto/IdeaKpmSchemaInfoProtoOrBuilder.java +++ b/libraries/tools/kotlin-gradle-plugin-idea-proto/src/generated/java/org/jetbrains/kotlin/kpm/idea/proto/IdeaKpmSchemaInfoProtoOrBuilder.java @@ -41,17 +41,33 @@ interface IdeaKpmSchemaInfoProtoOrBuilder extends int getSinceSchemaVersionPatch(); /** - * optional string message = 4; + * optional .org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmSchemaInfoProto.Severity severity = 4; + * @return Whether the severity field is set. + */ + boolean hasSeverity(); + /** + * optional .org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmSchemaInfoProto.Severity severity = 4; + * @return The enum numeric value on the wire for severity. + */ + int getSeverityValue(); + /** + * optional .org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmSchemaInfoProto.Severity severity = 4; + * @return The severity. + */ + org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmSchemaInfoProto.Severity getSeverity(); + + /** + * optional string message = 5; * @return Whether the message field is set. */ boolean hasMessage(); /** - * optional string message = 4; + * optional string message = 5; * @return The message. */ java.lang.String getMessage(); /** - * optional string message = 4; + * optional string message = 5; * @return The bytes for message. */ com.google.protobuf.ByteString diff --git a/libraries/tools/kotlin-gradle-plugin-idea-proto/src/generated/java/org/jetbrains/kotlin/kpm/idea/proto/ProtoIdeaKpm.java b/libraries/tools/kotlin-gradle-plugin-idea-proto/src/generated/java/org/jetbrains/kotlin/kpm/idea/proto/ProtoIdeaKpm.java index 7b99f34967c..501f30a7272 100644 --- a/libraries/tools/kotlin-gradle-plugin-idea-proto/src/generated/java/org/jetbrains/kotlin/kpm/idea/proto/ProtoIdeaKpm.java +++ b/libraries/tools/kotlin-gradle-plugin-idea-proto/src/generated/java/org/jetbrains/kotlin/kpm/idea/proto/ProtoIdeaKpm.java @@ -284,24 +284,27 @@ final class ProtoIdeaKpm { "eaKpmModuleProtoB\t\n\007_extrasB\030\n\026_gradle_p" + "lugin_versionB\031\n\027_core_libraries_version" + "B\037\n\035_explicit_api_mode_cli_optionB\025\n\023_ko" + - "tlin_native_home\"\222\002\n\026IdeaKpmSchemaInfoPr" + + "tlin_native_home\"\252\003\n\026IdeaKpmSchemaInfoPr" + "oto\022\'\n\032since_schema_version_major\030\001 \001(\rH" + "\000\210\001\001\022\'\n\032since_schema_version_minor\030\002 \001(\r" + "H\001\210\001\001\022\'\n\032since_schema_version_patch\030\003 \001(" + - "\rH\002\210\001\001\022\024\n\007message\030\004 \001(\tH\003\210\001\001B\035\n\033_since_s" + - "chema_version_majorB\035\n\033_since_schema_ver" + - "sion_minorB\035\n\033_since_schema_version_patc" + - "hB\n\n\010_message\"\372\002\n\025IdeaKpmContainerProto\022" + - "!\n\024schema_version_major\030\001 \001(\rH\000\210\001\001\022!\n\024sc" + - "hema_version_minor\030\002 \001(\rH\001\210\001\001\022!\n\024schema_" + - "version_patch\030\003 \001(\rH\002\210\001\001\022Q\n\014schema_infos" + - "\030\004 \003(\0132;.org.jetbrains.kotlin.kpm.idea.p" + - "roto.IdeaKpmSchemaInfoProto\022N\n\007project\030\030" + - " \001(\01328.org.jetbrains.kotlin.kpm.idea.pro" + - "to.IdeaKpmProjectProtoH\003\210\001\001B\027\n\025_schema_v" + - "ersion_majorB\027\n\025_schema_version_minorB\027\n" + - "\025_schema_version_patchB\n\n\010_projectB\002P\001b\006" + - "proto3" + "\rH\002\210\001\001\022[\n\010severity\030\004 \001(\0162D.org.jetbrains" + + ".kotlin.kpm.idea.proto.IdeaKpmSchemaInfo" + + "Proto.SeverityH\003\210\001\001\022\024\n\007message\030\005 \001(\tH\004\210\001" + + "\001\",\n\010Severity\022\010\n\004INFO\020\000\022\013\n\007WARNING\020\001\022\t\n\005" + + "ERROR\020\002B\035\n\033_since_schema_version_majorB\035" + + "\n\033_since_schema_version_minorB\035\n\033_since_" + + "schema_version_patchB\013\n\t_severityB\n\n\010_me" + + "ssage\"\372\002\n\025IdeaKpmContainerProto\022!\n\024schem" + + "a_version_major\030\001 \001(\rH\000\210\001\001\022!\n\024schema_ver" + + "sion_minor\030\002 \001(\rH\001\210\001\001\022!\n\024schema_version_" + + "patch\030\003 \001(\rH\002\210\001\001\022Q\n\014schema_infos\030\004 \003(\0132;" + + ".org.jetbrains.kotlin.kpm.idea.proto.Ide" + + "aKpmSchemaInfoProto\022N\n\007project\030\030 \001(\01328.o" + + "rg.jetbrains.kotlin.kpm.idea.proto.IdeaK" + + "pmProjectProtoH\003\210\001\001B\027\n\025_schema_version_m" + + "ajorB\027\n\025_schema_version_minorB\027\n\025_schema" + + "_version_patchB\n\n\010_projectB\002P\001b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, @@ -439,7 +442,7 @@ final class ProtoIdeaKpm { internal_static_org_jetbrains_kotlin_kpm_idea_proto_IdeaKpmSchemaInfoProto_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_org_jetbrains_kotlin_kpm_idea_proto_IdeaKpmSchemaInfoProto_descriptor, - new java.lang.String[] { "SinceSchemaVersionMajor", "SinceSchemaVersionMinor", "SinceSchemaVersionPatch", "Message", "SinceSchemaVersionMajor", "SinceSchemaVersionMinor", "SinceSchemaVersionPatch", "Message", }); + new java.lang.String[] { "SinceSchemaVersionMajor", "SinceSchemaVersionMinor", "SinceSchemaVersionPatch", "Severity", "Message", "SinceSchemaVersionMajor", "SinceSchemaVersionMinor", "SinceSchemaVersionPatch", "Severity", "Message", }); internal_static_org_jetbrains_kotlin_kpm_idea_proto_IdeaKpmContainerProto_descriptor = getDescriptor().getMessageTypes().get(21); internal_static_org_jetbrains_kotlin_kpm_idea_proto_IdeaKpmContainerProto_fieldAccessorTable = new diff --git a/libraries/tools/kotlin-gradle-plugin-idea-proto/src/generated/kotlin/org/jetbrains/kotlin/kpm/idea/proto/IdeaKpmSchemaInfoProtoKt.kt b/libraries/tools/kotlin-gradle-plugin-idea-proto/src/generated/kotlin/org/jetbrains/kotlin/kpm/idea/proto/IdeaKpmSchemaInfoProtoKt.kt index abecd03137a..a4c69a7ed26 100644 --- a/libraries/tools/kotlin-gradle-plugin-idea-proto/src/generated/kotlin/org/jetbrains/kotlin/kpm/idea/proto/IdeaKpmSchemaInfoProtoKt.kt +++ b/libraries/tools/kotlin-gradle-plugin-idea-proto/src/generated/kotlin/org/jetbrains/kotlin/kpm/idea/proto/IdeaKpmSchemaInfoProtoKt.kt @@ -95,7 +95,31 @@ internal object IdeaKpmSchemaInfoProtoKt { } /** - * optional string message = 4; + * optional .org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmSchemaInfoProto.Severity severity = 4; + */ + internal var severity: org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmSchemaInfoProto.Severity + @JvmName("getSeverity") + get() = _builder.getSeverity() + @JvmName("setSeverity") + set(value) { + _builder.setSeverity(value) + } + /** + * optional .org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmSchemaInfoProto.Severity severity = 4; + */ + internal fun clearSeverity() { + _builder.clearSeverity() + } + /** + * optional .org.jetbrains.kotlin.kpm.idea.proto.IdeaKpmSchemaInfoProto.Severity severity = 4; + * @return Whether the severity field is set. + */ + internal fun hasSeverity(): kotlin.Boolean { + return _builder.hasSeverity() + } + + /** + * optional string message = 5; */ internal var message: kotlin.String @JvmName("getMessage") @@ -105,13 +129,13 @@ internal object IdeaKpmSchemaInfoProtoKt { _builder.setMessage(value) } /** - * optional string message = 4; + * optional string message = 5; */ internal fun clearMessage() { _builder.clearMessage() } /** - * optional string message = 4; + * optional string message = 5; * @return Whether the message field is set. */ internal fun hasMessage(): kotlin.Boolean { diff --git a/libraries/tools/kotlin-gradle-plugin-idea-proto/src/main/kotlin/org/jetbrains/kotlin/kpm/idea/proto/IdeaKpmProtoSchema.kt b/libraries/tools/kotlin-gradle-plugin-idea-proto/src/main/kotlin/org/jetbrains/kotlin/kpm/idea/proto/IdeaKpmProtoSchema.kt index ab93e1fd36f..1adc49f857b 100644 --- a/libraries/tools/kotlin-gradle-plugin-idea-proto/src/main/kotlin/org/jetbrains/kotlin/kpm/idea/proto/IdeaKpmProtoSchema.kt +++ b/libraries/tools/kotlin-gradle-plugin-idea-proto/src/main/kotlin/org/jetbrains/kotlin/kpm/idea/proto/IdeaKpmProtoSchema.kt @@ -15,6 +15,7 @@ internal object IdeaKpmProtoSchema { sinceSchemaVersionMajor = 1 sinceSchemaVersionMinor = 0 sinceSchemaVersionPatch = 0 + severity = IdeaKpmSchemaInfoProto.Severity.INFO message = "Initial version of IdeaKpmProto*" } ) diff --git a/libraries/tools/kotlin-gradle-plugin-idea-proto/src/main/kotlin/org/jetbrains/kotlin/kpm/idea/proto/container.kt b/libraries/tools/kotlin-gradle-plugin-idea-proto/src/main/kotlin/org/jetbrains/kotlin/kpm/idea/proto/container.kt index 018811cf4b5..6a9a82fc355 100644 --- a/libraries/tools/kotlin-gradle-plugin-idea-proto/src/main/kotlin/org/jetbrains/kotlin/kpm/idea/proto/container.kt +++ b/libraries/tools/kotlin-gradle-plugin-idea-proto/src/main/kotlin/org/jetbrains/kotlin/kpm/idea/proto/container.kt @@ -76,24 +76,46 @@ internal fun IdeaKpmSerializationContext.IdeaKpmProject(proto: IdeaKpmContainerP return null } - if (proto.schemaVersionMajor > IdeaKpmProtoSchema.versionMajor) { + if (!proto.hasSchemaVersionPatch()) { + logger.warn("Missing 'schema_version_patch", Throwable()) + } + + val messagesFromFuture = proto.schemaInfosList.filter { schemaInfo -> + val sinceMajor = schemaInfo.sinceSchemaVersionMajor + val sinceMinor = schemaInfo.sinceSchemaVersionMinor + val sincePatch = schemaInfo.sinceSchemaVersionPatch + + sinceMajor > IdeaKpmProtoSchema.versionMajor || + (sinceMajor == IdeaKpmProtoSchema.versionMajor && IdeaKpmProtoSchema.versionMinor > IdeaKpmProtoSchema.versionMinor) || + (sinceMajor == IdeaKpmProtoSchema.versionMajor && sinceMinor == IdeaKpmProtoSchema.versionMinor && + sincePatch > IdeaKpmProtoSchema.versionPatch) + } + + messagesFromFuture.forEach { messageFromFuture -> + val userMessage = "Since: " + + "${messageFromFuture.sinceSchemaVersionMajor}." + + "${messageFromFuture.sinceSchemaVersionMinor}." + + "${messageFromFuture.sinceSchemaVersionPatch}: " + + messageFromFuture.message + + when (messageFromFuture.severity) { + IdeaKpmSchemaInfoProto.Severity.INFO -> logger.warn("Info: $userMessage") + IdeaKpmSchemaInfoProto.Severity.WARNING -> logger.warn("Warn: $userMessage") + IdeaKpmSchemaInfoProto.Severity.ERROR, + IdeaKpmSchemaInfoProto.Severity.UNRECOGNIZED, + null -> logger.error("Error: $userMessage") + } + } + + if (messagesFromFuture.any { it.severity == IdeaKpmSchemaInfoProto.Severity.ERROR }) { + val schemaVersionMajor = proto.schemaVersionMajor + val schemaVersionMinor = proto.schemaVersionMinor + val schemaVersionPatch = if (proto.hasSchemaVersionPatch()) proto.schemaVersionPatch else 0 logger.error( - "Incompatible IdeaKpmProto* version. Received major version ${proto.schemaVersionMajor}. " + - "Supported version ${IdeaKpmProtoSchema.versionMajor}", Throwable() + "Binary version $schemaVersionMajor.$schemaVersionMinor.$schemaVersionPatch is incompatible with this schema version: " + + "${IdeaKpmProtoSchema.versionMajor}.${IdeaKpmProtoSchema.versionMinor}.${IdeaKpmProtoSchema.versionPatch}" ) - - val relevantInfos = proto.schemaInfosList.filter { info -> - info.sinceSchemaVersionMajor > IdeaKpmProtoSchema.versionMajor - } - - relevantInfos.forEach { info -> - logger.error( - "Since: ${info.sinceSchemaVersionMajor}.${info.sinceSchemaVersionMinor}.${info.sinceSchemaVersionPatch}: ${info.message}" - ) - } - - return null } diff --git a/libraries/tools/kotlin-gradle-plugin-idea-proto/src/main/proto/proto_idea_kpm.proto b/libraries/tools/kotlin-gradle-plugin-idea-proto/src/main/proto/proto_idea_kpm.proto index 56d832f314f..3d2ac388871 100644 --- a/libraries/tools/kotlin-gradle-plugin-idea-proto/src/main/proto/proto_idea_kpm.proto +++ b/libraries/tools/kotlin-gradle-plugin-idea-proto/src/main/proto/proto_idea_kpm.proto @@ -146,10 +146,17 @@ message IdeaKpmProjectProto { } message IdeaKpmSchemaInfoProto { + enum Severity { + INFO = 0; + WARNING = 1; + ERROR = 2; + }; + optional uint32 since_schema_version_major = 1; optional uint32 since_schema_version_minor = 2; optional uint32 since_schema_version_patch = 3; - optional string message = 4; + optional Severity severity = 4; + optional string message = 5; } message IdeaKpmContainerProto { @@ -157,6 +164,5 @@ message IdeaKpmContainerProto { optional uint32 schema_version_minor = 2; optional uint32 schema_version_patch = 3; repeated IdeaKpmSchemaInfoProto schema_infos = 4; - optional IdeaKpmProjectProto project = 24; } diff --git a/libraries/tools/kotlin-gradle-plugin-idea-proto/src/test/kotlin/org/jetbrains/kotlin/kpm/idea/proto/ContainerTest.kt b/libraries/tools/kotlin-gradle-plugin-idea-proto/src/test/kotlin/org/jetbrains/kotlin/kpm/idea/proto/ContainerTest.kt index 371918ca6b5..a2305706985 100644 --- a/libraries/tools/kotlin-gradle-plugin-idea-proto/src/test/kotlin/org/jetbrains/kotlin/kpm/idea/proto/ContainerTest.kt +++ b/libraries/tools/kotlin-gradle-plugin-idea-proto/src/test/kotlin/org/jetbrains/kotlin/kpm/idea/proto/ContainerTest.kt @@ -19,11 +19,18 @@ class ContainerTest : IdeaKpmSerializationContext { override val extrasSerializationExtension = TestIdeaKpmExtrasSerializationExtension @Test - fun `deserialize - with too high major version - returns null`() { + fun `deserialize - with error future message - returns null`() { val data = ideaKpmContainerProto { schemaVersionMajor = IdeaKpmProtoSchema.versionMajor + 1 schemaVersionMinor = IdeaKpmProtoSchema.versionMinor schemaVersionPatch = IdeaKpmProtoSchema.versionPatch + schemaInfos.add(ideaKpmSchemaInfoProto { + sinceSchemaVersionMajor = IdeaKpmProtoSchema.versionMajor + 1 + sinceSchemaVersionMinor = 0 + sinceSchemaVersionPatch = 0 + message = "Incompatible for this test!" + severity = IdeaKpmSchemaInfoProto.Severity.ERROR + }) }.toByteArray() assertTrue(logger.reports.isEmpty(), "Expected no reports in logger")