Skip to content

Commit

Permalink
Revert JDK upgrade to implement separately
Browse files Browse the repository at this point in the history
  • Loading branch information
rmartin16 committed Aug 1, 2023
1 parent a7abd96 commit e147b56
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
8 changes: 4 additions & 4 deletions src/briefcase/integrations/java.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class JDK(ManagedTool):
# As of 12 May 2023, 17.0.7+7 is the current OpenJDK
# https://adoptium.net/temurin/releases/
JDK_MAJOR_VER = "17"
JDK_RELEASE = "17.0.8"
JDK_RELEASE = "17.0.7"
JDK_BUILD = "7"
JDK_INSTALL_DIR_NAME = f"java{JDK_MAJOR_VER}"

Expand Down Expand Up @@ -75,15 +75,15 @@ def version_from_path(cls, tools: ToolCache, java_path: str | Path) -> str:
:param tools: ToolCache of available tools
:param java_path: File path to a candidate JDK install
:return: JDK release version; e.g. "17.0.8"
:return: JDK release version; e.g. "17.0.7"
"""
output = tools.subprocess.check_output(
[
os.fsdecode(Path(java_path) / "bin" / "javac"),
"-version",
],
)
# javac's output should look like "javac 17.0.8\n"
# javac's output should look like "javac 17.0.7\n"
return output.strip("\n").split(" ")[1]

@classmethod
Expand Down Expand Up @@ -303,7 +303,7 @@ def install(self):

jdk_zip_path.unlink() # Zip file no longer needed once unpacked.

# The tarball will unpack into <briefcase data dir>/tools/jdk-17.0.8+7
# The tarball will unpack into <briefcase data dir>/tools/jdk-17.0.7+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 = (
Expand Down
12 changes: 6 additions & 6 deletions tests/integrations/java/test_JDK__upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def rmtree(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.8+7").mkdir(parents=True)
(tmp_path / "tools" / "jdk-17.0.7+7").mkdir(parents=True)

# Create an SDK wrapper
jdk = JDK(mock_tools, java_home=java_home)
Expand All @@ -79,7 +79,7 @@ def rmtree(path):
# A download was initiated
mock_tools.download.file.assert_called_with(
url="https://github.com/adoptium/temurin17-binaries/releases/download/"
"jdk-17.0.8+7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.8_7.tar.gz",
"jdk-17.0.7+7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.7_7.tar.gz",
download_path=tmp_path / "tools",
role="Java 17 JDK",
)
Expand Down Expand Up @@ -114,7 +114,7 @@ def rmtree(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.8+7").mkdir(parents=True)
(tmp_path / "tools" / "jdk-17.0.7+7").mkdir(parents=True)

# Create an SDK wrapper
jdk = JDK(mock_tools, java_home=java_home)
Expand All @@ -128,7 +128,7 @@ def rmtree(path):
# A download was initiated
mock_tools.download.file.assert_called_with(
url="https://github.com/adoptium/temurin17-binaries/releases/download/"
"jdk-17.0.8+7/OpenJDK17U-jdk_x64_mac_hotspot_17.0.8_7.tar.gz",
"jdk-17.0.7+7/OpenJDK17U-jdk_x64_mac_hotspot_17.0.7_7.tar.gz",
download_path=tmp_path / "tools",
role="Java 17 JDK",
)
Expand Down Expand Up @@ -170,7 +170,7 @@ def rmtree(path):
# A download was initiated
mock_tools.download.file.assert_called_with(
url="https://github.com/adoptium/temurin17-binaries/releases/download/"
"jdk-17.0.8+7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.8_7.tar.gz",
"jdk-17.0.7+7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.7_7.tar.gz",
download_path=tmp_path / "tools",
role="Java 17 JDK",
)
Expand Down Expand Up @@ -212,7 +212,7 @@ def rmtree(path):
# A download was initiated
mock_tools.download.file.assert_called_with(
url="https://github.com/adoptium/temurin17-binaries/releases/download/"
"jdk-17.0.8+7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.8_7.tar.gz",
"jdk-17.0.7+7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.7_7.tar.gz",
download_path=tmp_path / "tools",
role="Java 17 JDK",
)
Expand Down
28 changes: 14 additions & 14 deletions tests/integrations/java/test_JDK__verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,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.8\n",
"javac 17.0.7\n",
]

# Create a JDK wrapper by verification
Expand Down Expand Up @@ -179,7 +179,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.8\n"
mock_tools.subprocess.check_output.return_value = "javac 17.0.7\n"

# Create a JDK wrapper by verification
JDK.verify(mock_tools)
Expand All @@ -205,7 +205,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.8\n"
mock_tools.subprocess.check_output.return_value = "javac 17.0.7\n"

# Create a JDK wrapper by verification
JDK.verify(mock_tools)
Expand Down Expand Up @@ -404,63 +404,63 @@ 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.8+7/OpenJDK17U-jdk_x64_mac_hotspot_17.0.8_7.tar.gz",
"jdk-17.0.7+7/OpenJDK17U-jdk_x64_mac_hotspot_17.0.7_7.tar.gz",
"java17/Contents/Home",
False,
),
(
"Darwin",
"arm64",
"https://github.com/adoptium/temurin17-binaries/releases/download/"
"jdk-17.0.8+7/OpenJDK17U-jdk_aarch64_mac_hotspot_17.0.8_7.tar.gz",
"jdk-17.0.7+7/OpenJDK17U-jdk_aarch64_mac_hotspot_17.0.7_7.tar.gz",
"java17/Contents/Home",
False,
),
(
"Linux",
"x86_64",
"https://github.com/adoptium/temurin17-binaries/releases/download/"
"jdk-17.0.8+7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.8_7.tar.gz",
"jdk-17.0.7+7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.7_7.tar.gz",
"java17",
False,
),
(
"Linux",
"aarch64",
"https://github.com/adoptium/temurin17-binaries/releases/download/"
"jdk-17.0.8+7/OpenJDK17U-jdk_aarch64_linux_hotspot_17.0.8_7.tar.gz",
"jdk-17.0.7+7/OpenJDK17U-jdk_aarch64_linux_hotspot_17.0.7_7.tar.gz",
"java17",
False,
),
(
"Linux",
"aarch64",
"https://github.com/adoptium/temurin17-binaries/releases/download/"
"jdk-17.0.8+7/OpenJDK17U-jdk_arm_linux_hotspot_17.0.8_7.tar.gz",
"jdk-17.0.7+7/OpenJDK17U-jdk_arm_linux_hotspot_17.0.7_7.tar.gz",
"java17",
True,
),
(
"Linux",
"armv7l",
"https://github.com/adoptium/temurin17-binaries/releases/download/"
"jdk-17.0.8+7/OpenJDK17U-jdk_arm_linux_hotspot_17.0.8_7.tar.gz",
"jdk-17.0.7+7/OpenJDK17U-jdk_arm_linux_hotspot_17.0.7_7.tar.gz",
"java17",
False,
),
(
"Linux",
"armv8l",
"https://github.com/adoptium/temurin17-binaries/releases/download/"
"jdk-17.0.8+7/OpenJDK17U-jdk_arm_linux_hotspot_17.0.8_7.tar.gz",
"jdk-17.0.7+7/OpenJDK17U-jdk_arm_linux_hotspot_17.0.7_7.tar.gz",
"java17",
False,
),
(
"Windows",
"AMD64",
"https://github.com/adoptium/temurin17-binaries/releases/download/"
"jdk-17.0.8+7/OpenJDK17U-jdk_x64_windows_hotspot_17.0.8_7.zip",
"jdk-17.0.7+7/OpenJDK17U-jdk_x64_windows_hotspot_17.0.7_7.zip",
"java17",
False,
),
Expand Down Expand Up @@ -492,7 +492,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.8+7").mkdir(parents=True)
(tmp_path / "tools" / "jdk-17.0.7+7").mkdir(parents=True)

# Invoke the verify call
JDK.verify(mock_tools)
Expand Down Expand Up @@ -547,7 +547,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.8+7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.8_7.tar.gz",
"jdk-17.0.7+7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.7_7.tar.gz",
download_path=tmp_path / "tools",
role="Java 17 JDK",
)
Expand Down Expand Up @@ -575,7 +575,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.8+7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.8_7.tar.gz",
"jdk-17.0.7+7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.7_7.tar.gz",
download_path=tmp_path / "tools",
role="Java 17 JDK",
)
Expand Down

0 comments on commit e147b56

Please sign in to comment.