Skip to content

Commit 921b3be

Browse files
authored
Merge branch 'main' into all-contributors/add-pnngocdoan
2 parents 50b344c + 9a6728f commit 921b3be

File tree

8 files changed

+150
-41
lines changed

8 files changed

+150
-41
lines changed

.all-contributorsrc

Lines changed: 66 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,8 @@
350350
"avatar_url": "https://avatars.githubusercontent.com/u/3434564?v=4",
351351
"profile": "https://github.com/joshgiesbrecht",
352352
"contributions": [
353-
"code"
353+
"code",
354+
"bug"
354355
]
355356
},
356357
{
@@ -1569,24 +1570,70 @@
15691570
"doc"
15701571
]
15711572
},
1572-
{
1573-
"login": "AhmedMagedC",
1574-
"name": "AhmedMaged",
1575-
"avatar_url": "https://avatars.githubusercontent.com/u/111961041?v=4",
1576-
"profile": "https://github.com/AhmedMagedC",
1577-
"contributions": [
1578-
"code"
1579-
]
1580-
},
1581-
{
1582-
"login": "pnngocdoan",
1583-
"name": "Ngoc Doan",
1584-
"avatar_url": "https://avatars.githubusercontent.com/u/113954980?v=4",
1585-
"profile": "https://github.com/pnngocdoan",
1586-
"contributions": [
1587-
"code"
1588-
]
1589-
}
1573+
{
1574+
"login": "AhmedMagedC",
1575+
"name": "AhmedMaged",
1576+
"avatar_url": "https://avatars.githubusercontent.com/u/111961041?v=4",
1577+
"profile": "https://github.com/AhmedMagedC",
1578+
"contributions": [
1579+
"code"
1580+
]
1581+
},
1582+
{
1583+
"login": "ThexXTURBOXx",
1584+
"name": "Nico Mexis",
1585+
"avatar_url": "https://avatars.githubusercontent.com/u/12763829?v=4",
1586+
"profile": "http://nmexis.me",
1587+
"contributions": [
1588+
"code"
1589+
]
1590+
},
1591+
{
1592+
"login": "tychedelia",
1593+
"name": "charlotte 🌸",
1594+
"avatar_url": "https://avatars.githubusercontent.com/u/10366310?v=4",
1595+
"profile": "http://charlotte.fyi",
1596+
"contributions": [
1597+
"review"
1598+
]
1599+
},
1600+
{
1601+
"login": "jdebou",
1602+
"name": "Joackim de Bourqueney",
1603+
"avatar_url": "https://avatars.githubusercontent.com/u/80685479?v=4",
1604+
"profile": "http://i-j.fr",
1605+
"contributions": [
1606+
"code"
1607+
]
1608+
},
1609+
{
1610+
"login": "toniab",
1611+
"name": "Tonz",
1612+
"avatar_url": "https://avatars.githubusercontent.com/u/370199?v=4",
1613+
"profile": "https://github.com/toniab",
1614+
"contributions": [
1615+
"code",
1616+
"doc"
1617+
]
1618+
},
1619+
{
1620+
"login": "aj-m",
1621+
"name": "Andrew",
1622+
"avatar_url": "https://avatars.githubusercontent.com/u/2524348?v=4",
1623+
"profile": "https://github.com/aj-m",
1624+
"contributions": [
1625+
"code"
1626+
]
1627+
},
1628+
{
1629+
"login": "pnngocdoan",
1630+
"name": "Ngoc Doan",
1631+
"avatar_url": "https://avatars.githubusercontent.com/u/113954980?v=4",
1632+
"profile": "https://github.com/pnngocdoan",
1633+
"contributions": [
1634+
"code"
1635+
]
1636+
}
15901637
],
15911638
"repoType": "github",
15921639
"repoHost": "https://github.com",

