Skip to content

Commit 9680832

Browse files
committed
Merge branch 'gradle-runner-final' of https://github.com/Stefterv/processing4 into gradle-runner-final
2 parents 0b58942 + 8d96813 commit 9680832

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

core/src/processing/core/PGraphics.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4768,7 +4768,7 @@ public void text(char[] chars, int start, int stop, float x, float y) {
47684768
}
47694769

47704770
// int start = 0;
4771-
int index = 0;
4771+
int index = start;
47724772
while (index < stop) { //length) {
47734773
if (chars[index] == '\n') {
47744774
textLineAlignImpl(chars, start, index, x, y);

java/gradle/build.gradle.kts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,16 @@ publishing{
4646
}
4747
tasks.withType<Test>().configureEach {
4848
systemProperty("project.group", project(":java").group)
49+
}
50+
51+
tasks.register("writeVersion") {
52+
// make the version available to the plugin at runtime by writing it to a properties file in the resources directory
53+
doLast {
54+
val file = layout.buildDirectory.file("resources/main/version.properties").get().asFile
55+
file.parentFile.mkdirs()
56+
file.writeText("version=${project.version}")
57+
}
58+
}
59+
tasks.named("processResources") {
60+
dependsOn("writeVersion")
4961
}

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ class ProcessingPlugin @Inject constructor(private val objectFactory: ObjectFact
2020
val sketchName = project.layout.projectDirectory.asFile.name.replace(Regex("[^a-zA-Z0-9_]"), "_")
2121

2222
val isProcessing = project.findProperty("processing.version") != null
23-
val processingVersion = project.findProperty("processing.version") as String? ?: "4.3.4"
23+
val processingVersion = project.findProperty("processing.version") as String?
24+
?: javaClass.classLoader.getResourceAsStream("version.properties")?.use { stream ->
25+
java.util.Properties().apply { load(stream) }.getProperty("version")
26+
} ?: "4.3.4"
2427
val processingGroup = project.findProperty("processing.group") as String? ?: "org.processing"
2528
val workingDir = project.findProperty("processing.workingDir") as String?
2629
val debugPort = project.findProperty("processing.debugPort") as String?

0 commit comments

Comments
 (0)