Skip to content

Commit 5869fe2

Browse files
vol0nEgorkaKulikovArseniy Volynets
authored
Clion plugin for UTBot (#369)
* add content * Refactor grpc related logic (#336) * fix: logs on windows * Refactor actions and their neighborhood (#346) * Little improvements related to TODOs in code of CLion plugin (#351) * Refactor settings in CLion plugin (#350) * Skip coverage line indexes which are out of bounds * rename client -> currentClient * Add comments on initialization * Refactor UI and Utils related logic (#357) * Refactor some other pieces of code (#358) * Add refresh action, show busy icon on refresh (#361) * Improve some texts in CLion plugin (#362) * Update readme.me file * Update usage.md file * Other corrections * Little correction * Fix: do not show canceled notification on error * Fix: standalone coroutine exception canceled * Fix: source folder view pane not working * fix coverage * Use noStateLoaded for state initialization * fixes * correct mark/unmark actions' names * Refactor UTBotRunWithCoverageLineMarkerInfo * Add button for local/wsl scenario, use spinners for int fields * Bring all package names into line with naming requirements (#368) * fix settings (#367) * Fix: settings are not persisted, swap run icons - when in Configurable we used: project.settings.storedSettings it would return some instance of state. And because state can change, writes to that instance were not saved and so settings were not persisted - Fixed a bug with test run icons, "Run all tests" was swapped with "Run test" * Do not use projectPath, use project.path * fix: verbose mode enabling/disabling doesn't work * show wizard on project open * fix test dir setting * remove custome target, persist selected target * Little suggested changes * Some improvements to targets * fix: connectionSettingsChangedNotFired after settings changed Co-authored-by: Egor Kulikov <[email protected]> * use markDirtyAndRefresh (#371) * Don't change directory status on double click * Fix tests * fix tests * fix tests * fix tests * restore .vscode/settings.json * restore .vscode/settings.json * fix: with prompted result * remove 'Detect path' button * Remove local or wsl checkbox in settings * change default build folder to 'build' * add plugin artifact during publish-utbot workflow (#375) * modify workflows to include clion artifact * Use actions/setup-java for setting up jdk * fix ci * backup sarif report (#379) * Backup sarif report * backup sarif report * Little code improvements * handle one sarif report Co-authored-by: Egor Kulikov <[email protected]> * add run all tests and show coverage action (#378) * Merge coverage * Add action * small fix * small fix * Update md files and icons (#381) * remove dummy server * remove workflows from IJ Platform template * small fix * fix with prompted result action * fix blinking during generation * change actions names in search, fix progress * change vendor && notification group id * fix defaults, fix notification group, use spinner * disable timeout per function * restore use stubs Co-authored-by: Egor Kulikov <[email protected]> Co-authored-by: Arseniy Volynets <[email protected]>
1 parent 64b0daf commit 5869fe2

File tree

183 files changed

+7010
-1
lines changed

Some content is hidden

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

183 files changed

+7010
-1
lines changed

.github/workflows/build-utbot.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,23 @@ jobs:
9494
./docker/action-scripts/build-vsix.sh
9595
chmod +x docker/action-scripts/integration-tests.sh
9696
./docker/action-scripts/integration-tests.sh
97+
- name: Setup Java for building CLion plugin
98+
uses: actions/setup-java@v3
99+
with:
100+
distribution: zulu
101+
java-version: 11
102+
- name: Run CLion integration tests
103+
run: |
104+
chmod +x docker/action-scripts/runClionIntegrationTests.sh
105+
./docker/action-scripts/runClionIntegrationTests.sh
106+
- name: Upload logs
107+
uses: actions/upload-artifact@v2
108+
if: failure()
109+
with:
110+
name: test-report
111+
path: |
112+
/github/home/logs
113+
clion-plugin/build/reports/tests/**/*
97114
98115
build-utbot-and-generate-test:
99116
needs: matrix-prep

.github/workflows/publish-utbot.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ jobs:
6565
run: |
6666
chmod +x docker/action-scripts/build-vsix.sh
6767
./docker/action-scripts/build-vsix.sh
68+
- name: Setup Java for building CLion plugin
69+
uses: actions/setup-java@v3
70+
with:
71+
distribution: zulu
72+
java-version: 11
73+
- name: build CLion plugin
74+
run: |
75+
chmod +x docker/action-scripts/build-clion-plugin.sh
76+
./docker/action-scripts/build-clion-plugin.sh
6877
- name: build UTBot
6978
run: |
7079
chmod +x docker/action-scripts/build-utbot.sh

clion-plugin/.gitignore

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Compiled class file
2+
*.class
3+
4+
# Log file
5+
*.log
6+
7+
# BlueJ files
8+
*.ctxt
9+
10+
# Mobile Tools for Java (J2ME)
11+
.mtj.tmp/
12+
13+
# Package Files #
14+
*.war
15+
*.nar
16+
*.ear
17+
*.zip
18+
*.tar.gz
19+
*.rar
20+
21+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
22+
hs_err_pid*
23+
24+
# gradle directory
25+
.gradle
26+
27+
# idea settings
28+
.idea
29+
30+
# quadana settings
31+
.qodana
32+
33+
# build files
34+
build
35+
36+
#macos files
37+
.DS_Store
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="Run IDE for UI Tests" type="GradleRunConfiguration" factoryName="Gradle">
3+
<log_file alias="idea.log" path="$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log" />
4+
<ExternalSystemSettings>
5+
<option name="executionName" />
6+
<option name="externalProjectPath" value="$PROJECT_DIR$" />
7+
<option name="externalSystemIdString" value="GRADLE" />
8+
<option name="scriptParameters" value="runIdeForUiTests" />
9+
<option name="taskDescriptions">
10+
<list />
11+
</option>
12+
<option name="taskNames">
13+
<list />
14+
</option>
15+
<option name="vmOptions" />
16+
</ExternalSystemSettings>
17+
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
18+
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
19+
<DebugAllEnabled>false</DebugAllEnabled>
20+
<method v="2" />
21+
</configuration>
22+
</component>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="Run Plugin" type="GradleRunConfiguration" factoryName="Gradle">
3+
<log_file alias="idea.log" path="$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log" />
4+
<ExternalSystemSettings>
5+
<option name="executionName" />
6+
<option name="externalProjectPath" value="$PROJECT_DIR$" />
7+
<option name="externalSystemIdString" value="GRADLE" />
8+
<option name="scriptParameters" value="--info" />
9+
<option name="taskDescriptions">
10+
<list />
11+
</option>
12+
<option name="taskNames">
13+
<list>
14+
<option value="runIde" />
15+
</list>
16+
</option>
17+
<option name="vmOptions" value="" />
18+
</ExternalSystemSettings>
19+
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
20+
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
21+
<DebugAllEnabled>false</DebugAllEnabled>
22+
<method v="2" />
23+
</configuration>
24+
</component>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="Run Tests" type="GradleRunConfiguration" factoryName="Gradle">
3+
<log_file alias="idea.log" path="$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log" />
4+
<ExternalSystemSettings>
5+
<option name="executionName" />
6+
<option name="externalProjectPath" value="$PROJECT_DIR$" />
7+
<option name="externalSystemIdString" value="GRADLE" />
8+
<option name="scriptParameters" value="" />
9+
<option name="taskDescriptions">
10+
<list />
11+
</option>
12+
<option name="taskNames">
13+
<list>
14+
<option value="test" />
15+
</list>
16+
</option>
17+
<option name="vmOptions" value="" />
18+
</ExternalSystemSettings>
19+
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
20+
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
21+
<DebugAllEnabled>false</DebugAllEnabled>
22+
<method v="2" />
23+
</configuration>
24+
</component>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="Run Verifications" type="GradleRunConfiguration" factoryName="Gradle">
3+
<log_file alias="idea.log" path="$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log" />
4+
<ExternalSystemSettings>
5+
<option name="executionName" />
6+
<option name="externalProjectPath" value="$PROJECT_DIR$" />
7+
<option name="externalSystemIdString" value="GRADLE" />
8+
<option name="scriptParameters" value="" />
9+
<option name="taskDescriptions">
10+
<list />
11+
</option>
12+
<option name="taskNames">
13+
<list>
14+
<option value="runPluginVerifier" />
15+
</list>
16+
</option>
17+
<option name="vmOptions" value="" />
18+
</ExternalSystemSettings>
19+
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
20+
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
21+
<DebugAllEnabled>false</DebugAllEnabled>
22+
<method v="2">
23+
<option name="Gradle.BeforeRunTask" enabled="true" tasks="clean" externalProjectPath="$PROJECT_DIR$" vmOptions="" scriptParameters="" />
24+
</method>
25+
</configuration>
26+
</component>

clion-plugin/.run/Run Qodana.run.xml

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

clion-plugin/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<!-- Keep a Changelog guide -> https://keepachangelog.com -->
2+
3+
# UTBotCppClion Changelog
4+
5+
## [Unreleased]
6+
### Added
7+
- Initial scaffold created from [IntelliJ Platform Plugin Template](https://github.com/JetBrains/intellij-platform-plugin-template)

clion-plugin/CONFIGURATION.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Configuration
2+
3+
## Remote Scenario
4+
5+
If you run UTBot and CLion on different hosts, synchronization of project files is required:
6+
7+
- If UTBot is run inside the Docker container, mount your project folder to Docker.
8+
- If UTBot is run under WSL, no additional configuration required, just
9+
specify remote path to your project in `Settings` or use `Quickstart Wizard` to
10+
fill it for you.
11+
- If server is not run locally, CLion deployment can be used for synchronization, although it won't be
12+
fully automated, look at information below:
13+
14+
### Configuring CLion SFTP deployment for remote scenario
15+
16+
To configure SFTP do the following:
17+
18+
- Open `Settings -> Build, Execution, Deployment -> Deployment`
19+
- Create SFTP configuration: click `+` and choose or create SSH config with server host and port, than
20+
specify the path to your project on the remote machine in mappings, it is the same path you have specified
21+
in `Settings` for remote path
22+
- Go to `Options` and turn on upload on change:
23+
24+
![](images/plugin_usage/sftp/sftp-config.gif)
25+
26+
- Go to `Project view` and right-click on your project root, then
27+
choose `Deployment`, click `Upload to ...` and choose the name of your
28+
SFTP configuration:
29+
30+
![](images/plugin_usage/sftp/upload.gif)
31+
32+
Now server can access your project files.
33+
34+
When you change your files, CLion should upload changes to server.
35+
36+
## Local scenario
37+
38+
Wizard allows you to configure your project quickly without specifying different options manually in
39+
`Settings`. When you open your project for the first time, UTBot Wizard will be shown.
40+
41+
![](images/plugin_usage/wizard/wizard-welcome.png)
42+
43+
### Connection
44+
45+
After the first introductory step, you will be asked to
46+
fill several settings: server port, server host and remote path.
47+
Remote path specifies path to project on remote machine.
48+
49+
If UTBot is run on WSL or Linux (on the local machine), be sure
50+
to check the checkbox that fills in default values for the path and the port.
51+
52+
![](images/plugin_usage/wizard/wizard-connection.png)
53+
54+
### Build Directory and CMake Options
55+
56+
On the final Wizard step, UTBot will ask you to:
57+
- specify relative path to the build directory
58+
- set custom CMake options
59+
60+
![](images/plugin_usage/wizard/wizard-build-options.png)
61+
62+
### Demo
63+
64+
A demo how to go through the wizard:
65+
66+
![](images/plugin_usage/wizard/wizard-demo.gif)
67+
68+
## Plugin settings
69+
70+
The recommended way to configure plugin is to use UTBot Wizard.
71+
72+
If some advanced settings are required, specify them in `Settings -> Tools -> UTBot Settings`
73+
74+
![](images/plugin_usage/settings-demo.gif)
75+
76+
### Remote path
77+
78+
Remote path is a path to your project on the remote host. If UTBot is run locally, leave it empty.
79+
80+
81+
## Check configuration
82+
83+
When the connection to server is established, you can check project configuration
84+
to make sure that all path are specified correctly: just invoke `Configure project` action:
85+
86+
![](images/check-config/check-not.gif)
87+
88+
When project is configured, `Project is configured` notification appears:
89+
90+
![](images/check-config/check-ok.gif)
91+
92+
When plugin is configured and configuration is checked, you can start using plugin to generate tests.
93+
For further details how to use plugin see `USAGE.md`.

clion-plugin/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Software-Analysis-Team
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

clion-plugin/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# UTBotCpp-CLion-plugin
2+
<!-- Plugin description -->
3+
Plugin to communicate with [UTBotCpp](https://github.com/UnitTestBot/UTBotCpp) server in CLion.
4+
<!-- Plugin description end -->
5+
6+
### Installation
7+
8+
1. Open CLion. Go to `Settings -> plugins`
9+
2. Uninstall the previous version of plugin. Skip this step if you install it for the first time
10+
3. Click on `Settings` icon and then choose `Install from disk`
11+
![](images/install/install-from-disk.png)
12+
4. Choose plugin's zip file: `clion_plugin.zip`
13+
5. Restart CLion
14+
15+
See `CONFIGURATION.md` to configure the plugin before use.

0 commit comments

Comments
 (0)