Skip to content

Commit 57e18e2

Browse files
committed
Update gradle build
1 parent 5feae7c commit 57e18e2

File tree

12 files changed

+288
-197
lines changed

12 files changed

+288
-197
lines changed

.idea/deployment.xml

Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules/prettify-python.test.iml

Lines changed: 0 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules/ru.meanmail.prettify-python.main.iml

Lines changed: 0 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.

build.gradle.kts

Lines changed: 76 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,56 @@
1-
import org.jetbrains.intellij.tasks.PatchPluginXmlTask
21
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
32

4-
plugins {
5-
java
6-
kotlin("jvm") version "1.4.30"
7-
id("org.jetbrains.intellij") version "0.7.2"
8-
}
9-
10-
group = "ru.meanmail"
11-
version = "${project.properties["version"]}-${project.properties["postfix"]}"
3+
fun config(name: String) = project.findProperty(name).toString()
124

135
repositories {
146
mavenCentral()
157
}
168

17-
dependencies {
18-
implementation(kotlin("stdlib-jdk8"))
19-
testImplementation("junit:junit:4.13.2")
20-
}
21-
22-
configure<JavaPluginConvention> {
23-
sourceCompatibility = JavaVersion.VERSION_1_8
24-
}
25-
26-
tasks.withType<KotlinCompile> {
27-
kotlinOptions.jvmTarget = "11"
28-
}
29-
30-
tasks.withType<Wrapper> {
31-
distributionType = Wrapper.DistributionType.ALL
32-
gradleVersion = project.properties["gradleVersion"].toString()
9+
plugins {
10+
java
11+
kotlin("jvm") version "1.5.10"
12+
id("org.jetbrains.intellij") version "1.3.0"
3313
}
3414

35-
tasks.test {
36-
useJUnit()
15+
group = config("group")
16+
version = "${config("version")}-${config("platformVersion")}"
3717

38-
maxHeapSize = "1G"
18+
dependencies {
19+
compileOnly("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.10")
20+
testImplementation("junit:junit:4.13.2")
3921
}
4022

4123
intellij {
42-
pluginName = project.properties["pluginName"].toString()
43-
version = if (project.properties["eap"].toString() == "true") {
44-
"LATEST-EAP-SNAPSHOT"
45-
} else {
46-
project.properties["IdeVersion"].toString()
47-
}
48-
type = project.properties["ideType"].toString()
49-
when (type) {
50-
"PY" -> {
51-
setPlugins("python")
24+
pluginName.set(config("pluginName"))
25+
version.set(
26+
if (config("platformVersion") == "eap") {
27+
"LATEST-EAP-SNAPSHOT"
28+
} else {
29+
config("platformVersion")
5230
}
53-
"PC" -> {
54-
setPlugins("PythonCore")
31+
)
32+
type.set(config("platformType"))
33+
34+
val usePlugins = config("usePlugins").split(',')
35+
for (plugin in usePlugins) {
36+
if (plugin.isEmpty()) {
37+
continue
5538
}
56-
else -> {
57-
setPlugins(project.properties["pythonPluginVersion"].toString())
39+
val (name, version) = plugin.split(':')
40+
if (name == "python") {
41+
when (type.get()) {
42+
"PY" -> {
43+
plugins.add("python")
44+
}
45+
"PC" -> {
46+
plugins.add("PythonCore")
47+
}
48+
else -> {
49+
plugins.add("PythonCore:${version}")
50+
}
51+
}
52+
} else {
53+
plugins.add(plugin)
5854
}
5955
}
6056
}
@@ -88,11 +84,44 @@ fun readChangeNotes(pathname: String): String {
8884
it.joinToString("<br>")
8985
} +
9086
"See the full change notes on the <a href='" +
91-
project.properties["repository"] +
92-
"/blob/master/ChangeNotes.md'>github</a>"
87+
config("repository") +
88+
"/blob/master/CHANGES.md'>github</a>"
9389
}
9490

95-
tasks.withType<PatchPluginXmlTask> {
96-
setPluginDescription(file("Description.html").readText())
97-
setChangeNotes(readChangeNotes("ChangeNotes.md"))
91+
tasks {
92+
config("jvmVersion").let {
93+
withType<JavaCompile> {
94+
sourceCompatibility = it
95+
targetCompatibility = it
96+
}
97+
withType<KotlinCompile> {
98+
kotlinOptions.jvmTarget = it
99+
}
100+
}
101+
102+
wrapper {
103+
distributionType = Wrapper.DistributionType.ALL
104+
gradleVersion = config("gradleVersion")
105+
}
106+
107+
test {
108+
useJUnit()
109+
110+
maxHeapSize = "1G"
111+
}
112+
113+
patchPluginXml {
114+
version.set(project.version.toString())
115+
pluginDescription.set(file("description.html").readText())
116+
changeNotes.set(readChangeNotes("CHANGES.md"))
117+
}
118+
119+
publishPlugin {
120+
dependsOn("buildPlugin")
121+
token.set(System.getenv("PUBLISH_TOKEN"))
122+
channels.set(listOf(config("publishChannel")))
123+
}
124+
buildSearchableOptions {
125+
enabled = false
126+
}
98127
}
File renamed without changes.

gradle.properties

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
# Gradle
2-
gradleVersion=6.8.2
2+
gradleVersion=7.3
33
org.gradle.parallel=true
4+
jvmVersion=11
5+
#
46
# Plugin
7+
group=dev.meanmail
58
repository=https://github.com/meanmail/prettify-python-plugin
69
pluginName=Prettify python
7-
version=2020.3
8-
postfix=212
9-
# IDE
10-
eap=false
11-
IdeVersion=2021.2
12-
ideType=PC
13-
pythonPluginVersion=PythonCore:212.4746.92
10+
version=2020.2
11+
# https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library
12+
kotlin.stdlib.default.dependency=false
13+
#
14+
# Platform
15+
platformVersion=213-EAP-SNAPSHOT
16+
platformType=PC
17+
usePlugins=python:213.4293.20
18+
#
19+
# Publish
20+
publishChannel=default

gradle/wrapper/gradle-wrapper.jar

626 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.7-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)