diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..3a94d56 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +# Set the default behavior, in case people don't have core.autocrlf set. +* text=auto + +# Preserve line endings in gradle scripts +gradlew* -text diff diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000..565d61c --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,41 @@ +name: CI + +on: [push, pull_request] + +jobs: + Build: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - uses: actions/cache@v2 + with: + path: | + build/gradle-jvm + ~/.nuget/packages + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-Build-${{ hashFiles('gradlew.bat', 'src/dotnet/*/*.csproj', 'src/dotnet/*.props', 'gradle-wrapper.properties') }} + - run: ./gradlew :buildPlugin --no-daemon + - uses: actions/upload-artifact@v3 + if: always() + with: + name: ${{ github.event.repository.name }}.CI.${{ github.ref_name }} + path: output + Test: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - uses: actions/cache@v2 + with: + path: | + build/gradle-jvm + packages + ~/.nuget/packages + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-Test-${{ hashFiles('gradlew.bat', 'src/dotnet/*/*.csproj', 'src/dotnet/*.props', 'gradle-wrapper.properties') }} + - run: ./gradlew :testDotNet --no-daemon diff --git a/.github/workflows/Deploy.yml b/.github/workflows/Deploy.yml new file mode 100644 index 0000000..b6f3ce3 --- /dev/null +++ b/.github/workflows/Deploy.yml @@ -0,0 +1,21 @@ +name: Deploy + +on: + push: + tags: + - '*.*.*' + +jobs: + Publish: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - run: ./gradlew :publishPlugin -PBuildConfiguration="Release" -PPluginVersion="${{ github.ref_name }}" -PPublishToken="${{ env.PUBLISH_TOKEN }}" + env: + PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }} + - uses: actions/upload-artifact@v3 + if: always() + name: ${{ github.event.repository.name }}.${{ github.ref_name }} + path: output diff --git a/.gitignore b/.gitignore index 8a30d25..e05792a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,398 +1,22 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. -## -## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore +# Build artifacts +[Bb]in/ +[Oo]bj/ +build +output +.gradle +.tmp # User-specific files -*.rsuser *.suo *.user -*.userosscache *.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Mono auto generated files -mono_crash.* - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -[Ww][Ii][Nn]32/ -[Aa][Rr][Mm]/ -[Aa][Rr][Mm]64/ -bld/ -[Bb]in/ -[Oo]bj/ -[Ll]og/ -[Ll]ogs/ - -# Visual Studio 2015/2017 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# Visual Studio 2017 auto generated files -Generated\ Files/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUnit -*.VisualState.xml -TestResult.xml -nunit-*.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# Benchmark Results -BenchmarkDotNet.Artifacts/ - -# .NET Core -project.lock.json -project.fragment.lock.json -artifacts/ - -# ASP.NET Scaffolding -ScaffoldingReadMe.txt - -# StyleCop -StyleCopReport.xml - -# Files built by Visual Studio -*_i.c -*_p.c -*_h.h -*.ilk -*.meta -*.obj -*.iobj -*.pch -*.pdb -*.ipdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*_wpftmp.csproj -*.log -*.tlog -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db -*.VC.VC.opendb - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# Visual Studio Trace Files -*.e2e - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# AxoCover is a Code Coverage Tool -.axoCover/* -!.axoCover/settings.json - -# Coverlet is a free, cross platform Code Coverage Tool -coverage*.json -coverage*.xml -coverage*.info - -# Visual Studio code coverage results -*.coverage -*.coveragexml - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# Note: Comment the next line if you want to checkin your web deploy settings, -# but database connection strings (with potential passwords) will be unencrypted -*.pubxml -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# NuGet Symbol Packages -*.snupkg -# The packages folder can be ignored because of Package Restore -**/[Pp]ackages/* -# except build/, which is used as an MSBuild target. -!**/[Pp]ackages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/[Pp]ackages/repositories.config -# NuGet v3's project.json files produces more ignorable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt -*.appx -*.appxbundle -*.appxupload - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!?*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.jfm -*.pfx -*.publishsettings -orleans.codegen.cs - -# Including strong name files can present a security risk -# (https://github.com/github/gitignore/pull/2483#issue-259490424) -#*.snk - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm -ServiceFabricBackup/ -*.rptproj.bak - -# SQL Server files -*.mdf -*.ldf -*.ndf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings -*.rptproj.rsuser -*- [Bb]ackup.rdl -*- [Bb]ackup ([0-9]).rdl -*- [Bb]ackup ([0-9][0-9]).rdl - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat -node_modules/ - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) -*.vbw - -# Visual Studio 6 auto-generated project file (contains which files were open etc.) -*.vbp - -# Visual Studio 6 workspace and project file (working project files containing files to include in project) -*.dsw -*.dsp - -# Visual Studio 6 technical files -*.ncb -*.aps - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# CodeRush personal settings -.cr/personal - -# Python Tools for Visual Studio (PTVS) -__pycache__/ -*.pyc - -# Cake - Uncomment if you are using it -# tools/** -# !tools/packages.config - -# Tabs Studio -*.tss - -# Telerik's JustMock configuration file -*.jmconfig - -# BizTalk build output -*.btp.cs -*.btm.cs -*.odx.cs -*.xsd.cs - -# OpenCover UI analysis results -OpenCover/ - -# Azure Stream Analytics local run output -ASALocalRun/ - -# MSBuild Binary and Structured Log -*.binlog - -# NVidia Nsight GPU debugger configuration file -*.nvuser - -# MFractors (Xamarin productivity tool) working folder -.mfractor/ - -# Local History for Visual Studio -.localhistory/ - -# Visual Studio History (VSHistory) files -.vshistory/ - -# BeatPulse healthcheck temp database -healthchecksdb - -# Backup folder for Package Reference Convert tool in Visual Studio 2017 -MigrationBackup/ - -# Ionide (cross platform F# VS Code tools) working folder -.ionide/ - -# Fody - auto-generated XML schema -FodyWeavers.xsd - -# VS Code files for those working on multiple tools -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json -*.code-workspace - -# Local History for Visual Studio Code -.history/ - -# Windows Installer files from build outputs -*.cab -*.msi -*.msix -*.msm -*.msp - -# JetBrains Rider -*.sln.iml +*.cache + +# IDEs +/.idea/*.iml +/.idea/*.xml +/.idea/.idea.*/*.iml +/.idea/.idea.*/.idea/*.xml +.vs +_ReSharper* +_dotTrace* \ No newline at end of file diff --git a/.idea/.idea.ReSharperPlugin.ODataCliUi/.idea/runConfigurations/Rider__Frontend__Unix_.xml b/.idea/.idea.ReSharperPlugin.ODataCliUi/.idea/runConfigurations/Rider__Frontend__Unix_.xml new file mode 100644 index 0000000..1f69054 --- /dev/null +++ b/.idea/.idea.ReSharperPlugin.ODataCliUi/.idea/runConfigurations/Rider__Frontend__Unix_.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/.idea/.idea.ReSharperPlugin.ODataCliUi/.idea/runConfigurations/Rider__Frontend__Windows_.xml b/.idea/.idea.ReSharperPlugin.ODataCliUi/.idea/runConfigurations/Rider__Frontend__Windows_.xml new file mode 100644 index 0000000..d890b08 --- /dev/null +++ b/.idea/.idea.ReSharperPlugin.ODataCliUi/.idea/runConfigurations/Rider__Frontend__Windows_.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/.idea/.idea.ReSharperPlugin.ODataCliUi/.idea/runConfigurations/Rider__Unix_.xml b/.idea/.idea.ReSharperPlugin.ODataCliUi/.idea/runConfigurations/Rider__Unix_.xml new file mode 100644 index 0000000..b24f665 --- /dev/null +++ b/.idea/.idea.ReSharperPlugin.ODataCliUi/.idea/runConfigurations/Rider__Unix_.xml @@ -0,0 +1,17 @@ + + + + diff --git a/.idea/.idea.ReSharperPlugin.ODataCliUi/.idea/runConfigurations/Rider__Windows_.xml b/.idea/.idea.ReSharperPlugin.ODataCliUi/.idea/runConfigurations/Rider__Windows_.xml new file mode 100644 index 0000000..e1ca66e --- /dev/null +++ b/.idea/.idea.ReSharperPlugin.ODataCliUi/.idea/runConfigurations/Rider__Windows_.xml @@ -0,0 +1,17 @@ + + + + diff --git a/.idea/.idea.ReSharperPlugin.ODataCliUi/.idea/runConfigurations/VisualStudio.xml b/.idea/.idea.ReSharperPlugin.ODataCliUi/.idea/runConfigurations/VisualStudio.xml new file mode 100644 index 0000000..6f6c62a --- /dev/null +++ b/.idea/.idea.ReSharperPlugin.ODataCliUi/.idea/runConfigurations/VisualStudio.xml @@ -0,0 +1,12 @@ + + + + diff --git a/.idea/.idea.ReSharperPlugin.ODataCliUi/.idea/runConfigurations/rdgen__Unix_.xml b/.idea/.idea.ReSharperPlugin.ODataCliUi/.idea/runConfigurations/rdgen__Unix_.xml new file mode 100644 index 0000000..2aadf33 --- /dev/null +++ b/.idea/.idea.ReSharperPlugin.ODataCliUi/.idea/runConfigurations/rdgen__Unix_.xml @@ -0,0 +1,10 @@ + + + + diff --git a/.idea/.idea.ReSharperPlugin.ODataCliUi/.idea/runConfigurations/rdgen__Windows_.xml b/.idea/.idea.ReSharperPlugin.ODataCliUi/.idea/runConfigurations/rdgen__Windows_.xml new file mode 100644 index 0000000..4cc1b86 --- /dev/null +++ b/.idea/.idea.ReSharperPlugin.ODataCliUi/.idea/runConfigurations/rdgen__Windows_.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/Rider.xml b/.idea/runConfigurations/Rider.xml new file mode 100644 index 0000000..75a4c5f --- /dev/null +++ b/.idea/runConfigurations/Rider.xml @@ -0,0 +1,21 @@ + + + + + + + true + + + \ No newline at end of file diff --git a/.idea/runConfigurations/rdgen.xml b/.idea/runConfigurations/rdgen.xml new file mode 100644 index 0000000..b532a9e --- /dev/null +++ b/.idea/runConfigurations/rdgen.xml @@ -0,0 +1,21 @@ + + + + + + + true + + + \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..bef24bd --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,8 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). + +## 2023.1.0 +- Initial version diff --git a/README.md b/README.md index 523fddc..5d6edfd 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ -# rider--plugin--odata-cli-ui -Rider plugin that provides UI for OData CLI +# ODataCliUi for Rider and ReSharper + +[![Rider](https://img.shields.io/jetbrains/plugin/v/RIDER_PLUGIN_ID.svg?label=Rider&colorB=0A7BBB&style=for-the-badge&logo=rider)](https://plugins.jetbrains.com/plugin/RIDER_PLUGIN_ID) +[![ReSharper](https://img.shields.io/jetbrains/plugin/v/RESHARPER_PLUGIN_ID.svg?label=ReSharper&colorB=0A7BBB&style=for-the-badge&logo=resharper)](https://plugins.jetbrains.com/plugin/RESHARPER_PLUGIN_ID) diff --git a/ReSharperPlugin.ODataCliUi.sln b/ReSharperPlugin.ODataCliUi.sln new file mode 100644 index 0000000..0e700f2 --- /dev/null +++ b/ReSharperPlugin.ODataCliUi.sln @@ -0,0 +1,37 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReSharperPlugin.ODataCliUi", "src\dotnet\ReSharperPlugin.ODataCliUi\ReSharperPlugin.ODataCliUi.csproj", "{05608FE6-4FD1-4E9D-9BE2-B13A0E370BA2}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReSharperPlugin.ODataCliUi.Rider", "src\dotnet\ReSharperPlugin.ODataCliUi\ReSharperPlugin.ODataCliUi.Rider.csproj", "{084172D1-A9C6-46D0-96AD-05C5B09A5E5D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReSharperPlugin.ODataCliUi.Tests", "src\dotnet\ReSharperPlugin.ODataCliUi.Tests\ReSharperPlugin.ODataCliUi.Tests.csproj", "{01C3DEF5-50B2-47CB-9467-19BC6DDF9D3D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "misc", "misc", "{4A9ABB95-3762-448B-B5BF-099E46DB22DE}" +ProjectSection(SolutionItems) = preProject + src\dotnet\Plugin.props = src\dotnet\Plugin.props + README.md = README.md + CHANGELOG.md = CHANGELOG.md + src\rider\main\resources\META-INF\plugin.xml = src\rider\main\resources\META-INF\plugin.xml + gradle.properties = gradle.properties +EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {05608FE6-4FD1-4E9D-9BE2-B13A0E370BA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {05608FE6-4FD1-4E9D-9BE2-B13A0E370BA2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {05608FE6-4FD1-4E9D-9BE2-B13A0E370BA2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {05608FE6-4FD1-4E9D-9BE2-B13A0E370BA2}.Release|Any CPU.Build.0 = Release|Any CPU + {084172D1-A9C6-46D0-96AD-05C5B09A5E5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {084172D1-A9C6-46D0-96AD-05C5B09A5E5D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {084172D1-A9C6-46D0-96AD-05C5B09A5E5D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {084172D1-A9C6-46D0-96AD-05C5B09A5E5D}.Release|Any CPU.Build.0 = Release|Any CPU + {01C3DEF5-50B2-47CB-9467-19BC6DDF9D3D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {01C3DEF5-50B2-47CB-9467-19BC6DDF9D3D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {01C3DEF5-50B2-47CB-9467-19BC6DDF9D3D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {01C3DEF5-50B2-47CB-9467-19BC6DDF9D3D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..8a6edd9 --- /dev/null +++ b/build.gradle @@ -0,0 +1,222 @@ +// Reference https://www.jetbrains.org/intellij/sdk/docs/tutorials/build_system/gradle_guide.html +import org.apache.tools.ant.taskdefs.condition.Os + +plugins { + id 'java' + id 'org.jetbrains.kotlin.jvm' version '1.8.10' + id 'org.jetbrains.intellij' version '1.13.3' // See https://github.com/JetBrains/gradle-intellij-plugin/releases + id 'com.jetbrains.rdgen' version '2023.1.2' // See https://github.com/JetBrains/rd/releases + id 'me.filippov.gradle.jvm.wrapper' version '0.14.0' +} + +ext { + isWindows = Os.isFamily(Os.FAMILY_WINDOWS) + rdLibDirectory = { + new File(setupDependencies.idea.get().classes, "lib/rd") + } +} + +repositories { + maven { url 'https://cache-redirector.jetbrains.com/intellij-repository/snapshots' } + maven { url 'https://cache-redirector.jetbrains.com/maven-central' } +} + +wrapper { + gradleVersion = '7.6' + distributionType = Wrapper.DistributionType.ALL + distributionUrl = "https://cache-redirector.jetbrains.com/services.gradle.org/distributions/gradle-${gradleVersion}-all.zip" +} + +version = ext.PluginVersion + +tasks.named("processResources") { + from("dependencies.json", { into "META-INF" }) +} + +sourceSets { + main { + java.srcDir 'src/rider/main/java' + kotlin.srcDir 'src/rider/main/kotlin' + resources.srcDir 'src/rider/main/resources' + } +} + +compileKotlin { + kotlinOptions { jvmTarget = "17" } +} + +task setBuildTool { + doLast { + ext.executable = "dotnet" + ext.args = ["msbuild"] + + if (isWindows) { + ByteArrayOutputStream stdout = new ByteArrayOutputStream() + exec { + executable "${rootDir}\\tools\\vswhere.exe" + args '-latest','-property','installationPath','-products','*' + standardOutput = stdout + workingDir rootDir + } + + def directory = stdout.toString().trim() + if (directory) { + List files = new FileNameFinder().getFileNames("${directory}\\MSBuild", "**/MSBuild.exe") + ext.executable = files.get(0) + ext.args = ["/v:minimal"] + } + } + + ext.args << "${DotnetSolution}" + ext.args << "/p:Configuration=${BuildConfiguration}" + ext.args << "/p:HostFullIdentifier=" + } +} + +task compileDotNet { + dependsOn setBuildTool + doLast { + def arguments = setBuildTool.args.clone() + arguments << "/t:Restore;Rebuild" + exec { + executable setBuildTool.executable + args arguments + workingDir rootDir + } + } +} + +task testDotNet { + doLast { + exec { + executable "dotnet" + args "test","${DotnetSolution}","--logger","GitHubActions" + workingDir rootDir + } + } +} + +buildPlugin { + doLast { + copy { + from "${buildDir}/distributions/${rootProject.name}-${version}.zip" + into "${rootDir}/output" + } + + // TODO: See also org.jetbrains.changelog: https://github.com/JetBrains/gradle-changelog-plugin + def changelogText = file("${rootDir}/CHANGELOG.md").text + def changelogMatches = changelogText =~ /(?s)(-.+?)(?=##|$)/ + def changeNotes = changelogMatches.collect { + it[1].replaceAll(/(?s)- /, "\u2022 ").replaceAll(/`/, "").replaceAll(/,/, "%2C").replaceAll(/;/, "%3B") + }.take(1).join("") + + def arguments = setBuildTool.args.clone() + arguments << "/t:Pack" + arguments << "/p:PackageOutputPath=${rootDir}/output" + arguments << "/p:PackageReleaseNotes=${changeNotes}" + arguments << "/p:PackageVersion=${version}" + exec { + executable setBuildTool.executable + args arguments + workingDir rootDir + } + } +} + +intellij { + type = 'RD' + version = "${ProductVersion}" + downloadSources = false + instrumentCode = false + // TODO: add plugins + // plugins = ["uml", "com.jetbrains.ChooseRuntime:1.0.9"] +} + +runIde { + // Match Rider's default heap size of 1.5Gb (default for runIde is 512Mb) + maxHeapSize = "1500m" + + // Rider's backend doesn't support dynamic plugins. It might be possible to work with auto-reload of the frontend + // part of a plugin, but there are dangers about keeping plugins in sync + autoReloadPlugins = false + + // gradle-intellij-plugin will download the default version of the JBR for the snapshot. Update if required + // jbrVersion = "jbr_jcef-11_0_6b765.40" // https://confluence.jetbrains.com/display/JBR/Release+notes +} + +rdgen { + def modelDir = new File(rootDir, "protocol/src/main/kotlin/model") + def csOutput = new File(rootDir, "src/dotnet/${DotnetPluginId}/Rider") + def ktOutput = new File(rootDir, "src/rider/main/kotlin/${RiderPluginId.replace('.','/').toLowerCase()}") + + verbose = true + classpath { + "${rdLibDirectory()}/rider-model.jar" + } + sources "${modelDir}/rider" + hashFolder = "${buildDir}" + packages = "model.rider" + + generator { + language = "kotlin" + transform = "asis" + root = "com.jetbrains.rider.model.nova.ide.IdeRoot" + namespace = "com.jetbrains.rider.model" + directory = "$ktOutput" + } + + generator { + language = "csharp" + transform = "reversed" + root = "com.jetbrains.rider.model.nova.ide.IdeRoot" + namespace = "JetBrains.Rider.Model" + directory = "$csOutput" + } +} + +patchPluginXml { + // TODO: See also org.jetbrains.changelog: https://github.com/JetBrains/gradle-changelog-plugin + def changelogText = file("${rootDir}/CHANGELOG.md").text + def changelogMatches = changelogText =~ /(?s)(-.+?)(?=##|$)/ + + changeNotes = changelogMatches.collect { + it[1].replaceAll(/(?s)\r?\n/, "
\n") + }.take(1).join('') +} + +prepareSandbox { + dependsOn compileDotNet + + def outputFolder = "${rootDir}/src/dotnet/${DotnetPluginId}/bin/${DotnetPluginId}.Rider/${BuildConfiguration}" + def dllFiles = [ + "$outputFolder/${DotnetPluginId}.dll", + "$outputFolder/${DotnetPluginId}.pdb", + // TODO: add additional assemblies + ] + + dllFiles.forEach({ f -> + def file = file(f) + from(file, { into "${rootProject.name}/dotnet" }) + }) + + doLast { + dllFiles.forEach({ f -> + def file = file(f) + if (!file.exists()) throw new RuntimeException("File ${file} does not exist") + }) + } +} + +publishPlugin { + dependsOn testDotNet + dependsOn buildPlugin + token = "${PublishToken}" + + doLast { + exec { + executable "dotnet" + args "nuget","push","output/${DotnetPluginId}.${version}.nupkg","--api-key","${PublishToken}","--source","https://plugins.jetbrains.com" + workingDir rootDir + } + } +} diff --git a/buildPlugin.ps1 b/buildPlugin.ps1 new file mode 100644 index 0000000..22beb4e --- /dev/null +++ b/buildPlugin.ps1 @@ -0,0 +1,12 @@ +Param( + $Version = "9999.0.0" +) + +Set-StrictMode -Version Latest +$ErrorActionPreference = "Stop" +$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent +Set-Location $PSScriptRoot + +. ".\settings.ps1" + +Invoke-Exe $MSBuildPath "/t:Restore;Rebuild;Pack" "$SolutionPath" "/v:minimal" "/p:PackageVersion=$Version" "/p:PackageOutputPath=`"$OutputDirectory`"" diff --git a/dependencies.json b/dependencies.json new file mode 100644 index 0000000..0d4f101 --- /dev/null +++ b/dependencies.json @@ -0,0 +1,2 @@ +[ +] diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..0f90231 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,24 @@ +# Any property can be overwritten from command-line via +# -P= + +DotnetPluginId=ReSharperPlugin.ODataCliUi +DotnetSolution=ReSharperPlugin.ODataCliUi.sln +RiderPluginId=com.jetbrains.rider.plugins.odatacliui +PluginVersion=9999.0.0 + +BuildConfiguration=Debug + +PublishToken="_PLACEHOLDER_" + +# See https://www.jetbrains.com/intellij-repository/snapshots +# Keep in sync with SdkVersion in Plugin.props --> +# +# Examples: +# Release: 2020.2 +# EAP: 2020.3-EAP2-SNAPSHOT +# Nightly: 2020.3-SNAPSHOT +ProductVersion=2023.1 + +# Kotlin 1.4 will bundle the stdlib dependency by default, causing problems with the version bundled with the IDE +# https://blog.jetbrains.com/kotlin/2020/07/kotlin-1-4-rc-released/#stdlib-default +kotlin.stdlib.default.dependency=false diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..943f0cb Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..183cef7 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://cache-redirector.jetbrains.com/services.gradle.org/distributions/gradle-7.6-all.zip +networkTimeout=10000 +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..7689b57 --- /dev/null +++ b/gradlew @@ -0,0 +1,335 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# GRADLE JVM WRAPPER START MARKER +BUILD_DIR="${HOME}/.local/share/gradle-jvm" +JVM_ARCH=$(uname -m) +JVM_TEMP_FILE=$BUILD_DIR/gradle-jvm-temp.tar.gz +if [ "$darwin" = "true" ]; then + case $JVM_ARCH in + x86_64) + JVM_URL=https://download.oracle.com/java/17/archive/jdk-17.0.3.1_macos-x64_bin.tar.gz + JVM_TARGET_DIR=$BUILD_DIR/jdk-17.0.3.1_macos-x64_bin-1bcf03 + ;; + arm64) + JVM_URL=https://download.oracle.com/java/17/archive/jdk-17.0.3.1_macos-aarch64_bin.tar.gz + JVM_TARGET_DIR=$BUILD_DIR/jdk-17.0.3.1_macos-aarch64_bin-297fa2 + ;; + *) + die "Unknown architecture $JVM_ARCH" + ;; + esac +elif [ "$cygwin" = "true" ] || [ "$msys" = "true" ]; then + JVM_URL=https://download.oracle.com/java/17/archive/jdk-17.0.3.1_windows-x64_bin.zip + JVM_TARGET_DIR=$BUILD_DIR/jdk-17.0.3.1_windows-x64_bin-d6ede5 +else + JVM_ARCH=$(linux$(getconf LONG_BIT) uname -m) + case $JVM_ARCH in + x86_64) + JVM_URL=https://download.oracle.com/java/17/archive/jdk-17.0.3.1_linux-x64_bin.tar.gz + JVM_TARGET_DIR=$BUILD_DIR/jdk-17.0.3.1_linux-x64_bin-9324ae + ;; + aarch64) + JVM_URL=https://download.oracle.com/java/17/archive/jdk-17.0.3.1_linux-aarch64_bin.tar.gz + JVM_TARGET_DIR=$BUILD_DIR/jdk-17.0.3.1_linux-aarch64_bin-319da6 + ;; + *) + die "Unknown architecture $JVM_ARCH" + ;; + esac +fi + +set -e + +if [ -e "$JVM_TARGET_DIR/.flag" ] && [ -n "$(ls "$JVM_TARGET_DIR")" ] && [ "x$(cat "$JVM_TARGET_DIR/.flag")" = "x${JVM_URL}" ]; then + # Everything is up-to-date in $JVM_TARGET_DIR, do nothing + true +else + echo "Downloading $JVM_URL to $JVM_TEMP_FILE" + + rm -f "$JVM_TEMP_FILE" + mkdir -p "$BUILD_DIR" + if command -v curl >/dev/null 2>&1; then + if [ -t 1 ]; then CURL_PROGRESS="--progress-bar"; else CURL_PROGRESS="--silent --show-error"; fi + # shellcheck disable=SC2086 + curl $CURL_PROGRESS -L --output "${JVM_TEMP_FILE}" "$JVM_URL" 2>&1 + elif command -v wget >/dev/null 2>&1; then + if [ -t 1 ]; then WGET_PROGRESS=""; else WGET_PROGRESS="-nv"; fi + wget $WGET_PROGRESS -O "${JVM_TEMP_FILE}" "$JVM_URL" 2>&1 + else + die "ERROR: Please install wget or curl" + fi + + echo "Extracting $JVM_TEMP_FILE to $JVM_TARGET_DIR" + rm -rf "$JVM_TARGET_DIR" + mkdir -p "$JVM_TARGET_DIR" + + case "$JVM_URL" in + *".zip") unzip "$JVM_TEMP_FILE" -d "$JVM_TARGET_DIR" ;; + *) tar -x -f "$JVM_TEMP_FILE" -C "$JVM_TARGET_DIR" ;; + esac + + rm -f "$JVM_TEMP_FILE" + + echo "$JVM_URL" >"$JVM_TARGET_DIR/.flag" +fi + +JAVA_HOME= +for d in "$JVM_TARGET_DIR" "$JVM_TARGET_DIR"/* "$JVM_TARGET_DIR"/Contents/Home "$JVM_TARGET_DIR"/*/Contents/Home; do + if [ -e "$d/bin/java" ]; then + JAVA_HOME="$d" + fi +done + +if [ '!' -e "$JAVA_HOME/bin/java" ]; then + die "Unable to find bin/java under $JVM_TARGET_DIR" +fi + +# Make it available for child processes +export JAVA_HOME + +set +e + +# GRADLE JVM WRAPPER END MARKER + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..f80956a --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,168 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem GRADLE JVM WRAPPER START MARKER + +setlocal +set BUILD_DIR=%LOCALAPPDATA%\gradle-jvm +set JVM_TARGET_DIR=%BUILD_DIR%\jdk-17.0.3.1_windows-x64_bin-d6ede5\ + +set JVM_URL=https://download.oracle.com/java/17/archive/jdk-17.0.3.1_windows-x64_bin.zip + +set IS_TAR_GZ=0 +set JVM_TEMP_FILE=gradle-jvm.zip + +if /I "%JVM_URL:~-7%"==".tar.gz" ( + set IS_TAR_GZ=1 + set JVM_TEMP_FILE=gradle-jvm.tar.gz +) + +set POWERSHELL=%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe + +if not exist "%JVM_TARGET_DIR%" MD "%JVM_TARGET_DIR%" + +if not exist "%JVM_TARGET_DIR%.flag" goto downloadAndExtractJvm + +set /p CURRENT_FLAG=<"%JVM_TARGET_DIR%.flag" +if "%CURRENT_FLAG%" == "%JVM_URL%" goto continueWithJvm + +:downloadAndExtractJvm + +PUSHD "%BUILD_DIR%" +if errorlevel 1 goto fail + +echo Downloading %JVM_URL% to %BUILD_DIR%\%JVM_TEMP_FILE% +if exist "%JVM_TEMP_FILE%" DEL /F "%JVM_TEMP_FILE%" +"%POWERSHELL%" -nologo -noprofile -Command "Set-StrictMode -Version 3.0; $ErrorActionPreference = \"Stop\"; (New-Object Net.WebClient).DownloadFile('%JVM_URL%', '%JVM_TEMP_FILE%')" +if errorlevel 1 goto fail + +POPD + +RMDIR /S /Q "%JVM_TARGET_DIR%" +if errorlevel 1 goto fail + +MKDIR "%JVM_TARGET_DIR%" +if errorlevel 1 goto fail + +PUSHD "%JVM_TARGET_DIR%" +if errorlevel 1 goto fail + +echo Extracting %BUILD_DIR%\%JVM_TEMP_FILE% to %JVM_TARGET_DIR% + +if "%IS_TAR_GZ%"=="1" ( + tar xf "..\\%JVM_TEMP_FILE%" +) else ( + "%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%', '.');" +) +if errorlevel 1 goto fail + +DEL /F "..\%JVM_TEMP_FILE%" +if errorlevel 1 goto fail + +POPD + +echo %JVM_URL%>"%JVM_TARGET_DIR%.flag" +if errorlevel 1 goto fail + +:continueWithJvm + +set JAVA_HOME= +for /d %%d in ("%JVM_TARGET_DIR%"*) do if exist "%%d\bin\java.exe" set JAVA_HOME=%%d +if not exist "%JAVA_HOME%\bin\java.exe" ( + echo Unable to find java.exe under %JVM_TARGET_DIR% + goto fail +) + +endlocal & set JAVA_HOME=%JAVA_HOME% + +@rem GRADLE JVM WRAPPER END MARKER + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/protocol/build.gradle b/protocol/build.gradle new file mode 100644 index 0000000..7017786 --- /dev/null +++ b/protocol/build.gradle @@ -0,0 +1,17 @@ +plugins { + id 'java' + id 'org.jetbrains.kotlin.jvm' +} + +dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib" + implementation name: "rd-gen" + implementation name: "rider-model" +} + +repositories { + mavenCentral() + flatDir { + dirs rdLibDirectory().absolutePath + } +} \ No newline at end of file diff --git a/publishPlugin.ps1 b/publishPlugin.ps1 new file mode 100644 index 0000000..f236afa --- /dev/null +++ b/publishPlugin.ps1 @@ -0,0 +1,20 @@ +Param( + [string]$Configuration = "Release", + [Parameter(Mandatory=$true)] + [string]$Version, + [Parameter(Mandatory=$true)] + [string]$ApiKey +) + +Set-StrictMode -Version Latest +$ErrorActionPreference = "Stop" +$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent +Set-Location $PSScriptRoot + +. ".\settings.ps1" + +$ChangelogText = ([Regex]::Matches([System.IO.File]::ReadAllText("$PSScriptRoot\CHANGELOG.md"), '(?s)(##.+?.+?)(?=##|$)').Captures | Select -First 10) -Join '' + +Invoke-Exe $MSBuildPath "/t:Restore;Rebuild;Pack" "$SolutionPath" "/v:minimal" "/p:Configuration=$Configuration" "/p:PackageOutputPath=$OutputDirectory" "/p:PackageVersion=$Version" "/p:PackageReleaseNotes=`"$ChangelogText`"" +$PackageFile = "$OutputDirectory\$PluginId.$Version*.nupkg" +Invoke-Exe $NuGetPath push $PackageFile -Source "https://plugins.jetbrains.com/api/v2/package" -ApiKey $ApiKey diff --git a/runVisualStudio.ps1 b/runVisualStudio.ps1 new file mode 100644 index 0000000..9538e78 --- /dev/null +++ b/runVisualStudio.ps1 @@ -0,0 +1,89 @@ +Param( + $RootSuffix = "ODataCliUi", + $Version = "9999.0.0" +) + +Set-StrictMode -Version Latest +$ErrorActionPreference = "Stop" +$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent +Set-Location $PSScriptRoot + +. ".\settings.ps1" + +$UserProjectXmlFile = "$SourceBasePath\$PluginId\$PluginId.csproj.user" + +if (!(Test-Path "$UserProjectXmlFile")) { + # Get versions from Plugin.props file + $PluginPropsFile = "$SourceBasePath\Plugin.props" + $PluginPropsXml = [xml] (Get-Content "$PluginPropsFile") + $SdkVersionNode = $PluginPropsXml.SelectSingleNode(".//SdkVersion") + $VersionSplit = $SdkVersionNode.InnerText.Split(".") + $MajorVersion = "$($VersionSplit[0]).$($VersionSplit[1])" + + # Determine download link + $ReleaseUrl = "https://data.services.jetbrains.com/products/releases?code=RSU&type=eap&type=release&majorVersion=$MajorVersion" + $VersionEntry = $(Invoke-WebRequest -UseBasicParsing $ReleaseUrl | ConvertFrom-Json).RSU[0] + ## TODO: check versions + $DownloadLink = [uri] ($VersionEntry.downloads.windows.link.replace(".exe", ".Checked.exe")) + + # Download installer + $InstallerFile = "$PSScriptRoot\build\installer\$($DownloadLink.Segments[-1])" + if (!(Test-Path $InstallerFile)) { + mkdir -Force $(Split-Path $InstallerFile -Parent) > $null + Write-Output "Downloading $($DownloadLink.Segments[-2].TrimEnd("/")) installer" + (New-Object System.Net.WebClient).DownloadFile($DownloadLink, $InstallerFile) + } else { + Write-Output "Using cached installer from $InstallerFile" + } + + # Execute installer + Write-Output "Installing experimental hive" + Invoke-Exe $InstallerFile "/VsVersion=$VisualStudioMajorVersion.0" "/SpecificProductNames=ReSharper" "/Hive=$RootSuffix" "/Silent=True" + + $Installations = @(Get-ChildItem "$env:LOCALAPPDATA\JetBrains\ReSharperPlatformVs$VisualStudioMajorVersion\vAny_$VisualStudioInstanceId$RootSuffix\NuGet.Config") + if ($Installations.Count -ne 1) { Write-Error "Found no or multiple installation directories: $Installations" } + $InstallationDirectory = $Installations.Directory + Write-Host "Found installation directory at $InstallationDirectory" + + # Adapt packages.config + if (Test-Path "$InstallationDirectory\packages.config") { + $PackagesXml = [xml] (Get-Content "$InstallationDirectory\packages.config") + } else { + $PackagesXml = [xml] ("") + } + + if ($null -eq $PackagesXml.SelectSingleNode(".//package[@id='$PluginId']/@id")) { + $PluginNode = $PackagesXml.CreateElement('package') + $PluginNode.setAttribute("id", "$PluginId") + $PluginNode.setAttribute("version", "$Version") + + $PackagesNode = $PackagesXml.SelectSingleNode("//packages") + $PackagesNode.AppendChild($PluginNode) > $null + + $PackagesXml.Save("$InstallationDirectory\packages.config") + } + + # Adapt user project file + $HostIdentifier = "$($InstallationDirectory.Parent.Name)_$($InstallationDirectory.Name.Split('_')[-1])" + + Set-Content -Path "$UserProjectXmlFile" -Value "" + + $ProjectXml = [xml] (Get-Content "$UserProjectXmlFile") + $HostIdentifierNode = $ProjectXml.SelectSingleNode(".//HostFullIdentifier") + $HostIdentifierNode.InnerText = $HostIdentifier + $ProjectXml.Save("$UserProjectXmlFile") + + # Install plugin + $PluginRepository = "$env:LOCALAPPDATA\JetBrains\plugins" + Remove-Item "$PluginRepository\${PluginId}.${Version}" -Recurse -ErrorAction Ignore + Invoke-Exe $MSBuildPath "/t:Restore;Rebuild;Pack" "$SolutionPath" "/v:minimal" "/p:PackageVersion=$Version" "/p:PackageOutputPath=`"$OutputDirectory`"" + Invoke-Exe $NuGetPath install $PluginId -OutputDirectory "$PluginRepository" -Source "$OutputDirectory" -DependencyVersion Ignore + + Write-Output "Re-installing experimental hive" + Invoke-Exe "$InstallerFile" "/VsVersion=$VisualStudioMajorVersion.0" "/SpecificProductNames=ReSharper" "/Hive=$RootSuffix" "/Silent=True" +} else { + Write-Warning "Plugin is already installed. To trigger reinstall, delete $UserProjectXmlFile." +} + +Invoke-Exe $MSBuildPath "/t:Restore;Rebuild" "$SolutionPath" "/v:minimal" +Invoke-Exe $DevEnvPath "/rootSuffix $RootSuffix" "/ReSharper.Internal" "/ReSharper.LogFile $PSScriptRoot\ReSharper.log" "/ReSharper.LogLevel Trace" diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..03afe75 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,22 @@ +pluginManagement { + // Provide repositories to resolve plugins + repositories { + maven { url "https://cache-redirector.jetbrains.com/plugins.gradle.org" } + maven { url "https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlin-eap" } + maven { url "https://cache-redirector.jetbrains.com/myget.org.rd-snapshots.maven" } + } + resolutionStrategy { + eachPlugin { + // Gradle has to map a plugin dependency to Maven coordinates - '{groupId}:{artifactId}:{version}'. It tries + // to do use '{plugin.id}:{plugin.id}.gradle.plugin:version'. + // This doesn't work for rdgen, so we provide some help + if (requested.id.id == "com.jetbrains.rdgen") { + useModule("com.jetbrains.rd:rd-gen:${requested.version}") + } + } + } +} + +rootProject.name = 'ReSharperPlugin.ODataCliUi' + +include ':protocol' diff --git a/settings.ps1 b/settings.ps1 new file mode 100644 index 0000000..811aa90 --- /dev/null +++ b/settings.ps1 @@ -0,0 +1,34 @@ +$PluginId = "ReSharperPlugin.ODataCliUi" +$SolutionPath = "$PSScriptRoot\ReSharperPlugin.ODataCliUi.sln" +$SourceBasePath = "$PSScriptRoot\src\dotnet" + +$VsWhereOutput = [xml] (& "$PSScriptRoot\tools\vswhere.exe" -format xml -products *) +$VisualStudio = $VsWhereOutput.instances.instance | + Where-Object { $_.channelId -match "Release" } | + Sort-Object -Property installationVersion | + Select-Object -Last 1 + +$VisualStudioBaseDirectory = $VisualStudio.installationPath +$VisualStudioMajorVersion = ($VisualStudio.installationVersion -split '\.')[0] +$VisualStudioInstanceId = $VisualStudio.instanceId +$DevEnvPath = Get-ChildItem "$VisualStudioBaseDirectory\*\IDE\devenv.exe" +$MSBuildPath = Get-ChildItem "$VisualStudioBaseDirectory\MSBuild\*\Bin\MSBuild.exe" + +$OutputDirectory = "$PSScriptRoot\output" +$NuGetPath = "$PSScriptRoot\tools\nuget.exe" + +Function Invoke-Exe { + param( + [parameter(mandatory=$true,position=0)] [ValidateNotNullOrEmpty()] [string] $Executable, + [Parameter(ValueFromRemainingArguments=$true)][String[]] $Arguments, + [parameter(mandatory=$false)] [array] $ValidExitCodes = @(0) + ) + + Write-Host "> $Executable $Arguments" + $rc = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Passthru + $rc.Handle # to initialize handle according to https://stackoverflow.com/a/23797762/2684760 + $rc.WaitForExit() + if (-Not $ValidExitCodes.Contains($rc.ExitCode)) { + throw "'$Executable $Arguments' failed with exit code $($rc.ExitCode), valid exit codes: $ValidExitCodes" + } +} diff --git a/src/dotnet/Directory.Build.props b/src/dotnet/Directory.Build.props new file mode 100644 index 0000000..11eecb1 --- /dev/null +++ b/src/dotnet/Directory.Build.props @@ -0,0 +1,40 @@ + + + + Latest + MSB3277 + true + false + None + + obj\$(MSBuildProjectName)\ + $(DefaultItemExcludes);obj\** + bin\$(MSBuildProjectName)\$(Configuration)\ + + + + TRACE;DEBUG;JET_MODE_ASSERT + + + + + + $(SdkVersion.Substring(2,2))$(SdkVersion.Substring(5,1)).0.0 + + + + + + + + + + + + + + JetResourceGenerator + + + + diff --git a/src/dotnet/Plugin.props b/src/dotnet/Plugin.props new file mode 100644 index 0000000..02a6988 --- /dev/null +++ b/src/dotnet/Plugin.props @@ -0,0 +1,20 @@ + + + + + + 2023.1.0 + + ODataCliUi + Description + + Author + Copyright $([System.DateTime]::Now.Year) Maintainers of ODataCliUi + resharper plugin + + + + + + + diff --git a/src/dotnet/ReSharperPlugin.ODataCliUi.Tests/ReSharperPlugin.ODataCliUi.Tests.csproj b/src/dotnet/ReSharperPlugin.ODataCliUi.Tests/ReSharperPlugin.ODataCliUi.Tests.csproj new file mode 100644 index 0000000..87a7957 --- /dev/null +++ b/src/dotnet/ReSharperPlugin.ODataCliUi.Tests/ReSharperPlugin.ODataCliUi.Tests.csproj @@ -0,0 +1,24 @@ + + + + net472 + false + + + + + + + + + + + + + + + + + + + diff --git a/src/dotnet/ReSharperPlugin.ODataCliUi.Tests/TestEnvironment.cs b/src/dotnet/ReSharperPlugin.ODataCliUi.Tests/TestEnvironment.cs new file mode 100644 index 0000000..485919d --- /dev/null +++ b/src/dotnet/ReSharperPlugin.ODataCliUi.Tests/TestEnvironment.cs @@ -0,0 +1,22 @@ +using System.Threading; +using JetBrains.Application.BuildScript.Application.Zones; +using JetBrains.ReSharper.Feature.Services; +using JetBrains.ReSharper.Psi.CSharp; +using JetBrains.ReSharper.TestFramework; +using JetBrains.TestFramework; +using JetBrains.TestFramework.Application.Zones; +using NUnit.Framework; + +[assembly: Apartment(ApartmentState.STA)] + +namespace ReSharperPlugin.ODataCliUi.Tests +{ + [ZoneDefinition] + public class ODataCliUiTestEnvironmentZone : ITestsEnvZone, IRequire, IRequire { } + + [ZoneMarker] + public class ZoneMarker : IRequire, IRequire, IRequire { } + + [SetUpFixture] + public class ODataCliUiTestsAssembly : ExtensionTestEnvironmentAssembly { } +} diff --git a/src/dotnet/ReSharperPlugin.ODataCliUi.Tests/test/data/nuget.config b/src/dotnet/ReSharperPlugin.ODataCliUi.Tests/test/data/nuget.config new file mode 100644 index 0000000..944042d --- /dev/null +++ b/src/dotnet/ReSharperPlugin.ODataCliUi.Tests/test/data/nuget.config @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/dotnet/ReSharperPlugin.ODataCliUi/IODataCliUiZone.cs b/src/dotnet/ReSharperPlugin.ODataCliUi/IODataCliUiZone.cs new file mode 100644 index 0000000..8b5caf1 --- /dev/null +++ b/src/dotnet/ReSharperPlugin.ODataCliUi/IODataCliUiZone.cs @@ -0,0 +1,13 @@ +using JetBrains.Application.BuildScript.Application.Zones; +using JetBrains.ReSharper.Feature.Services.Daemon; +using JetBrains.ReSharper.Psi; +using JetBrains.ReSharper.Psi.CSharp; + +namespace ReSharperPlugin.ODataCliUi +{ + [ZoneDefinition] + // [ZoneDefinitionConfigurableFeature("Title", "Description", IsInProductSection: false)] + public interface IODataCliUiZone : IZone + { + } +} diff --git a/src/dotnet/ReSharperPlugin.ODataCliUi/ReSharperPlugin.ODataCliUi.Rider.csproj b/src/dotnet/ReSharperPlugin.ODataCliUi/ReSharperPlugin.ODataCliUi.Rider.csproj new file mode 100644 index 0000000..7000469 --- /dev/null +++ b/src/dotnet/ReSharperPlugin.ODataCliUi/ReSharperPlugin.ODataCliUi.Rider.csproj @@ -0,0 +1,15 @@ + + + + net472 + ReSharperPlugin.ODataCliUi + $(AssemblyName) + false + $(DefineConstants);RIDER + + + + + + + diff --git a/src/dotnet/ReSharperPlugin.ODataCliUi/ReSharperPlugin.ODataCliUi.csproj b/src/dotnet/ReSharperPlugin.ODataCliUi/ReSharperPlugin.ODataCliUi.csproj new file mode 100644 index 0000000..11db438 --- /dev/null +++ b/src/dotnet/ReSharperPlugin.ODataCliUi/ReSharperPlugin.ODataCliUi.csproj @@ -0,0 +1,23 @@ + + + + net472 + True + $(DefineConstants);RESHARPER + false + + + + + + + + + + + + + + + + diff --git a/src/rider/main/resources/META-INF/plugin.xml b/src/rider/main/resources/META-INF/plugin.xml new file mode 100644 index 0000000..e061f62 --- /dev/null +++ b/src/rider/main/resources/META-INF/plugin.xml @@ -0,0 +1,15 @@ + + com.jetbrains.rider.plugins.odatacliui + ODataCliUi + _PLACEHOLDER_ + Author + + com.intellij.modules.rider + + +Sample description

+]]> +
+ +
diff --git a/tools/nuget.exe b/tools/nuget.exe new file mode 100644 index 0000000..c4f85f6 Binary files /dev/null and b/tools/nuget.exe differ diff --git a/tools/vswhere.exe b/tools/vswhere.exe new file mode 100644 index 0000000..e3bf5d8 Binary files /dev/null and b/tools/vswhere.exe differ