-
Notifications
You must be signed in to change notification settings - Fork 11
/
build.gradle.kts
137 lines (111 loc) · 4.1 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
import io.gitlab.arturbosch.detekt.DetektPlugin
import io.gitlab.arturbosch.detekt.extensions.DetektExtension
import org.cqfn.diktat.plugin.gradle.DiktatExtension
import org.cqfn.diktat.plugin.gradle.DiktatGradlePlugin
import org.jetbrains.kotlin.gradle.dsl.KotlinCompile
plugins {
`maven-publish`
alias(libs.plugins.detekt)
alias(libs.plugins.diktat)
alias(libs.plugins.kotlin.jvm)
}
group = "org.jetbrains.reflekt"
version = libs.versions.kotlin.get()
description = "Reflekt is a compile-time reflection library that leverages the flows of the standard reflection approach and can find classes, objects " +
"(singleton classes) or functions by some conditions in compile-time."
allprojects {
apply(plugin = "kotlin")
apply(plugin = "maven-publish")
tasks.withType<KotlinCompile<*>> {
kotlinOptions.freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
}
java {
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_11
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().all {
kotlinOptions {
jvmTarget = "11"
}
}
repositories {
mavenCentral()
}
// We should publish the project in the local maven repository before the tests running
tasks.withType<Test> {
dependsOn(
tasks.withType<PublishToMavenLocal>(),
":reflekt-plugin:jar",
gradle.includedBuild("using-embedded-kotlin").task(":reflekt-dsl:jar")
)
}
apply<DiktatGradlePlugin>()
configure<DiktatExtension> {
diktatConfigFile = rootProject.file("diktat-analysis.yml")
inputs {
include("src/main/**/*.kt")
}
}
apply<DetektPlugin>()
configure<DetektExtension> {
config.setFrom(rootProject.files("detekt.yml"))
buildUponDefaultConfig = true
}
publishing.repositories.maven("https://packages.jetbrains.team/maven/p/reflekt/reflekt") {
name = "SpacePackages"
credentials {
username = System.getenv("JB_SPACE_CLIENT_ID").orEmpty()
password = System.getenv("JB_SPACE_CLIENT_SECRET").orEmpty()
}
}
}
configure<DiktatExtension> {
diktatConfigFile = rootProject.file("diktat-analysis.yml")
inputs {
include("./*.kts")
}
}
tasks.register("diktatCheckAll") {
group = LifecycleBasePlugin.VERIFICATION_GROUP
allprojects {
[email protected](tasks.getByName("diktatCheck"))
}
[email protected](gradle.includedBuild("using-embedded-kotlin").task(":diktatCheckAll"))
}
tasks.register("diktatFixAll") {
group = LifecycleBasePlugin.VERIFICATION_GROUP
allprojects {
[email protected](tasks.getByName("diktatFix"))
}
[email protected](gradle.includedBuild("using-embedded-kotlin").task(":diktatFixAll"))
}
subprojects {
publishing.publications.create<MavenPublication>("mavenJava") {
from([email protected]["java"])
pom {
description = rootProject.description
inceptionYear = "2020"
url = "https://github.com/JetBrains-Research/reflekt"
licenses {
license {
comments = "Open-source license"
distribution = "repo"
name = "Apache License"
url = "https://github.com/JetBrains-Research/reflekt/blob/master/LICENSE"
}
}
scm {
connection = "scm:git:[email protected]:JetBrains-Research/reflekt.git"
developerConnection = "scm:git:[email protected]:JetBrains-Research/reflekt.git"
url = "[email protected]:JetBrains-Research/reflekt.git"
}
}
}
}
for (it in listOf("publishAllPublicationsToSpacePackagesRepository", "publishToMavenLocal")) {
tasks[it].dependsOn(
gradle.includedBuild("using-embedded-kotlin").task(":reflekt-core:$it"),
gradle.includedBuild("using-embedded-kotlin").task(":reflekt-dsl:$it"),
gradle.includedBuild("using-embedded-kotlin").task(":gradle-plugin:$it"),
)
}