BUILD.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ First, [download the IntelliJ IDEA Community Edition](https://www.jetbrains.com/
1212
1. Clone the Processing4 repository to your machine locally
1313
1. Open the cloned repository in IntelliJ IDEA CE
1414
1. When prompted, select **Trust Project**. You can preview the project in Safe Mode but you won't be able to build Processing.
15-
1. IntelliJ may start loading Gradle dependencies automatically. Wait for this process to complete.
15+
1. IntelliJ may ask if you want to load Gradle project. If you allow this, make sure you are using JDK version 17.
1616
1. In the main menu, go to File > Project Structure > Project Settings > Project.
1717
1. In the SDK Dropdown option, select a JDK version 17 or Download the jdk
1818
1. Click the green Run Icon in the top right of the window. This is also where you can find the option to debug Processing.
@@ -130,6 +130,8 @@ The main task to run or debug the PDE is `run`. That means you just need to run
130130
131131
If your main concern is with the `Core` you don't need to build and start the whole PDE to test your changes. In IntelliJ IDEA you can select any of the sketches in `core/examples/src/.../` to run by click on the green arrow next to their main functions. This will just compile core and the example sketch. Feel free to create additional examples for your new functionality.
132132

133+
If you are specifically trying to run the `Processing CLI`, you can test commands from `app/test/Processing.app/CLITest`.
134+
133135
## Troubleshooting and Setup Tips (IntelliJ IDEA)
134136

135137
If you’re building Processing using IntelliJ IDEA and something’s not working, here are a few things that might help:

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ _Note: due to GitHub's limitations, this repository's [Contributors](https://git
124124
<td align="center" valign="top" width="16.66%"><a href="https://github.com/dhowe"><img src="https://avatars.githubusercontent.com/u/737638?v=4?s=120" width="120px;" alt="Daniel Howe"/><br /><sub><b>Daniel Howe</b></sub></a><br /><a href="https://github.com/processing/processing4/commits?author=dhowe" title="Code">💻</a></td>
125125
</tr>
126126
<tr>
127-
<td align="center" valign="top" width="16.66%"><a href="https://github.com/joshgiesbrecht"><img src="https://avatars.githubusercontent.com/u/3434564?v=4?s=120" width="120px;" alt="Josh Giesbrecht"/><br /><sub><b>Josh Giesbrecht</b></sub></a><br /><a href="https://github.com/processing/processing4/commits?author=joshgiesbrecht" title="Code">💻</a></td>
127+
<td align="center" valign="top" width="16.66%"><a href="https://github.com/joshgiesbrecht"><img src="https://avatars.githubusercontent.com/u/3434564?v=4?s=120" width="120px;" alt="Josh Giesbrecht"/><br /><sub><b>Josh Giesbrecht</b></sub></a><br /><a href="https://github.com/processing/processing4/commits?author=joshgiesbrecht" title="Code">💻</a> <a href="https://github.com/processing/processing4/issues?q=author%3Ajoshgiesbrecht" title="Bug reports">🐛</a></td>
128128
<td align="center" valign="top" width="16.66%"><a href="https://liquidex.house/"><img src="https://avatars.githubusercontent.com/u/16415678?v=4?s=120" width="120px;" alt="liquidex"/><br /><sub><b>liquidex</b></sub></a><br /><a href="https://github.com/processing/processing4/commits?author=liquidev" title="Code">💻</a></td>
129129
<td align="center" valign="top" width="16.66%"><a href="https://github.com/bgc"><img src="https://avatars.githubusercontent.com/u/516129?v=4?s=120" width="120px;" alt="bgc"/><br /><sub><b>bgc</b></sub></a><br /><a href="https://github.com/processing/processing4/commits?author=bgc" title="Code">💻</a></td>
130130
<td align="center" valign="top" width="16.66%"><a href="https://umair.io/"><img src="https://avatars.githubusercontent.com/u/3191547?v=4?s=120" width="120px;" alt="Mohammad Umair"/><br /><sub><b>Mohammad Umair</b></sub></a><br /><a href="https://github.com/processing/processing4/commits?author=omerjerk" title="Code">💻</a></td>
@@ -304,6 +304,13 @@ _Note: due to GitHub's limitations, this repository's [Contributors](https://git
304304
<td align="center" valign="top" width="16.66%"><a href="https://github.com/Vaivaswat2244"><img src="https://avatars.githubusercontent.com/u/113991324?v=4?s=120" width="120px;" alt="Vaivaswat Dubey"/><br /><sub><b>Vaivaswat Dubey</b></sub></a><br /><a href="https://github.com/processing/processing4/commits?author=Vaivaswat2244" title="Code">💻</a></td>
305305
<td align="center" valign="top" width="16.66%"><a href="https://www.cbi-games.org"><img src="https://avatars.githubusercontent.com/u/37940266?v=4?s=120" width="120px;" alt="jSdCool"/><br /><sub><b>jSdCool</b></sub></a><br /><a href="https://github.com/processing/processing4/commits?author=jSdCool" title="Code">💻</a> <a href="https://github.com/processing/processing4/commits?author=jSdCool" title="Documentation">📖</a></td>
306306
<td align="center" valign="top" width="16.66%"><a href="https://github.com/AhmedMagedC"><img src="https://avatars.githubusercontent.com/u/111961041?v=4?s=120" width="120px;" alt="AhmedMaged"/><br /><sub><b>AhmedMaged</b></sub></a><br /><a href="https://github.com/processing/processing4/commits?author=AhmedMagedC" title="Code">💻</a></td>
307+
<td align="center" valign="top" width="16.66%"><a href="http://nmexis.me"><img src="https://avatars.githubusercontent.com/u/12763829?v=4?s=120" width="120px;" alt="Nico Mexis"/><br /><sub><b>Nico Mexis</b></sub></a><br /><a href="https://github.com/processing/processing4/commits?author=ThexXTURBOXx" title="Code">💻</a></td>
308+
<td align="center" valign="top" width="16.66%"><a href="http://charlotte.fyi"><img src="https://avatars.githubusercontent.com/u/10366310?v=4?s=120" width="120px;" alt="charlotte 🌸"/><br /><sub><b>charlotte 🌸</b></sub></a><br /><a href="https://github.com/processing/processing4/pulls?q=is%3Apr+reviewed-by%3Atychedelia" title="Reviewed Pull Requests">👀</a></td>
309+
</tr>
310+
<tr>
311+
<td align="center" valign="top" width="16.66%"><a href="http://i-j.fr"><img src="https://avatars.githubusercontent.com/u/80685479?v=4?s=120" width="120px;" alt="Joackim de Bourqueney"/><br /><sub><b>Joackim de Bourqueney</b></sub></a><br /><a href="https://github.com/processing/processing4/commits?author=jdebou" title="Code">💻</a></td>
312+
<td align="center" valign="top" width="16.66%"><a href="https://github.com/toniab"><img src="https://avatars.githubusercontent.com/u/370199?v=4?s=120" width="120px;" alt="Tonz"/><br /><sub><b>Tonz</b></sub></a><br /><a href="https://github.com/processing/processing4/commits?author=toniab" title="Code">💻</a> <a href="https://github.com/processing/processing4/commits?author=toniab" title="Documentation">📖</a></td>
313+
<td align="center" valign="top" width="16.66%"><a href="https://github.com/aj-m"><img src="https://avatars.githubusercontent.com/u/2524348?v=4?s=120" width="120px;" alt="Andrew"/><br /><sub><b>Andrew</b></sub></a><br /><a href="https://github.com/processing/processing4/commits?author=aj-m" title="Code">💻</a></td>
307314
<td align="center" valign="top" width="16.66%"><a href="https://github.com/pnngocdoan"><img src="https://avatars.githubusercontent.com/u/113954980?v=4?s=120" width="120px;" alt="Ngoc Doan"/><br /><sub><b>Ngoc Doan</b></sub></a><br /><a href="https://github.com/processing/processing4/commits?author=pnngocdoan" title="Code">💻</a></td>
308315
</tr>
309316
</tbody>

app/src/processing/app/Processing.kt

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,30 +59,22 @@ class LSP: SuspendingCliktCommand("lsp"){
5959
}
6060
}
6161

62-
class LegacyCLI(val args: Array<String>): SuspendingCliktCommand( "cli"){
63-
override fun help(context: Context) = "Legacy processing-java command line interface"
62+
63+
class LegacyCLI(val args: Array<String>): SuspendingCliktCommand("cli") {
64+
override val treatUnknownOptionsAsArgs = true
6465

6566
val help by option("--help").flag()
66-
val build by option("--build").flag()
67-
val run by option("--run").flag()
68-
val present by option("--present").flag()
69-
val sketch: String? by option("--sketch")
70-
val force by option("--force").flag()
71-
val output: String? by option("--output")
72-
val export by option("--export").flag()
73-
val noJava by option("--no-java").flag()
74-
val variant: String? by option("--variant")
67+
val arguments by argument().multiple(default = emptyList())
7568

76-
override suspend fun run(){
77-
val cliArgs = args.filter { it != "cli" }
69+
override suspend fun run() {
7870
try {
79-
if(build){
71+
if (arguments.contains("--build")) {
8072
System.setProperty("java.awt.headless", "true")
8173
}
82-
// Indirect invocation since app does not depend on java mode
74+
8375
Class.forName("processing.mode.java.Commander")
8476
.getMethod("main", Array<String>::class.java)
85-
.invoke(null, *arrayOf<Any>(cliArgs.toTypedArray()))
77+
.invoke(null, arguments.toTypedArray())
8678
} catch (e: Exception) {
8779
throw InternalError("Failed to invoke main method", e)
8880
}

app/src/processing/app/ui/Editor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2665,7 +2665,7 @@ public int getStatusMode() {
26652665
* Clear the status area.
26662666
*/
26672667
public void statusEmpty() {
2668-
statusNotice(EMPTY);
2668+
status.empty();
26692669
}
26702670

26712671

@@ -2736,6 +2736,7 @@ public void highlight(Problem p) {
27362736
}
27372737

27382738
int tabIndex = p.getTabIndex();
2739+
sketch.setCurrentCode(tabIndex); // so we are looking at the right offsets below
27392740
int lineNumber = p.getLineNumber();
27402741
int lineStart = textarea.getLineStartOffset(lineNumber);
27412742
int lineEnd = textarea.getLineStopOffset(lineNumber);

app/test/processing/app/CLITest.kt

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package processing.app
2+
3+
import java.io.File
4+
import kotlin.test.Test
5+
6+
/*
7+
This class is used to test the CLI commands of the Processing IDE.
8+
It mostly exists to quickly run CLI commands without having to specify run configurations
9+
or to manually run it on the command line.
10+
11+
In IntelliJ IDEA, it should display runnable arrows next to each test method.
12+
Use this to quickly test the CLI commands.
13+
The output will be displayed in the console after `Running CLI with arguments: ...`.
14+
When developing on the CLI commands, feel free to add more test methods here.
15+
*/
16+
class CLITest {
17+
18+
@Test
19+
fun testLSP(){
20+
runCLIWithArguments("lsp")
21+
}
22+
23+
@Test
24+
fun testLegacyCLI(){
25+
runCLIWithArguments("cli --help")
26+
}
27+
28+
/*
29+
This function runs the CLI with the given arguments.
30+
*/
31+
fun runCLIWithArguments(args: String) {
32+
// TODO: Once Processing PDE correctly builds in IntelliJ IDEA switch over to using the code directly
33+
// To see if the PDE builds correctly can be tested by running the Processing.kt main function directly in IntelliJ IDEA
34+
// Set the JAVA_HOME environment variable to the JDK used by the IDE
35+
println("Running CLI with arguments: $args")
36+
val process = ProcessBuilder("./gradlew", "run", "--args=$args", "--quiet")
37+
.directory(File(System.getProperty("user.dir")).resolve("../../../"))
38+
.inheritIO()
39+
40+
process.environment().apply {
41+
put("JAVA_HOME", System.getProperty("java.home"))
42+
}
43+
44+
val result = process
45+
.start()
46+
.waitFor()
47+
println("Done running CLI with arguments: $args (Result: $result)")
48+
49+
}
50+
}

app/windows/Processing.wxs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<Feature Id="MainApplication" Title="Processing" Level="1">
1414
<Files Include="..\build\compose\binaries\main\app\Processing\**" />
1515
<ComponentRef Id="ApplicationShortcut" />
16+
<ComponentRef Id="PathComponent" />
1617
</Feature>
1718
<Directory Id="ProgramMenuFolder">
1819
<Directory Id="ApplicationProgramsFolder" Name="Processing"/>
@@ -31,5 +32,13 @@
3132
<RemoveFolder Id="CleanUpShortCut" Directory="ApplicationProgramsFolder" On="uninstall"/>
3233
<RegistryValue Root="HKCU" Key="Software\Processing Foundation\Processing" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
3334
</Component>
35+
<Component Id="PathComponent" Guid="795b17d1-6e67-4581-9588-1f80a73c1428">
36+
<Environment Id="AddProcessingToPath"
37+
Action="set"
38+
Name="Path"
39+
Part="last"
40+
Value="[INSTALLFOLDER]">
41+
</Environment>
42+
</Component>
3443
</Package>
3544
</Wix>

java/src/processing/mode/java/runner/Runner.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -774,10 +774,11 @@ public static boolean handleCommonErrors(final String exceptionClass,
774774
err.println("and your code should be rewritten in a more efficient manner.");
775775

776776
} else if (exceptionClass.equals("java.lang.UnsupportedClassVersionError")) {
777+
int javaVersion = Runtime.version().feature();
777778
listener.statusError("UnsupportedClassVersionError: A library is using code compiled with an unsupported version of Java.");
778-
err.println("This version of Processing only supports libraries and JAR files compiled for Java 1.8 or earlier.");
779-
err.println("A library used by this sketch was compiled for Java 1.9 or later, ");
780-
err.println("and needs to be recompiled to be compatible with Java 1.8.");
779+
err.println("This version of Processing only supports libraries and JAR files compiled for Java " + javaVersion + " or earlier.");
780+
err.println("A library used by this sketch was compiled for Java " + (javaVersion + 1) + " or later, ");
781+
err.println("and needs to be recompiled to be compatible with Java " + javaVersion + ".");
781782

782783
} else if (exceptionClass.equals("java.lang.NoSuchMethodError") ||
783784
exceptionClass.equals("java.lang.NoSuchFieldError")) {

0 commit comments

Comments
 (0)