Skip to content

Commit cdec594

Browse files
committed
Added export support
1 parent 3ad3654 commit cdec594

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

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

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,28 @@ class GradleService(val editor: Editor) {
7575
cancel.cancel()
7676
}
7777

78+
fun export(){
79+
val connection = connection ?: return
80+
if(!preparing) preparation?.cancel()
81+
82+
run?.cancel()
83+
run = CoroutineScope(Dispatchers.IO).launch {
84+
running.value = true
85+
preparation?.join()
86+
cancel.cancel()
87+
cancel = GradleConnector.newCancellationTokenSource()
88+
try {
89+
connection.newSketchBuild()
90+
.forTasks("runDistributable")
91+
.withCancellationToken(cancel.token())
92+
.run()
93+
}catch (e: Exception){
94+
Messages.log(e.toString())
95+
}
96+
}
97+
run?.invokeOnCompletion { running.value = run?.isActive ?: false }
98+
}
99+
78100
fun startService(){
79101
Messages.log("Starting Gradle service at ${folder}")
80102

@@ -151,7 +173,12 @@ class GradleService(val editor: Editor) {
151173
finishedTasks.add(name)
152174
}
153175
})
154-
// .setStandardOutput(System.out)
176+
.apply {
177+
if(Base.DEBUG) {
178+
setStandardError(System.err)
179+
setStandardOutput(System.out)
180+
}
181+
}
155182
// .setJavaHome(Platform.getJavaHome())
156183
}
157184
}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,10 @@ public String getCommentPrefix() {
488488
* Handler for Sketch → Export Application
489489
*/
490490
public void handleExportApplication() {
491+
if(true){
492+
this.service.export();
493+
return;
494+
}
491495
if (handleExportCheckModified()) {
492496
statusNotice(Language.text("export.notice.exporting"));
493497
ExportPrompt ep = new ExportPrompt(this, () -> {
@@ -636,6 +640,10 @@ public void handleTweak() {
636640
}
637641

638642
protected void handleLaunch(boolean present, boolean tweak) {
643+
if(true){
644+
this.service.run();
645+
return;
646+
}
639647
prepareRun();
640648
toolbar.activateRun();
641649
synchronized (runtimeLock) {

0 commit comments

Comments
 (0)