Skip to content

Commit 911c211

Browse files
committed
build/qg-xxx: дедуплицированы общие настройки подпроектов
1 parent 3899a21 commit 911c211

File tree

3 files changed

+32
-58
lines changed

3 files changed

+32
-58
lines changed

app/build.gradle.kts

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import kotlinx.kover.gradle.plugin.dsl.AggregationType
22
import kotlinx.kover.gradle.plugin.dsl.CoverageUnit
3-
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
4-
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
53

64
plugins {
7-
alias(libs.plugins.kotlin)
85
alias(libs.plugins.kotlin.spring)
96

107
alias(libs.plugins.spring.dependencyManagement)
@@ -19,16 +16,6 @@ plugins {
1916
group = "pro.qyoga"
2017
version = "0.0.1-SNAPSHOT"
2118

22-
java {
23-
toolchain {
24-
languageVersion.set(JavaLanguageVersion.of(21))
25-
}
26-
}
27-
28-
repositories {
29-
mavenCentral()
30-
}
31-
3219
dependencies {
3320
implementation(kotlin("reflect"))
3421
implementation("org.springframework.boot:spring-boot-starter-data-jdbc")
@@ -99,24 +86,10 @@ dependencies {
9986
}
10087
}
10188

102-
tasks.withType<KotlinCompile> {
103-
kotlin {
104-
compilerOptions {
105-
freeCompilerArgs = listOf("-Xjsr305=strict", "-Xjvm-default=all", "-Xwhen-guards")
106-
jvmTarget.set(JvmTarget.JVM_21)
107-
}
108-
}
109-
}
110-
11189
tasks.getByName<org.springframework.boot.gradle.tasks.bundling.BootJar>("bootJar") {
11290
this.archiveFileName.set("qyoga.jar")
11391
}
11492

115-
tasks.withType<Test> {
116-
this.systemProperty("file.encoding", "utf-8")
117-
useJUnitPlatform()
118-
}
119-
12093
kover {
12194
currentProject {
12295
createVariant("Endpoints") {

build.gradle.kts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,38 @@
1+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
2+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
3+
14
plugins {
25
alias(libs.plugins.kotlin) apply false
36
alias(libs.plugins.spring.dependencyManagement) apply false
47
alias(libs.plugins.spring.boot) apply false
58
}
69

10+
// Почему-то внутри subprojects libs не доступен
11+
val kotlinPlugin = libs.plugins.kotlin.asProvider().get().pluginId
12+
13+
subprojects {
14+
apply(plugin = kotlinPlugin)
15+
16+
repositories {
17+
mavenCentral()
18+
}
19+
20+
configure<JavaPluginExtension> {
21+
toolchain {
22+
languageVersion.set(JavaLanguageVersion.of(21))
23+
}
24+
}
25+
26+
tasks.withType<KotlinCompile> {
27+
compilerOptions {
28+
freeCompilerArgs = listOf("-Xjsr305=strict", "-Xjvm-default=all", "-Xwhen-guards")
29+
jvmTarget.set(JvmTarget.JVM_21)
30+
}
31+
}
32+
33+
tasks.withType<Test> {
34+
this.systemProperty("file.encoding", "utf-8")
35+
useJUnitPlatform()
36+
}
37+
38+
}

e2e-tests/build.gradle.kts

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,6 @@
1-
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
2-
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
3-
4-
plugins {
5-
alias(libs.plugins.kotlin)
6-
}
7-
81
group = "pro.qyoga.e2e-tests"
92
version = "0.0.1-SNAPSHOT"
103

11-
java {
12-
toolchain {
13-
languageVersion.set(JavaLanguageVersion.of(21))
14-
}
15-
}
16-
17-
repositories {
18-
mavenCentral()
19-
}
20-
214
dependencies {
225
implementation(platform("org.springframework.boot:spring-boot-dependencies:${libs.versions.springBoot.get()}"))
236

@@ -29,20 +12,6 @@ dependencies {
2912
testImplementation(testLibs.testcontainers.selenium)
3013
}
3114

32-
tasks.withType<KotlinCompile> {
33-
kotlin {
34-
compilerOptions {
35-
freeCompilerArgs = listOf("-Xjsr305=strict", "-Xjvm-default=all")
36-
jvmTarget.set(JvmTarget.JVM_21)
37-
}
38-
}
39-
}
40-
41-
tasks.withType<Test> {
42-
this.systemProperty("file.encoding", "utf-8")
43-
useJUnitPlatform()
44-
}
45-
4615
tasks {
4716
named("test", Test::class) {
4817
systemProperties["selenide.browser"] = "chrome"

0 commit comments

Comments
 (0)