Repository: beeware/briefcase
Pull request #1398 (2023-08-01 18:12:11)

Bump JDK from `17.0.7+7` to `17.0.8+7`
<!--- Describe your changes in detail -->
<!--- What problem does this change solve? -->
<!--- If this PR relates to an issue, include Refs #XXX or Fixes #XXX -->

## PR Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
- [X] All new features have been tested
- [X] All new features have been documented
- [X] I have read the **CONTRIBUTING.md** file
- [X] I will abide by the code of conduct



Patch:
diff --git a/changes/1398.feature.rst b/changes/1398.feature.rst
new file mode 100644
index 00000000..25d790ab
--- /dev/null
+++ b/changes/1398.feature.rst
@@ -0,0 +1,1 @@
+The Java JDK version was upgraded from 17.0.7+7 to 17.0.8+7.
diff --git a/src/briefcase/integrations/java.py b/src/briefcase/integrations/java.py
index 307848af..8ce7d775 100644
--- a/src/briefcase/integrations/java.py
+++ b/src/briefcase/integrations/java.py
@@ -13,10 +13,9 @@ class JDK(ManagedTool):
     name = "java"
     full_name = "Java JDK"
 
-    # As of 12 May 2023, 17.0.7+7 is the current OpenJDK
-    # https://adoptium.net/temurin/releases/
+    # Latest OpenJDK as of August 2023: https://adoptium.net/temurin/releases/
     JDK_MAJOR_VER = "17"
-    JDK_RELEASE = "17.0.7"
+    JDK_RELEASE = "17.0.8"
     JDK_BUILD = "7"
     JDK_INSTALL_DIR_NAME = f"java{JDK_MAJOR_VER}"
 
@@ -64,7 +63,7 @@ class JDK(ManagedTool):
 
         :param tools: ToolCache of available tools
         :param java_path: File path to a candidate JDK install
