generated from cortinico/kotlin-gradle-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make compatible with org.jetbrains.kotlin.multiplatform
- Loading branch information
1 parent
8fcaa6b
commit 05bc446
Showing
2 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
plugin-build/plugin/bin/main/io/github/izhangzhihao/unmeta/UnmetaPlugin.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package io.github.izhangzhihao.unmeta | ||
|
||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
|
||
class UnmetaPlugin : Plugin<Project> { | ||
|
||
private lateinit var extension: UnmetaExtension | ||
|
||
override fun apply(project: Project) { | ||
extension = project.extensions.create("unmeta", UnmetaExtension::class.java, project) | ||
val unmetaTaskTask = project.tasks.create("unmeta", UnmetaTask::class.java) | ||
unmetaTaskTask.enable.set(extension.enable) | ||
@Suppress("SwallowedException") | ||
val t = try { | ||
project.tasks.getByName("compileKotlin") | ||
} catch (e: org.gradle.api.UnknownTaskException) { | ||
project.tasks.getByName("compileKotlinJvm") | ||
} | ||
t.finalizedBy(unmetaTaskTask) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters