Skip to content

Commit 0e897c9

Browse files
authored
Merge pull request #1813 from Haehnchen/feature/gradle-kotlin
migrating gradle build from groovy to kotlin
2 parents ab82635 + 35014db commit 0e897c9

File tree

6 files changed

+148
-87
lines changed

6 files changed

+148
-87
lines changed

build.gradle

Lines changed: 0 additions & 80 deletions
This file was deleted.

build.gradle.kts

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2+
3+
fun properties(key: String) = project.findProperty(key).toString()
4+
5+
plugins {
6+
// Java support
7+
id("java")
8+
// Kotlin support
9+
id("org.jetbrains.kotlin.jvm") version "1.6.10"
10+
// Gradle IntelliJ Plugin
11+
id("org.jetbrains.intellij") version "1.4.0"
12+
// Gradle Changelog Plugin
13+
id("org.jetbrains.changelog") version "1.3.1"
14+
// Gradle Qodana Plugin
15+
id("org.jetbrains.qodana") version "0.1.13"
16+
}
17+
18+
group = properties("pluginGroup")
19+
version = properties("pluginVersion")
20+
21+
// Configure project's dependencies
22+
repositories {
23+
mavenCentral()
24+
}
25+
26+
dependencies {
27+
implementation("org.junit.jupiter:junit-jupiter:5.8.2")
28+
testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.8.2")
29+
}
30+
31+
// Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
32+
intellij {
33+
pluginName.set(properties("pluginName"))
34+
version.set(properties("platformVersion"))
35+
type.set(properties("platformType"))
36+
37+
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
38+
plugins.set(properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty))
39+
}
40+
41+
// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
42+
changelog {
43+
version.set(properties("pluginVersion"))
44+
groups.set(emptyList())
45+
}
46+
47+
// Configure Gradle Qodana Plugin - read more: https://github.com/JetBrains/gradle-qodana-plugin
48+
qodana {
49+
cachePath.set(projectDir.resolve(".qodana").canonicalPath)
50+
reportPath.set(projectDir.resolve("build/reports/inspections").canonicalPath)
51+
saveReport.set(true)
52+
showReport.set(System.getenv("QODANA_SHOW_REPORT")?.toBoolean() ?: false)
53+
}
54+
55+
tasks {
56+
// Set the JVM compatibility versions
57+
properties("javaVersion").let {
58+
withType<JavaCompile> {
59+
sourceCompatibility = it
60+
targetCompatibility = it
61+
}
62+
withType<KotlinCompile> {
63+
kotlinOptions.jvmTarget = it
64+
}
65+
}
66+
67+
wrapper {
68+
gradleVersion = properties("gradleVersion")
69+
}
70+
71+
patchPluginXml {
72+
version.set(properties("pluginVersion"))
73+
sinceBuild.set(properties("pluginSinceBuild"))
74+
// untilBuild.set(properties("pluginUntilBuild"))
75+
76+
// Get the latest available change notes from the changelog file
77+
changeNotes.set(provider {
78+
changelog.run {
79+
getOrNull(properties("pluginVersion")) ?: getLatest()
80+
}.toHTML()
81+
})
82+
}
83+
84+
// Configure UI tests plugin
85+
// Read more: https://github.com/JetBrains/intellij-ui-test-robot
86+
runIdeForUiTests {
87+
systemProperty("robot-server.port", "8082")
88+
systemProperty("ide.mac.message.dialogs.as.sheets", "false")
89+
systemProperty("jb.privacy.policy.text", "<!--999.999-->")
90+
systemProperty("jb.consents.confirmation.enabled", "false")
91+
}
92+
93+
signPlugin {
94+
certificateChain.set(System.getenv("CERTIFICATE_CHAIN"))
95+
privateKey.set(System.getenv("PRIVATE_KEY"))
96+
password.set(System.getenv("PRIVATE_KEY_PASSWORD"))
97+
}
98+
99+
publishPlugin {
100+
dependsOn("patchChangelog")
101+
token.set(System.getenv("PUBLISH_TOKEN"))
102+
// pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
103+
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
104+
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
105+
channels.set(listOf(properties("pluginVersion").split('-').getOrElse(1) { "default" }.split('.').first()))
106+
}
107+
108+
test {
109+
// Support "setUp" like "BasePlatformTestCase::setUp" as valid test structure
110+
useJUnitPlatform {
111+
includeEngines("junit-vintage")
112+
}
113+
}
114+
}

gradle.properties

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,32 @@
1-
ideaVersion = IU-2021.3
2-
phpPluginVersion = 213.5744.279
3-
twigPluginVersion = 213.5744.224
4-
dqlPluginVersion = 213.5744.125
5-
toolboxPluginVersion = 0.4.6
6-
annotationPluginVersion = 5.3
1+
# IntelliJ Platform Artifacts Repositories
2+
# -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html
3+
4+
pluginGroup = fr.adrienbrault.idea.symfony2plugin
5+
pluginName = Symfony Plugin
6+
7+
# SemVer format -> https://semver.org
8+
pluginVersion = 0.23.217
9+
10+
# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
11+
# for insight into build numbers and IntelliJ Platform versions.
12+
pluginSinceBuild = 211
13+
pluginUntilBuild =
14+
15+
# IntelliJ Platform Properties -> https://github.com/JetBrains/gradle-intellij-plugin#intellij-platform-properties
16+
platformType = IU
17+
platformVersion = 2021.3
18+
19+
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
20+
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
21+
platformPlugins = java,yaml,xpath,webDeployment,com.jetbrains.php:213.5744.279,de.espend.idea.php.annotation:5.3,de.espend.idea.php.toolbox:6.0.0,com.jetbrains.twig:213.5744.224,com.jetbrains.php.dql:213.5744.125
22+
23+
# Java language level used to compile sources and to generate the files for - Java 11 is required since 2020.3
24+
javaVersion = 11
25+
26+
# Gradle Releases -> https://github.com/gradle/gradle/releases
27+
gradleVersion = 7.4
28+
29+
# Opt-out flag for bundling Kotlin standard library.
30+
# See https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library for details.
31+
# suppress inspection "UnusedProperty"
32+
kotlin.stdlib.default.dependency = false

gradle/wrapper/gradle-wrapper.jar

618 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

settings.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = "Symfony Plugin"

0 commit comments

Comments
 (0)