Skip to content

Rider plugin #1463

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 4 commits into from
Dec 7, 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
161 changes: 88 additions & 73 deletions .github/workflows/public-rider-plugin.yml
Original file line number Diff line number Diff line change
@@ -1,73 +1,88 @@
# This is a basic workflow that is manually triggered

name: Manual workflow

# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
name:
# Friendly description to be shown in the UI instead of 'name'
description: 'It adds minor release indicator to version.'
# Default value if no value is explicitly provided
default: 'World'
# Input has to be provided for the workflow to run
required: true

env:
# Environment variable setting gradle options.
GRADLE_OPTS: "-XX:MaxHeapSize=2048m -Dorg.gradle.jvmargs='-XX:MaxHeapSize=2048m -XX:MaxPermSize=512m -Dorg.gradle.daemon=false' -Dorg.gradle.daemon=false"

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "greet"
public_rider_plugin:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
container: unittestbot/java-env:java11-zulu-jdk-gradle7.4.2-kotlinc1.7.0

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Runs a single command using the runners shell
- name: Print environment variables
run: printenv

- uses: actions/checkout@v3

- name: Set environment variables
run: |
# "You can make an environment variable available to any subsequent steps in a workflow job by
# defining or updating the environment variable and writing this to the GITHUB_ENV environment file."
echo "VERSION="$(date +%Y).$(date +%-m).${GITHUB_RUN_NUMBER}"" >> $GITHUB_ENV
echo "POSTFIX=${{ github.event.inputs.version-postfix }}" >> $GITHUB_ENV

- name: Set production version
if: ${{ github.event.inputs.version-postfix == 'no-postfix-prod' || github.event.inputs.version-postfix == 'alpha' || github.event.inputs.version-postfix == 'beta' }}
run: |
echo "VERSION="$(date +%Y).$(date +%-m)"" >> $GITHUB_ENV

- name: Set version for minor release
if: ${{ github.event.inputs.minor-release != 'none' }}
run: |
echo "VERSION=${{ env.VERSION }}.${{ github.event.inputs.minor-release }}" >> $GITHUB_ENV

- name: Create version with postfix
if: ${{ (env.POSTFIX == 'alpha') || (env.POSTFIX == 'beta') }}
run:
echo "VERSION=${{ env.VERSION }}-${{ env.POSTFIX }}" >> $GITHUB_ENV

- name: Build UTBot Rider plugin
run: |
gradle clean :utbot-rider:buildPlugin --no-daemon -PsemVer=${{ env.VERSION }} -PincludeRiderInBuild=true
cd utbot-rider/build/distributions
unzip utbot-rider-$PP env.VERSION }}.zip
rm utbot-rider-${{ env.VERSION}}.zip

