├── content
├── dependencies.json
├── protocol
│ ├── src
│ │ └── main
│ │ │ └── kotlin
│ │ │ └── model
│ │ │ └── rider
│ │ │ └── _._
│ └── build.gradle.kts
├── src
│ ├── rider
│ │ └── main
│ │ │ ├── kotlin
│ │ │ └── com
│ │ │ │ └── jetbrains
│ │ │ │ └── rider
│ │ │ │ └── plugins
│ │ │ │ └── sampleplugin
│ │ │ │ └── _._
│ │ │ └── resources
│ │ │ └── META-INF
│ │ │ └── plugin.xml
│ └── dotnet
│ │ ├── ReSharperPlugin.SamplePlugin
│ │ ├── ISamplePluginZone.cs
│ │ ├── ReSharperPlugin.SamplePlugin.Rider.csproj
│ │ └── ReSharperPlugin.SamplePlugin.csproj
│ │ ├── Plugin.props
│ │ ├── ReSharperPlugin.SamplePlugin.Tests
│ │ ├── test
│ │ │ └── data
│ │ │ │ └── nuget.config
│ │ ├── ReSharperPlugin.SamplePlugin.Tests.csproj
│ │ └── TestEnvironment.cs
│ │ └── Directory.Build.props
├── tools
│ ├── nuget.exe
│ └── vswhere.exe
├── gradle
│ ├── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
│ └── libs.versions.toml
├── .gitattributes
├── CHANGELOG.md
├── .gitignore
├── buildPlugin.ps1
├── README.md
├── .idea
│ ├── .idea.ReSharperPlugin.SamplePlugin
│ │ └── .idea
│ │ │ └── runConfigurations
│ │ │ ├── Rider__Frontend__Unix_.xml
│ │ │ ├── rdgen__Unix_.xml
│ │ │ ├── rdgen__Windows_.xml
│ │ │ ├── Rider__Frontend__Windows_.xml
│ │ │ ├── VisualStudio.xml
│ │ │ ├── Rider__Unix_.xml
│ │ │ └── Rider__Windows_.xml
│ └── runConfigurations
│ │ ├── Rider.xml
│ │ └── rdgen.xml
├── .github
│ └── workflows
│ │ ├── Deploy.yml
│ │ └── CI.yml
├── publishPlugin.ps1
├── settings.gradle.kts
├── gradle.properties
├── settings.ps1
├── ReSharperPlugin.SamplePlugin.sln
├── .template.config
│ └── template.json
├── runVisualStudio.ps1
├── gradlew.bat
├── build.gradle.kts
└── gradlew
├── .gitignore
├── images
└── run-configurations.png
├── install.cmd
├── unpack.cmd
├── CODE_OF_CONDUCT.md
├── JetBrains.ReSharper.SamplePlugin.nuspec
├── .github
└── workflows
│ └── release.yml
├── README.md
└── LICENSE
/content/dependencies.json:
--------------------------------------------------------------------------------
1 | [
2 | ]
3 |
--------------------------------------------------------------------------------
/content/protocol/src/main/kotlin/model/rider/_._:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /TestPlugin
2 | /.idea
3 | *.nupkg
4 | .nuke/
5 |
--------------------------------------------------------------------------------
/content/src/rider/main/kotlin/com/jetbrains/rider/plugins/sampleplugin/_._:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/content/tools/nuget.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JetBrains/resharper-rider-plugin/HEAD/content/tools/nuget.exe
--------------------------------------------------------------------------------
/content/tools/vswhere.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JetBrains/resharper-rider-plugin/HEAD/content/tools/vswhere.exe
--------------------------------------------------------------------------------
/images/run-configurations.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JetBrains/resharper-rider-plugin/HEAD/images/run-configurations.png
--------------------------------------------------------------------------------
/content/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JetBrains/resharper-rider-plugin/HEAD/content/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/content/.gitattributes:
--------------------------------------------------------------------------------
1 | # Set the default behavior, in case people don't have core.autocrlf set.
2 | * text=auto
3 |
4 | # Preserve line endings in gradle scripts
5 | gradlew* -text diff
6 |
--------------------------------------------------------------------------------
/install.cmd:
--------------------------------------------------------------------------------
1 | :; set -eo pipefail
2 | :; SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
3 | :; dotnet new uninstall ${SCRIPT_DIR}/content
4 | :; dotnet new install ${SCRIPT_DIR}/content
5 | :; exit $?
6 |
7 | dotnet new uninstall %~dp0content
8 | dotnet new install %~dp0content
9 |
--------------------------------------------------------------------------------
/content/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 | All notable changes to this project will be documented in this file.
3 |
4 | The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5 | and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6 |
7 | ## 1.0.0
8 | - Initial version
9 |
--------------------------------------------------------------------------------
/unpack.cmd:
--------------------------------------------------------------------------------
1 | :; SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
2 | :; ${SCRIPT_DIR}/install.cmd
3 | :; rm -rf ${SCRIPT_DIR}/TestPlugin
4 | :; dotnet new resharper-rider-plugin --force --name TestPlugin "$@"
5 | :; exit $?
6 |
7 | call %~dp0install.cmd
8 | dotnet new resharper-rider-plugin --force --name TestPlugin %*
9 |
--------------------------------------------------------------------------------
/content/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://cache-redirector.jetbrains.com/services.gradle.org/distributions/gradle-8.13-all.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/content/.gitignore:
--------------------------------------------------------------------------------
1 | # Build artifacts
2 | /.intellijPlatform/
3 | [Bb]in/
4 | [Oo]bj/
5 | build
6 | output
7 | .gradle
8 | .tmp
9 |
10 | # User-specific files
11 | *.suo
12 | *.user
13 | *.sln.docstates
14 | *.cache
15 |
16 | # IDEs
17 | /.idea/*.iml
18 | /.idea/*.xml
19 | /.idea/.idea.*/*.iml
20 | /.idea/.idea.*/.idea/*.xml
21 | .vs
22 | _ReSharper*
23 | _dotTrace*
24 |
--------------------------------------------------------------------------------
/content/buildPlugin.ps1:
--------------------------------------------------------------------------------
1 | Param(
2 | $Version = "9999.0.0"
3 | )
4 |
5 | Set-StrictMode -Version Latest
6 | $ErrorActionPreference = "Stop"
7 | $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
8 | Set-Location $PSScriptRoot
9 |
10 | . ".\settings.ps1"
11 |
12 | Invoke-Exe $MSBuildPath "/t:Restore;Rebuild;Pack" "$SolutionPath" "/v:minimal" "/p:PackageVersion=$Version" "/p:PackageOutputPath=`"$OutputDirectory`""
13 |
--------------------------------------------------------------------------------
/content/README.md:
--------------------------------------------------------------------------------
1 | # SamplePlugin for Rider and ReSharper
2 |
3 | [](https://plugins.jetbrains.com/plugin/RIDER_PLUGIN_ID)
4 | [](https://plugins.jetbrains.com/plugin/RESHARPER_PLUGIN_ID)
5 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # Code of Conduct
4 |
5 | This project and the corresponding community is governed by the [JetBrains Open Source and Community Code of Conduct](https://confluence.jetbrains.com/display/ALL/JetBrains+Open+Source+and+Community+Code+of+Conduct). Please make sure you read it.
6 |
--------------------------------------------------------------------------------
/content/src/dotnet/ReSharperPlugin.SamplePlugin/ISamplePluginZone.cs:
--------------------------------------------------------------------------------
1 | using JetBrains.Application.BuildScript.Application.Zones;
2 | using JetBrains.ReSharper.Feature.Services.Daemon;
3 | using JetBrains.ReSharper.Psi;
4 | using JetBrains.ReSharper.Psi.CSharp;
5 |
6 | namespace ReSharperPlugin.SamplePlugin
7 | {
8 | [ZoneDefinition]
9 | // [ZoneDefinitionConfigurableFeature("Title", "Description", IsInProductSection: false)]
10 | public interface ISamplePluginZone : IZone
11 | {
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/content/gradle/libs.versions.toml:
--------------------------------------------------------------------------------
1 | [versions]
2 | kotlin = "2.1.20" # https://plugins.jetbrains.com/docs/intellij/using-kotlin.html#kotlin-standard-library
3 | rdGen = "2025.3.1" # https://github.com/JetBrains/rd/releases
4 |
5 | [libraries]
6 | kotlinStdLib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "kotlin" }
7 | rdGen = { group = "com.jetbrains.rd", name = "rd-gen", version.ref = "rdGen" }
8 |
9 | [plugins]
10 | kotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
11 |
--------------------------------------------------------------------------------
/content/src/rider/main/resources/META-INF/plugin.xml:
--------------------------------------------------------------------------------
1 |
2 | com.jetbrains.rider.plugins.sampleplugin
3 | SamplePlugin
4 | _PLACEHOLDER_
5 | Author
6 |
7 | com.intellij.modules.rider
8 |
9 |
10 | Sample description
12 | ]]>
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/content/src/dotnet/ReSharperPlugin.SamplePlugin/ReSharperPlugin.SamplePlugin.Rider.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net472
5 | ReSharperPlugin.SamplePlugin
6 | $(AssemblyName)
7 | false
8 | $(DefineConstants);RIDER
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/content/.idea/.idea.ReSharperPlugin.SamplePlugin/.idea/runConfigurations/Rider__Frontend__Unix_.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/content/.idea/.idea.ReSharperPlugin.SamplePlugin/.idea/runConfigurations/rdgen__Unix_.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/content/.idea/.idea.ReSharperPlugin.SamplePlugin/.idea/runConfigurations/rdgen__Windows_.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/content/.idea/.idea.ReSharperPlugin.SamplePlugin/.idea/runConfigurations/Rider__Frontend__Windows_.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/content/src/dotnet/Plugin.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 2025.3.0.1
7 |
8 | SamplePlugin
9 | Description
10 |
11 | Author
12 | Copyright $([System.DateTime]::Now.Year) Maintainers of SamplePlugin
13 | resharper plugin
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/JetBrains.ReSharper.SamplePlugin.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | JetBrains.ReSharper.SamplePlugin
5 | $version$
6 | Matthias Koch
7 | JetBrains
8 |
9 |
10 |
11 | false
12 | SamplePlugin for ReSharper and Rider
13 | en-US
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/content/.github/workflows/Deploy.yml:
--------------------------------------------------------------------------------
1 | name: Deploy
2 |
3 | on:
4 | push:
5 | tags:
6 | - '*.*.*'
7 |
8 | jobs:
9 | Publish:
10 | runs-on: windows-latest
11 | steps:
12 | - uses: jlumbroso/free-disk-space@main
13 | with:
14 | tool-cache: false
15 | large-packages: false
16 | dotnet: false
17 | - uses: actions/checkout@v4
18 | with:
19 | submodules: recursive
20 | - run: ./gradlew :publishPlugin -PBuildConfiguration="Release" -PPluginVersion="${{ github.ref_name }}" -PPublishToken="${{ env.PUBLISH_TOKEN }}"
21 | env:
22 | PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
23 | - uses: actions/upload-artifact@v3
24 | if: always()
25 | name: ${{ github.event.repository.name }}.${{ github.ref_name }}
26 | path: output
27 |
--------------------------------------------------------------------------------
/content/src/dotnet/ReSharperPlugin.SamplePlugin.Tests/test/data/nuget.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/content/.idea/runConfigurations/Rider.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
11 |
16 |
17 |
18 | true
19 |
20 |
21 |
--------------------------------------------------------------------------------
/content/.idea/.idea.ReSharperPlugin.SamplePlugin/.idea/runConfigurations/VisualStudio.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/content/src/dotnet/ReSharperPlugin.SamplePlugin.Tests/ReSharperPlugin.SamplePlugin.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net472
5 | false
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/content/publishPlugin.ps1:
--------------------------------------------------------------------------------
1 | Param(
2 | [string]$Configuration = "Release",
3 | [Parameter(Mandatory=$true)]
4 | [string]$Version,
5 | [Parameter(Mandatory=$true)]
6 | [string]$ApiKey
7 | )
8 |
9 | Set-StrictMode -Version Latest
10 | $ErrorActionPreference = "Stop"
11 | $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
12 | Set-Location $PSScriptRoot
13 |
14 | . ".\settings.ps1"
15 |
16 | $ChangelogText = ([Regex]::Matches([System.IO.File]::ReadAllText("$PSScriptRoot\CHANGELOG.md"), '(?s)(##.+?.+?)(?=##|$)').Captures | Select -First 10) -Join ''
17 |
18 | Invoke-Exe $MSBuildPath "/t:Restore;Rebuild;Pack" "$SolutionPath" "/v:minimal" "/p:Configuration=$Configuration" "/p:PackageOutputPath=$OutputDirectory" "/p:PackageVersion=$Version" "/p:PackageReleaseNotes=`"$ChangelogText`""
19 | $PackageFile = "$OutputDirectory\$PluginId.$Version*.nupkg"
20 | Invoke-Exe $NuGetPath push $PackageFile -Source "https://plugins.jetbrains.com/api/v2/package" -ApiKey $ApiKey
21 |
--------------------------------------------------------------------------------
/content/src/dotnet/ReSharperPlugin.SamplePlugin.Tests/TestEnvironment.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using JetBrains.Application.BuildScript.Application.Zones;
3 | using JetBrains.ReSharper.Feature.Services;
4 | using JetBrains.ReSharper.Psi.CSharp;
5 | using JetBrains.ReSharper.TestFramework;
6 | using JetBrains.TestFramework;
7 | using JetBrains.TestFramework.Application.Zones;
8 | using NUnit.Framework;
9 |
10 | [assembly: Apartment(ApartmentState.STA)]
11 |
12 | namespace ReSharperPlugin.SamplePlugin.Tests
13 | {
14 | [ZoneDefinition]
15 | public class SamplePluginTestEnvironmentZone : ITestsEnvZone, IRequire, IRequire { }
16 |
17 | [ZoneMarker]
18 | public class ZoneMarker : IRequire, IRequire, IRequire { }
19 |
20 | [SetUpFixture]
21 | public class SamplePluginTestsAssembly : ExtensionTestEnvironmentAssembly { }
22 | }
23 |
--------------------------------------------------------------------------------
/content/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | // Provide repositories to resolve plugins
3 | repositories {
4 | maven { setUrl("https://cache-redirector.jetbrains.com/plugins.gradle.org") }
5 | maven { setUrl("https://cache-redirector.jetbrains.com/maven-central") }
6 | maven { setUrl("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlin-eap") }
7 | }
8 | resolutionStrategy {
9 | eachPlugin {
10 | // Gradle has to map a plugin dependency to Maven coordinates - '{groupId}:{artifactId}:{version}'. It tries
11 | // to do use '{plugin.id}:{plugin.id}.gradle.plugin:version'.
12 | // This doesn't work for rdgen, so we provide some help
13 | if (requested.id.id == "com.jetbrains.rdgen") {
14 | useModule("com.jetbrains.rd:rd-gen:${requested.version}")
15 | }
16 | }
17 | }
18 | }
19 |
20 | rootProject.name = "ReSharperPlugin.SamplePlugin"
21 |
22 | include(":protocol")
23 |
--------------------------------------------------------------------------------
/content/gradle.properties:
--------------------------------------------------------------------------------
1 | # Any property can be overwritten from command-line via
2 | # -P=
3 |
4 | DotnetPluginId=ReSharperPlugin.SamplePlugin
5 | DotnetSolution=ReSharperPlugin.SamplePlugin.sln
6 | RiderPluginId=com.jetbrains.rider.plugins.sampleplugin
7 | PluginVersion=9999.0.0
8 |
9 | BuildConfiguration=Debug
10 |
11 | PublishToken="_PLACEHOLDER_"
12 |
13 | # See https://www.jetbrains.com/intellij-repository/snapshots
14 | # Keep in sync with SdkVersion in Plugin.props -->
15 | #
16 | # Examples:
17 | # Release: 2020.2
18 | # EAP: 2020.3-EAP2-SNAPSHOT
19 | # Nightly: 2020.3-SNAPSHOT
20 | ProductVersion=2025.3
21 |
22 | # Kotlin 1.4 will bundle the stdlib dependency by default, causing problems with the version bundled with the IDE
23 | # https://blog.jetbrains.com/kotlin/2020/07/kotlin-1-4-rc-released/#stdlib-default
24 | kotlin.stdlib.default.dependency=false
25 |
26 | # Required to download Rider artifacts from Maven (and not "binary" releases from CDN).
27 | org.jetbrains.intellij.platform.buildFeature.useBinaryReleases=false
28 |
--------------------------------------------------------------------------------
/content/src/dotnet/ReSharperPlugin.SamplePlugin/ReSharperPlugin.SamplePlugin.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net472
5 | True
6 | $(DefineConstants);RESHARPER
7 | false
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/content/.idea/runConfigurations/rdgen.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | true
19 | true
20 | false
21 | false
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/.github/workflows/release.yml:
--------------------------------------------------------------------------------
1 | name: template
2 |
3 | on:
4 | push:
5 | tags:
6 | - '*.*.*'
7 |
8 | jobs:
9 | build:
10 | name: Create Release
11 | runs-on: windows-latest
12 | steps:
13 | - uses: actions/checkout@v4
14 | - run: .\content\tools\nuget.exe pack JetBrains.ReSharper.SamplePlugin.nuspec -NoPackageAnalysis -NoDefaultExcludes -Version ${{ github.ref_name }}
15 | - uses: actions/create-release@v1
16 | id: create_release
17 | env:
18 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19 | with:
20 | tag_name: ${{ github.ref_name }}
21 | release_name: ${{ github.ref_name }}
22 | draft: true
23 | - uses: actions/upload-release-asset@v1
24 | env:
25 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26 | with:
27 | upload_url: ${{ steps.create_release.outputs.upload_url }}
28 | asset_path: JetBrains.ReSharper.SamplePlugin.${{ github.ref_name }}.nupkg
29 | asset_name: JetBrains.ReSharper.SamplePlugin.${{ github.ref_name }}.nupkg
30 | asset_content_type: application/zip
31 |
--------------------------------------------------------------------------------
/content/.idea/.idea.ReSharperPlugin.SamplePlugin/.idea/runConfigurations/Rider__Unix_.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/content/.idea/.idea.ReSharperPlugin.SamplePlugin/.idea/runConfigurations/Rider__Windows_.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/content/src/dotnet/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Latest
5 | MSB3277
6 | true
7 | false
8 | None
9 |
10 | obj\$(MSBuildProjectName)\
11 | $(DefaultItemExcludes);obj\**
12 | bin\$(MSBuildProjectName)\$(Configuration)\
13 |
14 |
15 |
16 | TRACE;DEBUG;JET_MODE_ASSERT
17 |
18 |
19 |
20 |
21 |
22 | $(SdkVersion.Substring(2,2))$(SdkVersion.Substring(5,1)).0.0
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | JetResourceGenerator
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/content/protocol/build.gradle.kts:
--------------------------------------------------------------------------------
1 | import com.jetbrains.rd.generator.gradle.RdGenTask
2 |
3 | plugins {
4 | id("org.jetbrains.kotlin.jvm")
5 | id("com.jetbrains.rdgen") version libs.versions.rdGen
6 | }
7 |
8 | dependencies {
9 | implementation(libs.kotlinStdLib)
10 | implementation(libs.rdGen)
11 | implementation(
12 | project(
13 | mapOf(
14 | "path" to ":",
15 | "configuration" to "riderModel"
16 | )
17 | )
18 | )
19 | }
20 |
21 | val DotnetPluginId: String by rootProject
22 | val RiderPluginId: String by rootProject
23 |
24 | rdgen {
25 | val csOutput = File(rootDir, "src/dotnet/${DotnetPluginId}")
26 | val ktOutput = File(rootDir, "src/rider/main/kotlin/com/jetbrains/rider/plugins/${RiderPluginId.replace('.','/').toLowerCase()}")
27 |
28 | verbose = true
29 | packages = "model.rider"
30 |
31 | generator {
32 | language = "kotlin"
33 | transform = "asis"
34 | root = "com.jetbrains.rider.model.nova.ide.IdeRoot"
35 | namespace = "com.jetbrains.rider.model"
36 | directory = "$ktOutput"
37 | }
38 |
39 | generator {
40 | language = "csharp"
41 | transform = "reversed"
42 | root = "com.jetbrains.rider.model.nova.ide.IdeRoot"
43 | namespace = "JetBrains.Rider.Model"
44 | directory = "$csOutput"
45 | }
46 | }
47 |
48 | tasks.withType {
49 | val classPath = sourceSets["main"].runtimeClasspath
50 | dependsOn(classPath)
51 | classpath(classPath)
52 | }
53 |
--------------------------------------------------------------------------------
/content/.github/workflows/CI.yml:
--------------------------------------------------------------------------------
1 | name: CI
2 |
3 | on: [push, pull_request]
4 |
5 | jobs:
6 | Build:
7 | runs-on: windows-latest
8 | steps:
9 | - uses: jlumbroso/free-disk-space@main
10 | with:
11 | tool-cache: false
12 | large-packages: false
13 | dotnet: false
14 | - uses: actions/checkout@v4
15 | with:
16 | submodules: recursive
17 | - uses: actions/cache@v4
18 | with:
19 | path: |
20 | build/gradle-jvm
21 | ~/.nuget/packages
22 | ~/.gradle/caches
23 | ~/.gradle/wrapper
24 | key: ${{ runner.os }}-Build-${{ hashFiles('gradlew.bat', 'src/dotnet/*/*.csproj', 'src/dotnet/*.props', 'gradle-wrapper.properties') }}
25 | - run: ./gradlew :buildPlugin --no-daemon
26 | - uses: actions/upload-artifact@v4
27 | if: always()
28 | with:
29 | name: ${{ github.event.repository.name }}.CI.${{ github.ref_name }}
30 | path: output
31 | Test:
32 | runs-on: windows-latest
33 | steps:
34 | - uses: actions/checkout@v4
35 | with:
36 | submodules: recursive
37 | - uses: actions/cache@v4
38 | with:
39 | path: |
40 | build/gradle-jvm
41 | packages
42 | ~/.nuget/packages
43 | ~/.gradle/caches
44 | ~/.gradle/wrapper
45 | key: ${{ runner.os }}-Test-${{ hashFiles('gradlew.bat', 'src/dotnet/*/*.csproj', 'src/dotnet/*.props', 'gradle-wrapper.properties') }}
46 | - run: ./gradlew :testDotNet --no-daemon
47 |
--------------------------------------------------------------------------------
/content/settings.ps1:
--------------------------------------------------------------------------------
1 | $PluginId = "ReSharperPlugin.SamplePlugin"
2 | $SolutionPath = "$PSScriptRoot\ReSharperPlugin.SamplePlugin.sln"
3 | $SourceBasePath = "$PSScriptRoot\src\dotnet"
4 |
5 | $VsWhereOutput = [xml] (& "$PSScriptRoot\tools\vswhere.exe" -format xml -products *)
6 | $VisualStudio = $VsWhereOutput.instances.instance |
7 | Where-Object { $_.channelId -match "Release" } |
8 | Sort-Object -Property installationVersion |
9 | Select-Object -Last 1
10 |
11 | $VisualStudioBaseDirectory = $VisualStudio.installationPath
12 | $VisualStudioMajorVersion = ($VisualStudio.installationVersion -split '\.')[0]
13 | $VisualStudioInstanceId = $VisualStudio.instanceId
14 | $DevEnvPath = Get-ChildItem "$VisualStudioBaseDirectory\*\IDE\devenv.exe"
15 | $MSBuildPath = Get-ChildItem "$VisualStudioBaseDirectory\MSBuild\*\Bin\MSBuild.exe"
16 |
17 | $OutputDirectory = "$PSScriptRoot\output"
18 | $NuGetPath = "$PSScriptRoot\tools\nuget.exe"
19 |
20 | Function Invoke-Exe {
21 | param(
22 | [parameter(mandatory=$true,position=0)] [ValidateNotNullOrEmpty()] [string] $Executable,
23 | [Parameter(ValueFromRemainingArguments=$true)][String[]] $Arguments,
24 | [parameter(mandatory=$false)] [array] $ValidExitCodes = @(0)
25 | )
26 |
27 | Write-Host "> $Executable $Arguments"
28 | $rc = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Passthru
29 | $rc.Handle # to initialize handle according to https://stackoverflow.com/a/23797762/2684760
30 | $rc.WaitForExit()
31 | if (-Not $ValidExitCodes.Contains($rc.ExitCode)) {
32 | throw "'$Executable $Arguments' failed with exit code $($rc.ExitCode), valid exit codes: $ValidExitCodes"
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/content/ReSharperPlugin.SamplePlugin.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReSharperPlugin.SamplePlugin", "src\dotnet\ReSharperPlugin.SamplePlugin\ReSharperPlugin.SamplePlugin.csproj", "{05608FE6-4FD1-4E9D-9BE2-B13A0E370BA2}"
4 | EndProject
5 | #if (!resharper-only)
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReSharperPlugin.SamplePlugin.Rider", "src\dotnet\ReSharperPlugin.SamplePlugin\ReSharperPlugin.SamplePlugin.Rider.csproj", "{084172D1-A9C6-46D0-96AD-05C5B09A5E5D}"
7 | EndProject
8 | #endif
9 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReSharperPlugin.SamplePlugin.Tests", "src\dotnet\ReSharperPlugin.SamplePlugin.Tests\ReSharperPlugin.SamplePlugin.Tests.csproj", "{01C3DEF5-50B2-47CB-9467-19BC6DDF9D3D}"
10 | EndProject
11 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "misc", "misc", "{4A9ABB95-3762-448B-B5BF-099E46DB22DE}"
12 | ProjectSection(SolutionItems) = preProject
13 | src\dotnet\Plugin.props = src\dotnet\Plugin.props
14 | README.md = README.md
15 | CHANGELOG.md = CHANGELOG.md
16 | #if (!resharper-only)
17 | src\rider\main\resources\META-INF\plugin.xml = src\rider\main\resources\META-INF\plugin.xml
18 | build.gradle.kts = build.gradle.kts
19 | gradle.properties = gradle.properties
20 | #endif
21 | EndProjectSection
22 | EndProject
23 | Global
24 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
25 | Debug|Any CPU = Debug|Any CPU
26 | Release|Any CPU = Release|Any CPU
27 | EndGlobalSection
28 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
29 | {05608FE6-4FD1-4E9D-9BE2-B13A0E370BA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
30 | {05608FE6-4FD1-4E9D-9BE2-B13A0E370BA2}.Debug|Any CPU.Build.0 = Debug|Any CPU
31 | {05608FE6-4FD1-4E9D-9BE2-B13A0E370BA2}.Release|Any CPU.ActiveCfg = Release|Any CPU
32 | {05608FE6-4FD1-4E9D-9BE2-B13A0E370BA2}.Release|Any CPU.Build.0 = Release|Any CPU
33 | {084172D1-A9C6-46D0-96AD-05C5B09A5E5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
34 | {084172D1-A9C6-46D0-96AD-05C5B09A5E5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
35 | {084172D1-A9C6-46D0-96AD-05C5B09A5E5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
36 | {084172D1-A9C6-46D0-96AD-05C5B09A5E5D}.Release|Any CPU.Build.0 = Release|Any CPU
37 | {01C3DEF5-50B2-47CB-9467-19BC6DDF9D3D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
38 | {01C3DEF5-50B2-47CB-9467-19BC6DDF9D3D}.Debug|Any CPU.Build.0 = Debug|Any CPU
39 | {01C3DEF5-50B2-47CB-9467-19BC6DDF9D3D}.Release|Any CPU.ActiveCfg = Release|Any CPU
40 | {01C3DEF5-50B2-47CB-9467-19BC6DDF9D3D}.Release|Any CPU.Build.0 = Release|Any CPU
41 | EndGlobalSection
42 | EndGlobal
43 |
--------------------------------------------------------------------------------
/content/.template.config/template.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://json.schemastore.org/template",
3 | "author": "Matthias Koch",
4 | "classifications": [ "jetbrains", "resharper", "rider" ],
5 | "name": "ReSharper/Rider Plugin",
6 | "identity": "JetBrains.ReSharper.SamplePlugin",
7 | "shortName": "resharper-rider-plugin",
8 | "tags": {
9 | "type": "project",
10 | "language": "C#",
11 | "platform": ".NET",
12 | "hasMultipleProjects": "true"
13 | },
14 | "sourceName": "SamplePlugin",
15 | "preferNameDirectory" : true,
16 | "primaryOutputs": [
17 | ],
18 | "symbols": {
19 | "build-only":{
20 | "type": "parameter",
21 | "dataType":"bool",
22 | "defaultValue": "false",
23 | "description": "Only emit files related to build infrastructure."
24 | },
25 | "resharper-only":{
26 | "type": "parameter",
27 | "dataType":"bool",
28 | "defaultValue": "false",
29 | "description": "Only emit files relevant for ReSharper plugins (no Rider)."
30 | },
31 | "version":{
32 | "type": "parameter",
33 | "dataType":"string",
34 | "defaultValue": "2023.1",
35 | "replaces":"2023.1"
36 | },
37 | "github-actions":{
38 | "type": "parameter",
39 | "dataType":"bool",
40 | "defaultValue": "false",
41 | "description": "Include GitHub Actions workflow files."
42 | },
43 | "lowerCaseName":{
44 | "type": "generated",
45 | "generator": "casing",
46 | "parameters": {
47 | "source":"name",
48 | "toLower": true
49 | },
50 | "fileRename": "sampleplugin"
51 | }
52 | },
53 | "sources": [
54 | {
55 | "modifiers": [
56 | {
57 | "condition": "(resharper-only)",
58 | "exclude": [
59 | ".idea/**/Rider*.xml",
60 | ".idea/**/rdgen*.xml",
61 | "gradle/**/*",
62 | "protocol/**/*",
63 | "src/dotnet/**/*.Rider.csproj",
64 | "src/rider/**/*",
65 | "build.gradle.kts",
66 | "gradle.properties",
67 | "gradlew",
68 | "gradlew.bat",
69 | "settings.gradle.kts"
70 | ]
71 | },
72 | {
73 | "condition": "(build-only)",
74 | "exclude": [
75 | ".gitattributes",
76 | ".gitignore",
77 | "CHANGELOG.md",
78 | "README.md",
79 | "ReSharperPlugin.SamplePlugin.sln",
80 | "src/dotnet/*/**/*",
81 | "src/dotnet/Plugin.props",
82 | "src/rider/main/resources/META-INF/plugin.xml"
83 | ]
84 | },
85 | {
86 | "condition": "(!github-actions)",
87 | "exclude": [
88 | ".github/workflows/*"
89 | ]
90 | }
91 | ]
92 | }
93 | ],
94 | "postActions": [
95 | {
96 | "condition": "(OS != \"Windows_NT\" && !resharper-only)",
97 | "description": "Make gradlew executable",
98 | "manualInstructions": [ { "text": "Make gradlew executable" } ],
99 | "actionId": "cb9a6cf3-4f5c-4860-b9d2-03a574959774",
100 | "args": {
101 | "+x": "gradlew"
102 | },
103 | "continueOnError": true
104 | }
105 | ]
106 | }
107 |
--------------------------------------------------------------------------------
/content/runVisualStudio.ps1:
--------------------------------------------------------------------------------
1 | Param(
2 | $RootSuffix = "SamplePlugin",
3 | $Version = "9999.0.0"
4 | )
5 |
6 | Set-StrictMode -Version Latest
7 | $ErrorActionPreference = "Stop"
8 | $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
9 | Set-Location $PSScriptRoot
10 |
11 | . ".\settings.ps1"
12 |
13 | $UserProjectXmlFile = "$SourceBasePath\$PluginId\$PluginId.csproj.user"
14 |
15 | if (!(Test-Path "$UserProjectXmlFile")) {
16 | # Get versions from Plugin.props file
17 | $PluginPropsFile = "$SourceBasePath\Plugin.props"
18 | $PluginPropsXml = [xml] (Get-Content "$PluginPropsFile")
19 | $SdkVersionNode = $PluginPropsXml.SelectSingleNode(".//SdkVersion")
20 | $VersionSplit = $SdkVersionNode.InnerText.Split(".")
21 | $MajorVersion = "$($VersionSplit[0]).$($VersionSplit[1])"
22 |
23 | # Determine download link
24 | $ReleaseUrl = "https://data.services.jetbrains.com/products/releases?code=RSU&type=eap&type=release&majorVersion=$MajorVersion"
25 | $VersionEntry = $(Invoke-WebRequest -UseBasicParsing $ReleaseUrl | ConvertFrom-Json).RSU[0]
26 | ## TODO: check versions
27 | $DownloadLink = [uri] ($VersionEntry.downloads.windows.link.replace(".exe", ".Checked.exe"))
28 |
29 | # Download installer
30 | $InstallerFile = "$env:TEMP\JetBrains\Installer.Offline\$($DownloadLink.Segments[-1])"
31 | if (!(Test-Path $InstallerFile)) {
32 | Write-Output "Downloading $($DownloadLink.Segments[-2].TrimEnd("/")) installer"
33 | Start-BitsTransfer -Source $DownloadLink -Destination $InstallerFile
34 | } else {
35 | Write-Output "Using cached installer from $InstallerFile"
36 | }
37 |
38 | # Execute installer
39 | Write-Output "Installing experimental hive"
40 | Invoke-Exe $InstallerFile "/VsVersion=$VisualStudioMajorVersion.0" "/SpecificProductNames=ReSharper" "/Hive=$RootSuffix" "/Silent=True"
41 |
42 | $Installations = @(Get-ChildItem "$env:LOCALAPPDATA\JetBrains\ReSharperPlatformVs$VisualStudioMajorVersion\vAny_$VisualStudioInstanceId$RootSuffix\NuGet.Config")
43 | if ($Installations.Count -ne 1) { Write-Error "Found no or multiple installation directories: $Installations" }
44 | $InstallationDirectory = $Installations.Directory
45 | Write-Host "Found installation directory at $InstallationDirectory"
46 |
47 | # Adapt packages.config
48 | if (Test-Path "$InstallationDirectory\packages.config") {
49 | $PackagesXml = [xml] (Get-Content "$InstallationDirectory\packages.config")
50 | } else {
51 | $PackagesXml = [xml] ("")
52 | }
53 |
54 | if ($null -eq $PackagesXml.SelectSingleNode(".//package[@id='$PluginId']/@id")) {
55 | $PluginNode = $PackagesXml.CreateElement('package')
56 | $PluginNode.setAttribute("id", "$PluginId")
57 | $PluginNode.setAttribute("version", "$Version")
58 |
59 | $PackagesNode = $PackagesXml.SelectSingleNode("//packages")
60 | $PackagesNode.AppendChild($PluginNode) > $null
61 |
62 | $PackagesXml.Save("$InstallationDirectory\packages.config")
63 | }
64 |
65 | # Adapt user project file
66 | $HostIdentifier = "$($InstallationDirectory.Parent.Name)_$($InstallationDirectory.Name.Split('_')[-1])"
67 |
68 | Set-Content -Path "$UserProjectXmlFile" -Value ""
69 |
70 | $ProjectXml = [xml] (Get-Content "$UserProjectXmlFile")
71 | $HostIdentifierNode = $ProjectXml.SelectSingleNode(".//HostFullIdentifier")
72 | $HostIdentifierNode.InnerText = $HostIdentifier
73 | $ProjectXml.Save("$UserProjectXmlFile")
74 |
75 | # Install plugin
76 | $PluginRepository = "$env:LOCALAPPDATA\JetBrains\plugins"
77 | Remove-Item "$PluginRepository\${PluginId}.${Version}" -Recurse -ErrorAction Ignore
78 | Invoke-Exe $MSBuildPath "/t:Restore;Rebuild;Pack" "$SolutionPath" "/v:minimal" "/p:PackageVersion=$Version" "/p:PackageOutputPath=`"$OutputDirectory`""
79 | Invoke-Exe $NuGetPath install $PluginId -OutputDirectory "$PluginRepository" -Source "$OutputDirectory" -DependencyVersion Ignore
80 |
81 | Write-Output "Re-installing experimental hive"
82 | Invoke-Exe "$InstallerFile" "/VsVersion=$VisualStudioMajorVersion.0" "/SpecificProductNames=ReSharper" "/Hive=$RootSuffix" "/Silent=True"
83 | } else {
84 | Write-Warning "Plugin is already installed. To trigger reinstall, delete $UserProjectXmlFile."
85 | }
86 |
87 | Invoke-Exe $MSBuildPath "/t:Restore;Rebuild" "$SolutionPath" "/v:minimal"
88 | Invoke-Exe $DevEnvPath "/rootSuffix $RootSuffix" "/ReSharper.Internal" "/ReSharper.LogFile $PSScriptRoot\ReSharper.log" "/ReSharper.LogLevel Trace"
89 |
--------------------------------------------------------------------------------
/content/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%"=="" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%"=="" set DIRNAME=.
29 | @rem This is normally unused
30 | set APP_BASE_NAME=%~n0
31 | set APP_HOME=%DIRNAME%
32 |
33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
35 |
36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
38 |
39 | @rem GRADLE JVM WRAPPER START MARKER
40 |
41 | setlocal
42 | set BUILD_DIR=%LOCALAPPDATA%\gradle-jvm
43 | set JVM_TARGET_DIR=%BUILD_DIR%\jdk-17.0.3.1_windows-x64_bin-d6ede5\
44 |
45 | set JVM_URL=https://download.oracle.com/java/17/archive/jdk-17.0.3.1_windows-x64_bin.zip
46 |
47 | set IS_TAR_GZ=0
48 | set JVM_TEMP_FILE=gradle-jvm.zip
49 |
50 | if /I "%JVM_URL:~-7%"==".tar.gz" (
51 | set IS_TAR_GZ=1
52 | set JVM_TEMP_FILE=gradle-jvm.tar.gz
53 | )
54 |
55 | set POWERSHELL=%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe
56 |
57 | if not exist "%JVM_TARGET_DIR%" MD "%JVM_TARGET_DIR%"
58 |
59 | if not exist "%JVM_TARGET_DIR%.flag" goto downloadAndExtractJvm
60 |
61 | set /p CURRENT_FLAG=<"%JVM_TARGET_DIR%.flag"
62 | if "%CURRENT_FLAG%" == "%JVM_URL%" goto continueWithJvm
63 |
64 | :downloadAndExtractJvm
65 |
66 | PUSHD "%BUILD_DIR%"
67 | if errorlevel 1 goto fail
68 |
69 | echo Downloading %JVM_URL% to %BUILD_DIR%\%JVM_TEMP_FILE%
70 | if exist "%JVM_TEMP_FILE%" DEL /F "%JVM_TEMP_FILE%"
71 | "%POWERSHELL%" -nologo -noprofile -Command "Set-StrictMode -Version 3.0; $ErrorActionPreference = \"Stop\"; (New-Object Net.WebClient).DownloadFile('%JVM_URL%', '%JVM_TEMP_FILE%')"
72 | if errorlevel 1 goto fail
73 |
74 | POPD
75 |
76 | RMDIR /S /Q "%JVM_TARGET_DIR%"
77 | if errorlevel 1 goto fail
78 |
79 | MKDIR "%JVM_TARGET_DIR%"
80 | if errorlevel 1 goto fail
81 |
82 | PUSHD "%JVM_TARGET_DIR%"
83 | if errorlevel 1 goto fail
84 |
85 | echo Extracting %BUILD_DIR%\%JVM_TEMP_FILE% to %JVM_TARGET_DIR%
86 |
87 | if "%IS_TAR_GZ%"=="1" (
88 | tar xf "..\\%JVM_TEMP_FILE%"
89 | ) else (
90 | "%POWERSHELL%" -nologo -noprofile -command "Set-StrictMode -Version 3.0; $ErrorActionPreference = \"Stop\"; Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::ExtractToDirectory('..\\%JVM_TEMP_FILE%', '.');"
91 | )
92 | if errorlevel 1 goto fail
93 |
94 | DEL /F "..\%JVM_TEMP_FILE%"
95 | if errorlevel 1 goto fail
96 |
97 | POPD
98 |
99 | echo %JVM_URL%>"%JVM_TARGET_DIR%.flag"
100 | if errorlevel 1 goto fail
101 |
102 | :continueWithJvm
103 |
104 | set JAVA_HOME=
105 | for /d %%d in ("%JVM_TARGET_DIR%"*) do if exist "%%d\bin\java.exe" set JAVA_HOME=%%d
106 | if not exist "%JAVA_HOME%\bin\java.exe" (
107 | echo Unable to find java.exe under %JVM_TARGET_DIR%
108 | goto fail
109 | )
110 |
111 | endlocal & set JAVA_HOME=%JAVA_HOME%
112 |
113 | @rem GRADLE JVM WRAPPER END MARKER
114 |
115 | @rem Find java.exe
116 | if defined JAVA_HOME goto findJavaFromJavaHome
117 |
118 | set JAVA_EXE=java.exe
119 | %JAVA_EXE% -version >NUL 2>&1
120 | if %ERRORLEVEL% equ 0 goto execute
121 |
122 | echo. 1>&2
123 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
124 | echo. 1>&2
125 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
126 | echo location of your Java installation. 1>&2
127 |
128 | goto fail
129 |
130 | :findJavaFromJavaHome
131 | set JAVA_HOME=%JAVA_HOME:"=%
132 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
133 |
134 | if exist "%JAVA_EXE%" goto execute
135 |
136 | echo. 1>&2
137 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
138 | echo. 1>&2
139 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
140 | echo location of your Java installation. 1>&2
141 |
142 | goto fail
143 |
144 | :execute
145 | @rem Setup the command line
146 |
147 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
148 |
149 |
150 | @rem Execute Gradle
151 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
152 |
153 | :end
154 | @rem End local scope for the variables with windows NT shell
155 | if %ERRORLEVEL% equ 0 goto mainEnd
156 |
157 | :fail
158 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
159 | rem the _cmd.exe /c_ return code!
160 | set EXIT_CODE=%ERRORLEVEL%
161 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
162 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
163 | exit /b %EXIT_CODE%
164 |
165 | :mainEnd
166 | if "%OS%"=="Windows_NT" endlocal
167 |
168 | :omega
169 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)
2 |
3 | # Plugin Template for ReSharper and Rider
4 |
5 | This repository defines a template for easy development of ReSharper and Rider plugins according to the official documentation for the [ReSharper SDK](https://www.jetbrains.com/help/resharper/sdk) and [IntelliJ SDK](http://www.jetbrains.org/intellij/sdk/docs/welcome.html).
6 |
7 | ## Getting Started
8 |
9 | Download the `JetBrains.ReSharper.SamplePlugin.*.nupkg` template package from the [releases page](https://github.com/JetBrains/resharper-rider-plugin/releases) and invoke from the download directory:
10 |
11 | ```
12 | dotnet new install JetBrains.ReSharper.SamplePlugin.*.nupkg
13 | ```
14 |
15 | Afterwards, a new project can be created from the installed template. The `name` identifier should be letters-only:
16 |
17 | ```
18 | dotnet new resharper-rider-plugin --name MyAwesomePlugin [--resharper-only] [--build-only]
19 | ```
20 |
21 | > **Warning**
22 | > The template comes with its own solution file. Therefore, it MUST be used from the command-line as shown above.
23 |
24 | This will create a new folder with all the structure ready to go and all identifiers, like namespaces, ids and file names, replaced with `MyAwesomePlugin`. Passing `--resharper-only` will exclude all Rider related files. With the `--build-only --force`, all the build-relevant files can be updated (some reverts are most likely necessary). Metadata including project website, description, author and others should be entered in `Plugin.props` and `plugins.xml`.
25 |
26 |
27 | > **Warning**
28 | > The only place that currently needs to be updated manually is the `RIDER_PLUGIN_ID` in `README.md`, which you'll only get after uploading your Rider plugin the first time.
29 |
30 | ## Samples
31 |
32 | This repository contains a few sample projects for various extension points:
33 |
34 | - [Actions](https://github.com/JetBrains/resharper-rider-plugin/tree/fed252a46dd66ae2f3b012fac3db0d51049ea3fb/samples/Actions)
35 | - [Code Inspections](https://github.com/JetBrains/resharper-rider-plugin/tree/fed252a46dd66ae2f3b012fac3db0d51049ea3fb/samples/CodeInspections)
36 | - [Code Vision](https://github.com/JetBrains/resharper-rider-plugin/tree/fed252a46dd66ae2f3b012fac3db0d51049ea3fb/samples/CodeVision)
37 | - [Inlay Hints](https://github.com/JetBrains/resharper-rider-plugin/tree/fed252a46dd66ae2f3b012fac3db0d51049ea3fb/samples/InlayHints)
38 | - [Notifications](https://github.com/JetBrains/resharper-rider-plugin/tree/fed252a46dd66ae2f3b012fac3db0d51049ea3fb/samples/Notifications)
39 | - [Option Pages](https://github.com/JetBrains/resharper-rider-plugin/tree/fed252a46dd66ae2f3b012fac3db0d51049ea3fb/samples/OptionPages)
40 | - [Postfix Templates](https://github.com/JetBrains/resharper-rider-plugin/tree/fed252a46dd66ae2f3b012fac3db0d51049ea3fb/samples/PostfixTemplates)
41 | - [Rd Protocol](https://github.com/JetBrains/resharper-rider-plugin/tree/fed252a46dd66ae2f3b012fac3db0d51049ea3fb/samples/RdProtocol)
42 | - [Settings Provider](https://github.com/JetBrains/resharper-rider-plugin/tree/fed252a46dd66ae2f3b012fac3db0d51049ea3fb/samples/SettingsProvider)
43 |
44 | ## Development
45 |
46 | For general development, there are a couple of scripts/invocations worth knowing. Most importantly, to run and debug your plugin, invoke:
47 |
48 | ```
49 | # For Rider
50 | gradlew :runIde
51 |
52 | # For ReSharper (VisualStudio)
53 | powershell .\runVisualStudio.ps1
54 | ```
55 |
56 | If your Rider plugin requires a [model](https://www.jetbrains.com/help/resharper/sdk/Products/Rider.html) to share information between ReSharper backend and IntelliJ frontend, there is a sample protocol defined in `protocol` directory. To generate the Kotlin and C# implementation, call:
57 |
58 | ```
59 | gradlew :rdgen
60 | ```
61 |
62 | Debbuging your plugin requires your debugger to be attached to the corresponding IDE process. You can find the correct process by searching for `Backend` when running your extension in Rider, or `devenv` for Visual Studio. Read more about attaching here:
63 |
64 | - [Attach to process in Rider](https://www.jetbrains.com/help/rider/Attaching_to_Local_Process.html)
65 | - [Attach to process in Visual Studio](https://learn.microsoft.com/en-us/visualstudio/debugger/attach-to-running-processes-with-the-visual-studio-debugger)
66 |
67 | Opening the solution in Rider or IntelliJ IDEA will automatically provide the corresponding [run configurations](https://www.jetbrains.com/help/rider/Creating_and_Editing_Run_Debug_Configurations.html):
68 |
69 |
70 |
71 | ### Version Relevant Code
72 |
73 | There are a couple of version identifiers that should always be updated synchronously:
74 |
75 | - The `ProductVersion` variable in [build.gradle](https://github.com/JetBrains/resharper-rider-plugin/blob/master/content/gradle.properties#L17) is responsible for download a certain Rider frontend distribution
76 | - The `SdkVersion` property in [Plugin.props](https://github.com/JetBrains/resharper-rider-plugin/blob/master/content/src/dotnet/Plugin.props#L4) will affect the referenced `JetBrains.ReSharper.SDK` NuGet package and will also determine the `wave` version that is required for the Extension Manager in ReSharper
77 | - The `runVisualStudio.ps1` script will always download the latest available installer for ReSharper - this can be either a normal release or early-access-program (EAP) release
78 |
79 | Available versions are listed here for [ReSharper](https://www.nuget.org/packages/JetBrains.ReSharper.SDK) and [Rider](https://www.jetbrains.com/intellij-repository/snapshots) (under `com.jetbrains.intellij.rider`).
80 |
81 | ### Visual Studio / ReSharper Relevant Directories
82 |
83 | Installing ReSharper and the plugin into an experimental Visual Studio instance (hive) affects the following directories:
84 |
85 | - `%LOCALAPPDATA%/JetBrains/plugins` contains a copy of the plugin package, similar to the global NuGet package cache
86 | - `%LOCALAPPDATA%/JetBrains/Installations` contains settings directories per experimental instance, whereas `packages.config` defines what plugins should be installed
87 | - `%APPDATA%/JetBrains/ReSharperPlatformVs[version]` contains binary directories per experimental instance with all assemblies to run ReSharper and the plugin
88 |
89 | Using [attached folders](https://www.jetbrains.com/help/rider/Extending_Your_Solution.html#adding-external-files-and-folders) can be of great help to track these directories while developing a ReSharper plugin.
90 |
91 | ## Deployment
92 |
93 | Both plugins can be published by calling:
94 |
95 | ```
96 | # For Rider & ReSharper (Gradle)
97 | gradlew :publishPlugin -PPluginVersion= -PPublishToken=
98 |
99 | # For ReSharper (PowerShell)
100 | powershell ./publishPlugin.ps1 -Version -ApiKey
101 | ```
102 |
103 | > **Warning**
104 | > The first deployment must be done through the [marketplace](https://plugins.jetbrains.com/).
105 |
--------------------------------------------------------------------------------
/content/build.gradle.kts:
--------------------------------------------------------------------------------
1 | import com.jetbrains.plugin.structure.base.utils.isFile
2 | import groovy.ant.FileNameFinder
3 | import org.apache.tools.ant.taskdefs.condition.Os
4 | import org.jetbrains.intellij.platform.gradle.Constants
5 | import java.io.ByteArrayOutputStream
6 |
7 | plugins {
8 | id("java")
9 | alias(libs.plugins.kotlinJvm)
10 | id("org.jetbrains.intellij.platform") version "2.10.4" // See https://github.com/JetBrains/intellij-platform-gradle-plugin/releases
11 | id("me.filippov.gradle.jvm.wrapper") version "0.14.0"
12 | }
13 |
14 | val isWindows = Os.isFamily(Os.FAMILY_WINDOWS)
15 | extra["isWindows"] = isWindows
16 |
17 | val DotnetSolution: String by project
18 | val BuildConfiguration: String by project
19 | val ProductVersion: String by project
20 | val DotnetPluginId: String by project
21 | val RiderPluginId: String by project
22 | val PublishToken: String by project
23 |
24 | allprojects {
25 | repositories {
26 | maven { setUrl("https://cache-redirector.jetbrains.com/maven-central") }
27 | }
28 | }
29 |
30 | repositories {
31 | intellijPlatform {
32 | defaultRepositories()
33 | jetbrainsRuntime()
34 | }
35 | }
36 |
37 | tasks.wrapper {
38 | gradleVersion = "8.8"
39 | distributionType = Wrapper.DistributionType.ALL
40 | distributionUrl = "https://cache-redirector.jetbrains.com/services.gradle.org/distributions/gradle-${gradleVersion}-all.zip"
41 | }
42 |
43 | version = extra["PluginVersion"] as String
44 |
45 | tasks.processResources {
46 | from("dependencies.json") { into("META-INF") }
47 | }
48 |
49 | sourceSets {
50 | main {
51 | java.srcDir("src/rider/main/java")
52 | kotlin.srcDir("src/rider/main/kotlin")
53 | resources.srcDir("src/rider/main/resources")
54 | }
55 | }
56 |
57 | tasks.compileKotlin {
58 | kotlinOptions { jvmTarget = "17" }
59 | }
60 |
61 | val setBuildTool by tasks.registering {
62 | doLast {
63 | extra["executable"] = "dotnet"
64 | var args = mutableListOf("msbuild")
65 |
66 | if (isWindows) {
67 | val stdout = ByteArrayOutputStream()
68 | exec {
69 | executable("${rootDir}\\tools\\vswhere.exe")
70 | args("-latest", "-property", "installationPath", "-products", "*")
71 | standardOutput = stdout
72 | workingDir(rootDir)
73 | }
74 |
75 | val directory = stdout.toString().trim()
76 | if (directory.isNotEmpty()) {
77 | val files = FileNameFinder().getFileNames("${directory}\\MSBuild", "**/MSBuild.exe")
78 | extra["executable"] = files.get(0)
79 | args = mutableListOf("/v:minimal")
80 | }
81 | }
82 |
83 | args.add("${DotnetSolution}")
84 | args.add("/p:Configuration=${BuildConfiguration}")
85 | args.add("/p:HostFullIdentifier=")
86 | extra["args"] = args
87 | }
88 | }
89 |
90 | val compileDotNet by tasks.registering {
91 | dependsOn(setBuildTool)
92 | doLast {
93 | val executable: String by setBuildTool.get().extra
94 | val arguments = (setBuildTool.get().extra["args"] as List).toMutableList()
95 | arguments.add("/t:Restore;Rebuild")
96 | exec {
97 | executable(executable)
98 | args(arguments)
99 | workingDir(rootDir)
100 | }
101 | }
102 | }
103 |
104 | val testDotNet by tasks.registering {
105 | doLast {
106 | exec {
107 | executable("dotnet")
108 | args("test","${DotnetSolution}","--logger","GitHubActions")
109 | workingDir(rootDir)
110 | }
111 | }
112 | }
113 |
114 | tasks.buildPlugin {
115 | doLast {
116 | copy {
117 | from("${buildDir}/distributions/${rootProject.name}-${version}.zip")
118 | into("${rootDir}/output")
119 | }
120 |
121 | // TODO: See also org.jetbrains.changelog: https://github.com/JetBrains/gradle-changelog-plugin
122 | val changelogText = file("${rootDir}/CHANGELOG.md").readText()
123 | val changelogMatches = Regex("(?s)(-.+?)(?=##|$)").findAll(changelogText)
124 | val changeNotes = changelogMatches.map {
125 | it.groups[1]!!.value.replace("(?s)- ".toRegex(), "\u2022 ").replace("`", "").replace(",", "%2C").replace(";", "%3B")
126 | }.take(1).joinToString()
127 |
128 | val executable: String by setBuildTool.get().extra
129 | val arguments = (setBuildTool.get().extra["args"] as List).toMutableList()
130 | arguments.add("/t:Pack")
131 | arguments.add("/p:PackageOutputPath=${rootDir}/output")
132 | arguments.add("/p:PackageReleaseNotes=${changeNotes}")
133 | arguments.add("/p:PackageVersion=${version}")
134 | exec {
135 | executable(executable)
136 | args(arguments)
137 | workingDir(rootDir)
138 | }
139 | }
140 | }
141 |
142 | dependencies {
143 | intellijPlatform {
144 | rider(ProductVersion, useInstaller = false)
145 | jetbrainsRuntime()
146 |
147 | // TODO: add plugins
148 | // bundledPlugin("uml")
149 | // bundledPlugin("com.jetbrains.ChooseRuntime:1.0.9")
150 | }
151 | }
152 |
153 | tasks.runIde {
154 | // Match Rider's default heap size of 1.5Gb (default for runIde is 512Mb)
155 | maxHeapSize = "1500m"
156 | }
157 |
158 | tasks.patchPluginXml {
159 | // TODO: See also org.jetbrains.changelog: https://github.com/JetBrains/gradle-changelog-plugin
160 | val changelogText = file("${rootDir}/CHANGELOG.md").readText()
161 | val changelogMatches = Regex("(?s)(-.+?)(?=##|\$)").findAll(changelogText)
162 |
163 | changeNotes.set(changelogMatches.map {
164 | it.groups[1]!!.value.replace("(?s)\r?\n".toRegex(), "
\n")
165 | }.take(1).joinToString())
166 | }
167 |
168 | tasks.prepareSandbox {
169 | dependsOn(compileDotNet)
170 |
171 | val outputFolder = "${rootDir}/src/dotnet/${DotnetPluginId}/bin/${DotnetPluginId}.Rider/${BuildConfiguration}"
172 | val dllFiles = listOf(
173 | "$outputFolder/${DotnetPluginId}.dll",
174 | "$outputFolder/${DotnetPluginId}.pdb",
175 |
176 | // TODO: add additional assemblies
177 | )
178 |
179 | dllFiles.forEach({ f ->
180 | val file = file(f)
181 | from(file, { into("${rootProject.name}/dotnet") })
182 | })
183 |
184 | doLast {
185 | dllFiles.forEach({ f ->
186 | val file = file(f)
187 | if (!file.exists()) throw RuntimeException("File ${file} does not exist")
188 | })
189 | }
190 | }
191 |
192 | tasks.publishPlugin {
193 | dependsOn(testDotNet)
194 | dependsOn(tasks.buildPlugin)
195 | token.set("${PublishToken}")
196 |
197 | doLast {
198 | exec {
199 | executable("dotnet")
200 | args("nuget","push","output/${DotnetPluginId}.${version}.nupkg","--api-key","${PublishToken}","--source","https://plugins.jetbrains.com")
201 | workingDir(rootDir)
202 | }
203 | }
204 | }
205 |
206 | val riderModel: Configuration by configurations.creating {
207 | isCanBeConsumed = true
208 | isCanBeResolved = false
209 | }
210 |
211 | artifacts {
212 | add(riderModel.name, provider {
213 | intellijPlatform.platformPath.resolve("lib/rd/rider-model.jar").also {
214 | check(it.isFile) {
215 | "rider-model.jar is not found at $riderModel"
216 | }
217 | }
218 | }) {
219 | builtBy(Constants.Tasks.INITIALIZE_INTELLIJ_PLATFORM_PLUGIN)
220 | }
221 | }
222 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright 2018 JetBrains s.r.o.
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/content/gradlew:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Copyright © 2015-2021 the original authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | #
21 | # Gradle start up script for POSIX generated by Gradle.
22 | #
23 | # Important for running:
24 | #
25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
26 | # noncompliant, but you have some other compliant shell such as ksh or
27 | # bash, then to run this script, type that shell name before the whole
28 | # command line, like:
29 | #
30 | # ksh Gradle
31 | #
32 | # Busybox and similar reduced shells will NOT work, because this script
33 | # requires all of these POSIX shell features:
34 | # * functions;
35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37 | # * compound commands having a testable exit status, especially «case»;
38 | # * various built-in commands including «command», «set», and «ulimit».
39 | #
40 | # Important for patching:
41 | #
42 | # (2) This script targets any POSIX shell, so it avoids extensions provided
43 | # by Bash, Ksh, etc; in particular arrays are avoided.
44 | #
45 | # The "traditional" practice of packing multiple parameters into a
46 | # space-separated string is a well documented source of bugs and security
47 | # problems, so this is (mostly) avoided, by progressively accumulating
48 | # options in "$@", and eventually passing that to Java.
49 | #
50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
52 | # see the in-line comments for details.
53 | #
54 | # There are tweaks for specific operating systems such as AIX, CygWin,
55 | # Darwin, MinGW, and NonStop.
56 | #
57 | # (3) This script is generated from the Groovy template
58 | # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59 | # within the Gradle project.
60 | #
61 | # You can find Gradle at https://github.com/gradle/gradle/.
62 | #
63 | ##############################################################################
64 |
65 | # Attempt to set APP_HOME
66 |
67 | # Resolve links: $0 may be a link
68 | app_path=$0
69 |
70 | # Need this for daisy-chained symlinks.
71 | while
72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
73 | [ -h "$app_path" ]
74 | do
75 | ls=$( ls -ld "$app_path" )
76 | link=${ls#*' -> '}
77 | case $link in #(
78 | /*) app_path=$link ;; #(
79 | *) app_path=$APP_HOME$link ;;
80 | esac
81 | done
82 |
83 | # This is normally unused
84 | # shellcheck disable=SC2034
85 | APP_BASE_NAME=${0##*/}
86 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87 | APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
88 |
89 | # Use the maximum available, or set MAX_FD != -1 to use that value.
90 | MAX_FD=maximum
91 |
92 | warn () {
93 | echo "$*"
94 | } >&2
95 |
96 | die () {
97 | echo
98 | echo "$*"
99 | echo
100 | exit 1
101 | } >&2
102 |
103 | # OS specific support (must be 'true' or 'false').
104 | cygwin=false
105 | msys=false
106 | darwin=false
107 | nonstop=false
108 | case "$( uname )" in #(
109 | CYGWIN* ) cygwin=true ;; #(
110 | Darwin* ) darwin=true ;; #(
111 | MSYS* | MINGW* ) msys=true ;; #(
112 | NONSTOP* ) nonstop=true ;;
113 | esac
114 |
115 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
116 |
117 |
118 | # GRADLE JVM WRAPPER START MARKER
119 | BUILD_DIR="${HOME}/.local/share/gradle-jvm"
120 | JVM_ARCH=$(uname -m)
121 | JVM_TEMP_FILE=$BUILD_DIR/gradle-jvm-temp.tar.gz
122 | if [ "$darwin" = "true" ]; then
123 | case $JVM_ARCH in
124 | x86_64)
125 | JVM_URL=https://download.oracle.com/java/17/archive/jdk-17.0.3.1_macos-x64_bin.tar.gz
126 | JVM_TARGET_DIR=$BUILD_DIR/jdk-17.0.3.1_macos-x64_bin-1bcf03
127 | ;;
128 | arm64)
129 | JVM_URL=https://download.oracle.com/java/17/archive/jdk-17.0.3.1_macos-aarch64_bin.tar.gz
130 | JVM_TARGET_DIR=$BUILD_DIR/jdk-17.0.3.1_macos-aarch64_bin-297fa2
131 | ;;
132 | *)
133 | die "Unknown architecture $JVM_ARCH"
134 | ;;
135 | esac
136 | elif [ "$cygwin" = "true" ] || [ "$msys" = "true" ]; then
137 | JVM_URL=https://download.oracle.com/java/17/archive/jdk-17.0.3.1_windows-x64_bin.zip
138 | JVM_TARGET_DIR=$BUILD_DIR/jdk-17.0.3.1_windows-x64_bin-d6ede5
139 | else
140 | JVM_ARCH=$(linux$(getconf LONG_BIT) uname -m)
141 | case $JVM_ARCH in
142 | x86_64)
143 | JVM_URL=https://download.oracle.com/java/17/archive/jdk-17.0.3.1_linux-x64_bin.tar.gz
144 | JVM_TARGET_DIR=$BUILD_DIR/jdk-17.0.3.1_linux-x64_bin-9324ae
145 | ;;
146 | aarch64)
147 | JVM_URL=https://download.oracle.com/java/17/archive/jdk-17.0.3.1_linux-aarch64_bin.tar.gz
148 | JVM_TARGET_DIR=$BUILD_DIR/jdk-17.0.3.1_linux-aarch64_bin-319da6
149 | ;;
150 | *)
151 | die "Unknown architecture $JVM_ARCH"
152 | ;;
153 | esac
154 | fi
155 |
156 | set -e
157 |
158 | if [ -e "$JVM_TARGET_DIR/.flag" ] && [ -n "$(ls "$JVM_TARGET_DIR")" ] && [ "x$(cat "$JVM_TARGET_DIR/.flag")" = "x${JVM_URL}" ]; then
159 | # Everything is up-to-date in $JVM_TARGET_DIR, do nothing
160 | true
161 | else
162 | echo "Downloading $JVM_URL to $JVM_TEMP_FILE"
163 |
164 | rm -f "$JVM_TEMP_FILE"
165 | mkdir -p "$BUILD_DIR"
166 | if command -v curl >/dev/null 2>&1; then
167 | if [ -t 1 ]; then CURL_PROGRESS="--progress-bar"; else CURL_PROGRESS="--silent --show-error"; fi
168 | # shellcheck disable=SC2086
169 | curl $CURL_PROGRESS -L --output "${JVM_TEMP_FILE}" "$JVM_URL" 2>&1
170 | elif command -v wget >/dev/null 2>&1; then
171 | if [ -t 1 ]; then WGET_PROGRESS=""; else WGET_PROGRESS="-nv"; fi
172 | wget $WGET_PROGRESS -O "${JVM_TEMP_FILE}" "$JVM_URL" 2>&1
173 | else
174 | die "ERROR: Please install wget or curl"
175 | fi
176 |
177 | echo "Extracting $JVM_TEMP_FILE to $JVM_TARGET_DIR"
178 | rm -rf "$JVM_TARGET_DIR"
179 | mkdir -p "$JVM_TARGET_DIR"
180 |
181 | case "$JVM_URL" in
182 | *".zip") unzip "$JVM_TEMP_FILE" -d "$JVM_TARGET_DIR" ;;
183 | *) tar -x -f "$JVM_TEMP_FILE" -C "$JVM_TARGET_DIR" ;;
184 | esac
185 |
186 | rm -f "$JVM_TEMP_FILE"
187 |
188 | echo "$JVM_URL" >"$JVM_TARGET_DIR/.flag"
189 | fi
190 |
191 | JAVA_HOME=
192 | for d in "$JVM_TARGET_DIR" "$JVM_TARGET_DIR"/* "$JVM_TARGET_DIR"/Contents/Home "$JVM_TARGET_DIR"/*/Contents/Home; do
193 | if [ -e "$d/bin/java" ]; then
194 | JAVA_HOME="$d"
195 | fi
196 | done
197 |
198 | if [ '!' -e "$JAVA_HOME/bin/java" ]; then
199 | die "Unable to find bin/java under $JVM_TARGET_DIR"
200 | fi
201 |
202 | # Make it available for child processes
203 | export JAVA_HOME
204 |
205 | set +e
206 |
207 | # GRADLE JVM WRAPPER END MARKER
208 |
209 | # Determine the Java command to use to start the JVM.
210 | if [ -n "$JAVA_HOME" ] ; then
211 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
212 | # IBM's JDK on AIX uses strange locations for the executables
213 | JAVACMD=$JAVA_HOME/jre/sh/java
214 | else
215 | JAVACMD=$JAVA_HOME/bin/java
216 | fi
217 | if [ ! -x "$JAVACMD" ] ; then
218 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
219 |
220 | Please set the JAVA_HOME variable in your environment to match the
221 | location of your Java installation."
222 | fi
223 | else
224 | JAVACMD=java
225 | if ! command -v java >/dev/null 2>&1
226 | then
227 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
228 |
229 | Please set the JAVA_HOME variable in your environment to match the
230 | location of your Java installation."
231 | fi
232 | fi
233 |
234 | # Increase the maximum file descriptors if we can.
235 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
236 | case $MAX_FD in #(
237 | max*)
238 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
239 | # shellcheck disable=SC2039,SC3045
240 | MAX_FD=$( ulimit -H -n ) ||
241 | warn "Could not query maximum file descriptor limit"
242 | esac
243 | case $MAX_FD in #(
244 | '' | soft) :;; #(
245 | *)
246 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
247 | # shellcheck disable=SC2039,SC3045
248 | ulimit -n "$MAX_FD" ||
249 | warn "Could not set maximum file descriptor limit to $MAX_FD"
250 | esac
251 | fi
252 |
253 | # Collect all arguments for the java command, stacking in reverse order:
254 | # * args from the command line
255 | # * the main class name
256 | # * -classpath
257 | # * -D...appname settings
258 | # * --module-path (only if needed)
259 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
260 |
261 | # For Cygwin or MSYS, switch paths to Windows format before running java
262 | if "$cygwin" || "$msys" ; then
263 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
264 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
265 |
266 | JAVACMD=$( cygpath --unix "$JAVACMD" )
267 |
268 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
269 | for arg do
270 | if
271 | case $arg in #(
272 | -*) false ;; # don't mess with options #(
273 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
274 | [ -e "$t" ] ;; #(
275 | *) false ;;
276 | esac
277 | then
278 | arg=$( cygpath --path --ignore --mixed "$arg" )
279 | fi
280 | # Roll the args list around exactly as many times as the number of
281 | # args, so each arg winds up back in the position where it started, but
282 | # possibly modified.
283 | #
284 | # NB: a `for` loop captures its iteration list before it begins, so
285 | # changing the positional parameters here affects neither the number of
286 | # iterations, nor the values presented in `arg`.
287 | shift # remove old arg
288 | set -- "$@" "$arg" # push replacement arg
289 | done
290 | fi
291 |
292 |
293 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
294 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
295 |
296 | # Collect all arguments for the java command:
297 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
298 | # and any embedded shellness will be escaped.
299 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
300 | # treated as '${Hostname}' itself on the command line.
301 |
302 | set -- \
303 | "-Dorg.gradle.appname=$APP_BASE_NAME" \
304 | -classpath "$CLASSPATH" \
305 | org.gradle.wrapper.GradleWrapperMain \
306 | "$@"
307 |
308 | # Stop when "xargs" is not available.
309 | if ! command -v xargs >/dev/null 2>&1
310 | then
311 | die "xargs is not available"
312 | fi
313 |
314 | # Use "xargs" to parse quoted args.
315 | #
316 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
317 | #
318 | # In Bash we could simply go:
319 | #
320 | # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
321 | # set -- "${ARGS[@]}" "$@"
322 | #
323 | # but POSIX shell has neither arrays nor command substitution, so instead we
324 | # post-process each arg (as a line of input to sed) to backslash-escape any
325 | # character that might be a shell metacharacter, then use eval to reverse
326 | # that process (while maintaining the separation between arguments), and wrap
327 | # the whole thing up as a single "set" statement.
328 | #
329 | # This will of course break if any of these variables contains a newline or
330 | # an unmatched quote.
331 | #
332 |
333 | eval "set -- $(
334 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
335 | xargs -n1 |
336 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
337 | tr '\n' ' '
338 | )" '"$@"'
339 |
340 | exec "$JAVACMD" "$@"
341 |
--------------------------------------------------------------------------------