Skip to content
This repository was archived by the owner on Dec 20, 2022. It is now read-only.

Commit 8e1c532

Browse files
committed
moved gradle plugin to buildSrc
1 parent b40b6a6 commit 8e1c532

File tree

11 files changed

+49
-54
lines changed

11 files changed

+49
-54
lines changed

Contact.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ Created by Jens Klingenberg
22
* www.jensklingenberg.de
33

44

5-
Feel free to contact me:
5+
Contact:
66
77
* Twitter: [@jklingenberg_](https://twitter.com/jklingenberg_)

annotations/build.gradle

-12
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ kotlin {
4040
commonMain {
4141
dependencies {
4242
implementation kotlin('stdlib-common')
43-
implementation "io.ktor:ktor-client-core:1.2.3"
4443

4544
}
4645
}
@@ -54,7 +53,6 @@ kotlin {
5453
jsMain {
5554
dependencies {
5655
implementation kotlin('stdlib-js')
57-
implementation "io.ktor:ktor-client-js:1.2.3"
5856

5957
}
6058
}
@@ -67,7 +65,6 @@ kotlin {
6765
jvmMain {
6866
dependencies {
6967
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
70-
implementation "io.ktor:ktor-client-okhttp:1.2.3"
7168
}
7269
}
7370
jsTest {
@@ -80,15 +77,6 @@ kotlin {
8077
}
8178

8279

83-
task hello3(type: Exec) {
84-
doFirst {
85-
println 'start gradle....'
86-
}
87-
commandLine 'gradle',':annotations:install'
88-
doLast {
89-
println 'end gradle....'
90-
}
91-
}
9280

9381

9482
build.finalizedBy(publishToMavenLocal)
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
buildscript {
2+
ext.kotlin_version = '1.3.50'
3+
4+
5+
repositories {
6+
mavenCentral()
7+
8+
jcenter()
9+
}
10+
dependencies {
11+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
12+
classpath 'com.github.jengelman.gradle.plugins:shadow:5.0.0'
13+
}
14+
15+
allprojects {
16+
repositories {
17+
mavenCentral()
18+
mavenLocal()
19+
jcenter()
20+
}
21+
}
22+
}
23+
24+
125
plugins {
226
id 'org.jetbrains.kotlin.jvm' version '1.3.50'
327
}
@@ -10,22 +34,8 @@ group = "de.jensklingenberg"
1034
archivesBaseName = "mpapt-gradle"
1135
version = "1.0.0"
1236

13-
repositories {
14-
// The org.jetbrains.kotlin.jvm plugin requires a repository
15-
// where to download the Kotlin compiler dependencies from.
16-
jcenter()
17-
}
1837

1938

20-
allprojects {
21-
repositories {
22-
mavenLocal()
23-
mavenCentral()
24-
maven { url "https://maven.google.com" }
25-
maven { url "https://plugins.gradle.org/m2/" }
26-
}
27-
}
28-
2939
install {
3040
repositories.mavenInstaller {
3141
pom.artifactId = 'mpapt-gradle'
@@ -43,7 +53,12 @@ gradlePlugin {
4353

4454
dependencies {
4555
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
46-
implementation "org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.3.50"
56+
compile "org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.3.50"
4757
compileOnly "com.google.auto.service:auto-service:1.0-rc6"
4858
kapt "com.google.auto.service:auto-service:1.0-rc6"
4959
}
60+
61+
62+
build {
63+
dependsOn install
64+
}

gradle-plugin/src/main/java/de/jensklingenberg/mpapt/MpAptGradlePlugin.kt buildSrc/src/main/kotlin/de/jensklingenberg/mpapt/MpAptGradlePlugin.kt

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ import org.gradle.api.Project
44

55
open class MpAptGradlePlugin : org.gradle.api.Plugin<Project> {
66
override fun apply(project: Project) {
7-
project.extensions.create(
8-
"ktorfit",
9-
TestCompilerExtension::class.java
10-
)
7+
118
}
129
}
1310

gradle-plugin/src/main/java/de/jensklingenberg/mpapt/MpAptGradleSubplugin.kt buildSrc/src/main/kotlin/de/jensklingenberg/mpapt/MpAptGradleSubplugin.kt

+5-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class MpAptGradleSubplugin : KotlinGradleSubplugin<AbstractCompile> {
2323
?: TestCompilerExtension()
2424

2525
val enabledOption = SubpluginOption(key = "enabled", value = extension.enabled.toString())
26-
return listOf(enabledOption)
26+
return emptyList()
2727

2828
}
2929

@@ -42,9 +42,9 @@ class MpAptGradleSubplugin : KotlinGradleSubplugin<AbstractCompile> {
4242
version = "0.0.1" // remember to bump this version before any release!
4343
)
4444

45-
override fun getNativeCompilerPluginArtifact()=SubpluginArtifact(
46-
groupId = "de.jensklingenberg",
47-
artifactId = "kotlin-compiler-native-plugin",
48-
version = "0.0.1" // remember to bump this version before any release!
45+
override fun getNativeCompilerPluginArtifact() = SubpluginArtifact(
46+
groupId = "de.jensklingenberg",
47+
artifactId = "kotlin-compiler-native-plugin",
48+
version = "0.0.1" // remember to bump this version before any release!
4949
)
5050
}

example/build.gradle

-13
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ buildscript {
1717

1818
}
1919

20-
2120
plugins {
2221
id 'org.jetbrains.kotlin.multiplatform' version '1.3.50'
2322
}
@@ -70,7 +69,6 @@ kotlin {
7069
commonMain {
7170
dependencies {
7271
implementation kotlin('stdlib-common')
73-
implementation "io.ktor:ktor-client-core:1.2.3"
7472
implementation project(":annotations")
7573

7674
}
@@ -86,7 +84,6 @@ kotlin {
8684
jsMain {
8785
dependencies {
8886
implementation kotlin('stdlib-js')
89-
implementation "io.ktor:ktor-client-js:1.2.3"
9087

9188
}
9289
}
@@ -99,7 +96,6 @@ kotlin {
9996
jvmMain {
10097
dependencies {
10198
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
102-
implementation "io.ktor:ktor-client-okhttp:1.2.3"
10399
}
104100
}
105101
jvmTest {
@@ -120,15 +116,6 @@ kotlin {
120116
}
121117

122118

123-
build {
124-
125-
dependsOn ':kotlin-plugin:install'
126-
127-
dependsOn ':gradle-plugin:install'
128-
dependsOn ':kotlin-compiler-native-plugin:build'
129-
130-
131-
}
132119

133120
// workaround for https://youtrack.jetbrains.com/issue/KT-27170
134121
configurations {

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ org.gradle.configureondemand=false
55
kotlin.compiler.execution.strategy=in-process
66
kotlin.daemon.debug.log=true
77
org.gradle.jvmargs=-Xmx6g -XX:MaxPermSize=1024m
8-
kotlin.native.jvmArgs=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5006
8+
//kotlin.native.jvmArgs=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5006
99
gnsp.disableApplyOnlyOnRootProjectEnforcement
1010

1111
SONATYPE_NEXUS_USERNAME=

kotlin-compiler-native-plugin/build.gradle

+5
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,14 @@ kapt {
101101

102102
install{
103103
dependsOn(shadowJar)
104+
104105
}
105106

106107
build{
108+
dependsOn ':kotlin-plugin-shared:install'
109+
107110
dependsOn(shadowJar)
111+
112+
108113
finalizedBy(publishToMavenLocal)
109114
}

kotlin-plugin-shared/build.gradle

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ archivesBaseName = "kotlin-plugin-shared"
2929
version = "0.0.1"
3030

3131
install {
32+
dependsOn ':mpapt-runtime:install'
33+
3234
repositories.mavenInstaller {
3335
pom.artifactId = archivesBaseName
3436
}
@@ -40,7 +42,7 @@ repositories {
4042
}
4143

4244
dependencies {
43-
compile 'de.jensklingenberg:mpapt-runtime:0.8.0'
45+
compile project(':mpapt-runtime')
4446
compile "de.jensklingenberg.mpapt.testAnnotations:annotations-jvm:0.0.1"
4547
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
4648
compileOnly "org.jetbrains.kotlin:kotlin-compiler-embeddable"

kotlin-plugin-shared/src/main/java/de/jensklingenberg/MpAptTestProcessor.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.module
1212
class MpAptTestProcessor(configuration: CompilerConfiguration) : AbstractProcessor(configuration) {
1313
val TAG = "MyAnnotationProcessor"
1414

15+
val testFunction = TestFunction::class.java.name
1516
val testProperty = TestProperty::class.java.name
1617
val testValueParameter = TestValueParameter::class.java.name
1718
val testPropertyGetter = TestPropertyGetter::class.java.name
@@ -82,7 +83,7 @@ class MpAptTestProcessor(configuration: CompilerConfiguration) : AbstractProcess
8283
}
8384

8485

85-
override fun getSupportedAnnotationTypes(): Set<String> = setOf(TestClass::class.java.name, TestFunction::class.java.name)
86+
override fun getSupportedAnnotationTypes(): Set<String> = setOf(TestClass::class.java.name, testFunction, testProperty,testValueParameter,testPropertyGetter,testPropertySetter,testConstructor,testLocalVariable)
8687

8788
override fun processingOver() {
8889
log("$TAG***Processor over ***")

settings.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include ':gradle-plugin'
1+
22
include 'annotations'
33
include 'example'
44
include ':kotlin-compiler-native-plugin'

0 commit comments

Comments
 (0)