- name: Archive UTBot Rider plugin
uses: actions/upload-artifact@v3
with:
name: utbot-rider-${{ env.VERSION }}
path: utbot-rider/build/distributions/*

# This is a basic workflow that is manually triggered

name: Publish Rider plugin

# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
minor-release:
type: choice
description: "It adds minor release indicator to version."
required: true
default: 'none'
options:
- 'none'
- '1'
- '2'
- '3'
- '4'

version-postfix:
type: choice
description: "It adds alpha or beta postfix to version."
required: true
default: no-postfix-prod
options:
- no-postfix-prod
- no-postfix
- alpha
- beta

env:
# Environment variable setting gradle options.
GRADLE_OPTS: "-XX:MaxHeapSize=2048m -Dorg.gradle.jvmargs='-XX:MaxHeapSize=2048m -XX:MaxPermSize=512m -Dorg.gradle.daemon=false' -Dorg.gradle.daemon=false"

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "greet"
public_rider_plugin:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
container: unittestbot/java-env:java11-zulu-jdk-gradle7.4.2-kotlinc1.7.0

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Runs a single command using the runners shell
- name: Print environment variables
run: printenv

- uses: actions/checkout@v3

- name: Set environment variables
run: |
# "You can make an environment variable available to any subsequent steps in a workflow job by
# defining or updating the environment variable and writing this to the GITHUB_ENV environment file."
echo "VERSION="$(date +%Y).$(date +%-m).${GITHUB_RUN_NUMBER}"" >> $GITHUB_ENV
echo "POSTFIX=${{ github.event.inputs.version-postfix }}" >> $GITHUB_ENV

- name: Set production version
if: ${{ github.event.inputs.version-postfix == 'no-postfix-prod' || github.event.inputs.version-postfix == 'alpha' || github.event.inputs.version-postfix == 'beta' }}
run: |
echo "VERSION="$(date +%Y).$(date +%-m)"" >> $GITHUB_ENV

- name: Set version for minor release
if: ${{ github.event.inputs.minor-release != 'none' }}
run: |
echo "VERSION=${{ env.VERSION }}.${{ github.event.inputs.minor-release }}" >> $GITHUB_ENV

- name: Create version with postfix
if: ${{ (env.POSTFIX == 'alpha') || (env.POSTFIX == 'beta') }}
run:
echo "VERSION=${{ env.VERSION }}-${{ env.POSTFIX }}" >> $GITHUB_ENV

- name: Build UTBot Rider plugin
run: |
gradle clean :utbot-rider:buildPlugin --no-daemon -PsemVer=${{ env.VERSION }} -PincludeRiderInBuild=true
cd utbot-rider/build/distributions
unzip utbot-rider-${{ env.VERSION }}.zip
rm utbot-rider-${{ env.VERSION }}.zip

- name: Archive UTBot Rider plugin
uses: actions/upload-artifact@v3
with:
name: utbot-rider-${{ env.VERSION }}
path: utbot-rider/build/distributions/*

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ target/
.gradle/
*.log
*.rdgen
utbot-intellij/src/main/resources/settings.properties
2 changes: 1 addition & 1 deletion .run/Run IDE.run.xml → .run/Run IDEA.run.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run IDE" type="GradleRunConfiguration" factoryName="Gradle">
<configuration default="false" name="Run IDEA" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$/utbot-intellij" />
Expand Down
23 changes: 23 additions & 0 deletions .run/Run Rider.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Rider" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$/utbot-rider" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="-PincludeRiderInBuild=true" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="runIde" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>
18 changes: 16 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,14 @@ collectionsVersion=0.3.4
# as they cannot be set from properties
# utbot-intellij/build.gradle.kts
# utbot-rd/build.gradle
rdVersion=2022.3.4
# utbot-rider/build.gradle.kts
intellijPluginVersion=1.7.0
# every time you bump rd version:
# 1. regenerate all models
# 2. check if rider plugin works
rdVersion=2022.2.1
# to enable - add -PincludeRiderInBuild=true in build CLI
includeRiderInBuild=false
jacocoVersion=0.8.8
commonsLangVersion=3.11
commonsIoVersion=2.8.0
Expand Down Expand Up @@ -68,9 +74,17 @@ shadowJarVersion=7.1.2
openblasVersion=0.3.10-1.5.4
arpackNgVersion=3.7.0-1.5.4

# configuration for build server
org.gradle.daemon=false
org.gradle.parallel=false
org.gradle.jvmargs="-XX:MaxHeapSize=6144m"
kotlin.compiler.execution.strategy=in-process
org.gradle.caching=false

org.gradle.caching=false
# configuration for local compilation - much faster
#org.gradle.daemon=true
#kotlin.daemon.jvm.options=-Xmx4g
#org.gradle.parallel=true
#org.gradle.caching=true
#org.gradle.workers.max=8
#org.gradle.jvmargs="-XX:MaxHeapSize=6144m"
5 changes: 5 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ val ideType: String by settings

val pythonIde: String by settings
val jsIde: String by settings
val includeRiderInBuild: String by settings

pluginManagement {
resolutionStrategy {
Expand Down Expand Up @@ -40,6 +41,10 @@ include("utbot-testing")
include("utbot-rd")
include("utbot-android-studio")

if (includeRiderInBuild.toBoolean()) {
include("utbot-rider")
}

include("utbot-ui-commons")

if (pythonIde.split(",").contains(ideType)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ class EngineProcessModel private constructor(
fun create(lifetime: Lifetime, protocol: IProtocol): EngineProcessModel {
EngineProcessRoot.register(protocol.serializers)

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


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

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

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

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

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

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


Expand Down
26 changes: 25 additions & 1 deletion utbot-rd/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'com.jetbrains.rdgen' version "2022.3.4"
id 'com.jetbrains.rdgen' version "2022.2.1"
}

import com.jetbrains.rd.generator.gradle.RdGenExtension
Expand Down Expand Up @@ -181,4 +181,28 @@ task generateCommonModels(type: RdGenTask) {
directory = generatedOutputDir.canonicalPath
namespace = "org.utbot.rd.generated"
}
}

task generateCSharpModels(type: RdGenTask) {
def currentProjectDir = project.projectDir
def riderPluginProjectDir = project.rootProject.projectDir.toPath().resolve("utbot-rider").toFile()
def generatedOutputDir = new File (riderPluginProjectDir, "src/dotnet/UtBot/UtBot.Rd/Generated")
def hashDir = generatedOutputDir
def sourcesDir = new File(currentProjectDir, "src/main/rdgen/org/utbot/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.rd.models"

rdParams.generator {
language = "csharp"
transform = "symmetric"
root = "org.utbot.rd.models.CSharpRoot"

directory = generatedOutputDir.canonicalPath
namespace = "UtBot.Rd.Generated"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ class SettingsModel private constructor(
fun create(lifetime: Lifetime, protocol: IProtocol): SettingsModel {
SettingsRoot.register(protocol.serializers)

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


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

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


Expand Down
27 changes: 27 additions & 0 deletions utbot-rd/src/main/rdgen/org/utbot/rd/models/CSharpModel.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@file:Suppress("unused")
package org.utbot.rd.models

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

object CSharpRoot: Root()

object VSharpModel: Ext(CSharpRoot) {
val generateArguments = structdef {
field("assemblyPath", PredefinedType.string)
field("projectCsprojPath", PredefinedType.string)
field("solutionFilePath", PredefinedType.string)
field("moduleFqnName", PredefinedType.string)
field("methodToken", PredefinedType.int)
field("generationTimeoutInSeconds", PredefinedType.int)
}

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

init {
call("generate", generateArguments, generateResults).async
signal("ping", PredefinedType.string).async
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@file:Suppress("unused")
package org.utbot.rd.models

import com.jetbrains.rd.generator.nova.*
Expand Down
Loading