Skip to content

Commit 1aa671c

Browse files
committed
converter build gradle to kts
1 parent 7fd3f41 commit 1aa671c

File tree

10 files changed

+317
-211
lines changed

10 files changed

+317
-211
lines changed

build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
buildscript {
22

3-
ext.buildMaven = { p -> repositories { maven { url p } } }
4-
53
repositories {
64
mavenLocal()
75
google()

buildSrc/build.gradle

Lines changed: 0 additions & 26 deletions
This file was deleted.

buildSrc/build.gradle.kts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2+
3+
plugins {
4+
id("org.jetbrains.kotlin.jvm") version "1.8.0"
5+
}
6+
7+
allprojects {
8+
repositories {
9+
mavenLocal()
10+
mavenCentral()
11+
maven("https://maven.google.com")
12+
maven("https://plugins.gradle.org/m2/")
13+
}
14+
}
15+
16+
tasks.withType<KotlinCompile> {
17+
kotlinOptions.jvmTarget = "1.8"
18+
}
19+
20+
21+
22+
tasks.build {
23+
dependsOn(":compiler-plugin:kotlin-plugin:publishToMavenLocal")
24+
dependsOn(":compiler-plugin:kotlin-native-plugin:publishToMavenLocal")
25+
26+
dependsOn(":gradle-plugin:publishToMavenLocal")
27+
}

buildSrc/compiler-plugin/kotlin-native-plugin/build.gradle

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
22

33
plugins {
44
id("maven-publish")
5-
6-
id "org.jetbrains.kotlin.jvm"
7-
id "org.jetbrains.kotlin.kapt"
8-
5+
id("org.jetbrains.kotlin.jvm")
6+
id("org.jetbrains.kotlin.kapt")
97
}
108

119
group = "de.jensklingenberg"
@@ -40,9 +38,6 @@ publishing {
4038
from components.java
4139
}
4240
}
43-
repositories {
44-
45-
}
4641
}
4742

4843
tasks.withType(KotlinCompilationTask).configureEach {

buildSrc/gradle-plugin/build.gradle

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
plugins {
2+
kotlin("jvm")
3+
kotlin("kapt")
4+
id("java-gradle-plugin")
5+
`maven-publish`
6+
}
7+
8+
group = "de.jensklingenberg"
9+
version = "1.0.0"
10+
11+
12+
dependencies {
13+
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.8.0")
14+
}
15+
16+
gradlePlugin {
17+
plugins {
18+
19+
create("simplePlugin") {
20+
id = "compiler.gradleplugin.helloworld" // users will do `apply plugin: "compiler.plugin.helloworld"`
21+
implementationClass = "de.jensklingenberg.gradle.HelloWorldGradleSubPlugin" // entry-point class
22+
}
23+
}
24+
}
25+
26+
tasks.register("sourcesJar", Jar::class) {
27+
group = "build"
28+
description = "Assembles Kotlin sources"
29+
30+
archiveClassifier.set("sources")
31+
from(sourceSets.main.get().allSource)
32+
dependsOn(tasks.classes)
33+
}
34+
35+
publishing {
36+
publications {
37+
create<MavenPublication>("default") {
38+
from(components["java"])
39+
artifact(tasks["sourcesJar"])
40+
//artifact(tasks["dokkaJar"])
41+
42+
pom {
43+
name.set(project.name)
44+
description.set("KSP Plugin for Ktorfit")
45+
url.set("https://github.com/Foso/Ktorfit")
46+
47+
licenses {
48+
license {
49+
name.set("Apache License 2.0")
50+
url.set("https://github.com/Foso/Ktorfit/blob/master/LICENSE.txt")
51+
}
52+
}
53+
scm {
54+
url.set("https://github.com/Foso/Ktorfit")
55+
connection.set("scm:git:git://github.com/Foso/Ktorfit.git")
56+
}
57+
developers {
58+
developer {
59+
name.set("Jens Klingenberg")
60+
url.set("https://github.com/Foso")
61+
}
62+
}
63+
}
64+
}
65+
}
66+
67+
repositories {
68+
if (
69+
hasProperty("sonatypeUsername") &&
70+
hasProperty("sonatypePassword") &&
71+
hasProperty("sonatypeSnapshotUrl") &&
72+
hasProperty("sonatypeReleaseUrl")
73+
) {
74+
maven {
75+
val url = when {
76+
"SNAPSHOT" in version.toString() -> property("sonatypeSnapshotUrl")
77+
else -> property("sonatypeReleaseUrl")
78+
} as String
79+
setUrl(url)
80+
credentials {
81+
username = property("sonatypeUsername") as String
82+
password = property("sonatypePassword") as String
83+
}
84+
}
85+
}
86+
}
87+
}

0 commit comments

Comments
 (0)