aboutsummaryrefslogtreecommitdiff
path: root/buildSrc/src/main/kotlin/FrostPlugin.kt
diff options
context:
space:
mode:
Diffstat (limited to 'buildSrc/src/main/kotlin/FrostPlugin.kt')
-rw-r--r--buildSrc/src/main/kotlin/FrostPlugin.kt38
1 files changed, 38 insertions, 0 deletions
diff --git a/buildSrc/src/main/kotlin/FrostPlugin.kt b/buildSrc/src/main/kotlin/FrostPlugin.kt
new file mode 100644
index 00000000..8e640f04
--- /dev/null
+++ b/buildSrc/src/main/kotlin/FrostPlugin.kt
@@ -0,0 +1,38 @@
+import com.moowork.gradle.node.NodeExtension
+import com.moowork.gradle.node.NodePlugin
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.kotlin.dsl.apply
+import org.gradle.kotlin.dsl.create
+
+class FrostPlugin : Plugin<Project> {
+
+ companion object {
+ private const val NODE_VERSION = "12.4.0"
+ }
+
+ override fun apply(project: Project) {
+ project.plugins.withId("java-base") {
+ project.applyWebGenPlugin()
+ }
+ project.gradle.taskGraph.whenReady {
+ if (!project.plugins.hasPlugin("java-base")) {
+ throw IllegalArgumentException(
+ "Frost plugin can't be applied without Android or Java or Kotlin plugin."
+ )
+ }
+ }
+ }
+
+ private fun Project.applyWebGenPlugin() {
+ setupNode()
+// tasks.create(WebGenInstallTask.NAME, WebGenInstallTask::class)
+ }
+
+ private fun Project.setupNode() {
+ plugins.apply(NodePlugin::class)
+ val nodeConfig = extensions.findByName("node") as NodeExtension
+ nodeConfig.download = true
+ nodeConfig.version = NODE_VERSION
+ }
+} \ No newline at end of file