Skip to content
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
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ intellijPluginVersion=1.13.1
# every time you bump rd version:
# 1. regenerate all models
# 2. check if rider plugin works
rdVersion=2022.2.1
rdVersion=2022.3.3
# to enable - add -PincludeRiderInBuild=true in build CLI
includeRiderInBuild=false
jacocoVersion=0.8.8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,7 @@ class EngineProcessModel private constructor(
fun create(lifetime: Lifetime, protocol: IProtocol): EngineProcessModel {
EngineProcessRoot.register(protocol.serializers)

return EngineProcessModel().apply {
identify(protocol.identity, RdId.Null.mix("EngineProcessModel"))
bind(lifetime, protocol, "EngineProcessModel")
}
return EngineProcessModel()
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ class RdInstrumenterAdapter private constructor(
fun create(lifetime: Lifetime, protocol: IProtocol): RdInstrumenterAdapter {
EngineProcessRoot.register(protocol.serializers)

return RdInstrumenterAdapter().apply {
identify(protocol.identity, RdId.Null.mix("RdInstrumenterAdapter"))
bind(lifetime, protocol, "RdInstrumenterAdapter")
}
return RdInstrumenterAdapter()
}

private val __StringNullableSerializer = FrameworkMarshallers.String.nullable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ class RdSourceFindingStrategy private constructor(
fun create(lifetime: Lifetime, protocol: IProtocol): RdSourceFindingStrategy {
EngineProcessRoot.register(protocol.serializers)

return RdSourceFindingStrategy().apply {
identify(protocol.identity, RdId.Null.mix("RdSourceFindingStrategy"))
bind(lifetime, protocol, "RdSourceFindingStrategy")
}
return RdSourceFindingStrategy()
}

private val __StringNullableSerializer = FrameworkMarshallers.String.nullable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ class InstrumentedProcessModel private constructor(
fun create(lifetime: Lifetime, protocol: IProtocol): InstrumentedProcessModel {
InstrumentedProcessRoot.register(protocol.serializers)

return InstrumentedProcessModel().apply {
identify(protocol.identity, RdId.Null.mix("InstrumentedProcessModel"))
bind(lifetime, protocol, "InstrumentedProcessModel")
}
return InstrumentedProcessModel()
}


Expand Down
67 changes: 66 additions & 1 deletion utbot-rd/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
plugins {
id 'com.jetbrains.rdgen' version "2022.2.1"
id 'com.jetbrains.rdgen' version "2022.3.3"
}

import com.jetbrains.rd.generator.gradle.RdGenExtension
import com.jetbrains.rd.generator.gradle.RdGenTask

if (includeRiderInBuild.toBoolean()) {
def utbotRider = project.rootProject.childProjects["utbot-rider"]
evaluationDependsOn(utbotRider.path)
tasks.getByName("classes").dependsOn(utbotRider.tasks.getByName("addRiderModelsToUtbotModels"))
}

compileKotlin {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
Expand All @@ -26,6 +32,8 @@ configurations {
lifetimedProcessMockCompileClasspath.extendsFrom configurations.compileClasspath
processWithRdServerMockCompileClasspath.extendsFrom configurations.compileClasspath
rdgenModelsCompileClasspath.extendsFrom configurations.compileClasspath
if (includeRiderInBuild.toBoolean())
riderRdgenModelsCompileClasspath.extendsFrom configurations.rdgenModelsCompileClasspath
}

sourceSets {
Expand All @@ -44,8 +52,17 @@ sourceSets {
srcDirs = ["src/main/rdgen"]
}
}
if (includeRiderInBuild.toBoolean()) {
riderRdgenModels {
kotlin {
srcDirs = ["src/main/riderRdgenModels"]
}
}
}
}

def riderModelJar = new File(project.buildDir, "libs/rider-model.jar")

dependencies {
implementation project(':utbot-core')
implementation group: 'com.jetbrains.rd', name: 'rd-framework', version: rdVersion
Expand All @@ -56,6 +73,10 @@ dependencies {
processWithRdServerMockImplementation project(':utbot-rd')

rdgenModelsCompileClasspath group: 'com.jetbrains.rd', name: 'rd-gen', version: rdVersion

if (includeRiderInBuild.toBoolean()) {
riderRdgenModelsCompileClasspath files(riderModelJar)
}
}

task lifetimedProcessMockJar(type: Jar) {
Expand Down Expand Up @@ -99,6 +120,50 @@ test {
systemProperty("PROCESS_WITH_RD_SERVER_MOCK", processWithRdServerMockJar.archiveFile.get().getAsFile().canonicalPath)
}

if (includeRiderInBuild.toBoolean()) {
def currentProjectDir = project.projectDir
def riderProject = project.rootProject.childProjects["utbot-rider"]
def riderTask = riderProject.tasks.getByName("addRiderModelsToUtbotModels")
// !!!! IMPORTANT !!!!
// after generation you should MANUALLY correct kotlin generated code as it is incorrectly references some rider model
// mandatory steps:
// 1. In UtBotRiderModel.Generated.kt change package to `package org.utbot.rider.generated`
// 2. then import all unreferenced classes
// otherwise you will have broken plugin initialization and ClassNotFoundException
task generateRiderModels(type: RdGenTask) {
dependsOn(riderTask)

def riderProjectDir = riderProject.projectDir
def generatedOutputDir = new File(riderProjectDir, "src/main/kotlin/org/utbot/rider/generated")
def hashDir = generatedOutputDir
def sourcesDir = new File(currentProjectDir, "src/main/riderRdgenModels/org/utbot/rider/rd/models")
def rdParams = extensions.getByName("params") as RdGenExtension

group = "rdgen"
rdParams.verbose = true
rdParams.sources(sourcesDir)
rdParams.hashFolder = hashDir.canonicalPath
rdParams.packages = "org.utbot.rider.rd.models"
rdParams.classpath(riderModelJar)

rdParams.generator {
language = "kotlin"
transform = "symmetric"
root = "com.jetbrains.rider.model.nova.ide.IdeRoot"
directory = generatedOutputDir.canonicalPath
namespace = "org.utbot.rider.generated"
}

rdParams.generator {
language = "csharp"
transform = "symmetric"
root = "com.jetbrains.rider.model.nova.ide.IdeRoot"
namespace = "UtBot"
directory = new File(riderProjectDir, "src/dotnet/UtBot/UtBot/Generated")
}
}
}

task generateInstrumentedProcessModels(type: RdGenTask) {
def currentProjectDir = project.projectDir
def instrumentationProjectDir = project.rootProject.childProjects["utbot-instrumentation"].projectDir
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ class LoggerModel private constructor(
fun create(lifetime: Lifetime, protocol: IProtocol): LoggerModel {
LoggerRoot.register(protocol.serializers)

return LoggerModel().apply {
identify(protocol.identity, RdId.Null.mix("LoggerModel"))
bind(lifetime, protocol, "LoggerModel")
}
return LoggerModel()
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ class SettingsModel private constructor(
fun create(lifetime: Lifetime, protocol: IProtocol): SettingsModel {
SettingsRoot.register(protocol.serializers)

return SettingsModel().apply {
identify(protocol.identity, RdId.Null.mix("SettingsModel"))
bind(lifetime, protocol, "SettingsModel")
}
return SettingsModel()
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ class SynchronizationModel private constructor(
fun create(lifetime: Lifetime, protocol: IProtocol): SynchronizationModel {
SynchronizationRoot.register(protocol.serializers)

return SynchronizationModel().apply {
identify(protocol.identity, RdId.Null.mix("SynchronizationModel"))
bind(lifetime, protocol, "SynchronizationModel")
}
return SynchronizationModel()
}


Expand Down
6 changes: 6 additions & 0 deletions utbot-rd/src/main/rdgen/org/utbot/rd/models/CSharpModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,19 @@ object VSharpModel: Ext(CSharpRoot) {
field("parameters", immutableList(PredefinedType.string))
}

val mapEntry = structdef {
field("key", PredefinedType.string)
field("value", PredefinedType.string)
}

val generateArguments = structdef {
field("assemblyPath", PredefinedType.string)
field("projectCsprojPath", PredefinedType.string)
field("solutionFilePath", PredefinedType.string)
field("methods", immutableList(methodDescriptor))
field("generationTimeoutInSeconds", PredefinedType.int)
field("targetFramework", PredefinedType.string.nullable)
field("assembliesFullNameToTheirPath", immutableList(mapEntry))
}

val generateResults = structdef {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@file:Suppress("unused")

package org.utbot.rider.rd.models

import com.jetbrains.rd.generator.nova.*
import com.jetbrains.rider.model.nova.ide.SolutionModel

object UtBotRiderModel : Ext(SolutionModel.Solution) {
val startPublishArgs = structdef {
field("fileName", PredefinedType.string)
field("arguments", PredefinedType.string)
field("workingDirectory", PredefinedType.string)
}

init {
signal("startPublish", startPublishArgs).async
signal("logPublishOutput", PredefinedType.string).async
signal("logPublishError", PredefinedType.string).async
signal("stopPublish", PredefinedType.int).async

signal("startVSharp", PredefinedType.void).async
signal("logVSharp", PredefinedType.string).async
signal("stopVSharp", PredefinedType.int).async
}
}
18 changes: 10 additions & 8 deletions utbot-rider/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@ plugins {

intellij {
type.set("RD")
version.set("2023.1-SNAPSHOT")
}

dependencies {
implementation(group ="com.jetbrains.rd", name = "rd-framework", version = rdVersion)
implementation(group ="com.jetbrains.rd", name = "rd-core", version = rdVersion)
version.set("2022.3.3")
}

tasks {
register<Copy>("addRiderModelsToUtbotModels") {
val rdLibDirectory = File(project.tasks.setupDependencies.get().idea.get().classes, "lib/rd/rider-model.jar")
from(rdLibDirectory)
val utbotRd = project.rootProject.childProjects["utbot-rd"]!!
val targetDir = utbotRd.buildDir.resolve("libs")
into(targetDir)
}
val dotNetSdkCmdPath = projectDir.resolve("dotnet-sdk.cmd").toString()

compileKotlin {
Expand All @@ -29,7 +31,7 @@ tasks {
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

Expand All @@ -38,7 +40,7 @@ tasks {
}

patchPluginXml {
sinceBuild.set("231")
sinceBuild.set("223")
version.set(semVer)
}

Expand Down
Loading