-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle.kts
105 lines (86 loc) · 2.93 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.util.*
val projectVersion = "1.0.0"
group = "org.jetbrains.research.ml.ast.transformations"
version = projectVersion
fun properties(key: String) = project.findProperty(key).toString()
plugins {
java
kotlin("jvm") version "1.7.21" apply true
id("org.jetbrains.intellij") version "1.10.0" apply true
id("org.jetbrains.dokka") version "1.7.0" apply true
id("org.jlleitschuh.gradle.ktlint") version "10.3.0" apply true
`maven-publish`
}
allprojects {
apply {
apply {
plugin("java")
plugin("kotlin")
plugin("org.jetbrains.intellij")
plugin("org.jetbrains.dokka")
plugin("org.jlleitschuh.gradle.ktlint")
}
}
intellij {
pluginName.set(properties("pluginName"))
version.set(properties("platformVersion"))
type.set(properties("platformType"))
plugins.set(properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty))
}
repositories {
mavenCentral()
}
dependencies {
implementation(kotlin("stdlib-jdk8"))
}
ktlint {
enableExperimentalRules.set(true)
}
tasks {
withType<JavaCompile> {
sourceCompatibility = "17"
targetCompatibility = "17"
}
withType<KotlinCompile> {
kotlinOptions.jvmTarget = "17"
}
// According to this topic:
// https://intellij-support.jetbrains.com/hc/en-us/community/posts/360010164960-Build-Intellij-plugin-in-IDEA-2019-1-2020-3?page=1#community_comment_360002517940
withType<org.jetbrains.intellij.tasks.BuildSearchableOptionsTask>()
.forEach { it.enabled = false }
}
}
fun getLocalProperty(key: String, file: String = "local.properties"): String? {
val properties = Properties()
File("local.properties")
.takeIf { it.isFile }
?.let { properties.load(it.inputStream()) }
?: println("File $file with properties not found")
return properties.getProperty(key, null)
}
val spaceUsername = getLocalProperty("spaceUsername")
val spacePassword = getLocalProperty("spacePassword")
configure(subprojects.filter { it.name != "plugin-utilities-plugin" }) {
apply(plugin = "maven-publish")
val subprojectName = this.name
publishing {
publications {
register<MavenPublication>("maven") {
groupId = "org.jetbrains.research.ml.ast.transformations"
artifactId = subprojectName
version = projectVersion
from(components["java"])
}
}
repositories {
maven {
url = uri("https://packages.jetbrains.team/maven/p/bumblebee/bumblebee")
credentials {
username = spaceUsername
password = spacePassword
}
}
}
}
}