Skip to content

Commit 30fe980

Browse files
update to 1.4.30
1 parent f567fd2 commit 30fe980

File tree

5 files changed

+33
-42
lines changed

5 files changed

+33
-42
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ buildscript {
1717

1818
}
1919
plugins {
20-
id 'org.jetbrains.kotlin.multiplatform' version '1.4.20'
20+
id 'org.jetbrains.kotlin.multiplatform' version '1.4.30'
2121
}
2222

2323

buildSrc/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id 'org.jetbrains.kotlin.jvm' version '1.4.20'
2+
id 'org.jetbrains.kotlin.jvm' version '1.4.30'
33
}
44
apply plugin: "maven"
55

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ gradlePlugin {
1919
plugins {
2020
simplePlugin {
2121
id = "compiler.plugin.helloworld" // users will do `apply plugin: "compiler.plugin.helloworld"`
22-
implementationClass = "de.jensklingenberg.gradle.HelloWorldGradlePlugin" // entry-point class
22+
implementationClass = "de.jensklingenberg.gradle.HelloWorldGradleSubPlugin" // entry-point class
2323
}
2424
}
2525
}
2626

2727
dependencies {
2828
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
29-
implementation "org.jetbrains.kotlin:kotlin-gradle-plugin-api"
29+
implementation "org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.4.21"
3030
compileOnly "com.google.auto.service:auto-service:1.0-rc4"
3131
kapt "com.google.auto.service:auto-service:1.0-rc4"
3232
}

buildSrc/compiler-plugin/gradle-plugin/src/main/java/de/jensklingenberg/gradle/HelloWorldGradlePlugin.kt

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

buildSrc/compiler-plugin/gradle-plugin/src/main/java/de/jensklingenberg/gradle/HelloWorldGradleSubplugin.kt

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,38 @@
11
package de.jensklingenberg.gradle
22

3-
import com.google.auto.service.AutoService
43
import org.gradle.api.Project
5-
import org.gradle.api.tasks.compile.AbstractCompile
6-
import org.jetbrains.kotlin.gradle.dsl.KotlinCommonOptions
4+
import org.gradle.api.provider.Provider
75
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
8-
import org.jetbrains.kotlin.gradle.plugin.KotlinGradleSubplugin
6+
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilerPluginSupportPlugin
97
import org.jetbrains.kotlin.gradle.plugin.SubpluginArtifact
108
import org.jetbrains.kotlin.gradle.plugin.SubpluginOption
119

12-
@AutoService(KotlinGradleSubplugin::class) // don't forget!
13-
class HelloWorldGradleSubplugin : KotlinGradleSubplugin<AbstractCompile> {
14-
override fun apply(
15-
project: Project,
16-
kotlinCompile: AbstractCompile,
17-
javaCompile: AbstractCompile?,
18-
variantData: Any?,
19-
androidProjectHandler: Any?,
20-
kotlinCompilation: KotlinCompilation<KotlinCommonOptions>?
21-
): List<SubpluginOption> {
22-
val extension = project.extensions.findByType(TestCompilerExtension::class.java)
23-
?: TestCompilerExtension()
10+
open class TestCompilerExtension {
11+
var enabled: Boolean = true
12+
}
2413

25-
val enabledOption = SubpluginOption(key = "enabled", value = extension.enabled.toString())
26-
return listOf(enabledOption)
14+
class HelloWorldGradleSubPlugin : KotlinCompilerPluginSupportPlugin {
2715

28-
}
16+
private var gradleExtension : TestCompilerExtension = TestCompilerExtension()
2917

30-
override fun isApplicable(project: Project, task: AbstractCompile) =
31-
project.plugins.hasPlugin(HelloWorldGradlePlugin::class.java)
18+
override fun applyToCompilation(kotlinCompilation: KotlinCompilation<*>): Provider<List<SubpluginOption>> {
19+
gradleExtension = kotlinCompilation.target.project.extensions.findByType(TestCompilerExtension::class.java)
20+
?: TestCompilerExtension()
21+
val project = kotlinCompilation.target.project
3222

23+
return project.provider {
24+
val options = mutableListOf<SubpluginOption>(SubpluginOption("enabled", gradleExtension.enabled.toString()))
25+
options
26+
}
27+
}
28+
29+
override fun apply(target: Project) {
30+
target.extensions.create(
31+
"helloWorld",
32+
TestCompilerExtension::class.java
33+
)
34+
super.apply(target)
35+
}
3336

3437
/**
3538
* Just needs to be consistent with the key for CommandLineProcessor#pluginId
@@ -42,7 +45,11 @@ class HelloWorldGradleSubplugin : KotlinGradleSubplugin<AbstractCompile> {
4245
version = "0.0.1" // remember to bump this version before any release!
4346
)
4447

45-
override fun getNativeCompilerPluginArtifact(): SubpluginArtifact = SubpluginArtifact(
48+
override fun isApplicable(kotlinCompilation: KotlinCompilation<*>): Boolean {
49+
return true
50+
}
51+
52+
override fun getPluginArtifactForNative(): SubpluginArtifact = SubpluginArtifact(
4653
groupId = "de.jensklingenberg",
4754
artifactId = "kotlin-compiler-native-plugin",
4855
version = "0.0.1" // remember to bump this version before any release!

0 commit comments

Comments
 (0)