mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Hot Reloading plugin
This commit is contained in:
@@ -24,7 +24,7 @@ dependencies{
|
||||
// TODO: CI/CD for publishing the plugin to the Gradle Plugin Portal
|
||||
gradlePlugin{
|
||||
plugins{
|
||||
create("processing"){
|
||||
create("processing.java"){
|
||||
id = "org.processing.java"
|
||||
implementationClass = "org.processing.java.gradle.ProcessingPlugin"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
plugins {
|
||||
`java-gradle-plugin`
|
||||
kotlin("jvm") version libs.versions.kotlin
|
||||
alias(libs.plugins.gradlePublish)
|
||||
|
||||
}
|
||||
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies{
|
||||
implementation("org.jetbrains.compose.hot-reload:hot-reload-gradle-plugin:1.0.0-beta03")
|
||||
}
|
||||
|
||||
gradlePlugin{
|
||||
plugins{
|
||||
create("processing.java.hotreload"){
|
||||
id = "org.processing.java.hotreload"
|
||||
implementationClass = "org.processing.java.gradle.ProcessingHotReloadPlugin"
|
||||
}
|
||||
}
|
||||
}
|
||||
publishing{
|
||||
repositories{
|
||||
mavenLocal()
|
||||
maven {
|
||||
name = "App"
|
||||
url = uri(project(":app").layout.buildDirectory.dir("resources-bundled/common/repository").get().asFile.absolutePath)
|
||||
}
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package org.processing.java.gradle
|
||||
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.tasks.GradleBuild
|
||||
import org.jetbrains.compose.reload.gradle.ComposeHotReloadPlugin
|
||||
import org.jetbrains.compose.reload.gradle.ComposeHotRun
|
||||
|
||||
class ProcessingHotReloadPlugin: Plugin<Project> {
|
||||
override fun apply(project: Project) {
|
||||
project.plugins.apply(ComposeHotReloadPlugin::class.java)
|
||||
|
||||
project.repositories.google()
|
||||
|
||||
project.afterEvaluate {
|
||||
project.tasks.named("hotRun", ComposeHotRun::class.java){ task ->
|
||||
task.isAutoReloadEnabled.set(true)
|
||||
}
|
||||
project.tasks.named("run").configure { task ->
|
||||
task.dependsOn("hotRun")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,25 +59,6 @@ class ProcessingPlugin @Inject constructor(private val objectFactory: ObjectFact
|
||||
// Add the compose plugin to wrap the sketch in an executable
|
||||
project.plugins.apply("org.jetbrains.compose")
|
||||
|
||||
val propertiesFile = project.layout.projectDirectory.file("sketch.properties")
|
||||
if (propertiesFile.asFile.exists()) {
|
||||
val properties = Properties()
|
||||
properties.load(propertiesFile.asFile.inputStream())
|
||||
|
||||
val pluginsSetting = properties.getProperty("sketch.plugins")
|
||||
if (pluginsSetting != null && pluginsSetting.isNotEmpty()) {
|
||||
val plugins = pluginsSetting.split(",").map { it.trim() }
|
||||
|
||||
plugins.forEach { pluginId ->
|
||||
// Apply the plugin to the project, equivalent of
|
||||
// plugins {
|
||||
// id("org.processing.java.hotreload")
|
||||
// }
|
||||
project.plugins.apply(pluginId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add the Processing core library (within Processing from the internal maven repo and outside from the internet), equivalent of
|
||||
// dependencies {
|
||||
// implementation("org.processing:core:4.3.4")
|
||||
|
||||
Reference in New Issue
Block a user