-        :return: JDK release version; e.g. "17.0.7"
+        :return: JDK release version; e.g. "17.0.X"
         """
         output = tools.subprocess.check_output(
             [
@@ -72,7 +71,7 @@ class JDK(ManagedTool):
                 "-version",
             ],
         )
-        # javac's output should look like "javac 17.0.7\n"
+        # javac's output should look like "javac 17.0.X\n"
         return output.strip("\n").split(" ")[1]
 
     @classmethod
@@ -292,7 +291,7 @@ Delete {jdk_zip_path} and run briefcase again.
 
             jdk_zip_path.unlink()  # Zip file no longer needed once unpacked.
 
-            # The tarball will unpack into <briefcase data dir>/tools/jdk-17.0.7+7
+            # The tarball will unpack into <briefcase data dir>/tools/jdk-17.0.X+7
             # (or whatever name matches the current release).
             # We turn this into <briefcase data dir>/tools/java so we have a consistent name.
             java_unpack_path = (


Test patch:
diff --git a/tests/integrations/java/conftest.py b/tests/integrations/java/conftest.py
index af3c3c49..71ec7dfb 100644
--- a/tests/integrations/java/conftest.py
+++ b/tests/integrations/java/conftest.py
@@ -6,6 +6,8 @@ from briefcase.integrations.base import ToolCache
 from briefcase.integrations.download import Download
 from briefcase.integrations.subprocess import Subprocess
 
+JDK_RELEASE = "17.0.8"
+
 
 @pytest.fixture
 def mock_tools(mock_tools, tmp_path) -> ToolCache:
diff --git a/tests/integrations/java/test_JDK__upgrade.py b/tests/integrations/java/test_JDK__upgrade.py
index b9c86fbc..920b1dfb 100644
--- a/tests/integrations/java/test_JDK__upgrade.py
+++ b/tests/integrations/java/test_JDK__upgrade.py
@@ -13,6 +13,8 @@ from briefcase.exceptions import (
 from briefcase.integrations.base import ToolCache
 from briefcase.integrations.java import JDK
 
+from .conftest import JDK_RELEASE
+
 
 @pytest.fixture
 def mock_tools(mock_tools) -> ToolCache:
@@ -65,7 +67,7 @@ def test_existing_install(mock_tools, tmp_path):
     mock_tools.download.file.return_value = archive
 
     # Create a directory to make it look like Java was downloaded and unpacked.
-    (tmp_path / "tools" / "jdk-17.0.7+7").mkdir(parents=True)
+    (tmp_path / "tools" / f"jdk-{JDK_RELEASE}+7").mkdir(parents=True)
 
     # Create an SDK wrapper
     jdk = JDK(mock_tools, java_home=java_home)
@@ -79,7 +81,7 @@ def test_existing_install(mock_tools, tmp_path):
     # A download was initiated
     mock_tools.download.file.assert_called_with(
         url="https://github.com/adoptium/temurin17-binaries/releases/download/"
-        "jdk-17.0.7+7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.7_7.tar.gz",
+        f"jdk-{JDK_RELEASE}+7/OpenJDK17U-jdk_x64_linux_hotspot_{JDK_RELEASE}_7.tar.gz",
         download_path=tmp_path / "tools",
         role="Java 17 JDK",
     )
@@ -114,7 +116,7 @@ def test_macOS_existing_install(mock_tools, tmp_path):
     mock_tools.download.file.return_value = archive
 
     # Create a directory to make it look like Java was downloaded and unpacked.
-    (tmp_path / "tools" / "jdk-17.0.7+7").mkdir(parents=True)
+    (tmp_path / "tools" / f"jdk-{JDK_RELEASE}+7").mkdir(parents=True)
 
     # Create an SDK wrapper
     jdk = JDK(mock_tools, java_home=java_home)
@@ -128,7 +130,7 @@ def test_macOS_existing_install(mock_tools, tmp_path):
     # A download was initiated
     mock_tools.download.file.assert_called_with(
         url="https://github.com/adoptium/temurin17-binaries/releases/download/"
-        "jdk-17.0.7+7/OpenJDK17U-jdk_x64_mac_hotspot_17.0.7_7.tar.gz",
+        f"jdk-{JDK_RELEASE}+7/OpenJDK17U-jdk_x64_mac_hotspot_{JDK_RELEASE}_7.tar.gz",
         download_path=tmp_path / "tools",
         role="Java 17 JDK",
     )
@@ -170,7 +172,7 @@ def test_download_fail(mock_tools, tmp_path):
     # A download was initiated
     mock_tools.download.file.assert_called_with(
         url="https://github.com/adoptium/temurin17-binaries/releases/download/"
-        "jdk-17.0.7+7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.7_7.tar.gz",
+        f"jdk-{JDK_RELEASE}+7/OpenJDK17U-jdk_x64_linux_hotspot_{JDK_RELEASE}_7.tar.gz",
         download_path=tmp_path / "tools",
         role="Java 17 JDK",
     )
@@ -212,7 +214,7 @@ def test_unpack_fail(mock_tools, tmp_path):
     # A download was initiated
     mock_tools.download.file.assert_called_with(
         url="https://github.com/adoptium/temurin17-binaries/releases/download/"
-        "jdk-17.0.7+7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.7_7.tar.gz",
+        f"jdk-{JDK_RELEASE}+7/OpenJDK17U-jdk_x64_linux_hotspot_{JDK_RELEASE}_7.tar.gz",
         download_path=tmp_path / "tools",
         role="Java 17 JDK",
     )
diff --git a/tests/integrations/java/test_JDK__verify.py b/tests/integrations/java/test_JDK__verify.py
index be74a75e..42a41c33 100644
--- a/tests/integrations/java/test_JDK__verify.py
+++ b/tests/integrations/java/test_JDK__verify.py
@@ -14,6 +14,8 @@ from briefcase.exceptions import (
 )
 from briefcase.integrations.java import JDK
 
+from .conftest import JDK_RELEASE
+
 CALL_JAVA_HOME = mock.call(["/usr/libexec/java_home"])
 
 
@@ -46,7 +48,7 @@ def test_macos_tool_java_home(mock_tools, capsys):
     # Mock 2 calls to check_output.
     mock_tools.subprocess.check_output.side_effect = [
         "/path/to/java",
-        "javac 17.0.7\n",
+        f"javac {JDK_RELEASE}\n",
     ]
 
     # Create a JDK wrapper by verification
@@ -167,7 +169,7 @@ def test_macos_provided_overrides_tool_java_home(mock_tools, capsys):
     mock_tools.os.environ = {"JAVA_HOME": "/path/to/java"}
 
     # Mock return value from javac. libexec won't be invoked.
-    mock_tools.subprocess.check_output.return_value = "javac 17.0.7\n"
+    mock_tools.subprocess.check_output.return_value = f"javac {JDK_RELEASE}\n"
 
     # Create a JDK wrapper by verification
     JDK.verify(mock_tools)
@@ -193,7 +195,7 @@ def test_valid_provided_java_home(mock_tools, capsys):
     mock_tools.os.environ = {"JAVA_HOME": "/path/to/java"}
 
     # Mock return value from javac.
-    mock_tools.subprocess.check_output.return_value = "javac 17.0.7\n"
+    mock_tools.subprocess.check_output.return_value = f"javac {JDK_RELEASE}\n"
 
     # Create a JDK wrapper by verification
     JDK.verify(mock_tools)
@@ -392,42 +394,42 @@ def test_unparseable_javac_version(mock_tools, host_os, java_home, tmp_path, cap
             "Darwin",
             "x86_64",
             "https://github.com/adoptium/temurin17-binaries/releases/download/"
-            "jdk-17.0.7+7/OpenJDK17U-jdk_x64_mac_hotspot_17.0.7_7.tar.gz",
+            f"jdk-{JDK_RELEASE}+7/OpenJDK17U-jdk_x64_mac_hotspot_{JDK_RELEASE}_7.tar.gz",
             "java17/Contents/Home",
         ),
         (
             "Darwin",
             "aarch64",
             "https://github.com/adoptium/temurin17-binaries/releases/download/"
-            "jdk-17.0.7+7/OpenJDK17U-jdk_aarch64_mac_hotspot_17.0.7_7.tar.gz",
+            f"jdk-{JDK_RELEASE}+7/OpenJDK17U-jdk_aarch64_mac_hotspot_{JDK_RELEASE}_7.tar.gz",
             "java17/Contents/Home",
         ),
         (
             "Linux",
             "x86_64",
             "https://github.com/adoptium/temurin17-binaries/releases/download/"
-            "jdk-17.0.7+7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.7_7.tar.gz",
+            f"jdk-{JDK_RELEASE}+7/OpenJDK17U-jdk_x64_linux_hotspot_{JDK_RELEASE}_7.tar.gz",
             "java17",
         ),
         (
             "Linux",
             "aarch64",
             "https://github.com/adoptium/temurin17-binaries/releases/download/"
-            "jdk-17.0.7+7/OpenJDK17U-jdk_aarch64_linux_hotspot_17.0.7_7.tar.gz",
+            f"jdk-{JDK_RELEASE}+7/OpenJDK17U-jdk_aarch64_linux_hotspot_{JDK_RELEASE}_7.tar.gz",
             "java17",
         ),
         (
             "Linux",
             "armv6l",
             "https://github.com/adoptium/temurin17-binaries/releases/download/"
-            "jdk-17.0.7+7/OpenJDK17U-jdk_arm_linux_hotspot_17.0.7_7.tar.gz",
+            f"jdk-{JDK_RELEASE}+7/OpenJDK17U-jdk_arm_linux_hotspot_{JDK_RELEASE}_7.tar.gz",
             "java17",
         ),
         (
             "Windows",
             "AMD64",
             "https://github.com/adoptium/temurin17-binaries/releases/download/"
-            "jdk-17.0.7+7/OpenJDK17U-jdk_x64_windows_hotspot_17.0.7_7.zip",
+            f"jdk-{JDK_RELEASE}+7/OpenJDK17U-jdk_x64_windows_hotspot_{JDK_RELEASE}_7.zip",
             "java17",
         ),
     ],
@@ -456,7 +458,7 @@ def test_successful_jdk_download(
     mock_tools.download.file.return_value = archive
 
     # Create a directory to make it look like Java was downloaded and unpacked.
-    (tmp_path / "tools" / "jdk-17.0.7+7").mkdir(parents=True)
+    (tmp_path / "tools" / f"jdk-{JDK_RELEASE}+7").mkdir(parents=True)
 
     # Invoke the verify call
     JDK.verify(mock_tools)
@@ -511,7 +513,7 @@ def test_jdk_download_failure(mock_tools, tmp_path):
     # That download was attempted
     mock_tools.download.file.assert_called_with(
         url="https://github.com/adoptium/temurin17-binaries/releases/download/"
-        "jdk-17.0.7+7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.7_7.tar.gz",
+        f"jdk-{JDK_RELEASE}+7/OpenJDK17U-jdk_x64_linux_hotspot_{JDK_RELEASE}_7.tar.gz",
         download_path=tmp_path / "tools",
         role="Java 17 JDK",
     )
@@ -539,7 +541,7 @@ def test_invalid_jdk_archive(mock_tools, tmp_path):
     # The download occurred
     mock_tools.download.file.assert_called_with(
         url="https://github.com/adoptium/temurin17-binaries/releases/download/"
-        "jdk-17.0.7+7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.7_7.tar.gz",
+        f"jdk-{JDK_RELEASE}+7/OpenJDK17U-jdk_x64_linux_hotspot_{JDK_RELEASE}_7.tar.gz",
         download_path=tmp_path / "tools",
         role="Java 17 JDK",
     )