From 1c945e892afdb6033aa705aa7f736759fd4805e3 Mon Sep 17 00:00:00 2001
From: Andrea <55388041+andrewinci@users.noreply.github.com>
Date: Sat, 12 Feb 2022 19:17:53 +0000
Subject: [PATCH] chore: Bumb javafx from 15 to 16 (#199)
* chore: Bumb javafx from 15 to 16
* Fix update4j config generation
---
app/build.gradle | 2 +-
scripts/build.py | 46 ++++++++++++++++++++++++++++++++++++++++----
scripts/constants.py | 36 ----------------------------------
scripts/helper.py | 7 ++++---
4 files changed, 47 insertions(+), 44 deletions(-)
delete mode 100644 scripts/constants.py
diff --git a/app/build.gradle b/app/build.gradle
index edf811f4..01d5306a 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -7,7 +7,7 @@ plugins {
}
javafx {
- version = "15.0.1"
+ version = "16"
modules = ['javafx.controls', 'javafx.graphics', 'javafx.fxml', 'javafx.swing']
}
diff --git a/scripts/build.py b/scripts/build.py
index 66798dca..6500c23c 100644
--- a/scripts/build.py
+++ b/scripts/build.py
@@ -1,6 +1,5 @@
import glob
import os
-from constants import header, footer, manual_dependencies
from helper import build_file
"""
@@ -10,10 +9,48 @@
python3.8 scripts/build.py
"""
+header = """
+
+
+
+
+
+
+
+
+
+ """
+
+footer = """
+"""
+
RELEASE = os.environ.get("RELEASE_VERSION")
insulator_jar = {
- "insulator.jar": f"https://github.com/andrewinci/Insulator/releases/download/{RELEASE}/insulator.jar"
+ "insulator.jar": {"uri": f"https://github.com/andrewinci/Insulator/releases/download/{RELEASE}/insulator.jar"}
+}
+
+os_specific_jar = {
+ "kotlinx-serialization-runtime-jvm-1.0-M1-1.4.0-rc.jar": { "uri": "https://repo1.maven.org/maven2/org/jetbrains/kotlinx/kotlinx-serialization-runtime-jvm/1.0-M1-1.4.0-rc/kotlinx-serialization-runtime-jvm-1.0-M1-1.4.0-rc.jar"},
+ # javafx for mac
+ "javafx-swing-16-mac.jar": {"uri": "https://repo1.maven.org/maven2/org/openjfx/javafx-swing/16/javafx-swing-16-mac.jar", "os":"mac"},
+ "javafx-graphics-16-mac.jar": {"uri": "https://repo1.maven.org/maven2/org/openjfx/javafx-graphics/16/javafx-graphics-16-mac.jar", "os":"mac"},
+ "javafx-base-16-mac.jar": {"uri": "https://repo1.maven.org/maven2/org/openjfx/javafx-base/16/javafx-base-16-mac.jar", "os":"mac"},
+ "javafx-controls-16-mac.jar": {"uri": "https://repo1.maven.org/maven2/org/openjfx/javafx-controls/16/javafx-controls-16-mac.jar", "os":"mac"},
+ "javafx-fxml-16-mac.jar": {"uri": "https://repo1.maven.org/maven2/org/openjfx/javafx-fxml/16/javafx-fxml-16-mac.jar", "os":"mac"},
+ # javafx for linux
+ "javafx-swing-16-linux.jar": {"uri": "https://repo1.maven.org/maven2/org/openjfx/javafx-swing/16/javafx-swing-16-linux.jar", "os": "linux"},
+ "javafx-graphics-16-linux.jar": {"uri": "https://repo1.maven.org/maven2/org/openjfx/javafx-graphics/16/javafx-graphics-16-linux.jar", "os": "linux"},
+ "javafx-base-16-linux.jar": {"uri": "https://repo1.maven.org/maven2/org/openjfx/javafx-base/16/javafx-base-16-linux.jar", "os": "linux"},
+ "javafx-controls-16-linux.jar": {"uri": "https://repo1.maven.org/maven2/org/openjfx/javafx-controls/16/javafx-controls-16-linux.jar", "os": "linux"},
+ "javafx-fxml-16-linux.jar": {"uri": "https://repo1.maven.org/maven2/org/openjfx/javafx-fxml/16/javafx-fxml-16-linux.jar", "os": "linux"},
+ # javafx for windows
+ "javafx-swing-16-win.jar": {"uri": "https://repo1.maven.org/maven2/org/openjfx/javafx-swing/16/javafx-swing-16-win.jar", "os": "win"},
+ "javafx-graphics-16-win.jar": {"uri": "https://repo1.maven.org/maven2/org/openjfx/javafx-graphics/16/javafx-graphics-16-win.jar", "os": "win"},
+ "javafx-base-16-win.jar": {"uri": "https://repo1.maven.org/maven2/org/openjfx/javafx-base/16/javafx-base-16-win.jar", "os": "win"},
+ "javafx-controls-16-win.jar": {"uri": "https://repo1.maven.org/maven2/org/openjfx/javafx-controls/16/javafx-controls-16-win.jar", "os": "win"},
+ "javafx-fxml-16-win.jar": {"uri": "https://repo1.maven.org/maven2/org/openjfx/javafx-fxml/16/javafx-fxml-16-win.jar", "os": "win"},
}
+
jars_path = "./app/build/distributions/app/lib/"
dependency_files = set(
@@ -24,12 +61,13 @@
for x in [open(f).readlines() for f in dependency_files]
for l in x
]
-dependency_map = {j: url for [j, url] in dependencies}
+dependency_map = {j: {"uri": url} for [j, url] in dependencies}
dependency_map.update(insulator_jar)
+dependency_map.update(os_specific_jar)
+
jars = [j.replace(jars_path, "") for j in glob.glob(f"{jars_path}*.jar")]
files = {j: build_file(jars_path + j, dependency_map.get(j)) for j in jars}
-files.update(manual_dependencies)
print("Writing new update4j config file")
with open("insulator-update.xml", "w") as config:
diff --git a/scripts/constants.py b/scripts/constants.py
deleted file mode 100644
index c03e1e39..00000000
--- a/scripts/constants.py
+++ /dev/null
@@ -1,36 +0,0 @@
-header = """
-
-
-
-
-
-
-
-
-
- """
-
-footer = """
-"""
-
-manual_dependencies = {
- "kotlinx-serialization-runtime-jvm-1.0-M1-1.4.0-rc.jar": '',
- # javafx for mac
- "javafx-swing-15.0.1-mac.jar": '',
- "javafx-graphics-15.0.1-mac.jar": '',
- "javafx-base-15.0.1-mac.jar": '',
- "javafx-controls-15.0.1-mac.jar": '',
- "javafx-fxml-15.0.1-mac.jar": '',
- # javafx for linux
- "javafx-swing-15.0.1-linux.jar": '',
- "javafx-graphics-15.0.1-linux.jar": '',
- "javafx-base-15.0.1-linux.jar": '',
- "javafx-controls-15.0.1-linux.jar": '',
- "javafx-fxml-15.0.1-linux.jar": '',
- # javafx for windows
- "javafx-swing-15.0.1-win.jar": '',
- "javafx-graphics-15.0.1-win.jar": '',
- "javafx-base-15.0.1-win.jar": '',
- "javafx-controls-15.0.1-win.jar": '',
- "javafx-fxml-15.0.1-win.jar": '',
-}
diff --git a/scripts/helper.py b/scripts/helper.py
index d504bdcd..e34989df 100644
--- a/scripts/helper.py
+++ b/scripts/helper.py
@@ -17,9 +17,10 @@ def adler(fname):
return hex(asum)[2:10].zfill(8).lower()
-def build_file(jar, url):
- if url is None:
+def build_file(jar, info):
+ if info["uri"] is None:
return None
hash = adler(jar)
size = os.path.getsize(jar)
- return f''
+ os_attr = ("os=\""+info["os"]+"\" ") if "os" in info else ""
+ return f''