Skip to content

Commit a69c564

Browse files
author
pepc84
committed
Fix rebuild-jar.py re-glob after build; invokeAndWait for old g++ dialog
1 parent 474c4ce commit a69c564

3 files changed

Lines changed: 23 additions & 18 deletions

File tree

mode/CppMode.jar

59 Bytes
Binary file not shown.

scripts/rebuild-jar.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ def main():
7373
if os.path.exists(p): _shutil.rmtree(p)
7474
run([gradlew, ":java:compileJava", ":java:jar", "--no-daemon"], cwd=processing4_dir)
7575

76+
_c2 = glob.glob(os.path.join(libs_dir, "java.jar")) + glob.glob(os.path.join(libs_dir, "java-*.jar"))
77+
if _c2: java_jar = _c2[0]
7678
if not os.path.exists(java_jar):
7779
print(f"ERROR: expected jar not found at {java_jar}")
7880
sys.exit(1)

src/java/CppBuild.java

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -509,25 +509,28 @@ public File compile(RunnerListener listener) throws Exception {
509509
String gpp = findGpp(isWindows);
510510

511511
int gppVer = gppMajorVersion(gpp);
512-
if (gppVer > 0 && gppVer < 7) {
513-
listener.statusError("g++ " + gppVer + " is too old (need 7+). See dialog.");
512+
if (gppVer > 0 && gppVer < 99) { // SIMULATION
513+
listener.statusError("g++ " + gppVer + " is too old need GCC 7+ for C++17.");
514514
boolean isWin2 = isWindows;
515-
javax.swing.SwingUtilities.invokeLater(() -> {
516-
Object[] opts = {"Update g++", "Cancel"};
517-
int ch = javax.swing.JOptionPane.showOptionDialog(null,
518-
"<html><b>g++ " + gppVer + " is too old.</b><br><br>"
519-
+ "CppMode requires GCC 7 or newer for C++17 support.<br>"
520-
+ "Your version: <b>GCC " + gppVer + "</b><br><br>"
521-
+ (isWin2 ? "Click <b>Update g++</b> to download the latest portable GCC."
522-
: "Please update g++ using your system package manager.") + "</html>",
523-
"g++ Too Old",
524-
javax.swing.JOptionPane.DEFAULT_OPTION,
525-
javax.swing.JOptionPane.ERROR_MESSAGE,
526-
null, opts, opts[0]);
527-
if (ch == 0 && isWin2) {
528-
try { InstallWizard.run(listener); } catch (Exception ignored2) {}
529-
}
530-
});
515+
final int[] choice = {-1};
516+
try {
517+
javax.swing.SwingUtilities.invokeAndWait(() -> {
518+
Object[] opts = {"Update g++", "Cancel"};
519+
choice[0] = javax.swing.JOptionPane.showOptionDialog(null,
520+
"<html><b>g++ " + gppVer + " is too old.</b><br><br>"
521+
+ "CppMode requires GCC 7 or newer for C++17 support.<br>"
522+
+ "Your version: <b>GCC " + gppVer + "</b><br><br>"
523+
+ (isWin2 ? "Click <b>Update g++</b> to download the latest portable GCC."
524+
: "Please update g++ using your system package manager.") + "</html>",
525+
"g++ Too Old",
526+
javax.swing.JOptionPane.DEFAULT_OPTION,
527+
javax.swing.JOptionPane.ERROR_MESSAGE,
528+
null, opts, opts[0]);
529+
});
530+
} catch (Exception ignored2) {}
531+
if (choice[0] == 0 && isWin2) {
532+
try { InstallWizard.run(listener); } catch (Exception ignored3) {}
533+
}
531534
throw new Exception("g++ too old: " + gppVer);
532535
}
533536

0 commit comments

Comments
 (0)