@@ -12,6 +12,7 @@ import processing.app.Base
12
12
import processing.app.Language
13
13
import processing.app.Messages
14
14
import processing.app.Platform
15
+ import processing.app.Preferences
15
16
import processing.app.gradle.helpers.ActionGradleJob
16
17
import processing.app.gradle.helpers.BackgroundGradleJob
17
18
import processing.app.ui.Editor
@@ -26,7 +27,6 @@ import kotlin.io.path.writeText
26
27
// TODO: PoC new debugger/tweak mode
27
28
// TODO: Allow for plugins to skip gradle entirely / new modes
28
29
// TODO: Improve background building
29
- // TODO: Rename to Service?
30
30
// TODO: Track build speed (for analytics?)
31
31
32
32
// The gradle service runs the gradle tasks and manages the gradle connection
@@ -35,7 +35,7 @@ import kotlin.io.path.writeText
35
35
// GradleJob manages the gradle build and connects the debugger
36
36
class GradleService (val editor : Editor ) {
37
37
val folder: File get() = editor.sketch.folder
38
- val active = mutableStateOf(true )
38
+ val active = mutableStateOf(Preferences .getBoolean( " run.use_gradle " ) )
39
39
40
40
val jobs = mutableStateListOf<GradleJob >()
41
41
val workingDir = kotlin.io.path.createTempDirectory()
@@ -45,7 +45,7 @@ class GradleService(val editor: Editor) {
45
45
46
46
private val scope = CoroutineScope (Dispatchers .IO )
47
47
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
49
49
fun getEnabled (): Boolean {
50
50
return active.value
51
51
}
@@ -101,6 +101,7 @@ class GradleService(val editor: Editor) {
101
101
}
102
102
// TODO: Stop all jobs on dispose
103
103
}
104
+ // TODO: Add support for present
104
105
fun run (){
105
106
stopActions()
106
107
editor.console.clear()
@@ -215,12 +216,13 @@ class GradleService(val editor: Editor) {
215
216
return @let Base .DEBUG
216
217
}
217
218
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" )
219
220
val header = """
220
221
// @processing-auto-generated mode=${editor.mode.title} version=${Base .getVersionName()}
221
222
//
222
223
""" .trimIndent()
223
224
225
+ // TODO: add instructions keys
224
226
val instructions = Language .text(" gradle.instructions" )
225
227
.split(" \n " )
226
228
.joinToString(" \n " ) { " // $it " }
0 commit comments