@@ -12,6 +12,7 @@ import processing.app.Base
1212import processing.app.Language
1313import processing.app.Messages
1414import processing.app.Platform
15+ import processing.app.Preferences
1516import processing.app.gradle.helpers.ActionGradleJob
1617import processing.app.gradle.helpers.BackgroundGradleJob
1718import processing.app.ui.Editor
@@ -26,7 +27,6 @@ import kotlin.io.path.writeText
2627// TODO: PoC new debugger/tweak mode
2728// TODO: Allow for plugins to skip gradle entirely / new modes
2829// TODO: Improve background building
29- // TODO: Rename to Service?
3030// TODO: Track build speed (for analytics?)
3131
3232// The gradle service runs the gradle tasks and manages the gradle connection
@@ -35,7 +35,7 @@ import kotlin.io.path.writeText
3535// GradleJob manages the gradle build and connects the debugger
3636class GradleService (val editor : Editor ) {
3737 val folder: File get() = editor.sketch.folder
38- val active = mutableStateOf(true )
38+ val active = mutableStateOf(Preferences .getBoolean( " run.use_gradle " ) )
3939
4040 val jobs = mutableStateListOf<GradleJob >()
4141 val workingDir = kotlin.io.path.createTempDirectory()
@@ -45,7 +45,7 @@ class GradleService(val editor: Editor) {
4545
4646 private val scope = CoroutineScope (Dispatchers .IO )
4747
48- // Hooks for java to check if the Gradle service is running
48+ // Hooks for java to check if the Gradle service is running since mutableStateOf is not accessible in java
4949 fun getEnabled (): Boolean {
5050 return active.value
5151 }
@@ -101,6 +101,7 @@ class GradleService(val editor: Editor) {
101101 }
102102 // TODO: Stop all jobs on dispose
103103 }
104+ // TODO: Add support for present
104105 fun run (){
105106 stopActions()
106107 editor.console.clear()
@@ -215,12 +216,13 @@ class GradleService(val editor: Editor) {
215216 return @let Base .DEBUG
216217 }
217218 if (generate) {
218- Messages .log(" build.gradle.kts not found or outdated in ${folder} , creating one" )
219+ Messages .log(" build.gradle.kts outdated or not found in ${folder} , creating one" )
219220 val header = """
220221 // @processing-auto-generated mode=${editor.mode.title} version=${Base .getVersionName()}
221222 //
222223 """ .trimIndent()
223224
225+ // TODO: add instructions keys
224226 val instructions = Language .text(" gradle.instructions" )
225227 .split(" \n " )
226228 .joinToString(" \n " ) { " // $it " }
0 commit comments