Skip to content

Commit 3eccb21

Browse files
committed
test gradle projects
add tests for gradle DSLs - groovy - kotlin import fails for gradle kotlin DSL
1 parent 7f1f99e commit 3eccb21

File tree

2 files changed

+50
-5
lines changed

2 files changed

+50
-5
lines changed

features/ImportProject.feature

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,19 @@ Feature: Importing projects
77
And I add project "m" folder "tmp" to the list of workspace folders
88
And I start lsp-java
99
Then The server status must become "LSP::Started"
10+
11+
Scenario: Gradle Groovy DSL projects
12+
Given I have gradle groovy DSL project "m" in "tmp"
13+
And I have a java file "tmp/m/src/main/java/temp/App.java"
14+
And I clear the buffer
15+
And I add project "m" folder "tmp" to the list of workspace folders
16+
And I start lsp-java
17+
Then The server status must become "LSP::Started"
18+
19+
Scenario: Gradle Kotlin DSL projects
20+
Given I have gradle kotlin DSL project "m" in "tmp"
21+
And I have a java file "tmp/m/src/main/java/temp/App.java"
22+
And I clear the buffer
23+
And I add project "m" folder "tmp" to the list of workspace folders
24+
And I start lsp-java
25+
Then The server status must become "LSP::Started"

features/step-definitions/lsp-java-steps.el

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@
3939
(setq retry-count (1+ retry-count))
4040
(message "The function failed, attempt %s" retry-count)))))))
4141

42-
(Given "^I have maven project \"\\([^\"]+\\)\" in \"\\([^\"]+\\)\"$"
43-
(lambda (project-name dir-name)
42+
(defun lsp-java-steps-project (project-name dir-name config-name config)
4443
(setq default-directory lsp-java-test-root)
4544

4645
;; delete old directory
@@ -52,8 +51,12 @@
5251
(f-join dir-name project-name "src" "main" "java" "temp")) t)
5352

5453
;; add pom.xml
55-
(with-temp-file (expand-file-name "pom.xml" (f-join dir-name project-name))
56-
(insert "
54+
(with-temp-file (expand-file-name config-name (f-join dir-name project-name))
55+
(insert config)))
56+
57+
(Given "^I have maven project \"\\([^\"]+\\)\" in \"\\([^\"]+\\)\"$"
58+
(lambda (project-name dir-name)
59+
(lsp-java-steps-project project-name dir-name "pom.xml" "
5760
<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
5861
xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">
5962
<modelVersion>4.0.0</modelVersion>
@@ -68,7 +71,33 @@
6871
<maven.compiler.source>1.8</maven.compiler.source>
6972
<maven.compiler.target>1.8</maven.compiler.target>
7073
</properties>
71-
</project>"))))
74+
</project>")))
75+
76+
(Given "^I have gradle groovy DSL project \"\\([^\"]+\\)\" in \"\\([^\"]+\\)\"$"
77+
(lambda (project-name dir-name)
78+
(lsp-java-steps-project project-name dir-name "build.gradle" "
79+
plugins {
80+
id 'java'
81+
}
82+
repositories {
83+
jcenter()
84+
}
85+
dependencies {
86+
implementation 'com.google.guava:guava:27.0.1-jre'
87+
}")))
88+
89+
(Given "^I have gradle kotlin DSL project \"\\([^\"]+\\)\" in \"\\([^\"]+\\)\"$"
90+
(lambda (project-name dir-name)
91+
(lsp-java-steps-project project-name dir-name "build.gradle.kts" "
92+
plugins {
93+
java
94+
}
95+
repositories {
96+
jcenter()
97+
}
98+
dependencies {
99+
implementation(\"com.google.guava:guava:27.0.1-jre\")
100+
}")))
72101

73102
(And "^I have a java file \"\\([^\"]+\\)\"$"
74103
(lambda (file-name)

0 commit comments

Comments
 (0)