Skip to content

Commit 0faf1b5

Browse files
authored
Rider plugin (#1463)
* [utbot-rider] 1. introducing first version of UtBot for Rider, based on VSharp symbolic engine 2. Added `Run Rider` run configuration * removed settings.properties(generated from UtSettings) from repo as it is generated automatically * rider plugin workflow * [utbor-rider] fixing cross-os vsharp start
1 parent ece8349 commit 0faf1b5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2129
-83
lines changed
Lines changed: 88 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,88 @@
1-
# This is a basic workflow that is manually triggered
2-
3-
name: Manual workflow
4-
5-
# Controls when the action will run. Workflow runs when manually triggered using the UI
6-
# or API.
7-
on:
8-
workflow_dispatch:
9-
# Inputs the workflow accepts.
10-
inputs:
11-
name:
12-
# Friendly description to be shown in the UI instead of 'name'
13-
description: 'It adds minor release indicator to version.'
14-
# Default value if no value is explicitly provided
15-
default: 'World'
16-
# Input has to be provided for the workflow to run
17-
required: true
18-
19-
env:
20-
# Environment variable setting gradle options.
21-
GRADLE_OPTS: "-XX:MaxHeapSize=2048m -Dorg.gradle.jvmargs='-XX:MaxHeapSize=2048m -XX:MaxPermSize=512m -Dorg.gradle.daemon=false' -Dorg.gradle.daemon=false"
22-
23-
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
24-
jobs:
25-
# This workflow contains a single job called "greet"
26-
public_rider_plugin:
27-
# The type of runner that the job will run on
28-
runs-on: ubuntu-20.04
29-
container: unittestbot/java-env:java11-zulu-jdk-gradle7.4.2-kotlinc1.7.0
30-
31-
# Steps represent a sequence of tasks that will be executed as part of the job
32-
steps:
33-
# Runs a single command using the runners shell
34-
- name: Print environment variables
35-
run: printenv
36-
37-
- uses: actions/checkout@v3
38-
39-
- name: Set environment variables
40-
run: |
41-
# "You can make an environment variable available to any subsequent steps in a workflow job by
42-
# defining or updating the environment variable and writing this to the GITHUB_ENV environment file."
43-
echo "VERSION="$(date +%Y).$(date +%-m).${GITHUB_RUN_NUMBER}"" >> $GITHUB_ENV
44-
echo "POSTFIX=${{ github.event.inputs.version-postfix }}" >> $GITHUB_ENV
45-
46-
- name: Set production version
47-
if: ${{ github.event.inputs.version-postfix == 'no-postfix-prod' || github.event.inputs.version-postfix == 'alpha' || github.event.inputs.version-postfix == 'beta' }}
48-
run: |
49-
echo "VERSION="$(date +%Y).$(date +%-m)"" >> $GITHUB_ENV
50-
51-
- name: Set version for minor release
52-
if: ${{ github.event.inputs.minor-release != 'none' }}
53-
run: |
54-
echo "VERSION=${{ env.VERSION }}.${{ github.event.inputs.minor-release }}" >> $GITHUB_ENV
55-
56-
- name: Create version with postfix
57-
if: ${{ (env.POSTFIX == 'alpha') || (env.POSTFIX == 'beta') }}
58-
run:
59-
echo "VERSION=${{ env.VERSION }}-${{ env.POSTFIX }}" >> $GITHUB_ENV
60-
61-
- name: Build UTBot Rider plugin
62-
run: |
63-
gradle clean :utbot-rider:buildPlugin --no-daemon -PsemVer=${{ env.VERSION }} -PincludeRiderInBuild=true
64-
cd utbot-rider/build/distributions
65-
unzip utbot-rider-$PP env.VERSION }}.zip
66-
rm utbot-rider-${{ env.VERSION}}.zip
67-
68-
- name: Archive UTBot Rider plugin
69-
uses: actions/upload-artifact@v3
70-
with:
71-
name: utbot-rider-${{ env.VERSION }}
72-
path: utbot-rider/build/distributions/*
73-
1+
# This is a basic workflow that is manually triggered
2+
3+
name: Publish Rider plugin
4+
5+
# Controls when the action will run. Workflow runs when manually triggered using the UI
6+
# or API.
7+
on:
8+
workflow_dispatch:
9+
# Inputs the workflow accepts.
10+
inputs:
11+
minor-release:
12+
type: choice
13+
description: "It adds minor release indicator to version."
14+
required: true
15+
default: 'none'
16+
options:
17+
- 'none'
18+
- '1'
19+
- '2'
20+
- '3'
21+
- '4'
22+
23+
version-postfix:
24+
type: choice
25+
description: "It adds alpha or beta postfix to version."
26+
required: true
27+
default: no-postfix-prod
28+
options:
29+
- no-postfix-prod
30+
- no-postfix
31+
- alpha
32+
- beta
33+
34+
env:
35+
# Environment variable setting gradle options.
36+
GRADLE_OPTS: "-XX:MaxHeapSize=2048m -Dorg.gradle.jvmargs='-XX:MaxHeapSize=2048m -XX:MaxPermSize=512m -Dorg.gradle.daemon=false' -Dorg.gradle.daemon=false"
37+
38+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
39+
jobs:
40+
# This workflow contains a single job called "greet"
41+
public_rider_plugin:
42+
# The type of runner that the job will run on
43+
runs-on: ubuntu-20.04
44+
container: unittestbot/java-env:java11-zulu-jdk-gradle7.4.2-kotlinc1.7.0
45+
46+
# Steps represent a sequence of tasks that will be executed as part of the job
47+
steps:
48+
# Runs a single command using the runners shell
49+
- name: Print environment variables
50+
run: printenv
51+
52+
- uses: actions/checkout@v3
53+
54+
- name: Set environment variables
55+
run: |
56+
# "You can make an environment variable available to any subsequent steps in a workflow job by
57+
# defining or updating the environment variable and writing this to the GITHUB_ENV environment file."
58+
echo "VERSION="$(date +%Y).$(date +%-m).${GITHUB_RUN_NUMBER}"" >> $GITHUB_ENV
59+
echo "POSTFIX=${{ github.event.inputs.version-postfix }}" >> $GITHUB_ENV
60+
61+
- name: Set production version
62+
if: ${{ github.event.inputs.version-postfix == 'no-postfix-prod' || github.event.inputs.version-postfix == 'alpha' || github.event.inputs.version-postfix == 'beta' }}
63+
run: |
64+
echo "VERSION="$(date +%Y).$(date +%-m)"" >> $GITHUB_ENV
65+
66+
- name: Set version for minor release
67+
if: ${{ github.event.inputs.minor-release != 'none' }}
68+
run: |
69+
echo "VERSION=${{ env.VERSION }}.${{ github.event.inputs.minor-release }}" >> $GITHUB_ENV
70+
71+
- name: Create version with postfix
72+
if: ${{ (env.POSTFIX == 'alpha') || (env.POSTFIX == 'beta') }}
73+
run:
74+
echo "VERSION=${{ env.VERSION }}-${{ env.POSTFIX }}" >> $GITHUB_ENV
75+
76+
- name: Build UTBot Rider plugin
77+
run: |
78+
gradle clean :utbot-rider:buildPlugin --no-daemon -PsemVer=${{ env.VERSION }} -PincludeRiderInBuild=true
79+
cd utbot-rider/build/distributions
80+
unzip utbot-rider-${{ env.VERSION }}.zip
81+
rm utbot-rider-${{ env.VERSION }}.zip
82+
83+
- name: Archive UTBot Rider plugin
84+
uses: actions/upload-artifact@v3
85+
with:
86+
name: utbot-rider-${{ env.VERSION }}
87+
path: utbot-rider/build/distributions/*
88+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ target/
88
.gradle/
99
*.log
1010
*.rdgen
11+
utbot-intellij/src/main/resources/settings.properties

.run/Run IDE.run.xml renamed to .run/Run IDEA.run.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<component name="ProjectRunConfigurationManager">
2-
<configuration default="false" name="Run IDE" type="GradleRunConfiguration" factoryName="Gradle">
2+
<configuration default="false" name="Run IDEA" type="GradleRunConfiguration" factoryName="Gradle">
33
<ExternalSystemSettings>
44
<option name="executionName" />
55
<option name="externalProjectPath" value="$PROJECT_DIR$/utbot-intellij" />

.run/Run Rider.run.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="Run Rider" type="GradleRunConfiguration" factoryName="Gradle">
3+
<ExternalSystemSettings>
4+
<option name="executionName" />
5+
<option name="externalProjectPath" value="$PROJECT_DIR$/utbot-rider" />
6+
<option name="externalSystemIdString" value="GRADLE" />
7+
<option name="scriptParameters" value="-PincludeRiderInBuild=true" />
8+
<option name="taskDescriptions">
9+
<list />
10+
</option>
11+
<option name="taskNames">
12+
<list>
13+
<option value="runIde" />
14+
</list>
15+
</option>
16+
<option name="vmOptions" />
17+
</ExternalSystemSettings>
18+
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
19+
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
20+
<DebugAllEnabled>false</DebugAllEnabled>
21+
<method v="2" />
22+
</configuration>
23+
</component>

gradle.properties

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,14 @@ collectionsVersion=0.3.4
3232
# as they cannot be set from properties
3333
# utbot-intellij/build.gradle.kts
3434
# utbot-rd/build.gradle
35-
rdVersion=2022.3.4
35+
# utbot-rider/build.gradle.kts
3636
intellijPluginVersion=1.7.0
37+
# every time you bump rd version:
38+
# 1. regenerate all models
39+
# 2. check if rider plugin works
40+
rdVersion=2022.2.1
41+
# to enable - add -PincludeRiderInBuild=true in build CLI
42+
includeRiderInBuild=false
3743
jacocoVersion=0.8.8
3844
commonsLangVersion=3.11
3945
commonsIoVersion=2.8.0
@@ -68,9 +74,17 @@ shadowJarVersion=7.1.2
6874
openblasVersion=0.3.10-1.5.4
6975
arpackNgVersion=3.7.0-1.5.4
7076

77+
# configuration for build server
7178
org.gradle.daemon=false
7279
org.gradle.parallel=false
7380
org.gradle.jvmargs="-XX:MaxHeapSize=6144m"
7481
kotlin.compiler.execution.strategy=in-process
82+
org.gradle.caching=false
7583

76-
org.gradle.caching=false
84+
# configuration for local compilation - much faster
85+
#org.gradle.daemon=true
86+
#kotlin.daemon.jvm.options=-Xmx4g
87+
#org.gradle.parallel=true
88+
#org.gradle.caching=true
89+
#org.gradle.workers.max=8
90+
#org.gradle.jvmargs="-XX:MaxHeapSize=6144m"

settings.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ val ideType: String by settings
22

33
val pythonIde: String by settings
44
val jsIde: String by settings
5+
val includeRiderInBuild: String by settings
56

67
pluginManagement {
78
resolutionStrategy {
@@ -40,6 +41,10 @@ include("utbot-testing")
4041
include("utbot-rd")
4142
include("utbot-android-studio")
4243

44+
if (includeRiderInBuild.toBoolean()) {
45+
include("utbot-rider")
46+
}
47+
4348
include("utbot-ui-commons")
4449

4550
if (pythonIde.split(",").contains(ideType)) {

utbot-framework/src/main/kotlin/org/utbot/framework/process/generated/EngineProcessModel.Generated.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ class EngineProcessModel private constructor(
6666
fun create(lifetime: Lifetime, protocol: IProtocol): EngineProcessModel {
6767
EngineProcessRoot.register(protocol.serializers)
6868

69-
return EngineProcessModel()
69+
return EngineProcessModel().apply {
70+
identify(protocol.identity, RdId.Null.mix("EngineProcessModel"))
71+
bind(lifetime, protocol, "EngineProcessModel")
72+
}
7073
}
7174

7275

utbot-framework/src/main/kotlin/org/utbot/framework/process/generated/RdInstrumenterAdapter.Generated.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ class RdInstrumenterAdapter private constructor(
4242
fun create(lifetime: Lifetime, protocol: IProtocol): RdInstrumenterAdapter {
4343
EngineProcessRoot.register(protocol.serializers)
4444

45-
return RdInstrumenterAdapter()
45+
return RdInstrumenterAdapter().apply {
46+
identify(protocol.identity, RdId.Null.mix("RdInstrumenterAdapter"))
47+
bind(lifetime, protocol, "RdInstrumenterAdapter")
48+
}
4649
}
4750

4851
private val __StringNullableSerializer = FrameworkMarshallers.String.nullable()

utbot-framework/src/main/kotlin/org/utbot/framework/process/generated/RdSourceFindingStrategy.Generated.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ class RdSourceFindingStrategy private constructor(
4444
fun create(lifetime: Lifetime, protocol: IProtocol): RdSourceFindingStrategy {
4545
EngineProcessRoot.register(protocol.serializers)
4646

47-
return RdSourceFindingStrategy()
47+
return RdSourceFindingStrategy().apply {
48+
identify(protocol.identity, RdId.Null.mix("RdSourceFindingStrategy"))
49+
bind(lifetime, protocol, "RdSourceFindingStrategy")
50+
}
4851
}
4952

5053
private val __StringNullableSerializer = FrameworkMarshallers.String.nullable()

utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/rd/generated/InstrumentedProcessModel.Generated.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ class InstrumentedProcessModel private constructor(
5555
fun create(lifetime: Lifetime, protocol: IProtocol): InstrumentedProcessModel {
5656
InstrumentedProcessRoot.register(protocol.serializers)
5757

58-
return InstrumentedProcessModel()
58+
return InstrumentedProcessModel().apply {
59+
identify(protocol.identity, RdId.Null.mix("InstrumentedProcessModel"))
60+
bind(lifetime, protocol, "InstrumentedProcessModel")
61+
}
5962
}
6063

6164

utbot-rd/build.gradle

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id 'com.jetbrains.rdgen' version "2022.3.4"
2+
id 'com.jetbrains.rdgen' version "2022.2.1"
33
}
44

55
import com.jetbrains.rd.generator.gradle.RdGenExtension
@@ -181,4 +181,28 @@ task generateCommonModels(type: RdGenTask) {
181181
directory = generatedOutputDir.canonicalPath
182182
namespace = "org.utbot.rd.generated"
183183
}
184+
}
185+
186+
task generateCSharpModels(type: RdGenTask) {
187+
def currentProjectDir = project.projectDir
188+
def riderPluginProjectDir = project.rootProject.projectDir.toPath().resolve("utbot-rider").toFile()
189+
def generatedOutputDir = new File (riderPluginProjectDir, "src/dotnet/UtBot/UtBot.Rd/Generated")
190+
def hashDir = generatedOutputDir
191+
def sourcesDir = new File(currentProjectDir, "src/main/rdgen/org/utbot/rd/models")
192+
def rdParams = extensions.getByName("params") as RdGenExtension
193+
194+
group = "rdgen"
195+
rdParams.verbose = true
196+
rdParams.sources(sourcesDir)
197+
rdParams.hashFolder = hashDir.canonicalPath
198+
rdParams.packages = "org.utbot.rd.models"
199+
200+
rdParams.generator {
201+
language = "csharp"
202+
transform = "symmetric"
203+
root = "org.utbot.rd.models.CSharpRoot"
204+
205+
directory = generatedOutputDir.canonicalPath
206+
namespace = "UtBot.Rd.Generated"
207+
}
184208
}

utbot-rd/src/main/kotlin/org/utbot/rd/generated/SettingsModel.Generated.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ class SettingsModel private constructor(
4343
fun create(lifetime: Lifetime, protocol: IProtocol): SettingsModel {
4444
SettingsRoot.register(protocol.serializers)
4545

46-
return SettingsModel()
46+
return SettingsModel().apply {
47+
identify(protocol.identity, RdId.Null.mix("SettingsModel"))
48+
bind(lifetime, protocol, "SettingsModel")
49+
}
4750
}
4851

4952

utbot-rd/src/main/kotlin/org/utbot/rd/generated/SynchronizationModel.Generated.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ class SynchronizationModel private constructor(
4141
fun create(lifetime: Lifetime, protocol: IProtocol): SynchronizationModel {
4242
SynchronizationRoot.register(protocol.serializers)
4343

44-
return SynchronizationModel()
44+
return SynchronizationModel().apply {
45+
identify(protocol.identity, RdId.Null.mix("SynchronizationModel"))
46+
bind(lifetime, protocol, "SynchronizationModel")
47+
}
4548
}
4649

4750

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
@file:Suppress("unused")
2+
package org.utbot.rd.models
3+
4+
import com.jetbrains.rd.generator.nova.*
5+
6+
object CSharpRoot: Root()
7+
8+
object VSharpModel: Ext(CSharpRoot) {
9+
val generateArguments = structdef {
10+
field("assemblyPath", PredefinedType.string)
11+
field("projectCsprojPath", PredefinedType.string)
12+
field("solutionFilePath", PredefinedType.string)
13+
field("moduleFqnName", PredefinedType.string)
14+
field("methodToken", PredefinedType.int)
15+
field("generationTimeoutInSeconds", PredefinedType.int)
16+
}
17+
18+
val generateResults = structdef {
19+
field("generatedProjectPath", PredefinedType.string)
20+
field("generatedFilesPaths", array(PredefinedType.string))
21+
}
22+
23+
init {
24+
call("generate", generateArguments, generateResults).async
25+
signal("ping", PredefinedType.string).async
26+
}
27+
}

utbot-rd/src/main/rdgen/org/utbot/rd/models/EngineProcessModel.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@file:Suppress("unused")
12
package org.utbot.rd.models
23

34
import com.jetbrains.rd.generator.nova.*

0 commit comments

Comments
 (0)