Skip to content

Rider plugin updates #1531

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions utbot-rd/src/main/rdgen/org/utbot/rd/models/CSharpModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,25 @@ import com.jetbrains.rd.generator.nova.*
object CSharpRoot: Root()

object VSharpModel: Ext(CSharpRoot) {
val methodDescriptor = structdef {
field("methodName", PredefinedType.string)
field("typeName", PredefinedType.string)
}

val generateArguments = structdef {
field("assemblyPath", PredefinedType.string)
field("projectCsprojPath", PredefinedType.string)
field("solutionFilePath", PredefinedType.string)
field("moduleFqnName", PredefinedType.string)
field("methodToken", PredefinedType.int)
field("method", methodDescriptor)
field("generationTimeoutInSeconds", PredefinedType.int)
field("targetFramework", PredefinedType.string.nullable)
}

val generateResults = structdef {
field("isGenerated", PredefinedType.bool)
field("generatedProjectPath", PredefinedType.string)
field("generatedFilesPaths", array(PredefinedType.string))
field("exceptionMessage", PredefinedType.string.nullable)
}

init {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace UtBot.Rd.Generated


/// <summary>
/// <p>Generated from: CSharpModel.kt:5</p>
/// <p>Generated from: CSharpModel.kt:6</p>
/// </summary>
public class CSharpRoot : RdExtBase
{
Expand Down
172 changes: 143 additions & 29 deletions utbot-rider/src/dotnet/UtBot/UtBot.Rd/Generated/VSharpModel.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace UtBot.Rd.Generated


/// <summary>
/// <p>Generated from: CSharpModel.kt:7</p>
/// <p>Generated from: CSharpModel.kt:8</p>
/// </summary>
public class VSharpModel : RdExtBase
{
Expand Down Expand Up @@ -76,7 +76,7 @@ private VSharpModel (



protected override long SerializationHash => -3661028246701070338L;
protected override long SerializationHash => -2362293640438957269L;

protected override Action<ISerializers> Register => RegisterDeclaredTypesSerializers;
public static void RegisterDeclaredTypesSerializers(ISerializers serializers)
Expand Down Expand Up @@ -118,7 +118,7 @@ public override string ToString()


/// <summary>
/// <p>Generated from: CSharpModel.kt:8</p>
/// <p>Generated from: CSharpModel.kt:14</p>
/// </summary>
public sealed class GenerateArguments : IPrintable, IEquatable<GenerateArguments>
{
Expand All @@ -127,43 +127,43 @@ public sealed class GenerateArguments : IPrintable, IEquatable<GenerateArguments
[NotNull] public string AssemblyPath {get; private set;}
[NotNull] public string ProjectCsprojPath {get; private set;}
[NotNull] public string SolutionFilePath {get; private set;}
[NotNull] public string ModuleFqnName {get; private set;}
public int MethodToken {get; private set;}
[NotNull] public MethodDescriptor Method {get; private set;}
public int GenerationTimeoutInSeconds {get; private set;}
[CanBeNull] public string TargetFramework {get; private set;}

//private fields
//primary constructor
public GenerateArguments(
[NotNull] string assemblyPath,
[NotNull] string projectCsprojPath,
[NotNull] string solutionFilePath,
[NotNull] string moduleFqnName,
int methodToken,
int generationTimeoutInSeconds
[NotNull] MethodDescriptor method,
int generationTimeoutInSeconds,
[CanBeNull] string targetFramework
)
{
if (assemblyPath == null) throw new ArgumentNullException("assemblyPath");
if (projectCsprojPath == null) throw new ArgumentNullException("projectCsprojPath");
if (solutionFilePath == null) throw new ArgumentNullException("solutionFilePath");
if (moduleFqnName == null) throw new ArgumentNullException("moduleFqnName");
if (method == null) throw new ArgumentNullException("method");

AssemblyPath = assemblyPath;
ProjectCsprojPath = projectCsprojPath;
SolutionFilePath = solutionFilePath;
ModuleFqnName = moduleFqnName;
MethodToken = methodToken;
Method = method;
GenerationTimeoutInSeconds = generationTimeoutInSeconds;
TargetFramework = targetFramework;
}
//secondary constructor
//deconstruct trait
public void Deconstruct([NotNull] out string assemblyPath, [NotNull] out string projectCsprojPath, [NotNull] out string solutionFilePath, [NotNull] out string moduleFqnName, out int methodToken, out int generationTimeoutInSeconds)
public void Deconstruct([NotNull] out string assemblyPath, [NotNull] out string projectCsprojPath, [NotNull] out string solutionFilePath, [NotNull] out MethodDescriptor method, out int generationTimeoutInSeconds, [CanBeNull] out string targetFramework)
{
assemblyPath = AssemblyPath;
projectCsprojPath = ProjectCsprojPath;
solutionFilePath = SolutionFilePath;
moduleFqnName = ModuleFqnName;
methodToken = MethodToken;
method = Method;
generationTimeoutInSeconds = GenerationTimeoutInSeconds;
targetFramework = TargetFramework;
}
//statics

Expand All @@ -172,22 +172,24 @@ public void Deconstruct([NotNull] out string assemblyPath, [NotNull] out string
var assemblyPath = reader.ReadString();
var projectCsprojPath = reader.ReadString();
var solutionFilePath = reader.ReadString();
var moduleFqnName = reader.ReadString();
var methodToken = reader.ReadInt();
var method = MethodDescriptor.Read(ctx, reader);
var generationTimeoutInSeconds = reader.ReadInt();
var _result = new GenerateArguments(assemblyPath, projectCsprojPath, solutionFilePath, moduleFqnName, methodToken, generationTimeoutInSeconds);
var targetFramework = ReadStringNullable(ctx, reader);
var _result = new GenerateArguments(assemblyPath, projectCsprojPath, solutionFilePath, method, generationTimeoutInSeconds, targetFramework);
return _result;
};
public static CtxReadDelegate<string> ReadStringNullable = JetBrains.Rd.Impl.Serializers.ReadString.NullableClass();

public static CtxWriteDelegate<GenerateArguments> Write = (ctx, writer, value) =>
{
writer.Write(value.AssemblyPath);
writer.Write(value.ProjectCsprojPath);
writer.Write(value.SolutionFilePath);
writer.Write(value.ModuleFqnName);
writer.Write(value.MethodToken);
MethodDescriptor.Write(ctx, writer, value.Method);
writer.Write(value.GenerationTimeoutInSeconds);
WriteStringNullable(ctx, writer, value.TargetFramework);
};
public static CtxWriteDelegate<string> WriteStringNullable = JetBrains.Rd.Impl.Serializers.WriteString.NullableClass();

//constants

Expand All @@ -205,7 +207,7 @@ public bool Equals(GenerateArguments other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return AssemblyPath == other.AssemblyPath && ProjectCsprojPath == other.ProjectCsprojPath && SolutionFilePath == other.SolutionFilePath && ModuleFqnName == other.ModuleFqnName && MethodToken == other.MethodToken && GenerationTimeoutInSeconds == other.GenerationTimeoutInSeconds;
return AssemblyPath == other.AssemblyPath && ProjectCsprojPath == other.ProjectCsprojPath && SolutionFilePath == other.SolutionFilePath && Equals(Method, other.Method) && GenerationTimeoutInSeconds == other.GenerationTimeoutInSeconds && Equals(TargetFramework, other.TargetFramework);
}
//hash code trait
public override int GetHashCode()
Expand All @@ -215,9 +217,9 @@ public override int GetHashCode()
hash = hash * 31 + AssemblyPath.GetHashCode();
hash = hash * 31 + ProjectCsprojPath.GetHashCode();
hash = hash * 31 + SolutionFilePath.GetHashCode();
hash = hash * 31 + ModuleFqnName.GetHashCode();
hash = hash * 31 + MethodToken.GetHashCode();
hash = hash * 31 + Method.GetHashCode();
hash = hash * 31 + GenerationTimeoutInSeconds.GetHashCode();
hash = hash * 31 + (TargetFramework != null ? TargetFramework.GetHashCode() : 0);
return hash;
}
}
Expand All @@ -229,9 +231,9 @@ public void Print(PrettyPrinter printer)
printer.Print("assemblyPath = "); AssemblyPath.PrintEx(printer); printer.Println();
printer.Print("projectCsprojPath = "); ProjectCsprojPath.PrintEx(printer); printer.Println();
printer.Print("solutionFilePath = "); SolutionFilePath.PrintEx(printer); printer.Println();
printer.Print("moduleFqnName = "); ModuleFqnName.PrintEx(printer); printer.Println();
printer.Print("methodToken = "); MethodToken.PrintEx(printer); printer.Println();
printer.Print("method = "); Method.PrintEx(printer); printer.Println();
printer.Print("generationTimeoutInSeconds = "); GenerationTimeoutInSeconds.PrintEx(printer); printer.Println();
printer.Print("targetFramework = "); TargetFramework.PrintEx(printer); printer.Println();
}
printer.Print(")");
}
Expand All @@ -246,52 +248,66 @@ public override string ToString()


/// <summary>
/// <p>Generated from: CSharpModel.kt:17</p>
/// <p>Generated from: CSharpModel.kt:23</p>
/// </summary>
public sealed class GenerateResults : IPrintable, IEquatable<GenerateResults>
{
//fields
//public fields
public bool IsGenerated {get; private set;}
[NotNull] public string GeneratedProjectPath {get; private set;}
[NotNull] public string[] GeneratedFilesPaths {get; private set;}
[CanBeNull] public string ExceptionMessage {get; private set;}

//private fields
//primary constructor
public GenerateResults(
bool isGenerated,
[NotNull] string generatedProjectPath,
[NotNull] string[] generatedFilesPaths
[NotNull] string[] generatedFilesPaths,
[CanBeNull] string exceptionMessage
)
{
if (generatedProjectPath == null) throw new ArgumentNullException("generatedProjectPath");
if (generatedFilesPaths == null) throw new ArgumentNullException("generatedFilesPaths");

IsGenerated = isGenerated;
GeneratedProjectPath = generatedProjectPath;
GeneratedFilesPaths = generatedFilesPaths;
ExceptionMessage = exceptionMessage;
}
//secondary constructor
//deconstruct trait
public void Deconstruct([NotNull] out string generatedProjectPath, [NotNull] out string[] generatedFilesPaths)
public void Deconstruct(out bool isGenerated, [NotNull] out string generatedProjectPath, [NotNull] out string[] generatedFilesPaths, [CanBeNull] out string exceptionMessage)
{
isGenerated = IsGenerated;
generatedProjectPath = GeneratedProjectPath;
generatedFilesPaths = GeneratedFilesPaths;
exceptionMessage = ExceptionMessage;
}
//statics

public static CtxReadDelegate<GenerateResults> Read = (ctx, reader) =>
{
var isGenerated = reader.ReadBool();
var generatedProjectPath = reader.ReadString();
var generatedFilesPaths = ReadStringArray(ctx, reader);
var _result = new GenerateResults(generatedProjectPath, generatedFilesPaths);
var exceptionMessage = ReadStringNullable(ctx, reader);
var _result = new GenerateResults(isGenerated, generatedProjectPath, generatedFilesPaths, exceptionMessage);
return _result;
};
public static CtxReadDelegate<string[]> ReadStringArray = JetBrains.Rd.Impl.Serializers.ReadString.Array();
public static CtxReadDelegate<string> ReadStringNullable = JetBrains.Rd.Impl.Serializers.ReadString.NullableClass();

public static CtxWriteDelegate<GenerateResults> Write = (ctx, writer, value) =>
{
writer.Write(value.IsGenerated);
writer.Write(value.GeneratedProjectPath);
WriteStringArray(ctx, writer, value.GeneratedFilesPaths);
WriteStringNullable(ctx, writer, value.ExceptionMessage);
};
public static CtxWriteDelegate<string[]> WriteStringArray = JetBrains.Rd.Impl.Serializers.WriteString.Array();
public static CtxWriteDelegate<string> WriteStringNullable = JetBrains.Rd.Impl.Serializers.WriteString.NullableClass();

//constants

Expand All @@ -309,15 +325,17 @@ public bool Equals(GenerateResults other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return GeneratedProjectPath == other.GeneratedProjectPath && GeneratedFilesPaths.SequenceEqual(other.GeneratedFilesPaths);
return IsGenerated == other.IsGenerated && GeneratedProjectPath == other.GeneratedProjectPath && GeneratedFilesPaths.SequenceEqual(other.GeneratedFilesPaths) && Equals(ExceptionMessage, other.ExceptionMessage);
}
//hash code trait
public override int GetHashCode()
{
unchecked {
var hash = 0;
hash = hash * 31 + IsGenerated.GetHashCode();
hash = hash * 31 + GeneratedProjectPath.GetHashCode();
hash = hash * 31 + GeneratedFilesPaths.ContentHashCode();
hash = hash * 31 + (ExceptionMessage != null ? ExceptionMessage.GetHashCode() : 0);
return hash;
}
}
Expand All @@ -326,8 +344,104 @@ public void Print(PrettyPrinter printer)
{
printer.Println("GenerateResults (");
using (printer.IndentCookie()) {
printer.Print("isGenerated = "); IsGenerated.PrintEx(printer); printer.Println();
printer.Print("generatedProjectPath = "); GeneratedProjectPath.PrintEx(printer); printer.Println();
printer.Print("generatedFilesPaths = "); GeneratedFilesPaths.PrintEx(printer); printer.Println();
printer.Print("exceptionMessage = "); ExceptionMessage.PrintEx(printer); printer.Println();
}
printer.Print(")");
}
//toString
public override string ToString()
{
var printer = new SingleLinePrettyPrinter();
Print(printer);
return printer.ToString();
}
}


/// <summary>
/// <p>Generated from: CSharpModel.kt:9</p>
/// </summary>
public sealed class MethodDescriptor : IPrintable, IEquatable<MethodDescriptor>
{
//fields
//public fields
[NotNull] public string MethodName {get; private set;}
[NotNull] public string TypeName {get; private set;}

//private fields
//primary constructor
public MethodDescriptor(
[NotNull] string methodName,
[NotNull] string typeName
)
{
if (methodName == null) throw new ArgumentNullException("methodName");
if (typeName == null) throw new ArgumentNullException("typeName");

MethodName = methodName;
TypeName = typeName;
}
//secondary constructor
//deconstruct trait
public void Deconstruct([NotNull] out string methodName, [NotNull] out string typeName)
{
methodName = MethodName;
typeName = TypeName;
}
//statics

public static CtxReadDelegate<MethodDescriptor> Read = (ctx, reader) =>
{
var methodName = reader.ReadString();
var typeName = reader.ReadString();
var _result = new MethodDescriptor(methodName, typeName);
return _result;
};

public static CtxWriteDelegate<MethodDescriptor> Write = (ctx, writer, value) =>
{
writer.Write(value.MethodName);
writer.Write(value.TypeName);
};

//constants

//custom body
//methods
//equals trait
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != GetType()) return false;
return Equals((MethodDescriptor) obj);
}
public bool Equals(MethodDescriptor other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return MethodName == other.MethodName && TypeName == other.TypeName;
}
//hash code trait
public override int GetHashCode()
{
unchecked {
var hash = 0;
hash = hash * 31 + MethodName.GetHashCode();
hash = hash * 31 + TypeName.GetHashCode();
return hash;
}
}
//pretty print
public void Print(PrettyPrinter printer)
{
printer.Println("MethodDescriptor (");
using (printer.IndentCookie()) {
printer.Print("methodName = "); MethodName.PrintEx(printer); printer.Println();
printer.Print("typeName = "); TypeName.PrintEx(printer); printer.Println();
}
printer.Print(")");
}
Expand Down
1 change: 1 addition & 0 deletions utbot-rider/src/dotnet/UtBot/UtBot.Rd/RdUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ namespace UtBot.Rd;
public static class RdUtil
{
public static readonly string MainProcessName = "UtBot";
public static readonly string DefaultTestProjectTarget = "net6.0";
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
<ProjectReference Include="..\UtBot.Rd\UtBot.Rd.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="VSTeam.VSharp" Version="0.0.4" />
<PackageReference Include="VSTeam.VSharp" Version="0.0.6" />
</ItemGroup>
</Project>
Loading