generated from JetBrains/intellij-platform-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
148 lines (136 loc) · 4.52 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
fun properties(key: String) = providers.gradleProperty(key)
fun environment(key: String) = providers.environmentVariable(key)
plugins {
// Java support
id("java")
// Kotlin support
alias(libs.plugins.kotlin)
// gradle-intellij-plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
alias(libs.plugins.gradleIntelliJPlugin) apply false
// gradle-changelog-plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
alias(libs.plugins.changelog) apply false
// Gradle Kover Plugin
alias(libs.plugins.kover)
`maven-publish` // for pom generation
alias(libs.plugins.aar2jar) apply false
}
// Configure root project
tasks {
wrapper {
gradleVersion = properties("gradleVersion").get()
}
}
allprojects {
group = properties("pluginGroup").get()
version = properties("pluginVersion").get()
repositories {
mavenCentral()
maven {
url = uri("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
content {
// Download only these groups from the repository
includeGroup("com.intellij.remoterobot")
}
}
maven {
url = uri("https://oss.sonatype.org/content/repositories/snapshots/")
content {
// Download only these groups from the repository
includeGroup("org.beanshell")
}
}
maven {
url = uri("https://jitpack.io")
content {
// Download only these groups from the repository
includeGroup("com.github.beanshell")
includeGroup("com.github.TarCV")
}
}
google {
metadataSources {
// Redirection breaks aar2jar transformation
ignoreGradleMetadataRedirection()
mavenPom()
}
}
}
tasks {
withType<AbstractArchiveTask>().configureEach {
// Settings for reproducibility
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
filePermissions {
unix("rw-r--r--")
}
}
}
afterEvaluate {
tasks {
withType<Jar> {
manifest {
// Settings for reproducibility
attributes.replaceAll { k, v ->
when (k) {
"Build-JVM" -> {
v.toString()
.replace(Regex("""(?<=[\.\+])\d+"""), "0")
.replace(Regex("""(?<=\().+?(?=\d)"""), "_ ")
.replace(Regex("""\D+(?=\))"""), "")
.replace(Regex("""[+-][A-Za-z_]+"""), "")
}
"Build-OS" -> {
v.toString()
.replace(Regex("""(?<=\.)\d+"""), "0")
.replace(Regex("""[+-]\d+"""), "")
.replace(Regex("""[+-][A-Za-z_]+"""), "")
}
else -> v
}
}
}
// Settings for reproducibility
}
}
}
}
subprojects {
apply(plugin = "maven-publish")
apply(plugin = "kotlin")
// Set the JVM language level used to build the project. Use Java 17 for 2022.2+.
kotlin {
jvmToolchain(17)
}
project.afterEvaluate {
dependencies {
implementation(platform(libs.junitBom))
implementation(platform(libs.kotlinBom))
}
publishing {
publications {
artifacts {
create<MavenPublication>("artifact") {
from(components["java"])
}
}
}
}
task("copyPomForCi", Sync::class) {
dependsOn("generatePomFileForArtifactPublication")
from("build/publications/artifact")
into("${rootProject.projectDir}/ci/poms/${project.projectDir.name}")
include("pom-default.xml")
rename("pom-default.xml", "pom.xml")
}
}
}
// Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration
kover {
reports {
total {
xml {
onCheck = true
}
}
}
}