Skip to content

Commit 0d3795f

Browse files
committed
Gradle Runner, more variables
1 parent ab38e5f commit 0d3795f

File tree

5 files changed

+41
-10
lines changed

5 files changed

+41
-10
lines changed

app/build.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,9 +482,8 @@ tasks.register("signResources"){
482482
}
483483
file(composeResources("Info.plist")).delete()
484484
}
485-
486-
487485
}
486+
488487
afterEvaluate {
489488
tasks.named("prepareAppResources").configure {
490489
dependsOn(

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,19 @@ class GradleService(val editor: Editor) {
213213
"workingDir" to workingDir.toAbsolutePath().toString(),
214214
"settings" to Platform.getSettingsFolder().absolutePath.toString(),
215215
"unsaved" to unsaved.joinToString(","),
216-
"debugPort" to debugPort.toString()
216+
"debugPort" to debugPort.toString(),
217+
"present" to false, // TODO: Implement
218+
"fullscreen" to false, // TODO: Implement
219+
"display" to 1, // TODO: Implement
220+
"external" to true,
221+
"editor.location" to editor.location.let { "${it.x},${it.y}" },
222+
//"awt.disable" to false,
223+
//"window.color" to "0xFF000000", // TODO: Implement
224+
//"stop.color" to "0xFF000000", // TODO: Implement
225+
"stop.hide" to false, // TODO: Implement
226+
"sketch.folder" to folder.absolutePath,
227+
//"location" to "0,0",
228+
//"ui.scale" to "1.0",
217229
)
218230
val repository = Platform.getContentFile("repository").absolutePath
219231

core/src/processing/core/PApplet.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ public class PApplet implements PConstants {
705705
protected boolean exitCalled;
706706

707707
// ok to be static because it's not possible to mix enabled/disabled
708-
static protected boolean disableAWT;
708+
static protected boolean disableAWT = System.getProperty("processing.awt.disable", "false").equals("true");;
709709

710710
// messages to send if attached as an external vm
711711

@@ -9932,19 +9932,21 @@ static public void runSketch(final String[] args,
99329932
System.exit(1);
99339933
}
99349934

9935-
boolean external = false;
9936-
int[] location = null;
9937-
int[] editorLocation = null;
9935+
boolean external = System.getProperty("processing.external", "false").equals("true");;
9936+
int[] location = System.getProperty("processing.location", null) != null ?
9937+
parseInt(split(System.getProperty("processing.location"), ',')) : null;
99389938

9939+
int[] editorLocation = System.getProperty("processing.editor.location", null) != null ?
9940+
parseInt(split(System.getProperty("processing.editor.location"), ',')) : null;
99399941
String name = null;
99409942
int windowColor = 0;
99419943
int stopColor = 0xff808080;
9942-
boolean hideStop = false;
9944+
boolean hideStop = System.getProperty("processing.stop.hide", "false").equals("true");
99439945

99449946
int displayNum = -1; // use default
99459947
boolean present = System.getProperty("processing.present", "false").equals("true");
99469948
boolean fullScreen = System.getProperty("processing.fullscreen", "false").equals("true");
9947-
float uiScale = 0;
9949+
float uiScale = parseInt(System.getProperty("processing.uiScale", "0"), 0);
99489950

99499951
String param, value;
99509952
String folder = calcSketchPath();

java/gradle/src/main/kotlin/ProcessingPlugin.kt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,14 @@ class ProcessingPlugin @Inject constructor(private val objectFactory: ObjectFact
142142
description = "Creates a distributable version of the Processing sketch"
143143

144144
dependsOn("createDistributable")
145-
doLast {
145+
146+
}
147+
}
148+
149+
project.afterEvaluate {
150+
// Copy the result of create distributable to the project directory
151+
project.tasks.named("createDistributable") { task ->
152+
task.doLast {
146153
project.copy {
147154
it.from(project.tasks.named("createDistributable").get().outputs.files)
148155
it.into(project.layout.projectDirectory)
@@ -151,6 +158,13 @@ class ProcessingPlugin @Inject constructor(private val objectFactory: ObjectFact
151158
}
152159
}
153160

161+
// Move the processing variables into javaexec tasks so they can be used in the sketch as well
162+
project.tasks.withType(JavaExec::class.java).configureEach { task ->
163+
project.properties
164+
.filterKeys { it.startsWith("processing") }
165+
.forEach { (key, value) -> task.systemProperty(key, value) }
166+
}
167+
154168
project.extensions.getByType(JavaPluginExtension::class.java).sourceSets.all { sourceSet ->
155169
// For each java source set (mostly main) add a new source set for the PDE files
156170
val pdeSourceSet = objectFactory.newInstance(

java/gradle/src/main/kotlin/ProcessingTask.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ abstract class ProcessingTask : SourceTask() {
5757
javaFile.close()
5858

5959
// Scan all the libaries in the sketchbook
60+
// TODO: Move scanning the libraries to a separate task to avoid running this every time
6061
val libraries = File(sketchBook, "libraries")
6162
.listFiles { file -> file.isDirectory }
6263
?.map { folder ->
@@ -106,6 +107,9 @@ abstract class ProcessingTask : SourceTask() {
106107
// Write the dependencies to a file
107108
val deps = File(outputDirectory, "$sketchName.dependencies")
108109
deps.writeText(dependencies.joinToString("\n") { it.absolutePath })
110+
111+
// TODO: Add to the dependencies
112+
val renderer = meta.sketchRenderer
109113
}
110114

111115
@get:Inject

0 commit comments

Comments
 (0)