Skip to content

Commit 1762b74

Browse files
committed
Simplified Gradle Service, improved sketch logging, fixed toolbar state
1 parent e6474e1 commit 1762b74

File tree

4 files changed

+26
-24
lines changed

4 files changed

+26
-24
lines changed

app/src/processing/app/gradle/GradleJob.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ class GradleJob{
5757
withCancellationToken(cancel.token())
5858
addStateListener()
5959
addDebugging()
60+
setStandardOutput(System.out)
6061
if(Base.DEBUG) {
61-
setStandardOutput(System.out)
6262
setStandardError(System.err)
6363
}
6464
run()
@@ -83,6 +83,7 @@ class GradleJob{
8383
":run" -> {
8484
state.value = State.RUNNING
8585
Messages.log("Start run")
86+
service?.editor?.toolbar?.activateRun()
8687
}
8788
}
8889

@@ -99,6 +100,8 @@ class GradleJob{
99100
}
100101
":run"->{
101102
state.value = State.NONE
103+
service?.editor?.toolbar?.deactivateRun()
104+
service?.editor?.toolbar?.deactivateStop()
102105
}
103106
}
104107
}

app/src/processing/app/gradle/GradleService.kt

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ package processing.app.gradle
22

33
import androidx.compose.runtime.mutableStateListOf
44
import androidx.compose.runtime.mutableStateOf
5+
import androidx.compose.runtime.snapshotFlow
6+
import kotlinx.coroutines.CoroutineScope
7+
import kotlinx.coroutines.Dispatchers
8+
import kotlinx.coroutines.launch
59
import org.gradle.tooling.BuildLauncher
610
import processing.app.Base
711
import processing.app.Language
@@ -46,38 +50,32 @@ class GradleService(
4650
val workingDir = createTempDirectory()
4751
val debugPort = (30_000..60_000).random()
4852

49-
// TODO: Add support for present
5053
fun run(){
51-
stopActions()
52-
53-
val job = GradleJob()
54-
job.service = this
55-
job.configure = {
56-
setup()
57-
forTasks("run")
58-
}
59-
jobs.add(job)
60-
job.start()
54+
startAction("run")
6155
}
6256

6357
fun export(){
58+
startAction("runDistributable")
59+
}
60+
61+
fun stop(){
6462
stopActions()
63+
}
64+
65+
private fun startAction(vararg tasks: String) {
66+
if(!active.value) return
6567

6668
val job = GradleJob()
6769
job.service = this
6870
job.configure = {
6971
setup()
70-
forTasks("runDistributable")
72+
forTasks(tasks.joinToString(" "))
7173
}
7274
jobs.add(job)
7375
job.start()
7476
}
7577

76-
fun stop(){
77-
stopActions()
78-
}
79-
80-
fun stopActions(){
78+
private fun stopActions(){
8179
jobs
8280
.forEach(GradleJob::cancel)
8381
}
@@ -108,7 +106,7 @@ class GradleService(
108106
"settings" to Platform.getSettingsFolder().absolutePath.toString(),
109107
"unsaved" to unsaved.joinToString(","),
110108
"debugPort" to debugPort.toString(),
111-
"fullscreen" to false, // TODO: Implement
109+
"fullscreen" to System.getProperty("processing.fullscreen", "false").equals("true"),
112110
"display" to 1, // TODO: Implement
113111
"external" to true,
114112
"location" to null, // TODO: Implement

app/src/processing/app/ui/EditorConsole.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,11 @@ private boolean suppressMessage(String what, boolean err) {
254254
// "java.lang.NoSuchMethodError: accessibilityHitTest"
255255
// https://github.com/processing/processing4/issues/368
256256
return true;
257+
} else if (what.contains("__MOVE__")) {
258+
// Don't display the "Move" message that is used to position the sketch window
259+
return true;
257260
}
261+
258262
} else { // !err
259263
if (what.contains("Listening for transport dt_socket at address")) {
260264
// Message from the JVM about the socket launch for debug

java/src/processing/mode/java/JavaEditor.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,8 @@ protected void handleLaunch(boolean present, boolean tweak) {
643643
toolbar.activateRun();
644644

645645
if(this.service.getEnabled()){
646+
System.setProperty("processing.fullscreen", present ? "true" : "false");
647+
System.setProperty("processing.tweak", tweak ? "true" : "false");
646648
this.service.run();
647649
return;
648650
}
@@ -676,12 +678,7 @@ protected void handleLaunch(boolean present, boolean tweak) {
676678
*/
677679
public void handleStop() {
678680
if(this.service.getEnabled()){
679-
// TODO: Improve Gradle UI Feedback
680-
toolbar.activateStop();
681681
this.service.stop();
682-
683-
toolbar.deactivateStop();
684-
toolbar.deactivateRun();
685682
return;
686683
}
687684

0 commit comments

Comments
 (0)